From e07e253bc87d6a86e5fb7f62bb63438ae4f6c5ba Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Sun, 10 Feb 2013 21:10:52 +0800 Subject: AMD S3: Change the hardcoded data size to macros. Change-Id: Ieefc4213a6dee9c399826b1daa98bbf4bc10d881 Signed-off-by: Zheng Bao Signed-off-by: zbao Reviewed-on: http://review.coreboot.org/2303 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/cpu/amd/agesa/s3_resume.c | 4 ++-- src/cpu/amd/agesa/s3_resume.h | 8 ++++++-- 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 -- cgit v1.2.3