aboutsummaryrefslogtreecommitdiffstats
path: root/src/optionroms.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-06-13 16:05:17 -0400
committerKevin O'Connor <kevin@koconnor.net>2010-06-13 16:05:17 -0400
commite23042606f938a9e344252983cf8e05e7528a126 (patch)
treee16fd382b0e877339b527f6facce4caa581a87a8 /src/optionroms.c
parent8cb8ba52b1bb478893411394ce49b364086f8a1a (diff)
downloadseabios-e23042606f938a9e344252983cf8e05e7528a126.tar.gz
Unify optionrom cbfs/qemu_cfg rom pulling code.
Make the qemu_cfg optionrom extraction code use an interface more similar to the cbfs file interface. Introduce a set of "romfile_" wrappers that select between cbfs and qemu cfg interface. Use these new wrappers in the optionrom code.
Diffstat (limited to 'src/optionroms.c')
-rw-r--r--src/optionroms.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/optionroms.c b/src/optionroms.c
index f144d839..0b0f3962 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -227,47 +227,31 @@ lookup_hardcode(u32 vendev)
&& ((OPTIONROM_VENDEV_2 >> 16)
| ((OPTIONROM_VENDEV_2 & 0xffff)) << 16) == vendev)
return copy_rom((void*)OPTIONROM_MEM_2);
- int ret = cbfs_copy_optionrom((void*)RomEnd, max_rom() - RomEnd, vendev);
- if (ret < 0)
+ char fname[17];
+ snprintf(fname, sizeof(fname), "pci%04x,%04x.rom"
+ , pci_vd_to_ven(vendev), pci_vd_to_dev(vendev));
+ int ret = romfile_copy(romfile_find(fname), (void*)RomEnd
+ , max_rom() - RomEnd);
+ if (ret <= 0)
return NULL;
return (void*)RomEnd;
}
// Run all roms in a given CBFS directory.
static void
-run_cbfs_roms(const char *prefix, int isvga)
+run_file_roms(const char *prefix, int isvga)
{
- struct cbfs_file *file = NULL;
+ u32 file = 0;
for (;;) {
- file = cbfs_findprefix(prefix, file);
+ file = romfile_findprefix(prefix, file);
if (!file)
break;
- int ret = cbfs_copyfile(file, (void*)RomEnd, max_rom() - RomEnd);
+ int ret = romfile_copy(file, (void*)RomEnd, max_rom() - RomEnd);
if (ret > 0)
init_optionrom((void*)RomEnd, 0, isvga);
}
}
-static void
-run_qemu_roms(const char *prefix, int isvga)
-{
- struct QemuCfgFile entry;
- int plen = strlen(prefix);
- int rc, dlen;
-
- rc = qemu_cfg_first_file(&entry);
- while (rc > 0) {
- if (memcmp(prefix, entry.name, plen) == 0) {
- dlen = qemu_cfg_read_file(&entry, (void*)RomEnd, max_rom() - RomEnd);
- if (dlen > 0) {
- dprintf(1, "init qemu rom: %s\n", entry.name);
- init_optionrom((void*)RomEnd, 0, isvga);
- }
- }
- rc = qemu_cfg_next_file(&entry);
- }
-}
-
/****************************************************************
* PCI roms
@@ -397,8 +381,7 @@ optionrom_setup(void)
}
// Find and deploy CBFS roms not associated with a device.
- run_cbfs_roms("genroms/", 0);
- run_qemu_roms("genroms/", 0);
+ run_file_roms("genroms/", 0);
}
// All option roms found and deployed - now build BEV/BCV vectors.
@@ -457,8 +440,7 @@ vga_setup(void)
init_pcirom(bdf, 1);
// Find and deploy CBFS vga-style roms not associated with a device.
- run_cbfs_roms("vgaroms/", 1);
- run_qemu_roms("vgaroms/", 1);
+ run_file_roms("vgaroms/", 1);
}
if (RomEnd == BUILD_ROM_START) {