summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/memlayout.h2
-rw-r--r--src/include/symbols.h6
-rw-r--r--src/lib/cbfs_spi.c9
3 files changed, 12 insertions, 5 deletions
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index 899836c5f0..3178bc4893 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -82,7 +82,7 @@
#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)
+ REGION(postram_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) \
diff --git a/src/include/symbols.h b/src/include/symbols.h
index bf875aed57..aa055ec852 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -41,9 +41,9 @@ extern u8 _stack[];
extern u8 _estack[];
#define _stack_size (_estack - _stack)
-extern u8 _dram_cbfs_cache[];
-extern u8 _edram_cbfs_cache[];
-#define _dram_cbfs_cache_size (_edram_cbfs_cache - _dram_cbfs_cache)
+extern u8 _postram_cbfs_cache[];
+extern u8 _epostram_cbfs_cache[];
+#define _postram_cbfs_cache_size (_epostram_cbfs_cache - _postram_cbfs_cache)
extern u8 _cbfs_cache[];
extern u8 _ecbfs_cache[];
diff --git a/src/lib/cbfs_spi.c b/src/lib/cbfs_spi.c
index 82c3b834d3..ffa0628b05 100644
--- a/src/lib/cbfs_spi.c
+++ b/src/lib/cbfs_spi.c
@@ -45,7 +45,14 @@ static struct mmap_helper_region_device mdev =
static void initialize_mdev(int unused)
{
- mmap_helper_device_init(&mdev, _dram_cbfs_cache, _dram_cbfs_cache_size);
+ /*
+ * Call boot_device_init() to ensure spi_flash is initialized before
+ * backing mdev with postram cache. This prevents the mdev backing from
+ * being overwritten if spi_flash was not accessed before dram was up.
+ */
+ boot_device_init();
+ mmap_helper_device_init(&mdev, _postram_cbfs_cache,
+ _postram_cbfs_cache_size);
}
ROMSTAGE_CBMEM_INIT_HOOK(initialize_mdev);