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