On Fri, Dec 24, 2010 at 08:41:21PM +0200, Gleb Natapov wrote: > On Fri, Dec 24, 2010 at 01:33:20PM -0500, Kevin O'Connor wrote: > > On Fri, Dec 24, 2010 at 12:13:14PM -0500, Kevin O'Connor wrote: > > > 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 <g...@redhat.com> > > > > > > I find this patch confusing. How about the patch below instead? > > > > Hrmm - instead of tracking the priority of each rom, lets track the > > source of each rom, and then calculate the priority when adding the > > bev/bcv. How about the attached instead? (It is admittedly more > > complex, but it gives me the ability to set priorities for each BCV.) > > > I am OK with this one too. The attached patch includes parts of patch 8 > though (pass prio too add_bev/add_bcv functions).
Yeah - it conflicts with your patch 5 as well. I'm going to commit the patch below (which should be more of a replacement for your patch 7). -Kevin commit bca3a878467d30e13a776243c5ca3e426dc847a0 Author: Kevin O'Connor <ke...@koconnor.net> Date: Fri Dec 24 14:42:42 2010 -0500 Track the source of each optionrom deployed. It's useful to track where each optionrom in the system originated from when initializing bev/bcvs. So, keep a map of the rom address to its source. diff --git a/src/optionroms.c b/src/optionroms.c index 854c33f..19672f7 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -211,6 +211,15 @@ init_optionrom(struct rom_header *rom, u16 bdf, int isvga) return 0; } +#define RS_PCIROM (1LL<<33) + +static void +setRomSource(u64 *sources, struct rom_header *rom, u64 source) +{ + if (sources) + sources[((u32)rom - BUILD_ROM_START) / OPTION_ROM_ALIGN] = source; +} + /**************************************************************** * Roms in CBFS @@ -240,16 +249,19 @@ lookup_hardcode(u32 vendev) // Run all roms in a given CBFS directory. static void -run_file_roms(const char *prefix, int isvga) +run_file_roms(const char *prefix, int isvga, u64 *sources) { u32 file = 0; for (;;) { file = romfile_findprefix(prefix, file); if (!file) break; - int ret = romfile_copy(file, (void*)RomEnd, max_rom() - RomEnd); - if (ret > 0) - init_optionrom((void*)RomEnd, 0, isvga); + struct rom_header *rom = (void*)RomEnd; + int ret = romfile_copy(file, rom, max_rom() - RomEnd); + if (ret > 0) { + setRomSource(sources, rom, file); + init_optionrom(rom, 0, isvga); + } } } @@ -330,7 +342,7 @@ fail: // Attempt to map and initialize the option rom on a given PCI device. static int -init_pcirom(u16 bdf, int isvga) +init_pcirom(u16 bdf, int isvga, u64 *sources) { u32 vendev = pci_config_readl(bdf, PCI_VENDOR_ID); dprintf(4, "Attempting to init PCI bdf %02x:%02x.%x (vd %04x:%04x)\n" @@ -342,6 +354,7 @@ init_pcirom(u16 bdf, int isvga) if (! rom) // No ROM present. return -1; + setRomSource(sources, rom, RS_PCIROM | bdf); return init_optionrom(rom, bdf, isvga); } @@ -357,7 +370,8 @@ optionrom_setup(void) return; dprintf(1, "Scan for option roms\n"); - + u64 sources[(BUILD_BIOS_ADDR - BUILD_ROM_START) / OPTION_ROM_ALIGN]; + memset(sources, 0, sizeof(sources)); u32 post_vga = RomEnd; if (CONFIG_OPTIONROMS_DEPLOYED) { @@ -378,11 +392,11 @@ optionrom_setup(void) if (v == 0x0000 || v == 0xffff || v == PCI_CLASS_DISPLAY_VGA || (CONFIG_ATA && v == PCI_CLASS_STORAGE_IDE)) continue; - init_pcirom(bdf, 0); + init_pcirom(bdf, 0, sources); } // Find and deploy CBFS roms not associated with a device. - run_file_roms("genroms/", 0); + run_file_roms("genroms/", 0, sources); } // All option roms found and deployed - now build BEV/BCV vectors. @@ -438,10 +452,10 @@ vga_setup(void) // Find and deploy PCI VGA rom. int bdf = VGAbdf = pci_find_vga(); if (bdf >= 0) - init_pcirom(bdf, 1); + init_pcirom(bdf, 1, NULL); // Find and deploy CBFS vga-style roms not associated with a device. - run_file_roms("vgaroms/", 1); + run_file_roms("vgaroms/", 1, NULL); } if (RomEnd == BUILD_ROM_START) { _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios