Support running non-pci specific vga option roms from CBFS.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 18 Jun 2009 00:35:41 +0000 (20:35 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 18 Jun 2009 00:35:41 +0000 (20:35 -0400)
Load option roms from the "vgaroms/" CBFS directory during VGA scan.

src/coreboot.c
src/optionroms.c
src/util.h

index 1ba8d123dea746154c568ad4a7b9606056a20150..7d4ca835f2c90352b058bc542f577387ba2cb32b 100644 (file)
@@ -494,17 +494,22 @@ cbfs_copy_optionrom(void *dst, u32 maxlen, u32 vendev)
     return cbfs_copyfile(dst, maxlen, fname);
 }
 
+// Copy the next file with the given prefix - starting at pos 'last'.
 struct cbfs_file *
-cbfs_copy_gen_optionrom(void *dst, u32 maxlen, struct cbfs_file *file)
+cbfs_copyfile_prefix(void *dst, u32 maxlen, char *prefix
+                     , struct cbfs_file *last)
 {
     if (! CONFIG_COREBOOT_FLASH)
         return NULL;
-    if (! file)
+    dprintf(3, "Searching CBFS for data file prefix %s\n", prefix);
+    struct cbfs_file *file;
+    if (! last)
         file = cbfs_getfirst();
     else
-        file = cbfs_getnext(file);
+        file = cbfs_getnext(last);
+    int prefixlen = strlen(prefix);
     for (; file; file = cbfs_getnext(file)) {
-        if (memcmp("genroms/", file->filename, 8) != 0)
+        if (memcmp(prefix, file->filename, prefixlen) != 0)
             continue;
         u32 size = ntohl(file->len);
         void *src = (void*)file + ntohl(file->offset);
index 2856217a85ce9ad3eac8e9dc7d9fd762f016b646..69ba8b158bce06df2832fe74cc4658d29ad8f6f7 100644 (file)
@@ -338,8 +338,8 @@ optionrom_setup()
         // Find and deploy CBFS roms not associated with a device.
         struct cbfs_file *tmp = NULL;
         for (;;) {
-            tmp = cbfs_copy_gen_optionrom(
-                (void*)next_rom, BUILD_BIOS_ADDR - next_rom, tmp);
+            tmp = cbfs_copyfile_prefix(
+                (void*)next_rom, BUILD_BIOS_ADDR - next_rom, "genroms/", tmp);
             if (!tmp)
                 break;
             verifysize_optionrom((void*)next_rom, 0);
@@ -408,6 +408,19 @@ vga_setup()
         if (rom && !get_pnp_rom(rom))
             // Call rom even if it isn't a pnp rom.
             callrom(rom, OPTION_ROM_INITVECTOR, bdf);
+
+        // Find and deploy CBFS vga-style roms not associated with a device.
+        struct cbfs_file *tmp = NULL;
+        for (;;) {
+            tmp = cbfs_copyfile_prefix(
+                (void*)next_rom, BUILD_BIOS_ADDR - next_rom, "vgaroms/", tmp);
+            if (!tmp)
+                break;
+            rom = verifysize_optionrom((void*)next_rom, 0);
+            if (rom && !get_pnp_rom(rom))
+                // Call rom even if it isn't a pnp rom.
+                callrom(rom, OPTION_ROM_INITVECTOR, bdf);
+        }
     }
 
     dprintf(1, "Turning on vga console\n");
index e2db7f0362b009cce8db5c83344adf84936fa004..2ba80ddf6bf4b15f043ffce61bca75e0ccaca5a7 100644 (file)
@@ -189,8 +189,8 @@ const char *cbfs_findNprefix(const char *prefix, int n);
 int cbfs_copy_optionrom(void *dst, u32 maxlen, u32 vendev);
 void cbfs_run_payload(const char *filename);
 struct cbfs_file;
-struct cbfs_file *cbfs_copy_gen_optionrom(void *dst, u32 maxlen
-                                          , struct cbfs_file *file);
+struct cbfs_file *cbfs_copyfile_prefix(void *dst, u32 maxlen, char *prefix
+                                       , struct cbfs_file *last);
 void coreboot_setup();
 
 // vgahooks.c