These are some cleanups and changes. These are build and boot tested on qemu.
Some changes for option roms: - don't make users pick the name. Names for option roms are in the v3-defined format of pci%04x,%04x.rom with the vendor and device id filling in the %04x. - users pass in vendor and device id. - users pass in a dest. If the dest is 0, the address of the ROM image in FLASH is returned. If the address is non-zero, then the decmpressor is called, and it will make sure the ROM image is copied to the destination (even in the uncompressed case). And some type and print cleanup. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4060 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
ace2dc5962
commit
d7a709a60f
|
@ -162,8 +162,7 @@ void * romfs_load_payload(struct lb_memory *lb_mem, const char *name);
|
||||||
void * romfs_load_stage(const char *name);
|
void * romfs_load_stage(const char *name);
|
||||||
int romfs_execute_stage(const char *name);
|
int romfs_execute_stage(const char *name);
|
||||||
void * romfs_get_file(const char *name);
|
void * romfs_get_file(const char *name);
|
||||||
int romfs_load_optionrom(const char *name, u32 dest);
|
void *romfs_load_optionrom(u16 vendor, u16 device, void * dest);
|
||||||
|
|
||||||
int run_address(void *f);
|
int run_address(void *f);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct romfs_header *romfs_master_header(void)
|
||||||
{
|
{
|
||||||
struct romfs_header *header;
|
struct romfs_header *header;
|
||||||
|
|
||||||
unsigned long ptr = *((unsigned long *) ROMFS_HEADPTR_ADDR);
|
void *ptr = (void *)*((unsigned long *) ROMFS_HEADPTR_ADDR);
|
||||||
printk_debug("Check ROMFS header at %p\n", ptr);
|
printk_debug("Check ROMFS header at %p\n", ptr);
|
||||||
header = (struct romfs_header *) ptr;
|
header = (struct romfs_header *) ptr;
|
||||||
|
|
||||||
|
@ -130,22 +130,39 @@ struct romfs_stage *romfs_find_file(const char *name, int type)
|
||||||
return (void *) ROMFS_SUBHEADER(file);
|
return (void *) ROMFS_SUBHEADER(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
int romfs_load_optionrom(const char *name, u32 dest)
|
void *romfs_load_optionrom(u16 vendor, u16 device, void * dest)
|
||||||
{
|
{
|
||||||
struct romfs_optionrom *orom = (struct romfs_optionrom *)
|
char name[17];
|
||||||
|
struct romfs_optionrom *orom;
|
||||||
|
u8 *src;
|
||||||
|
|
||||||
|
sprintf(name,"pci%04x,%04x.rom", vendor, device);
|
||||||
|
|
||||||
|
orom = (struct romfs_optionrom *)
|
||||||
romfs_find_file(name, ROMFS_TYPE_OPTIONROM);
|
romfs_find_file(name, ROMFS_TYPE_OPTIONROM);
|
||||||
|
|
||||||
if (orom == NULL)
|
if (orom == NULL)
|
||||||
return -1;
|
return NULL;
|
||||||
|
|
||||||
|
/* They might have specified a dest address. If so, we can decompress.
|
||||||
|
* If not, there's not much hope of decompressing or relocating the rom.
|
||||||
|
* in the common case, the expansion rom is uncompressed, we
|
||||||
|
* pass 0 in for the dest, and all we have to do is find the rom and
|
||||||
|
* return a pointer to it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
src = ((unsigned char *) orom) + sizeof(struct romfs_optionrom);
|
||||||
|
|
||||||
|
if (! dest)
|
||||||
|
return src;
|
||||||
|
|
||||||
if (romfs_decompress(ntohl(orom->compression),
|
if (romfs_decompress(ntohl(orom->compression),
|
||||||
((unsigned char *) orom) +
|
src,
|
||||||
sizeof(struct romfs_optionrom),
|
dest,
|
||||||
(void *) dest,
|
|
||||||
ntohl(orom->len)))
|
ntohl(orom->len)))
|
||||||
return -1;
|
return NULL;
|
||||||
|
|
||||||
return 0;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * romfs_load_payload(struct lb_memory *lb_mem, const char *name)
|
void * romfs_load_payload(struct lb_memory *lb_mem, const char *name)
|
||||||
|
|
Loading…
Reference in New Issue