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>
diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c
index a056141..6fe8e57 100644
--- a/src/soc/amd/common/block/pi/agesawrapper.c
+++ b/src/soc/amd/common/block/pi/agesawrapper.c
@@ -96,18 +96,22 @@
 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_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_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;