program loading: add prog_run() function

The prog_run() function abstracts away what is required
for running a given program. Within it, there are 2
calls: 1. platform_prog_run() and 2. arch_prog_run().
The platform_prog_run() allows for a chipset to intercept
a program that will be run. This allows for CPU switching
as currently needed in t124 and t132.

Change-Id: I22a5dd5bfb1018e7e46475e47ac993a0941e2a8c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/8846
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Aaron Durbin
2015-03-20 15:55:08 -05:00
committed by Aaron Durbin
parent 3948e5392b
commit b3847e6424
15 changed files with 95 additions and 22 deletions

View File

@@ -25,15 +25,16 @@
#include <arch/transition.h>
#include <console/console.h>
#include <program_loading.h>
#include <rules.h>
#include <string.h>
void arch_payload_run(const struct payload *payload)
static void run_payload(struct prog *prog)
{
void (*doit)(void *);
void *arg;
doit = prog_entry(&payload->prog);
arg = prog_entry_arg(&payload->prog);
doit = prog_entry(prog);
arg = prog_entry_arg(prog);
uint8_t current_el = get_current_el();
@@ -61,3 +62,23 @@ void arch_payload_run(const struct payload *payload)
cache_sync_instructions();
transition_with_entry(doit, arg, &exc_state);
}
void arch_prog_run(struct prog *prog)
{
void (*doit)(void *);
void *arg;
if (ENV_RAMSTAGE && prog->type == PROG_PAYLOAD)
run_payload(prog);
return;
doit = prog_entry(prog);
arg = prog_entry_arg(prog);
doit(prog_entry_arg(prog));
}
void arch_payload_run(struct payload *payload)
{
arch_prog_run(&payload->prog);
}