]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / PcAtChipsetPkg / Library / ResetSystemLib / ResetSystemLib.c
index 237ae883e976dee2818bd2b15dc0262dc8b1521a..4f3cb46d6e1406941be170306545ff1ce29b97cb 100644 (file)
@@ -1,19 +1,16 @@
 /** @file\r
   Reset System Library functions for PCAT platforms\r
 \r
-  Copyright (c) 2006 - 2016, 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
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include <Base.h>\r
 \r
+#include <Uefi/UefiBaseType.h>\r
+#include <Uefi/UefiMultiPhase.h>\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/IoLib.h>\r
 \r
@@ -32,7 +29,7 @@ ResetCold (
   VOID\r
   )\r
 {\r
-  IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
+  IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
 }\r
 \r
 /**\r
@@ -48,7 +45,7 @@ ResetWarm (
   VOID\r
   )\r
 {\r
-  IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
+  IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));\r
 }\r
 \r
 /**\r
@@ -67,24 +64,6 @@ ResetShutdown (
   ASSERT (FALSE);\r
 }\r
 \r
-\r
-/**\r
-  Calling this function causes the system to enter a power state for capsule\r
-  update.\r
-\r
-  Reset update should not return, if it returns, it means the system does\r
-  not support capsule update.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-EnterS3WithImmediateWake (\r
-  VOID\r
-  )\r
-{\r
-  ASSERT (FALSE);\r
-}\r
-\r
 /**\r
   This function causes a systemwide reset. The exact type of the reset is\r
   defined by the EFI_GUID that follows the Null-terminated Unicode string passed\r
@@ -99,9 +78,52 @@ EnterS3WithImmediateWake (
 VOID\r
 EFIAPI\r
 ResetPlatformSpecific (\r
-  IN UINTN   DataSize,\r
-  IN VOID    *ResetData\r
+  IN UINTN  DataSize,\r
+  IN VOID   *ResetData\r
   )\r
 {\r
   ResetCold ();\r
 }\r
+\r
+/**\r
+  The ResetSystem function 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 ResetData.\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.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetSystem (\r
+  IN EFI_RESET_TYPE  ResetType,\r
+  IN EFI_STATUS      ResetStatus,\r
+  IN UINTN           DataSize,\r
+  IN VOID            *ResetData OPTIONAL\r
+  )\r
+{\r
+  switch (ResetType) {\r
+    case EfiResetWarm:\r
+      ResetWarm ();\r
+      break;\r
+\r
+    case EfiResetCold:\r
+      ResetCold ();\r
+      break;\r
+\r
+    case EfiResetShutdown:\r
+      ResetShutdown ();\r
+      return;\r
+\r
+    case EfiResetPlatformSpecific:\r
+      ResetPlatformSpecific (DataSize, ResetData);\r
+      return;\r
+\r
+    default:\r
+      return;\r
+  }\r
+}\r