VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/VlanConfigDxe/VlanConfigImpl.h@ 80721

Last change on this file since 80721 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 16.2 KB
Line 
1/** @file
2 Header file for driver binding protocol and HII config access protocol.
3
4Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#ifndef __VLAN_CONFIG_IMPL_H__
10#define __VLAN_CONFIG_IMPL_H__
11
12#include <Uefi.h>
13
14#include <Protocol/ComponentName.h>
15#include <Protocol/ComponentName2.h>
16#include <Protocol/HiiConfigAccess.h>
17#include <Protocol/HiiConfigRouting.h>
18#include <Protocol/VlanConfig.h>
19
20#include <Library/BaseLib.h>
21#include <Library/BaseMemoryLib.h>
22#include <Library/DebugLib.h>
23#include <Library/MemoryAllocationLib.h>
24#include <Library/UefiBootServicesTableLib.h>
25#include <Library/UefiLib.h>
26#include <Library/NetLib.h>
27#include <Library/HiiLib.h>
28#include <Library/DevicePathLib.h>
29#include <Library/PrintLib.h>
30
31#include <Guid/MdeModuleHii.h>
32
33#include "VlanConfigNvData.h"
34
35extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2;
36extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName;
37
38//
39// Tool generated IFR binary data and String package data
40//
41extern UINT8 VlanConfigBin[];
42extern UINT8 VlanConfigDxeStrings[];
43
44#define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))
45
46typedef struct {
47 UINTN Signature;
48
49 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
50 EFI_HII_HANDLE HiiHandle;
51 EFI_HANDLE DriverHandle;
52 EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
53
54 EFI_HANDLE ControllerHandle;
55 EFI_HANDLE ImageHandle;
56 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
57 EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
58 CHAR16 *MacString;
59
60 UINT16 NumberOfVlan;
61 UINT16 VlanId[MAX_VLAN_NUMBER];
62} VLAN_CONFIG_PRIVATE_DATA;
63
64#define VLAN_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('V', 'C', 'P', 'D')
65#define VLAN_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, VLAN_CONFIG_PRIVATE_DATA, ConfigAccess, VLAN_CONFIG_PRIVATE_DATA_SIGNATURE)
66
67extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate;
68
69
70/**
71 Retrieves a Unicode string that is the user readable name of the driver.
72
73 This function retrieves the user readable name of a driver in the form of a
74 Unicode string. If the driver specified by This has a user readable name in
75 the language specified by Language, then a pointer to the driver name is
76 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
77 by This does not support the language specified by Language,
78 then EFI_UNSUPPORTED is returned.
79
80 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
81 EFI_COMPONENT_NAME_PROTOCOL instance.
82 @param Language[in] A pointer to a Null-terminated ASCII string
83 array indicating the language. This is the
84 language of the driver name that the caller is
85 requesting, and it must match one of the
86 languages specified in SupportedLanguages. The
87 number of languages supported by a driver is up
88 to the driver writer. Language is specified
89 in RFC 4646 or ISO 639-2 language code format.
90 @param DriverName[out] A pointer to the Unicode string to return.
91 This Unicode string is the name of the
92 driver specified by This in the language
93 specified by Language.
94
95 @retval EFI_SUCCESS The Unicode string for the Driver specified by
96 This and the language specified by Language was
97 returned in DriverName.
98 @retval EFI_INVALID_PARAMETER Language is NULL.
99 @retval EFI_INVALID_PARAMETER DriverName is NULL.
100 @retval EFI_UNSUPPORTED The driver specified by This does not support
101 the language specified by Language.
102
103**/
104EFI_STATUS
105EFIAPI
106VlanConfigComponentNameGetDriverName (
107 IN EFI_COMPONENT_NAME_PROTOCOL *This,
108 IN CHAR8 *Language,
109 OUT CHAR16 **DriverName
110 );
111
112/**
113 Retrieves a Unicode string that is the user readable name of the controller
114 that is being managed by a driver.
115
116 This function retrieves the user readable name of the controller specified by
117 ControllerHandle and ChildHandle in the form of a Unicode string. If the
118 driver specified by This has a user readable name in the language specified by
119 Language, then a pointer to the controller name is returned in ControllerName,
120 and EFI_SUCCESS is returned. If the driver specified by This is not currently
121 managing the controller specified by ControllerHandle and ChildHandle,
122 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
123 support the language specified by Language, then EFI_UNSUPPORTED is returned.
124
125 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
126 EFI_COMPONENT_NAME_PROTOCOL instance.
127 @param ControllerHandle[in] The handle of a controller that the driver
128 specified by This is managing. This handle
129 specifies the controller whose name is to be
130 returned.
131 @param ChildHandle[in] The handle of the child controller to retrieve
132 the name of. This is an optional parameter that
133 may be NULL. It will be NULL for device
134 drivers. It will also be NULL for a bus drivers
135 that wish to retrieve the name of the bus
136 controller. It will not be NULL for a bus
137 driver that wishes to retrieve the name of a
138 child controller.
139 @param Language[in] A pointer to a Null-terminated ASCII string
140 array indicating the language. This is the
141 language of the driver name that the caller is
142 requesting, and it must match one of the
143 languages specified in SupportedLanguages. The
144 number of languages supported by a driver is up
145 to the driver writer. Language is specified in
146 RFC 4646 or ISO 639-2 language code format.
147 @param ControllerName[out] A pointer to the Unicode string to return.
148 This Unicode string is the name of the
149 controller specified by ControllerHandle and
150 ChildHandle in the language specified by
151 Language from the point of view of the driver
152 specified by This.
153
154 @retval EFI_SUCCESS The Unicode string for the user readable name in
155 the language specified by Language for the
156 driver specified by This was returned in
157 DriverName.
158 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
159 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
160 EFI_HANDLE.
161 @retval EFI_INVALID_PARAMETER Language is NULL.
162 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
163 @retval EFI_UNSUPPORTED The driver specified by This is not currently
164 managing the controller specified by
165 ControllerHandle and ChildHandle.
166 @retval EFI_UNSUPPORTED The driver specified by This does not support
167 the language specified by Language.
168
169**/
170EFI_STATUS
171EFIAPI
172VlanConfigComponentNameGetControllerName (
173 IN EFI_COMPONENT_NAME_PROTOCOL *This,
174 IN EFI_HANDLE ControllerHandle,
175 IN EFI_HANDLE ChildHandle OPTIONAL,
176 IN CHAR8 *Language,
177 OUT CHAR16 **ControllerName
178 );
179
180/**
181 Test to see if this driver supports ControllerHandle.
182
183 @param[in] This Protocol instance pointer.
184 @param[in] ControllerHandle Handle of device to test
185 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
186 device to start.
187
188 @retval EFI_SUCCES This driver supports this device
189 @retval EFI_ALREADY_STARTED This driver is already running on this device
190 @retval other This driver does not support this device
191
192**/
193EFI_STATUS
194EFIAPI
195VlanConfigDriverBindingSupported (
196 IN EFI_DRIVER_BINDING_PROTOCOL *This,
197 IN EFI_HANDLE ControllerHandle,
198 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
199 );
200
201/**
202 Start this driver on ControllerHandle.
203
204 @param[in] This Protocol instance pointer.
205 @param[in] ControllerHandle Handle of device to bind driver to
206 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
207 device to start.
208
209 @retval EFI_SUCCES This driver is added to ControllerHandle
210 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
211 @retval other This driver does not support this device
212
213**/
214EFI_STATUS
215EFIAPI
216VlanConfigDriverBindingStart (
217 IN EFI_DRIVER_BINDING_PROTOCOL *This,
218 IN EFI_HANDLE ControllerHandle,
219 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
220 );
221
222/**
223 Stop this driver on ControllerHandle.
224
225 @param[in] This Protocol instance pointer.
226 @param[in] ControllerHandle Handle of device to stop driver on
227 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number
228 of children is zero stop the entire bus driver.
229 @param[in] ChildHandleBuffer List of Child Handles to Stop.
230
231 @retval EFI_SUCCES This driver is removed ControllerHandle
232 @retval other This driver was not removed from this device
233
234**/
235EFI_STATUS
236EFIAPI
237VlanConfigDriverBindingStop (
238 IN EFI_DRIVER_BINDING_PROTOCOL *This,
239 IN EFI_HANDLE ControllerHandle,
240 IN UINTN NumberOfChildren,
241 IN EFI_HANDLE *ChildHandleBuffer
242 );
243
244/**
245 This function update VLAN list in the VLAN configuration Form.
246
247 @param[in, out] PrivateData Points to VLAN configuration private data.
248
249**/
250VOID
251VlanUpdateForm (
252 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
253 );
254
255/**
256 This function publish the VLAN configuration Form for a network device. The
257 HII Config Access protocol will be installed on a child handle of the network
258 device.
259
260 @param[in, out] PrivateData Points to VLAN configuration private data.
261
262 @retval EFI_SUCCESS HII Form is installed for this network device.
263 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
264 @retval Others Other errors as indicated.
265
266**/
267EFI_STATUS
268InstallVlanConfigForm (
269 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
270 );
271
272/**
273 This function remove the VLAN configuration Form for a network device. The
274 child handle for HII Config Access protocol will be destroyed.
275
276 @param[in, out] PrivateData Points to VLAN configuration private data.
277
278 @retval EFI_SUCCESS HII Form has been uninstalled successfully.
279 @retval Others Other errors as indicated.
280
281**/
282EFI_STATUS
283UninstallVlanConfigForm (
284 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
285 );
286
287/**
288 This function allows a caller to extract the current configuration for one
289 or more named elements from the target driver.
290
291 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
292 @param[in] Request A null-terminated Unicode string in
293 <ConfigRequest> format.
294 @param[out] Progress On return, points to a character in the Request
295 string. Points to the string's null terminator if
296 request was successful. Points to the most recent
297 '&' before the first failing name/value pair (or
298 the beginning of the string if the failure is in
299 the first name/value pair) if the request was not
300 successful.
301 @param[out] Results A null-terminated Unicode string in
302 <ConfigAltResp> format which has all values filled
303 in for the names in the Request string. String to
304 be allocated by the called function.
305
306 @retval EFI_SUCCESS The Results is filled with the requested values.
307 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
308 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
309 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
310 driver.
311
312**/
313EFI_STATUS
314EFIAPI
315VlanExtractConfig (
316 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
317 IN CONST EFI_STRING Request,
318 OUT EFI_STRING *Progress,
319 OUT EFI_STRING *Results
320 );
321
322/**
323 This function processes the results of changes in configuration.
324
325 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
326 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>
327 format.
328 @param[out] Progress A pointer to a string filled in with the offset of
329 the most recent '&' before the first failing
330 name/value pair (or the beginning of the string if
331 the failure is in the first name/value pair) or
332 the terminating NULL if all was successful.
333
334 @retval EFI_SUCCESS The Results is processed successfully.
335 @retval EFI_INVALID_PARAMETER Configuration is NULL.
336 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
337 driver.
338
339**/
340EFI_STATUS
341EFIAPI
342VlanRouteConfig (
343 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
344 IN CONST EFI_STRING Configuration,
345 OUT EFI_STRING *Progress
346 );
347
348/**
349 This function processes the results of changes in configuration.
350
351 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
352 @param[in] Action Specifies the type of action taken by the browser.
353 @param[in] QuestionId A unique value which is sent to the original
354 exporting driver so that it can identify the type
355 of data to expect.
356 @param[in] Type The type of value for the question.
357 @param[in] Value A pointer to the data being sent to the original
358 exporting driver.
359 @param[out] ActionRequest On return, points to the action requested by the
360 callback function.
361
362 @retval EFI_SUCCESS The callback successfully handled the action.
363 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
364 variable and its data.
365 @retval EFI_DEVICE_ERROR The variable could not be saved.
366 @retval EFI_UNSUPPORTED The specified Action is not supported by the
367 callback.
368
369**/
370EFI_STATUS
371EFIAPI
372VlanCallback (
373 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
374 IN EFI_BROWSER_ACTION Action,
375 IN EFI_QUESTION_ID QuestionId,
376 IN UINT8 Type,
377 IN EFI_IFR_TYPE_VALUE *Value,
378 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
379 );
380
381#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette