From 108fb8a37e06603d4bebbd784f2c1955ebbb70f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 14 Jun 2018 06:57:05 +0300 Subject: soc/amd/common: Fix agesawrapper CreateStruct calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When AllocationMethod == ByHost, buffer has to be provided by caller. Improve code symmetry, the named parameter is now always pointer to the struct. Change-Id: I2085f7d5d63ef96f4bd9d5194af099634c402820 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/27112 Tested-by: build bot (Jenkins) Reviewed-by: Garrett Kirkendall Reviewed-by: Marshall Dawson --- src/soc/amd/common/block/pi/agesawrapper.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/soc/amd') diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c index a05614151e..6fe8e578df 100644 --- a/src/soc/amd/common/block/pi/agesawrapper.c +++ b/src/soc/amd/common/block/pi/agesawrapper.c @@ -96,18 +96,22 @@ static AGESA_STATUS create_struct(AMD_INTERFACE_PARAMS *interface_struct) AGESA_STATUS agesawrapper_amdinitreset(void) { AGESA_STATUS status; - AMD_RESET_PARAMS ResetParams; + AMD_RESET_PARAMS _ResetParams; AMD_INTERFACE_PARAMS AmdParamStruct = { .AgesaFunctionName = AMD_INIT_RESET, .AllocationMethod = ByHost, .NewStructSize = sizeof(AMD_RESET_PARAMS), - .NewStructPtr = &ResetParams, + .NewStructPtr = &_ResetParams, }; + AMD_RESET_PARAMS *ResetParams; + create_struct(&AmdParamStruct); - SetFchResetParams(&ResetParams.FchInterface); + + ResetParams = (AMD_RESET_PARAMS *)AmdParamStruct.NewStructPtr; + SetFchResetParams(&ResetParams->FchInterface); timestamp_add_now(TS_AGESA_INIT_RESET_START); - status = AmdInitReset(&ResetParams); + status = AmdInitReset(ResetParams); timestamp_add_now(TS_AGESA_INIT_RESET_DONE); if (status != AGESA_SUCCESS) @@ -450,9 +454,12 @@ AGESA_STATUS agesawrapper_amdinitresume(void) AGESA_STATUS agesawrapper_amds3laterestore(void) { AGESA_STATUS Status; + AMD_S3LATE_PARAMS _S3LateParams; AMD_INTERFACE_PARAMS AmdParamStruct = { .AgesaFunctionName = AMD_S3LATE_RESTORE, .AllocationMethod = ByHost, + .NewStructSize = sizeof(AMD_S3LATE_PARAMS), + .NewStructPtr = &_S3LateParams, }; AMD_S3LATE_PARAMS *S3LateParams; size_t vol_size; @@ -485,9 +492,12 @@ AGESA_STATUS agesawrapper_amds3laterestore(void) AGESA_STATUS agesawrapper_amds3finalrestore(void) { AGESA_STATUS Status; + AMD_S3FINAL_PARAMS _S3FinalParams; AMD_INTERFACE_PARAMS AmdParamStruct = { .AgesaFunctionName = AMD_S3FINAL_RESTORE, .AllocationMethod = ByHost, + .NewStructSize = sizeof(AMD_S3FINAL_PARAMS), + .NewStructPtr = &_S3FinalParams, }; AMD_S3FINAL_PARAMS *S3FinalParams; size_t vol_size; -- cgit v1.2.3