summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorBret Barkelew <Bret.Barkelew@microsoft.com>2019-02-22 13:51:43 +0800
committerLiming Gao <liming.gao@intel.com>2019-04-28 09:40:21 +0800
commit0851d7a53a1d7db853a0c553df95708923961418 (patch)
treec2570fe3262a4dc19b9ad445486e1c4a64b9124d /MdeModulePkg/Library
parent06aaf2f82cd1cd6a45e826cf33666cb979cd9950 (diff)
downloadedk2-0851d7a53a1d7db853a0c553df95708923961418.tar.gz
edk2-0851d7a53a1d7db853a0c553df95708923961418.tar.bz2
edk2-0851d7a53a1d7db853a0c553df95708923961418.zip
MdeModulePkg/ResetUtilityLib: Add a new API ResetSystemWithSubtype
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>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
index 59f14edadc..2b5af4b95a 100644
--- a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
+++ b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
@@ -1,7 +1,7 @@
/** @file
This contains the business logic for the module-specific Reset Helper functions.
- Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -23,9 +23,9 @@ typedef struct {
VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);
/**
- 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 is a shorthand helper function to reset with reset type and 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
@@ -35,12 +35,14 @@ VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18);
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 +53,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 the reset type
+ 'EfiResetPlatformSpecific' and 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);
}
/**