2 Header file for driver binding protocol and HII config access protocol.
4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __VLAN_CONFIG_IMPL_H__
10 #define __VLAN_CONFIG_IMPL_H__
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>
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>
31 #include <Guid/MdeModuleHii.h>
33 #include "VlanConfigNvData.h"
35 extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2
;
36 extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName
;
39 // Tool generated IFR binary data and String package data
41 extern UINT8 VlanConfigBin
[];
42 extern UINT8 VlanConfigDxeStrings
[];
44 #define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))
49 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
50 EFI_HII_HANDLE HiiHandle
;
51 EFI_HANDLE DriverHandle
;
52 EFI_DEVICE_PATH_PROTOCOL
*ChildDevicePath
;
54 EFI_HANDLE ControllerHandle
;
55 EFI_HANDLE ImageHandle
;
56 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
;
57 EFI_VLAN_CONFIG_PROTOCOL
*VlanConfig
;
61 UINT16 VlanId
[MAX_VLAN_NUMBER
];
62 } VLAN_CONFIG_PRIVATE_DATA
;
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)
67 extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate
;
70 Retrieves a Unicode string that is the user readable name of the driver.
72 This function retrieves the user readable name of a driver in the form of a
73 Unicode string. If the driver specified by This has a user readable name in
74 the language specified by Language, then a pointer to the driver name is
75 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
76 by This does not support the language specified by Language,
77 then EFI_UNSUPPORTED is returned.
79 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
80 EFI_COMPONENT_NAME_PROTOCOL instance.
81 @param Language[in] A pointer to a Null-terminated ASCII string
82 array indicating the language. This is the
83 language of the driver name that the caller is
84 requesting, and it must match one of the
85 languages specified in SupportedLanguages. The
86 number of languages supported by a driver is up
87 to the driver writer. Language is specified
88 in RFC 4646 or ISO 639-2 language code format.
89 @param DriverName[out] A pointer to the Unicode string to return.
90 This Unicode string is the name of the
91 driver specified by This in the language
92 specified by Language.
94 @retval EFI_SUCCESS The Unicode string for the Driver specified by
95 This and the language specified by Language was
96 returned in DriverName.
97 @retval EFI_INVALID_PARAMETER Language is NULL.
98 @retval EFI_INVALID_PARAMETER DriverName is NULL.
99 @retval EFI_UNSUPPORTED The driver specified by This does not support
100 the language specified by Language.
105 VlanConfigComponentNameGetDriverName (
106 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
108 OUT CHAR16
**DriverName
112 Retrieves a Unicode string that is the user readable name of the controller
113 that is being managed by a driver.
115 This function retrieves the user readable name of the controller specified by
116 ControllerHandle and ChildHandle in the form of a Unicode string. If the
117 driver specified by This has a user readable name in the language specified by
118 Language, then a pointer to the controller name is returned in ControllerName,
119 and EFI_SUCCESS is returned. If the driver specified by This is not currently
120 managing the controller specified by ControllerHandle and ChildHandle,
121 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
122 support the language specified by Language, then EFI_UNSUPPORTED is returned.
124 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
125 EFI_COMPONENT_NAME_PROTOCOL instance.
126 @param ControllerHandle[in] The handle of a controller that the driver
127 specified by This is managing. This handle
128 specifies the controller whose name is to be
130 @param ChildHandle[in] The handle of the child controller to retrieve
131 the name of. This is an optional parameter that
132 may be NULL. It will be NULL for device
133 drivers. It will also be NULL for a bus drivers
134 that wish to retrieve the name of the bus
135 controller. It will not be NULL for a bus
136 driver that wishes to retrieve the name of a
138 @param Language[in] A pointer to a Null-terminated ASCII string
139 array indicating the language. This is the
140 language of the driver name that the caller is
141 requesting, and it must match one of the
142 languages specified in SupportedLanguages. The
143 number of languages supported by a driver is up
144 to the driver writer. Language is specified in
145 RFC 4646 or ISO 639-2 language code format.
146 @param ControllerName[out] A pointer to the Unicode string to return.
147 This Unicode string is the name of the
148 controller specified by ControllerHandle and
149 ChildHandle in the language specified by
150 Language from the point of view of the driver
153 @retval EFI_SUCCESS The Unicode string for the user readable name in
154 the language specified by Language for the
155 driver specified by This was returned in
157 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
158 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
160 @retval EFI_INVALID_PARAMETER Language is NULL.
161 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
162 @retval EFI_UNSUPPORTED The driver specified by This is not currently
163 managing the controller specified by
164 ControllerHandle and ChildHandle.
165 @retval EFI_UNSUPPORTED The driver specified by This does not support
166 the language specified by Language.
171 VlanConfigComponentNameGetControllerName (
172 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
173 IN EFI_HANDLE ControllerHandle
,
174 IN EFI_HANDLE ChildHandle OPTIONAL
,
176 OUT CHAR16
**ControllerName
180 Test to see if this driver supports ControllerHandle.
182 @param[in] This Protocol instance pointer.
183 @param[in] ControllerHandle Handle of device to test
184 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
187 @retval EFI_SUCCESS This driver supports this device
188 @retval EFI_ALREADY_STARTED This driver is already running on this device
189 @retval other This driver does not support this device
194 VlanConfigDriverBindingSupported (
195 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
196 IN EFI_HANDLE ControllerHandle
,
197 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
201 Start this driver on ControllerHandle.
203 @param[in] This Protocol instance pointer.
204 @param[in] ControllerHandle Handle of device to bind driver to
205 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
208 @retval EFI_SUCCESS This driver is added to ControllerHandle
209 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
210 @retval other This driver does not support this device
215 VlanConfigDriverBindingStart (
216 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
217 IN EFI_HANDLE ControllerHandle
,
218 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
222 Stop this driver on ControllerHandle.
224 @param[in] This Protocol instance pointer.
225 @param[in] ControllerHandle Handle of device to stop driver on
226 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number
227 of children is zero stop the entire bus driver.
228 @param[in] ChildHandleBuffer List of Child Handles to Stop.
230 @retval EFI_SUCCESS This driver is removed ControllerHandle
231 @retval other This driver was not removed from this device
236 VlanConfigDriverBindingStop (
237 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
238 IN EFI_HANDLE ControllerHandle
,
239 IN UINTN NumberOfChildren
,
240 IN EFI_HANDLE
*ChildHandleBuffer
244 This function update VLAN list in the VLAN configuration Form.
246 @param[in, out] PrivateData Points to VLAN configuration private data.
251 IN OUT VLAN_CONFIG_PRIVATE_DATA
*PrivateData
255 This function publish the VLAN configuration Form for a network device. The
256 HII Config Access protocol will be installed on a child handle of the network
259 @param[in, out] PrivateData Points to VLAN configuration private data.
261 @retval EFI_SUCCESS HII Form is installed for this network device.
262 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
263 @retval Others Other errors as indicated.
267 InstallVlanConfigForm (
268 IN OUT VLAN_CONFIG_PRIVATE_DATA
*PrivateData
272 This function remove the VLAN configuration Form for a network device. The
273 child handle for HII Config Access protocol will be destroyed.
275 @param[in, out] PrivateData Points to VLAN configuration private data.
277 @retval EFI_SUCCESS HII Form has been uninstalled successfully.
278 @retval Others Other errors as indicated.
282 UninstallVlanConfigForm (
283 IN OUT VLAN_CONFIG_PRIVATE_DATA
*PrivateData
287 This function allows a caller to extract the current configuration for one
288 or more named elements from the target driver.
290 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
291 @param[in] Request A null-terminated Unicode string in
292 <ConfigRequest> format.
293 @param[out] Progress On return, points to a character in the Request
294 string. Points to the string's null terminator if
295 request was successful. Points to the most recent
296 '&' before the first failing name/value pair (or
297 the beginning of the string if the failure is in
298 the first name/value pair) if the request was not
300 @param[out] Results A null-terminated Unicode string in
301 <ConfigAltResp> format which has all values filled
302 in for the names in the Request string. String to
303 be allocated by the called function.
305 @retval EFI_SUCCESS The Results is filled with the requested values.
306 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
307 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
308 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
315 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
316 IN CONST EFI_STRING Request
,
317 OUT EFI_STRING
*Progress
,
318 OUT EFI_STRING
*Results
322 This function processes the results of changes in configuration.
324 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
325 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>
327 @param[out] Progress A pointer to a string filled in with the offset of
328 the most recent '&' before the first failing
329 name/value pair (or the beginning of the string if
330 the failure is in the first name/value pair) or
331 the terminating NULL if all was successful.
333 @retval EFI_SUCCESS The Results is processed successfully.
334 @retval EFI_INVALID_PARAMETER Configuration is NULL.
335 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
342 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
343 IN CONST EFI_STRING Configuration
,
344 OUT EFI_STRING
*Progress
348 This function processes the results of changes in configuration.
350 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
351 @param[in] Action Specifies the type of action taken by the browser.
352 @param[in] QuestionId A unique value which is sent to the original
353 exporting driver so that it can identify the type
355 @param[in] Type The type of value for the question.
356 @param[in] Value A pointer to the data being sent to the original
358 @param[out] ActionRequest On return, points to the action requested by the
361 @retval EFI_SUCCESS The callback successfully handled the action.
362 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
363 variable and its data.
364 @retval EFI_DEVICE_ERROR The variable could not be saved.
365 @retval EFI_UNSUPPORTED The specified Action is not supported by the
372 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
373 IN EFI_BROWSER_ACTION Action
,
374 IN EFI_QUESTION_ID QuestionId
,
376 IN EFI_IFR_TYPE_VALUE
*Value
,
377 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest