[coreboot] New patch to review for coreboot: 255321a Fix multipleVGA cards resource conflict

Kerry Sheh (shekairui@gmail.com) gerrit at coreboot.org
Thu Dec 15 11:50:56 CET 2011


Kerry Sheh (shekairui at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/489

-gerrit

commit 255321a2d294747af779f24247db2a3583c5f48e
Author: Kerry Sheh <shekairui at gmail.com>
Date:   Thu Dec 15 19:30:50 2011 +0800

    Fix multipleVGA cards resource conflict
    
    If both graphic cards decode the IO 3B0-3DF and MEM A00000-BFFFF,
    Windows 7 complain a resource conflict, so only one VGA card can works
    at the same time.
    
    There is a discuss in coreboot mail list before,
    please reference thread: "how to prevent legacy resource conflictwith   multipleVGA cards"
    
    For the second graphic device, coreboot already disabled the
    IO and MEM decode in function set_vga_bridge_bits().
    But it will be enabled again in function pci_set_resource(),
    if the secondary graphic device take any IO/MEM resources.
    
    Following log printed by enable_resources() shows the problem:
    ...snip...
    PCI: 00:00.0 cmd <- 06
    PCI: 00:01.0 subsystem <- 1022/1410
    PCI: 00:01.0 cmd <- 07                <== The first graphic device
    PCI: 00:01.1 subsystem <- 1022/1410
    PCI: 00:01.1 cmd <- 02
    PCI: 00:02.0 bridge ctrl <- 0003
    PCI: 00:02.0 cmd <- 07
    ...snip...
    PCI: 01:00.0 cmd <- 03                <== The secondary graphic device
    PCI: 01:00.1 cmd <- 02
    PCI: 02:00.0 cmd <- 02
    PCI: 03:00.0 cmd <- 03
    done.
    ...snip...
    
    This patch tries to disable IO & MEM decode for the second graphic device,
    the resource conflict in windows7 resolved.
    
    Signed-off-by: Kerry Sheh <shekairui at gmail.com>
    Signed-off-by: Kerry Sheh <kerry.she at amd.com>
    Change-Id: I0de5e3761b51e2723d9c1dc0c39fff692e3a779d
---
 src/devices/pci_device.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c
index 2ccb38a..5e4269d 100644
--- a/src/devices/pci_device.c
+++ b/src/devices/pci_device.c
@@ -494,6 +494,20 @@ static void pci_set_resource(struct device *dev, struct resource *resource)
 			dev->command |= PCI_COMMAND_IO;
 		if (resource->flags & IORESOURCE_PCI_BRIDGE)
 			dev->command |= PCI_COMMAND_MASTER;
+
+		/* It isn't safe to enable other VGA cards,
+		 * otherwise windows will report resource conflict when
+		 * more than one graphic card in the system.
+		 */
+#if CONFIG_VGA_BRIDGE_SETUP == 1
+		extern device_t vga_pri;
+		if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
+			((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) {
+			if (dev != vga_pri) {
+				dev->command &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
+			}
+		}
+#endif
 	}
 
 	/* Get the base address. */




More information about the coreboot mailing list