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