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> Reviewed-on: http://review.coreboot.org/8836 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
committed by
Aaron Durbin
parent
fcfdff84f4
commit
ebf2ed4621
@ -104,14 +104,11 @@ struct payload {
|
|||||||
void *entry;
|
void *entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* Load payload into memory in preparation to run. */
|
||||||
* Load payload into memory and return pointer to payload structure. Returns
|
void payload_load(void);
|
||||||
* NULL on error.
|
|
||||||
*/
|
|
||||||
struct payload *payload_load(void);
|
|
||||||
|
|
||||||
/* Run the loaded payload. */
|
/* Run the loaded payload. */
|
||||||
void payload_run(const struct payload *payload);
|
void payload_run(void);
|
||||||
|
|
||||||
/* Mirror the payload to be loaded. */
|
/* Mirror the payload to be loaded. */
|
||||||
void mirror_payload(struct payload *payload);
|
void mirror_payload(struct payload *payload);
|
||||||
|
@ -227,26 +227,16 @@ static boot_state_t bs_write_tables(void *arg)
|
|||||||
|
|
||||||
static boot_state_t bs_payload_load(void *arg)
|
static boot_state_t bs_payload_load(void *arg)
|
||||||
{
|
{
|
||||||
struct payload *payload;
|
|
||||||
|
|
||||||
timestamp_add_now(TS_LOAD_PAYLOAD);
|
timestamp_add_now(TS_LOAD_PAYLOAD);
|
||||||
|
|
||||||
payload = payload_load();
|
payload_load();
|
||||||
|
|
||||||
if (! payload)
|
|
||||||
die("Could not load payload\n");
|
|
||||||
|
|
||||||
/* Pass the payload to the next state. */
|
|
||||||
boot_states[BS_PAYLOAD_BOOT].arg = payload;
|
|
||||||
|
|
||||||
return BS_PAYLOAD_BOOT;
|
return BS_PAYLOAD_BOOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boot_state_t bs_payload_boot(void *arg)
|
static boot_state_t bs_payload_boot(void *arg)
|
||||||
{
|
{
|
||||||
struct payload *payload = arg;
|
payload_run();
|
||||||
|
|
||||||
payload_run(payload);
|
|
||||||
|
|
||||||
printk(BIOS_EMERG, "Boot failed");
|
printk(BIOS_EMERG, "Boot failed");
|
||||||
/* Returning from this state will fail because the following signals
|
/* Returning from this state will fail because the following signals
|
||||||
|
@ -44,7 +44,7 @@ void __attribute__((weak)) mirror_payload(struct payload *payload)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct payload *payload_load(void)
|
void payload_load(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
void *entry;
|
void *entry;
|
||||||
@ -65,24 +65,22 @@ struct payload *payload_load(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(payload_ops))
|
if (i == ARRAY_SIZE(payload_ops))
|
||||||
return NULL;
|
goto out;
|
||||||
|
|
||||||
mirror_payload(payload);
|
mirror_payload(payload);
|
||||||
|
|
||||||
entry = selfload(payload);
|
entry = selfload(payload);
|
||||||
|
|
||||||
if (entry == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
payload->entry = entry;
|
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)
|
const struct payload *payload = &global_payload;
|
||||||
return;
|
|
||||||
|
|
||||||
/* Reset to booting from this image as late as possible */
|
/* Reset to booting from this image as late as possible */
|
||||||
boot_successful();
|
boot_successful();
|
||||||
|
Reference in New Issue
Block a user