Zheng Bao (zheng.bao@amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2303
-gerrit
commit 7d13d8a269daa68a0e8047f27f589013bef4747f Author: Zheng Bao fishbaozi@gmail.com Date: Sun Feb 10 21:10:52 2013 +0800
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 --- 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 42e950f..7069c77 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 10bc826..39ad30a 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