Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/boot.c | 1 + src/bootsplash.c | 1 + src/fw/acpi.c | 1 + src/fw/coreboot.c | 1 + src/fw/mptable.c | 1 + src/fw/paravirt.c | 1 + src/fw/smbios.c | 1 + src/fw/smp.c | 1 + src/hw/floppy.c | 1 + src/hw/pci.c | 1 + src/hw/ps2port.c | 1 + src/hw/ramdisk.c | 1 + src/optionroms.c | 1 + src/romfile.c | 1 + src/romfile.h | 19 +++++++++++++++++++ src/util.h | 13 ------------- 16 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 src/romfile.h
diff --git a/src/boot.c b/src/boot.c index 68a20d9..08876fa 100644 --- a/src/boot.c +++ b/src/boot.c @@ -16,6 +16,7 @@ #include "hw/usb.h" // struct usbdevice_s #include "fw/csm.h" // csm_bootprio_* #include "list.h" // hlist_node +#include "romfile.h" // romfile_loadint #include "string.h" // memset
diff --git a/src/bootsplash.c b/src/bootsplash.c index 340839b..493d60d 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -13,6 +13,7 @@ #include "vbe.h" // struct vbe_info #include "bmp.h" // bmp_alloc #include "fw/smbios.h" // display_uuid +#include "romfile.h" // romfile_loadfile #include "stacks.h" // call16_int #include "string.h" // memset
diff --git a/src/fw/acpi.c b/src/fw/acpi.c index 8abd205..f94a6fb 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -15,6 +15,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "dev-q35.h" +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // readl
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index c67a62b..ba65dc6 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -15,6 +15,7 @@ #include "acpi.h" // find_acpi_features #include "hw/pci.h" // pci_probe_devices #include "paravirt.h" // PlatformRunningOn +#include "romfile.h" // romfile_findprefix #include "stacks.h" // yield #include "string.h" // memset
diff --git a/src/fw/mptable.c b/src/fw/mptable.c index ecc618a..c79f54f 100644 --- a/src/fw/mptable.c +++ b/src/fw/mptable.c @@ -10,6 +10,7 @@ #include "mptable.h" // MPTABLE_SIGNATURE #include "hw/pci.h" #include "hw/pci_regs.h" +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // cpuid
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 2be4281..fd58184 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -20,6 +20,7 @@ #include "mptable.h" // mptable_setup #include "hw/pci.h" // create_pirtable #include "xen.h" // xen_biostable_setup +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // cpuid
diff --git a/src/fw/smbios.c b/src/fw/smbios.c index f80b42b..2f95d96 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -9,6 +9,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "smbios.h" // struct smbios_entry_point +#include "romfile.h" // romfile_findprefix #include "string.h" // memset #include "x86.h" // cpuid
diff --git a/src/fw/smp.c b/src/fw/smp.c index 1906255..cc6fb80 100644 --- a/src/fw/smp.c +++ b/src/fw/smp.c @@ -8,6 +8,7 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield #include "x86.h" // wrmsr
diff --git a/src/hw/floppy.c b/src/hw/floppy.c index c051f54..c8ae756 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -16,6 +16,7 @@ #include "boot.h" // boot_add_floppy #include "pci.h" // pci_to_bdf #include "pci_ids.h" // PCI_CLASS_BRIDGE_ISA +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield #include "string.h" // memset
diff --git a/src/hw/pci.c b/src/hw/pci.c index 295a26d..f171d10 100644 --- a/src/hw/pci.c +++ b/src/hw/pci.c @@ -12,6 +12,7 @@ #include "farptr.h" // MAKE_FLATPTR #include "pci_regs.h" // PCI_VENDOR_ID #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA +#include "romfile.h" // romfile_loadint #include "stacks.h" // call32 #include "string.h" // memset #include "x86.h" // readl diff --git a/src/hw/ps2port.c b/src/hw/ps2port.c index 6fd0c3a..6da297f 100644 --- a/src/hw/ps2port.c +++ b/src/hw/ps2port.c @@ -10,6 +10,7 @@ #include "biosvar.h" // GET_LOW #include "ps2port.h" // ps2_kbd_command #include "pic.h" // pic_eoi1 +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield
diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c index cd517e7..3eadd74 100644 --- a/src/hw/ramdisk.c +++ b/src/hw/ramdisk.c @@ -10,6 +10,7 @@ #include "biosvar.h" // GET_GLOBAL #include "bregs.h" // struct bregs #include "boot.h" // boot_add_floppy +#include "romfile.h" // romfile_findprefix #include "stacks.h" // call16_int #include "string.h" // memset
diff --git a/src/optionroms.c b/src/optionroms.c index cc6083b..5c79121 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -14,6 +14,7 @@ #include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA #include "boot.h" // IPL #include "optionroms.h" // struct rom_header +#include "romfile.h" // romfile_loadint #include "stacks.h" // farcall16big #include "string.h" // memset
diff --git a/src/romfile.c b/src/romfile.c index f19f756..94e1ed5 100644 --- a/src/romfile.c +++ b/src/romfile.c @@ -6,6 +6,7 @@
#include "config.h" // CONFIG_* #include "util.h" // dprintf +#include "romfile.h" // struct romfile_s #include "string.h" // memcmp
static struct romfile_s *RomfileRoot VARVERIFY32INIT; diff --git a/src/romfile.h b/src/romfile.h new file mode 100644 index 0000000..c6d62a1 --- /dev/null +++ b/src/romfile.h @@ -0,0 +1,19 @@ +#ifndef __ROMFILE_H +#define __ROMFILE_H + +#include "types.h" // u32 + +// romfile.c +struct romfile_s { + struct romfile_s *next; + char name[128]; + u32 size; + int (*copy)(struct romfile_s *file, void *dest, u32 maxlen); +}; +void romfile_add(struct romfile_s *file); +struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev); +struct romfile_s *romfile_find(const char *name); +void *romfile_loadfile(const char *name, int *psize); +u64 romfile_loadint(const char *name, u64 defval); + +#endif // romfile.h diff --git a/src/util.h b/src/util.h index 0492e39..a1a10f4 100644 --- a/src/util.h +++ b/src/util.h @@ -239,19 +239,6 @@ static inline void free(void *data) { // fw/mtrr.c void mtrr_setup(void);
-// romfile.c -struct romfile_s { - struct romfile_s *next; - char name[128]; - u32 size; - int (*copy)(struct romfile_s *file, void *dest, u32 maxlen); -}; -void romfile_add(struct romfile_s *file); -struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev); -struct romfile_s *romfile_find(const char *name); -void *romfile_loadfile(const char *name, int *psize); -u64 romfile_loadint(const char *name, u64 defval); - // romlayout.S void reset_vector(void) __noreturn;