[LinuxBIOS] [Patch] Fix CONFIG_CONSOLE_VGA handling in default pci_dev_init.

Luc Verhaegen libv at skynet.be
Wed Jan 2 10:16:38 CET 2008


The CONFIG_CONSOLE_VGA and CONFIG_PCI_ROM_RUN logic in 
src/devices/pci_device.c:pci_dev_init is messed up.

First of all, pci_dev_init should only do anything when the pci rom 
should be run. Secondly, vga_inited should only be set when the rom has 
been run, and never otherwise as this should be done by the relevant 
init function of possible (future) VGA setup drivers.

Signed-off-by: Luc Verhaegen <libv at skynet.be>
-------------- next part --------------
Index: src/devices/pci_device.c
===================================================================
--- src/devices/pci_device.c	(revision 3031)
+++ src/devices/pci_device.c	(working copy)
@@ -643,23 +643,13 @@
 		((device & 0xffff) << 16) | (vendor & 0xffff));
 }
 
+/** default handler: only runs the relevant pci bios. */
 void pci_dev_init(struct device *dev)
 {
-#if CONFIG_CONSOLE_VGA == 1
-	extern int vga_inited;
-#endif
-#if CONFIG_PCI_ROM_RUN == 1 || CONFIG_CONSOLE_VGA == 1
+
+#if CONFIG_PCI_ROM_RUN == 1
 	struct rom_header *rom, *ram;
 
-#if CONFIG_PCI_ROM_RUN != 1
-	/* We want to execute VGA option ROMs when CONFIG_CONSOLE_VGA
-	 * is set but CONFIG_PCI_ROM_RUN is not. In this case we skip
-	 * all other option ROM types.
-	 */
-	if (dev->class!=PCI_CLASS_DISPLAY_VGA) 
-		return;
-#endif
-
 	rom = pci_rom_probe(dev);
 	if (rom == NULL)
 		return;
@@ -671,14 +661,14 @@
 	run_bios(dev, ram);
 
 #if CONFIG_CONSOLE_VGA == 1
-	/* vga_inited is a trigger of the VGA console code.
-	 *
-	 * Only set it if we enabled VGA console, and if we 
-	 * just initialized a VGA card.
-	 */
-	vga_inited|=dev->class==PCI_CLASS_DISPLAY_VGA;
-#endif
-#endif
+	/* vga_inited is a trigger of the VGA console code. */
+	if (dev->class == PCI_CLASS_DISPLAY_VGA) {
+	    extern int vga_inited;
+	    vga_inited = TRUE;
+	}
+#endif /* CONFIG_CONSOLE_VGA */
+
+#endif /* CONFIG_PCI_ROM_RUN */
 }
 
 /** Default device operation for PCI devices */


More information about the coreboot mailing list