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
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.
20 #include "ConSplitter.h"
23 // EFI Component Name Protocol
25 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName
= {
26 ConSplitterComponentNameGetDriverName
,
27 ConSplitterConInComponentNameGetControllerName
,
32 // EFI Component Name 2 Protocol
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
,
42 // EFI Component Name Protocol
44 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName
= {
45 ConSplitterComponentNameGetDriverName
,
46 ConSplitterSimplePointerComponentNameGetControllerName
,
51 // EFI Component Name 2 Protocol
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
,
60 // EFI Component Name Protocol
62 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName
= {
63 ConSplitterComponentNameGetDriverName
,
64 ConSplitterAbsolutePointerComponentNameGetControllerName
,
69 // EFI Component Name 2 Protocol
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
,
78 // EFI Component Name Protocol
80 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName
= {
81 ConSplitterComponentNameGetDriverName
,
82 ConSplitterConOutComponentNameGetControllerName
,
87 // EFI Component Name 2 Protocol
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
,
97 // EFI Component Name Protocol
99 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName
= {
100 ConSplitterComponentNameGetDriverName
,
101 ConSplitterStdErrComponentNameGetControllerName
,
106 // EFI Component Name 2 Protocol
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
,
115 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable
[] = {
118 (CHAR16
*) L
"Console Splitter Driver"
126 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable
[] = {
129 (CHAR16
*) L
"Primary Console Input Device"
137 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable
[] = {
140 (CHAR16
*) L
"Primary Simple Pointer Device"
148 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable
[] = {
151 (CHAR16
*)L
"Primary Absolute Pointer Device"
159 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable
[] = {
162 (CHAR16
*) L
"Primary Console Output Device"
170 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable
[] = {
173 (CHAR16
*) L
"Primary Standard Error Device"
182 Retrieves a Unicode string that is the user readable name of the driver.
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.
191 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
192 EFI_COMPONENT_NAME_PROTOCOL instance.
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.
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.
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.
212 @retval EFI_INVALID_PARAMETER Language is NULL.
214 @retval EFI_INVALID_PARAMETER DriverName is NULL.
216 @retval EFI_UNSUPPORTED The driver specified by This does not support
217 the language specified by Language.
222 ConSplitterComponentNameGetDriverName (
223 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
225 OUT CHAR16
**DriverName
228 return LookupUnicodeString2 (
230 This
->SupportedLanguages
,
231 mConSplitterDriverNameTable
,
233 (BOOLEAN
)(This
== &gConSplitterConInComponentName
)
238 Retrieves a Unicode string that is the user readable name of the controller
239 that is being managed by a driver.
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.
250 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
251 EFI_COMPONENT_NAME_PROTOCOL instance.
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
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
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.
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
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
288 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
290 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
293 @retval EFI_INVALID_PARAMETER Language is NULL.
295 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
297 @retval EFI_UNSUPPORTED The driver specified by This is not currently
298 managing the controller specified by
299 ControllerHandle and ChildHandle.
301 @retval EFI_UNSUPPORTED The driver specified by This does not support
302 the language specified by Language.
307 ConSplitterConInComponentNameGetControllerName (
308 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
309 IN EFI_HANDLE ControllerHandle
,
310 IN EFI_HANDLE ChildHandle OPTIONAL
,
312 OUT CHAR16
**ControllerName
316 EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*TextIn
;
318 // here ChildHandle is not an Optional parameter.
320 if (ChildHandle
== NULL
) {
321 return EFI_UNSUPPORTED
;
324 Status
= gBS
->OpenProtocol (
326 &gEfiSimpleTextInProtocolGuid
,
330 EFI_OPEN_PROTOCOL_GET_PROTOCOL
332 if (EFI_ERROR (Status
)) {
333 return EFI_UNSUPPORTED
;
336 return LookupUnicodeString2 (
338 This
->SupportedLanguages
,
339 mConSplitterConInControllerNameTable
,
341 (BOOLEAN
)(This
== &gConSplitterConInComponentName
)
346 Retrieves a Unicode string that is the user readable name of the controller
347 that is being managed by a driver.
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.
358 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
359 EFI_COMPONENT_NAME_PROTOCOL instance.
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
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
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.
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
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
396 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
398 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
401 @retval EFI_INVALID_PARAMETER Language is NULL.
403 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
405 @retval EFI_UNSUPPORTED The driver specified by This is not currently
406 managing the controller specified by
407 ControllerHandle and ChildHandle.
409 @retval EFI_UNSUPPORTED The driver specified by This does not support
410 the language specified by Language.
415 ConSplitterSimplePointerComponentNameGetControllerName (
416 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
417 IN EFI_HANDLE ControllerHandle
,
418 IN EFI_HANDLE ChildHandle OPTIONAL
,
420 OUT CHAR16
**ControllerName
424 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointer
;
426 // here ChildHandle is not an Optional parameter.
428 if (ChildHandle
== NULL
) {
429 return EFI_UNSUPPORTED
;
432 Status
= gBS
->OpenProtocol (
434 &gEfiSimplePointerProtocolGuid
,
435 (VOID
**) &SimplePointer
,
438 EFI_OPEN_PROTOCOL_GET_PROTOCOL
440 if (EFI_ERROR (Status
)) {
441 return EFI_UNSUPPORTED
;
444 return LookupUnicodeString2 (
446 This
->SupportedLanguages
,
447 mConSplitterSimplePointerControllerNameTable
,
449 (BOOLEAN
)(This
== &gConSplitterSimplePointerComponentName
)
455 ConSplitterAbsolutePointerComponentNameGetControllerName (
456 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
457 IN EFI_HANDLE ControllerHandle
,
458 IN EFI_HANDLE ChildHandle OPTIONAL
,
460 OUT CHAR16
**ControllerName
465 Retrieves a Unicode string that is the user readable name of the controller
466 that is being managed by an EFI Driver.
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
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.
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
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.
509 EFI_ABSOLUTE_POINTER_PROTOCOL
*AbsolutePointer
;
511 // here ChildHandle is not an Optional parameter.
513 if (ChildHandle
== NULL
) {
514 return EFI_UNSUPPORTED
;
517 Status
= gBS
->OpenProtocol (
519 &gEfiAbsolutePointerProtocolGuid
,
520 (VOID
**) &AbsolutePointer
,
523 EFI_OPEN_PROTOCOL_GET_PROTOCOL
525 if (EFI_ERROR (Status
)) {
526 return EFI_UNSUPPORTED
;
529 return LookupUnicodeString2 (
531 This
->SupportedLanguages
,
532 mConSplitterAbsolutePointerControllerNameTable
,
534 (BOOLEAN
)(This
== &gConSplitterAbsolutePointerComponentName
)
539 Retrieves a Unicode string that is the user readable name of the controller
540 that is being managed by a driver.
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.
551 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
552 EFI_COMPONENT_NAME_PROTOCOL instance.
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
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
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.
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
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
589 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
591 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
594 @retval EFI_INVALID_PARAMETER Language is NULL.
596 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
598 @retval EFI_UNSUPPORTED The driver specified by This is not currently
599 managing the controller specified by
600 ControllerHandle and ChildHandle.
602 @retval EFI_UNSUPPORTED The driver specified by This does not support
603 the language specified by Language.
608 ConSplitterConOutComponentNameGetControllerName (
609 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
610 IN EFI_HANDLE ControllerHandle
,
611 IN EFI_HANDLE ChildHandle OPTIONAL
,
613 OUT CHAR16
**ControllerName
617 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*TextOut
;
619 // here ChildHandle is not an Optional parameter.
621 if (ChildHandle
== NULL
) {
622 return EFI_UNSUPPORTED
;
625 Status
= gBS
->OpenProtocol (
627 &gEfiSimpleTextOutProtocolGuid
,
631 EFI_OPEN_PROTOCOL_GET_PROTOCOL
633 if (EFI_ERROR (Status
)) {
634 return EFI_UNSUPPORTED
;
637 return LookupUnicodeString2 (
639 This
->SupportedLanguages
,
640 mConSplitterConOutControllerNameTable
,
642 (BOOLEAN
)(This
== &gConSplitterConOutComponentName
)
647 Retrieves a Unicode string that is the user readable name of the controller
648 that is being managed by a driver.
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.
659 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
660 EFI_COMPONENT_NAME_PROTOCOL instance.
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
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
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.
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
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
697 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
699 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
702 @retval EFI_INVALID_PARAMETER Language is NULL.
704 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
706 @retval EFI_UNSUPPORTED The driver specified by This is not currently
707 managing the controller specified by
708 ControllerHandle and ChildHandle.
710 @retval EFI_UNSUPPORTED The driver specified by This does not support
711 the language specified by Language.
716 ConSplitterStdErrComponentNameGetControllerName (
717 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
718 IN EFI_HANDLE ControllerHandle
,
719 IN EFI_HANDLE ChildHandle OPTIONAL
,
721 OUT CHAR16
**ControllerName
725 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ErrOut
;
727 // here ChildHandle is not an Optional parameter.
729 if (ChildHandle
== NULL
) {
730 return EFI_UNSUPPORTED
;
733 Status
= gBS
->OpenProtocol (
735 &gEfiSimpleTextOutProtocolGuid
,
739 EFI_OPEN_PROTOCOL_GET_PROTOCOL
741 if (EFI_ERROR (Status
)) {
742 return EFI_UNSUPPORTED
;
745 return LookupUnicodeString2 (
747 This
->SupportedLanguages
,
748 mConSplitterStdErrControllerNameTable
,
750 (BOOLEAN
)(This
== &gConSplitterStdErrComponentName
)