diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2012-05-31 00:20:55 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2012-06-02 20:06:18 -0400 |
commit | 59d6ca52a7eba5b1f4f2becf70fd446dccaf0a2e (patch) | |
tree | a90ca99b49e14bd73076a35183be1a14143534e6 /src/ramdisk.c | |
parent | 51d6ba3e6fac2e78679145fe34f3861225670ae9 (diff) | |
download | seabios-hppa-59d6ca52a7eba5b1f4f2becf70fd446dccaf0a2e.zip seabios-hppa-59d6ca52a7eba5b1f4f2becf70fd446dccaf0a2e.tar.gz seabios-hppa-59d6ca52a7eba5b1f4f2becf70fd446dccaf0a2e.tar.bz2 |
Cache romfile entries.
Create a 'struct romfile_s' and populate a list of all romfiles at
start of init. Caching the romfiles both simplifies the code and
makes it more efficient.
Also, convert the ramdisk code to use romfile helpers instead of
directly accessing cbfs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/ramdisk.c')
-rw-r--r-- | src/ramdisk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ramdisk.c b/src/ramdisk.c index bae30e2..9249a49 100644 --- a/src/ramdisk.c +++ b/src/ramdisk.c @@ -14,15 +14,15 @@ void ramdisk_setup(void) { - if (!CONFIG_COREBOOT || !CONFIG_COREBOOT_FLASH || !CONFIG_FLASH_FLOPPY) + if (!CONFIG_FLASH_FLOPPY) return; // Find image. - struct cbfs_file *file = cbfs_findprefix("floppyimg/", NULL); + struct romfile_s *file = romfile_findprefix("floppyimg/", NULL); if (!file) return; - const char *filename = cbfs_filename(file); - u32 size = cbfs_datasize(file); + const char *filename = file->name; + u32 size = file->size; dprintf(3, "Found floppy file %s of size %d\n", filename, size); int ftype = find_floppy_type(size); if (ftype < 0) { @@ -39,7 +39,9 @@ ramdisk_setup(void) add_e820((u32)pos, size, E820_RESERVED); // Copy image into ram. - cbfs_copyfile(file, pos, size); + int ret = file->copy(file, pos, size); + if (ret < 0) + return; // Setup driver. struct drive_s *drive_g = init_floppy((u32)pos, ftype); |