coreboot/src/devices
Kerry Sheh 8660a1aa56 Fix multipleVGA cards resource conflict on Windows
If multiple VGA-compatible legacy graphic cards decode the IO range
3B0-3BB, 3C0-3DF and MEM range A00000-BFFFF.
Windows 7 complain a resource conflict, so only one VGA card can
works at the same time.

There is a discussion in coreboot mail list before,
please reference thread: "how to prevent legacy resource conflictwith   multipleVGA cards"
http://www.coreboot.org/pipermail/coreboot/2010-October/061508.html

Linux using VGA Arbiter module(vgaarb) to resolve this resource conflict,
Please see the following linux dmesg log, more information can be found in
Linux source dir Documentation/vgaarbiter.txt.
But it seems that windows don't dealwith this conflict.
~# dmesg | grep -i vgaarb
[    0.774076] vgaarb: device added: PCI:0000:00:01.0,decodes=io+mem,owns=io+mem
[    0.776065] vgaarb: device added: PCI:0000:01:00.0,decodes=io+mem,owns=none,l
[    0.780051] vgaarb: loaded
[    0.784049] vgaarb: bridge control possible 0000:01:00.0
[    0.788050] vgaarb: bridge control possible 0000:00:01.0

For the second legacy 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 second legacy vga-compatible 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 second graphic device
PCI: 01:00.1 cmd <- 02
PCI: 02:00.0 cmd <- 02
PCI: 03:00.0 cmd <- 03
done.
...snip...


The IO & MEM decoding on the second vga graphic device should be disabled.
Please reference PCI spec. section 3.10 in detail.
set_vga_bridge_bits() would do this work for us, it did the right thing,
but was put to the wrong place, the setting would be overwritten by
assign_resources() later.

In order to make sure the set_vga_bridge_bits() setting not be
overwritten by others, moving the call of set_vga_bridge_bits()
to the end of dev_configure(), instead of at the beginning.

This patch resolved the dual graphic cards resource conflict in windows7,
multiple vga-compatible graphic cards can work together in windows7.


Signed-off-by: Kerry Sheh <shekairui@gmail.com>
Signed-off-by: Kerry Sheh <kerry.she@amd.com>
Change-Id: I0de5e3761b51e2723d9c1dc0c39fff692e3a779d
Reviewed-on: http://review.coreboot.org/489
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
2012-02-07 00:32:52 +01:00
..
oprom Fix console output in real mode int10 implementation. 2011-12-13 23:46:27 +01:00
agp_device.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
cardbus_device.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
device.c Fix multipleVGA cards resource conflict on Windows 2012-02-07 00:32:52 +01:00
device_util.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
hypertransport.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
Kconfig Printing coreboot debug messages on VGA console is pretty much useless, since 2010-11-22 08:09:50 +00:00
Makefile.inc Rename build system variables to be more intuitive, and 2010-09-30 16:55:02 +00:00
pci_device.c Use subsystem id from devicetree.cb instead of Kconfig and move 2011-03-01 19:58:47 +00:00
pci_ops.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
pci_rom.c Add OPROM mapping support to coreboot 2012-02-07 00:09:58 +01:00
pciexp_device.c some ifdef --> if fixes 2011-04-21 20:24:43 +00:00
pcix_device.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00
pnp_device.c Fix an infinite loop in pnp_get_ioresource(), which freezes coreboot if 2011-01-31 21:16:48 +00:00
root_device.c Cosmetics and coding style fixes in devices/*. 2010-10-18 00:00:57 +00:00
smbus_ops.c Various cosmetic and coding style fixes in src/devices. 2010-11-04 23:23:47 +00:00