From patchwork Mon Apr 8 13:05:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 2408501 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 468C1DFB78 for ; Mon, 8 Apr 2013 13:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935574Ab3DHNFQ (ORCPT ); Mon, 8 Apr 2013 09:05:16 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:33747 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935544Ab3DHNFP (ORCPT ); Mon, 8 Apr 2013 09:05:15 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Apr 2013 07:05:14 -0600 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 8 Apr 2013 07:05:12 -0600 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id C1FC56E8041 for ; Mon, 8 Apr 2013 09:05:08 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r38D5B3C313674 for ; Mon, 8 Apr 2013 09:05:11 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r38D5A7c000703 for ; Mon, 8 Apr 2013 09:05:11 -0400 Received: from localhost.localdomain (sig-9-65-183-218.mts.ibm.com [9.65.183.218]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r38D58DO000500; Mon, 8 Apr 2013 09:05:09 -0400 Message-Id: <201304081305.r38D58DO000500@d01av04.pok.ibm.com> Subject: [PATCH 2/2] powerpc: Set default VGA device To: linux-pci@vger.kernel.org Cc: bhelgaas@google.com, linuxppc-dev@lists.ozlabs.org, benh@kernel.crashing.org, lucaskt@linux.vnet.ibm.com, klebers@linux.vnet.ibm.com, brking@linux.vnet.ibm.com From: Brian King Date: Mon, 08 Apr 2013 08:05:10 -0500 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13040813-3620-0000-0000-000001EFDEBF Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add a PCI quirk for VGA devices on Power to set the default VGA device. Ensures a default VGA is always set if a graphics adapter is present, even if firmware did not initialize it. If more than one graphics adapter is present, ensure the one initialized by firmware is set as the default VGA device. This ensures that X autoconfiguration will work. Signed-off-by: Brian King --- arch/powerpc/kernel/pci-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff -puN arch/powerpc/kernel/pci-common.c~powerpc_vga_default_device arch/powerpc/kernel/pci-common.c --- linux/arch/powerpc/kernel/pci-common.c~powerpc_vga_default_device 2013-04-08 06:16:37.000000000 -0500 +++ linux-bjking1/arch/powerpc/kernel/pci-common.c 2013-04-08 06:16:37.000000000 -0500 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1725,3 +1726,15 @@ static void fixup_hide_host_resource_fsl } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); + +static void fixup_vga(struct pci_dev *pdev) +{ + u16 cmd; + + pci_read_config_word(pdev, PCI_COMMAND, &cmd); + if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device()) + vga_set_default_device(pdev); + +} +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);