2 UEFI Component Name(2) protocol implementation for Opal driver.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "OpalDriver.h"
12 // EFI Component Name Protocol
14 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gOpalComponentName
= {
15 OpalEfiDriverComponentNameGetDriverName
,
16 OpalEfiDriverComponentNameGetControllerName
,
21 // EFI Component Name 2 Protocol
23 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gOpalComponentName2
= {
24 OpalEfiDriverComponentName2GetDriverName
,
25 OpalEfiDriverComponentName2GetControllerName
,
29 /// The name of the driver in all the languages we support.
30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mOpalDriverNameTable
[] = {
31 { LANGUAGE_RFC_3066_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
32 { LANGUAGE_ISO_639_2_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
37 Retrieves a Unicode string that is the user readable name of the driver.
39 This function retrieves the user readable name of a driver in the form of a
40 Unicode string. If the driver specified by This has a user readable name in
41 the language specified by Language, then a pointer to the driver name is
42 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
43 by This does not support the language specified by Language,
44 then EFI_UNSUPPORTED is returned.
46 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
47 EFI_COMPONENT_NAME_PROTOCOL instance.
49 @param Language[in] A pointer to a Null-terminated ASCII string
50 array indicating the language. This is the
51 language of the driver name that the caller is
52 requesting, and it must match one of the
53 languages specified in SupportedLanguages. The
54 number of languages supported by a driver is up
55 to the driver writer. Language is specified
56 in RFC 4646 or ISO 639-2 language code format.
58 @param DriverName[out] A pointer to the Unicode string to return.
59 This Unicode string is the name of the
60 driver specified by This in the language
61 specified by Language.
63 @retval EFI_SUCCESS The Unicode string for the Driver specified by
64 This and the language specified by Language was
65 returned in DriverName.
67 @retval EFI_INVALID_PARAMETER Language is NULL.
69 @retval EFI_INVALID_PARAMETER DriverName is NULL.
71 @retval EFI_UNSUPPORTED The driver specified by This does not support
72 the language specified by Language.
77 OpalEfiDriverComponentNameGetDriverName (
78 EFI_COMPONENT_NAME_PROTOCOL
*This
,
83 return LookupUnicodeString2 (
85 This
->SupportedLanguages
,
93 Retrieves a Unicode string that is the user readable name of the driver.
95 This function retrieves the user readable name of a driver in the form of a
96 Unicode string. If the driver specified by This has a user readable name in
97 the language specified by Language, then a pointer to the driver name is
98 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
99 by This does not support the language specified by Language,
100 then EFI_UNSUPPORTED is returned.
102 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
103 EFI_COMPONENT_NAME_PROTOCOL instance.
105 @param Language[in] A pointer to a Null-terminated ASCII string
106 array indicating the language. This is the
107 language of the driver name that the caller is
108 requesting, and it must match one of the
109 languages specified in SupportedLanguages. The
110 number of languages supported by a driver is up
111 to the driver writer. Language is specified
112 in RFC 4646 or ISO 639-2 language code format.
114 @param DriverName[out] A pointer to the Unicode string to return.
115 This Unicode string is the name of the
116 driver specified by This in the language
117 specified by Language.
119 @retval EFI_SUCCESS The Unicode string for the Driver specified by
120 This and the language specified by Language was
121 returned in DriverName.
123 @retval EFI_INVALID_PARAMETER Language is NULL.
125 @retval EFI_INVALID_PARAMETER DriverName is NULL.
127 @retval EFI_UNSUPPORTED The driver specified by This does not support
128 the language specified by Language.
133 OpalEfiDriverComponentName2GetDriverName (
134 EFI_COMPONENT_NAME2_PROTOCOL
*This
,
139 return LookupUnicodeString2 (
141 This
->SupportedLanguages
,
142 mOpalDriverNameTable
,
149 Retrieves a Unicode string that is the user readable name of the controller
150 that is being managed by a driver.
152 This function retrieves the user readable name of the controller specified by
153 ControllerHandle and ChildHandle in the form of a Unicode string. If the
154 driver specified by This has a user readable name in the language specified by
155 Language, then a pointer to the controller name is returned in ControllerName,
156 and EFI_SUCCESS is returned. If the driver specified by This is not currently
157 managing the controller specified by ControllerHandle and ChildHandle,
158 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
159 support the language specified by Language, then EFI_UNSUPPORTED is returned.
161 @param ControllerHandle[in] The handle of a controller that the driver
162 specified by This is managing. This handle
163 specifies the controller whose name is to be
166 @param ChildHandle[in] The handle of the child controller to retrieve
167 the name of. This is an optional parameter that
168 may be NULL. It will be NULL for device
169 drivers. It will also be NULL for a bus drivers
170 that wish to retrieve the name of the bus
171 controller. It will not be NULL for a bus
172 driver that wishes to retrieve the name of a
176 @param Language[in] A pointer to a Null-terminated ASCII string
177 array indicating the language. This is the
178 language of the driver name that the caller is
179 requesting, and it must match one of the
180 languages specified in SupportedLanguages. The
181 number of languages supported by a driver is up
182 to the driver writer. Language is specified in
183 RFC 4646 or ISO 639-2 language code format.
185 @param ControllerName[out] A pointer to the Unicode string to return.
186 This Unicode string is the name of the
187 controller specified by ControllerHandle and
188 ChildHandle in the language specified by
189 Language from the point of view of the driver
192 @retval EFI_SUCCESS The Unicode string for the user readable name in
193 the language specified by Language for the
194 driver specified by This was returned in
197 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
199 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
202 @retval EFI_INVALID_PARAMETER Language is NULL.
204 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
206 @retval EFI_UNSUPPORTED The driver specified by This is not currently
207 managing the controller specified by
208 ControllerHandle and ChildHandle.
210 @retval EFI_UNSUPPORTED The driver specified by This does not support
211 the language specified by Language.
216 EFI_HANDLE ControllerHandle
,
217 EFI_HANDLE ChildHandle
,
219 CHAR16
**ControllerName
222 if ((Language
== NULL
) || (ControllerName
== NULL
) || (ControllerHandle
== NULL
)) {
223 return EFI_INVALID_PARAMETER
;
226 // don't support any controller or children names
227 return EFI_UNSUPPORTED
;
231 Retrieves a Unicode string that is the user readable name of the controller
232 that is being managed by a driver.
234 This function retrieves the user readable name of the controller specified by
235 ControllerHandle and ChildHandle in the form of a Unicode string. If the
236 driver specified by This has a user readable name in the language specified by
237 Language, then a pointer to the controller name is returned in ControllerName,
238 and EFI_SUCCESS is returned. If the driver specified by This is not currently
239 managing the controller specified by ControllerHandle and ChildHandle,
240 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
241 support the language specified by Language, then EFI_UNSUPPORTED is returned.
243 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
244 EFI_COMPONENT_NAME_PROTOCOL instance.
246 @param ControllerHandle[in] The handle of a controller that the driver
247 specified by This is managing. This handle
248 specifies the controller whose name is to be
251 @param ChildHandle[in] The handle of the child controller to retrieve
252 the name of. This is an optional parameter that
253 may be NULL. It will be NULL for device
254 drivers. It will also be NULL for a bus drivers
255 that wish to retrieve the name of the bus
256 controller. It will not be NULL for a bus
257 driver that wishes to retrieve the name of a
260 @param Language[in] A pointer to a Null-terminated ASCII string
261 array indicating the language. This is the
262 language of the driver name that the caller is
263 requesting, and it must match one of the
264 languages specified in SupportedLanguages. The
265 number of languages supported by a driver is up
266 to the driver writer. Language is specified in
267 RFC 4646 or ISO 639-2 language code format.
269 @param ControllerName[out] A pointer to the Unicode string to return.
270 This Unicode string is the name of the
271 controller specified by ControllerHandle and
272 ChildHandle in the language specified by
273 Language from the point of view of the driver
276 @retval EFI_SUCCESS The Unicode string for the user readable name in
277 the language specified by Language for the
278 driver specified by This was returned in
281 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
283 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
286 @retval EFI_INVALID_PARAMETER Language is NULL.
288 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
290 @retval EFI_UNSUPPORTED The driver specified by This is not currently
291 managing the controller specified by
292 ControllerHandle and ChildHandle.
294 @retval EFI_UNSUPPORTED The driver specified by This does not support
295 the language specified by Language.
300 OpalEfiDriverComponentNameGetControllerName (
301 EFI_COMPONENT_NAME_PROTOCOL
*This
,
302 EFI_HANDLE ControllerHandle
,
303 EFI_HANDLE ChildHandle
,
305 CHAR16
**ControllerName
308 return (GetControllerName (ControllerHandle
, ChildHandle
, Language
, ControllerName
));
312 Retrieves a Unicode string that is the user readable name of the controller
313 that is being managed by a driver.
315 This function retrieves the user readable name of the controller specified by
316 ControllerHandle and ChildHandle in the form of a Unicode string. If the
317 driver specified by This has a user readable name in the language specified by
318 Language, then a pointer to the controller name is returned in ControllerName,
319 and EFI_SUCCESS is returned. If the driver specified by This is not currently
320 managing the controller specified by ControllerHandle and ChildHandle,
321 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
322 support the language specified by Language, then EFI_UNSUPPORTED is returned.
324 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
325 EFI_COMPONENT_NAME_PROTOCOL instance.
327 @param ControllerHandle[in] The handle of a controller that the driver
328 specified by This is managing. This handle
329 specifies the controller whose name is to be
332 @param ChildHandle[in] The handle of the child controller to retrieve
333 the name of. This is an optional parameter that
334 may be NULL. It will be NULL for device
335 drivers. It will also be NULL for a bus drivers
336 that wish to retrieve the name of the bus
337 controller. It will not be NULL for a bus
338 driver that wishes to retrieve the name of a
341 @param Language[in] A pointer to a Null-terminated ASCII string
342 array indicating the language. This is the
343 language of the driver name that the caller is
344 requesting, and it must match one of the
345 languages specified in SupportedLanguages. The
346 number of languages supported by a driver is up
347 to the driver writer. Language is specified in
348 RFC 4646 or ISO 639-2 language code format.
350 @param ControllerName[out] A pointer to the Unicode string to return.
351 This Unicode string is the name of the
352 controller specified by ControllerHandle and
353 ChildHandle in the language specified by
354 Language from the point of view of the driver
357 @retval EFI_SUCCESS The Unicode string for the user readable name in
358 the language specified by Language for the
359 driver specified by This was returned in
362 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
364 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
367 @retval EFI_INVALID_PARAMETER Language is NULL.
369 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
371 @retval EFI_UNSUPPORTED The driver specified by This is not currently
372 managing the controller specified by
373 ControllerHandle and ChildHandle.
375 @retval EFI_UNSUPPORTED The driver specified by This does not support
376 the language specified by Language.
381 OpalEfiDriverComponentName2GetControllerName (
382 EFI_COMPONENT_NAME2_PROTOCOL
*This
,
383 EFI_HANDLE ControllerHandle
,
384 EFI_HANDLE ChildHandle
,
386 CHAR16
**ControllerName
389 return (GetControllerName (ControllerHandle
, ChildHandle
, Language
, ControllerName
));