summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/fsp
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common/fsp')
-rw-r--r--src/soc/amd/common/fsp/Makefile.inc2
-rw-r--r--src/soc/amd/common/fsp/fsp_memmap.c31
2 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/amd/common/fsp/Makefile.inc b/src/soc/amd/common/fsp/Makefile.inc
index cb4b675975..f26fe8f884 100644
--- a/src/soc/amd/common/fsp/Makefile.inc
+++ b/src/soc/amd/common/fsp/Makefile.inc
@@ -1,7 +1,9 @@
## SPDX-License-Identifier: GPL-2.0-only
ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
+romstage-y += fsp_memmap.c
romstage-y += fsp_reset.c
romstage-y += fsp_validate.c
+ramstage-y += fsp_memmap.c
ramstage-y += fsp_report_resources.c
ramstage-y += fsp_reset.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fsp-acpi.c
diff --git a/src/soc/amd/common/fsp/fsp_memmap.c b/src/soc/amd/common/fsp/fsp_memmap.c
new file mode 100644
index 0000000000..8bed87b111
--- /dev/null
+++ b/src/soc/amd/common/fsp/fsp_memmap.c
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <amdblocks/memmap.h>
+#include <console/console.h>
+#include <fsp/util.h>
+#include <FspGuids.h>
+#include <memrange.h>
+#include <types.h>
+
+void fsp_get_smm_region(uintptr_t *start, size_t *size)
+{
+ static uintptr_t smm_start;
+ static size_t smm_size;
+
+ *start = smm_start;
+ *size = smm_size;
+ if (*size && *start)
+ return;
+
+ struct range_entry tseg;
+
+ if (fsp_find_range_hob(&tseg, AMD_FSP_TSEG_HOB_GUID.b) != CB_SUCCESS) {
+ printk(BIOS_ERR, "unable to find TSEG HOB\n");
+ return;
+ }
+
+ smm_start = (uintptr_t)range_entry_base(&tseg);
+ smm_size = range_entry_size(&tseg);
+ *start = smm_start;
+ *size = smm_size;
+}