diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-02-27 22:50:12 -0600 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-03-22 00:13:42 +0100 |
commit | dd4a6d2357decf0cf505370234b378985c68f97f (patch) | |
tree | 6c656e9d13fbc39a9a88766d9b3f533a98a9f89b /src/include | |
parent | 24d1d4b47274eb82893e6726472a991a36fce0aa (diff) | |
download | coreboot-dd4a6d2357decf0cf505370234b378985c68f97f.tar.xz |
coreboot: dynamic cbmem requirement
Dynamic cbmem is now a requirement for relocatable ramstage.
This patch replaces the reserve_* fields in the romstage_handoff
structure by using the dynamic cbmem library.
The haswell code is not moved over in this commit, but it should be
safe because there is a hard requirement for DYNAMIC_CBMEM when using
a reloctable ramstage.
Change-Id: I59ab4552c3ae8c2c3982df458cd81a4a9b712cc2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2849
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/cbfs.h | 21 | ||||
-rw-r--r-- | src/include/cbmem.h | 5 | ||||
-rw-r--r-- | src/include/rmodule.h | 16 | ||||
-rw-r--r-- | src/include/romstage_handoff.h | 3 |
4 files changed, 21 insertions, 24 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h index 811df88884..ac249aabf5 100644 --- a/src/include/cbfs.h +++ b/src/include/cbfs.h @@ -87,21 +87,24 @@ int init_default_cbfs_media(struct cbfs_media *media); /* The cache_loaded_ramstage() and load_cached_ramstage() functions are defined * to be weak so that board and chipset code may override them. Their job is to * cache and load the ramstage for quick S3 resume. By default a copy of the - * relocated ramstage is saved just below the running ramstage region. These + * relocated ramstage is saved using the cbmem infrastructure. These * functions are only valid during romstage. */ struct romstage_handoff; +struct cbmem_entry; -/* The implementer of cache_loaded_ramstage() needs to ensure that the - * reserve_* fields in in romstage_handoff reflect the memory footprint of the - * ramstage (including cached region). Note that the handoff variable can be - * NULL. */ +/* The implementer of cache_loaded_ramstage() may use the romstage_handoff + * structure to store information, but note that the handoff variable can be + * NULL. The ramstage cbmem_entry represents the region occupied by the loaded + * ramstage. */ void __attribute__((weak)) -cache_loaded_ramstage(struct romstage_handoff *handoff, void *ramstage_base, - uint32_t ramstage_size, void *entry_point); -/* Return NULL on error or entry point on success. */ +cache_loaded_ramstage(struct romstage_handoff *handoff, + const struct cbmem_entry *ramstage, void *entry_point); +/* Return NULL on error or entry point on success. The ramstage cbmem_entry is + * the region where to load the cached contents to. */ void * __attribute__((weak)) -load_cached_ramstage(struct romstage_handoff *handoff); +load_cached_ramstage(struct romstage_handoff *handoff, + const struct cbmem_entry *ramstage); #endif /* CONFIG_RELOCATABLE_RAMSTAGE */ #endif diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 41f5971c80..b3d9f869c8 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -131,11 +131,6 @@ void cbmem_add_lb_mem(struct lb_memory *mem); #ifndef __PRE_RAM__ extern uint64_t high_tables_base, high_tables_size; -#if CONFIG_EARLY_CBMEM_INIT -/* Return 0 on success, < 0 on error. */ -int __attribute__((weak)) cbmem_get_table_location(uint64_t *tables_base, - uint64_t *tables_size); -#endif void set_cbmem_toc(struct cbmem_entry *); #endif diff --git a/src/include/rmodule.h b/src/include/rmodule.h index 2d8fc0fdc8..631c63d219 100644 --- a/src/include/rmodule.h +++ b/src/include/rmodule.h @@ -41,13 +41,15 @@ int rmodule_entry_offset(const struct rmodule *m); int rmodule_memory_size(const struct rmodule *m); int rmodule_load(void *loc, struct rmodule *m); int rmodule_load_alignment(const struct rmodule *m); -/* Returns the an aligned pointer that reflects a region used below addr - * based on the rmodule_size. i.e. the returned pointer up to addr is memory - * that may be utilized by the rmodule. program_start and rmodule_start - * are pointers updated to reflect where the rmodule program starts and where - * the rmodule (including header) should be placed respectively. */ -void *rmodule_find_region_below(void *addr, size_t rmodule_size, - void **program_start, void **rmodule_start); +/* rmodule_calc_region() calculates the region size, offset to place an + * rmodule in memory, and load address offset based off of a region allocator + * with an alignment of region_alignment. This function helps place an rmodule + * in the same location in ram it will run from. The offset to place the + * rmodule into the region allocated of size region_size is returned. The + * load_offset is the address to load and relocate the rmodule. + * region_alignment must be a power of 2. */ +int rmodule_calc_region(unsigned int region_alignment, size_t rmodule_size, + size_t *region_size, int *load_offset); #define FIELD_ENTRY(x_) ((u32)&x_) #define RMODULE_HEADER(entry_, type_) \ diff --git a/src/include/romstage_handoff.h b/src/include/romstage_handoff.h index 4150e8e1cd..3152fb2e9d 100644 --- a/src/include/romstage_handoff.h +++ b/src/include/romstage_handoff.h @@ -28,9 +28,6 @@ * using the CBMEM_ID_ROMSTAGE_INFO id it needs to ensure it doesn't clobber * fields it doesn't own. */ struct romstage_handoff { - /* This indicates to the ramstage to reserve a chunk of memory. */ - uint32_t reserve_base; - uint32_t reserve_size; /* Inidicate if the current boot is an S3 resume. If * CONFIG_RELOCTABLE_RAMSTAGE is enabled the chipset code is * responsible for initializing this variable. Otherwise, ramstage |