summaryrefslogtreecommitdiffstats
path: root/src/soc/amd/picasso/memmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/picasso/memmap.c')
-rw-r--r--src/soc/amd/picasso/memmap.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/memmap.c b/src/soc/amd/picasso/memmap.c
index 5f4ba42da1a4..42a330726efd 100644
--- a/src/soc/amd/picasso/memmap.c
+++ b/src/soc/amd/picasso/memmap.c
@@ -4,12 +4,14 @@
#include <assert.h>
#include <stdint.h>
+#include <cbmem.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <cpu/amd/msr.h>
#include <memrange.h>
#include <fsp/util.h>
#include <FspGuids.h>
+#include <soc/memmap.h>
/*
* For data stored in TSEG, ensure TValid is clear so R/W access can reach
@@ -57,3 +59,26 @@ void smm_region(uintptr_t *start, size_t *size)
once = 1;
}
}
+
+void memmap_stash_early_dram_usage(void)
+{
+ struct memmap_early_dram *e;
+
+ e = cbmem_add(CBMEM_ID_CB_EARLY_DRAM, sizeof(*e));
+
+ if (!e)
+ die("ERROR: Failed to stash early dram usage!\n");
+
+ e->base = (uint32_t)(uintptr_t)_early_reserved_dram;
+ e->size = REGION_SIZE(early_reserved_dram);
+}
+
+const struct memmap_early_dram *memmap_get_early_dram_usage(void)
+{
+ struct memmap_early_dram *e = cbmem_find(CBMEM_ID_CB_EARLY_DRAM);
+
+ if (!e)
+ die("ERROR: Failed to read early dram usage!\n");
+
+ return e;
+}