3 Copyright (c) 2005 - 2007, 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.
24 // EFI Component Name Functions
27 Retrieves a Unicode string that is the user readable name of the driver.
29 This function retrieves the user readable name of a driver in the form of a
30 Unicode string. If the driver specified by This has a user readable name in
31 the language specified by Language, then a pointer to the driver name is
32 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
33 by This does not support the language specified by Language,
34 then EFI_UNSUPPORTED is returned.
36 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
37 EFI_COMPONENT_NAME_PROTOCOL instance.
39 @param Language[in] A pointer to a Null-terminated ASCII string
40 array indicating the language. This is the
41 language of the driver name that the caller is
42 requesting, and it must match one of the
43 languages specified in SupportedLanguages. The
44 number of languages supported by a driver is up
45 to the driver writer. Language is specified
46 in RFC 4646 or ISO 639-2 language code format.
48 @param DriverName[out] A pointer to the Unicode string to return.
49 This Unicode string is the name of the
50 driver specified by This in the language
51 specified by Language.
53 @retval EFI_SUCCESS The Unicode string for the Driver specified by
54 This and the language specified by Language was
55 returned in DriverName.
57 @retval EFI_INVALID_PARAMETER Language is NULL.
59 @retval EFI_INVALID_PARAMETER DriverName is NULL.
61 @retval EFI_UNSUPPORTED The driver specified by This does not support
62 the language specified by Language.
67 FatComponentNameGetDriverName (
68 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
70 OUT CHAR16
**DriverName
75 Retrieves a Unicode string that is the user readable name of the controller
76 that is being managed by a driver.
78 This function retrieves the user readable name of the controller specified by
79 ControllerHandle and ChildHandle in the form of a Unicode string. If the
80 driver specified by This has a user readable name in the language specified by
81 Language, then a pointer to the controller name is returned in ControllerName,
82 and EFI_SUCCESS is returned. If the driver specified by This is not currently
83 managing the controller specified by ControllerHandle and ChildHandle,
84 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
85 support the language specified by Language, then EFI_UNSUPPORTED is returned.
87 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
88 EFI_COMPONENT_NAME_PROTOCOL instance.
90 @param ControllerHandle[in] The handle of a controller that the driver
91 specified by This is managing. This handle
92 specifies the controller whose name is to be
95 @param ChildHandle[in] The handle of the child controller to retrieve
96 the name of. This is an optional parameter that
97 may be NULL. It will be NULL for device
98 drivers. It will also be NULL for a bus drivers
99 that wish to retrieve the name of the bus
100 controller. It will not be NULL for a bus
101 driver that wishes to retrieve the name of a
104 @param Language[in] A pointer to a Null-terminated ASCII string
105 array indicating the language. This is the
106 language of the driver name that the caller is
107 requesting, and it must match one of the
108 languages specified in SupportedLanguages. The
109 number of languages supported by a driver is up
110 to the driver writer. Language is specified in
111 RFC 4646 or ISO 639-2 language code format.
113 @param ControllerName[out] A pointer to the Unicode string to return.
114 This Unicode string is the name of the
115 controller specified by ControllerHandle and
116 ChildHandle in the language specified by
117 Language from the point of view of the driver
120 @retval EFI_SUCCESS The Unicode string for the user readable name in
121 the language specified by Language for the
122 driver specified by This was returned in
125 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
127 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
130 @retval EFI_INVALID_PARAMETER Language is NULL.
132 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
134 @retval EFI_UNSUPPORTED The driver specified by This is not currently
135 managing the controller specified by
136 ControllerHandle and ChildHandle.
138 @retval EFI_UNSUPPORTED The driver specified by This does not support
139 the language specified by Language.
144 FatComponentNameGetControllerName (
145 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
146 IN EFI_HANDLE ControllerHandle
,
147 IN EFI_HANDLE ChildHandle OPTIONAL
,
149 OUT CHAR16
**ControllerName
153 // EFI Component Name Protocol
155 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gFatComponentName
= {
156 FatComponentNameGetDriverName
,
157 FatComponentNameGetControllerName
,
162 // EFI Component Name 2 Protocol
164 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gFatComponentName2
= {
165 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) FatComponentNameGetDriverName
,
166 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) FatComponentNameGetControllerName
,
170 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatDriverNameTable
[] = {
173 L
"FAT File System Driver"
181 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatControllerNameTable
[] = {
194 Retrieves a Unicode string that is the user readable name of the driver.
196 This function retrieves the user readable name of a driver in the form of a
197 Unicode string. If the driver specified by This has a user readable name in
198 the language specified by Language, then a pointer to the driver name is
199 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
200 by This does not support the language specified by Language,
201 then EFI_UNSUPPORTED is returned.
203 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
204 EFI_COMPONENT_NAME_PROTOCOL instance.
206 @param Language[in] A pointer to a Null-terminated ASCII string
207 array indicating the language. This is the
208 language of the driver name that the caller is
209 requesting, and it must match one of the
210 languages specified in SupportedLanguages. The
211 number of languages supported by a driver is up
212 to the driver writer. Language is specified
213 in RFC 4646 or ISO 639-2 language code format.
215 @param DriverName[out] A pointer to the Unicode string to return.
216 This Unicode string is the name of the
217 driver specified by This in the language
218 specified by Language.
220 @retval EFI_SUCCESS The Unicode string for the Driver specified by
221 This and the language specified by Language was
222 returned in DriverName.
224 @retval EFI_INVALID_PARAMETER Language is NULL.
226 @retval EFI_INVALID_PARAMETER DriverName is NULL.
228 @retval EFI_UNSUPPORTED The driver specified by This does not support
229 the language specified by Language.
234 FatComponentNameGetDriverName (
235 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
237 OUT CHAR16
**DriverName
240 return LookupUnicodeString2 (
242 This
->SupportedLanguages
,
245 (BOOLEAN
)(This
== &gFatComponentName
)
250 Retrieves a Unicode string that is the user readable name of the controller
251 that is being managed by a driver.
253 This function retrieves the user readable name of the controller specified by
254 ControllerHandle and ChildHandle in the form of a Unicode string. If the
255 driver specified by This has a user readable name in the language specified by
256 Language, then a pointer to the controller name is returned in ControllerName,
257 and EFI_SUCCESS is returned. If the driver specified by This is not currently
258 managing the controller specified by ControllerHandle and ChildHandle,
259 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
260 support the language specified by Language, then EFI_UNSUPPORTED is returned.
262 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
263 EFI_COMPONENT_NAME_PROTOCOL instance.
265 @param ControllerHandle[in] The handle of a controller that the driver
266 specified by This is managing. This handle
267 specifies the controller whose name is to be
270 @param ChildHandle[in] The handle of the child controller to retrieve
271 the name of. This is an optional parameter that
272 may be NULL. It will be NULL for device
273 drivers. It will also be NULL for a bus drivers
274 that wish to retrieve the name of the bus
275 controller. It will not be NULL for a bus
276 driver that wishes to retrieve the name of a
279 @param Language[in] A pointer to a Null-terminated ASCII string
280 array indicating the language. This is the
281 language of the driver name that the caller is
282 requesting, and it must match one of the
283 languages specified in SupportedLanguages. The
284 number of languages supported by a driver is up
285 to the driver writer. Language is specified in
286 RFC 4646 or ISO 639-2 language code format.
288 @param ControllerName[out] A pointer to the Unicode string to return.
289 This Unicode string is the name of the
290 controller specified by ControllerHandle and
291 ChildHandle in the language specified by
292 Language from the point of view of the driver
295 @retval EFI_SUCCESS The Unicode string for the user readable name in
296 the language specified by Language for the
297 driver specified by This was returned in
300 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
302 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
305 @retval EFI_INVALID_PARAMETER Language is NULL.
307 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
309 @retval EFI_UNSUPPORTED The driver specified by This is not currently
310 managing the controller specified by
311 ControllerHandle and ChildHandle.
313 @retval EFI_UNSUPPORTED The driver specified by This does not support
314 the language specified by Language.
319 FatComponentNameGetControllerName (
320 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
321 IN EFI_HANDLE ControllerHandle
,
322 IN EFI_HANDLE ChildHandle OPTIONAL
,
324 OUT CHAR16
**ControllerName
330 // This is a device driver, so ChildHandle must be NULL.
332 if (ChildHandle
!= NULL
) {
333 return EFI_UNSUPPORTED
;
337 // Make sure this driver is currently managing ControllHandle
339 Status
= EfiTestManagedDevice (
341 gFatDriverBinding
.DriverBindingHandle
,
342 &gEfiDiskIoProtocolGuid
344 if (EFI_ERROR (Status
)) {
348 return LookupUnicodeString2 (
350 This
->SupportedLanguages
,
351 mFatControllerNameTable
,
353 (BOOLEAN
)(This
== &gFatComponentName
)