Roman Kononov wrote:
> On 01/17/2007 05:56 PM, Roman Kononov wrote:
>> In the original code vga_inited is set, then run_bios() is
>> called, which does printk(), which is allowed using the VGA.
>>
>> The patch puts vga_inited=1 and run_bios() in the right order.
> 
> For me, this bug resulted in linuxbios hanged.
> 
> When console log level is BIOS_INFO and above, linuxbios accesses
> the video memory of uninitialized VGA hardware, which is bad.
> 

Can you try the attached patch? It's a little less intrusive
Index: src/devices/pci_rom.c
===================================================================
--- src/devices/pci_rom.c       (revision 2534)
+++ src/devices/pci_rom.c       (working copy)
@@ -63,7 +63,6 @@
 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
@@ -96,7 +95,6 @@
                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 {
Index: src/devices/pci_device.c
===================================================================
--- src/devices/pci_device.c    (revision 2534)
+++ src/devices/pci_device.c    (working copy)
@@ -634,7 +634,9 @@
 void pci_dev_init(struct device *dev)
 {
 #if CONFIG_PCI_ROM_RUN == 1
+       extern int vga_inited;
        struct rom_header *rom, *ram;
+       struct pci_data * rom_data;
 
        rom = pci_rom_probe(dev);
        if (rom == NULL)
@@ -644,6 +646,8 @@
                return;
 
        run_bios(dev, ram);
+       if (dev->class == PCI_CLASS_DISPLAY_VGA)
+               vga_inited = 1;
 #endif
 }
 

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
linuxbios mailing list
[email protected]
http://www.openbios.org/mailman/listinfo/linuxbios

Reply via email to