diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-03-20 16:37:12 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2015-04-03 14:53:11 +0200 |
commit | ce9efe061a23bc3e3d2a4c17cf29692ce6f9eb53 (patch) | |
tree | 4c7715b3d7869bb3282751f536450e653dc83dbe /src/include | |
parent | b3847e64242228166976f425cd42331db7857551 (diff) |
program loading: unify on struct prog
Instead of having different structures for loading
ramstage and payload align to using struct prog.
This also removes arch_payload_run() in favor of
the prog_run() interface.
Change-Id: I31483096094eacc713a7433811cd69cc5621c43e
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/8849
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/program_loading.h | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/src/include/program_loading.h b/src/include/program_loading.h index 1df1825869..269988777f 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -50,7 +50,8 @@ struct prog { const char *name; /* The area can mean different things depending on what type the * program is. e.g. a payload prog uses this field for the backing - * store of the payload_segments and data. */ + * store of the payload_segments and data. After loading the segments + * area is updated to reflect the bounce buffer used. */ struct buffer_area area; /* Entry to program with optional argument. It's up to the architecture * to decide if argument is passed. */ @@ -100,6 +101,14 @@ void arch_prog_run(struct prog *prog); * code it needs to that as well. */ void platform_prog_run(struct prog *prog); +struct prog_loader_ops { + const char *name; + /* Returns < 0 on error or 0 on success. This function needs to do + * different things depending on the prog type. See definition + * of struct prog above. */ + int (*prepare)(struct prog *prog); +}; + /************************ * ROMSTAGE LOADING * ************************/ @@ -111,6 +120,9 @@ void run_romstage(void); * RAMSTAGE LOADING * ************************/ +/* Run ramstage from romstage. */ +void run_ramstage(void); + struct romstage_handoff; #if IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE) /* Cache the loaded ramstage described by prog. */ @@ -124,25 +136,10 @@ static inline void load_cached_ramstage(struct romstage_handoff *h, struct prog *p) {} #endif -/* Run ramstage from romstage. */ -void run_ramstage(void); - -struct ramstage_loader_ops { - const char *name; - /* Returns 0 on succes. < 0 on error. */ - int (*load)(struct prog *ramstage); -}; - /*********************** * PAYLOAD LOADING * ***********************/ -struct payload { - struct prog prog; - /* Used when payload wants memory coreboot ramstage is running at. */ - struct buffer_area bounce; -}; - /* Load payload into memory in preparation to run. */ void payload_load(void); @@ -150,23 +147,9 @@ void payload_load(void); void payload_run(void); /* Mirror the payload to be loaded. */ -void mirror_payload(struct payload *payload); - -/* architecture specific function to run payload. */ -void arch_payload_run(struct payload *payload); - -/* Payload loading operations. */ -struct payload_loader_ops { - const char *name; - /* - * Fill in payload_backing_store structure. Return 0 on success, < 0 - * on failure. - */ - int (*locate)(struct payload *payload); -}; +void mirror_payload(struct prog *payload); /* Defined in src/lib/selfboot.c */ -void *selfload(struct payload *payload); - +void *selfload(struct prog *payload); #endif /* PROGRAM_LOADING_H */ |