From 922619512def4ef62c13c97b78321c6e6e610153 Mon Sep 17 00:00:00 2001 From: Justin TerAvest Date: Fri, 22 Dec 2017 15:15:02 -0700 Subject: soc/amd/common: Allow AGESA file split for pre- and post-memory By splitting the binary files for platform initialization, the post-memory code can be modified to stop executing in place (--xip). This change creates two separate sections in CBFS for AGESA and loads the appropriate file at the correct stage. BUG=b:68141063 TEST=Booted kahlee with split agesa enabled. Change-Id: I2fa423df164037bc3738476fd2a34522df279e34 Signed-off-by: Justin TerAvest Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/22974 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/soc/amd/common/block/pi/agesawrapper.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c index f2327f1679..3e06f9e9db 100644 --- a/src/soc/amd/common/block/pi/agesawrapper.c +++ b/src/soc/amd/common/block/pi/agesawrapper.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -423,15 +424,26 @@ static int agesa_locate_stage_file(const char *name, struct region_device *rdev) region_device_sz(rdev) - metadata_sz); } +static const char *get_agesa_cbfs_name(void) +{ + if (!IS_ENABLED(CONFIG_AGESA_SPLIT_MEMORY_FILES)) + return CONFIG_AGESA_CBFS_NAME; + if (!ENV_RAMSTAGE) + return CONFIG_AGESA_PRE_MEMORY_CBFS_NAME; + return CONFIG_AGESA_POST_MEMORY_CBFS_NAME; +} + const void *agesawrapper_locate_module (const CHAR8 name[8]) { const void *agesa; const AMD_IMAGE_HEADER *image; struct region_device rdev; size_t file_size; - const char *fname = CONFIG_AGESA_CBFS_NAME; + const char *fname; int ret; + fname = get_agesa_cbfs_name(); + if (IS_ENABLED(CONFIG_AGESA_BINARY_PI_AS_STAGE)) ret = agesa_locate_stage_file(fname, &rdev); else -- cgit v1.2.3