From f545abfd22a594ecb9c0678efa5278bb38a37a70 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 24 Oct 2013 10:14:06 -0500 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/174425 Reviewed-by: Duncan Laurie Reviewed-on: http://review.coreboot.org/4897 Reviewed-by: Alexandru Gagniuc Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/include/rmodule.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/include/rmodule.h') diff --git a/src/include/rmodule.h b/src/include/rmodule.h index 247711a0ae..41da3a9d2d 100644 --- a/src/include/rmodule.h +++ b/src/include/rmodule.h @@ -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. */ -- cgit v1.2.3