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