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
,
30 /// The name of the driver in all the languages we support.
31 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mOpalDriverNameTable
[] = {
32 { LANGUAGE_RFC_3066_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
33 { LANGUAGE_ISO_639_2_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
38 Retrieves a Unicode string that is the user readable name of the driver.
40 This function retrieves the user readable name of a driver in the form of a
41 Unicode string. If the driver specified by This has a user readable name in
42 the language specified by Language, then a pointer to the driver name is
43 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
44 by This does not support the language specified by Language,
45 then EFI_UNSUPPORTED is returned.
47 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
48 EFI_COMPONENT_NAME_PROTOCOL instance.
50 @param Language[in] A pointer to a Null-terminated ASCII string
51 array indicating the language. This is the
52 language of the driver name that the caller is
53 requesting, and it must match one of the
54 languages specified in SupportedLanguages. The
55 number of languages supported by a driver is up
56 to the driver writer. Language is specified
57 in RFC 4646 or ISO 639-2 language code format.
59 @param DriverName[out] A pointer to the Unicode string to return.
60 This Unicode string is the name of the
61 driver specified by This in the language
62 specified by Language.
64 @retval EFI_SUCCESS The Unicode string for the Driver specified by
65 This and the language specified by Language was
66 returned in DriverName.
68 @retval EFI_INVALID_PARAMETER Language is NULL.
70 @retval EFI_INVALID_PARAMETER DriverName is NULL.
72 @retval EFI_UNSUPPORTED The driver specified by This does not support
73 the language specified by Language.
78 OpalEfiDriverComponentNameGetDriverName(
79 EFI_COMPONENT_NAME_PROTOCOL
* This
,
84 return LookupUnicodeString2(
86 This
->SupportedLanguages
,
94 Retrieves a Unicode string that is the user readable name of the driver.
96 This function retrieves the user readable name of a driver in the form of a
97 Unicode string. If the driver specified by This has a user readable name in
98 the language specified by Language, then a pointer to the driver name is
99 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
100 by This does not support the language specified by Language,
101 then EFI_UNSUPPORTED is returned.
103 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
104 EFI_COMPONENT_NAME_PROTOCOL instance.
106 @param Language[in] A pointer to a Null-terminated ASCII string
107 array indicating the language. This is the
108 language of the driver name that the caller is
109 requesting, and it must match one of the
110 languages specified in SupportedLanguages. The
111 number of languages supported by a driver is up
112 to the driver writer. Language is specified
113 in RFC 4646 or ISO 639-2 language code format.
115 @param DriverName[out] A pointer to the Unicode string to return.
116 This Unicode string is the name of the
117 driver specified by This in the language
118 specified by Language.
120 @retval EFI_SUCCESS The Unicode string for the Driver specified by
121 This and the language specified by Language was
122 returned in DriverName.
124 @retval EFI_INVALID_PARAMETER Language is NULL.
126 @retval EFI_INVALID_PARAMETER DriverName is NULL.
128 @retval EFI_UNSUPPORTED The driver specified by This does not support
129 the language specified by Language.
134 OpalEfiDriverComponentName2GetDriverName(
135 EFI_COMPONENT_NAME2_PROTOCOL
* This
,
140 return LookupUnicodeString2(
142 This
->SupportedLanguages
,
143 mOpalDriverNameTable
,
150 Retrieves a Unicode string that is the user readable name of the controller
151 that is being managed by a driver.
153 This function retrieves the user readable name of the controller specified by
154 ControllerHandle and ChildHandle in the form of a Unicode string. If the
155 driver specified by This has a user readable name in the language specified by
156 Language, then a pointer to the controller name is returned in ControllerName,
157 and EFI_SUCCESS is returned. If the driver specified by This is not currently
158 managing the controller specified by ControllerHandle and ChildHandle,
159 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
160 support the language specified by Language, then EFI_UNSUPPORTED is returned.
162 @param ControllerHandle[in] The handle of a controller that the driver
163 specified by This is managing. This handle
164 specifies the controller whose name is to be
167 @param ChildHandle[in] The handle of the child controller to retrieve
168 the name of. This is an optional parameter that
169 may be NULL. It will be NULL for device
170 drivers. It will also be NULL for a bus drivers
171 that wish to retrieve the name of the bus
172 controller. It will not be NULL for a bus
173 driver that wishes to retrieve the name of a
177 @param Language[in] A pointer to a Null-terminated ASCII string
178 array indicating the language. This is the
179 language of the driver name that the caller is
180 requesting, and it must match one of the
181 languages specified in SupportedLanguages. The
182 number of languages supported by a driver is up
183 to the driver writer. Language is specified in
184 RFC 4646 or ISO 639-2 language code format.
186 @param ControllerName[out] A pointer to the Unicode string to return.
187 This Unicode string is the name of the
188 controller specified by ControllerHandle and
189 ChildHandle in the language specified by
190 Language from the point of view of the driver
193 @retval EFI_SUCCESS The Unicode string for the user readable name in
194 the language specified by Language for the
195 driver specified by This was returned in
198 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
200 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
203 @retval EFI_INVALID_PARAMETER Language is NULL.
205 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
207 @retval EFI_UNSUPPORTED The driver specified by This is not currently
208 managing the controller specified by
209 ControllerHandle and ChildHandle.
211 @retval EFI_UNSUPPORTED The driver specified by This does not support
212 the language specified by Language.
217 EFI_HANDLE ControllerHandle
,
218 EFI_HANDLE ChildHandle
,
220 CHAR16
** ControllerName
223 if (Language
== NULL
|| ControllerName
== NULL
|| ControllerHandle
== NULL
) {
224 return EFI_INVALID_PARAMETER
;
227 // don't support any controller or children names
228 return EFI_UNSUPPORTED
;
232 Retrieves a Unicode string that is the user readable name of the controller
233 that is being managed by a driver.
235 This function retrieves the user readable name of the controller specified by
236 ControllerHandle and ChildHandle in the form of a Unicode string. If the
237 driver specified by This has a user readable name in the language specified by
238 Language, then a pointer to the controller name is returned in ControllerName,
239 and EFI_SUCCESS is returned. If the driver specified by This is not currently
240 managing the controller specified by ControllerHandle and ChildHandle,
241 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
242 support the language specified by Language, then EFI_UNSUPPORTED is returned.
244 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
245 EFI_COMPONENT_NAME_PROTOCOL instance.
247 @param ControllerHandle[in] The handle of a controller that the driver
248 specified by This is managing. This handle
249 specifies the controller whose name is to be
252 @param ChildHandle[in] The handle of the child controller to retrieve
253 the name of. This is an optional parameter that
254 may be NULL. It will be NULL for device
255 drivers. It will also be NULL for a bus drivers
256 that wish to retrieve the name of the bus
257 controller. It will not be NULL for a bus
258 driver that wishes to retrieve the name of a
261 @param Language[in] A pointer to a Null-terminated ASCII string
262 array indicating the language. This is the
263 language of the driver name that the caller is
264 requesting, and it must match one of the
265 languages specified in SupportedLanguages. The
266 number of languages supported by a driver is up
267 to the driver writer. Language is specified in
268 RFC 4646 or ISO 639-2 language code format.
270 @param ControllerName[out] A pointer to the Unicode string to return.
271 This Unicode string is the name of the
272 controller specified by ControllerHandle and
273 ChildHandle in the language specified by
274 Language from the point of view of the driver
277 @retval EFI_SUCCESS The Unicode string for the user readable name in
278 the language specified by Language for the
279 driver specified by This was returned in
282 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
284 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
287 @retval EFI_INVALID_PARAMETER Language is NULL.
289 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
291 @retval EFI_UNSUPPORTED The driver specified by This is not currently
292 managing the controller specified by
293 ControllerHandle and ChildHandle.
295 @retval EFI_UNSUPPORTED The driver specified by This does not support
296 the language specified by Language.
301 OpalEfiDriverComponentNameGetControllerName(
302 EFI_COMPONENT_NAME_PROTOCOL
* This
,
303 EFI_HANDLE ControllerHandle
,
304 EFI_HANDLE ChildHandle
,
306 CHAR16
** ControllerName
309 return (GetControllerName( ControllerHandle
, ChildHandle
, Language
, ControllerName
));
313 Retrieves a Unicode string that is the user readable name of the controller
314 that is being managed by a driver.
316 This function retrieves the user readable name of the controller specified by
317 ControllerHandle and ChildHandle in the form of a Unicode string. If the
318 driver specified by This has a user readable name in the language specified by
319 Language, then a pointer to the controller name is returned in ControllerName,
320 and EFI_SUCCESS is returned. If the driver specified by This is not currently
321 managing the controller specified by ControllerHandle and ChildHandle,
322 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
323 support the language specified by Language, then EFI_UNSUPPORTED is returned.
325 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
326 EFI_COMPONENT_NAME_PROTOCOL instance.
328 @param ControllerHandle[in] The handle of a controller that the driver
329 specified by This is managing. This handle
330 specifies the controller whose name is to be
333 @param ChildHandle[in] The handle of the child controller to retrieve
334 the name of. This is an optional parameter that
335 may be NULL. It will be NULL for device
336 drivers. It will also be NULL for a bus drivers
337 that wish to retrieve the name of the bus
338 controller. It will not be NULL for a bus
339 driver that wishes to retrieve the name of a
342 @param Language[in] A pointer to a Null-terminated ASCII string
343 array indicating the language. This is the
344 language of the driver name that the caller is
345 requesting, and it must match one of the
346 languages specified in SupportedLanguages. The
347 number of languages supported by a driver is up
348 to the driver writer. Language is specified in
349 RFC 4646 or ISO 639-2 language code format.
351 @param ControllerName[out] A pointer to the Unicode string to return.
352 This Unicode string is the name of the
353 controller specified by ControllerHandle and
354 ChildHandle in the language specified by
355 Language from the point of view of the driver
358 @retval EFI_SUCCESS The Unicode string for the user readable name in
359 the language specified by Language for the
360 driver specified by This was returned in
363 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
365 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
368 @retval EFI_INVALID_PARAMETER Language is NULL.
370 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
372 @retval EFI_UNSUPPORTED The driver specified by This is not currently
373 managing the controller specified by
374 ControllerHandle and ChildHandle.
376 @retval EFI_UNSUPPORTED The driver specified by This does not support
377 the language specified by Language.
382 OpalEfiDriverComponentName2GetControllerName(
383 EFI_COMPONENT_NAME2_PROTOCOL
* This
,
384 EFI_HANDLE ControllerHandle
,
385 EFI_HANDLE ChildHandle
,
387 CHAR16
** ControllerName
390 return (GetControllerName(ControllerHandle
, ChildHandle
, Language
, ControllerName
));