summaryrefslogtreecommitdiff
path: root/src/include/cbfs.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2013-02-15 23:26:52 -0600
committerRonald G. Minnich <rminnich@gmail.com>2013-03-21 22:59:40 +0100
commitde1f890186ce84963eb3dd1638784473193909c3 (patch)
tree1ad9b1358d208bc338f4766a117fe5e076a84cef /src/include/cbfs.h
parent8ce667e50684bea7c60db43c0ca7dd1b3ec3fde3 (diff)
downloadcoreboot-de1f890186ce84963eb3dd1638784473193909c3.tar.xz
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 <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/2805 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/include/cbfs.h')
-rw-r--r--src/include/cbfs.h21
1 files changed, 21 insertions, 0 deletions
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