[SeaBIOS] [PATCH 7/9] Create mapping between rom address and boot priority.
Kevin O'Connor
kevin at koconnor.net
Fri Dec 24 18:13:14 CET 2010
On Thu, Dec 23, 2010 at 11:29:41AM +0200, Gleb Natapov wrote:
> At the time of bev/bcv initialization the device rom was loaded from is
> no longer know. Only memory address where rom resides is know at this
> point. This patch create mapping between boot priority and rom address
> at rom initialization time for use during bev/bcv init.
>
> Signed-off-by: Gleb Natapov <gleb at redhat.com>
I find this patch confusing. How about the patch below instead?
-Kevin
diff --git a/src/optionroms.c b/src/optionroms.c
index 854c33f..579fdd8 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -195,13 +195,17 @@ copy_rom(struct rom_header *rom)
return (void*)RomEnd;
}
+static u8 RomPriority[(BUILD_BIOS_ADDR - BUILD_ROM_START) / OPTION_ROM_ALIGN];
+
// Run rom init code and note rom size.
static int
-init_optionrom(struct rom_header *rom, u16 bdf, int isvga)
+init_optionrom(struct rom_header *rom, u16 bdf, int isvga, u8 prio)
{
if (! is_valid_rom(rom))
return -1;
+ RomPriority[((u32)rom - BUILD_ROM_START) / OPTION_ROM_ALIGN] = prio;
+
if (isvga || get_pnp_rom(rom))
// Only init vga and PnP roms here.
callrom(rom, bdf);
@@ -249,7 +253,7 @@ run_file_roms(const char *prefix, int isvga)
break;
int ret = romfile_copy(file, (void*)RomEnd, max_rom() - RomEnd);
if (ret > 0)
- init_optionrom((void*)RomEnd, 0, isvga);
+ init_optionrom((void*)RomEnd, 0, isvga, -1);
}
}
@@ -342,7 +346,7 @@ init_pcirom(u16 bdf, int isvga)
if (! rom)
// No ROM present.
return -1;
- return init_optionrom(rom, bdf, isvga);
+ return init_optionrom(rom, bdf, isvga, -1);
}
@@ -364,7 +368,7 @@ optionrom_setup(void)
// Option roms are already deployed on the system.
u32 pos = RomEnd;
while (pos < max_rom()) {
- int ret = init_optionrom((void*)pos, 0, 0);
+ int ret = init_optionrom((void*)pos, 0, 0, -1);
if (ret)
pos += OPTION_ROM_ALIGN;
else
@@ -430,7 +434,7 @@ vga_setup(void)
if (CONFIG_OPTIONROMS_DEPLOYED) {
// Option roms are already deployed on the system.
- init_optionrom((void*)BUILD_ROM_START, 0, 1);
+ init_optionrom((void*)BUILD_ROM_START, 0, 1, -1);
} else {
// Clear option rom memory
memset((void*)RomEnd, 0, _max_rom() - RomEnd);
More information about the SeaBIOS
mailing list