2 This header describes various helper functions for resetting the system.
4 Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _RESET_UTILITY_LIB_H_
11 #define _RESET_UTILITY_LIB_H_
14 This is a shorthand helper function to reset with a subtype so that
15 the caller doesn't have to bother with a function that has half a dozen
18 This will generate a reset with status EFI_SUCCESS, a NULL string, and
19 no custom data. The subtype will be formatted in such a way that it can be
20 picked up by notification registrations and custom handlers.
22 NOTE: This call will fail if the architectural ResetSystem underpinnings
23 are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
26 @param[in] ResetSubtype GUID pointer for the reset subtype to be used.
31 ResetPlatformSpecificGuid (
32 IN CONST GUID
*ResetSubtype
36 This function examines the DataSize and ResetData parameters passed to
37 to ResetSystem() and detemrines if the ResetData contains a Null-terminated
38 Unicode string followed by a GUID specific subtype. If the GUID specific
39 subtype is present, then a pointer to the GUID value in ResetData is returned.
41 @param[in] DataSize The size, in bytes, of ResetData.
42 @param[in] ResetData Pointer to the data buffer passed into ResetSystem().
44 @retval Pointer Pointer to the GUID value in ResetData.
45 @retval NULL ResetData is NULL.
46 @retval NULL ResetData does not start with a Null-terminated
48 @retval NULL A Null-terminated Unicode string is present, but there
49 are less than sizeof (GUID) bytes after the string.
50 @retval NULL No subtype is found.
55 GetResetPlatformSpecificGuid (
57 IN CONST VOID
*ResetData
61 This is a helper function that creates the reset data buffer that can be
62 passed into ResetSystem().
64 The reset data buffer is returned in ResetData and contains ResetString
65 followed by the ResetSubtype GUID followed by the ExtraData.
67 NOTE: Strings are internally limited by MAX_UINT16.
69 @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On
70 output, either the total number of bytes
71 copied, or the required buffer size.
72 @param[in, out] ResetData A pointer to the buffer in which to place the
74 @param[in] ResetSubtype Pointer to the GUID specific subtype. This
75 parameter is optional and may be NULL.
76 @param[in] ResetString Pointer to a Null-terminated Unicode string
77 that describes the reset. This parameter is
78 optional and may be NULL.
79 @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer.
80 @param[in] ExtraData Pointer to a buffer of extra data. This
81 parameter is optional and may be NULL.
83 @retval RETURN_SUCCESS ResetDataSize and ResetData are updated.
84 @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL.
85 @retval RETURN_INVALID_PARAMETER ResetData is NULL.
86 @retval RETURN_INVALID_PARAMETER ExtraData was provided without a
87 ResetSubtype. This is not supported by the
89 @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided.
90 ResetDataSize is updated with minimum size
96 IN OUT UINTN
*ResetDataSize
,
97 IN OUT VOID
*ResetData
,
98 IN CONST GUID
*ResetSubtype OPTIONAL
,
99 IN CONST CHAR16
*ResetString OPTIONAL
,
100 IN UINTN ExtraDataSize OPTIONAL
,
101 IN CONST VOID
*ExtraData OPTIONAL
104 #endif // _RESET_UTILITY_LIB_H_