soc/amd/common: Fix agesawrapper CreateStruct calls

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 <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/27112
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Garrett Kirkendall <garrett.kirkendall@amd.corp-partner.google.com>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
Kyösti Mälkki 2018-06-14 06:57:05 +03:00 committed by Patrick Georgi
parent 58f68e80ec
commit 108fb8a37e
1 changed files with 14 additions and 4 deletions

View File

@ -96,18 +96,22 @@ static AGESA_STATUS create_struct(AMD_INTERFACE_PARAMS *interface_struct)
AGESA_STATUS agesawrapper_amdinitreset(void) AGESA_STATUS agesawrapper_amdinitreset(void)
{ {
AGESA_STATUS status; AGESA_STATUS status;
AMD_RESET_PARAMS ResetParams; AMD_RESET_PARAMS _ResetParams;
AMD_INTERFACE_PARAMS AmdParamStruct = { AMD_INTERFACE_PARAMS AmdParamStruct = {
.AgesaFunctionName = AMD_INIT_RESET, .AgesaFunctionName = AMD_INIT_RESET,
.AllocationMethod = ByHost, .AllocationMethod = ByHost,
.NewStructSize = sizeof(AMD_RESET_PARAMS), .NewStructSize = sizeof(AMD_RESET_PARAMS),
.NewStructPtr = &ResetParams, .NewStructPtr = &_ResetParams,
}; };
AMD_RESET_PARAMS *ResetParams;
create_struct(&AmdParamStruct); create_struct(&AmdParamStruct);
SetFchResetParams(&ResetParams.FchInterface);
ResetParams = (AMD_RESET_PARAMS *)AmdParamStruct.NewStructPtr;
SetFchResetParams(&ResetParams->FchInterface);
timestamp_add_now(TS_AGESA_INIT_RESET_START); timestamp_add_now(TS_AGESA_INIT_RESET_START);
status = AmdInitReset(&ResetParams); status = AmdInitReset(ResetParams);
timestamp_add_now(TS_AGESA_INIT_RESET_DONE); timestamp_add_now(TS_AGESA_INIT_RESET_DONE);
if (status != AGESA_SUCCESS) if (status != AGESA_SUCCESS)
@ -450,9 +454,12 @@ AGESA_STATUS agesawrapper_amdinitresume(void)
AGESA_STATUS agesawrapper_amds3laterestore(void) AGESA_STATUS agesawrapper_amds3laterestore(void)
{ {
AGESA_STATUS Status; AGESA_STATUS Status;
AMD_S3LATE_PARAMS _S3LateParams;
AMD_INTERFACE_PARAMS AmdParamStruct = { AMD_INTERFACE_PARAMS AmdParamStruct = {
.AgesaFunctionName = AMD_S3LATE_RESTORE, .AgesaFunctionName = AMD_S3LATE_RESTORE,
.AllocationMethod = ByHost, .AllocationMethod = ByHost,
.NewStructSize = sizeof(AMD_S3LATE_PARAMS),
.NewStructPtr = &_S3LateParams,
}; };
AMD_S3LATE_PARAMS *S3LateParams; AMD_S3LATE_PARAMS *S3LateParams;
size_t vol_size; size_t vol_size;
@ -485,9 +492,12 @@ AGESA_STATUS agesawrapper_amds3laterestore(void)
AGESA_STATUS agesawrapper_amds3finalrestore(void) AGESA_STATUS agesawrapper_amds3finalrestore(void)
{ {
AGESA_STATUS Status; AGESA_STATUS Status;
AMD_S3FINAL_PARAMS _S3FinalParams;
AMD_INTERFACE_PARAMS AmdParamStruct = { AMD_INTERFACE_PARAMS AmdParamStruct = {
.AgesaFunctionName = AMD_S3FINAL_RESTORE, .AgesaFunctionName = AMD_S3FINAL_RESTORE,
.AllocationMethod = ByHost, .AllocationMethod = ByHost,
.NewStructSize = sizeof(AMD_S3FINAL_PARAMS),
.NewStructPtr = &_S3FinalParams,
}; };
AMD_S3FINAL_PARAMS *S3FinalParams; AMD_S3FINAL_PARAMS *S3FinalParams;
size_t vol_size; size_t vol_size;