From: Bret Barkelew <bret.barke...@microsoft.com>

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.w...@intel.com>
Cc: Hao Wu <hao.a...@intel.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Michael Turner <michael.tur...@microsoft.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao....@intel.com>
---
 .../Library/ResetUtilityLib/ResetUtility.c    | 36 +++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c 
b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
index 59f14edadc..45dbd2a952 100644
--- a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
+++ b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
@@ -31,16 +31,14 @@ VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);
   no custom data. The subtype will be formatted in such a way that it can be
   picked up by notification registrations and custom handlers.
 
-  NOTE: This call will fail if the architectural ResetSystem underpinnings
-        are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
-        to your DEPEX.
-
+  @param[in]  ResetType     The default EFI_RESET_TYPE of the reset.
   @param[in]  ResetSubtype  GUID pointer for the reset subtype to be used.
 
 **/
 VOID
 EFIAPI
-ResetPlatformSpecificGuid (
+ResetSystemWithSubtype (
+  IN EFI_RESET_TYPE     ResetType,
   IN CONST  GUID        *ResetSubtype
   )
 {
@@ -51,7 +49,33 @@ ResetPlatformSpecificGuid (
     (GUID *)((UINT8 *)&ResetData + OFFSET_OF 
(RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)),
     ResetSubtype
     );
-  ResetPlatformSpecific (sizeof (ResetData), &ResetData);
+
+  ResetSystem (ResetType, EFI_SUCCESS, sizeof (ResetData), &ResetData);
+}
+
+/**
+  This is a shorthand helper function to reset with a subtype so that
+  the caller doesn't have to bother with a function that has half a dozen
+  parameters.
+
+  This will generate a reset with status EFI_SUCCESS, a NULL string, and
+  no custom data. The subtype will be formatted in such a way that it can be
+  picked up by notification registrations and custom handlers.
+
+  NOTE: This call will fail if the architectural ResetSystem underpinnings
+        are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
+        to your DEPEX.
+
+  @param[in]  ResetSubtype  GUID pointer for the reset subtype to be used.
+
+**/
+VOID
+EFIAPI
+ResetPlatformSpecificGuid (
+  IN CONST  GUID        *ResetSubtype
+  )
+{
+  ResetSystemWithSubtype (EfiResetPlatformSpecific, ResetSubtype);
 }
 
 /**
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39046): https://edk2.groups.io/g/devel/message/39046
Mute This Topic: https://groups.io/mt/31137361/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to