From bdf913ab010c99db8e64845f5b5837c9008609dc Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 24 Feb 2014 14:56:34 -0600 Subject: coreboot: unify infrastructure for loading payloads A payload can be loaded either from a vboot region or from cbfs. Provide a common place for choosing where the payload is loaded from. Additionally, place the logic in the 'loaders' directory similarly to the ramstage loader infrastructure. Change-Id: I6b0034ea5ebd04a3d058151819ac77a126a6bfe2 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/5296 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel --- src/lib/hardwaremain.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/lib/hardwaremain.c') diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index fed153be48..d90e0f6b94 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #if CONFIG_HAVE_ACPI_RESUME #include @@ -226,30 +226,26 @@ static boot_state_t bs_write_tables(void *arg) static boot_state_t bs_payload_load(void *arg) { - void *payload; - void *entry; + struct payload *payload; timestamp_add_now(TS_LOAD_PAYLOAD); - payload = cbfs_load_payload(CBFS_DEFAULT_MEDIA, - CONFIG_CBFS_PREFIX "/payload"); - if (! payload) - die("Could not find a payload\n"); - - entry = selfload(get_lb_mem(), payload); + payload = payload_load(); - if (! entry) + if (! payload) die("Could not load payload\n"); /* Pass the payload to the next state. */ - boot_states[BS_PAYLOAD_BOOT].arg = entry; + boot_states[BS_PAYLOAD_BOOT].arg = payload; return BS_PAYLOAD_BOOT; } -static boot_state_t bs_payload_boot(void *entry) +static boot_state_t bs_payload_boot(void *arg) { - selfboot(entry); + struct payload *payload = arg; + + payload_run(payload); printk(BIOS_EMERG, "Boot failed"); /* Returning from this state will fail because the following signals -- cgit v1.2.3