Update the k8 code for the v3 resource allocator.
The major change is that the K8 registers don't get touched until the end of
resource allocation.

Fam10 code could be updated the same way.

Move VGA code before resource allocation but after device enumeration.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4395 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/devices/device.c b/src/devices/device.c
index 123d22a..64b3c10 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -663,9 +663,9 @@
 
 #if CONFIG_CONSOLE_VGA == 1
 device_t vga_pri = 0;
-static void allocate_vga_resource(void)
+static void set_vga_bridge_bits(void)
 {
-#warning "FIXME modify allocate_vga_resource so it is less pci centric!"
+#warning "FIXME modify set_vga_bridge so it is less pci centric!"
 #warning "This function knows too much about PCI stuff, it should be just a iterator/visitor."
 
 	/* FIXME: Handle the VGA palette snooping. */
@@ -716,7 +716,7 @@
 
 	if (vga) {
 		/* VGA is first add on card or the only onboard VGA. */
-		printk_debug("Allocating VGA resource %s\n", dev_path(vga));
+		printk_debug("Setting up VGA for %s\n", dev_path(vga));
 		/* All legacy VGA cards have MEM & I/O space registers. */
 		vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
 		vga_pri = vga;
@@ -921,6 +921,10 @@
 	struct device *child;
 	int i;
 
+#if CONFIG_CONSOLE_VGA == 1
+	set_vga_bridge_bits();
+#endif
+
 	printk_info("Allocating resources...\n");
 
 	root = &dev_root;
@@ -984,12 +988,6 @@
 		}
 	}
 
-#if CONFIG_CONSOLE_VGA == 1
-	/* Allocate the VGA I/O resource. */
-	allocate_vga_resource();
-	print_resource_tree(root, BIOS_DEBUG, "After VGA.");
-#endif
-
 	/* Store the computed resource allocations into device registers ... */
 	printk_info("Setting resources...\n");
 	for (child = root->link[0].children; child; child = child->sibling) {