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