summaryrefslogtreecommitdiff
path: root/src/include/memlayout.h
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2015-11-13 14:05:27 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-12-03 14:17:04 +0100
commitf82e8ab6970f0f18d81e3da61a96a955987f5362 (patch)
tree6e9567912ec15b0f31f8f6018fadf792827c6552 /src/include/memlayout.h
parent857829654c6e519a2165916d6596b5060b7b6aca (diff)
downloadcoreboot-f82e8ab6970f0f18d81e3da61a96a955987f5362.tar.xz
cbfs_spi: enable CBFS access in early romstage
Currently the CBFS mmap cannot be accessed at the beginning of romstage because it waits until DRAM is initialized. This change first loads CBFS into SRAM and then switches to using DRAM as the backing once it is initialized. BUG=chromium:210230 BRANCH=none TEST=confirm that the cbfs can be access at the beginning and end of romstage on different boards. Change-Id: I9fdaef392349c27ba1c19d4cd07e8ee0ac92dddc Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: ccaaba266386c7d5cc62de63bdca81a0cc7c4d83 Original-Change-Id: Idabfab99765b52069755e1d1aa61bbee39501796 Original-Signed-off-by: Mary Ruthven <mruthven@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/312577 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/12586 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include/memlayout.h')
-rw-r--r--src/include/memlayout.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index 03442970ad..899836c5f0 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -79,9 +79,11 @@
/* Use either CBFS_CACHE (unified) or both (PRERAM|POSTRAM)_CBFS_CACHE */
#define CBFS_CACHE(addr, size) REGION(cbfs_cache, addr, size, 4)
-/* TODO: This only works if you never access CBFS in romstage before RAM is up!
- * If you need to change that assumption, you have some work ahead of you... */
-#if defined(__PRE_RAM__) && !ENV_ROMSTAGE
+#if ENV_ROMSTAGE
+ #define PRERAM_CBFS_CACHE(addr, size) CBFS_CACHE(addr, size)
+ #define POSTRAM_CBFS_CACHE(addr, size) \
+ REGION(dram_cbfs_cache, addr, size, 4)
+#elif defined(__PRE_RAM__)
#define PRERAM_CBFS_CACHE(addr, size) CBFS_CACHE(addr, size)
#define POSTRAM_CBFS_CACHE(addr, size) \
REGION(unused_cbfs_cache, addr, size, 4)