[coreboot-gerrit] Patch set updated for coreboot: northbridge/amd/amdmct/mct_ddr3: Fix failing S3 resume

Timothy Pearson (tpearson@raptorengineeringinc.com) gerrit at coreboot.org
Sat Oct 17 08:23:30 CEST 2015


Timothy Pearson (tpearson at raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11960

-gerrit

commit 2e9179789c4545bb2d3b7a727828a7ba9e1bd5f3
Author: Timothy Pearson <tpearson at raptorengineeringinc.com>
Date:   Mon Jun 1 02:40:24 2015 -0500

    northbridge/amd/amdmct/mct_ddr3: Fix failing S3 resume
    
    Change-Id: I852a8132ff2f39f9297447455ad03d728ce9c5f6
    Signed-off-by: Timothy Pearson <tpearson at raptorengineeringinc.com>
---
 src/northbridge/amd/amdmct/mct_ddr3/s3utils.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c b/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c
index 1dcbea0..c9bcac1 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c
@@ -602,7 +602,9 @@ int8_t save_mct_information_to_nvram(void)
 int8_t restore_mct_information_from_nvram(void)
 {
 	ssize_t s3nv_offset;
-	struct amd_s3_persistent_data persistent_data;
+	ssize_t s3nv_file_offset;
+	void * s3nv_cbfs_file_ptr;
+	struct amd_s3_persistent_data *persistent_data;
 
 	/* Obtain CBFS file offset */
 	s3nv_offset = get_s3nv_file_offset();
@@ -610,11 +612,19 @@ int8_t restore_mct_information_from_nvram(void)
 		return -1;
 
 	/* Align flash pointer to nearest boundary */
+	s3nv_file_offset = s3nv_offset;
 	s3nv_offset &= ~(CONFIG_S3_DATA_SIZE-1);
 	s3nv_offset += CONFIG_S3_DATA_SIZE;
+	s3nv_file_offset = s3nv_offset - s3nv_file_offset;
 
-	cbfs_read(CBFS_DEFAULT_MEDIA, &persistent_data, s3nv_offset, sizeof(struct amd_s3_persistent_data));
-	restore_mct_data_from_save_variable(&persistent_data);
+	/* Map data structure in CBFS and restore settings */
+	s3nv_cbfs_file_ptr = cbfs_boot_map_with_leak(S3NV_FILE_NAME, CBFS_TYPE_RAW, NULL);
+	if (!s3nv_cbfs_file_ptr) {
+		printk(BIOS_DEBUG, "S3 state file could not be mapped: %s\n", S3NV_FILE_NAME);
+		return -1;
+	}
+	persistent_data = (s3nv_cbfs_file_ptr + s3nv_file_offset);
+	restore_mct_data_from_save_variable(persistent_data);
 
 	return 0;
 }
\ No newline at end of file



More information about the coreboot-gerrit mailing list