When CONFIG_CONSOLE_VGA==0 and CONFIG_PCI_ROM_RUN==1 VGA will not be initialized because of pci_rom_load()
What about vgainit-v3? Roman
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 <[EMAIL PROTECTED]> Signed-off-by: Stefan Reinauer <[EMAIL PROTECTED]> Index: src/devices/pci_rom.c =================================================================== --- src/devices/pci_rom.c (revision 2542) +++ src/devices/pci_rom.c (working copy) @@ -62,13 +62,6 @@ struct rom_header * pci_rom_probe(struct 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 -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) { struct pci_data * rom_data; @@ -89,16 +82,14 @@ struct rom_header *pci_rom_load(struct d rom_size = rom_header->size * 512; if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) { -#if CONFIG_CONSOLE_VGA == 1 - #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 if (dev != vga_pri) return NULL; // only one VGA supported - #endif +#endif 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 { printk_debug("copying non-VGA ROM Image from 0x%x to 0x%x, 0x%x bytes\n", rom_header, pci_ram_image_start, rom_size); Index: src/devices/pci_device.c =================================================================== --- src/devices/pci_device.c (revision 2542) +++ src/devices/pci_device.c (working copy) @@ -633,17 +633,39 @@ void pci_dev_set_subsystem(device_t dev, 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 }
-- linuxbios mailing list linuxbios@linuxbios.org http://www.openbios.org/mailman/listinfo/linuxbios