summaryrefslogtreecommitdiff
path: root/src/lib/loaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/loaders')
-rw-r--r--src/lib/loaders/cbfs_payload_loader.c10
-rw-r--r--src/lib/loaders/cbfs_ramstage_loader.c4
-rw-r--r--src/lib/loaders/load_and_run_payload.c35
-rw-r--r--src/lib/loaders/load_and_run_ramstage.c12
4 files changed, 29 insertions, 32 deletions
diff --git a/src/lib/loaders/cbfs_payload_loader.c b/src/lib/loaders/cbfs_payload_loader.c
index 609d1232e1..3928613e73 100644
--- a/src/lib/loaders/cbfs_payload_loader.c
+++ b/src/lib/loaders/cbfs_payload_loader.c
@@ -20,24 +20,24 @@
#include <cbfs.h>
#include <program_loading.h>
-static int cbfs_locate_payload(struct payload *payload)
+static int cbfs_locate_payload(struct prog *payload)
{
void *buffer;
size_t size;
const int type = CBFS_TYPE_PAYLOAD;
- buffer = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, payload->prog.name,
+ buffer = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, payload->name,
type, &size);
if (buffer == NULL)
return -1;
- prog_set_area(&payload->prog, buffer, size);
+ prog_set_area(payload, buffer, size);
return 0;
}
-const struct payload_loader_ops cbfs_payload_loader = {
+const struct prog_loader_ops cbfs_payload_loader = {
.name = "CBFS",
- .locate = cbfs_locate_payload,
+ .prepare = cbfs_locate_payload,
};
diff --git a/src/lib/loaders/cbfs_ramstage_loader.c b/src/lib/loaders/cbfs_ramstage_loader.c
index 27be88ef7a..e565329616 100644
--- a/src/lib/loaders/cbfs_ramstage_loader.c
+++ b/src/lib/loaders/cbfs_ramstage_loader.c
@@ -54,7 +54,7 @@ static int cbfs_load_ramstage(struct prog *ramstage)
#endif /* CONFIG_RELOCATABLE_RAMSTAGE */
-const struct ramstage_loader_ops cbfs_ramstage_loader = {
+const struct prog_loader_ops cbfs_ramstage_loader = {
.name = "CBFS",
- .load = cbfs_load_ramstage,
+ .prepare = cbfs_load_ramstage,
};
diff --git a/src/lib/loaders/load_and_run_payload.c b/src/lib/loaders/load_and_run_payload.c
index e3208a9feb..6c42a589d2 100644
--- a/src/lib/loaders/load_and_run_payload.c
+++ b/src/lib/loaders/load_and_run_payload.c
@@ -26,24 +26,22 @@
#include <program_loading.h>
#include <timestamp.h>
-extern const struct payload_loader_ops vboot_payload_loader;
-extern const struct payload_loader_ops cbfs_payload_loader;
+extern const struct prog_loader_ops vboot_payload_loader;
+extern const struct prog_loader_ops cbfs_payload_loader;
-static const struct payload_loader_ops *payload_ops[] = {
+static const struct prog_loader_ops *payload_ops[] = {
#if CONFIG_VBOOT_VERIFY_FIRMWARE
&vboot_payload_loader,
#endif
&cbfs_payload_loader,
};
-static struct payload global_payload = {
- .prog = {
- .name = CONFIG_CBFS_PREFIX "/payload",
- .type = PROG_PAYLOAD,
- },
+static struct prog global_payload = {
+ .name = CONFIG_CBFS_PREFIX "/payload",
+ .type = PROG_PAYLOAD,
};
-void __attribute__((weak)) mirror_payload(struct payload *payload)
+void __attribute__((weak)) mirror_payload(struct prog *payload)
{
return;
}
@@ -51,19 +49,18 @@ void __attribute__((weak)) mirror_payload(struct payload *payload)
void payload_load(void)
{
int i;
- const struct payload_loader_ops *ops;
- struct payload *payload = &global_payload;
- struct prog * prog = &payload->prog;
+ const struct prog_loader_ops *ops;
+ struct prog *payload = &global_payload;
for (i = 0; i < ARRAY_SIZE(payload_ops); i++) {
ops = payload_ops[i];
- if (ops->locate(payload) < 0) {
+ if (ops->prepare(payload) < 0) {
printk(BIOS_DEBUG, "%s: could not locate payload.\n",
ops->name);
continue;
}
printk(BIOS_DEBUG, "%s: located payload @ %p, %zu bytes.\n",
- ops->name, prog_start(prog), prog_size(prog));
+ ops->name, prog_start(payload), prog_size(payload));
break;
}
@@ -73,23 +70,23 @@ void payload_load(void)
mirror_payload(payload);
/* Pass cbtables to payload if architecture desires it. */
- prog_set_entry(&payload->prog, selfload(payload),
+ prog_set_entry(payload, selfload(payload),
cbmem_find(CBMEM_ID_CBTABLE));
out:
- if (prog_entry(&payload->prog) == NULL)
+ if (prog_entry(payload) == NULL)
die("Payload not loaded.\n");
}
void payload_run(void)
{
- struct payload *payload = &global_payload;
+ struct prog *payload = &global_payload;
/* Reset to booting from this image as late as possible */
boot_successful();
printk(BIOS_DEBUG, "Jumping to boot code at %p(%p)\n",
- prog_entry(&payload->prog), prog_entry_arg(&payload->prog));
+ prog_entry(payload), prog_entry_arg(payload));
post_code(POST_ENTER_ELF_BOOT);
timestamp_add_now(TS_SELFBOOT_JUMP);
@@ -99,5 +96,5 @@ void payload_run(void)
*/
checkstack(_estack, 0);
- arch_payload_run(payload);
+ prog_run(payload);
}
diff --git a/src/lib/loaders/load_and_run_ramstage.c b/src/lib/loaders/load_and_run_ramstage.c
index 9067a28dc6..b3728a17cf 100644
--- a/src/lib/loaders/load_and_run_ramstage.c
+++ b/src/lib/loaders/load_and_run_ramstage.c
@@ -25,10 +25,10 @@
#include <romstage_handoff.h>
#include <timestamp.h>
-extern const struct ramstage_loader_ops cbfs_ramstage_loader;
-extern const struct ramstage_loader_ops vboot_ramstage_loader;
+extern const struct prog_loader_ops cbfs_ramstage_loader;
+extern const struct prog_loader_ops vboot_ramstage_loader;
-static const struct ramstage_loader_ops *loaders[] = {
+static const struct prog_loader_ops *loaders[] = {
#if CONFIG_VBOOT_VERIFY_FIRMWARE
&vboot_ramstage_loader,
#endif
@@ -36,12 +36,12 @@ static const struct ramstage_loader_ops *loaders[] = {
};
static void
-load_ramstage(const struct ramstage_loader_ops *ops,
+load_ramstage(const struct prog_loader_ops *ops,
struct romstage_handoff *handoff, struct prog *ramstage)
{
timestamp_add_now(TS_START_COPYRAM);
- if (ops->load(ramstage))
+ if (ops->prepare(ramstage))
return;
cache_loaded_ramstage(handoff, ramstage);
@@ -68,7 +68,7 @@ static void run_ramstage_from_resume(struct romstage_handoff *handoff,
void run_ramstage(void)
{
struct romstage_handoff *handoff;
- const struct ramstage_loader_ops *ops;
+ const struct prog_loader_ops *ops;
int i;
struct prog ramstage = {
.name = CONFIG_CBFS_PREFIX "/ramstage",