]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/ResetUtilityLib.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Library / ResetUtilityLib.h
CommitLineData
e12ceb40
MK
1/** @file\r
2 This header describes various helper functions for resetting the system.\r
3\r
4 Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>\r
5 Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>\r
6\r
9d510e61 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
e12ceb40
MK
8\r
9**/\r
10#ifndef _RESET_UTILITY_LIB_H_\r
11#define _RESET_UTILITY_LIB_H_\r
12\r
13/**\r
14 This is a shorthand helper function to reset with a subtype so that\r
15 the caller doesn't have to bother with a function that has half a dozen\r
16 parameters.\r
17\r
18 This will generate a reset with status EFI_SUCCESS, a NULL string, and\r
19 no custom data. The subtype will be formatted in such a way that it can be\r
20 picked up by notification registrations and custom handlers.\r
21\r
22 NOTE: This call will fail if the architectural ResetSystem underpinnings\r
23 are not initialized. For DXE, you can add gEfiResetArchProtocolGuid\r
24 to your DEPEX.\r
25\r
26 @param[in] ResetSubtype GUID pointer for the reset subtype to be used.\r
27\r
28**/\r
29VOID\r
30EFIAPI\r
31ResetPlatformSpecificGuid (\r
32 IN CONST GUID *ResetSubtype\r
33 );\r
34\r
35/**\r
36 This function examines the DataSize and ResetData parameters passed to\r
37 to ResetSystem() and detemrines if the ResetData contains a Null-terminated\r
d1102dba 38 Unicode string followed by a GUID specific subtype. If the GUID specific\r
e12ceb40
MK
39 subtype is present, then a pointer to the GUID value in ResetData is returned.\r
40\r
41 @param[in] DataSize The size, in bytes, of ResetData.\r
42 @param[in] ResetData Pointer to the data buffer passed into ResetSystem().\r
43\r
44 @retval Pointer Pointer to the GUID value in ResetData.\r
45 @retval NULL ResetData is NULL.\r
46 @retval NULL ResetData does not start with a Null-terminated\r
47 Unicode string.\r
48 @retval NULL A Null-terminated Unicode string is present, but there\r
49 are less than sizeof (GUID) bytes after the string.\r
50 @retval NULL No subtype is found.\r
51\r
52**/\r
53GUID *\r
54EFIAPI\r
55GetResetPlatformSpecificGuid (\r
56 IN UINTN DataSize,\r
57 IN CONST VOID *ResetData\r
58 );\r
59\r
60/**\r
d1102dba 61 This is a helper function that creates the reset data buffer that can be\r
e12ceb40
MK
62 passed into ResetSystem().\r
63\r
64 The reset data buffer is returned in ResetData and contains ResetString\r
65 followed by the ResetSubtype GUID followed by the ExtraData.\r
66\r
67 NOTE: Strings are internally limited by MAX_UINT16.\r
68\r
69 @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On\r
70 output, either the total number of bytes\r
71 copied, or the required buffer size.\r
72 @param[in, out] ResetData A pointer to the buffer in which to place the\r
73 final structure.\r
74 @param[in] ResetSubtype Pointer to the GUID specific subtype. This\r
75 parameter is optional and may be NULL.\r
76 @param[in] ResetString Pointer to a Null-terminated Unicode string\r
77 that describes the reset. This parameter is\r
78 optional and may be NULL.\r
79 @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer.\r
80 @param[in] ExtraData Pointer to a buffer of extra data. This\r
81 parameter is optional and may be NULL.\r
82\r
83 @retval RETURN_SUCCESS ResetDataSize and ResetData are updated.\r
84 @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL.\r
85 @retval RETURN_INVALID_PARAMETER ResetData is NULL.\r
86 @retval RETURN_INVALID_PARAMETER ExtraData was provided without a\r
87 ResetSubtype. This is not supported by the\r
88 UEFI spec.\r
89 @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided.\r
90 ResetDataSize is updated with minimum size\r
91 required.\r
92**/\r
93RETURN_STATUS\r
94EFIAPI\r
95BuildResetData (\r
96 IN OUT UINTN *ResetDataSize,\r
97 IN OUT VOID *ResetData,\r
98 IN CONST GUID *ResetSubtype OPTIONAL,\r
99 IN CONST CHAR16 *ResetString OPTIONAL,\r
100 IN UINTN ExtraDataSize OPTIONAL,\r
101 IN CONST VOID *ExtraData OPTIONAL\r
102 );\r
103\r
104#endif // _RESET_UTILITY_LIB_H_\r