diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-04-30 21:50:35 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-04-30 21:50:35 -0400 |
commit | 1edc89d668afe38fc1d35f096ca35da75e6158bf (patch) | |
tree | f5b3f6cf4cb5a1f39cd73cef17de624793ea6ef3 /src/optionroms.c | |
parent | 217d363328237435fe380f3857d06a56762731f0 (diff) | |
download | seabios-1edc89d668afe38fc1d35f096ca35da75e6158bf.tar.gz |
Add ability to run all option roms in CBFS directory "genroms/".
Diffstat (limited to 'src/optionroms.c')
-rw-r--r-- | src/optionroms.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/optionroms.c b/src/optionroms.c index ac262865..c42968a9 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -187,8 +187,8 @@ lookup_hardcode(u32 vendev) && ((OPTIONROM_VENDEV_2 >> 16) | ((OPTIONROM_VENDEV_2 & 0xffff)) << 16) == vendev) return copy_rom((struct rom_header *)OPTIONROM_MEM_2); - int ret = cb_copy_optionrom((void*)next_rom, BUILD_BIOS_ADDR - next_rom - , vendev); + int ret = cbfs_copy_optionrom((void*)next_rom, BUILD_BIOS_ADDR - next_rom + , vendev); if (ret < 0) return NULL; return (struct rom_header *)next_rom; @@ -261,19 +261,10 @@ fail: return NULL; } -// Attempt to map and initialize the option rom on a given PCI device. +// Adjust for the size of an option rom; allow it to resize. static struct rom_header * -init_optionrom(u16 bdf) +verifysize_optionrom(struct rom_header *rom, u16 bdf) { - u32 vendev = pci_config_readl(bdf, PCI_VENDOR_ID); - dprintf(4, "Attempting to init PCI bdf %x (dev/ven %x)\n", bdf, vendev); - struct rom_header *rom = lookup_hardcode(vendev); - if (! rom) - rom = map_optionrom(bdf, vendev); - if (! rom) - // No ROM present. - return NULL; - if (! is_valid_rom(rom)) return NULL; @@ -286,6 +277,21 @@ init_optionrom(u16 bdf) return rom; } +// Attempt to map and initialize the option rom on a given PCI device. +static struct rom_header * +init_optionrom(u16 bdf) +{ + u32 vendev = pci_config_readl(bdf, PCI_VENDOR_ID); + dprintf(4, "Attempting to init PCI bdf %x (dev/ven %x)\n", bdf, vendev); + struct rom_header *rom = lookup_hardcode(vendev); + if (! rom) + rom = map_optionrom(bdf, vendev); + if (! rom) + // No ROM present. + return NULL; + return verifysize_optionrom(rom, bdf); +} + /**************************************************************** * Non-VGA option rom init @@ -325,6 +331,16 @@ optionrom_setup() continue; init_optionrom(bdf); } + + // Find and deploy CBFS roms not associated with a device. + struct cbfs_file *tmp = NULL; + for (;;) { + tmp = cbfs_copy_gen_optionrom( + (void*)next_rom, BUILD_BIOS_ADDR - next_rom, tmp); + if (!tmp) + break; + verifysize_optionrom((void*)next_rom, 0); + } } // All option roms found and deployed - now build BEV/BCV vectors. |