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