Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/22728
Change subject: soc/amd/common: Add AmdInitRtb call ......................................................................
soc/amd/common: Add AmdInitRtb call
Add support for the AmdInitRtb() function which asks AGESA for the S3 save data.
Change-Id: I93336ca7e85cb4eff7140d4caab92591f921304a Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/common/agesawrapper.c M src/soc/amd/common/agesawrapper.h M src/soc/amd/common/amd_late_init.c 3 files changed, 46 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/22728/1
diff --git a/src/soc/amd/common/agesawrapper.c b/src/soc/amd/common/agesawrapper.c index b939183..28c290b 100644 --- a/src/soc/amd/common/agesawrapper.c +++ b/src/soc/amd/common/agesawrapper.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */
+#include <arch/acpi.h> #include "agesawrapper.h" #include <cbfs.h> #include <cbmem.h> @@ -338,6 +339,49 @@ return Status; }
+AGESA_STATUS agesawrapper_amdinitrtb(void) +{ + AGESA_STATUS Status; + AMD_RTB_PARAMS *AmdS3SaveParamsPtr; + AMD_INTERFACE_PARAMS AmdInterfaceParams; + struct region nv_data, vol_data; + + if (!acpi_s3_resume_allowed()) + return AGESA_UNSUPPORTED; + + memset(&AmdInterfaceParams, 0, sizeof(AMD_INTERFACE_PARAMS)); + + AmdInterfaceParams.StdHeader.ImageBasePtr = 0; + AmdInterfaceParams.StdHeader.HeapStatus = HEAP_SYSTEM_MEM; + AmdInterfaceParams.StdHeader.CalloutPtr = &GetBiosCallout; + AmdInterfaceParams.AllocationMethod = PostMemDram; + AmdInterfaceParams.AgesaFunctionName = AMD_INIT_RTB; + AmdInterfaceParams.StdHeader.AltImageBasePtr = 0; + AmdInterfaceParams.StdHeader.Func = 0; + AmdCreateStruct(&AmdInterfaceParams); + + AmdS3SaveParamsPtr = (AMD_RTB_PARAMS *)AmdInterfaceParams.NewStructPtr; + AmdS3SaveParamsPtr->StdHeader = AmdInterfaceParams.StdHeader; + + Status = AmdInitRtb(AmdS3SaveParamsPtr); + if (Status != AGESA_SUCCESS) { + agesawrapper_amdreadeventlog(AmdInterfaceParams.StdHeader.HeapStatus); + ASSERT(Status == AGESA_SUCCESS); + } + + nv_data.offset = (size_t)AmdS3SaveParamsPtr->S3DataBlock.NvStorage; + nv_data.size = (size_t)AmdS3SaveParamsPtr->S3DataBlock.NvStorageSize; + vol_data.offset = (size_t)AmdS3SaveParamsPtr->S3DataBlock.VolatileStorage; + vol_data.size = (size_t)AmdS3SaveParamsPtr->S3DataBlock.VolatileStorageSize; + + if (save_s3_info(nv_data, vol_data)) + printk(BIOS_ERR, "Error saving S3 data, resume is impossible\n"); + + AmdReleaseStruct(&AmdInterfaceParams); + + return Status; +} + AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus) { AGESA_STATUS Status; diff --git a/src/soc/amd/common/agesawrapper.h b/src/soc/amd/common/agesawrapper.h index a000328..a9ba3e6 100644 --- a/src/soc/amd/common/agesawrapper.h +++ b/src/soc/amd/common/agesawrapper.h @@ -41,7 +41,7 @@ void *agesawrapper_getlateinitptr(int pick); AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, void *ConfigPtr); -AGESA_STATUS agesawrapper_amdS3Save(void); +AGESA_STATUS agesawrapper_amdinitrtb(void); AGESA_STATUS agesawrapper_amdinitresume(void); AGESA_STATUS agesawrapper_amds3laterestore(void);
diff --git a/src/soc/amd/common/amd_late_init.c b/src/soc/amd/common/amd_late_init.c index 3aee23c..d57de26 100644 --- a/src/soc/amd/common/amd_late_init.c +++ b/src/soc/amd/common/amd_late_init.c @@ -27,13 +27,12 @@ { if (acpi_is_wakeup_s3()) return; - AGESAWRAPPER(amdinitlate);
if (!acpi_s3_resume_allowed()) return;
- AGESAWRAPPER(amdS3Save); + AGESAWRAPPER(amdinitrtb); }
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT,