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