From a736f480883e544b2131c966cdfb80bb42e751b3 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Fri, 16 Jul 2021 14:03:21 -0600 Subject: lib/cbfs,device/pci_rom: Move cbfs_boot_map_optionrom and modernize These methods are oprom specific. Move them out of CBFS. I also deleted the tohex methods and replaced them with snprintf. BUG=b:179699789 TEST=Boot guybrush and see oprom still loads Signed-off-by: Raul E Rangel Change-Id: I03791f19c93fabfe62d9ecd4f9b4fad0e6a6146e Reviewed-on: https://review.coreboot.org/c/coreboot/+/56393 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner --- src/device/pci_rom.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/device') diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 334d99be8f..106b5f9c8b 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,24 @@ void __weak map_oprom_vendev_rev(u32 *vendev, u8 *rev) { return; } u32 __weak map_oprom_vendev(u32 vendev) { return vendev; } +static void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device) +{ + char name[17] = "pciXXXX,XXXX.rom"; + + snprintf(name, sizeof(name), "pci%04hx,%04hx.rom", vendor, device); + + return cbfs_map(name, NULL); +} + +static void *cbfs_boot_map_optionrom_revision(uint16_t vendor, uint16_t device, uint8_t rev) +{ + char name[20] = "pciXXXX,XXXX,XX.rom"; + + snprintf(name, sizeof(name), "pci%04hx,%04hx,%02hhx.rom", vendor, device, rev); + + return cbfs_map(name, NULL); +} + struct rom_header *pci_rom_probe(const struct device *dev) { struct rom_header *rom_header = NULL; -- cgit v1.2.3