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