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

@ -82,7 +82,9 @@ int recovery_mode_enabled(void)
}
#if CONFIG_VBOOT_VERIFY_FIRMWARE
void *vboot_get_payload(size_t *len)
#include <payload_loader.h>
static void *vboot_get_payload(size_t *len)
{
struct vboot_handoff *vboot_handoff;
struct firmware_component *fwc;
@ -109,6 +111,27 @@ void *vboot_get_payload(size_t *len)
return (void *)fwc->address;
}
static int vboot_locate_payload(struct payload *payload)
{
void *buffer;
size_t size;
buffer = vboot_get_payload(&size);
if (buffer == NULL)
return -1;
payload->backing_store.data = buffer;
payload->backing_store.size = size;
return 0;
}
const struct payload_loader_ops vboot_payload_loader = {
.name = "VBOOT",
.locate = vboot_locate_payload,
};
int vboot_get_handoff_info(void **addr, uint32_t *size)
{
struct vboot_handoff *vboot_handoff;

View File

@ -47,7 +47,6 @@ int recovery_mode_enabled(void);
void init_chromeos(int bootmode);
#if CONFIG_VBOOT_VERIFY_FIRMWARE
void *vboot_get_payload(size_t *len);
/* Returns 0 on success < 0 on error. */
int vboot_get_handoff_info(void **addr, uint32_t *size);
#endif