3 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials are licensed and made available
5 under the terms and conditions of the BSD License which accompanies this
6 distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 // EFI Component Name Functions
21 Retrieves a Unicode string that is the user readable name of the driver.
23 This function retrieves the user readable name of a driver in the form of a
24 Unicode string. If the driver specified by This has a user readable name in
25 the language specified by Language, then a pointer to the driver name is
26 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
27 by This does not support the language specified by Language,
28 then EFI_UNSUPPORTED is returned.
30 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
31 EFI_COMPONENT_NAME_PROTOCOL instance.
33 @param Language[in] A pointer to a Null-terminated ASCII string
34 array indicating the language. This is the
35 language of the driver name that the caller is
36 requesting, and it must match one of the
37 languages specified in SupportedLanguages. The
38 number of languages supported by a driver is up
39 to the driver writer. Language is specified
40 in RFC 4646 or ISO 639-2 language code format.
42 @param DriverName[out] A pointer to the Unicode string to return.
43 This Unicode string is the name of the
44 driver specified by This in the language
45 specified by Language.
47 @retval EFI_SUCCESS The Unicode string for the Driver specified by
48 This and the language specified by Language was
49 returned in DriverName.
51 @retval EFI_INVALID_PARAMETER Language is NULL.
53 @retval EFI_INVALID_PARAMETER DriverName is NULL.
55 @retval EFI_UNSUPPORTED The driver specified by This does not support
56 the language specified by Language.
61 FatComponentNameGetDriverName (
62 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
64 OUT CHAR16
**DriverName
69 Retrieves a Unicode string that is the user readable name of the controller
70 that is being managed by a driver.
72 This function retrieves the user readable name of the controller specified by
73 ControllerHandle and ChildHandle in the form of a Unicode string. If the
74 driver specified by This has a user readable name in the language specified by
75 Language, then a pointer to the controller name is returned in ControllerName,
76 and EFI_SUCCESS is returned. If the driver specified by This is not currently
77 managing the controller specified by ControllerHandle and ChildHandle,
78 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
79 support the language specified by Language, then EFI_UNSUPPORTED is returned.
81 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
82 EFI_COMPONENT_NAME_PROTOCOL instance.
84 @param ControllerHandle[in] The handle of a controller that the driver
85 specified by This is managing. This handle
86 specifies the controller whose name is to be
89 @param ChildHandle[in] The handle of the child controller to retrieve
90 the name of. This is an optional parameter that
91 may be NULL. It will be NULL for device
92 drivers. It will also be NULL for a bus drivers
93 that wish to retrieve the name of the bus
94 controller. It will not be NULL for a bus
95 driver that wishes to retrieve the name of a
98 @param Language[in] A pointer to a Null-terminated ASCII string
99 array indicating the language. This is the
100 language of the driver name that the caller is
101 requesting, and it must match one of the
102 languages specified in SupportedLanguages. The
103 number of languages supported by a driver is up
104 to the driver writer. Language is specified in
105 RFC 4646 or ISO 639-2 language code format.
107 @param ControllerName[out] A pointer to the Unicode string to return.
108 This Unicode string is the name of the
109 controller specified by ControllerHandle and
110 ChildHandle in the language specified by
111 Language from the point of view of the driver
114 @retval EFI_SUCCESS The Unicode string for the user readable name in
115 the language specified by Language for the
116 driver specified by This was returned in
119 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
121 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
124 @retval EFI_INVALID_PARAMETER Language is NULL.
126 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
128 @retval EFI_UNSUPPORTED The driver specified by This is not currently
129 managing the controller specified by
130 ControllerHandle and ChildHandle.
132 @retval EFI_UNSUPPORTED The driver specified by This does not support
133 the language specified by Language.
138 FatComponentNameGetControllerName (
139 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
140 IN EFI_HANDLE ControllerHandle
,
141 IN EFI_HANDLE ChildHandle OPTIONAL
,
143 OUT CHAR16
**ControllerName
147 // EFI Component Name Protocol
149 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gFatComponentName
= {
150 FatComponentNameGetDriverName
,
151 FatComponentNameGetControllerName
,
156 // EFI Component Name 2 Protocol
158 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gFatComponentName2
= {
159 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) FatComponentNameGetDriverName
,
160 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) FatComponentNameGetControllerName
,
164 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatDriverNameTable
[] = {
167 L
"FAT File System Driver"
175 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatControllerNameTable
[] = {
188 Retrieves a Unicode string that is the user readable name of the driver.
190 This function retrieves the user readable name of a driver in the form of a
191 Unicode string. If the driver specified by This has a user readable name in
192 the language specified by Language, then a pointer to the driver name is
193 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
194 by This does not support the language specified by Language,
195 then EFI_UNSUPPORTED is returned.
197 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
198 EFI_COMPONENT_NAME_PROTOCOL instance.
200 @param Language[in] A pointer to a Null-terminated ASCII string
201 array indicating the language. This is the
202 language of the driver name that the caller is
203 requesting, and it must match one of the
204 languages specified in SupportedLanguages. The
205 number of languages supported by a driver is up
206 to the driver writer. Language is specified
207 in RFC 4646 or ISO 639-2 language code format.
209 @param DriverName[out] A pointer to the Unicode string to return.
210 This Unicode string is the name of the
211 driver specified by This in the language
212 specified by Language.
214 @retval EFI_SUCCESS The Unicode string for the Driver specified by
215 This and the language specified by Language was
216 returned in DriverName.
218 @retval EFI_INVALID_PARAMETER Language is NULL.
220 @retval EFI_INVALID_PARAMETER DriverName is NULL.
222 @retval EFI_UNSUPPORTED The driver specified by This does not support
223 the language specified by Language.
228 FatComponentNameGetDriverName (
229 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
231 OUT CHAR16
**DriverName
234 return LookupUnicodeString2 (
236 This
->SupportedLanguages
,
239 (BOOLEAN
)(This
== &gFatComponentName
)
244 Retrieves a Unicode string that is the user readable name of the controller
245 that is being managed by a driver.
247 This function retrieves the user readable name of the controller specified by
248 ControllerHandle and ChildHandle in the form of a Unicode string. If the
249 driver specified by This has a user readable name in the language specified by
250 Language, then a pointer to the controller name is returned in ControllerName,
251 and EFI_SUCCESS is returned. If the driver specified by This is not currently
252 managing the controller specified by ControllerHandle and ChildHandle,
253 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
254 support the language specified by Language, then EFI_UNSUPPORTED is returned.
256 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
257 EFI_COMPONENT_NAME_PROTOCOL instance.
259 @param ControllerHandle[in] The handle of a controller that the driver
260 specified by This is managing. This handle
261 specifies the controller whose name is to be
264 @param ChildHandle[in] The handle of the child controller to retrieve
265 the name of. This is an optional parameter that
266 may be NULL. It will be NULL for device
267 drivers. It will also be NULL for a bus drivers
268 that wish to retrieve the name of the bus
269 controller. It will not be NULL for a bus
270 driver that wishes to retrieve the name of a
273 @param Language[in] A pointer to a Null-terminated ASCII string
274 array indicating the language. This is the
275 language of the driver name that the caller is
276 requesting, and it must match one of the
277 languages specified in SupportedLanguages. The
278 number of languages supported by a driver is up
279 to the driver writer. Language is specified in
280 RFC 4646 or ISO 639-2 language code format.
282 @param ControllerName[out] A pointer to the Unicode string to return.
283 This Unicode string is the name of the
284 controller specified by ControllerHandle and
285 ChildHandle in the language specified by
286 Language from the point of view of the driver
289 @retval EFI_SUCCESS The Unicode string for the user readable name in
290 the language specified by Language for the
291 driver specified by This was returned in
294 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
296 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
299 @retval EFI_INVALID_PARAMETER Language is NULL.
301 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
303 @retval EFI_UNSUPPORTED The driver specified by This is not currently
304 managing the controller specified by
305 ControllerHandle and ChildHandle.
307 @retval EFI_UNSUPPORTED The driver specified by This does not support
308 the language specified by Language.
313 FatComponentNameGetControllerName (
314 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
315 IN EFI_HANDLE ControllerHandle
,
316 IN EFI_HANDLE ChildHandle OPTIONAL
,
318 OUT CHAR16
**ControllerName
324 // This is a device driver, so ChildHandle must be NULL.
326 if (ChildHandle
!= NULL
) {
327 return EFI_UNSUPPORTED
;
331 // Make sure this driver is currently managing ControllHandle
333 Status
= EfiTestManagedDevice (
335 gFatDriverBinding
.DriverBindingHandle
,
336 &gEfiDiskIoProtocolGuid
338 if (EFI_ERROR (Status
)) {
342 return LookupUnicodeString2 (
344 This
->SupportedLanguages
,
345 mFatControllerNameTable
,
347 (BOOLEAN
)(This
== &gFatComponentName
)