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>
This commit is contained in:
Aaron Durbin
2014-02-24 14:56:34 -06:00
committed by Aaron Durbin
parent 9cd96b4096
commit bdf913ab01
10 changed files with 222 additions and 40 deletions

View File

@ -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");
payload = payload_load();
if (! payload)
die("Could not find a payload\n");
entry = selfload(get_lb_mem(), payload);
if (! entry)
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