]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
MdeModulePkg/ResetUtilityLib: Add a new API ResetSystemWithSubtype
[mirror_edk2.git] / 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