From: Kevin O'Connor Date: Thu, 18 Jun 2009 00:35:41 +0000 (-0400) Subject: Support running non-pci specific vga option roms from CBFS. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=09880dada98c075b98e68b08cb3ce8ffbf605faf;p=seabios.git Support running non-pci specific vga option roms from CBFS. Load option roms from the "vgaroms/" CBFS directory during VGA scan. --- diff --git a/src/coreboot.c b/src/coreboot.c index 1ba8d12..7d4ca83 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -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); diff --git a/src/optionroms.c b/src/optionroms.c index 2856217..69ba8b1 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -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"); diff --git a/src/util.h b/src/util.h index e2db7f0..2ba80dd 100644 --- a/src/util.h +++ b/src/util.h @@ -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