aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/fsp/Makefile.inc1
-rw-r--r--src/soc/amd/common/fsp/fsp_validate.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/src/soc/amd/common/fsp/Makefile.inc b/src/soc/amd/common/fsp/Makefile.inc
index 503d3bfc0e..2541f27754 100644
--- a/src/soc/amd/common/fsp/Makefile.inc
+++ b/src/soc/amd/common/fsp/Makefile.inc
@@ -1,5 +1,6 @@
ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
romstage-y += fsp_reset.c
+romstage-y += fsp_validate.c
ramstage-y += fsp_reset.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fsp-acpi.c
ramstage-$(CONFIG_SOC_AMD_COMMON_FSP_DMI_TABLES) += dmi.c
diff --git a/src/soc/amd/common/fsp/fsp_validate.c b/src/soc/amd/common/fsp/fsp_validate.c
new file mode 100644
index 0000000000..4d6a8f72bc
--- /dev/null
+++ b/src/soc/amd/common/fsp/fsp_validate.c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <fsp/util.h>
+#include <types.h>
+
+/* Validate the FSP-M header in romstage */
+void soc_validate_fspm_header(const struct fsp_header *hdr)
+{
+ /* Check if the image fits into the reserved memory region */
+ if (hdr->image_size > CONFIG_FSP_M_SIZE)
+ die("The FSP-M binary is %u bytes larger than the memory region allocated for "
+ "it. Increase FSP_M_SIZE to make it fit.\n",
+ hdr->image_size - CONFIG_FSP_M_SIZE);
+}