From fa420b49c5cbce160cfb4f46fc3542589a800a43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= <kyosti.malkki@gmail.com>
Date: Sun, 26 Mar 2017 11:35:23 +0300
Subject: AGESA: Simplify parameters for S3 support functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This save/restore facility operates on the same datablock.

Change-Id: I6e1f176adc2addbf2659c724f94c1b8d46d4838f
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/19026
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
---
 src/northbridge/amd/agesa/agesawrapper.c |  6 +++---
 src/northbridge/amd/agesa/agesawrapper.h |  6 +++---
 src/northbridge/amd/agesa/oem_s3.c       | 10 +++-------
 3 files changed, 9 insertions(+), 13 deletions(-)

(limited to 'src')

diff --git a/src/northbridge/amd/agesa/agesawrapper.c b/src/northbridge/amd/agesa/agesawrapper.c
index d21c9c371a..32c52bb31a 100644
--- a/src/northbridge/amd/agesa/agesawrapper.c
+++ b/src/northbridge/amd/agesa/agesawrapper.c
@@ -134,7 +134,7 @@ AGESA_STATUS agesawrapper_amdinitresume(void)
 
 	AmdResumeParamsPtr->S3DataBlock.NvStorageSize = 0;
 	AmdResumeParamsPtr->S3DataBlock.VolatileStorageSize = 0;
-	OemInitResume(AmdResumeParamsPtr);
+	OemInitResume(&AmdResumeParamsPtr->S3DataBlock);
 
 	status = AmdInitResume(AmdResumeParamsPtr);
 
@@ -195,7 +195,7 @@ AGESA_STATUS agesawrapper_amds3laterestore(void)
 	AmdS3LateParamsPtr->S3DataBlock.NvStorageSize = 0;
 #endif
 	AmdS3LateParamsPtr->S3DataBlock.VolatileStorageSize = 0;
-	OemS3LateRestore(AmdS3LateParamsPtr);
+	OemS3LateRestore(&AmdS3LateParamsPtr->S3DataBlock);
 
 	status = AmdS3LateRestore(AmdS3LateParamsPtr);
 	AGESA_EVENTLOG(status, &AmdInterfaceParams.StdHeader);
@@ -259,7 +259,7 @@ AGESA_STATUS agesawrapper_amdS3Save(void)
 	AGESA_EVENTLOG(status, &AmdInterfaceParams.StdHeader);
 	ASSERT(status == AGESA_SUCCESS);
 
-	OemS3Save(AmdS3SaveParamsPtr);
+	OemS3Save(&AmdS3SaveParamsPtr->S3DataBlock);
 
 	AmdReleaseStruct(&AmdInterfaceParams);
 
diff --git a/src/northbridge/amd/agesa/agesawrapper.h b/src/northbridge/amd/agesa/agesawrapper.h
index 19bb0be4a1..a59888377f 100644
--- a/src/northbridge/amd/agesa/agesawrapper.h
+++ b/src/northbridge/amd/agesa/agesawrapper.h
@@ -52,8 +52,8 @@ struct OEM_HOOK
 extern const struct OEM_HOOK OemCustomize;
 
 /* For suspend-to-ram support. */
-AGESA_STATUS OemInitResume(AMD_RESUME_PARAMS *ResumeParams);
-AGESA_STATUS OemS3LateRestore(AMD_S3LATE_PARAMS *S3LateParams);
-AGESA_STATUS OemS3Save(AMD_S3SAVE_PARAMS *S3SaveParams);
+AGESA_STATUS OemInitResume(AMD_S3_PARAMS *dataBlock);
+AGESA_STATUS OemS3LateRestore(AMD_S3_PARAMS *dataBlock);
+AGESA_STATUS OemS3Save(AMD_S3_PARAMS *dataBlock);
 
 #endif /* _AGESAWRAPPER_H_ */
diff --git a/src/northbridge/amd/agesa/oem_s3.c b/src/northbridge/amd/agesa/oem_s3.c
index 7f51de0831..525bfabafb 100644
--- a/src/northbridge/amd/agesa/oem_s3.c
+++ b/src/northbridge/amd/agesa/oem_s3.c
@@ -58,10 +58,8 @@ static void get_s3nv_data(S3_DATA_TYPE S3DataType, uintptr_t *pos, uintptr_t *le
 	}
 }
 
-
-AGESA_STATUS OemInitResume(AMD_RESUME_PARAMS *ResumeParams)
+AGESA_STATUS OemInitResume(AMD_S3_PARAMS *dataBlock)
 {
-	AMD_S3_PARAMS *dataBlock = &ResumeParams->S3DataBlock;
 	uintptr_t pos, size;
 
 	get_s3nv_data(S3DataTypeNonVolatile, &pos, &size);
@@ -72,9 +70,8 @@ AGESA_STATUS OemInitResume(AMD_RESUME_PARAMS *ResumeParams)
 	return AGESA_SUCCESS;
 }
 
-AGESA_STATUS OemS3LateRestore(AMD_S3LATE_PARAMS *S3LateParams)
+AGESA_STATUS OemS3LateRestore(AMD_S3_PARAMS *dataBlock)
 {
-	AMD_S3_PARAMS *dataBlock = &S3LateParams->S3DataBlock;
 	void *dst;
 	size_t len;
 
@@ -112,9 +109,8 @@ static int spi_SaveS3info(u32 pos, u32 size, u8 *buf, u32 len)
 
 static u8 MTRRStorage[S3_DATA_MTRR_SIZE];
 
-AGESA_STATUS OemS3Save(AMD_S3SAVE_PARAMS *S3SaveParams)
+AGESA_STATUS OemS3Save(AMD_S3_PARAMS *dataBlock)
 {
-	AMD_S3_PARAMS *dataBlock = &S3SaveParams->S3DataBlock;
 	u32 MTRRStorageSize = 0;
 	uintptr_t pos, size;
 
-- 
cgit v1.2.3