diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-04-28 15:59:12 -0500 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-30 13:05:13 +0200 |
commit | 5e8286bed6f18cd2a85b029911f97da21b38394d (patch) | |
tree | 26cdb02663397d6ab40697abef50c3ba6e39aaed /src/lib/loaders/load_and_run_romstage.c | |
parent | 16110e7ffaf417f98bef2a359ec522f6fc160ee5 (diff) | |
download | coreboot-5e8286bed6f18cd2a85b029911f97da21b38394d.tar.xz |
program loading: add optional is_loader_active() callback
Add a way for a loader to indicate if it is active. Such users
of this callback would be vboot which can indicate to the rest
of the system that it isn't active. is_loader_active() also
gives vboot a chance to perform the necessary work to make
said decision.
Change-Id: I6679ac75b19bb1bfff9c2b709da5591986f752ff
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/10022
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/lib/loaders/load_and_run_romstage.c')
-rw-r--r-- | src/lib/loaders/load_and_run_romstage.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/loaders/load_and_run_romstage.c b/src/lib/loaders/load_and_run_romstage.c index 1c2ed77abf..b54bfc7e5c 100644 --- a/src/lib/loaders/load_and_run_romstage.c +++ b/src/lib/loaders/load_and_run_romstage.c @@ -41,11 +41,26 @@ void run_romstage(void) }; for (i = 0; i < ARRAY_SIZE(loaders); i++) { + /* Default loader state is active. */ + int ret = 1; const struct prog_loader_ops *ops; ops = loaders[i]; - printk(BIOS_DEBUG, "Trying %s romstage loader.\n", ops->name); + if (ops->is_loader_active != NULL) + ret = ops->is_loader_active(&romstage); + + if (ret == 0) { + printk(BIOS_DEBUG, "%s romstage loader inactive.\n", + ops->name); + continue; + } else if (ret < 0) { + printk(BIOS_DEBUG, "%s romstage loader failure.\n", + ops->name); + continue; + } + + printk(BIOS_DEBUG, "%s romstage loader active.\n", ops->name); timestamp_add_now(TS_START_COPYROM); |