1201_ht_bus0_dev0_fidvid_core.diff
https://openbios.org/roundup/linuxbios/issue41
Lord have mercy upon us.




git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2118 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/devices/device.c b/src/devices/device.c
index 303a669..4ca469b 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -369,7 +369,6 @@
 }
 
 #if CONFIG_CONSOLE_VGA == 1
-
 device_t vga_pri = 0;
 static void allocate_vga_resource(void)
 {
@@ -377,31 +376,52 @@
 #warning "This function knows to much about PCI stuff, it should be just a ietrator/visitor."
 
 	/* FIXME handle the VGA pallette snooping */
-	struct device *dev, *vga, *vga_onboard;
+	struct device *dev, *vga, *vga_onboard, *vga_first, *vga_last;
 	struct bus *bus;
 	bus = 0;
 	vga = 0;
 	vga_onboard = 0;
+	vga_first = 0;
+	vga_last = 0;
 	for(dev = all_devices; dev; dev = dev->next) {
 		if (!dev->enabled) continue;
 		if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
 			((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) 
 		{
-			if (!vga) {
-				if (dev->on_mainboard) {
-					vga_onboard = dev;
-				} else {
-					vga = dev;
-				}
-			}
+                        if (!vga_first) {
+                                if (dev->on_mainboard) {
+                                        vga_onboard = dev;
+                                } else {
+                                        vga_first = dev;
+                                }
+                        } else {
+                                if (dev->on_mainboard) {
+                                        vga_onboard = dev;
+                                } else {
+                                        vga_last = dev;
+                                }
+                        }
+
 			/* It isn't safe to enable other VGA cards */
 			dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
 		}
 	}
 	
-	if (!vga) {
-		vga = vga_onboard;
-	}
+        vga = vga_last;
+
+        if(!vga) {
+                vga = vga_first;
+        }
+
+#if 1
+        if (vga_onboard) // will use on board vga as pri
+#else
+        if (!vga) // will use last add on adapter as pri
+#endif
+        {
+                vga = vga_onboard;
+        }
+
 	
 	if (vga) {
 		/* vga is first add on card or the only onboard vga */
@@ -419,6 +439,7 @@
 		bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
 	} 
 }
+
 #endif
 
 
@@ -499,7 +520,6 @@
  */
 int reset_bus(struct bus *bus)
 {
-	device_t dev;
 	if (bus && bus->dev && bus->dev->ops && bus->dev->ops->reset_bus)
 	{
 		bus->dev->ops->reset_bus(bus);