2 UEFI Component Name(2) protocol implementation for EFI UNDI32 driver.
4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed
6 and made available under the terms and conditions of the BSD License which
7 accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 // EFI Component Name Functions
22 Retrieves a Unicode string that is the user readable name of the driver.
24 This function retrieves the user readable name of a driver in the form of a
25 Unicode string. If the driver specified by This has a user readable name in
26 the language specified by Language, then a pointer to the driver name is
27 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
28 by This does not support the language specified by Language,
29 then EFI_UNSUPPORTED is returned.
31 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
32 EFI_COMPONENT_NAME_PROTOCOL instance.
34 @param Language[in] A pointer to a Null-terminated ASCII string
35 array indicating the language. This is the
36 language of the driver name that the caller is
37 requesting, and it must match one of the
38 languages specified in SupportedLanguages. The
39 number of languages supported by a driver is up
40 to the driver writer. Language is specified
41 in RFC 4646 or ISO 639-2 language code format.
43 @param DriverName[out] A pointer to the Unicode string to return.
44 This Unicode string is the name of the
45 driver specified by This in the language
46 specified by Language.
48 @retval EFI_SUCCESS The Unicode string for the Driver specified by
49 This and the language specified by Language was
50 returned in DriverName.
52 @retval EFI_INVALID_PARAMETER Language is NULL.
54 @retval EFI_INVALID_PARAMETER DriverName is NULL.
56 @retval EFI_UNSUPPORTED The driver specified by This does not support
57 the language specified by Language.
62 UndiComponentNameGetDriverName (
63 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
65 OUT CHAR16
**DriverName
70 Retrieves a Unicode string that is the user readable name of the controller
71 that is being managed by a driver.
73 This function retrieves the user readable name of the controller specified by
74 ControllerHandle and ChildHandle in the form of a Unicode string. If the
75 driver specified by This has a user readable name in the language specified by
76 Language, then a pointer to the controller name is returned in ControllerName,
77 and EFI_SUCCESS is returned. If the driver specified by This is not currently
78 managing the controller specified by ControllerHandle and ChildHandle,
79 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
80 support the language specified by Language, then EFI_UNSUPPORTED is returned.
82 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
83 EFI_COMPONENT_NAME_PROTOCOL instance.
85 @param ControllerHandle[in] The handle of a controller that the driver
86 specified by This is managing. This handle
87 specifies the controller whose name is to be
90 @param ChildHandle[in] The handle of the child controller to retrieve
91 the name of. This is an optional parameter that
92 may be NULL. It will be NULL for device
93 drivers. It will also be NULL for a bus drivers
94 that wish to retrieve the name of the bus
95 controller. It will not be NULL for a bus
96 driver that wishes to retrieve the name of a
99 @param Language[in] A pointer to a Null-terminated ASCII string
100 array indicating the language. This is the
101 language of the driver name that the caller is
102 requesting, and it must match one of the
103 languages specified in SupportedLanguages. The
104 number of languages supported by a driver is up
105 to the driver writer. Language is specified in
106 RFC 4646 or ISO 639-2 language code format.
108 @param ControllerName[out] A pointer to the Unicode string to return.
109 This Unicode string is the name of the
110 controller specified by ControllerHandle and
111 ChildHandle in the language specified by
112 Language from the point of view of the driver
115 @retval EFI_SUCCESS The Unicode string for the user readable name in
116 the language specified by Language for the
117 driver specified by This was returned in
120 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
122 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
125 @retval EFI_INVALID_PARAMETER Language is NULL.
127 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
129 @retval EFI_UNSUPPORTED The driver specified by This is not currently
130 managing the controller specified by
131 ControllerHandle and ChildHandle.
133 @retval EFI_UNSUPPORTED The driver specified by This does not support
134 the language specified by Language.
139 UndiComponentNameGetControllerName (
140 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
141 IN EFI_HANDLE ControllerHandle
,
142 IN EFI_HANDLE ChildHandle OPTIONAL
,
144 OUT CHAR16
**ControllerName
149 // EFI Component Name Protocol
151 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUndiComponentName
= {
152 UndiComponentNameGetDriverName
,
153 UndiComponentNameGetControllerName
,
158 // EFI Component Name 2 Protocol
160 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUndiComponentName2
= {
161 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) UndiComponentNameGetDriverName
,
162 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) UndiComponentNameGetControllerName
,
167 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUndiDriverNameTable
[] = {
178 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUndiControllerNameTable
[] = {
190 Retrieves a Unicode string that is the user readable name of the driver.
192 This function retrieves the user readable name of a driver in the form of a
193 Unicode string. If the driver specified by This has a user readable name in
194 the language specified by Language, then a pointer to the driver name is
195 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
196 by This does not support the language specified by Language,
197 then EFI_UNSUPPORTED is returned.
199 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
200 EFI_COMPONENT_NAME_PROTOCOL instance.
202 @param Language[in] A pointer to a Null-terminated ASCII string
203 array indicating the language. This is the
204 language of the driver name that the caller is
205 requesting, and it must match one of the
206 languages specified in SupportedLanguages. The
207 number of languages supported by a driver is up
208 to the driver writer. Language is specified
209 in RFC 4646 or ISO 639-2 language code format.
211 @param DriverName[out] A pointer to the Unicode string to return.
212 This Unicode string is the name of the
213 driver specified by This in the language
214 specified by Language.
216 @retval EFI_SUCCESS The Unicode string for the Driver specified by
217 This and the language specified by Language was
218 returned in DriverName.
220 @retval EFI_INVALID_PARAMETER Language is NULL.
222 @retval EFI_INVALID_PARAMETER DriverName is NULL.
224 @retval EFI_UNSUPPORTED The driver specified by This does not support
225 the language specified by Language.
230 UndiComponentNameGetDriverName (
231 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
233 OUT CHAR16
**DriverName
236 return LookupUnicodeString2 (
238 This
->SupportedLanguages
,
239 mUndiDriverNameTable
,
241 (BOOLEAN
)(This
== &gUndiComponentName
)
246 Retrieves a Unicode string that is the user readable name of the controller
247 that is being managed by a driver.
249 This function retrieves the user readable name of the controller specified by
250 ControllerHandle and ChildHandle in the form of a Unicode string. If the
251 driver specified by This has a user readable name in the language specified by
252 Language, then a pointer to the controller name is returned in ControllerName,
253 and EFI_SUCCESS is returned. If the driver specified by This is not currently
254 managing the controller specified by ControllerHandle and ChildHandle,
255 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
256 support the language specified by Language, then EFI_UNSUPPORTED is returned.
257 Currently not implemented.
259 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
260 EFI_COMPONENT_NAME_PROTOCOL instance.
262 @param ControllerHandle[in] The handle of a controller that the driver
263 specified by This is managing. This handle
264 specifies the controller whose name is to be
267 @param ChildHandle[in] The handle of the child controller to retrieve
268 the name of. This is an optional parameter that
269 may be NULL. It will be NULL for device
270 drivers. It will also be NULL for a bus drivers
271 that wish to retrieve the name of the bus
272 controller. It will not be NULL for a bus
273 driver that wishes to retrieve the name of a
276 @param Language[in] A pointer to a Null-terminated ASCII string
277 array indicating the language. This is the
278 language of the driver name that the caller is
279 requesting, and it must match one of the
280 languages specified in SupportedLanguages. The
281 number of languages supported by a driver is up
282 to the driver writer. Language is specified in
283 RFC 4646 or ISO 639-2 language code format.
285 @param ControllerName[out] A pointer to the Unicode string to return.
286 This Unicode string is the name of the
287 controller specified by ControllerHandle and
288 ChildHandle in the language specified by
289 Language from the point of view of the driver
292 @retval EFI_SUCCESS The Unicode string for the user readable name in
293 the language specified by Language for the
294 driver specified by This was returned in
297 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
299 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
302 @retval EFI_INVALID_PARAMETER Language is NULL.
304 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
306 @retval EFI_UNSUPPORTED The driver specified by This is not currently
307 managing the controller specified by
308 ControllerHandle and ChildHandle.
310 @retval EFI_UNSUPPORTED The driver specified by This does not support
311 the language specified by Language.
316 UndiComponentNameGetControllerName (
317 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
318 IN EFI_HANDLE ControllerHandle
,
319 IN EFI_HANDLE ChildHandle OPTIONAL
,
321 OUT CHAR16
**ControllerName
325 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*Nii
;
327 if (ChildHandle
!= NULL
) {
328 return EFI_UNSUPPORTED
;
332 // Make sure this driver is currently managing ControllHandle
334 Status
= EfiTestManagedDevice (
336 gUndiDriverBinding
.DriverBindingHandle
,
337 &gEfiPciIoProtocolGuid
339 if (EFI_ERROR (Status
)) {
344 // Retrieve an instance of a produced protocol from ControllerHandle
346 Status
= gBS
->OpenProtocol (
348 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
352 EFI_OPEN_PROTOCOL_GET_PROTOCOL
354 if (EFI_ERROR (Status
)) {
358 return LookupUnicodeString2 (
360 This
->SupportedLanguages
,
361 mUndiControllerNameTable
,
363 (BOOLEAN
)(This
== &gUndiComponentName
)