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>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@1081 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Myles Watson 2008-12-22 17:27:00 +00:00
commit a94ea6f062
4 changed files with 39 additions and 22 deletions

View file

@ -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;
}
@ -301,15 +308,17 @@ biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev)
}
}
#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);

View file

@ -15,11 +15,12 @@ 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)

View file

@ -281,26 +281,33 @@ biosemu_dev_get_device_vendor_id(void)
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");

View file

@ -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);
@ -166,7 +166,7 @@ in16le(void *addr)
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)
{