Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8836
-gerrit
commit d62afc3426f968c264149cef772381e4e74903ec Author: Aaron Durbin adurbin@chromium.org Date: Fri Mar 20 10:20:15 2015 -0500
payload loading: remove passing of struct payload
There's no need to keep track of struct payload within the boot state machine. It is completely contained within the payload loader module.
Change-Id: I16fcecf43d7fb41fc311955fdb82eabbd5c96b11 Signed-off-by: Aaron Durbin adurbin@chromium.org --- src/include/program_loading.h | 9 +++------ src/lib/hardwaremain.c | 14 ++------------ src/lib/loaders/load_and_run_payload.c | 16 +++++++--------- 3 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/src/include/program_loading.h b/src/include/program_loading.h index e071db9..ca61c16 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -104,14 +104,11 @@ struct payload { void *entry; };
-/* - * Load payload into memory and return pointer to payload structure. Returns - * NULL on error. - */ -struct payload *payload_load(void); +/* Load payload into memory in preparation to run. */ +void payload_load(void);
/* Run the loaded payload. */ -void payload_run(const struct payload *payload); +void payload_run(void);
/* Mirror the payload to be loaded. */ void mirror_payload(struct payload *payload); diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index 1091c00..83bc7be 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -227,26 +227,16 @@ static boot_state_t bs_write_tables(void *arg)
static boot_state_t bs_payload_load(void *arg) { - struct payload *payload; - timestamp_add_now(TS_LOAD_PAYLOAD);
- payload = payload_load(); - - if (! payload) - die("Could not load payload\n"); - - /* Pass the payload to the next state. */ - boot_states[BS_PAYLOAD_BOOT].arg = payload; + payload_load();
return BS_PAYLOAD_BOOT; }
static boot_state_t bs_payload_boot(void *arg) { - struct payload *payload = arg; - - payload_run(payload); + payload_run();
printk(BIOS_EMERG, "Boot failed"); /* Returning from this state will fail because the following signals diff --git a/src/lib/loaders/load_and_run_payload.c b/src/lib/loaders/load_and_run_payload.c index 4bb29c1..89b6da6 100644 --- a/src/lib/loaders/load_and_run_payload.c +++ b/src/lib/loaders/load_and_run_payload.c @@ -44,7 +44,7 @@ void __attribute__((weak)) mirror_payload(struct payload *payload) return; }
-struct payload *payload_load(void) +void payload_load(void) { int i; void *entry; @@ -65,24 +65,22 @@ struct payload *payload_load(void) }
if (i == ARRAY_SIZE(payload_ops)) - return NULL; + goto out;
mirror_payload(payload);
entry = selfload(payload);
- if (entry == NULL) - return NULL; - payload->entry = entry;
- return payload; +out: + if (payload->entry == NULL) + die("Payload not loaded.\n"); }
-void payload_run(const struct payload *payload) +void payload_run(void) { - if (payload == NULL) - return; + const struct payload *payload = &global_payload;
/* Reset to booting from this image as late as possible */ boot_successful();