]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CorebootPayloadPkg/ResetSystemLib: Add new API ResetSystem
authorZhichao Gao <zhichao.gao@intel.com>
Mon, 8 Apr 2019 08:09:10 +0000 (16:09 +0800)
committerLiming Gao <liming.gao@intel.com>
Sun, 28 Apr 2019 01:40:17 +0000 (09:40 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1460

Add a new API ResetSystem to this ResetSystemLib instance.
It only adds the basic functions from ResetSystemRuntimeDxe.
Lacking of this interface may cause link error, if some drivers
use this new API and link to this library instance.
Notes:
This library API only provide a basic function of reset. Full
function should use the instance in the MdeModulePkg and make
sure the depex driver is dispatched.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
CorebootPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c

index 1fb914240819fd5193fd00f3df08e490eb3279c4..2a6abaf6ba86ff27a25d8948ed507ad7d6f439b2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Reset System Library functions for coreboot\r
 \r
-  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -176,3 +176,46 @@ ResetPlatformSpecific (
 {\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