Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31160
Change subject: soc/amd/stoneyridge: Reboot if missing MRC cache info ......................................................................
soc/amd/stoneyridge: Reboot if missing MRC cache info
AGESA doesn't detect invalid NV data during AmdInitResume(). In cases where the data has been erased, or cannot be found, reboot the system. Otherwise the user will experience a hang when cbmem isn't recovered and the postcar frame cannot be initialized.
BUG=b:122725586 TEST=Write S3 NV save data with 0xff and force reboot
Change-Id: Ib3cf2515f300decd3de198f7741660d95ee4c744 Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/soc/amd/common/block/s3/s3_resume.c 1 file changed, 21 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/31160/1
diff --git a/src/soc/amd/common/block/s3/s3_resume.c b/src/soc/amd/common/block/s3/s3_resume.c index 04414e8..adbda64 100644 --- a/src/soc/amd/common/block/s3/s3_resume.c +++ b/src/soc/amd/common/block/s3/s3_resume.c @@ -16,7 +16,9 @@
#include <stage_cache.h> #include <mrc_cache.h> +#include <reset.h> #include <console/console.h> +#include <soc/southbridge.h> #include <amdblocks/s3_resume.h>
/* Training data versioning is not supported or tracked. */ @@ -33,11 +35,25 @@ } *base = rdev_mmap_full(&rdev); *size = region_device_sz(&rdev); - if (!*base || !*size) - printk(BIOS_ERR, "Error: S3 NV data not found\n"); - else - printk(BIOS_SPEW, "S3 NV data @0x%p 0x%0zx total bytes\n", - *base, *size); + if (!*base || !*size) { + printk(BIOS_ERR, "Error: S3 NV data not found, rebooting...\n"); + set_pm1cnt_s5(); + board_reset(); + } + + int i; + uint8_t erased = 0xff; + uint8_t *s3nv = *base; + for (i = 0 ; i < *size ; i++) + erased &= *(s3nv + i); + + if (erased == 0xff) { + printk(BIOS_ERR, "Error: S3 NV data invalid, rebooting...\n"); + set_pm1cnt_s5(); + board_reset(); + } + + printk(BIOS_SPEW, "S3 NV data @0x%p, 0x%0zx bytes\n", *base, *size); }
void get_s3vol_info(void **base, size_t *size)