From 778a42b129aef01be41633051b494e4462588e6b Mon Sep 17 00:00:00 2001 From: Roman Kononov Date: Fri, 6 Apr 2007 18:34:39 +0000 Subject: 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 Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2587 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/pci_device.c | 24 +++++++++++++++++++++++- src/devices/pci_rom.c | 6 +----- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src/devices') 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 } diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c index 3c032b2ac1..55225ea4ca 100644 --- a/src/devices/pci_rom.c +++ b/src/devices/pci_rom.c @@ -62,12 +62,9 @@ struct rom_header * pci_rom_probe(struct device *dev) static void *pci_ram_image_start = (void *)PCI_RAM_IMAGE_START; -#if CONFIG_CONSOLE_VGA == 1 -extern int vga_inited; // defined in vga_console.c -#if CONFIG_CONSOLE_VGA_MULTI == 0 +#if CONFIG_CONSOLE_VGA == 1 && CONFIG_CONSOLE_VGA_MULTI == 0 extern device_t vga_pri; // the primary vga device, defined in device.c #endif -#endif struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header) { @@ -96,7 +93,6 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade printk_debug("copying VGA ROM Image from 0x%x to 0x%x, 0x%x bytes\n", rom_header, PCI_VGA_RAM_IMAGE_START, rom_size); memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size); - vga_inited = 1; return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START); #endif } else { -- cgit v1.2.3