]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/ComponentName.c
66874e8dca9c861fb369ee8fb7f7dc21f6d9955d
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / ComponentName.c
1 /*++
2
3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
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.
11
12 Module Name:
13
14 ComponentName.c
15
16 Abstract:
17
18 --*/
19
20
21 #include <PiDxe.h>
22
23
24 #include <Library/UefiLib.h>
25
26 //
27 // EFI Component Name Functions
28 //
29 /**
30 Retrieves a Unicode string that is the user readable name of the driver.
31
32 This function retrieves the user readable name of a driver in the form of a
33 Unicode string. If the driver specified by This has a user readable name in
34 the language specified by Language, then a pointer to the driver name is
35 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
36 by This does not support the language specified by Language,
37 then EFI_UNSUPPORTED is returned.
38
39 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
40 EFI_COMPONENT_NAME_PROTOCOL instance.
41
42 @param Language[in] A pointer to a Null-terminated ASCII string
43 array indicating the language. This is the
44 language of the driver name that the caller is
45 requesting, and it must match one of the
46 languages specified in SupportedLanguages. The
47 number of languages supported by a driver is up
48 to the driver writer. Language is specified
49 in RFC 3066 or ISO 639-2 language code format.
50
51 @param DriverName[out] A pointer to the Unicode string to return.
52 This Unicode string is the name of the
53 driver specified by This in the language
54 specified by Language.
55
56 @retval EFI_SUCCESS The Unicode string for the Driver specified by
57 This and the language specified by Language was
58 returned in DriverName.
59
60 @retval EFI_INVALID_PARAMETER Language is NULL.
61
62 @retval EFI_INVALID_PARAMETER DriverName is NULL.
63
64 @retval EFI_UNSUPPORTED The driver specified by This does not support
65 the language specified by Language.
66
67 **/
68 EFI_STATUS
69 EFIAPI
70 UsbMassStorageGetDriverName (
71 IN EFI_COMPONENT_NAME_PROTOCOL *This,
72 IN CHAR8 *Language,
73 OUT CHAR16 **DriverName
74 );
75
76
77 /**
78 Retrieves a Unicode string that is the user readable name of the controller
79 that is being managed by a driver.
80
81 This function retrieves the user readable name of the controller specified by
82 ControllerHandle and ChildHandle in the form of a Unicode string. If the
83 driver specified by This has a user readable name in the language specified by
84 Language, then a pointer to the controller name is returned in ControllerName,
85 and EFI_SUCCESS is returned. If the driver specified by This is not currently
86 managing the controller specified by ControllerHandle and ChildHandle,
87 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
88 support the language specified by Language, then EFI_UNSUPPORTED is returned.
89
90 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
91 EFI_COMPONENT_NAME_PROTOCOL instance.
92
93 @param ControllerHandle[in] The handle of a controller that the driver
94 specified by This is managing. This handle
95 specifies the controller whose name is to be
96 returned.
97
98 @param ChildHandle[in] The handle of the child controller to retrieve
99 the name of. This is an optional parameter that
100 may be NULL. It will be NULL for device
101 drivers. It will also be NULL for a bus drivers
102 that wish to retrieve the name of the bus
103 controller. It will not be NULL for a bus
104 driver that wishes to retrieve the name of a
105 child controller.
106
107 @param Language[in] A pointer to a Null-terminated ASCII string
108 array indicating the language. This is the
109 language of the driver name that the caller is
110 requesting, and it must match one of the
111 languages specified in SupportedLanguages. The
112 number of languages supported by a driver is up
113 to the driver writer. Language is specified in
114 RFC 3066 or ISO 639-2 language code format.
115
116 @param ControllerName[out] A pointer to the Unicode string to return.
117 This Unicode string is the name of the
118 controller specified by ControllerHandle and
119 ChildHandle in the language specified by
120 Language from the point of view of the driver
121 specified by This.
122
123 @retval EFI_SUCCESS The Unicode string for the user readable name in
124 the language specified by Language for the
125 driver specified by This was returned in
126 DriverName.
127
128 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
129
130 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
131 EFI_HANDLE.
132
133 @retval EFI_INVALID_PARAMETER Language is NULL.
134
135 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
136
137 @retval EFI_UNSUPPORTED The driver specified by This is not currently
138 managing the controller specified by
139 ControllerHandle and ChildHandle.
140
141 @retval EFI_UNSUPPORTED The driver specified by This does not support
142 the language specified by Language.
143
144 **/
145 EFI_STATUS
146 EFIAPI
147 UsbMassStorageGetControllerName (
148 IN EFI_COMPONENT_NAME_PROTOCOL *This,
149 IN EFI_HANDLE ControllerHandle,
150 IN EFI_HANDLE ChildHandle OPTIONAL,
151 IN CHAR8 *Language,
152 OUT CHAR16 **ControllerName
153 );
154
155
156 //
157 // EFI Component Name Protocol
158 //
159 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName = {
160 UsbMassStorageGetDriverName,
161 UsbMassStorageGetControllerName,
162 "eng"
163 };
164
165 //
166 // EFI Component Name 2 Protocol
167 //
168 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbMassStorageComponentName2 = {
169 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UsbMassStorageGetDriverName,
170 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UsbMassStorageGetControllerName,
171 "en"
172 };
173
174
175 STATIC EFI_UNICODE_STRING_TABLE
176 mUsbMassStorageDriverNameTable[] = {
177 {"eng;en", L"Usb Mass Storage Driver"},
178 {NULL, NULL}
179 };
180
181 /**
182 Retrieves a Unicode string that is the user readable name of the driver.
183
184 This function retrieves the user readable name of a driver in the form of a
185 Unicode string. If the driver specified by This has a user readable name in
186 the language specified by Language, then a pointer to the driver name is
187 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
188 by This does not support the language specified by Language,
189 then EFI_UNSUPPORTED is returned.
190
191 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
192 EFI_COMPONENT_NAME_PROTOCOL instance.
193
194 @param Language[in] A pointer to a Null-terminated ASCII string
195 array indicating the language. This is the
196 language of the driver name that the caller is
197 requesting, and it must match one of the
198 languages specified in SupportedLanguages. The
199 number of languages supported by a driver is up
200 to the driver writer. Language is specified
201 in RFC 3066 or ISO 639-2 language code format.
202
203 @param DriverName[out] A pointer to the Unicode string to return.
204 This Unicode string is the name of the
205 driver specified by This in the language
206 specified by Language.
207
208 @retval EFI_SUCCESS The Unicode string for the Driver specified by
209 This and the language specified by Language was
210 returned in DriverName.
211
212 @retval EFI_INVALID_PARAMETER Language is NULL.
213
214 @retval EFI_INVALID_PARAMETER DriverName is NULL.
215
216 @retval EFI_UNSUPPORTED The driver specified by This does not support
217 the language specified by Language.
218
219 **/
220 EFI_STATUS
221 EFIAPI
222 UsbMassStorageGetDriverName (
223 IN EFI_COMPONENT_NAME_PROTOCOL *This,
224 IN CHAR8 *Language,
225 OUT CHAR16 **DriverName
226 )
227 {
228 return LookupUnicodeString2 (
229 Language,
230 This->SupportedLanguages,
231 mUsbMassStorageDriverNameTable,
232 DriverName,
233 (BOOLEAN)(This == &gUsbMassStorageComponentName)
234 );
235 }
236
237 /**
238 Retrieves a Unicode string that is the user readable name of the controller
239 that is being managed by a driver.
240
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.
249
250 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
251 EFI_COMPONENT_NAME_PROTOCOL instance.
252
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
256 returned.
257
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
265 child controller.
266
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 3066 or ISO 639-2 language code format.
275
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
281 specified by This.
282
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
286 DriverName.
287
288 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
289
290 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
291 EFI_HANDLE.
292
293 @retval EFI_INVALID_PARAMETER Language is NULL.
294
295 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
296
297 @retval EFI_UNSUPPORTED The driver specified by This is not currently
298 managing the controller specified by
299 ControllerHandle and ChildHandle.
300
301 @retval EFI_UNSUPPORTED The driver specified by This does not support
302 the language specified by Language.
303
304 **/
305 EFI_STATUS
306 EFIAPI
307 UsbMassStorageGetControllerName (
308 IN EFI_COMPONENT_NAME_PROTOCOL *This,
309 IN EFI_HANDLE ControllerHandle,
310 IN EFI_HANDLE ChildHandle OPTIONAL,
311 IN CHAR8 *Language,
312 OUT CHAR16 **ControllerName
313 )
314 {
315 return EFI_UNSUPPORTED;
316 }