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 Functions
27 ConSplitterComponentNameGetDriverName (
28 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
30 OUT CHAR16
**DriverName
35 ConSplitterConInComponentNameGetControllerName (
36 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
37 IN EFI_HANDLE ControllerHandle
,
38 IN EFI_HANDLE ChildHandle OPTIONAL
,
40 OUT CHAR16
**ControllerName
45 ConSplitterSimplePointerComponentNameGetControllerName (
46 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
47 IN EFI_HANDLE ControllerHandle
,
48 IN EFI_HANDLE ChildHandle OPTIONAL
,
50 OUT CHAR16
**ControllerName
55 ConSplitterConOutComponentNameGetControllerName (
56 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
57 IN EFI_HANDLE ControllerHandle
,
58 IN EFI_HANDLE ChildHandle OPTIONAL
,
60 OUT CHAR16
**ControllerName
65 ConSplitterStdErrComponentNameGetControllerName (
66 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
67 IN EFI_HANDLE ControllerHandle
,
68 IN EFI_HANDLE ChildHandle OPTIONAL
,
70 OUT CHAR16
**ControllerName
74 // EFI Component Name Protocol
76 EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName
= {
77 ConSplitterComponentNameGetDriverName
,
78 ConSplitterConInComponentNameGetControllerName
,
82 EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName
= {
83 ConSplitterComponentNameGetDriverName
,
84 ConSplitterSimplePointerComponentNameGetControllerName
,
88 EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName
= {
89 ConSplitterComponentNameGetDriverName
,
90 ConSplitterConOutComponentNameGetControllerName
,
94 EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName
= {
95 ConSplitterComponentNameGetDriverName
,
96 ConSplitterStdErrComponentNameGetControllerName
,
100 static EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable
[] = {
103 (CHAR16
*) L
"Console Splitter Driver"
111 static EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable
[] = {
114 (CHAR16
*) L
"Primary Console Input Device"
122 static EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable
[] = {
125 (CHAR16
*) L
"Primary Simple Pointer Device"
133 static EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable
[] = {
136 (CHAR16
*) L
"Primary Console Output Device"
144 static EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable
[] = {
147 (CHAR16
*) L
"Primary Standard Error Device"
157 ConSplitterComponentNameGetDriverName (
158 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
160 OUT CHAR16
**DriverName
165 Retrieves a Unicode string that is the user readable name of the EFI Driver.
168 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
169 Language - A pointer to a three character ISO 639-2 language identifier.
170 This is the language of the driver name that that the caller
171 is requesting, and it must match one of the languages specified
172 in SupportedLanguages. The number of languages supported by a
173 driver is up to the driver writer.
174 DriverName - A pointer to the Unicode string to return. This Unicode string
175 is the name of the driver specified by This in the language
176 specified by Language.
179 EFI_SUCCESS - The Unicode string for the Driver specified by This
180 and the language specified by Language was returned
182 EFI_INVALID_PARAMETER - Language is NULL.
183 EFI_INVALID_PARAMETER - DriverName is NULL.
184 EFI_UNSUPPORTED - The driver specified by This does not support the
185 language specified by Language.
189 return LookupUnicodeString (
191 gConSplitterConInComponentName
.SupportedLanguages
,
192 mConSplitterDriverNameTable
,
199 ConSplitterConInComponentNameGetControllerName (
200 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
201 IN EFI_HANDLE ControllerHandle
,
202 IN EFI_HANDLE ChildHandle OPTIONAL
,
204 OUT CHAR16
**ControllerName
209 Retrieves a Unicode string that is the user readable name of the controller
210 that is being managed by an EFI Driver.
213 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
214 ControllerHandle - The handle of a controller that the driver specified by
215 This is managing. This handle specifies the controller
216 whose name is to be returned.
217 ChildHandle - The handle of the child controller to retrieve the name
218 of. This is an optional parameter that may be NULL. It
219 will be NULL for device drivers. It will also be NULL
220 for a bus drivers that wish to retrieve the name of the
221 bus controller. It will not be NULL for a bus driver
222 that wishes to retrieve the name of a child controller.
223 Language - A pointer to a three character ISO 639-2 language
224 identifier. This is the language of the controller name
225 that that the caller is requesting, and it must match one
226 of the languages specified in SupportedLanguages. The
227 number of languages supported by a driver is up to the
229 ControllerName - A pointer to the Unicode string to return. This Unicode
230 string is the name of the controller specified by
231 ControllerHandle and ChildHandle in the language
232 specified by Language from the point of view of the
233 driver specified by This.
236 EFI_SUCCESS - The Unicode string for the user readable name in the
237 language specified by Language for the driver
238 specified by This was returned in DriverName.
239 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
240 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
242 EFI_INVALID_PARAMETER - Language is NULL.
243 EFI_INVALID_PARAMETER - ControllerName is NULL.
244 EFI_UNSUPPORTED - The driver specified by This is not currently
245 managing the controller specified by
246 ControllerHandle and ChildHandle.
247 EFI_UNSUPPORTED - The driver specified by This does not support the
248 language specified by Language.
253 EFI_SIMPLE_TEXT_IN_PROTOCOL
*TextIn
;
255 // here ChildHandle is not an Optional parameter.
257 if (ChildHandle
== NULL
) {
258 return EFI_UNSUPPORTED
;
261 Status
= gBS
->OpenProtocol (
263 &gEfiSimpleTextInProtocolGuid
,
267 EFI_OPEN_PROTOCOL_GET_PROTOCOL
269 if (EFI_ERROR (Status
)) {
270 return EFI_UNSUPPORTED
;
273 return LookupUnicodeString (
275 gConSplitterConInComponentName
.SupportedLanguages
,
276 mConSplitterConInControllerNameTable
,
283 ConSplitterSimplePointerComponentNameGetControllerName (
284 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
285 IN EFI_HANDLE ControllerHandle
,
286 IN EFI_HANDLE ChildHandle OPTIONAL
,
288 OUT CHAR16
**ControllerName
293 Retrieves a Unicode string that is the user readable name of the controller
294 that is being managed by an EFI Driver.
297 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
298 ControllerHandle - The handle of a controller that the driver specified by
299 This is managing. This handle specifies the controller
300 whose name is to be returned.
301 ChildHandle - The handle of the child controller to retrieve the name
302 of. This is an optional parameter that may be NULL. It
303 will be NULL for device drivers. It will also be NULL
304 for a bus drivers that wish to retrieve the name of the
305 bus controller. It will not be NULL for a bus driver
306 that wishes to retrieve the name of a child controller.
307 Language - A pointer to a three character ISO 639-2 language
308 identifier. This is the language of the controller name
309 that that the caller is requesting, and it must match one
310 of the languages specified in SupportedLanguages. The
311 number of languages supported by a driver is up to the
313 ControllerName - A pointer to the Unicode string to return. This Unicode
314 string is the name of the controller specified by
315 ControllerHandle and ChildHandle in the language
316 specified by Language from the point of view of the
317 driver specified by This.
320 EFI_SUCCESS - The Unicode string for the user readable name in the
321 language specified by Language for the driver
322 specified by This was returned in DriverName.
323 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
324 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
326 EFI_INVALID_PARAMETER - Language is NULL.
327 EFI_INVALID_PARAMETER - ControllerName is NULL.
328 EFI_UNSUPPORTED - The driver specified by This is not currently
329 managing the controller specified by
330 ControllerHandle and ChildHandle.
331 EFI_UNSUPPORTED - The driver specified by This does not support the
332 language specified by Language.
337 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointer
;
339 // here ChildHandle is not an Optional parameter.
341 if (ChildHandle
== NULL
) {
342 return EFI_UNSUPPORTED
;
345 Status
= gBS
->OpenProtocol (
347 &gEfiSimplePointerProtocolGuid
,
348 (VOID
**) &SimplePointer
,
351 EFI_OPEN_PROTOCOL_GET_PROTOCOL
353 if (EFI_ERROR (Status
)) {
354 return EFI_UNSUPPORTED
;
357 return LookupUnicodeString (
359 gConSplitterSimplePointerComponentName
.SupportedLanguages
,
360 mConSplitterSimplePointerControllerNameTable
,
367 ConSplitterConOutComponentNameGetControllerName (
368 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
369 IN EFI_HANDLE ControllerHandle
,
370 IN EFI_HANDLE ChildHandle OPTIONAL
,
372 OUT CHAR16
**ControllerName
377 Retrieves a Unicode string that is the user readable name of the controller
378 that is being managed by an EFI Driver.
381 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
382 ControllerHandle - The handle of a controller that the driver specified by
383 This is managing. This handle specifies the controller
384 whose name is to be returned.
385 ChildHandle - The handle of the child controller to retrieve the name
386 of. This is an optional parameter that may be NULL. It
387 will be NULL for device drivers. It will also be NULL
388 for a bus drivers that wish to retrieve the name of the
389 bus controller. It will not be NULL for a bus driver
390 that wishes to retrieve the name of a child controller.
391 Language - A pointer to a three character ISO 639-2 language
392 identifier. This is the language of the controller name
393 that that the caller is requesting, and it must match one
394 of the languages specified in SupportedLanguages. The
395 number of languages supported by a driver is up to the
397 ControllerName - A pointer to the Unicode string to return. This Unicode
398 string is the name of the controller specified by
399 ControllerHandle and ChildHandle in the language
400 specified by Language from the point of view of the
401 driver specified by This.
404 EFI_SUCCESS - The Unicode string for the user readable name in the
405 language specified by Language for the driver
406 specified by This was returned in DriverName.
407 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
408 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
410 EFI_INVALID_PARAMETER - Language is NULL.
411 EFI_INVALID_PARAMETER - ControllerName is NULL.
412 EFI_UNSUPPORTED - The driver specified by This is not currently
413 managing the controller specified by
414 ControllerHandle and ChildHandle.
415 EFI_UNSUPPORTED - The driver specified by This does not support the
416 language specified by Language.
421 EFI_SIMPLE_TEXT_OUT_PROTOCOL
*TextOut
;
423 // here ChildHandle is not an Optional parameter.
425 if (ChildHandle
== NULL
) {
426 return EFI_UNSUPPORTED
;
429 Status
= gBS
->OpenProtocol (
431 &gEfiSimpleTextOutProtocolGuid
,
435 EFI_OPEN_PROTOCOL_GET_PROTOCOL
437 if (EFI_ERROR (Status
)) {
438 return EFI_UNSUPPORTED
;
441 return LookupUnicodeString (
443 gConSplitterConOutComponentName
.SupportedLanguages
,
444 mConSplitterConOutControllerNameTable
,
451 ConSplitterStdErrComponentNameGetControllerName (
452 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
453 IN EFI_HANDLE ControllerHandle
,
454 IN EFI_HANDLE ChildHandle OPTIONAL
,
456 OUT CHAR16
**ControllerName
461 Retrieves a Unicode string that is the user readable name of the controller
462 that is being managed by an EFI Driver.
465 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
466 ControllerHandle - The handle of a controller that the driver specified by
467 This is managing. This handle specifies the controller
468 whose name is to be returned.
469 ChildHandle - The handle of the child controller to retrieve the name
470 of. This is an optional parameter that may be NULL. It
471 will be NULL for device drivers. It will also be NULL
472 for a bus drivers that wish to retrieve the name of the
473 bus controller. It will not be NULL for a bus driver
474 that wishes to retrieve the name of a child controller.
475 Language - A pointer to a three character ISO 639-2 language
476 identifier. This is the language of the controller name
477 that that the caller is requesting, and it must match one
478 of the languages specified in SupportedLanguages. The
479 number of languages supported by a driver is up to the
481 ControllerName - A pointer to the Unicode string to return. This Unicode
482 string is the name of the controller specified by
483 ControllerHandle and ChildHandle in the language
484 specified by Language from the point of view of the
485 driver specified by This.
488 EFI_SUCCESS - The Unicode string for the user readable name in the
489 language specified by Language for the driver
490 specified by This was returned in DriverName.
491 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
492 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
494 EFI_INVALID_PARAMETER - Language is NULL.
495 EFI_INVALID_PARAMETER - ControllerName is NULL.
496 EFI_UNSUPPORTED - The driver specified by This is not currently
497 managing the controller specified by
498 ControllerHandle and ChildHandle.
499 EFI_UNSUPPORTED - The driver specified by This does not support the
500 language specified by Language.
505 EFI_SIMPLE_TEXT_OUT_PROTOCOL
*ErrOut
;
507 // here ChildHandle is not an Optional parameter.
509 if (ChildHandle
== NULL
) {
510 return EFI_UNSUPPORTED
;
513 Status
= gBS
->OpenProtocol (
515 &gEfiSimpleTextOutProtocolGuid
,
519 EFI_OPEN_PROTOCOL_GET_PROTOCOL
521 if (EFI_ERROR (Status
)) {
522 return EFI_UNSUPPORTED
;
525 return LookupUnicodeString (
527 gConSplitterStdErrComponentName
.SupportedLanguages
,
528 mConSplitterStdErrControllerNameTable
,