diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-12-12 10:10:52 -0800 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2014-05-10 06:31:45 +0200 |
commit | be2512973d04f3da3cebfd3e7ee10809fbe4ae4a (patch) | |
tree | 87e5998608c57917fd4c9c695238d223e0866563 /src/include | |
parent | 7d34c6070b8fc2e8dc2f5274794e2374a883d4ce (diff) |
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@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179775
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://review.coreboot.org/5011
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ramstage_cache.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/include/ramstage_cache.h b/src/include/ramstage_cache.h index 5b0597a828..8d9b095177 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_ */ |