From 244677494b934cd2d6da956622cc599d67c89343 Mon Sep 17 00:00:00 2001 From: Guo Dong Date: Thu, 25 Jun 2015 16:02:16 +0000 Subject: [PATCH] CorebootPayloadPkg: Fix "reset -s" issue. Fix reboot issue after issuing shell command "reset -s" from UEFI payload. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Dong Reviewed-by: Maurice Ma git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17715 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/ResetSystemLib/ResetSystemLib.c | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c b/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c index 77b81dbed0..55f5609629 100644 --- a/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -112,11 +112,38 @@ ResetShutdown ( VOID ) { - AcpiPmControl (7); + EFI_HOB_GUID_TYPE *GuidHob; + ACPI_BOARD_INFO *pAcpiBoardInfo; + UINTN PmCtrlReg; + + // + // Find the acpi board information guid hob + // + GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid); + ASSERT (GuidHob != NULL); + pAcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob); + + // + // GPE0_EN should be disabled to avoid any GPI waking up the system from S5 + // + IoWrite16 ((UINTN)pAcpiBoardInfo->PmGpeEnBase, 0); + + // + // Clear Power Button Status + // + IoWrite16((UINTN) pAcpiBoardInfo->PmEvtBase, BIT8); + + // + // Transform system into S5 sleep state + // + PmCtrlReg = (UINTN)pAcpiBoardInfo->PmCtrlRegBase; + IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (7 << 10)); + IoOr16 (PmCtrlReg, BIT13); + CpuDeadLoop (); + ASSERT (FALSE); } - /** Calling this function causes the system to enter a power state for capsule update. -- 2.39.2