[coreboot-gerrit] Patch set updated for coreboot: fb45fae ramstage_cache: allow ramstage usage add valid helper
Aaron Durbin (adurbin@google.com)
gerrit at coreboot.org
Fri May 9 17:26:40 CEST 2014
Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5011
-gerrit
commit fb45fae5c7028ee7754bdda7c7790b67dfb8c4ee
Author: Aaron Durbin <adurbin at chromium.org>
Date: Thu Dec 12 10:10:52 2013 -0800
ramstage_cache: allow ramstage usage add valid helper
Allow ramstage cache to be used from ramstage proper. Also
add a helper function for checking validity of ramstage
cache structure.
BUG=chrome-os-partner:22867
BRANCH=None
TEST=Built and booted. S3 resumed.
Change-Id: If1f2ad1bcf64504b42e315be243a12432b50e3d5
Signed-off-by: Aaron Durbin <adurbin at chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179775
Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
---
src/include/ramstage_cache.h | 10 +++++++---
src/lib/ramstage_cache.c | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/include/ramstage_cache.h b/src/include/ramstage_cache.h
index 5b0597a..8d9b095 100644
--- a/src/include/ramstage_cache.h
+++ b/src/include/ramstage_cache.h
@@ -20,9 +20,8 @@
#ifndef _RAMSTAGE_CACHE_
#define _RAMSTAGE_CACHE_
-#if !defined(__PRE_RAM__)
-#error "ramstage_cache only used in romstage for loading ramstage."
-#endif
+#include <stddef.h>
+#include <stdint.h>
/* This structure is saved along with the relocated ramstage program when
* CONFIG_RELOCATED_RAMSTAGE is employed. For x86, it can used to protect
@@ -46,4 +45,9 @@ struct ramstage_cache *ramstage_cache_location(long *size);
/* Chipset/Board function called when cache is invalid on resume. */
void ramstage_cache_invalid(struct ramstage_cache *cache);
+static inline int ramstage_cache_is_valid(const struct ramstage_cache *c)
+{
+ return (c != NULL && c->magic == RAMSTAGE_CACHE_MAGIC);
+}
+
#endif /* _RAMSTAGE_CACHE_ */
diff --git a/src/lib/ramstage_cache.c b/src/lib/ramstage_cache.c
index a1a4804..0f7273a 100644
--- a/src/lib/ramstage_cache.c
+++ b/src/lib/ramstage_cache.c
@@ -79,7 +79,7 @@ void *load_cached_ramstage(struct romstage_handoff *handoff,
cache = ramstage_cache_location(&size);
- if (cache == NULL || cache->magic != RAMSTAGE_CACHE_MAGIC) {
+ if (!ramstage_cache_is_valid(cache)) {
printk(BIOS_DEBUG, "Invalid ramstage cache found.\n");
ramstage_cache_invalid(cache);
return NULL;
More information about the coreboot-gerrit
mailing list