]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/ConSplitterDxe/ComponentName.c
Fix an issue in the implementation of GetDriverName() in Con splitter driver. We...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConSplitterDxe / ComponentName.c
CommitLineData
fb0b259e 1/** @file\r
2 UEFI Component Name(2) protocol implementation for ConSplitter driver.\r
95276127 3\r
fb0b259e 4Copyright (c) 2006, Intel Corporation. <BR>\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
95276127 9\r
fb0b259e 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
95276127 12\r
fb0b259e 13**/\r
95276127 14\r
95276127 15#include "ConSplitter.h"\r
16\r
17//\r
18// EFI Component Name Protocol\r
19//\r
1307dcd7 20GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName = {\r
95276127 21 ConSplitterComponentNameGetDriverName,\r
22 ConSplitterConInComponentNameGetControllerName,\r
23 "eng"\r
1307dcd7 24};\r
5bca971e 25\r
26//\r
27// EFI Component Name 2 Protocol\r
28//\r
1307dcd7 29GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2 = {\r
5bca971e 30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,\r
31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConInComponentNameGetControllerName,\r
32 "en"\r
1307dcd7 33};\r
95276127 34\r
5bca971e 35\r
36//\r
37// EFI Component Name Protocol\r
38//\r
1307dcd7 39GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName = {\r
95276127 40 ConSplitterComponentNameGetDriverName,\r
41 ConSplitterSimplePointerComponentNameGetControllerName,\r
42 "eng"\r
1307dcd7 43};\r
5bca971e 44\r
45//\r
46// EFI Component Name 2 Protocol\r
47//\r
1307dcd7 48GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2 = {\r
5bca971e 49 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,\r
50 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterSimplePointerComponentNameGetControllerName,\r
51 "en"\r
1307dcd7 52};\r
95276127 53\r
8ae0b360 54//\r
55// EFI Component Name Protocol\r
56//\r
57GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {\r
58 ConSplitterComponentNameGetDriverName,\r
59 ConSplitterAbsolutePointerComponentNameGetControllerName,\r
60 "eng"\r
61};\r
62\r
63//\r
64// EFI Component Name 2 Protocol\r
65//\r
66GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {\r
67 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,\r
68 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterAbsolutePointerComponentNameGetControllerName,\r
69 "en"\r
70};\r
5bca971e 71\r
72//\r
73// EFI Component Name Protocol\r
74//\r
1307dcd7 75GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName = {\r
95276127 76 ConSplitterComponentNameGetDriverName,\r
77 ConSplitterConOutComponentNameGetControllerName,\r
78 "eng"\r
1307dcd7 79};\r
5bca971e 80\r
81//\r
82// EFI Component Name 2 Protocol\r
83//\r
1307dcd7 84GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2 = {\r
5bca971e 85 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,\r
86 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConOutComponentNameGetControllerName,\r
87 "en"\r
1307dcd7 88};\r
95276127 89\r
5bca971e 90\r
91//\r
92// EFI Component Name Protocol\r
93//\r
1307dcd7 94GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName = {\r
95276127 95 ConSplitterComponentNameGetDriverName,\r
96 ConSplitterStdErrComponentNameGetControllerName,\r
97 "eng"\r
1307dcd7 98};\r
5bca971e 99\r
100//\r
101// EFI Component Name 2 Protocol\r
102//\r
1307dcd7 103GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2 = {\r
5bca971e 104 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,\r
105 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterStdErrComponentNameGetControllerName,\r
106 "en"\r
1307dcd7 107};\r
5bca971e 108\r
95276127 109\r
d1aeb0bd 110GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {\r
95276127 111 {\r
5bca971e 112 "eng;en",\r
95276127 113 (CHAR16 *) L"Console Splitter Driver"\r
114 },\r
115 {\r
116 NULL,\r
117 NULL\r
118 }\r
119};\r
120\r
d1aeb0bd 121GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {\r
95276127 122 {\r
5bca971e 123 "eng;en",\r
95276127 124 (CHAR16 *) L"Primary Console Input Device"\r
125 },\r
126 {\r
127 NULL,\r
128 NULL\r
129 }\r
130};\r
131\r
d1aeb0bd 132GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {\r
95276127 133 {\r
5bca971e 134 "eng;en",\r
95276127 135 (CHAR16 *) L"Primary Simple Pointer Device"\r
136 },\r
137 {\r
138 NULL,\r
139 NULL\r
140 }\r
141};\r
142\r
8ae0b360 143GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {\r
144 {\r
145 "eng;en",\r
146 (CHAR16 *)L"Primary Absolute Pointer Device"\r
147 },\r
148 {\r
149 NULL,\r
150 NULL\r
151 }\r
152};\r
153\r
d1aeb0bd 154GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {\r
95276127 155 {\r
5bca971e 156 "eng;en",\r
95276127 157 (CHAR16 *) L"Primary Console Output Device"\r
158 },\r
159 {\r
160 NULL,\r
161 NULL\r
162 }\r
163};\r
164\r
d1aeb0bd 165GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {\r
95276127 166 {\r
5bca971e 167 "eng;en",\r
95276127 168 (CHAR16 *) L"Primary Standard Error Device"\r
169 },\r
170 {\r
171 NULL,\r
172 NULL\r
173 }\r
174};\r
175\r
5bca971e 176/**\r
177 Retrieves a Unicode string that is the user readable name of the driver.\r
178\r
179 This function retrieves the user readable name of a driver in the form of a\r
180 Unicode string. If the driver specified by This has a user readable name in\r
181 the language specified by Language, then a pointer to the driver name is\r
182 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
183 by This does not support the language specified by Language,\r
184 then EFI_UNSUPPORTED is returned.\r
185\r
186 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
187 EFI_COMPONENT_NAME_PROTOCOL instance.\r
188\r
189 @param Language[in] A pointer to a Null-terminated ASCII string\r
190 array indicating the language. This is the\r
191 language of the driver name that the caller is\r
192 requesting, and it must match one of the\r
193 languages specified in SupportedLanguages. The\r
194 number of languages supported by a driver is up\r
195 to the driver writer. Language is specified\r
196 in RFC 3066 or ISO 639-2 language code format.\r
197\r
198 @param DriverName[out] A pointer to the Unicode string to return.\r
199 This Unicode string is the name of the\r
200 driver specified by This in the language\r
201 specified by Language.\r
202\r
203 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
204 This and the language specified by Language was\r
205 returned in DriverName.\r
206\r
207 @retval EFI_INVALID_PARAMETER Language is NULL.\r
208\r
209 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
210\r
211 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
212 the language specified by Language.\r
213\r
214**/\r
95276127 215EFI_STATUS\r
216EFIAPI\r
217ConSplitterComponentNameGetDriverName (\r
218 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
219 IN CHAR8 *Language,\r
220 OUT CHAR16 **DriverName\r
221 )\r
95276127 222{\r
5bca971e 223 return LookupUnicodeString2 (\r
95276127 224 Language,\r
5bca971e 225 This->SupportedLanguages,\r
95276127 226 mConSplitterDriverNameTable,\r
5bca971e 227 DriverName,\r
abda9e12 228 (BOOLEAN)((This == &gConSplitterConInComponentName) || \r
229 (This == &gConSplitterSimplePointerComponentName) ||\r
230 (This == &gConSplitterAbsolutePointerComponentName) ||\r
231 (This == &gConSplitterConOutComponentName) ||\r
232 (This == &gConSplitterStdErrComponentName))\r
95276127 233 );\r
234}\r
235\r
b71f6b3c 236/**\r
237 Tests whether a controller handle is being managed by a specific driver and\r
238 the child handle is a child device of the controller.\r
239\r
240 @param ControllerHandle A handle for a controller to test.\r
241 @param DriverBindingHandle Specifies the driver binding handle for the\r
242 driver.\r
243 @param ProtocolGuid Specifies the protocol that the driver specified\r
244 by DriverBindingHandle opens in its Start()\r
245 function.\r
246 @param ChildHandle A child handle to test.\r
247 @param ConsumsedGuid Supplies the protocol that the child controller\r
248 opens on its parent controller.\r
249\r
250 @retval EFI_SUCCESS ControllerHandle is managed by the driver\r
251 specifed by DriverBindingHandle and ChildHandle\r
252 is a child of the ControllerHandle.\r
253 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r
254 specifed by DriverBindingHandle.\r
255 @retval EFI_UNSUPPORTED ChildHandle is not a child of the\r
256 ControllerHandle.\r
257\r
258**/\r
259EFI_STATUS\r
260ConSplitterTestControllerHandles (\r
261 IN CONST EFI_HANDLE ControllerHandle,\r
262 IN CONST EFI_HANDLE DriverBindingHandle,\r
263 IN CONST EFI_GUID *ProtocolGuid,\r
264 IN EFI_HANDLE ChildHandle,\r
265 IN CONST EFI_GUID *ConsumsedGuid\r
266 )\r
267{\r
268 EFI_STATUS Status;\r
269\r
270 //\r
271 // here ChildHandle is not an Optional parameter.\r
272 //\r
273 if (ChildHandle == NULL) {\r
274 return EFI_UNSUPPORTED;\r
275 }\r
276\r
277 Status = EfiTestManagedDevice (\r
278 ControllerHandle,\r
279 DriverBindingHandle,\r
280 ProtocolGuid\r
281 );\r
282 if (EFI_ERROR (Status)) {\r
283 return Status;\r
284 }\r
285\r
286 Status = EfiTestChildHandle (\r
287 ControllerHandle,\r
288 ChildHandle,\r
289 ConsumsedGuid\r
290 );\r
291\r
292 return Status;\r
293}\r
294\r
5bca971e 295/**\r
296 Retrieves a Unicode string that is the user readable name of the controller\r
297 that is being managed by a driver.\r
298\r
299 This function retrieves the user readable name of the controller specified by\r
300 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
301 driver specified by This has a user readable name in the language specified by\r
302 Language, then a pointer to the controller name is returned in ControllerName,\r
303 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
304 managing the controller specified by ControllerHandle and ChildHandle,\r
305 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
306 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
307\r
308 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
309 EFI_COMPONENT_NAME_PROTOCOL instance.\r
310\r
311 @param ControllerHandle[in] The handle of a controller that the driver\r
312 specified by This is managing. This handle\r
313 specifies the controller whose name is to be\r
314 returned.\r
315\r
316 @param ChildHandle[in] The handle of the child controller to retrieve\r
317 the name of. This is an optional parameter that\r
318 may be NULL. It will be NULL for device\r
319 drivers. It will also be NULL for a bus drivers\r
320 that wish to retrieve the name of the bus\r
321 controller. It will not be NULL for a bus\r
322 driver that wishes to retrieve the name of a\r
323 child controller.\r
324\r
325 @param Language[in] A pointer to a Null-terminated ASCII string\r
326 array indicating the language. This is the\r
327 language of the driver name that the caller is\r
328 requesting, and it must match one of the\r
329 languages specified in SupportedLanguages. The\r
330 number of languages supported by a driver is up\r
331 to the driver writer. Language is specified in\r
332 RFC 3066 or ISO 639-2 language code format.\r
333\r
334 @param ControllerName[out] A pointer to the Unicode string to return.\r
335 This Unicode string is the name of the\r
336 controller specified by ControllerHandle and\r
337 ChildHandle in the language specified by\r
338 Language from the point of view of the driver\r
339 specified by This.\r
340\r
341 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
342 the language specified by Language for the\r
343 driver specified by This was returned in\r
344 DriverName.\r
345\r
346 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
347\r
348 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
349 EFI_HANDLE.\r
350\r
351 @retval EFI_INVALID_PARAMETER Language is NULL.\r
352\r
353 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
354\r
355 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
356 managing the controller specified by\r
357 ControllerHandle and ChildHandle.\r
358\r
359 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
360 the language specified by Language.\r
361\r
362**/\r
95276127 363EFI_STATUS\r
364EFIAPI\r
365ConSplitterConInComponentNameGetControllerName (\r
366 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
367 IN EFI_HANDLE ControllerHandle,\r
368 IN EFI_HANDLE ChildHandle OPTIONAL,\r
369 IN CHAR8 *Language,\r
370 OUT CHAR16 **ControllerName\r
371 )\r
95276127 372{\r
373 EFI_STATUS Status;\r
95276127 374\r
b71f6b3c 375 Status = ConSplitterTestControllerHandles (\r
376 ControllerHandle,\r
377 gConSplitterConInDriverBinding.DriverBindingHandle,\r
378 &gEfiSimpleTextInProtocolGuid,\r
379 ChildHandle,\r
380 &gEfiConsoleInDeviceGuid\r
381 );\r
95276127 382 if (EFI_ERROR (Status)) {\r
b71f6b3c 383 return Status;\r
95276127 384 }\r
385\r
5bca971e 386 return LookupUnicodeString2 (\r
95276127 387 Language,\r
5bca971e 388 This->SupportedLanguages,\r
95276127 389 mConSplitterConInControllerNameTable,\r
5bca971e 390 ControllerName,\r
391 (BOOLEAN)(This == &gConSplitterConInComponentName)\r
95276127 392 );\r
393}\r
394\r
5bca971e 395/**\r
396 Retrieves a Unicode string that is the user readable name of the controller\r
397 that is being managed by a driver.\r
398\r
399 This function retrieves the user readable name of the controller specified by\r
400 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
401 driver specified by This has a user readable name in the language specified by\r
402 Language, then a pointer to the controller name is returned in ControllerName,\r
403 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
404 managing the controller specified by ControllerHandle and ChildHandle,\r
405 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
406 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
407\r
408 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
409 EFI_COMPONENT_NAME_PROTOCOL instance.\r
410\r
411 @param ControllerHandle[in] The handle of a controller that the driver\r
412 specified by This is managing. This handle\r
413 specifies the controller whose name is to be\r
414 returned.\r
415\r
416 @param ChildHandle[in] The handle of the child controller to retrieve\r
417 the name of. This is an optional parameter that\r
418 may be NULL. It will be NULL for device\r
419 drivers. It will also be NULL for a bus drivers\r
420 that wish to retrieve the name of the bus\r
421 controller. It will not be NULL for a bus\r
422 driver that wishes to retrieve the name of a\r
423 child controller.\r
424\r
425 @param Language[in] A pointer to a Null-terminated ASCII string\r
426 array indicating the language. This is the\r
427 language of the driver name that the caller is\r
428 requesting, and it must match one of the\r
429 languages specified in SupportedLanguages. The\r
430 number of languages supported by a driver is up\r
431 to the driver writer. Language is specified in\r
432 RFC 3066 or ISO 639-2 language code format.\r
433\r
434 @param ControllerName[out] A pointer to the Unicode string to return.\r
435 This Unicode string is the name of the\r
436 controller specified by ControllerHandle and\r
437 ChildHandle in the language specified by\r
438 Language from the point of view of the driver\r
439 specified by This.\r
440\r
441 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
442 the language specified by Language for the\r
443 driver specified by This was returned in\r
444 DriverName.\r
445\r
446 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
447\r
448 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
449 EFI_HANDLE.\r
450\r
451 @retval EFI_INVALID_PARAMETER Language is NULL.\r
452\r
453 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
454\r
455 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
456 managing the controller specified by\r
457 ControllerHandle and ChildHandle.\r
458\r
459 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
460 the language specified by Language.\r
461\r
462**/\r
95276127 463EFI_STATUS\r
464EFIAPI\r
465ConSplitterSimplePointerComponentNameGetControllerName (\r
466 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
467 IN EFI_HANDLE ControllerHandle,\r
468 IN EFI_HANDLE ChildHandle OPTIONAL,\r
469 IN CHAR8 *Language,\r
470 OUT CHAR16 **ControllerName\r
471 )\r
95276127 472{\r
473 EFI_STATUS Status;\r
95276127 474\r
b71f6b3c 475 Status = ConSplitterTestControllerHandles (\r
476 ControllerHandle,\r
477 gConSplitterSimplePointerDriverBinding.DriverBindingHandle,\r
478 &gEfiSimplePointerProtocolGuid,\r
479 ChildHandle,\r
480 &gEfiSimplePointerProtocolGuid\r
481 );\r
95276127 482 if (EFI_ERROR (Status)) {\r
b71f6b3c 483 return Status;\r
95276127 484 }\r
485\r
5bca971e 486 return LookupUnicodeString2 (\r
487 Language,\r
488 This->SupportedLanguages,\r
489 mConSplitterSimplePointerControllerNameTable,\r
490 ControllerName,\r
491 (BOOLEAN)(This == &gConSplitterSimplePointerComponentName)\r
492 );\r
95276127 493}\r
494\r
8ae0b360 495EFI_STATUS\r
496EFIAPI\r
497ConSplitterAbsolutePointerComponentNameGetControllerName (\r
498 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
499 IN EFI_HANDLE ControllerHandle,\r
500 IN EFI_HANDLE ChildHandle OPTIONAL,\r
501 IN CHAR8 *Language,\r
502 OUT CHAR16 **ControllerName\r
503 )\r
504/*++\r
505\r
506 Routine Description:\r
507 Retrieves a Unicode string that is the user readable name of the controller\r
508 that is being managed by an EFI Driver.\r
509\r
510 Arguments:\r
511 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
fb0b259e 512 ControllerHandle - The handle of a controller that the driver specified by\r
513 This is managing. This handle specifies the controller\r
8ae0b360 514 whose name is to be returned.\r
fb0b259e 515 ChildHandle - The handle of the child controller to retrieve the name\r
516 of. This is an optional parameter that may be NULL. It\r
517 will be NULL for device drivers. It will also be NULL\r
518 for a bus drivers that wish to retrieve the name of the\r
519 bus controller. It will not be NULL for a bus driver\r
8ae0b360 520 that wishes to retrieve the name of a child controller.\r
fb0b259e 521 Language - A pointer to RFC3066 language identifier.\r
522 This is the language of the controller name\r
8ae0b360 523 that that the caller is requesting, and it must match one\r
fb0b259e 524 of the languages specified in SupportedLanguages. The\r
525 number of languages supported by a driver is up to the\r
8ae0b360 526 driver writer.\r
527 ControllerName - A pointer to the Unicode string to return. This Unicode\r
fb0b259e 528 string is the name of the controller specified by\r
529 ControllerHandle and ChildHandle in the language\r
530 specified by Language from the point of view of the\r
531 driver specified by This.\r
8ae0b360 532\r
533 Returns:\r
534 EFI_SUCCESS - The Unicode string for the user readable name in the\r
fb0b259e 535 language specified by Language for the driver\r
8ae0b360 536 specified by This was returned in DriverName.\r
537 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
fb0b259e 538 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid\r
8ae0b360 539 EFI_HANDLE.\r
540 EFI_INVALID_PARAMETER - Language is NULL.\r
541 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
fb0b259e 542 EFI_UNSUPPORTED - The driver specified by This is not currently\r
543 managing the controller specified by\r
8ae0b360 544 ControllerHandle and ChildHandle.\r
fb0b259e 545 EFI_UNSUPPORTED - The driver specified by This does not support the\r
8ae0b360 546 language specified by Language.\r
547\r
548--*/\r
549{\r
550 EFI_STATUS Status;\r
8ae0b360 551\r
b71f6b3c 552 Status = ConSplitterTestControllerHandles (\r
553 ControllerHandle,\r
554 gConSplitterAbsolutePointerDriverBinding.DriverBindingHandle,\r
555 &gEfiAbsolutePointerProtocolGuid,\r
556 ChildHandle,\r
557 &gEfiAbsolutePointerProtocolGuid\r
558 );\r
8ae0b360 559 if (EFI_ERROR (Status)) {\r
b71f6b3c 560 return Status;\r
8ae0b360 561 }\r
562\r
b71f6b3c 563 return LookupUnicodeString2 (\r
564 Language,\r
565 This->SupportedLanguages,\r
566 mConSplitterAbsolutePointerControllerNameTable,\r
567 ControllerName,\r
568 (BOOLEAN)(This == &gConSplitterAbsolutePointerComponentName)\r
569 );\r
8ae0b360 570}\r
571\r
5bca971e 572/**\r
573 Retrieves a Unicode string that is the user readable name of the controller\r
574 that is being managed by a driver.\r
575\r
576 This function retrieves the user readable name of the controller specified by\r
577 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
578 driver specified by This has a user readable name in the language specified by\r
579 Language, then a pointer to the controller name is returned in ControllerName,\r
580 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
581 managing the controller specified by ControllerHandle and ChildHandle,\r
582 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
583 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
584\r
585 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
586 EFI_COMPONENT_NAME_PROTOCOL instance.\r
587\r
588 @param ControllerHandle[in] The handle of a controller that the driver\r
589 specified by This is managing. This handle\r
590 specifies the controller whose name is to be\r
591 returned.\r
592\r
593 @param ChildHandle[in] The handle of the child controller to retrieve\r
594 the name of. This is an optional parameter that\r
595 may be NULL. It will be NULL for device\r
596 drivers. It will also be NULL for a bus drivers\r
597 that wish to retrieve the name of the bus\r
598 controller. It will not be NULL for a bus\r
599 driver that wishes to retrieve the name of a\r
600 child controller.\r
601\r
602 @param Language[in] A pointer to a Null-terminated ASCII string\r
603 array indicating the language. This is the\r
604 language of the driver name that the caller is\r
605 requesting, and it must match one of the\r
606 languages specified in SupportedLanguages. The\r
607 number of languages supported by a driver is up\r
608 to the driver writer. Language is specified in\r
609 RFC 3066 or ISO 639-2 language code format.\r
610\r
611 @param ControllerName[out] A pointer to the Unicode string to return.\r
612 This Unicode string is the name of the\r
613 controller specified by ControllerHandle and\r
614 ChildHandle in the language specified by\r
615 Language from the point of view of the driver\r
616 specified by This.\r
617\r
618 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
619 the language specified by Language for the\r
620 driver specified by This was returned in\r
621 DriverName.\r
622\r
623 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
624\r
625 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
626 EFI_HANDLE.\r
627\r
628 @retval EFI_INVALID_PARAMETER Language is NULL.\r
629\r
630 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
631\r
632 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
633 managing the controller specified by\r
634 ControllerHandle and ChildHandle.\r
635\r
636 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
637 the language specified by Language.\r
638\r
639**/\r
95276127 640EFI_STATUS\r
641EFIAPI\r
642ConSplitterConOutComponentNameGetControllerName (\r
643 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
644 IN EFI_HANDLE ControllerHandle,\r
645 IN EFI_HANDLE ChildHandle OPTIONAL,\r
646 IN CHAR8 *Language,\r
647 OUT CHAR16 **ControllerName\r
648 )\r
95276127 649{\r
650 EFI_STATUS Status;\r
95276127 651\r
b71f6b3c 652 Status = ConSplitterTestControllerHandles (\r
653 ControllerHandle,\r
654 gConSplitterConOutDriverBinding.DriverBindingHandle,\r
655 &gEfiSimpleTextOutProtocolGuid,\r
656 ChildHandle,\r
657 &gEfiConsoleOutDeviceGuid\r
658 );\r
95276127 659 if (EFI_ERROR (Status)) {\r
b71f6b3c 660 return Status;\r
95276127 661 }\r
662\r
5bca971e 663 return LookupUnicodeString2 (\r
664 Language,\r
665 This->SupportedLanguages,\r
666 mConSplitterConOutControllerNameTable,\r
667 ControllerName,\r
668 (BOOLEAN)(This == &gConSplitterConOutComponentName)\r
669 );\r
95276127 670}\r
671\r
5bca971e 672/**\r
673 Retrieves a Unicode string that is the user readable name of the controller\r
674 that is being managed by a driver.\r
675\r
676 This function retrieves the user readable name of the controller specified by\r
677 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
678 driver specified by This has a user readable name in the language specified by\r
679 Language, then a pointer to the controller name is returned in ControllerName,\r
680 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
681 managing the controller specified by ControllerHandle and ChildHandle,\r
682 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
683 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
684\r
685 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
686 EFI_COMPONENT_NAME_PROTOCOL instance.\r
687\r
688 @param ControllerHandle[in] The handle of a controller that the driver\r
689 specified by This is managing. This handle\r
690 specifies the controller whose name is to be\r
691 returned.\r
692\r
693 @param ChildHandle[in] The handle of the child controller to retrieve\r
694 the name of. This is an optional parameter that\r
695 may be NULL. It will be NULL for device\r
696 drivers. It will also be NULL for a bus drivers\r
697 that wish to retrieve the name of the bus\r
698 controller. It will not be NULL for a bus\r
699 driver that wishes to retrieve the name of a\r
700 child controller.\r
701\r
702 @param Language[in] A pointer to a Null-terminated ASCII string\r
703 array indicating the language. This is the\r
704 language of the driver name that the caller is\r
705 requesting, and it must match one of the\r
706 languages specified in SupportedLanguages. The\r
707 number of languages supported by a driver is up\r
708 to the driver writer. Language is specified in\r
709 RFC 3066 or ISO 639-2 language code format.\r
710\r
711 @param ControllerName[out] A pointer to the Unicode string to return.\r
712 This Unicode string is the name of the\r
713 controller specified by ControllerHandle and\r
714 ChildHandle in the language specified by\r
715 Language from the point of view of the driver\r
716 specified by This.\r
717\r
718 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
719 the language specified by Language for the\r
720 driver specified by This was returned in\r
721 DriverName.\r
722\r
723 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
724\r
725 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
726 EFI_HANDLE.\r
727\r
728 @retval EFI_INVALID_PARAMETER Language is NULL.\r
729\r
730 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
731\r
732 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
733 managing the controller specified by\r
734 ControllerHandle and ChildHandle.\r
735\r
736 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
737 the language specified by Language.\r
738\r
739**/\r
95276127 740EFI_STATUS\r
741EFIAPI\r
742ConSplitterStdErrComponentNameGetControllerName (\r
743 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
744 IN EFI_HANDLE ControllerHandle,\r
745 IN EFI_HANDLE ChildHandle OPTIONAL,\r
746 IN CHAR8 *Language,\r
747 OUT CHAR16 **ControllerName\r
748 )\r
95276127 749{\r
750 EFI_STATUS Status;\r
95276127 751\r
b71f6b3c 752 Status = ConSplitterTestControllerHandles (\r
753 ControllerHandle,\r
754 gConSplitterStdErrDriverBinding.DriverBindingHandle,\r
755 &gEfiSimpleTextOutProtocolGuid,\r
756 ChildHandle,\r
757 &gEfiStandardErrorDeviceGuid\r
758 );\r
95276127 759 if (EFI_ERROR (Status)) {\r
b71f6b3c 760 return Status;\r
95276127 761 }\r
762\r
5bca971e 763 return LookupUnicodeString2 (\r
764 Language,\r
765 This->SupportedLanguages,\r
766 mConSplitterStdErrControllerNameTable,\r
767 ControllerName,\r
768 (BOOLEAN)(This == &gConSplitterStdErrComponentName)\r
769 );\r
95276127 770}\r