]> git.proxmox.com Git - mirror_edk2.git/blob - 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
1 /** @file
2 UEFI Component Name(2) protocol implementation for ConSplitter driver.
3
4 Copyright (c) 2006, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "ConSplitter.h"
16
17 //
18 // EFI Component Name Protocol
19 //
20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName = {
21 ConSplitterComponentNameGetDriverName,
22 ConSplitterConInComponentNameGetControllerName,
23 "eng"
24 };
25
26 //
27 // EFI Component Name 2 Protocol
28 //
29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2 = {
30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConInComponentNameGetControllerName,
32 "en"
33 };
34
35
36 //
37 // EFI Component Name Protocol
38 //
39 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName = {
40 ConSplitterComponentNameGetDriverName,
41 ConSplitterSimplePointerComponentNameGetControllerName,
42 "eng"
43 };
44
45 //
46 // EFI Component Name 2 Protocol
47 //
48 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2 = {
49 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
50 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterSimplePointerComponentNameGetControllerName,
51 "en"
52 };
53
54 //
55 // EFI Component Name Protocol
56 //
57 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {
58 ConSplitterComponentNameGetDriverName,
59 ConSplitterAbsolutePointerComponentNameGetControllerName,
60 "eng"
61 };
62
63 //
64 // EFI Component Name 2 Protocol
65 //
66 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {
67 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
68 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterAbsolutePointerComponentNameGetControllerName,
69 "en"
70 };
71
72 //
73 // EFI Component Name Protocol
74 //
75 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName = {
76 ConSplitterComponentNameGetDriverName,
77 ConSplitterConOutComponentNameGetControllerName,
78 "eng"
79 };
80
81 //
82 // EFI Component Name 2 Protocol
83 //
84 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2 = {
85 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
86 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConOutComponentNameGetControllerName,
87 "en"
88 };
89
90
91 //
92 // EFI Component Name Protocol
93 //
94 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName = {
95 ConSplitterComponentNameGetDriverName,
96 ConSplitterStdErrComponentNameGetControllerName,
97 "eng"
98 };
99
100 //
101 // EFI Component Name 2 Protocol
102 //
103 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2 = {
104 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
105 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterStdErrComponentNameGetControllerName,
106 "en"
107 };
108
109
110 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {
111 {
112 "eng;en",
113 (CHAR16 *) L"Console Splitter Driver"
114 },
115 {
116 NULL,
117 NULL
118 }
119 };
120
121 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {
122 {
123 "eng;en",
124 (CHAR16 *) L"Primary Console Input Device"
125 },
126 {
127 NULL,
128 NULL
129 }
130 };
131
132 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {
133 {
134 "eng;en",
135 (CHAR16 *) L"Primary Simple Pointer Device"
136 },
137 {
138 NULL,
139 NULL
140 }
141 };
142
143 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {
144 {
145 "eng;en",
146 (CHAR16 *)L"Primary Absolute Pointer Device"
147 },
148 {
149 NULL,
150 NULL
151 }
152 };
153
154 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
155 {
156 "eng;en",
157 (CHAR16 *) L"Primary Console Output Device"
158 },
159 {
160 NULL,
161 NULL
162 }
163 };
164
165 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {
166 {
167 "eng;en",
168 (CHAR16 *) L"Primary Standard Error Device"
169 },
170 {
171 NULL,
172 NULL
173 }
174 };
175
176 /**
177 Retrieves a Unicode string that is the user readable name of the driver.
178
179 This function retrieves the user readable name of a driver in the form of a
180 Unicode string. If the driver specified by This has a user readable name in
181 the language specified by Language, then a pointer to the driver name is
182 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
183 by This does not support the language specified by Language,
184 then EFI_UNSUPPORTED is returned.
185
186 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
187 EFI_COMPONENT_NAME_PROTOCOL instance.
188
189 @param Language[in] A pointer to a Null-terminated ASCII string
190 array indicating the language. This is the
191 language of the driver name that the caller is
192 requesting, and it must match one of the
193 languages specified in SupportedLanguages. The
194 number of languages supported by a driver is up
195 to the driver writer. Language is specified
196 in RFC 3066 or ISO 639-2 language code format.
197
198 @param DriverName[out] A pointer to the Unicode string to return.
199 This Unicode string is the name of the
200 driver specified by This in the language
201 specified by Language.
202
203 @retval EFI_SUCCESS The Unicode string for the Driver specified by
204 This and the language specified by Language was
205 returned in DriverName.
206
207 @retval EFI_INVALID_PARAMETER Language is NULL.
208
209 @retval EFI_INVALID_PARAMETER DriverName is NULL.
210
211 @retval EFI_UNSUPPORTED The driver specified by This does not support
212 the language specified by Language.
213
214 **/
215 EFI_STATUS
216 EFIAPI
217 ConSplitterComponentNameGetDriverName (
218 IN EFI_COMPONENT_NAME_PROTOCOL *This,
219 IN CHAR8 *Language,
220 OUT CHAR16 **DriverName
221 )
222 {
223 return LookupUnicodeString2 (
224 Language,
225 This->SupportedLanguages,
226 mConSplitterDriverNameTable,
227 DriverName,
228 (BOOLEAN)((This == &gConSplitterConInComponentName) ||
229 (This == &gConSplitterSimplePointerComponentName) ||
230 (This == &gConSplitterAbsolutePointerComponentName) ||
231 (This == &gConSplitterConOutComponentName) ||
232 (This == &gConSplitterStdErrComponentName))
233 );
234 }
235
236 /**
237 Tests whether a controller handle is being managed by a specific driver and
238 the child handle is a child device of the controller.
239
240 @param ControllerHandle A handle for a controller to test.
241 @param DriverBindingHandle Specifies the driver binding handle for the
242 driver.
243 @param ProtocolGuid Specifies the protocol that the driver specified
244 by DriverBindingHandle opens in its Start()
245 function.
246 @param ChildHandle A child handle to test.
247 @param ConsumsedGuid Supplies the protocol that the child controller
248 opens on its parent controller.
249
250 @retval EFI_SUCCESS ControllerHandle is managed by the driver
251 specifed by DriverBindingHandle and ChildHandle
252 is a child of the ControllerHandle.
253 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
254 specifed by DriverBindingHandle.
255 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
256 ControllerHandle.
257
258 **/
259 EFI_STATUS
260 ConSplitterTestControllerHandles (
261 IN CONST EFI_HANDLE ControllerHandle,
262 IN CONST EFI_HANDLE DriverBindingHandle,
263 IN CONST EFI_GUID *ProtocolGuid,
264 IN EFI_HANDLE ChildHandle,
265 IN CONST EFI_GUID *ConsumsedGuid
266 )
267 {
268 EFI_STATUS Status;
269
270 //
271 // here ChildHandle is not an Optional parameter.
272 //
273 if (ChildHandle == NULL) {
274 return EFI_UNSUPPORTED;
275 }
276
277 Status = EfiTestManagedDevice (
278 ControllerHandle,
279 DriverBindingHandle,
280 ProtocolGuid
281 );
282 if (EFI_ERROR (Status)) {
283 return Status;
284 }
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 3066 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 not a valid EFI_HANDLE.
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 &gEfiSimpleTextInProtocolGuid,
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 3066 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 not a valid EFI_HANDLE.
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 EFI_STATUS
496 EFIAPI
497 ConSplitterAbsolutePointerComponentNameGetControllerName (
498 IN EFI_COMPONENT_NAME_PROTOCOL *This,
499 IN EFI_HANDLE ControllerHandle,
500 IN EFI_HANDLE ChildHandle OPTIONAL,
501 IN CHAR8 *Language,
502 OUT CHAR16 **ControllerName
503 )
504 /*++
505
506 Routine Description:
507 Retrieves a Unicode string that is the user readable name of the controller
508 that is being managed by an EFI Driver.
509
510 Arguments:
511 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
512 ControllerHandle - The handle of a controller that the driver specified by
513 This is managing. This handle specifies the controller
514 whose name is to be returned.
515 ChildHandle - The handle of the child controller to retrieve the name
516 of. This is an optional parameter that may be NULL. It
517 will be NULL for device drivers. It will also be NULL
518 for a bus drivers that wish to retrieve the name of the
519 bus controller. It will not be NULL for a bus driver
520 that wishes to retrieve the name of a child controller.
521 Language - A pointer to RFC3066 language identifier.
522 This is the language of the controller name
523 that that the caller is requesting, and it must match one
524 of the languages specified in SupportedLanguages. The
525 number of languages supported by a driver is up to the
526 driver writer.
527 ControllerName - A pointer to the Unicode string to return. This Unicode
528 string is the name of the controller specified by
529 ControllerHandle and ChildHandle in the language
530 specified by Language from the point of view of the
531 driver specified by This.
532
533 Returns:
534 EFI_SUCCESS - The Unicode string for the user readable name in the
535 language specified by Language for the driver
536 specified by This was returned in DriverName.
537 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
538 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
539 EFI_HANDLE.
540 EFI_INVALID_PARAMETER - Language is NULL.
541 EFI_INVALID_PARAMETER - ControllerName is NULL.
542 EFI_UNSUPPORTED - The driver specified by This is not currently
543 managing the controller specified by
544 ControllerHandle and ChildHandle.
545 EFI_UNSUPPORTED - The driver specified by This does not support the
546 language specified by Language.
547
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 3066 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 not a valid EFI_HANDLE.
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 &gEfiSimpleTextOutProtocolGuid,
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 3066 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 not a valid EFI_HANDLE.
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 &gEfiSimpleTextOutProtocolGuid,
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 }