diff options
author | Aaron Durbin <adurbin@chromium.org> | 2014-02-24 14:56:34 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2014-03-03 19:48:02 +0100 |
commit | bdf913ab010c99db8e64845f5b5837c9008609dc (patch) | |
tree | 75b62500dfe2edfa7846febb7924bde551b16baa /src/lib/hardwaremain.c | |
parent | 9cd96b409646418040f5c046a1366cfc38251d70 (diff) |
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 <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/5296
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/lib/hardwaremain.c')
-rw-r--r-- | src/lib/hardwaremain.c | 22 |
1 files changed, 9 insertions, 13 deletions
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 <stdlib.h> #include <reset.h> #include <boot/tables.h> -#include <cbfs.h> +#include <payload_loader.h> #include <lib.h> #if CONFIG_HAVE_ACPI_RESUME #include <arch/acpi.h> @@ -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 |