From 1e25fd426ad848f79e7ee7f7de4d3dc3ca129b1f Mon Sep 17 00:00:00 2001 From: Fred Reitberger Date: Wed, 2 Feb 2022 13:30:18 -0500 Subject: [PATCH] soc/amd/common/block/psp: introduce AMD_SOC_SEPARATE_EFS_SECTION On systems that use the first 128kByte of the SPI flash for the EC firmware, it is not possible to place the EFS/amdfw part at the lowest location in flash where the on-chip PSP firmware will look for the EFS, since this is at an offset of 128kByte into the flash which is where the cbfs master header resides when the main CBFS is placed right after the EC firmware. This patch introduces the AMD_SOC_SEPARATE_EFS_SECTION option that allows putting the EFS in a separate FMAP section that can be located right after the EC firmware FMAP section. The EFS FMAP partition is checked to ensure it begins at the expected location. Change-Id: I5ed0f76c9c9c9c180ee5f1b96f88689d0979bb5e Signed-off-by: Fred Reitberger Reviewed-on: https://review.coreboot.org/c/coreboot/+/61558 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/soc/amd/common/block/psp/Kconfig | 8 ++++++++ src/soc/amd/common/block/psp/Makefile.inc | 1 + src/soc/amd/common/block/psp/efs_fmap_check.c | 9 +++++++++ 3 files changed, 18 insertions(+) create mode 100644 src/soc/amd/common/block/psp/efs_fmap_check.c diff --git a/src/soc/amd/common/block/psp/Kconfig b/src/soc/amd/common/block/psp/Kconfig index c5ec56015b..7ef7e40b3b 100644 --- a/src/soc/amd/common/block/psp/Kconfig +++ b/src/soc/amd/common/block/psp/Kconfig @@ -27,3 +27,11 @@ config SOC_AMD_PSP_SELECTABLE_SMU_FW and each mainboard can choose to select an appropriate fanless or fanned set of blobs. Ask your AMD representative whether your APU is considered fanless. + +config AMD_SOC_SEPARATE_EFS_SECTION + bool + help + Use separate EFS FMAP section instead of putting EFS into CBFS. The + FMAP section must begin exactly at the location the EFS needs to be + placed in the flash. This option can be used to place the EFS right + after the 128kByte EC firmware at the beginning of the flash. diff --git a/src/soc/amd/common/block/psp/Makefile.inc b/src/soc/amd/common/block/psp/Makefile.inc index 94dc57ca8f..5bae663021 100644 --- a/src/soc/amd/common/block/psp/Makefile.inc +++ b/src/soc/amd/common/block/psp/Makefile.inc @@ -6,6 +6,7 @@ smm-y += psp.c smm-y += psp_smm.c bootblock-y += psp_efs.c +bootblock-$(CONFIG_AMD_SOC_SEPARATE_EFS_SECTION) += efs_fmap_check.c verstage-y += psp_efs.c endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP diff --git a/src/soc/amd/common/block/psp/efs_fmap_check.c b/src/soc/amd/common/block/psp/efs_fmap_check.c new file mode 100644 index 0000000000..44dfe70ee0 --- /dev/null +++ b/src/soc/amd/common/block/psp/efs_fmap_check.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include + +_Static_assert(FMAP_SECTION_EFS_START == (FLASH_BASE_ADDR + EFS_OFFSET), + "FMAP EFS Offset does not match EFS Offset - check your config");