]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/ResetUtilityLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
06aaf2f8 4 Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR>\r
e12ceb40
MK
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
1436aea4 10\r
e12ceb40
MK
11#ifndef _RESET_UTILITY_LIB_H_\r
12#define _RESET_UTILITY_LIB_H_\r
13\r
06aaf2f8
BB
14#include <Uefi/UefiMultiPhase.h>\r
15\r
16/**\r
17 This is a shorthand helper function to reset with reset type and a subtype\r
18 so that the caller doesn't have to bother with a function that has half\r
19 a dozen parameters.\r
20\r
21 This will generate a reset with status EFI_SUCCESS, a NULL string, and\r
22 no custom data. The subtype will be formatted in such a way that it can be\r
23 picked up by notification registrations and custom handlers.\r
24\r
25 NOTE: This call will fail if the architectural ResetSystem underpinnings\r
26 are not initialized. For DXE, you can add gEfiResetArchProtocolGuid\r
27 to your DEPEX.\r
28\r
29 @param[in] ResetType The default EFI_RESET_TYPE of the reset.\r
30 @param[in] ResetSubtype GUID pointer for the reset subtype to be used.\r
31\r
32**/\r
33VOID\r
34EFIAPI\r
35ResetSystemWithSubtype (\r
1436aea4
MK
36 IN EFI_RESET_TYPE ResetType,\r
37 IN CONST GUID *ResetSubtype\r
06aaf2f8
BB
38 );\r
39\r
e12ceb40 40/**\r
06aaf2f8
BB
41 This is a shorthand helper function to reset with the reset type\r
42 'EfiResetPlatformSpecific' and a subtype so that the caller doesn't\r
43 have to bother with a function that has half a dozen parameters.\r
e12ceb40
MK
44\r
45 This will generate a reset with status EFI_SUCCESS, a NULL string, and\r
46 no custom data. The subtype will be formatted in such a way that it can be\r
47 picked up by notification registrations and custom handlers.\r
48\r
49 NOTE: This call will fail if the architectural ResetSystem underpinnings\r
50 are not initialized. For DXE, you can add gEfiResetArchProtocolGuid\r
51 to your DEPEX.\r
52\r
53 @param[in] ResetSubtype GUID pointer for the reset subtype to be used.\r
54\r
55**/\r
56VOID\r
57EFIAPI\r
58ResetPlatformSpecificGuid (\r
1436aea4 59 IN CONST GUID *ResetSubtype\r
e12ceb40
MK
60 );\r
61\r
62/**\r
63 This function examines the DataSize and ResetData parameters passed to\r
64 to ResetSystem() and detemrines if the ResetData contains a Null-terminated\r
d1102dba 65 Unicode string followed by a GUID specific subtype. If the GUID specific\r
e12ceb40
MK
66 subtype is present, then a pointer to the GUID value in ResetData is returned.\r
67\r
68 @param[in] DataSize The size, in bytes, of ResetData.\r
69 @param[in] ResetData Pointer to the data buffer passed into ResetSystem().\r
70\r
71 @retval Pointer Pointer to the GUID value in ResetData.\r
72 @retval NULL ResetData is NULL.\r
73 @retval NULL ResetData does not start with a Null-terminated\r
74 Unicode string.\r
75 @retval NULL A Null-terminated Unicode string is present, but there\r
76 are less than sizeof (GUID) bytes after the string.\r
77 @retval NULL No subtype is found.\r
78\r
79**/\r
80GUID *\r
81EFIAPI\r
82GetResetPlatformSpecificGuid (\r
83 IN UINTN DataSize,\r
84 IN CONST VOID *ResetData\r
85 );\r
86\r
87/**\r
d1102dba 88 This is a helper function that creates the reset data buffer that can be\r
e12ceb40
MK
89 passed into ResetSystem().\r
90\r
91 The reset data buffer is returned in ResetData and contains ResetString\r
92 followed by the ResetSubtype GUID followed by the ExtraData.\r
93\r
94 NOTE: Strings are internally limited by MAX_UINT16.\r
95\r
96 @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On\r
97 output, either the total number of bytes\r
98 copied, or the required buffer size.\r
99 @param[in, out] ResetData A pointer to the buffer in which to place the\r
100 final structure.\r
101 @param[in] ResetSubtype Pointer to the GUID specific subtype. This\r
102 parameter is optional and may be NULL.\r
103 @param[in] ResetString Pointer to a Null-terminated Unicode string\r
104 that describes the reset. This parameter is\r
105 optional and may be NULL.\r
106 @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer.\r
107 @param[in] ExtraData Pointer to a buffer of extra data. This\r
108 parameter is optional and may be NULL.\r
109\r
110 @retval RETURN_SUCCESS ResetDataSize and ResetData are updated.\r
111 @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL.\r
112 @retval RETURN_INVALID_PARAMETER ResetData is NULL.\r
113 @retval RETURN_INVALID_PARAMETER ExtraData was provided without a\r
114 ResetSubtype. This is not supported by the\r
115 UEFI spec.\r
116 @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided.\r
117 ResetDataSize is updated with minimum size\r
118 required.\r
119**/\r
120RETURN_STATUS\r
121EFIAPI\r
122BuildResetData (\r
1436aea4
MK
123 IN OUT UINTN *ResetDataSize,\r
124 IN OUT VOID *ResetData,\r
125 IN CONST GUID *ResetSubtype OPTIONAL,\r
126 IN CONST CHAR16 *ResetString OPTIONAL,\r
127 IN UINTN ExtraDataSize OPTIONAL,\r
128 IN CONST VOID *ExtraData OPTIONAL\r
e12ceb40
MK
129 );\r
130\r
131#endif // _RESET_UTILITY_LIB_H_\r