]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BeagleBoardPkg/ResetSystemLib: Add new API ResetSystem
authorZhichao Gao <zhichao.gao@intel.com>
Mon, 8 Apr 2019 08:07:35 +0000 (16:07 +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>
BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c

index 9fc572957f5f5f8f532f536338ff71d13378c097..f3e0201a6f1f9fd18d29c914072b309eae0887f6 100644 (file)
@@ -3,6 +3,7 @@
 \r
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   Copyright (c) 2017, 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
@@ -103,3 +104,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