]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/ResetUtilityLib: Add a new API ResetSystemWithSubtype
authorBret Barkelew <Bret.Barkelew@microsoft.com>
Fri, 22 Feb 2019 05:51:43 +0000 (13:51 +0800)
committerLiming Gao <liming.gao@intel.com>
Sun, 28 Apr 2019 01:40:21 +0000 (09:40 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1458

Implement the new API ResetSystemWithSubtype. Depend on Uefi Spec
2.8 chapter 8.5.1, the ResetData is valid while the ResetStatus
is EFI_SUCCESS regardless of the ResetType. Also change the function
ResetPlatofrmSpecificGuid to directly call ResetSystemWithSubtype
to reduce the duplicated code.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c

index 59f14edadc0719cfb82c6b443b9ee6b6900cda77..2b5af4b95a7df7f1229d32208d1fec63eaf4b4a0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This contains the business logic for the module-specific Reset Helper functions.\r
 \r
-  Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
@@ -23,9 +23,9 @@ typedef struct {
 VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);\r
 \r
 /**\r
-  This is a shorthand helper function to reset with a subtype so that\r
-  the caller doesn't have to bother with a function that has half a dozen\r
-  parameters.\r
+  This is a shorthand helper function to reset with reset type and a subtype\r
+  so that the caller doesn't have to bother with a function that has half\r
+  a dozen parameters.\r
 \r
   This will generate a reset with status EFI_SUCCESS, a NULL string, and\r
   no custom data. The subtype will be formatted in such a way that it can be\r
@@ -35,12 +35,14 @@ VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);
         are not initialized. For DXE, you can add gEfiResetArchProtocolGuid\r
         to your DEPEX.\r
 \r
+  @param[in]  ResetType     The default EFI_RESET_TYPE of the reset.\r
   @param[in]  ResetSubtype  GUID pointer for the reset subtype to be used.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-ResetPlatformSpecificGuid (\r
+ResetSystemWithSubtype (\r
+  IN EFI_RESET_TYPE     ResetType,\r
   IN CONST  GUID        *ResetSubtype\r
   )\r
 {\r
@@ -51,7 +53,33 @@ ResetPlatformSpecificGuid (
     (GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)),\r
     ResetSubtype\r
     );\r
-  ResetPlatformSpecific (sizeof (ResetData), &ResetData);\r
+\r
+  ResetSystem (ResetType, EFI_SUCCESS, sizeof (ResetData), &ResetData);\r
+}\r
+\r
+/**\r
+  This is a shorthand helper function to reset with the reset type\r
+  'EfiResetPlatformSpecific' and a subtype so that the caller doesn't\r
+  have to bother with a function that has half a dozen parameters.\r
+\r
+  This will generate a reset with status EFI_SUCCESS, a NULL string, and\r
+  no custom data. The subtype will be formatted in such a way that it can be\r
+  picked up by notification registrations and custom handlers.\r
+\r
+  NOTE: This call will fail if the architectural ResetSystem underpinnings\r
+        are not initialized. For DXE, you can add gEfiResetArchProtocolGuid\r
+        to your DEPEX.\r
+\r
+  @param[in]  ResetSubtype  GUID pointer for the reset subtype to be used.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetPlatformSpecificGuid (\r
+  IN CONST  GUID        *ResetSubtype\r
+  )\r
+{\r
+  ResetSystemWithSubtype (EfiResetPlatformSpecific, ResetSubtype);\r
 }\r
 \r
 /**\r