rmodule: consolidate rmodule stage loading

There are 3 places rmodule stages are loaded in the
existing code: cbfs and 2 in vboot_wrapper. Much of the
code is the same except for a few different cbmem entry
ids. Instead provide a common implementation in the
rmodule library itself.

A structure named rmod_stage_load is introduced to manage
the inputs and outputs from the new API.

BUG=chrome-os-partner:22866
BRANCH=None
TEST=Built and booted successfully.

Change-Id: I146055005557e04164e95de4aae8a2bde8713131
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174425
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://review.coreboot.org/4897
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Aaron Durbin
2013-10-24 10:14:06 -05:00
committed by Aaron Durbin
parent 16000c883e
commit f545abfd22
4 changed files with 108 additions and 118 deletions

View File

@@ -79,6 +79,26 @@ int rmodule_calc_region(unsigned int region_alignment, size_t rmodule_size,
__attribute__ ((section (".module_header"))) = \
RMODULE_HEADER(entry_, type_)
/* Support for loading rmodule stages. This API is only available when
* using dynamic cbmem because it uses the dynamic cbmem API to obtain
* the backing store region for the stage. */
#if CONFIG_DYNAMIC_CBMEM
struct cbfs_stage;
struct cbmem_entry;
struct rmod_stage_load {
/* Inputs */
uint32_t cbmem_id;
const char *name;
/* Outputs */
const struct cbmem_entry *cbmem_entry;
void *entry;
};
/* Both of the following functions return 0 on success, -1 on error. */
int rmodule_stage_load(struct rmod_stage_load *rsl, struct cbfs_stage *stage);
int rmodule_stage_load_from_cbfs(struct rmod_stage_load *rsl);
#endif
/* Private data structures below should not be used directly. */