[coreboot-gerrit] Change in coreboot[master]: WIP: amd/common: Add FCH restore functions to wrapper

Marshall Dawson (Code Review) gerrit at coreboot.org
Thu Jan 25 23:24:48 CET 2018


Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/23441


Change subject: WIP: amd/common: Add FCH restore functions to wrapper
......................................................................

WIP: amd/common: Add FCH restore functions to wrapper

This follows a historical methodology for restoring the FCH settings,
but is not architecturally pure.  The FCH restoration falls outside
the definitions of the AGESA Arch2008 entry points.

A better implementation is needed.

Change-Id: I2c81d744d550493266c7986891a43c1d16b78b9a
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/common/block/pi/agesawrapper.c
1 file changed, 60 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/23441/1

diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c
index 22b9f04..fd6f5f5 100644
--- a/src/soc/amd/common/block/pi/agesawrapper.c
+++ b/src/soc/amd/common/block/pi/agesawrapper.c
@@ -513,6 +513,66 @@
 	return Status;
 }
 
+AGESA_STATUS agesawrapper_fchs3earlyrestore(void)
+{
+	AGESA_STATUS status = AGESA_SUCCESS;
+	struct cbmem_usage *amd_cbmem = (struct cbmem_usage *)agesa_heap_base();
+	AMD_CONFIG_PARAMS StdHeader = {
+		.HeapStatus = HEAP_SYSTEM_MEM,
+		.HeapBasePtr = (uintptr_t)&amd_cbmem->heap_base,
+		.CalloutPtr = &GetBiosCallout,
+	};
+	FCH_DATA_BLOCK FchParams = {
+		.StdHeader = &StdHeader,
+	};
+
+	if (!acpi_s3_resume_allowed())
+		return AGESA_UNSUPPORTED;
+
+	if (!amd_cbmem) {
+		printk(BIOS_ERR, "Error locating CBMEM_ID_RESUME_SCRATCH\n");
+		return AGESA_ERROR;
+	}
+
+// todo: save data during POST to be used here
+//	s3_resume_init_data(&FchParams);
+
+	FchInitS3EarlyRestore(&FchParams);
+
+	return status;
+}
+
+AGESA_STATUS agesawrapper_fchs3laterestore(void)
+{
+	AGESA_STATUS status = AGESA_SUCCESS;
+	struct cbmem_usage *amd_cbmem = (struct cbmem_usage *)agesa_heap_base();
+	AMD_CONFIG_PARAMS StdHeader = {
+		.HeapStatus = HEAP_SYSTEM_MEM,
+		.HeapBasePtr = (uintptr_t)&amd_cbmem->heap_base,
+		.CalloutPtr = &GetBiosCallout,
+	};
+	FCH_DATA_BLOCK FchParams = {
+		.StdHeader = &StdHeader,
+	};
+
+	if (!acpi_s3_resume_allowed())
+		return AGESA_UNSUPPORTED;
+
+	if (!amd_cbmem) {
+		printk(BIOS_ERR, "Error locating CBMEM_ID_RESUME_SCRATCH\n");
+		return AGESA_ERROR;
+	}
+
+// todo: save data during POST to be used here
+//	s3_resume_init_data(&FchParams);
+	FchInitS3LateRestore(&FchParams);
+
+	// todo: still need to reload interrupt values?  native agesa doesn't
+	//       but old PI code used to.
+
+	return status;
+}
+
 static int agesa_locate_file(const char *name, struct region_device *rdev,
 				uint32_t type)
 {

-- 
To view, visit https://review.coreboot.org/23441
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c81d744d550493266c7986891a43c1d16b78b9a
Gerrit-Change-Number: 23441
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180125/bb7541c9/attachment-0001.html>


More information about the coreboot-gerrit mailing list