summaryrefslogtreecommitdiff
path: root/src/include/cbmem.h
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2020-02-06 18:27:50 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-08-17 06:22:58 +0000
commit54a4f172d80d0490ecd6ad07e3c23341a27bed8f (patch)
tree65fc58cd511d8c3323c6cdc3bf6d953a420f834f /src/include/cbmem.h
parenta6a2f9372c492c2e6ca4404b372054b1fd82e1ee (diff)
downloadcoreboot-54a4f172d80d0490ecd6ad07e3c23341a27bed8f.tar.xz
lib/imd_cbmem.c: Add a helper function to indicate that cbmem is ready
This can be used in romstage in particular to know if dram is ready. Change-Id: I0231ab9c0b78a69faa762e0a97378bf0b50eebaf Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38736 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/include/cbmem.h')
-rw-r--r--src/include/cbmem.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index b548cd9559..7e1da17b98 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -155,4 +155,18 @@ static inline int cbmem_possibly_online(void)
return 1;
}
+/* Returns 1 after running cbmem init hooks, 0 otherwise. */
+static inline int cbmem_online(void)
+{
+ extern int cbmem_initialized;
+
+ if (!cbmem_possibly_online())
+ return 0;
+
+ if (ENV_ROMSTAGE)
+ return cbmem_initialized;
+
+ return 1;
+}
+
#endif /* _CBMEM_H_ */