]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
MdeModulePkg/ResetSystem: Remove unnecessary global variable
[mirror_edk2.git] / MdeModulePkg / Universal / ResetSystemRuntimeDxe / ResetSystem.c
index 957cb0b4c5098623b3a699903c86dfd43db49b3c..64f2da5ce9def5ef4bc59141998490e03e2d54f2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Reset Architectural Protocol implementation\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2017, 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
 \r
 #include "ResetSystem.h"\r
 \r
-//\r
-// The handle onto which the Reset Architectural Protocol is installed\r
-//\r
-EFI_HANDLE  mResetHandle = NULL;\r
-\r
 /**\r
   The driver's entry point.\r
 \r
@@ -40,6 +35,7 @@ InitializeResetSystem (
   )\r
 {\r
   EFI_STATUS  Status;\r
+  EFI_HANDLE  Handle;\r
 \r
   //\r
   // Make sure the Reset Architectural Protocol is not already installed in the system\r
@@ -54,8 +50,9 @@ InitializeResetSystem (
   //\r
   // Now install the Reset RT AP on a new handle\r
   //\r
+  Handle = NULL;\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &mResetHandle,\r
+                  &Handle,\r
                   &gEfiResetArchProtocolGuid,\r
                   NULL,\r
                   NULL\r
@@ -65,37 +62,6 @@ InitializeResetSystem (
   return Status;\r
 }\r
 \r
-/**\r
-  Reset system for capsule update.\r
-\r
-  @param[in] CapsuleDataPtr  Pointer to the capsule block descriptors.\r
-                            \r
-**/\r
-VOID\r
-CapsuleReset (\r
-  IN UINTN   CapsuleDataPtr\r
-  )\r
-{\r
-  //\r
-  // This implementation assumes that we're using a variable\r
-  // to indicate capsule updates.\r
-  //\r
-  gRT->SetVariable (\r
-         EFI_CAPSULE_VARIABLE_NAME,\r
-         &gEfiCapsuleVendorGuid,\r
-         EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-         sizeof (UINTN),\r
-         (VOID *) &CapsuleDataPtr\r
-         );\r
-\r
-  EnterS3WithImmediateWake ();\r
-\r
-  //\r
-  // Should not return\r
-  //\r
-  CpuDeadLoop ();\r
-}\r
-\r
 /**\r
   Put the system into S3 power state.                            \r
 **/\r
@@ -117,11 +83,15 @@ DoS3 (
 \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] DataSize           The size, in bytes, of ResetData.\r
   @param[in] ResetData          For a ResetType of EfiResetCold, EfiResetWarm, or\r
                                 EfiResetShutdown the data buffer starts with a Null-terminated\r
                                 string, optionally followed by additional binary data.\r
-\r
+                                The string is a description that the caller may use to further\r
+                                indicate the reason for the system reset. ResetData is only\r
+                                valid if ResetStatus is something other than EFI_SUCCESS\r
+                                unless the ResetType is EfiResetPlatformSpecific\r
+                                where a minimum amount of ResetData is always required.\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -135,6 +105,11 @@ ResetSystem (
   EFI_STATUS    Status;\r
   UINTN         Size;\r
   UINTN         CapsuleDataPtr;\r
+  \r
+  //\r
+  // Indicate reset system runtime service is called.\r
+  //\r
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM));\r
 \r
   switch (ResetType) {\r
   case EfiResetWarm:\r
@@ -170,6 +145,10 @@ ResetSystem (
     ResetShutdown ();\r
     return ;\r
 \r
+  case EfiResetPlatformSpecific:\r
+    ResetPlatformSpecific (DataSize, ResetData);\r
+    return;\r
+\r
   default:\r
     return ;\r
   }\r