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