summaryrefslogtreecommitdiff
path: root/src/soc/amd/stoneyridge/pmutil.c
diff options
context:
space:
mode:
authorMarshall Dawson <marshalldawson3rd@gmail.com>2018-10-02 09:23:04 -0600
committerPatrick Georgi <pgeorgi@google.com>2018-10-04 09:42:42 +0000
commitaeb7f0511bdfad83978e6c54ef9353a62a79f428 (patch)
tree43a5a7a210037b90fe9305d3a61539a0cd2e3b6f /src/soc/amd/stoneyridge/pmutil.c
parent723e736db972c6fb012517e82bc5815fa09eb0da (diff)
amd/stoneyridge: Prepare for vboot rebooting system
Implement the function vboot_platform_prepare_reboot() which is normally a weak function. The SlpTyp field of the PM1 register is not reset to its default value when the APU restarts. This change prevents a failing condition if vboot decides to reset the system instead of allowing an S3 resume to continue. TEST=Resume Grunt when vboot attempts a reset, verify a fresh boot instead BUG=b:117089826 Change-Id: I6e0e3e541bad89ca5b23d6ddb6e5c0df7f762f10 Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/28877 Reviewed-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/stoneyridge/pmutil.c')
-rw-r--r--src/soc/amd/stoneyridge/pmutil.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/soc/amd/stoneyridge/pmutil.c b/src/soc/amd/stoneyridge/pmutil.c
index baabba5fbb..7e5e4dfe4b 100644
--- a/src/soc/amd/stoneyridge/pmutil.c
+++ b/src/soc/amd/stoneyridge/pmutil.c
@@ -32,3 +32,15 @@ int vboot_platform_is_resuming(void)
return acpi_sleep_from_pm1(inw(pm_acpi_pm_cnt_blk())) == ACPI_S3;
}
+
+/* If vboot requests a system reset, modify the PM1 register so it will never be
+ * misinterpreted as an S3 resume. */
+void vboot_platform_prepare_reboot(void)
+{
+ uint16_t pm1;
+
+ pm1 = inw(pm_acpi_pm_cnt_blk());
+ pm1 &= ~SLP_TYP;
+ pm1 |= SLP_TYP_S5 << SLP_TYP_SHIFT;
+ outw(pm1, pm_acpi_pm_cnt_blk());
+}