coreboot: infrastructure for different ramstage loaders
There are 2 methods currently available in coreboot to load ramstage from romstage: cbfs and vboot. The vboot path had to be explicitly enabled and code needed to be added to each chipset to support both. Additionally, many of the paths were duplicated between the two. An additional complication is the presence of having a relocatable ramstage which creates another path with duplication. To rectify this situation provide a common API through the use of a callback to load the ramstage. The rest of the existing logic to handle all the various cases is put in a common place. Change-Id: I5268ce70686cc0d121161a775c3a86ea38a4d8ae Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5087 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
committed by
Aaron Durbin
parent
e9aaa71fb1
commit
0f333071ef
@ -123,58 +123,6 @@ void *cbfs_load_optionrom(struct cbfs_media *media, uint16_t vendor,
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if CONFIG_RELOCATABLE_RAMSTAGE && defined(__PRE_RAM__)
|
||||
|
||||
#include <rmodule.h>
|
||||
#include <romstage_handoff.h>
|
||||
static void *load_stage_from_cbfs(struct cbfs_media *media, const char *name,
|
||||
struct romstage_handoff *handoff)
|
||||
{
|
||||
struct rmod_stage_load rmod_ram = {
|
||||
.cbmem_id = CBMEM_ID_RAMSTAGE,
|
||||
.name = name,
|
||||
};
|
||||
|
||||
if (rmodule_stage_load_from_cbfs(&rmod_ram)) {
|
||||
printk(BIOS_DEBUG, "Could not load ramstage.\n");
|
||||
return (void *) -1;
|
||||
}
|
||||
|
||||
cache_loaded_ramstage(handoff, rmod_ram.cbmem_entry, rmod_ram.entry);
|
||||
|
||||
return rmod_ram.entry;
|
||||
}
|
||||
|
||||
void * cbfs_load_stage(struct cbfs_media *media, const char *name)
|
||||
{
|
||||
struct romstage_handoff *handoff;
|
||||
const struct cbmem_entry *ramstage;
|
||||
void *entry;
|
||||
|
||||
handoff = romstage_handoff_find_or_add();
|
||||
|
||||
if (handoff == NULL) {
|
||||
LOG("Couldn't find or allocate romstage handoff.\n");
|
||||
return load_stage_from_cbfs(media, name, handoff);
|
||||
} else if (!handoff->s3_resume)
|
||||
return load_stage_from_cbfs(media, name, handoff);
|
||||
|
||||
ramstage = cbmem_entry_find(CBMEM_ID_RAMSTAGE);
|
||||
|
||||
if (ramstage == NULL)
|
||||
return load_stage_from_cbfs(media, name, handoff);
|
||||
|
||||
/* S3 resume path. Load a cached copy of the loaded ramstage. If
|
||||
* return value is NULL load from cbfs. */
|
||||
entry = load_cached_ramstage(handoff, ramstage);
|
||||
if (entry == NULL)
|
||||
return load_stage_from_cbfs(media, name, handoff);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void * cbfs_load_stage(struct cbfs_media *media, const char *name)
|
||||
{
|
||||
struct cbfs_stage *stage = (struct cbfs_stage *)
|
||||
@ -211,7 +159,6 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name)
|
||||
|
||||
return (void *) entry;
|
||||
}
|
||||
#endif /* CONFIG_RELOCATABLE_RAMSTAGE */
|
||||
|
||||
#if !CONFIG_ALT_CBFS_LOAD_PAYLOAD
|
||||
void *cbfs_load_payload(struct cbfs_media *media, const char *name)
|
||||
|
Reference in New Issue
Block a user