Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.z...@intel.com>
Reviewed-by: Liming Gao <liming....@intel.com>
---
 MdeModulePkg/Core/Pei/PeiMain.h         | 27 ++++++++++++++++++-
 MdeModulePkg/Core/Pei/PeiMain.inf       |  3 ++-
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c |  3 ++-
 MdeModulePkg/Core/Pei/Reset/Reset.c     | 48 +++++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index 8c7cfe4..2498320 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -1,7 +1,7 @@
 /** @file
   Definition of Pei Core Structures and Services
   
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include <Ppi/MemoryDiscovered.h>
 #include <Ppi/StatusCode.h>
 #include <Ppi/Reset.h>
+#include <Ppi/Reset2.h>
 #include <Ppi/FirmwareVolume.h>
 #include <Ppi/FirmwareVolumeInfo.h>
 #include <Ppi/FirmwareVolumeInfo2.h>
@@ -964,6 +965,30 @@ PeiResetSystem (
   );
 
 /**
+  Resets the entire platform.
+
+  @param[in] ResetType      The type of reset to perform.
+  @param[in] ResetStatus    The status code for the reset.
+  @param[in] DataSize       The size, in bytes, of WatchdogData.
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or 
EfiResetShutdown
+                            the data buffer starts with a Null-terminated 
string, optionally
+                            followed by additional binary data. The string is 
a description
+                            that the caller may use to further indicate the 
reason for the
+                            system reset. ResetData is only valid if 
ResetStatus is something
+                            other than EFI_SUCCESS unless the ResetType is 
EfiResetPlatformSpecific
+                            where a minimum amount of ResetData is always 
required.
+
+**/
+VOID
+EFIAPI
+PeiResetSystem2 (
+  IN EFI_RESET_TYPE     ResetType,
+  IN EFI_STATUS         ResetStatus,
+  IN UINTN              DataSize,
+  IN VOID               *ResetData OPTIONAL
+  );
+
+/**
 
   Initialize PeiCore Fv List.
 
diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf 
b/MdeModulePkg/Core/Pei/PeiMain.inf
index 342e344..0acac47 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.inf
+++ b/MdeModulePkg/Core/Pei/PeiMain.inf
@@ -6,7 +6,7 @@
 # 2) Dispatch PEIM from discovered FV.
 # 3) Handoff control to DxeIpl to load DXE core and enter DXE phase.
 #
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -100,6 +100,7 @@
   gEfiPeiSecurity2PpiGuid                       ## NOTIFY
   gEfiTemporaryRamSupportPpiGuid                ## SOMETIMES_CONSUMES
   gEfiTemporaryRamDonePpiGuid                   ## SOMETIMES_CONSUMES
+  gEfiPeiReset2PpiGuid                          ## SOMETIMES_CONSUMES
 
 [Pcd]  
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported                   ## 
CONSUMES
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c 
b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index d019141..05e0d0f 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -63,7 +63,8 @@ EFI_PEI_SERVICES  gPs = {
   PeiFfsGetVolumeInfo,
   PeiRegisterForShadow,
   PeiFfsFindSectionData3,
-  PeiFfsGetFileInfo2
+  PeiFfsGetFileInfo2,
+  PeiResetSystem2
 };
 
 /**
diff --git a/MdeModulePkg/Core/Pei/Reset/Reset.c 
b/MdeModulePkg/Core/Pei/Reset/Reset.c
index 793244b..2e9ac82 100644
--- a/MdeModulePkg/Core/Pei/Reset/Reset.c
+++ b/MdeModulePkg/Core/Pei/Reset/Reset.c
@@ -58,3 +58,51 @@ PeiResetSystem (
   return  EFI_NOT_AVAILABLE_YET;
 }
 
+/**
+  Resets the entire platform.
+
+  @param[in] ResetType      The type of reset to perform.
+  @param[in] ResetStatus    The status code for the reset.
+  @param[in] DataSize       The size, in bytes, of WatchdogData.
+  @param[in] ResetData      For a ResetType of EfiResetCold, EfiResetWarm, or 
EfiResetShutdown
+                            the data buffer starts with a Null-terminated 
string, optionally
+                            followed by additional binary data. The string is 
a description
+                            that the caller may use to further indicate the 
reason for the
+                            system reset. ResetData is only valid if 
ResetStatus is something
+                            other than EFI_SUCCESS unless the ResetType is 
EfiResetPlatformSpecific
+                            where a minimum amount of ResetData is always 
required.
+
+**/
+VOID
+EFIAPI
+PeiResetSystem2 (
+  IN EFI_RESET_TYPE     ResetType,
+  IN EFI_STATUS         ResetStatus,
+  IN UINTN              DataSize,
+  IN VOID               *ResetData OPTIONAL
+  )
+{
+  EFI_STATUS            Status;
+  EFI_PEI_RESET2_PPI    *Reset2Ppi;
+
+  Status = PeiServicesLocatePpi (
+             &gEfiPeiReset2PpiGuid,
+             0,
+             NULL,
+             (VOID **)&Reset2Ppi
+             );
+
+  if (!EFI_ERROR (Status)) {
+    Reset2Ppi->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
+    return;
+  }
+
+  //
+  // Report Status Code that Reset2 PPI is not available.
+  //
+  REPORT_STATUS_CODE (
+    EFI_ERROR_CODE | EFI_ERROR_MINOR,
+    (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)
+    );
+}
+
-- 
1.9.5.msysgit.0


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to