summaryrefslogtreecommitdiff
path: root/src/lib/loaders/load_and_run_romstage.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-04-21 15:18:22 -0500
committerAaron Durbin <adurbin@chromium.org>2015-04-22 15:38:30 +0200
commit69cb2c2b5e4c4e4db005dc57249c0d15cadea5ee (patch)
tree952d017902077f8394e8a5ad8907b7f284f5df70 /src/lib/loaders/load_and_run_romstage.c
parent13d45aa92877bec1ff10221b3af85d57b59adf6d (diff)
downloadcoreboot-69cb2c2b5e4c4e4db005dc57249c0d15cadea5ee.tar.xz
coreboot: add a place to choose romstage loader
Instead of always loading romstage from cbfs provide a way, similar to ramstage and payload, for other program loaders to intervene. For now, only the cbfs loader is consulted. TEST=Booted to end of ramstage on qemu-armv7 Change-Id: I87c3e2e566d7a0723e775aa427de58af745ecdd5 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9934 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/lib/loaders/load_and_run_romstage.c')
-rw-r--r--src/lib/loaders/load_and_run_romstage.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/lib/loaders/load_and_run_romstage.c b/src/lib/loaders/load_and_run_romstage.c
index 9bd9603bab..1c2ed77abf 100644
--- a/src/lib/loaders/load_and_run_romstage.c
+++ b/src/lib/loaders/load_and_run_romstage.c
@@ -26,20 +26,38 @@
#include <program_loading.h>
#include <timestamp.h>
+extern const struct prog_loader_ops cbfs_romstage_loader;
+
+static const struct prog_loader_ops *loaders[] = {
+ &cbfs_romstage_loader,
+};
+
void run_romstage(void)
{
+ int i;
struct prog romstage = {
.name = CONFIG_CBFS_PREFIX "/romstage",
.type = PROG_ROMSTAGE,
};
- timestamp_add_now(TS_START_COPYROM);
- if (cbfs_load_prog_stage(CBFS_DEFAULT_MEDIA, &romstage) < 0) {
- if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
- die("Couldn't load romstage.\n");
- halt();
+ for (i = 0; i < ARRAY_SIZE(loaders); i++) {
+ const struct prog_loader_ops *ops;
+
+ ops = loaders[i];
+
+ printk(BIOS_DEBUG, "Trying %s romstage loader.\n", ops->name);
+
+ timestamp_add_now(TS_START_COPYROM);
+
+ if (ops->prepare(&romstage))
+ continue;
+
+ timestamp_add_now(TS_END_COPYROM);
+
+ prog_run(&romstage);
}
- timestamp_add_now(TS_END_COPYROM);
- prog_run(&romstage);
+ if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
+ die("Couldn't load romstage.\n");
+ halt();
}