Author: myles Date: 2008-12-22 18:27:00 +0100 (Mon, 22 Dec 2008) New Revision: 1081
Modified: coreboot-v3/util/x86emu/yabel/biosemu.c coreboot-v3/util/x86emu/yabel/compat/functions.c coreboot-v3/util/x86emu/yabel/device.c coreboot-v3/util/x86emu/yabel/device.h Log:
Date: Sun, 21 Dec 2008 00:09:12 +0100 Subject: [PATCH] use the rom_addr passed by coreboot, needed for ROM images from LAR
Signed-off-by: Pattrick Hueper phueper@hueper.net Acked-by: Myles Watson mylesgw@gmail.com
Modified: coreboot-v3/util/x86emu/yabel/biosemu.c =================================================================== --- coreboot-v3/util/x86emu/yabel/biosemu.c 2008-12-19 02:43:46 UTC (rev 1080) +++ coreboot-v3/util/x86emu/yabel/biosemu.c 2008-12-22 17:27:00 UTC (rev 1081) @@ -43,8 +43,15 @@
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 @@ 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; } @@ -301,15 +308,17 @@ } } #endif - // check wether the stack is "clean" i.e. containing the HLT instruction - // we pushed before executing, and pointing to the original stack address... - // indicating that the initialization probably was successful + /* Check whether the stack is "clean" i.e. containing the HLT + * instruction we pushed before executing and pointing to the original + * stack address... indicating that the initialization probably was + * successful + */ if ((pop_word() == 0xf4f4) && (M.x86.R_SS == STACK_SEGMENT) && (M.x86.R_SP == STACK_START_OFFSET)) { DEBUG_PRINTF("Stack is clean, initialization successfull!\n"); } else { DEBUG_PRINTF - ("Stack unclean, initialization probably NOT COMPLETE!!!\n"); + ("Stack unclean, initialization probably NOT COMPLETE!!\n"); DEBUG_PRINTF("SS:SP = %04x:%04x, expected: %04x:%04x\n", M.x86.R_SS, M.x86.R_SP, STACK_SEGMENT, STACK_START_OFFSET);
Modified: coreboot-v3/util/x86emu/yabel/compat/functions.c =================================================================== --- coreboot-v3/util/x86emu/yabel/compat/functions.c 2008-12-19 02:43:46 UTC (rev 1080) +++ coreboot-v3/util/x86emu/yabel/compat/functions.c 2008-12-22 17:27:00 UTC (rev 1081) @@ -15,11 +15,12 @@ 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)
Modified: coreboot-v3/util/x86emu/yabel/device.c =================================================================== --- coreboot-v3/util/x86emu/yabel/device.c 2008-12-19 02:43:46 UTC (rev 1080) +++ coreboot-v3/util/x86emu/yabel/device.c 2008-12-22 17:27:00 UTC (rev 1081) @@ -281,26 +281,33 @@ bios_device.pci_device_id, bios_device.pci_vendor_id); }
-/* 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 */ +/* Check whether the device has a valid Expansion ROM and search the PCI Data + * Structure and 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) { + //translated address + rom_base_addr = ta.address + ta.address_offset; + break; + } } } - // in the ROM there could be multiple Expansion ROM Images... start searching - // them for a x86 image + /* In the ROM there could be multiple Expansion ROM Images... start + * searching them for an x86 image. + */ do { if (rom_base_addr == 0) { printf("Error: no Expansion ROM address found!\n");
Modified: coreboot-v3/util/x86emu/yabel/device.h =================================================================== --- coreboot-v3/util/x86emu/yabel/device.h 2008-12-19 02:43:46 UTC (rev 1080) +++ coreboot-v3/util/x86emu/yabel/device.h 2008-12-22 17:27:00 UTC (rev 1081) @@ -115,7 +115,7 @@
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);
@@ -166,7 +166,7 @@ return val; }
-/* debug function, dumps HID1 and HID4 to detect wether caches are on/off */ +/* debug function, dumps HID1 and HID4 to detect whether caches are on/off */ static inline void dumpHID(void) {