]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmSmcPsciResetSystemLib: Add a new API ResetSystem
authorZhichao Gao <zhichao.gao@intel.com>
Thu, 11 Apr 2019 01:28:13 +0000 (09:28 +0800)
committerLiming Gao <liming.gao@intel.com>
Sun, 28 Apr 2019 01:40:19 +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>
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c

index 87c1ea0ed032f507fac6ece90013a059b3018952..b2dde9bfc13a880e8670eb883ef7a4ff687c11e7 100644 (file)
@@ -2,6 +2,7 @@
   ResetSystemLib implementation using PSCI calls\r
 \r
   Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -169,3 +170,46 @@ ResetPlatformSpecific (
   // Map the platform specific reset as reboot\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