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 EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName
= {
26 ConSplitterComponentNameGetDriverName
,
27 ConSplitterConInComponentNameGetControllerName
,
31 EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName
= {
32 ConSplitterComponentNameGetDriverName
,
33 ConSplitterSimplePointerComponentNameGetControllerName
,
37 EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName
= {
38 ConSplitterComponentNameGetDriverName
,
39 ConSplitterConOutComponentNameGetControllerName
,
43 EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName
= {
44 ConSplitterComponentNameGetDriverName
,
45 ConSplitterStdErrComponentNameGetControllerName
,
49 static EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable
[] = {
52 (CHAR16
*) L
"Console Splitter Driver"
60 static EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable
[] = {
63 (CHAR16
*) L
"Primary Console Input Device"
71 static EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable
[] = {
74 (CHAR16
*) L
"Primary Simple Pointer Device"
82 static EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable
[] = {
85 (CHAR16
*) L
"Primary Console Output Device"
93 static EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable
[] = {
96 (CHAR16
*) L
"Primary Standard Error Device"
106 ConSplitterComponentNameGetDriverName (
107 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
109 OUT CHAR16
**DriverName
114 Retrieves a Unicode string that is the user readable name of the EFI Driver.
117 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
118 Language - A pointer to a three character ISO 639-2 language identifier.
119 This is the language of the driver name that that the caller
120 is requesting, and it must match one of the languages specified
121 in SupportedLanguages. The number of languages supported by a
122 driver is up to the driver writer.
123 DriverName - A pointer to the Unicode string to return. This Unicode string
124 is the name of the driver specified by This in the language
125 specified by Language.
128 EFI_SUCCESS - The Unicode string for the Driver specified by This
129 and the language specified by Language was returned
131 EFI_INVALID_PARAMETER - Language is NULL.
132 EFI_INVALID_PARAMETER - DriverName is NULL.
133 EFI_UNSUPPORTED - The driver specified by This does not support the
134 language specified by Language.
138 return LookupUnicodeString (
140 gConSplitterConInComponentName
.SupportedLanguages
,
141 mConSplitterDriverNameTable
,
148 ConSplitterConInComponentNameGetControllerName (
149 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
150 IN EFI_HANDLE ControllerHandle
,
151 IN EFI_HANDLE ChildHandle OPTIONAL
,
153 OUT CHAR16
**ControllerName
158 Retrieves a Unicode string that is the user readable name of the controller
159 that is being managed by an EFI Driver.
162 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
163 ControllerHandle - The handle of a controller that the driver specified by
164 This is managing. This handle specifies the controller
165 whose name is to be returned.
166 ChildHandle - The handle of the child controller to retrieve the name
167 of. This is an optional parameter that may be NULL. It
168 will be NULL for device drivers. It will also be NULL
169 for a bus drivers that wish to retrieve the name of the
170 bus controller. It will not be NULL for a bus driver
171 that wishes to retrieve the name of a child controller.
172 Language - A pointer to a three character ISO 639-2 language
173 identifier. This is the language of the controller name
174 that that the caller is requesting, and it must match one
175 of the languages specified in SupportedLanguages. The
176 number of languages supported by a driver is up to the
178 ControllerName - A pointer to the Unicode string to return. This Unicode
179 string is the name of the controller specified by
180 ControllerHandle and ChildHandle in the language
181 specified by Language from the point of view of the
182 driver specified by This.
185 EFI_SUCCESS - The Unicode string for the user readable name in the
186 language specified by Language for the driver
187 specified by This was returned in DriverName.
188 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
189 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
191 EFI_INVALID_PARAMETER - Language is NULL.
192 EFI_INVALID_PARAMETER - ControllerName is NULL.
193 EFI_UNSUPPORTED - The driver specified by This is not currently
194 managing the controller specified by
195 ControllerHandle and ChildHandle.
196 EFI_UNSUPPORTED - The driver specified by This does not support the
197 language specified by Language.
202 EFI_SIMPLE_TEXT_IN_PROTOCOL
*TextIn
;
204 // here ChildHandle is not an Optional parameter.
206 if (ChildHandle
== NULL
) {
207 return EFI_UNSUPPORTED
;
210 Status
= gBS
->OpenProtocol (
212 &gEfiSimpleTextInProtocolGuid
,
216 EFI_OPEN_PROTOCOL_GET_PROTOCOL
218 if (EFI_ERROR (Status
)) {
219 return EFI_UNSUPPORTED
;
222 return LookupUnicodeString (
224 gConSplitterConInComponentName
.SupportedLanguages
,
225 mConSplitterConInControllerNameTable
,
232 ConSplitterSimplePointerComponentNameGetControllerName (
233 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
234 IN EFI_HANDLE ControllerHandle
,
235 IN EFI_HANDLE ChildHandle OPTIONAL
,
237 OUT CHAR16
**ControllerName
242 Retrieves a Unicode string that is the user readable name of the controller
243 that is being managed by an EFI Driver.
246 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
247 ControllerHandle - The handle of a controller that the driver specified by
248 This is managing. This handle specifies the controller
249 whose name is to be returned.
250 ChildHandle - The handle of the child controller to retrieve the name
251 of. This is an optional parameter that may be NULL. It
252 will be NULL for device drivers. It will also be NULL
253 for a bus drivers that wish to retrieve the name of the
254 bus controller. It will not be NULL for a bus driver
255 that wishes to retrieve the name of a child controller.
256 Language - A pointer to a three character ISO 639-2 language
257 identifier. This is the language of the controller name
258 that that the caller is requesting, and it must match one
259 of the languages specified in SupportedLanguages. The
260 number of languages supported by a driver is up to the
262 ControllerName - A pointer to the Unicode string to return. This Unicode
263 string is the name of the controller specified by
264 ControllerHandle and ChildHandle in the language
265 specified by Language from the point of view of the
266 driver specified by This.
269 EFI_SUCCESS - The Unicode string for the user readable name in the
270 language specified by Language for the driver
271 specified by This was returned in DriverName.
272 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
273 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
275 EFI_INVALID_PARAMETER - Language is NULL.
276 EFI_INVALID_PARAMETER - ControllerName is NULL.
277 EFI_UNSUPPORTED - The driver specified by This is not currently
278 managing the controller specified by
279 ControllerHandle and ChildHandle.
280 EFI_UNSUPPORTED - The driver specified by This does not support the
281 language specified by Language.
286 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointer
;
288 // here ChildHandle is not an Optional parameter.
290 if (ChildHandle
== NULL
) {
291 return EFI_UNSUPPORTED
;
294 Status
= gBS
->OpenProtocol (
296 &gEfiSimplePointerProtocolGuid
,
297 (VOID
**) &SimplePointer
,
300 EFI_OPEN_PROTOCOL_GET_PROTOCOL
302 if (EFI_ERROR (Status
)) {
303 return EFI_UNSUPPORTED
;
306 return LookupUnicodeString (
308 gConSplitterSimplePointerComponentName
.SupportedLanguages
,
309 mConSplitterSimplePointerControllerNameTable
,
316 ConSplitterConOutComponentNameGetControllerName (
317 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
318 IN EFI_HANDLE ControllerHandle
,
319 IN EFI_HANDLE ChildHandle OPTIONAL
,
321 OUT CHAR16
**ControllerName
326 Retrieves a Unicode string that is the user readable name of the controller
327 that is being managed by an EFI Driver.
330 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
331 ControllerHandle - The handle of a controller that the driver specified by
332 This is managing. This handle specifies the controller
333 whose name is to be returned.
334 ChildHandle - The handle of the child controller to retrieve the name
335 of. This is an optional parameter that may be NULL. It
336 will be NULL for device drivers. It will also be NULL
337 for a bus drivers that wish to retrieve the name of the
338 bus controller. It will not be NULL for a bus driver
339 that wishes to retrieve the name of a child controller.
340 Language - A pointer to a three character ISO 639-2 language
341 identifier. This is the language of the controller name
342 that that the caller is requesting, and it must match one
343 of the languages specified in SupportedLanguages. The
344 number of languages supported by a driver is up to the
346 ControllerName - A pointer to the Unicode string to return. This Unicode
347 string is the name of the controller specified by
348 ControllerHandle and ChildHandle in the language
349 specified by Language from the point of view of the
350 driver specified by This.
353 EFI_SUCCESS - The Unicode string for the user readable name in the
354 language specified by Language for the driver
355 specified by This was returned in DriverName.
356 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
357 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
359 EFI_INVALID_PARAMETER - Language is NULL.
360 EFI_INVALID_PARAMETER - ControllerName is NULL.
361 EFI_UNSUPPORTED - The driver specified by This is not currently
362 managing the controller specified by
363 ControllerHandle and ChildHandle.
364 EFI_UNSUPPORTED - The driver specified by This does not support the
365 language specified by Language.
370 EFI_SIMPLE_TEXT_OUT_PROTOCOL
*TextOut
;
372 // here ChildHandle is not an Optional parameter.
374 if (ChildHandle
== NULL
) {
375 return EFI_UNSUPPORTED
;
378 Status
= gBS
->OpenProtocol (
380 &gEfiSimpleTextOutProtocolGuid
,
384 EFI_OPEN_PROTOCOL_GET_PROTOCOL
386 if (EFI_ERROR (Status
)) {
387 return EFI_UNSUPPORTED
;
390 return LookupUnicodeString (
392 gConSplitterConOutComponentName
.SupportedLanguages
,
393 mConSplitterConOutControllerNameTable
,
400 ConSplitterStdErrComponentNameGetControllerName (
401 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
402 IN EFI_HANDLE ControllerHandle
,
403 IN EFI_HANDLE ChildHandle OPTIONAL
,
405 OUT CHAR16
**ControllerName
410 Retrieves a Unicode string that is the user readable name of the controller
411 that is being managed by an EFI Driver.
414 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
415 ControllerHandle - The handle of a controller that the driver specified by
416 This is managing. This handle specifies the controller
417 whose name is to be returned.
418 ChildHandle - The handle of the child controller to retrieve the name
419 of. This is an optional parameter that may be NULL. It
420 will be NULL for device drivers. It will also be NULL
421 for a bus drivers that wish to retrieve the name of the
422 bus controller. It will not be NULL for a bus driver
423 that wishes to retrieve the name of a child controller.
424 Language - A pointer to a three character ISO 639-2 language
425 identifier. This is the language of the controller name
426 that that the caller is requesting, and it must match one
427 of the languages specified in SupportedLanguages. The
428 number of languages supported by a driver is up to the
430 ControllerName - A pointer to the Unicode string to return. This Unicode
431 string is the name of the controller specified by
432 ControllerHandle and ChildHandle in the language
433 specified by Language from the point of view of the
434 driver specified by This.
437 EFI_SUCCESS - The Unicode string for the user readable name in the
438 language specified by Language for the driver
439 specified by This was returned in DriverName.
440 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
441 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
443 EFI_INVALID_PARAMETER - Language is NULL.
444 EFI_INVALID_PARAMETER - ControllerName is NULL.
445 EFI_UNSUPPORTED - The driver specified by This is not currently
446 managing the controller specified by
447 ControllerHandle and ChildHandle.
448 EFI_UNSUPPORTED - The driver specified by This does not support the
449 language specified by Language.
454 EFI_SIMPLE_TEXT_OUT_PROTOCOL
*ErrOut
;
456 // here ChildHandle is not an Optional parameter.
458 if (ChildHandle
== NULL
) {
459 return EFI_UNSUPPORTED
;
462 Status
= gBS
->OpenProtocol (
464 &gEfiSimpleTextOutProtocolGuid
,
468 EFI_OPEN_PROTOCOL_GET_PROTOCOL
470 if (EFI_ERROR (Status
)) {
471 return EFI_UNSUPPORTED
;
474 return LookupUnicodeString (
476 gConSplitterStdErrComponentName
.SupportedLanguages
,
477 mConSplitterStdErrControllerNameTable
,