aboutsummaryrefslogtreecommitdiff
path: root/src/devices/pci_device.c
diff options
context:
space:
mode:
authorRoman Kononov <kononov195-lbl@yahoo.com>2007-04-06 18:34:39 +0000
committerStefan Reinauer <stepan@openbios.org>2007-04-06 18:34:39 +0000
commit778a42b129aef01be41633051b494e4462588e6b (patch)
treeb8f147a9df8d943fbb5771d1540a82cd988ba506 /src/devices/pci_device.c
parentba43064d3276f3c96bb057ecdfd293cb2ae11a97 (diff)
This patch makes sure that VGA is initialized before it is used. Without
this fix, LinuxBIOS crashes if the CONSOLE_LOG_LEVEL is high enough. Additionally, The VGA option rom will be executed if either CONFIG_PCI_ROM_RUN=1 or CONFIG_CONSOLE_VGA=1. Signed-off-by: Roman Kononov <kononov195-lbl@yahoo.com> Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2587 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/pci_device.c')
-rw-r--r--src/devices/pci_device.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/devices/pci_device.c b/src/devices/pci_device.c
index 2750893378..b1651f3922 100644
--- a/src/devices/pci_device.c
+++ b/src/devices/pci_device.c
@@ -633,17 +633,39 @@ void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device)
void pci_dev_init(struct device *dev)
{
-#if CONFIG_PCI_ROM_RUN == 1
+#if CONFIG_CONSOLE_VGA == 1
+ extern int vga_inited;
+#endif
+#if CONFIG_PCI_ROM_RUN == 1 || CONFIG_CONSOLE_VGA == 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;
+
ram = pci_rom_load(dev, rom);
if (ram == NULL)
return;
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
}