Hi, On Sat, Dec 20, 2008 at 2:44 PM, Myles Watson mylesgw@gmail.com wrote:
That would be great. Once that's done I think I'll try YABEL on a "factory" BIOS from inside Coreboot. Qemu would be an easy place to try that.
here is the patch that should use the address that coreboot passes, unless that address is 0, then the ExpROM BAR address is used.
Subject: [PATCH] use the rom_addr passed by coreboot, needed for ROM images from LAR
Signed-off-by: Pattrick Hueper phueper@hueper.net --- util/x86emu/yabel/biosemu.c | 11 +++++++++-- util/x86emu/yabel/compat/functions.c | 4 ++-- util/x86emu/yabel/device.c | 22 +++++++++++++--------- util/x86emu/yabel/device.h | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/util/x86emu/yabel/biosemu.c b/util/x86emu/yabel/biosemu.c index 7e92fde..cc11c0f 100644 --- a/util/x86emu/yabel/biosemu.c +++ b/util/x86emu/yabel/biosemu.c @@ -43,8 +43,15 @@ static X86EMU_pioFuncs my_pio_funcs = {
void dump(u8 * addr, u32 len);
+/* main entry into YABEL biosemu, arguments are: + * *biosmem = pointer to virtual memory + * biosmem_size = size of the virtual memory + * *dev = pointer to the device to be initialised + * rom_addr = address of the OptionROM to be executed, if this is = 0, YABEL + * will look for an ExpansionROM BAR and use the code from there. + */ u32 -biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev) +biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_addr) { u8 *rom_image; int i = 0; @@ -60,7 +67,7 @@ biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev) printf("Error initializing device!\n"); return -1; } - if (biosemu_dev_check_exprom() != 0) { + if (biosemu_dev_check_exprom(rom_addr) != 0) { printf("Error: Device Expansion ROM invalid!\n"); return -1; } diff --git a/util/x86emu/yabel/compat/functions.c b/util/x86emu/yabel/compat/functions.c index c1a6d9a..33c9115 100644 --- a/util/x86emu/yabel/compat/functions.c +++ b/util/x86emu/yabel/compat/functions.c @@ -15,11 +15,11 @@ u8* vmem = (u8 *) CONFIG_YABEL_VIRTMEM_LOCATION; u8* vmem = (u8 *) (16*1024*1024); /* default to 16MB */ #endif
-u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev); +u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_addr);
void run_bios(struct device * dev, unsigned long addr) { - biosemu(vmem, VMEM_SIZE, dev); + biosemu(vmem, VMEM_SIZE, dev, addr); }
u64 get_time(void) diff --git a/util/x86emu/yabel/device.c b/util/x86emu/yabel/device.c index ab4e7a2..0a0e00f 100644 --- a/util/x86emu/yabel/device.c +++ b/util/x86emu/yabel/device.c @@ -282,21 +282,25 @@ biosemu_dev_get_device_vendor_id(void) }
/* check, wether the device has a valid Expansion ROM, also search the PCI Data Structure and - * any Expansion ROM Header (using dev_scan_exp_header()) for needed information */ + * any Expansion ROM Header (using dev_scan_exp_header()) for needed information + * if the rom_addr parameter is != 0, it is the address of the Expansion ROM image and will be + * used, if it is == 0, the Expansion ROM BAR address will be used + */ u8 -biosemu_dev_check_exprom() +biosemu_dev_check_exprom(unsigned long rom_base_addr) { int i = 0; translate_address_t ta; - unsigned long rom_base_addr = 0; u16 pci_ds_offset; pci_data_struct_t pci_ds; - // check for ExpROM Address (Offset 30) in taa - for (i = 0; i <= taa_last_entry; i++) { - ta = translate_address_array[i]; - if (ta.cfg_space_offset == 0x30) { - rom_base_addr = ta.address + ta.address_offset; //translated address - break; + if (rom_base_addr == 0) { + // check for ExpROM Address (Offset 30) in taa + for (i = 0; i <= taa_last_entry; i++) { + ta = translate_address_array[i]; + if (ta.cfg_space_offset == 0x30) { + rom_base_addr = ta.address + ta.address_offset; //translated address + break; + } } } // in the ROM there could be multiple Expansion ROM Images... start searching diff --git a/util/x86emu/yabel/device.h b/util/x86emu/yabel/device.h index 09c7710..0f1680c 100644 --- a/util/x86emu/yabel/device.h +++ b/util/x86emu/yabel/device.h @@ -115,7 +115,7 @@ extern biosemu_device_t bios_device;
u8 biosemu_dev_init(struct device * device); // NOTE: for dev_check_exprom to work, biosemu_dev_init MUST be called first! -u8 biosemu_dev_check_exprom(void); +u8 biosemu_dev_check_exprom(unsigned long rom_base_addr);
u8 biosemu_dev_translate_address(unsigned long * addr);