Here's the full story, which I'm hoping to address all related problems with.
We agreed that a VGA console and the need to run any option ROMs is mutually 
not strictly dependent, Luc's problem was that LBv2 code doesn't reflect 
that. There are 6 combinations:

* Console may be on VGA or not (e.g. serial)

_independently_

* LB might run
  - no option ROMs
  - only VGA option ROMs
  - all option ROMs

The combination "no option ROMs" / "VGA console" currently does not compile; 
Ron fixed that.

I would now additionally introduce CONFIG_VGA_ROM_RUN, to map all 6 
combinations. The implicit (broken) assumption that CONSOLE_VGA would also 
run the ROMs is lifted, and transferred to this new config option instead; 
the source code becomes less ambiguous.

This change is minimally intrusive, because all board configs that previously 
assumed CONSOLE_VGA would also run the ROMs didn't compile, they had to also 
specify PCI_ROM_RUN, so this new option only offers 2 new opportunities which 
didn't work before or were impossible to specify, respectively.

This part combines Luc's and Ron's patches, and adds the new option to 
clarify.

Signed-off-by: Torsten Duwe <[EMAIL PROTECTED]>
diff -BNurbp LinuxBIOSv2.orig/src/config/Options.lb LinuxBIOSv2/src/config/Options.lb
--- LinuxBIOSv2.orig/src/config/Options.lb	2007-12-29 17:12:33.000000000 +0100
+++ LinuxBIOSv2/src/config/Options.lb	2008-01-05 17:02:32.000000000 +0100
@@ -415,7 +415,7 @@ end
 define CONFIG_CONSOLE_VGA
 	default 0
 	export always
-	comment "Log messages to VGA"
+	comment "Log messages to any VGA-compatible device (may require *_ROM_RUN to bring up)"
 end
 define CONFIG_CONSOLE_VGA_MULTI
         default 0
@@ -1027,10 +1027,16 @@ define CPU_ADDR_BITS
 	comment "CPU hardware address lines num, for AMD K8 could be 40, and AMD family 10 could be 48"
 end
 
+define CONFIG_VGA_ROM_RUN
+	default 0
+	export always
+	comment "Init x86 ROMs on VGA-class PCI devices"
+end
+
 define CONFIG_PCI_ROM_RUN
 	default 0
 	export always
-	comment "Init PCI device option rom"
+	comment "Init x86 ROMs on all PCI devices"
 end
 
 define CONFIG_PCI_64BIT_PREF_MEM
diff -BNurbp LinuxBIOSv2.orig/src/devices/Config.lb LinuxBIOSv2/src/devices/Config.lb
--- LinuxBIOSv2.orig/src/devices/Config.lb	2007-07-25 18:25:53.000000000 +0200
+++ LinuxBIOSv2/src/devices/Config.lb	2008-01-05 16:55:48.000000000 +0100
@@ -1,4 +1,5 @@
 uses CONFIG_PCI_ROM_RUN
+uses CONFIG_VGA_ROM_RUN
 object device.o
 object root_device.o
 object device_util.o
@@ -15,4 +16,9 @@ object smbus_ops.o
 if CONFIG_PCI_ROM_RUN
 	object pci_rom.o
 	dir emulator
+else
+if CONFIG_VGA_ROM_RUN
+	object pci_rom.o
+	dir emulator
+end
 end
diff -BNurbp LinuxBIOSv2.orig/src/devices/pci_device.c LinuxBIOSv2/src/devices/pci_device.c
--- LinuxBIOSv2.orig/src/devices/pci_device.c	2007-10-03 00:13:15.000000000 +0200
+++ LinuxBIOSv2/src/devices/pci_device.c	2008-01-05 16:56:04.000000000 +0100
@@ -643,16 +643,14 @@ void pci_dev_set_subsystem(device_t dev,
 		((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 || CONFIG_VGA_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
+	/* We want to execute VGA option ROMs when CONFIG_VGA_ROM_RUN
 	 * is set but CONFIG_PCI_ROM_RUN is not. In this case we skip
 	 * all other option ROM types.
 	 */
@@ -671,14 +669,13 @@ void pci_dev_init(struct device *dev)
 	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 = 1;
+	}
+#endif /* CONFIG_CONSOLE_VGA */
+#endif /* CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN */
 }
 
 /** Default device operation for PCI devices */
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to