From 5e8286bed6f18cd2a85b029911f97da21b38394d Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 28 Apr 2015 15:59:12 -0500 Subject: 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 Reviewed-on: http://review.coreboot.org/10022 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/lib/loaders/load_and_run_payload.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/lib/loaders/load_and_run_payload.c') diff --git a/src/lib/loaders/load_and_run_payload.c b/src/lib/loaders/load_and_run_payload.c index 0e08d8829d..7a08097884 100644 --- a/src/lib/loaders/load_and_run_payload.c +++ b/src/lib/loaders/load_and_run_payload.c @@ -54,7 +54,24 @@ void payload_load(void) struct prog *payload = &global_payload; for (i = 0; i < ARRAY_SIZE(payload_ops); i++) { + /* Default loader state is active. */ + int ret = 1; + ops = payload_ops[i]; + + if (ops->is_loader_active != NULL) + ret = ops->is_loader_active(payload); + + if (ret == 0) { + printk(BIOS_DEBUG, "%s payload loader inactive.\n", + ops->name); + continue; + } else if (ret < 0) { + printk(BIOS_DEBUG, "%s payload loader failure.\n", + ops->name); + continue; + } + if (ops->prepare(payload) < 0) { printk(BIOS_DEBUG, "%s: could not locate payload.\n", ops->name); -- cgit v1.2.3