Reviewed-by: Maurice Ma <maurice...@intel.com>

Thanks,
-Maurice

-----Original Message-----
From: Dong, Guo 
Sent: Thursday, June 11, 2015 6:33 AM
To: edk2-devel@lists.sourceforge.net
Cc: Ma, Maurice
Subject: [Patch 2/2] CorebootPayloadPkg: Fix "reset -s" issue.

This patch will 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.d...@intel.com>
---
 .../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 77b81db..55f5609 100644
--- a/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -110,15 +110,42 @@ VOID
 EFIAPI
 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.
 
   Reset update should not return, if it returns, it means the system does
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to