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