From 50023d3965ee1d1dcc1d464de521756ab22d38e2 Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Wed, 25 Jan 2017 15:23:47 -0700 Subject: [PATCH] UPSTREAM: cpu/amd/pi: Change wrapper to use config option Add a check for vboot when locating the binaryPI image. There is currently an ordering problem using cbmem to locate the image when vboot is present. Vboot inserts its locator into the search process so that memory can be checked before flash is queried. For the earliest calls using the wrapper, DRAM has not been set up and cbmem not initialized in romstage. This change prevents an endless loop when vboot searches cbmem. This change has another side effect. When vboot is in effect, the change forces the RO binaryPI to be used even when on either of the RW paths. There is currently no ability to relocate the XIP image for use in a RW region. Signed-off-by: Marshall Dawson Reviewed-by: Marc Jones (cherry picked from commit 6efe9217c38cf93fd9b38e52cf3ec90fee3d0474) BUG=none BRANCH=none TEST=none Change-Id: If30b23954f97cc4565ff81b55ee3a9e4145be379 Signed-off-by: Patrick Georgi Original-Commit-Id: ca3815b4c586c63743892ee04ad61026d6ba4df0 Original-Change-Id: I0c14bd729f8a67bca37cbdbd3a5e266c99c86d54 Original-Signed-off-by: Marc Jones Original-Reviewed-on: https://review.coreboot.org/18438 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Martin Roth Reviewed-on: https://chromium-review.googlesource.com/490076 Commit-Ready: Furquan Shaikh --- src/northbridge/amd/pi/agesawrapper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/northbridge/amd/pi/agesawrapper.c b/src/northbridge/amd/pi/agesawrapper.c index 213d784a9e..0afd0ca78a 100644 --- a/src/northbridge/amd/pi/agesawrapper.c +++ b/src/northbridge/amd/pi/agesawrapper.c @@ -397,8 +397,15 @@ const void *agesawrapper_locate_module (const CHAR8 name[8]) const AMD_MODULE_HEADER* module; size_t file_size; - agesa = cbfs_boot_map_with_leak((const char *)CONFIG_CBFS_AGESA_NAME, + if (IS_ENABLED(CONFIG_VBOOT)) { + /* Use phys. location in flash and prevent vboot from searching cbmem */ + agesa = (void *)CONFIG_AGESA_BINARY_PI_LOCATION; + file_size = 0x100000; + } else { + agesa = cbfs_boot_map_with_leak((const char *)CONFIG_CBFS_AGESA_NAME, CBFS_TYPE_RAW, &file_size); + } + if (!agesa) return NULL; image = LibAmdLocateImage(agesa, agesa + file_size - 1, 4096, name);