summaryrefslogtreecommitdiff
path: root/src/cpu/amd
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2013-02-10 21:10:52 +0800
committerPatrick Georgi <patrick@georgi-clan.de>2013-02-11 08:23:36 +0100
commite07e253bc87d6a86e5fb7f62bb63438ae4f6c5ba (patch)
treea3000fcb36db38bce9ec0cdff946ff68b14e66d3 /src/cpu/amd
parente7c76b475c03ee7f907dbbef87ca7d755bcef6d1 (diff)
downloadcoreboot-e07e253bc87d6a86e5fb7f62bb63438ae4f6c5ba.tar.xz
AMD S3: Change the hardcoded data size to macros.
Change-Id: Ieefc4213a6dee9c399826b1daa98bbf4bc10d881 Signed-off-by: Zheng Bao <zheng.bao@amd.com> Signed-off-by: zbao <fishbaozi@gmail.com> Reviewed-on: http://review.coreboot.org/2303 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/cpu/amd')
-rw-r--r--src/cpu/amd/agesa/s3_resume.c4
-rw-r--r--src/cpu/amd/agesa/s3_resume.h8
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cpu/amd/agesa/s3_resume.c b/src/cpu/amd/agesa/s3_resume.c
index 42e950f26b..7069c77f1a 100644
--- a/src/cpu/amd/agesa/s3_resume.c
+++ b/src/cpu/amd/agesa/s3_resume.c
@@ -283,9 +283,9 @@ u32 OemAgesaSaveS3Info(S3_DATA_TYPE S3DataType, u32 DataSize, void *Data)
spi_claim_bus(flash->spi);
if (S3DataType == S3DataTypeNonVolatile) {
- flash->erase(flash, S3_DATA_NONVOLATILE_POS, 0x1000);
+ flash->erase(flash, S3_DATA_NONVOLATILE_POS, S3_DATA_NONVOLATILE_SIZE);
} else {
- flash->erase(flash, S3_DATA_VOLATILE_POS, 0x6000);
+ flash->erase(flash, S3_DATA_VOLATILE_POS, S3_DATA_VOLATILE_SIZE);
}
nvram_pos = 0;
diff --git a/src/cpu/amd/agesa/s3_resume.h b/src/cpu/amd/agesa/s3_resume.h
index 10bc826be6..39ad30ab02 100644
--- a/src/cpu/amd/agesa/s3_resume.h
+++ b/src/cpu/amd/agesa/s3_resume.h
@@ -20,9 +20,13 @@
#ifndef S3_RESUME_H
#define S3_RESUME_H
-#define S3_DATA_NONVOLATILE_POS (CONFIG_S3_VOLATILE_POS + 0x7000)
+/* The size needs to be 4k aligned, which is the sector size of most flashes. */
+#define S3_DATA_VOLATILE_SIZE 0x6000
+#define S3_DATA_MTRR_SIZE 0x1000
+#define S3_DATA_NONVOLATILE_SIZE 0x1000
#define S3_DATA_VOLATILE_POS CONFIG_S3_VOLATILE_POS
-#define S3_DATA_MTRR_POS (CONFIG_S3_VOLATILE_POS + 0x6000)
+#define S3_DATA_MTRR_POS (CONFIG_S3_VOLATILE_POS + S3_DATA_VOLATILE_SIZE)
+#define S3_DATA_NONVOLATILE_POS (CONFIG_S3_VOLATILE_POS + S3_DATA_VOLATILE_SIZE + S3_DATA_MTRR_SIZE)
typedef enum {
S3DataTypeNonVolatile=0, ///< NonVolatile Data Type