2 UEFI Component Name(2) protocol implementation for EFI UNDI32 driver.
4 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 // EFI Component Name Functions
16 Retrieves a Unicode string that is the user readable name of the driver.
18 This function retrieves the user readable name of a driver in the form of a
19 Unicode string. If the driver specified by This has a user readable name in
20 the language specified by Language, then a pointer to the driver name is
21 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
22 by This does not support the language specified by Language,
23 then EFI_UNSUPPORTED is returned.
25 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
26 EFI_COMPONENT_NAME_PROTOCOL instance.
28 @param Language[in] A pointer to a Null-terminated ASCII string
29 array indicating the language. This is the
30 language of the driver name that the caller is
31 requesting, and it must match one of the
32 languages specified in SupportedLanguages. The
33 number of languages supported by a driver is up
34 to the driver writer. Language is specified
35 in RFC 4646 or ISO 639-2 language code format.
37 @param DriverName[out] A pointer to the Unicode string to return.
38 This Unicode string is the name of the
39 driver specified by This in the language
40 specified by Language.
42 @retval EFI_SUCCESS The Unicode string for the Driver specified by
43 This and the language specified by Language was
44 returned in DriverName.
46 @retval EFI_INVALID_PARAMETER Language is NULL.
48 @retval EFI_INVALID_PARAMETER DriverName is NULL.
50 @retval EFI_UNSUPPORTED The driver specified by This does not support
51 the language specified by Language.
56 UndiComponentNameGetDriverName (
57 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
59 OUT CHAR16
**DriverName
64 Retrieves a Unicode string that is the user readable name of the controller
65 that is being managed by a driver.
67 This function retrieves the user readable name of the controller specified by
68 ControllerHandle and ChildHandle in the form of a Unicode string. If the
69 driver specified by This has a user readable name in the language specified by
70 Language, then a pointer to the controller name is returned in ControllerName,
71 and EFI_SUCCESS is returned. If the driver specified by This is not currently
72 managing the controller specified by ControllerHandle and ChildHandle,
73 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
74 support the language specified by Language, then EFI_UNSUPPORTED is returned.
76 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
77 EFI_COMPONENT_NAME_PROTOCOL instance.
79 @param ControllerHandle[in] The handle of a controller that the driver
80 specified by This is managing. This handle
81 specifies the controller whose name is to be
84 @param ChildHandle[in] The handle of the child controller to retrieve
85 the name of. This is an optional parameter that
86 may be NULL. It will be NULL for device
87 drivers. It will also be NULL for a bus drivers
88 that wish to retrieve the name of the bus
89 controller. It will not be NULL for a bus
90 driver that wishes to retrieve the name of a
93 @param Language[in] A pointer to a Null-terminated ASCII string
94 array indicating the language. This is the
95 language of the driver name that the caller is
96 requesting, and it must match one of the
97 languages specified in SupportedLanguages. The
98 number of languages supported by a driver is up
99 to the driver writer. Language is specified in
100 RFC 4646 or ISO 639-2 language code format.
102 @param ControllerName[out] A pointer to the Unicode string to return.
103 This Unicode string is the name of the
104 controller specified by ControllerHandle and
105 ChildHandle in the language specified by
106 Language from the point of view of the driver
109 @retval EFI_SUCCESS The Unicode string for the user readable name in
110 the language specified by Language for the
111 driver specified by This was returned in
114 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
116 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
119 @retval EFI_INVALID_PARAMETER Language is NULL.
121 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
123 @retval EFI_UNSUPPORTED The driver specified by This is not currently
124 managing the controller specified by
125 ControllerHandle and ChildHandle.
127 @retval EFI_UNSUPPORTED The driver specified by This does not support
128 the language specified by Language.
133 UndiComponentNameGetControllerName (
134 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
135 IN EFI_HANDLE ControllerHandle
,
136 IN EFI_HANDLE ChildHandle OPTIONAL
,
138 OUT CHAR16
**ControllerName
143 // EFI Component Name Protocol
145 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUndiComponentName
= {
146 UndiComponentNameGetDriverName
,
147 UndiComponentNameGetControllerName
,
152 // EFI Component Name 2 Protocol
154 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUndiComponentName2
= {
155 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) UndiComponentNameGetDriverName
,
156 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) UndiComponentNameGetControllerName
,
161 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUndiDriverNameTable
[] = {
172 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUndiControllerNameTable
[] = {
184 Retrieves a Unicode string that is the user readable name of the driver.
186 This function retrieves the user readable name of a driver in the form of a
187 Unicode string. If the driver specified by This has a user readable name in
188 the language specified by Language, then a pointer to the driver name is
189 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
190 by This does not support the language specified by Language,
191 then EFI_UNSUPPORTED is returned.
193 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
194 EFI_COMPONENT_NAME_PROTOCOL instance.
196 @param Language[in] A pointer to a Null-terminated ASCII string
197 array indicating the language. This is the
198 language of the driver name that the caller is
199 requesting, and it must match one of the
200 languages specified in SupportedLanguages. The
201 number of languages supported by a driver is up
202 to the driver writer. Language is specified
203 in RFC 4646 or ISO 639-2 language code format.
205 @param DriverName[out] A pointer to the Unicode string to return.
206 This Unicode string is the name of the
207 driver specified by This in the language
208 specified by Language.
210 @retval EFI_SUCCESS The Unicode string for the Driver specified by
211 This and the language specified by Language was
212 returned in DriverName.
214 @retval EFI_INVALID_PARAMETER Language is NULL.
216 @retval EFI_INVALID_PARAMETER DriverName is NULL.
218 @retval EFI_UNSUPPORTED The driver specified by This does not support
219 the language specified by Language.
224 UndiComponentNameGetDriverName (
225 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
227 OUT CHAR16
**DriverName
230 return LookupUnicodeString2 (
232 This
->SupportedLanguages
,
233 mUndiDriverNameTable
,
235 (BOOLEAN
)(This
== &gUndiComponentName
)
240 Retrieves a Unicode string that is the user readable name of the controller
241 that is being managed by a driver.
243 This function retrieves the user readable name of the controller specified by
244 ControllerHandle and ChildHandle in the form of a Unicode string. If the
245 driver specified by This has a user readable name in the language specified by
246 Language, then a pointer to the controller name is returned in ControllerName,
247 and EFI_SUCCESS is returned. If the driver specified by This is not currently
248 managing the controller specified by ControllerHandle and ChildHandle,
249 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
250 support the language specified by Language, then EFI_UNSUPPORTED is returned.
251 Currently not implemented.
253 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
254 EFI_COMPONENT_NAME_PROTOCOL instance.
256 @param ControllerHandle[in] The handle of a controller that the driver
257 specified by This is managing. This handle
258 specifies the controller whose name is to be
261 @param ChildHandle[in] The handle of the child controller to retrieve
262 the name of. This is an optional parameter that
263 may be NULL. It will be NULL for device
264 drivers. It will also be NULL for a bus drivers
265 that wish to retrieve the name of the bus
266 controller. It will not be NULL for a bus
267 driver that wishes to retrieve the name of a
270 @param Language[in] A pointer to a Null-terminated ASCII string
271 array indicating the language. This is the
272 language of the driver name that the caller is
273 requesting, and it must match one of the
274 languages specified in SupportedLanguages. The
275 number of languages supported by a driver is up
276 to the driver writer. Language is specified in
277 RFC 4646 or ISO 639-2 language code format.
279 @param ControllerName[out] A pointer to the Unicode string to return.
280 This Unicode string is the name of the
281 controller specified by ControllerHandle and
282 ChildHandle in the language specified by
283 Language from the point of view of the driver
286 @retval EFI_SUCCESS The Unicode string for the user readable name in
287 the language specified by Language for the
288 driver specified by This was returned in
291 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
293 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
296 @retval EFI_INVALID_PARAMETER Language is NULL.
298 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
300 @retval EFI_UNSUPPORTED The driver specified by This is not currently
301 managing the controller specified by
302 ControllerHandle and ChildHandle.
304 @retval EFI_UNSUPPORTED The driver specified by This does not support
305 the language specified by Language.
310 UndiComponentNameGetControllerName (
311 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
312 IN EFI_HANDLE ControllerHandle
,
313 IN EFI_HANDLE ChildHandle OPTIONAL
,
315 OUT CHAR16
**ControllerName
319 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*Nii
;
321 if (ChildHandle
!= NULL
) {
322 return EFI_UNSUPPORTED
;
326 // Make sure this driver is currently managing ControllHandle
328 Status
= EfiTestManagedDevice (
330 gUndiDriverBinding
.DriverBindingHandle
,
331 &gEfiPciIoProtocolGuid
333 if (EFI_ERROR (Status
)) {
338 // Retrieve an instance of a produced protocol from ControllerHandle
340 Status
= gBS
->OpenProtocol (
342 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
346 EFI_OPEN_PROTOCOL_GET_PROTOCOL
348 if (EFI_ERROR (Status
)) {
352 return LookupUnicodeString2 (
354 This
->SupportedLanguages
,
355 mUndiControllerNameTable
,
357 (BOOLEAN
)(This
== &gUndiComponentName
)