]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/FrameworkFormCallback.h
Remove IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / FrameworkFormCallback.h
CommitLineData
92627141 1/** @file\r
2 The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to custom\r
5259c97d 3 NV storage devices and for communication of user selections in a more\r
92627141 4 interactive environment. This protocol should be published by hardware\r
5259c97d 5 specific drivers that want to export access to custom hardware storage or\r
6 publish IFR that need to call back the original driver.\r
92627141 7\r
1c2f052d 8Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
22a69a5e 9SPDX-License-Identifier: BSD-2-Clause-Patent\r
92627141 10\r
92627141 11 @par Revision Reference:\r
12 This protocol is defined in HII spec 0.92.\r
13\r
14**/\r
15\r
108854b2
LG
16#ifndef __FRAMEWORK_FORM_CALLBACK_H__\r
17#define __FRAMEWORK_FORM_CALLBACK_H__\r
92627141 18\r
8e5b17b2 19#include <Protocol/FrameworkHii.h>\r
20#include <Protocol/FrameworkFormBrowser.h>\r
92627141 21\r
22#define EFI_FORM_CALLBACK_PROTOCOL_GUID \\r
23 { \\r
24 0xf3e4543d, 0xcf35, 0x6cef, {0x35, 0xc4, 0x4f, 0xe6, 0x34, 0x4d, 0xfc, 0x54 } \\r
25 }\r
26\r
27//\r
28// Forward reference for pure ANSI compatability\r
29//\r
30typedef struct _EFI_FORM_CALLBACK_PROTOCOL EFI_FORM_CALLBACK_PROTOCOL;\r
31\r
3f17e6d7 32///\r
1c2f052d
LG
33/// Inconsistent with specification here:\r
34/// RESET_REQUIRED, EXIT_REQUIRED, SAVE_REQUIRED, NV_CHANGED and NV_NOT_CHANGED are not\r
33d228aa 35/// defined in HII specification. These Flags of EFI_IFR_DATA_ENTRY should be defined\r
36/// to describe the standard behavior of the browser after the callback.\r
3f17e6d7 37///\r
f22f941e 38/// If this flag is set, the browser will exit and reset after processing callback results.\r
3f17e6d7 39///\r
1c2f052d 40#define RESET_REQUIRED 1\r
3f17e6d7 41///\r
f22f941e 42/// If this flag is set, the browser will exit after processing callback results.\r
3f17e6d7
LG
43///\r
44#define EXIT_REQUIRED 2\r
45///\r
f22f941e 46/// If this flag is set, the browser will save the NV data after processing callback results.\r
3f17e6d7
LG
47///\r
48#define SAVE_REQUIRED 4\r
49///\r
f22f941e 50/// If this flag is set, the browser will turn the NV flag on after processing callback results.\r
3f17e6d7
LG
51///\r
52#define NV_CHANGED 8\r
53///\r
f22f941e 54/// If this flag is set, the browser will turn the NV flag off after processing callback results.\r
3f17e6d7
LG
55///\r
56#define NV_NOT_CHANGED 16\r
57\r
92627141 58#pragma pack(1)\r
59typedef struct {\r
aa4a31e3 60 UINT8 OpCode; ///< Likely a string, numeric, or one-of\r
f22f941e 61 UINT8 Length; ///< Length of the EFI_IFR_DATA_ENTRY packet.\r
62 UINT16 Flags; ///< Flags settings to determine what behavior is desired from the browser after the callback.\r
63 VOID *Data; ///< The data in the form based on the op-code type. This is not a pointer to the data; the data follows immediately.\r
aa4a31e3 64 ///\r
f22f941e 65 /// If the OpCode is a OneOf or Numeric type - Data is a UINT16 value.\r
66 /// If the OpCode is a String type - Data is a CHAR16[x] type.\r
67 /// If the OpCode is a Checkbox type - Data is a UINT8 value.\r
68 /// If the OpCode is a NV Access type - Data is a EFI_IFR_NV_DATA structure.\r
aa4a31e3 69 ///\r
108854b2 70} EFI_IFR_DATA_ENTRY;\r
92627141 71\r
72typedef struct {\r
f22f941e 73 VOID *NvRamMap; ///< If the flag of the op-code specified retrieval of a copy of the NVRAM map.\r
aa4a31e3 74 //\r
92627141 75 // this is a pointer to a buffer copy\r
76 //\r
f22f941e 77 UINT32 EntryCount; ///< Number of EFI_IFR_DATA_ENTRY entries.\r
92627141 78 //\r
108854b2 79 // EFI_IFR_DATA_ENTRY Data[1]; // The in-line Data entries.\r
92627141 80 //\r
108854b2 81} EFI_IFR_DATA_ARRAY;\r
92627141 82\r
83\r
84typedef union {\r
f22f941e 85 EFI_IFR_DATA_ARRAY DataArray; ///< Primarily used by those that call back to their drivers and use HII as a repository.\r
86 EFI_IFR_PACKET DataPacket; ///< Primarily used by those that do not use HII as a repository.\r
87 CHAR16 String[1]; ///< If returning an error - fill the string with null-terminated contents.\r
2cec3ea5 88} EFI_HII_CALLBACK_PACKET;\r
92627141 89\r
90typedef struct {\r
dc7b4a5c 91 FRAMEWORK_EFI_IFR_OP_HEADER Header;\r
f22f941e 92 UINT16 QuestionId; ///< Offset into the map.\r
93 UINT8 StorageWidth; ///< Width of the value.\r
92627141 94 //\r
95 // CHAR8 Data[1]; // The Data itself\r
96 //\r
108854b2 97} EFI_IFR_NV_DATA;\r
92627141 98\r
99#pragma pack()\r
100//\r
101// The following types are currently defined:\r
102//\r
103/**\r
104 Returns the value of a variable.\r
105\r
106 @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
107 @param VariableName A NULL-terminated Unicode string that is the\r
108 name of the vendor's variable.\r
109 @param VendorGuid A unique identifier for the vendor.\r
110 @param Attributes If not NULL, a pointer to the memory location to\r
111 return the attribute's bit-mask for the variable.\r
112 @param DataSize The size in bytes of the Buffer. A size of zero causes\r
113 the variable to be deleted.\r
114 @param Buffer The buffer to return the contents of the variable.\r
115\r
116 @retval EFI_SUCCESS The function completed successfully.\r
117 @retval EFI_NOT_FOUND The variable was not found.\r
118 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
119 DataSize has been updated with the size needed to complete the request.\r
120 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
121 @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
122\r
123**/\r
124typedef\r
125EFI_STATUS\r
69686d56 126(EFIAPI *EFI_NV_READ)(\r
92627141 127 IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
128 IN CHAR16 *VariableName,\r
129 IN EFI_GUID *VendorGuid,\r
130 OUT UINT32 *Attributes OPTIONAL,\r
131 IN OUT UINTN *DataSize,\r
132 OUT VOID *Buffer\r
133 );\r
134\r
135/**\r
136 Sets the value of a variable.\r
137\r
138 @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
139 @param VariableName A NULL-terminated Unicode string that is the\r
1c2f052d
LG
140 name of the vendor's variable. Each VariableName\r
141 is unique for each VendorGuid.\r
92627141 142 @param VendorGuid A unique identifier for the vendor.\r
143 @param Attributes Attributes bit-mask to set for the variable.\r
1c2f052d
LG
144 Inconsistent with specification here:\r
145 Attributes data type has been changed from\r
d6a1c70d 146 UINT32 * to UINT32, because the input parameter is\r
f22f941e 147 not necessary to use a pointer date type.\r
92627141 148 @param DataSize The size in bytes of the Buffer. A size of zero causes\r
149 the variable to be deleted.\r
150 @param Buffer The buffer containing the contents of the variable.\r
f22f941e 151 @param ResetRequired Returns a value from the driver that abstracts this\r
152 information and will enable a system to know if a\r
153 system reset is required to achieve the configuration\r
154 changes being enabled through this function.\r
92627141 155\r
156 @retval EFI_SUCCESS The firmware has successfully stored the variable and\r
157 its data as defined by the Attributes.\r
158 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold\r
159 the variable and its data.\r
160 @retval EFI_INVALID_PARAMETER An invalid combination of Attributes bits\r
161 was supplied, or the DataSize exceeds the maximum allowed.\r
162 @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
163\r
164**/\r
165typedef\r
166EFI_STATUS\r
69686d56 167(EFIAPI *EFI_NV_WRITE)(\r
92627141 168 IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
169 IN CHAR16 *VariableName,\r
170 IN EFI_GUID *VendorGuid,\r
171 IN UINT32 Attributes,\r
172 IN UINTN DataSize,\r
173 IN VOID *Buffer,\r
174 OUT BOOLEAN *ResetRequired\r
175 );\r
176\r
177/**\r
178 This function is called to provide results data to the driver.\r
179\r
180 @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
181 @param KeyValue A unique value which is sent to the original exporting\r
1c2f052d
LG
182 driver so that it can identify the type of data\r
183 to expect. The format of the data tends to vary based\r
f22f941e 184 on the opcode that generated the callback.\r
92627141 185 @param Data A pointer to the data being sent to the original exporting driver.\r
f22f941e 186 @param Packet A pointer to a packet of information that a driver passes\r
92627141 187 back to the browser.\r
188\r
189 @return Status Code\r
190\r
191**/\r
192typedef\r
193EFI_STATUS\r
69686d56 194(EFIAPI *EFI_FORM_CALLBACK)(\r
92627141 195 IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
196 IN UINT16 KeyValue,\r
108854b2 197 IN EFI_IFR_DATA_ARRAY *Data,\r
2cec3ea5 198 OUT EFI_HII_CALLBACK_PACKET **Packet\r
92627141 199 );\r
200\r
201/**\r
92627141 202 The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to\r
203 custom NVS devices as well as communication of user selections in a more\r
3f17e6d7 204 interactive environment. This protocol should be published by platform-specific\r
92627141 205 drivers that want to export access to custom hardware storage or publish IFR\r
206 that has a requirement to call back the original driver.\r
92627141 207**/\r
208struct _EFI_FORM_CALLBACK_PROTOCOL {\r
2bbaeb0d 209 EFI_NV_READ NvRead; ///< The read operation to access the NV data serviced by a hardware-specific driver.\r
210 EFI_NV_WRITE NvWrite; ///< The write operation to access the NV data serviced by a hardware-specific driver.\r
211 EFI_FORM_CALLBACK Callback; ///< The function that is called from the configuration browser to communicate key value pairs.\r
92627141 212};\r
213\r
214extern EFI_GUID gEfiFormCallbackProtocolGuid;\r
215\r
216#endif\r