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