summaryrefslogtreecommitdiff
path: root/src/vendorcode/google
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-02-24 14:56:34 -0600
committerAaron Durbin <adurbin@google.com>2014-03-03 19:48:02 +0100
commitbdf913ab010c99db8e64845f5b5837c9008609dc (patch)
tree75b62500dfe2edfa7846febb7924bde551b16baa /src/vendorcode/google
parent9cd96b409646418040f5c046a1366cfc38251d70 (diff)
downloadcoreboot-bdf913ab010c99db8e64845f5b5837c9008609dc.tar.xz
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/vendorcode/google')
-rw-r--r--src/vendorcode/google/chromeos/chromeos.c25
-rw-r--r--src/vendorcode/google/chromeos/chromeos.h1
2 files changed, 24 insertions, 2 deletions
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index 54fe8dbb30..e917ba1f35 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -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;
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 0359c91409..7fe8f06c08 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -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