From de1f890186ce84963eb3dd1638784473193909c3 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 15 Feb 2013 23:26:52 -0600 Subject: coreboot: add caching loaded ramstage interface Instead of hard coding the policy for how a relocated ramstage image is saved add an interface. The interface consists of two functions. cache_loaded_ramstage() and load_cached_ramstage() are the functions to cache and load the relocated ramstage, respectively. There are default implementations which cache and load the relocated ramstage just below where the ramstage runs. Change-Id: I4346e873d8543e7eee4c1cd484847d846f297bb0 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/2805 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/include/cbfs.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/include') diff --git a/src/include/cbfs.h b/src/include/cbfs.h index 9bfe2ceb96..811df88884 100644 --- a/src/include/cbfs.h +++ b/src/include/cbfs.h @@ -83,5 +83,26 @@ int selfboot(struct lb_memory *mem, struct cbfs_payload *payload); /* Defined in individual arch / board implementation. */ int init_default_cbfs_media(struct cbfs_media *media); +#if CONFIG_RELOCATABLE_RAMSTAGE && defined(__PRE_RAM__) +/* 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 + * functions are only valid during romstage. */ + +struct romstage_handoff; + +/* 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. */ +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. */ +void * __attribute__((weak)) +load_cached_ramstage(struct romstage_handoff *handoff); +#endif /* CONFIG_RELOCATABLE_RAMSTAGE */ + #endif -- cgit v1.2.3