]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/ConSplitterDxe/ComponentName.c
add UsbMouseSimulateTouchPad driver to verify the correction of dispatching AbsoluteP...
[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 Retrieves a Unicode string that is the user readable name of the controller
239 that is being managed by a driver.
240
241 This function retrieves the user readable name of the controller specified by
242 ControllerHandle and ChildHandle in the form of a Unicode string. If the
243 driver specified by This has a user readable name in the language specified by
244 Language, then a pointer to the controller name is returned in ControllerName,
245 and EFI_SUCCESS is returned. If the driver specified by This is not currently
246 managing the controller specified by ControllerHandle and ChildHandle,
247 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
248 support the language specified by Language, then EFI_UNSUPPORTED is returned.
249
250 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
251 EFI_COMPONENT_NAME_PROTOCOL instance.
252
253 @param ControllerHandle[in] The handle of a controller that the driver
254 specified by This is managing. This handle
255 specifies the controller whose name is to be
256 returned.
257
258 @param ChildHandle[in] The handle of the child controller to retrieve
259 the name of. This is an optional parameter that
260 may be NULL. It will be NULL for device
261 drivers. It will also be NULL for a bus drivers
262 that wish to retrieve the name of the bus
263 controller. It will not be NULL for a bus
264 driver that wishes to retrieve the name of a
265 child controller.
266
267 @param Language[in] A pointer to a Null-terminated ASCII string
268 array indicating the language. This is the
269 language of the driver name that the caller is
270 requesting, and it must match one of the
271 languages specified in SupportedLanguages. The
272 number of languages supported by a driver is up
273 to the driver writer. Language is specified in
274 RFC 3066 or ISO 639-2 language code format.
275
276 @param ControllerName[out] A pointer to the Unicode string to return.
277 This Unicode string is the name of the
278 controller specified by ControllerHandle and
279 ChildHandle in the language specified by
280 Language from the point of view of the driver
281 specified by This.
282
283 @retval EFI_SUCCESS The Unicode string for the user readable name in
284 the language specified by Language for the
285 driver specified by This was returned in
286 DriverName.
287
288 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
289
290 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
291 EFI_HANDLE.
292
293 @retval EFI_INVALID_PARAMETER Language is NULL.
294
295 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
296
297 @retval EFI_UNSUPPORTED The driver specified by This is not currently
298 managing the controller specified by
299 ControllerHandle and ChildHandle.
300
301 @retval EFI_UNSUPPORTED The driver specified by This does not support
302 the language specified by Language.
303
304 **/
305 EFI_STATUS
306 EFIAPI
307 ConSplitterConInComponentNameGetControllerName (
308 IN EFI_COMPONENT_NAME_PROTOCOL *This,
309 IN EFI_HANDLE ControllerHandle,
310 IN EFI_HANDLE ChildHandle OPTIONAL,
311 IN CHAR8 *Language,
312 OUT CHAR16 **ControllerName
313 )
314 {
315 EFI_STATUS Status;
316 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
317 //
318 // here ChildHandle is not an Optional parameter.
319 //
320 if (ChildHandle == NULL) {
321 return EFI_UNSUPPORTED;
322 }
323
324 Status = gBS->OpenProtocol (
325 ControllerHandle,
326 &gEfiSimpleTextInProtocolGuid,
327 (VOID **) &TextIn,
328 NULL,
329 ControllerHandle,
330 EFI_OPEN_PROTOCOL_GET_PROTOCOL
331 );
332 if (EFI_ERROR (Status)) {
333 return EFI_UNSUPPORTED;
334 }
335
336 return LookupUnicodeString2 (
337 Language,
338 This->SupportedLanguages,
339 mConSplitterConInControllerNameTable,
340 ControllerName,
341 (BOOLEAN)(This == &gConSplitterConInComponentName)
342 );
343 }
344
345 /**
346 Retrieves a Unicode string that is the user readable name of the controller
347 that is being managed by a driver.
348
349 This function retrieves the user readable name of the controller specified by
350 ControllerHandle and ChildHandle in the form of a Unicode string. If the
351 driver specified by This has a user readable name in the language specified by
352 Language, then a pointer to the controller name is returned in ControllerName,
353 and EFI_SUCCESS is returned. If the driver specified by This is not currently
354 managing the controller specified by ControllerHandle and ChildHandle,
355 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
356 support the language specified by Language, then EFI_UNSUPPORTED is returned.
357
358 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
359 EFI_COMPONENT_NAME_PROTOCOL instance.
360
361 @param ControllerHandle[in] The handle of a controller that the driver
362 specified by This is managing. This handle
363 specifies the controller whose name is to be
364 returned.
365
366 @param ChildHandle[in] The handle of the child controller to retrieve
367 the name of. This is an optional parameter that
368 may be NULL. It will be NULL for device
369 drivers. It will also be NULL for a bus drivers
370 that wish to retrieve the name of the bus
371 controller. It will not be NULL for a bus
372 driver that wishes to retrieve the name of a
373 child controller.
374
375 @param Language[in] A pointer to a Null-terminated ASCII string
376 array indicating the language. This is the
377 language of the driver name that the caller is
378 requesting, and it must match one of the
379 languages specified in SupportedLanguages. The
380 number of languages supported by a driver is up
381 to the driver writer. Language is specified in
382 RFC 3066 or ISO 639-2 language code format.
383
384 @param ControllerName[out] A pointer to the Unicode string to return.
385 This Unicode string is the name of the
386 controller specified by ControllerHandle and
387 ChildHandle in the language specified by
388 Language from the point of view of the driver
389 specified by This.
390
391 @retval EFI_SUCCESS The Unicode string for the user readable name in
392 the language specified by Language for the
393 driver specified by This was returned in
394 DriverName.
395
396 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
397
398 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
399 EFI_HANDLE.
400
401 @retval EFI_INVALID_PARAMETER Language is NULL.
402
403 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
404
405 @retval EFI_UNSUPPORTED The driver specified by This is not currently
406 managing the controller specified by
407 ControllerHandle and ChildHandle.
408
409 @retval EFI_UNSUPPORTED The driver specified by This does not support
410 the language specified by Language.
411
412 **/
413 EFI_STATUS
414 EFIAPI
415 ConSplitterSimplePointerComponentNameGetControllerName (
416 IN EFI_COMPONENT_NAME_PROTOCOL *This,
417 IN EFI_HANDLE ControllerHandle,
418 IN EFI_HANDLE ChildHandle OPTIONAL,
419 IN CHAR8 *Language,
420 OUT CHAR16 **ControllerName
421 )
422 {
423 EFI_STATUS Status;
424 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;
425 //
426 // here ChildHandle is not an Optional parameter.
427 //
428 if (ChildHandle == NULL) {
429 return EFI_UNSUPPORTED;
430 }
431
432 Status = gBS->OpenProtocol (
433 ControllerHandle,
434 &gEfiSimplePointerProtocolGuid,
435 (VOID **) &SimplePointer,
436 NULL,
437 ControllerHandle,
438 EFI_OPEN_PROTOCOL_GET_PROTOCOL
439 );
440 if (EFI_ERROR (Status)) {
441 return EFI_UNSUPPORTED;
442 }
443
444 return LookupUnicodeString2 (
445 Language,
446 This->SupportedLanguages,
447 mConSplitterSimplePointerControllerNameTable,
448 ControllerName,
449 (BOOLEAN)(This == &gConSplitterSimplePointerComponentName)
450 );
451 }
452
453 EFI_STATUS
454 EFIAPI
455 ConSplitterAbsolutePointerComponentNameGetControllerName (
456 IN EFI_COMPONENT_NAME_PROTOCOL *This,
457 IN EFI_HANDLE ControllerHandle,
458 IN EFI_HANDLE ChildHandle OPTIONAL,
459 IN CHAR8 *Language,
460 OUT CHAR16 **ControllerName
461 )
462 /*++
463
464 Routine Description:
465 Retrieves a Unicode string that is the user readable name of the controller
466 that is being managed by an EFI Driver.
467
468 Arguments:
469 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
470 ControllerHandle - The handle of a controller that the driver specified by
471 This is managing. This handle specifies the controller
472 whose name is to be returned.
473 ChildHandle - The handle of the child controller to retrieve the name
474 of. This is an optional parameter that may be NULL. It
475 will be NULL for device drivers. It will also be NULL
476 for a bus drivers that wish to retrieve the name of the
477 bus controller. It will not be NULL for a bus driver
478 that wishes to retrieve the name of a child controller.
479 Language - A pointer to RFC3066 language identifier.
480 This is the language of the controller name
481 that that the caller is requesting, and it must match one
482 of the languages specified in SupportedLanguages. The
483 number of languages supported by a driver is up to the
484 driver writer.
485 ControllerName - A pointer to the Unicode string to return. This Unicode
486 string is the name of the controller specified by
487 ControllerHandle and ChildHandle in the language
488 specified by Language from the point of view of the
489 driver specified by This.
490
491 Returns:
492 EFI_SUCCESS - The Unicode string for the user readable name in the
493 language specified by Language for the driver
494 specified by This was returned in DriverName.
495 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
496 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
497 EFI_HANDLE.
498 EFI_INVALID_PARAMETER - Language is NULL.
499 EFI_INVALID_PARAMETER - ControllerName is NULL.
500 EFI_UNSUPPORTED - The driver specified by This is not currently
501 managing the controller specified by
502 ControllerHandle and ChildHandle.
503 EFI_UNSUPPORTED - The driver specified by This does not support the
504 language specified by Language.
505
506 --*/
507 {
508 EFI_STATUS Status;
509 EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;
510 //
511 // here ChildHandle is not an Optional parameter.
512 //
513 if (ChildHandle == NULL) {
514 return EFI_UNSUPPORTED;
515 }
516
517 Status = gBS->OpenProtocol (
518 ControllerHandle,
519 &gEfiAbsolutePointerProtocolGuid,
520 (VOID **) &AbsolutePointer,
521 NULL,
522 ControllerHandle,
523 EFI_OPEN_PROTOCOL_GET_PROTOCOL
524 );
525 if (EFI_ERROR (Status)) {
526 return EFI_UNSUPPORTED;
527 }
528
529 return LookupUnicodeString2 (
530 Language,
531 This->SupportedLanguages,
532 mConSplitterAbsolutePointerControllerNameTable,
533 ControllerName,
534 (BOOLEAN)(This == &gConSplitterAbsolutePointerComponentName)
535 );
536 }
537
538 /**
539 Retrieves a Unicode string that is the user readable name of the controller
540 that is being managed by a driver.
541
542 This function retrieves the user readable name of the controller specified by
543 ControllerHandle and ChildHandle in the form of a Unicode string. If the
544 driver specified by This has a user readable name in the language specified by
545 Language, then a pointer to the controller name is returned in ControllerName,
546 and EFI_SUCCESS is returned. If the driver specified by This is not currently
547 managing the controller specified by ControllerHandle and ChildHandle,
548 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
549 support the language specified by Language, then EFI_UNSUPPORTED is returned.
550
551 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
552 EFI_COMPONENT_NAME_PROTOCOL instance.
553
554 @param ControllerHandle[in] The handle of a controller that the driver
555 specified by This is managing. This handle
556 specifies the controller whose name is to be
557 returned.
558
559 @param ChildHandle[in] The handle of the child controller to retrieve
560 the name of. This is an optional parameter that
561 may be NULL. It will be NULL for device
562 drivers. It will also be NULL for a bus drivers
563 that wish to retrieve the name of the bus
564 controller. It will not be NULL for a bus
565 driver that wishes to retrieve the name of a
566 child controller.
567
568 @param Language[in] A pointer to a Null-terminated ASCII string
569 array indicating the language. This is the
570 language of the driver name that the caller is
571 requesting, and it must match one of the
572 languages specified in SupportedLanguages. The
573 number of languages supported by a driver is up
574 to the driver writer. Language is specified in
575 RFC 3066 or ISO 639-2 language code format.
576
577 @param ControllerName[out] A pointer to the Unicode string to return.
578 This Unicode string is the name of the
579 controller specified by ControllerHandle and
580 ChildHandle in the language specified by
581 Language from the point of view of the driver
582 specified by This.
583
584 @retval EFI_SUCCESS The Unicode string for the user readable name in
585 the language specified by Language for the
586 driver specified by This was returned in
587 DriverName.
588
589 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
590
591 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
592 EFI_HANDLE.
593
594 @retval EFI_INVALID_PARAMETER Language is NULL.
595
596 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
597
598 @retval EFI_UNSUPPORTED The driver specified by This is not currently
599 managing the controller specified by
600 ControllerHandle and ChildHandle.
601
602 @retval EFI_UNSUPPORTED The driver specified by This does not support
603 the language specified by Language.
604
605 **/
606 EFI_STATUS
607 EFIAPI
608 ConSplitterConOutComponentNameGetControllerName (
609 IN EFI_COMPONENT_NAME_PROTOCOL *This,
610 IN EFI_HANDLE ControllerHandle,
611 IN EFI_HANDLE ChildHandle OPTIONAL,
612 IN CHAR8 *Language,
613 OUT CHAR16 **ControllerName
614 )
615 {
616 EFI_STATUS Status;
617 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
618 //
619 // here ChildHandle is not an Optional parameter.
620 //
621 if (ChildHandle == NULL) {
622 return EFI_UNSUPPORTED;
623 }
624
625 Status = gBS->OpenProtocol (
626 ControllerHandle,
627 &gEfiSimpleTextOutProtocolGuid,
628 (VOID **) &TextOut,
629 NULL,
630 ControllerHandle,
631 EFI_OPEN_PROTOCOL_GET_PROTOCOL
632 );
633 if (EFI_ERROR (Status)) {
634 return EFI_UNSUPPORTED;
635 }
636
637 return LookupUnicodeString2 (
638 Language,
639 This->SupportedLanguages,
640 mConSplitterConOutControllerNameTable,
641 ControllerName,
642 (BOOLEAN)(This == &gConSplitterConOutComponentName)
643 );
644 }
645
646 /**
647 Retrieves a Unicode string that is the user readable name of the controller
648 that is being managed by a driver.
649
650 This function retrieves the user readable name of the controller specified by
651 ControllerHandle and ChildHandle in the form of a Unicode string. If the
652 driver specified by This has a user readable name in the language specified by
653 Language, then a pointer to the controller name is returned in ControllerName,
654 and EFI_SUCCESS is returned. If the driver specified by This is not currently
655 managing the controller specified by ControllerHandle and ChildHandle,
656 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
657 support the language specified by Language, then EFI_UNSUPPORTED is returned.
658
659 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
660 EFI_COMPONENT_NAME_PROTOCOL instance.
661
662 @param ControllerHandle[in] The handle of a controller that the driver
663 specified by This is managing. This handle
664 specifies the controller whose name is to be
665 returned.
666
667 @param ChildHandle[in] The handle of the child controller to retrieve
668 the name of. This is an optional parameter that
669 may be NULL. It will be NULL for device
670 drivers. It will also be NULL for a bus drivers
671 that wish to retrieve the name of the bus
672 controller. It will not be NULL for a bus
673 driver that wishes to retrieve the name of a
674 child controller.
675
676 @param Language[in] A pointer to a Null-terminated ASCII string
677 array indicating the language. This is the
678 language of the driver name that the caller is
679 requesting, and it must match one of the
680 languages specified in SupportedLanguages. The
681 number of languages supported by a driver is up
682 to the driver writer. Language is specified in
683 RFC 3066 or ISO 639-2 language code format.
684
685 @param ControllerName[out] A pointer to the Unicode string to return.
686 This Unicode string is the name of the
687 controller specified by ControllerHandle and
688 ChildHandle in the language specified by
689 Language from the point of view of the driver
690 specified by This.
691
692 @retval EFI_SUCCESS The Unicode string for the user readable name in
693 the language specified by Language for the
694 driver specified by This was returned in
695 DriverName.
696
697 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
698
699 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
700 EFI_HANDLE.
701
702 @retval EFI_INVALID_PARAMETER Language is NULL.
703
704 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
705
706 @retval EFI_UNSUPPORTED The driver specified by This is not currently
707 managing the controller specified by
708 ControllerHandle and ChildHandle.
709
710 @retval EFI_UNSUPPORTED The driver specified by This does not support
711 the language specified by Language.
712
713 **/
714 EFI_STATUS
715 EFIAPI
716 ConSplitterStdErrComponentNameGetControllerName (
717 IN EFI_COMPONENT_NAME_PROTOCOL *This,
718 IN EFI_HANDLE ControllerHandle,
719 IN EFI_HANDLE ChildHandle OPTIONAL,
720 IN CHAR8 *Language,
721 OUT CHAR16 **ControllerName
722 )
723 {
724 EFI_STATUS Status;
725 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ErrOut;
726 //
727 // here ChildHandle is not an Optional parameter.
728 //
729 if (ChildHandle == NULL) {
730 return EFI_UNSUPPORTED;
731 }
732
733 Status = gBS->OpenProtocol (
734 ControllerHandle,
735 &gEfiSimpleTextOutProtocolGuid,
736 (VOID **) &ErrOut,
737 NULL,
738 ControllerHandle,
739 EFI_OPEN_PROTOCOL_GET_PROTOCOL
740 );
741 if (EFI_ERROR (Status)) {
742 return EFI_UNSUPPORTED;
743 }
744
745 return LookupUnicodeString2 (
746 Language,
747 This->SupportedLanguages,
748 mConSplitterStdErrControllerNameTable,
749 ControllerName,
750 (BOOLEAN)(This == &gConSplitterStdErrComponentName)
751 );
752 }