]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CorebootPayloadPkg: Fix "reset -s" issue.
authorGuo Dong <guo.dong@intel.com>
Thu, 25 Jun 2015 16:02:16 +0000 (16:02 +0000)
committergdong1 <gdong1@Edk2>
Thu, 25 Jun 2015 16:02:16 +0000 (16:02 +0000)
Fix reboot issue after issuing shell command "reset -s" from UEFI payload.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17715 6f19259b-4bc3-4df7-8a09-765794883524

CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c

index 77b81dbed03e83f4e1d5210b6bc8c6da9db14dd5..55f5609629075aa165da6c49e881def981bc97b9 100644 (file)
@@ -112,11 +112,38 @@ ResetShutdown (
   VOID\r
   )\r
 {\r
-  AcpiPmControl (7);\r
+  EFI_HOB_GUID_TYPE  *GuidHob;\r
+  ACPI_BOARD_INFO    *pAcpiBoardInfo;\r
+  UINTN              PmCtrlReg;\r
+\r
+  //\r
+  // Find the acpi board information guid hob\r
+  //\r
+  GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);\r
+  ASSERT (GuidHob != NULL);\r
+  pAcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob); \r
+  \r
+  //\r
+  // GPE0_EN should be disabled to avoid any GPI waking up the system from S5\r
+  //\r
+  IoWrite16 ((UINTN)pAcpiBoardInfo->PmGpeEnBase,  0);\r
+\r
+  //\r
+  // Clear Power Button Status\r
+  //\r
+  IoWrite16((UINTN) pAcpiBoardInfo->PmEvtBase, BIT8);\r
+  \r
+  //\r
+  // Transform system into S5 sleep state\r
+  //\r
+  PmCtrlReg = (UINTN)pAcpiBoardInfo->PmCtrlRegBase; \r
+  IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (7 << 10));\r
+  IoOr16 (PmCtrlReg, BIT13);\r
+  CpuDeadLoop ();\r
+\r
   ASSERT (FALSE);\r
 }\r
 \r
-\r
 /**\r
   Calling this function causes the system to enter a power state for capsule\r
   update.\r