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
,
61 // EFI Component Name Protocol
63 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName
= {
64 ConSplitterComponentNameGetDriverName
,
65 ConSplitterConOutComponentNameGetControllerName
,
70 // EFI Component Name 2 Protocol
72 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2
= {
73 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) ConSplitterComponentNameGetDriverName
,
74 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) ConSplitterConOutComponentNameGetControllerName
,
80 // EFI Component Name Protocol
82 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName
= {
83 ConSplitterComponentNameGetDriverName
,
84 ConSplitterStdErrComponentNameGetControllerName
,
89 // EFI Component Name 2 Protocol
91 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2
= {
92 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) ConSplitterComponentNameGetDriverName
,
93 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) ConSplitterStdErrComponentNameGetControllerName
,
98 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable
[] = {
101 (CHAR16
*) L
"Console Splitter Driver"
109 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable
[] = {
112 (CHAR16
*) L
"Primary Console Input Device"
120 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable
[] = {
123 (CHAR16
*) L
"Primary Simple Pointer Device"
131 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable
[] = {
134 (CHAR16
*) L
"Primary Console Output Device"
142 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable
[] = {
145 (CHAR16
*) L
"Primary Standard Error Device"
154 Retrieves a Unicode string that is the user readable name of the driver.
156 This function retrieves the user readable name of a driver in the form of a
157 Unicode string. If the driver specified by This has a user readable name in
158 the language specified by Language, then a pointer to the driver name is
159 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
160 by This does not support the language specified by Language,
161 then EFI_UNSUPPORTED is returned.
163 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
164 EFI_COMPONENT_NAME_PROTOCOL instance.
166 @param Language[in] A pointer to a Null-terminated ASCII string
167 array indicating the language. This is the
168 language of the driver name that the caller is
169 requesting, and it must match one of the
170 languages specified in SupportedLanguages. The
171 number of languages supported by a driver is up
172 to the driver writer. Language is specified
173 in RFC 3066 or ISO 639-2 language code format.
175 @param DriverName[out] A pointer to the Unicode string to return.
176 This Unicode string is the name of the
177 driver specified by This in the language
178 specified by Language.
180 @retval EFI_SUCCESS The Unicode string for the Driver specified by
181 This and the language specified by Language was
182 returned in DriverName.
184 @retval EFI_INVALID_PARAMETER Language is NULL.
186 @retval EFI_INVALID_PARAMETER DriverName is NULL.
188 @retval EFI_UNSUPPORTED The driver specified by This does not support
189 the language specified by Language.
194 ConSplitterComponentNameGetDriverName (
195 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
197 OUT CHAR16
**DriverName
200 return LookupUnicodeString2 (
202 This
->SupportedLanguages
,
203 mConSplitterDriverNameTable
,
205 (BOOLEAN
)(This
== &gConSplitterConInComponentName
)
210 Retrieves a Unicode string that is the user readable name of the controller
211 that is being managed by a driver.
213 This function retrieves the user readable name of the controller specified by
214 ControllerHandle and ChildHandle in the form of a Unicode string. If the
215 driver specified by This has a user readable name in the language specified by
216 Language, then a pointer to the controller name is returned in ControllerName,
217 and EFI_SUCCESS is returned. If the driver specified by This is not currently
218 managing the controller specified by ControllerHandle and ChildHandle,
219 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
220 support the language specified by Language, then EFI_UNSUPPORTED is returned.
222 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
223 EFI_COMPONENT_NAME_PROTOCOL instance.
225 @param ControllerHandle[in] The handle of a controller that the driver
226 specified by This is managing. This handle
227 specifies the controller whose name is to be
230 @param ChildHandle[in] The handle of the child controller to retrieve
231 the name of. This is an optional parameter that
232 may be NULL. It will be NULL for device
233 drivers. It will also be NULL for a bus drivers
234 that wish to retrieve the name of the bus
235 controller. It will not be NULL for a bus
236 driver that wishes to retrieve the name of a
239 @param Language[in] A pointer to a Null-terminated ASCII string
240 array indicating the language. This is the
241 language of the driver name that the caller is
242 requesting, and it must match one of the
243 languages specified in SupportedLanguages. The
244 number of languages supported by a driver is up
245 to the driver writer. Language is specified in
246 RFC 3066 or ISO 639-2 language code format.
248 @param ControllerName[out] A pointer to the Unicode string to return.
249 This Unicode string is the name of the
250 controller specified by ControllerHandle and
251 ChildHandle in the language specified by
252 Language from the point of view of the driver
255 @retval EFI_SUCCESS The Unicode string for the user readable name in
256 the language specified by Language for the
257 driver specified by This was returned in
260 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
262 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
265 @retval EFI_INVALID_PARAMETER Language is NULL.
267 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
269 @retval EFI_UNSUPPORTED The driver specified by This is not currently
270 managing the controller specified by
271 ControllerHandle and ChildHandle.
273 @retval EFI_UNSUPPORTED The driver specified by This does not support
274 the language specified by Language.
279 ConSplitterConInComponentNameGetControllerName (
280 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
281 IN EFI_HANDLE ControllerHandle
,
282 IN EFI_HANDLE ChildHandle OPTIONAL
,
284 OUT CHAR16
**ControllerName
288 EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*TextIn
;
290 // here ChildHandle is not an Optional parameter.
292 if (ChildHandle
== NULL
) {
293 return EFI_UNSUPPORTED
;
296 Status
= gBS
->OpenProtocol (
298 &gEfiSimpleTextInProtocolGuid
,
302 EFI_OPEN_PROTOCOL_GET_PROTOCOL
304 if (EFI_ERROR (Status
)) {
305 return EFI_UNSUPPORTED
;
308 return LookupUnicodeString2 (
310 This
->SupportedLanguages
,
311 mConSplitterConInControllerNameTable
,
313 (BOOLEAN
)(This
== &gConSplitterConInComponentName
)
318 Retrieves a Unicode string that is the user readable name of the controller
319 that is being managed by a driver.
321 This function retrieves the user readable name of the controller specified by
322 ControllerHandle and ChildHandle in the form of a Unicode string. If the
323 driver specified by This has a user readable name in the language specified by
324 Language, then a pointer to the controller name is returned in ControllerName,
325 and EFI_SUCCESS is returned. If the driver specified by This is not currently
326 managing the controller specified by ControllerHandle and ChildHandle,
327 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
328 support the language specified by Language, then EFI_UNSUPPORTED is returned.
330 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
331 EFI_COMPONENT_NAME_PROTOCOL instance.
333 @param ControllerHandle[in] The handle of a controller that the driver
334 specified by This is managing. This handle
335 specifies the controller whose name is to be
338 @param ChildHandle[in] The handle of the child controller to retrieve
339 the name of. This is an optional parameter that
340 may be NULL. It will be NULL for device
341 drivers. It will also be NULL for a bus drivers
342 that wish to retrieve the name of the bus
343 controller. It will not be NULL for a bus
344 driver that wishes to retrieve the name of a
347 @param Language[in] A pointer to a Null-terminated ASCII string
348 array indicating the language. This is the
349 language of the driver name that the caller is
350 requesting, and it must match one of the
351 languages specified in SupportedLanguages. The
352 number of languages supported by a driver is up
353 to the driver writer. Language is specified in
354 RFC 3066 or ISO 639-2 language code format.
356 @param ControllerName[out] A pointer to the Unicode string to return.
357 This Unicode string is the name of the
358 controller specified by ControllerHandle and
359 ChildHandle in the language specified by
360 Language from the point of view of the driver
363 @retval EFI_SUCCESS The Unicode string for the user readable name in
364 the language specified by Language for the
365 driver specified by This was returned in
368 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
370 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
373 @retval EFI_INVALID_PARAMETER Language is NULL.
375 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
377 @retval EFI_UNSUPPORTED The driver specified by This is not currently
378 managing the controller specified by
379 ControllerHandle and ChildHandle.
381 @retval EFI_UNSUPPORTED The driver specified by This does not support
382 the language specified by Language.
387 ConSplitterSimplePointerComponentNameGetControllerName (
388 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
389 IN EFI_HANDLE ControllerHandle
,
390 IN EFI_HANDLE ChildHandle OPTIONAL
,
392 OUT CHAR16
**ControllerName
396 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointer
;
398 // here ChildHandle is not an Optional parameter.
400 if (ChildHandle
== NULL
) {
401 return EFI_UNSUPPORTED
;
404 Status
= gBS
->OpenProtocol (
406 &gEfiSimplePointerProtocolGuid
,
407 (VOID
**) &SimplePointer
,
410 EFI_OPEN_PROTOCOL_GET_PROTOCOL
412 if (EFI_ERROR (Status
)) {
413 return EFI_UNSUPPORTED
;
416 return LookupUnicodeString2 (
418 This
->SupportedLanguages
,
419 mConSplitterSimplePointerControllerNameTable
,
421 (BOOLEAN
)(This
== &gConSplitterSimplePointerComponentName
)
426 Retrieves a Unicode string that is the user readable name of the controller
427 that is being managed by a driver.
429 This function retrieves the user readable name of the controller specified by
430 ControllerHandle and ChildHandle in the form of a Unicode string. If the
431 driver specified by This has a user readable name in the language specified by
432 Language, then a pointer to the controller name is returned in ControllerName,
433 and EFI_SUCCESS is returned. If the driver specified by This is not currently
434 managing the controller specified by ControllerHandle and ChildHandle,
435 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
436 support the language specified by Language, then EFI_UNSUPPORTED is returned.
438 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
439 EFI_COMPONENT_NAME_PROTOCOL instance.
441 @param ControllerHandle[in] The handle of a controller that the driver
442 specified by This is managing. This handle
443 specifies the controller whose name is to be
446 @param ChildHandle[in] The handle of the child controller to retrieve
447 the name of. This is an optional parameter that
448 may be NULL. It will be NULL for device
449 drivers. It will also be NULL for a bus drivers
450 that wish to retrieve the name of the bus
451 controller. It will not be NULL for a bus
452 driver that wishes to retrieve the name of a
455 @param Language[in] A pointer to a Null-terminated ASCII string
456 array indicating the language. This is the
457 language of the driver name that the caller is
458 requesting, and it must match one of the
459 languages specified in SupportedLanguages. The
460 number of languages supported by a driver is up
461 to the driver writer. Language is specified in
462 RFC 3066 or ISO 639-2 language code format.
464 @param ControllerName[out] A pointer to the Unicode string to return.
465 This Unicode string is the name of the
466 controller specified by ControllerHandle and
467 ChildHandle in the language specified by
468 Language from the point of view of the driver
471 @retval EFI_SUCCESS The Unicode string for the user readable name in
472 the language specified by Language for the
473 driver specified by This was returned in
476 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
478 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
481 @retval EFI_INVALID_PARAMETER Language is NULL.
483 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
485 @retval EFI_UNSUPPORTED The driver specified by This is not currently
486 managing the controller specified by
487 ControllerHandle and ChildHandle.
489 @retval EFI_UNSUPPORTED The driver specified by This does not support
490 the language specified by Language.
495 ConSplitterConOutComponentNameGetControllerName (
496 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
497 IN EFI_HANDLE ControllerHandle
,
498 IN EFI_HANDLE ChildHandle OPTIONAL
,
500 OUT CHAR16
**ControllerName
504 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*TextOut
;
506 // here ChildHandle is not an Optional parameter.
508 if (ChildHandle
== NULL
) {
509 return EFI_UNSUPPORTED
;
512 Status
= gBS
->OpenProtocol (
514 &gEfiSimpleTextOutProtocolGuid
,
518 EFI_OPEN_PROTOCOL_GET_PROTOCOL
520 if (EFI_ERROR (Status
)) {
521 return EFI_UNSUPPORTED
;
524 return LookupUnicodeString2 (
526 This
->SupportedLanguages
,
527 mConSplitterConOutControllerNameTable
,
529 (BOOLEAN
)(This
== &gConSplitterConOutComponentName
)
534 Retrieves a Unicode string that is the user readable name of the controller
535 that is being managed by a driver.
537 This function retrieves the user readable name of the controller specified by
538 ControllerHandle and ChildHandle in the form of a Unicode string. If the
539 driver specified by This has a user readable name in the language specified by
540 Language, then a pointer to the controller name is returned in ControllerName,
541 and EFI_SUCCESS is returned. If the driver specified by This is not currently
542 managing the controller specified by ControllerHandle and ChildHandle,
543 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
544 support the language specified by Language, then EFI_UNSUPPORTED is returned.
546 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
547 EFI_COMPONENT_NAME_PROTOCOL instance.
549 @param ControllerHandle[in] The handle of a controller that the driver
550 specified by This is managing. This handle
551 specifies the controller whose name is to be
554 @param ChildHandle[in] The handle of the child controller to retrieve
555 the name of. This is an optional parameter that
556 may be NULL. It will be NULL for device
557 drivers. It will also be NULL for a bus drivers
558 that wish to retrieve the name of the bus
559 controller. It will not be NULL for a bus
560 driver that wishes to retrieve the name of a
563 @param Language[in] A pointer to a Null-terminated ASCII string
564 array indicating the language. This is the
565 language of the driver name that the caller is
566 requesting, and it must match one of the
567 languages specified in SupportedLanguages. The
568 number of languages supported by a driver is up
569 to the driver writer. Language is specified in
570 RFC 3066 or ISO 639-2 language code format.
572 @param ControllerName[out] A pointer to the Unicode string to return.
573 This Unicode string is the name of the
574 controller specified by ControllerHandle and
575 ChildHandle in the language specified by
576 Language from the point of view of the driver
579 @retval EFI_SUCCESS The Unicode string for the user readable name in
580 the language specified by Language for the
581 driver specified by This was returned in
584 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
586 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
589 @retval EFI_INVALID_PARAMETER Language is NULL.
591 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
593 @retval EFI_UNSUPPORTED The driver specified by This is not currently
594 managing the controller specified by
595 ControllerHandle and ChildHandle.
597 @retval EFI_UNSUPPORTED The driver specified by This does not support
598 the language specified by Language.
603 ConSplitterStdErrComponentNameGetControllerName (
604 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
605 IN EFI_HANDLE ControllerHandle
,
606 IN EFI_HANDLE ChildHandle OPTIONAL
,
608 OUT CHAR16
**ControllerName
612 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ErrOut
;
614 // here ChildHandle is not an Optional parameter.
616 if (ChildHandle
== NULL
) {
617 return EFI_UNSUPPORTED
;
620 Status
= gBS
->OpenProtocol (
622 &gEfiSimpleTextOutProtocolGuid
,
626 EFI_OPEN_PROTOCOL_GET_PROTOCOL
628 if (EFI_ERROR (Status
)) {
629 return EFI_UNSUPPORTED
;
632 return LookupUnicodeString2 (
634 This
->SupportedLanguages
,
635 mConSplitterStdErrControllerNameTable
,
637 (BOOLEAN
)(This
== &gConSplitterStdErrComponentName
)