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