MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first
authorMichael D Kinney <michael.d.kinney@intel.com>
Fri, 1 Sep 2017 07:31:03 +0000 (00:31 -0700)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 9 Feb 2018 07:29:49 +0000 (15:29 +0800)
Update PEI Service ResetSystem() to always attempt to use
the Reset2 PPI before looking for the Reset PPI.

Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Core/Pei/Reset/Reset.c

index 7440eef..cd36c52 100644 (file)
@@ -35,16 +35,21 @@ PeiResetSystem (
   EFI_STATUS        Status;\r
   EFI_PEI_RESET_PPI *ResetPpi;\r
 \r
-  Status = PeiServicesLocatePpi (\r
-             &gEfiPeiResetPpiGuid,         \r
-             0,                         \r
-             NULL,                      \r
-             (VOID **)&ResetPpi                  \r
-             );\r
+  //\r
+  // Attempt to use newer ResetSystem2().  If this returns, then ResetSystem2()\r
+  // is not available.\r
+  //\r
+  PeiResetSystem2 (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
 \r
   //\r
-  // LocatePpi returns EFI_NOT_FOUND on error\r
+  // Look for PEI Reset System PPI\r
   //\r
+  Status = PeiServicesLocatePpi (\r
+             &gEfiPeiResetPpiGuid,\r
+             0,\r
+             NULL,\r
+             (VOID **)&ResetPpi\r
+             );\r
   if (!EFI_ERROR (Status)) {\r
     return ResetPpi->ResetSystem (PeiServices);\r
   } \r
@@ -55,6 +60,10 @@ PeiResetSystem (
     EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
     (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)\r
     );\r
+\r
+  //\r
+  // No reset PPIs are available yet.\r
+  //\r
   return  EFI_NOT_AVAILABLE_YET;\r
 }\r
 \r
@@ -85,6 +94,9 @@ PeiResetSystem2 (
   EFI_STATUS            Status;\r
   EFI_PEI_RESET2_PPI    *Reset2Ppi;\r
 \r
+  //\r
+  // Look for PEI Reset System 2 PPI\r
+  //\r
   Status = PeiServicesLocatePpi (\r
              &gEfiPeiReset2PpiGuid,\r
              0,\r