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