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