diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/cbfs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index b8f3d5cb61..4f0b443360 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -159,6 +159,12 @@ static inline int tohex4(unsigned int c) return (c <= 9) ? (c + '0') : (c - 10 + 'a'); } +static void tohex8(unsigned int val, char *dest) +{ + dest[0] = tohex4((val >> 4) & 0xf); + dest[1] = tohex4(val & 0xf); +} + static void tohex16(unsigned int val, char *dest) { dest[0] = tohex4(val >> 12); @@ -177,6 +183,17 @@ void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device) return cbfs_boot_map_with_leak(name, CBFS_TYPE_OPTIONROM, NULL); } +void *cbfs_boot_map_optionrom_revision(uint16_t vendor, uint16_t device, uint8_t rev) +{ + char name[20] = "pciXXXX,XXXX,XX.rom"; + + tohex16(vendor, name + 3); + tohex16(device, name + 8); + tohex8(rev, name + 13); + + return cbfs_boot_map_with_leak(name, CBFS_TYPE_OPTIONROM, NULL); +} + size_t cbfs_boot_load_file(const char *name, void *buf, size_t buf_size, uint32_t type) { |