summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2021-02-05 15:50:20 -0700
committerFelix Held <felix-coreboot@felixheld.de>2021-02-07 18:07:24 +0000
commit899be1b3529b391c430504589649f0ec9452a1d9 (patch)
treeef595f8e2b0b7261a8d328694bfb48a909941040 /src/soc/amd/common
parent969a5c8e855230d274289542c9bfaaa5063f2364 (diff)
soc/amd/picasso: Move memmap_early_dram to common blocks
We need the same functionality for cezanne. TEST=Boot ezknil Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I0800c662bb473eb571c74e76a8247298f534b53f Reviewed-on: https://review.coreboot.org/c/coreboot/+/50337 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/cpu/noncar/Makefile.inc2
-rw-r--r--src/soc/amd/common/block/cpu/noncar/memmap.c29
-rw-r--r--src/soc/amd/common/block/include/amdblocks/memmap.h19
3 files changed, 50 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/cpu/noncar/Makefile.inc b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
index ed08d2a1c4..dd959417f1 100644
--- a/src/soc/amd/common/block/cpu/noncar/Makefile.inc
+++ b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
@@ -2,5 +2,7 @@ ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_NONCAR),y)
bootblock-y += pre_c.S
bootblock-y += write_resume_eip.c
+romstage-y += memmap.c
+ramstage-y += memmap.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_NONCAR
diff --git a/src/soc/amd/common/block/cpu/noncar/memmap.c b/src/soc/amd/common/block/cpu/noncar/memmap.c
new file mode 100644
index 0000000000..9efe959d4d
--- /dev/null
+++ b/src/soc/amd/common/block/cpu/noncar/memmap.c
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <console/console.h>
+#include <cbmem.h>
+#include <amdblocks/memmap.h>
+
+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;
+}
diff --git a/src/soc/amd/common/block/include/amdblocks/memmap.h b/src/soc/amd/common/block/include/amdblocks/memmap.h
new file mode 100644
index 0000000000..a748e57316
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/memmap.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef AMD_BLOCK_MEMMAP_H
+#define AMD_BLOCK_MEMMAP_H
+
+#include <stdint.h>
+#include <symbols.h>
+
+DECLARE_REGION(early_reserved_dram)
+
+struct memmap_early_dram {
+ uint32_t base;
+ uint32_t size;
+};
+
+void memmap_stash_early_dram_usage(void);
+const struct memmap_early_dram *memmap_get_early_dram_usage(void);
+
+#endif /* AMD_BLOCK_MEMMAP_H */