3 UEFI Component Name(2) protocol implementation.
5 Copyright (c) 2004 - 2007, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Library/UefiLib.h>
23 // EFI Component Name Functions
26 Retrieves a Unicode string that is the user readable name of the driver.
28 This function retrieves the user readable name of a driver in the form of a
29 Unicode string. If the driver specified by This has a user readable name in
30 the language specified by Language, then a pointer to the driver name is
31 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
32 by This does not support the language specified by Language,
33 then EFI_UNSUPPORTED is returned.
35 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
36 EFI_COMPONENT_NAME_PROTOCOL instance.
38 @param Language[in] A pointer to a Null-terminated ASCII string
39 array indicating the language. This is the
40 language of the driver name that the caller is
41 requesting, and it must match one of the
42 languages specified in SupportedLanguages. The
43 number of languages supported by a driver is up
44 to the driver writer. Language is specified
45 in RFC 3066 or ISO 639-2 language code format.
47 @param DriverName[out] A pointer to the Unicode string to return.
48 This Unicode string is the name of the
49 driver specified by This in the language
50 specified by Language.
52 @retval EFI_SUCCESS The Unicode string for the Driver specified by
53 This and the language specified by Language was
54 returned in DriverName.
56 @retval EFI_INVALID_PARAMETER Language is NULL.
58 @retval EFI_INVALID_PARAMETER DriverName is NULL.
60 @retval EFI_UNSUPPORTED The driver specified by This does not support
61 the language specified by Language.
66 UsbMassStorageGetDriverName (
67 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
69 OUT CHAR16
**DriverName
74 Retrieves a Unicode string that is the user readable name of the controller
75 that is being managed by a driver.
77 This function retrieves the user readable name of the controller specified by
78 ControllerHandle and ChildHandle in the form of a Unicode string. If the
79 driver specified by This has a user readable name in the language specified by
80 Language, then a pointer to the controller name is returned in ControllerName,
81 and EFI_SUCCESS is returned. If the driver specified by This is not currently
82 managing the controller specified by ControllerHandle and ChildHandle,
83 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
84 support the language specified by Language, then EFI_UNSUPPORTED is returned.
86 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
87 EFI_COMPONENT_NAME_PROTOCOL instance.
89 @param ControllerHandle[in] The handle of a controller that the driver
90 specified by This is managing. This handle
91 specifies the controller whose name is to be
94 @param ChildHandle[in] The handle of the child controller to retrieve
95 the name of. This is an optional parameter that
96 may be NULL. It will be NULL for device
97 drivers. It will also be NULL for a bus drivers
98 that wish to retrieve the name of the bus
99 controller. It will not be NULL for a bus
100 driver that wishes to retrieve the name of a
103 @param Language[in] A pointer to a Null-terminated ASCII string
104 array indicating the language. This is the
105 language of the driver name that the caller is
106 requesting, and it must match one of the
107 languages specified in SupportedLanguages. The
108 number of languages supported by a driver is up
109 to the driver writer. Language is specified in
110 RFC 3066 or ISO 639-2 language code format.
112 @param ControllerName[out] A pointer to the Unicode string to return.
113 This Unicode string is the name of the
114 controller specified by ControllerHandle and
115 ChildHandle in the language specified by
116 Language from the point of view of the driver
119 @retval EFI_SUCCESS The Unicode string for the user readable name in
120 the language specified by Language for the
121 driver specified by This was returned in
124 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
126 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
129 @retval EFI_INVALID_PARAMETER Language is NULL.
131 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
133 @retval EFI_UNSUPPORTED The driver specified by This is not currently
134 managing the controller specified by
135 ControllerHandle and ChildHandle.
137 @retval EFI_UNSUPPORTED The driver specified by This does not support
138 the language specified by Language.
143 UsbMassStorageGetControllerName (
144 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
145 IN EFI_HANDLE ControllerHandle
,
146 IN EFI_HANDLE ChildHandle OPTIONAL
,
148 OUT CHAR16
**ControllerName
153 // EFI Component Name Protocol
155 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName
= {
156 UsbMassStorageGetDriverName
,
157 UsbMassStorageGetControllerName
,
162 // EFI Component Name 2 Protocol
164 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbMassStorageComponentName2
= {
165 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) UsbMassStorageGetDriverName
,
166 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) UsbMassStorageGetControllerName
,
171 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
172 mUsbMassStorageDriverNameTable
[] = {
173 {"eng;en", L
"Usb Mass Storage Driver"},
178 Retrieves a Unicode string that is the user readable name of the driver.
180 This function retrieves the user readable name of a driver in the form of a
181 Unicode string. If the driver specified by This has a user readable name in
182 the language specified by Language, then a pointer to the driver name is
183 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
184 by This does not support the language specified by Language,
185 then EFI_UNSUPPORTED is returned.
187 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
188 EFI_COMPONENT_NAME_PROTOCOL instance.
190 @param Language[in] A pointer to a Null-terminated ASCII string
191 array indicating the language. This is the
192 language of the driver name that the caller is
193 requesting, and it must match one of the
194 languages specified in SupportedLanguages. The
195 number of languages supported by a driver is up
196 to the driver writer. Language is specified
197 in RFC 3066 or ISO 639-2 language code format.
199 @param DriverName[out] A pointer to the Unicode string to return.
200 This Unicode string is the name of the
201 driver specified by This in the language
202 specified by Language.
204 @retval EFI_SUCCESS The Unicode string for the Driver specified by
205 This and the language specified by Language was
206 returned in DriverName.
208 @retval EFI_INVALID_PARAMETER Language is NULL.
210 @retval EFI_INVALID_PARAMETER DriverName is NULL.
212 @retval EFI_UNSUPPORTED The driver specified by This does not support
213 the language specified by Language.
218 UsbMassStorageGetDriverName (
219 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
221 OUT CHAR16
**DriverName
224 return LookupUnicodeString2 (
226 This
->SupportedLanguages
,
227 mUsbMassStorageDriverNameTable
,
229 (BOOLEAN
)(This
== &gUsbMassStorageComponentName
)
234 Retrieves a Unicode string that is the user readable name of the controller
235 that is being managed by a driver.
237 This function retrieves the user readable name of the controller specified by
238 ControllerHandle and ChildHandle in the form of a Unicode string. If the
239 driver specified by This has a user readable name in the language specified by
240 Language, then a pointer to the controller name is returned in ControllerName,
241 and EFI_SUCCESS is returned. If the driver specified by This is not currently
242 managing the controller specified by ControllerHandle and ChildHandle,
243 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
244 support the language specified by Language, then EFI_UNSUPPORTED is returned.
246 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
247 EFI_COMPONENT_NAME_PROTOCOL instance.
249 @param ControllerHandle[in] The handle of a controller that the driver
250 specified by This is managing. This handle
251 specifies the controller whose name is to be
254 @param ChildHandle[in] The handle of the child controller to retrieve
255 the name of. This is an optional parameter that
256 may be NULL. It will be NULL for device
257 drivers. It will also be NULL for a bus drivers
258 that wish to retrieve the name of the bus
259 controller. It will not be NULL for a bus
260 driver that wishes to retrieve the name of a
263 @param Language[in] A pointer to a Null-terminated ASCII string
264 array indicating the language. This is the
265 language of the driver name that the caller is
266 requesting, and it must match one of the
267 languages specified in SupportedLanguages. The
268 number of languages supported by a driver is up
269 to the driver writer. Language is specified in
270 RFC 3066 or ISO 639-2 language code format.
272 @param ControllerName[out] A pointer to the Unicode string to return.
273 This Unicode string is the name of the
274 controller specified by ControllerHandle and
275 ChildHandle in the language specified by
276 Language from the point of view of the driver
279 @retval EFI_SUCCESS The Unicode string for the user readable name in
280 the language specified by Language for the
281 driver specified by This was returned in
284 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
286 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
289 @retval EFI_INVALID_PARAMETER Language is NULL.
291 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
293 @retval EFI_UNSUPPORTED The driver specified by This is not currently
294 managing the controller specified by
295 ControllerHandle and ChildHandle.
297 @retval EFI_UNSUPPORTED The driver specified by This does not support
298 the language specified by Language.
303 UsbMassStorageGetControllerName (
304 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
305 IN EFI_HANDLE ControllerHandle
,
306 IN EFI_HANDLE ChildHandle OPTIONAL
,
308 OUT CHAR16
**ControllerName
311 return EFI_UNSUPPORTED
;