2 UEFI Component Name(2) protocol implementation for Opal driver.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which 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.
15 #include "OpalDriver.h"
18 // EFI Component Name Protocol
20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gOpalComponentName
= {
21 OpalEfiDriverComponentNameGetDriverName
,
22 OpalEfiDriverComponentNameGetControllerName
,
27 // EFI Component Name 2 Protocol
29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gOpalComponentName2
= {
30 OpalEfiDriverComponentName2GetDriverName
,
31 OpalEfiDriverComponentName2GetControllerName
,
36 /// The name of the driver in all the languages we support.
37 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mOpalDriverNameTable
[] = {
38 { LANGUAGE_RFC_3066_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
39 { LANGUAGE_ISO_639_2_ENGLISH
, (CHAR16
*)EFI_DRIVER_NAME_UNICODE
},
44 Retrieves a Unicode string that is the user readable name of the driver.
46 This function retrieves the user readable name of a driver in the form of a
47 Unicode string. If the driver specified by This has a user readable name in
48 the language specified by Language, then a pointer to the driver name is
49 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
50 by This does not support the language specified by Language,
51 then EFI_UNSUPPORTED is returned.
53 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
54 EFI_COMPONENT_NAME_PROTOCOL instance.
56 @param Language[in] A pointer to a Null-terminated ASCII string
57 array indicating the language. This is the
58 language of the driver name that the caller is
59 requesting, and it must match one of the
60 languages specified in SupportedLanguages. The
61 number of languages supported by a driver is up
62 to the driver writer. Language is specified
63 in RFC 4646 or ISO 639-2 language code format.
65 @param DriverName[out] A pointer to the Unicode string to return.
66 This Unicode string is the name of the
67 driver specified by This in the language
68 specified by Language.
70 @retval EFI_SUCCESS The Unicode string for the Driver specified by
71 This and the language specified by Language was
72 returned in DriverName.
74 @retval EFI_INVALID_PARAMETER Language is NULL.
76 @retval EFI_INVALID_PARAMETER DriverName is NULL.
78 @retval EFI_UNSUPPORTED The driver specified by This does not support
79 the language specified by Language.
84 OpalEfiDriverComponentNameGetDriverName(
85 EFI_COMPONENT_NAME_PROTOCOL
* This
,
90 return LookupUnicodeString2(
92 This
->SupportedLanguages
,
100 Retrieves a Unicode string that is the user readable name of the driver.
102 This function retrieves the user readable name of a driver in the form of a
103 Unicode string. If the driver specified by This has a user readable name in
104 the language specified by Language, then a pointer to the driver name is
105 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
106 by This does not support the language specified by Language,
107 then EFI_UNSUPPORTED is returned.
109 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
110 EFI_COMPONENT_NAME_PROTOCOL instance.
112 @param Language[in] A pointer to a Null-terminated ASCII string
113 array indicating the language. This is the
114 language of the driver name that the caller is
115 requesting, and it must match one of the
116 languages specified in SupportedLanguages. The
117 number of languages supported by a driver is up
118 to the driver writer. Language is specified
119 in RFC 4646 or ISO 639-2 language code format.
121 @param DriverName[out] A pointer to the Unicode string to return.
122 This Unicode string is the name of the
123 driver specified by This in the language
124 specified by Language.
126 @retval EFI_SUCCESS The Unicode string for the Driver specified by
127 This and the language specified by Language was
128 returned in DriverName.
130 @retval EFI_INVALID_PARAMETER Language is NULL.
132 @retval EFI_INVALID_PARAMETER DriverName is NULL.
134 @retval EFI_UNSUPPORTED The driver specified by This does not support
135 the language specified by Language.
140 OpalEfiDriverComponentName2GetDriverName(
141 EFI_COMPONENT_NAME2_PROTOCOL
* This
,
146 return LookupUnicodeString2(
148 This
->SupportedLanguages
,
149 mOpalDriverNameTable
,
156 Retrieves a Unicode string that is the user readable name of the controller
157 that is being managed by a driver.
159 This function retrieves the user readable name of the controller specified by
160 ControllerHandle and ChildHandle in the form of a Unicode string. If the
161 driver specified by This has a user readable name in the language specified by
162 Language, then a pointer to the controller name is returned in ControllerName,
163 and EFI_SUCCESS is returned. If the driver specified by This is not currently
164 managing the controller specified by ControllerHandle and ChildHandle,
165 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
166 support the language specified by Language, then EFI_UNSUPPORTED is returned.
168 @param ControllerHandle[in] The handle of a controller that the driver
169 specified by This is managing. This handle
170 specifies the controller whose name is to be
173 @param ChildHandle[in] The handle of the child controller to retrieve
174 the name of. This is an optional parameter that
175 may be NULL. It will be NULL for device
176 drivers. It will also be NULL for a bus drivers
177 that wish to retrieve the name of the bus
178 controller. It will not be NULL for a bus
179 driver that wishes to retrieve the name of a
183 @param Language[in] A pointer to a Null-terminated ASCII string
184 array indicating the language. This is the
185 language of the driver name that the caller is
186 requesting, and it must match one of the
187 languages specified in SupportedLanguages. The
188 number of languages supported by a driver is up
189 to the driver writer. Language is specified in
190 RFC 4646 or ISO 639-2 language code format.
192 @param ControllerName[out] A pointer to the Unicode string to return.
193 This Unicode string is the name of the
194 controller specified by ControllerHandle and
195 ChildHandle in the language specified by
196 Language from the point of view of the driver
199 @retval EFI_SUCCESS The Unicode string for the user readable name in
200 the language specified by Language for the
201 driver specified by This was returned in
204 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
206 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
209 @retval EFI_INVALID_PARAMETER Language is NULL.
211 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
213 @retval EFI_UNSUPPORTED The driver specified by This is not currently
214 managing the controller specified by
215 ControllerHandle and ChildHandle.
217 @retval EFI_UNSUPPORTED The driver specified by This does not support
218 the language specified by Language.
223 EFI_HANDLE ControllerHandle
,
224 EFI_HANDLE ChildHandle
,
226 CHAR16
** ControllerName
229 if (Language
== NULL
|| ControllerName
== NULL
|| ControllerHandle
== NULL
) {
230 return EFI_INVALID_PARAMETER
;
233 // don't support any controller or children names
234 return EFI_UNSUPPORTED
;
238 Retrieves a Unicode string that is the user readable name of the controller
239 that is being managed by a driver.
241 This function retrieves the user readable name of the controller specified by
242 ControllerHandle and ChildHandle in the form of a Unicode string. If the
243 driver specified by This has a user readable name in the language specified by
244 Language, then a pointer to the controller name is returned in ControllerName,
245 and EFI_SUCCESS is returned. If the driver specified by This is not currently
246 managing the controller specified by ControllerHandle and ChildHandle,
247 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
248 support the language specified by Language, then EFI_UNSUPPORTED is returned.
250 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
251 EFI_COMPONENT_NAME_PROTOCOL instance.
253 @param ControllerHandle[in] The handle of a controller that the driver
254 specified by This is managing. This handle
255 specifies the controller whose name is to be
258 @param ChildHandle[in] The handle of the child controller to retrieve
259 the name of. This is an optional parameter that
260 may be NULL. It will be NULL for device
261 drivers. It will also be NULL for a bus drivers
262 that wish to retrieve the name of the bus
263 controller. It will not be NULL for a bus
264 driver that wishes to retrieve the name of a
267 @param Language[in] A pointer to a Null-terminated ASCII string
268 array indicating the language. This is the
269 language of the driver name that the caller is
270 requesting, and it must match one of the
271 languages specified in SupportedLanguages. The
272 number of languages supported by a driver is up
273 to the driver writer. Language is specified in
274 RFC 4646 or ISO 639-2 language code format.
276 @param ControllerName[out] A pointer to the Unicode string to return.
277 This Unicode string is the name of the
278 controller specified by ControllerHandle and
279 ChildHandle in the language specified by
280 Language from the point of view of the driver
283 @retval EFI_SUCCESS The Unicode string for the user readable name in
284 the language specified by Language for the
285 driver specified by This was returned in
288 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
290 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
293 @retval EFI_INVALID_PARAMETER Language is NULL.
295 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
297 @retval EFI_UNSUPPORTED The driver specified by This is not currently
298 managing the controller specified by
299 ControllerHandle and ChildHandle.
301 @retval EFI_UNSUPPORTED The driver specified by This does not support
302 the language specified by Language.
307 OpalEfiDriverComponentNameGetControllerName(
308 EFI_COMPONENT_NAME_PROTOCOL
* This
,
309 EFI_HANDLE ControllerHandle
,
310 EFI_HANDLE ChildHandle
,
312 CHAR16
** ControllerName
315 return (GetControllerName( ControllerHandle
, ChildHandle
, Language
, ControllerName
));
319 Retrieves a Unicode string that is the user readable name of the controller
320 that is being managed by a driver.
322 This function retrieves the user readable name of the controller specified by
323 ControllerHandle and ChildHandle in the form of a Unicode string. If the
324 driver specified by This has a user readable name in the language specified by
325 Language, then a pointer to the controller name is returned in ControllerName,
326 and EFI_SUCCESS is returned. If the driver specified by This is not currently
327 managing the controller specified by ControllerHandle and ChildHandle,
328 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
329 support the language specified by Language, then EFI_UNSUPPORTED is returned.
331 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
332 EFI_COMPONENT_NAME_PROTOCOL instance.
334 @param ControllerHandle[in] The handle of a controller that the driver
335 specified by This is managing. This handle
336 specifies the controller whose name is to be
339 @param ChildHandle[in] The handle of the child controller to retrieve
340 the name of. This is an optional parameter that
341 may be NULL. It will be NULL for device
342 drivers. It will also be NULL for a bus drivers
343 that wish to retrieve the name of the bus
344 controller. It will not be NULL for a bus
345 driver that wishes to retrieve the name of a
348 @param Language[in] A pointer to a Null-terminated ASCII string
349 array indicating the language. This is the
350 language of the driver name that the caller is
351 requesting, and it must match one of the
352 languages specified in SupportedLanguages. The
353 number of languages supported by a driver is up
354 to the driver writer. Language is specified in
355 RFC 4646 or ISO 639-2 language code format.
357 @param ControllerName[out] A pointer to the Unicode string to return.
358 This Unicode string is the name of the
359 controller specified by ControllerHandle and
360 ChildHandle in the language specified by
361 Language from the point of view of the driver
364 @retval EFI_SUCCESS The Unicode string for the user readable name in
365 the language specified by Language for the
366 driver specified by This was returned in
369 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
371 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
374 @retval EFI_INVALID_PARAMETER Language is NULL.
376 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
378 @retval EFI_UNSUPPORTED The driver specified by This is not currently
379 managing the controller specified by
380 ControllerHandle and ChildHandle.
382 @retval EFI_UNSUPPORTED The driver specified by This does not support
383 the language specified by Language.
388 OpalEfiDriverComponentName2GetControllerName(
389 EFI_COMPONENT_NAME2_PROTOCOL
* This
,
390 EFI_HANDLE ControllerHandle
,
391 EFI_HANDLE ChildHandle
,
393 CHAR16
** ControllerName
396 return (GetControllerName(ControllerHandle
, ChildHandle
, Language
, ControllerName
));