[LinuxBIOS] [PATCH] VGA is used before it is initialized

Roman Kononov kononov195-lbl at yahoo.com
Thu Jan 18 00:56:10 CET 2007


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.

Roman

----------------------
Index: src/devices/pci_rom.c
===================================================================
--- src/devices/pci_rom.c       (revision 2536)
+++ src/devices/pci_rom.c       (working copy)
@@ -69,7 +69,7 @@
  #endif
  #endif

-struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header)
+struct rom_header *pci_rom_load_and_run(struct device *dev, struct rom_header *rom_header)
  {
         struct pci_data * rom_data;
         unsigned long rom_address;
@@ -96,6 +96,7 @@
                 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);
+               run_bios(dev,(unsigned long)PCI_VGA_RAM_IMAGE_START);
                 vga_inited = 1;
                 return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
  #endif
@@ -103,6 +104,7 @@
                 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);
                 memcpy(pci_ram_image_start, rom_header, rom_size);
+               run_bios(dev,(unsigned long)pci_ram_image_start);
                 pci_ram_image_start += rom_size;
                 return (struct rom_header *) (pci_ram_image_start-rom_size);
         }
Index: src/devices/pci_device.c
===================================================================
--- src/devices/pci_device.c    (revision 2536)
+++ src/devices/pci_device.c    (working copy)
@@ -634,16 +634,12 @@
  void pci_dev_init(struct device *dev)
  {
  #if CONFIG_PCI_ROM_RUN == 1
-       struct rom_header *rom, *ram;
+       struct rom_header *rom;

         rom = pci_rom_probe(dev);
         if (rom == NULL)
                 return;
-       ram = pci_rom_load(dev, rom);
-       if (ram == NULL)
-               return;
-
-       run_bios(dev, ram);
+       pci_rom_load_and_run(dev, rom);
  #endif
  }

Index: src/include/device/pci_rom.h
===================================================================
--- src/include/device/pci_rom.h        (revision 2536)
+++ src/include/device/pci_rom.h        (working copy)
@@ -34,7 +34,8 @@
  };

  extern struct rom_header * pci_rom_probe(struct device *dev);
-extern struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header);
+extern struct rom_header *pci_rom_load_and_run(struct device *dev, struct rom_header *rom_header);
+void run_bios(struct device *dev,unsigned long addr);

  extern void pci_dev_init(struct device *dev);






More information about the coreboot mailing list