]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add Reset2 ppi support in PEI CORE.
authorStar Zeng <star.zeng@intel.com>
Mon, 11 May 2015 02:06:51 +0000 (02:06 +0000)
committerlzeng14 <lzeng14@Edk2>
Mon, 11 May 2015 02:06:51 +0000 (02:06 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17389 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg/Core/Pei/PeiMain.inf
MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
MdeModulePkg/Core/Pei/Reset/Reset.c

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