• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   UEFI Component Name(2) protocol implementation for ConSplitter driver.
3 
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #include "ConSplitter.h"
16 
17 //
18 // EFI Component Name Protocol
19 //
20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gConSplitterConInComponentName = {
21   ConSplitterComponentNameGetDriverName,
22   ConSplitterConInComponentNameGetControllerName,
23   "eng"
24 };
25 
26 //
27 // EFI Component Name 2 Protocol
28 //
29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2 = {
30   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
31   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConInComponentNameGetControllerName,
32   "en"
33 };
34 
35 
36 //
37 // EFI Component Name Protocol
38 //
39 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gConSplitterSimplePointerComponentName = {
40   ConSplitterComponentNameGetDriverName,
41   ConSplitterSimplePointerComponentNameGetControllerName,
42   "eng"
43 };
44 
45 //
46 // EFI Component Name 2 Protocol
47 //
48 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2 = {
49   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
50   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterSimplePointerComponentNameGetControllerName,
51   "en"
52 };
53 
54 //
55 // EFI Component Name Protocol
56 //
57 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {
58   ConSplitterComponentNameGetDriverName,
59   ConSplitterAbsolutePointerComponentNameGetControllerName,
60   "eng"
61 };
62 
63 //
64 // EFI Component Name 2 Protocol
65 //
66 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {
67   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
68   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterAbsolutePointerComponentNameGetControllerName,
69   "en"
70 };
71 
72 //
73 // EFI Component Name Protocol
74 //
75 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gConSplitterConOutComponentName = {
76   ConSplitterComponentNameGetDriverName,
77   ConSplitterConOutComponentNameGetControllerName,
78   "eng"
79 };
80 
81 //
82 // EFI Component Name 2 Protocol
83 //
84 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2 = {
85   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
86   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConOutComponentNameGetControllerName,
87   "en"
88 };
89 
90 
91 //
92 // EFI Component Name Protocol
93 //
94 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gConSplitterStdErrComponentName = {
95   ConSplitterComponentNameGetDriverName,
96   ConSplitterStdErrComponentNameGetControllerName,
97   "eng"
98 };
99 
100 //
101 // EFI Component Name 2 Protocol
102 //
103 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2 = {
104   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
105   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterStdErrComponentNameGetControllerName,
106   "en"
107 };
108 
109 
110 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {
111   {
112     "eng;en",
113     (CHAR16 *) L"Console Splitter Driver"
114   },
115   {
116     NULL,
117     NULL
118   }
119 };
120 
121 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {
122   {
123     "eng;en",
124     (CHAR16 *) L"Primary Console Input Device"
125   },
126   {
127     NULL,
128     NULL
129   }
130 };
131 
132 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {
133   {
134     "eng;en",
135     (CHAR16 *) L"Primary Simple Pointer Device"
136   },
137   {
138     NULL,
139     NULL
140   }
141 };
142 
143 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {
144   {
145     "eng;en",
146     (CHAR16 *)L"Primary Absolute Pointer Device"
147   },
148   {
149     NULL,
150     NULL
151   }
152 };
153 
154 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
155   {
156     "eng;en",
157     (CHAR16 *) L"Primary Console Output Device"
158   },
159   {
160     NULL,
161     NULL
162   }
163 };
164 
165 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {
166   {
167     "eng;en",
168     (CHAR16 *) L"Primary Standard Error Device"
169   },
170   {
171     NULL,
172     NULL
173   }
174 };
175 
176 /**
177   Retrieves a Unicode string that is the user readable name of the driver.
178 
179   This function retrieves the user readable name of a driver in the form of a
180   Unicode string. If the driver specified by This has a user readable name in
181   the language specified by Language, then a pointer to the driver name is
182   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
183   by This does not support the language specified by Language,
184   then EFI_UNSUPPORTED is returned.
185 
186   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
187                                 EFI_COMPONENT_NAME_PROTOCOL instance.
188 
189   @param  Language[in]          A pointer to a Null-terminated ASCII string
190                                 array indicating the language. This is the
191                                 language of the driver name that the caller is
192                                 requesting, and it must match one of the
193                                 languages specified in SupportedLanguages. The
194                                 number of languages supported by a driver is up
195                                 to the driver writer. Language is specified
196                                 in RFC 4646 or ISO 639-2 language code format.
197 
198   @param  DriverName[out]       A pointer to the Unicode string to return.
199                                 This Unicode string is the name of the
200                                 driver specified by This in the language
201                                 specified by Language.
202 
203   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
204                                 This and the language specified by Language was
205                                 returned in DriverName.
206 
207   @retval EFI_INVALID_PARAMETER Language is NULL.
208 
209   @retval EFI_INVALID_PARAMETER DriverName is NULL.
210 
211   @retval EFI_UNSUPPORTED       The driver specified by This does not support
212                                 the language specified by Language.
213 
214 **/
215 EFI_STATUS
216 EFIAPI
ConSplitterComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN CHAR8 * Language,OUT CHAR16 ** DriverName)217 ConSplitterComponentNameGetDriverName (
218   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
219   IN  CHAR8                        *Language,
220   OUT CHAR16                       **DriverName
221   )
222 {
223   return LookupUnicodeString2 (
224            Language,
225            This->SupportedLanguages,
226            mConSplitterDriverNameTable,
227            DriverName,
228            (BOOLEAN)((This == &gConSplitterConInComponentName) ||
229                      (This == &gConSplitterSimplePointerComponentName) ||
230                      (This == &gConSplitterAbsolutePointerComponentName) ||
231                      (This == &gConSplitterConOutComponentName) ||
232                      (This == &gConSplitterStdErrComponentName))
233            );
234 }
235 
236 /**
237   Tests whether a controller handle is being managed by a specific driver and
238   the child handle is a child device of the controller.
239 
240   @param  ControllerHandle     A handle for a controller to test.
241   @param  DriverBindingHandle  Specifies the driver binding handle for the
242                                driver.
243   @param  ProtocolGuid         Specifies the protocol that the driver specified
244                                by DriverBindingHandle opens in its Start()
245                                function.
246   @param  ChildHandle          A child handle to test.
247   @param  ConsumsedGuid        Supplies the protocol that the child controller
248                                opens on its parent controller.
249 
250   @retval EFI_SUCCESS          ControllerHandle is managed by the driver
251                                specifed by DriverBindingHandle and ChildHandle
252                                is a child of the ControllerHandle.
253   @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the driver
254                                specifed by DriverBindingHandle.
255   @retval EFI_UNSUPPORTED      ChildHandle is not a child of the
256                                ControllerHandle.
257 
258 **/
259 EFI_STATUS
ConSplitterTestControllerHandles(IN CONST EFI_HANDLE ControllerHandle,IN CONST EFI_HANDLE DriverBindingHandle,IN CONST EFI_GUID * ProtocolGuid,IN EFI_HANDLE ChildHandle,IN CONST EFI_GUID * ConsumsedGuid)260 ConSplitterTestControllerHandles (
261   IN  CONST EFI_HANDLE       ControllerHandle,
262   IN  CONST EFI_HANDLE       DriverBindingHandle,
263   IN  CONST EFI_GUID         *ProtocolGuid,
264   IN  EFI_HANDLE             ChildHandle,
265   IN  CONST EFI_GUID         *ConsumsedGuid
266   )
267 {
268   EFI_STATUS                 Status;
269 
270   //
271   // here ChildHandle is not an Optional parameter.
272   //
273   if (ChildHandle == NULL) {
274     return EFI_UNSUPPORTED;
275   }
276 
277   //
278   // Tests whether a controller handle is being managed by a specific driver.
279   //
280   Status = EfiTestManagedDevice (
281              ControllerHandle,
282              DriverBindingHandle,
283              ProtocolGuid
284              );
285   if (EFI_ERROR (Status)) {
286     return Status;
287   }
288 
289   //
290   // Tests whether a child handle is a child device of the controller.
291   //
292   Status = EfiTestChildHandle (
293              ControllerHandle,
294              ChildHandle,
295              ConsumsedGuid
296              );
297 
298   return Status;
299 }
300 
301 /**
302   Retrieves a Unicode string that is the user readable name of the controller
303   that is being managed by a driver.
304 
305   This function retrieves the user readable name of the controller specified by
306   ControllerHandle and ChildHandle in the form of a Unicode string. If the
307   driver specified by This has a user readable name in the language specified by
308   Language, then a pointer to the controller name is returned in ControllerName,
309   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
310   managing the controller specified by ControllerHandle and ChildHandle,
311   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
312   support the language specified by Language, then EFI_UNSUPPORTED is returned.
313 
314   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
315                                 EFI_COMPONENT_NAME_PROTOCOL instance.
316 
317   @param  ControllerHandle[in]  The handle of a controller that the driver
318                                 specified by This is managing.  This handle
319                                 specifies the controller whose name is to be
320                                 returned.
321 
322   @param  ChildHandle[in]       The handle of the child controller to retrieve
323                                 the name of.  This is an optional parameter that
324                                 may be NULL.  It will be NULL for device
325                                 drivers.  It will also be NULL for a bus drivers
326                                 that wish to retrieve the name of the bus
327                                 controller.  It will not be NULL for a bus
328                                 driver that wishes to retrieve the name of a
329                                 child controller.
330 
331   @param  Language[in]          A pointer to a Null-terminated ASCII string
332                                 array indicating the language.  This is the
333                                 language of the driver name that the caller is
334                                 requesting, and it must match one of the
335                                 languages specified in SupportedLanguages. The
336                                 number of languages supported by a driver is up
337                                 to the driver writer. Language is specified in
338                                 RFC 4646 or ISO 639-2 language code format.
339 
340   @param  ControllerName[out]   A pointer to the Unicode string to return.
341                                 This Unicode string is the name of the
342                                 controller specified by ControllerHandle and
343                                 ChildHandle in the language specified by
344                                 Language from the point of view of the driver
345                                 specified by This.
346 
347   @retval EFI_SUCCESS           The Unicode string for the user readable name in
348                                 the language specified by Language for the
349                                 driver specified by This was returned in
350                                 DriverName.
351 
352   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
353 
354   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
355                                 EFI_HANDLE.
356 
357   @retval EFI_INVALID_PARAMETER Language is NULL.
358 
359   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
360 
361   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
362                                 managing the controller specified by
363                                 ControllerHandle and ChildHandle.
364 
365   @retval EFI_UNSUPPORTED       The driver specified by This does not support
366                                 the language specified by Language.
367 
368 **/
369 EFI_STATUS
370 EFIAPI
ConSplitterConInComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)371 ConSplitterConInComponentNameGetControllerName (
372   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
373   IN  EFI_HANDLE                                      ControllerHandle,
374   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
375   IN  CHAR8                                           *Language,
376   OUT CHAR16                                          **ControllerName
377   )
378 {
379   EFI_STATUS                     Status;
380 
381   Status = ConSplitterTestControllerHandles (
382              ControllerHandle,
383              gConSplitterConInDriverBinding.DriverBindingHandle,
384              &gEfiConsoleInDeviceGuid,
385              ChildHandle,
386              &gEfiConsoleInDeviceGuid
387              );
388   if (EFI_ERROR (Status)) {
389     return Status;
390   }
391 
392   return LookupUnicodeString2 (
393            Language,
394            This->SupportedLanguages,
395            mConSplitterConInControllerNameTable,
396            ControllerName,
397            (BOOLEAN)(This == &gConSplitterConInComponentName)
398            );
399 }
400 
401 /**
402   Retrieves a Unicode string that is the user readable name of the controller
403   that is being managed by a driver.
404 
405   This function retrieves the user readable name of the controller specified by
406   ControllerHandle and ChildHandle in the form of a Unicode string. If the
407   driver specified by This has a user readable name in the language specified by
408   Language, then a pointer to the controller name is returned in ControllerName,
409   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
410   managing the controller specified by ControllerHandle and ChildHandle,
411   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
412   support the language specified by Language, then EFI_UNSUPPORTED is returned.
413 
414   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
415                                 EFI_COMPONENT_NAME_PROTOCOL instance.
416 
417   @param  ControllerHandle[in]  The handle of a controller that the driver
418                                 specified by This is managing.  This handle
419                                 specifies the controller whose name is to be
420                                 returned.
421 
422   @param  ChildHandle[in]       The handle of the child controller to retrieve
423                                 the name of.  This is an optional parameter that
424                                 may be NULL.  It will be NULL for device
425                                 drivers.  It will also be NULL for a bus drivers
426                                 that wish to retrieve the name of the bus
427                                 controller.  It will not be NULL for a bus
428                                 driver that wishes to retrieve the name of a
429                                 child controller.
430 
431   @param  Language[in]          A pointer to a Null-terminated ASCII string
432                                 array indicating the language.  This is the
433                                 language of the driver name that the caller is
434                                 requesting, and it must match one of the
435                                 languages specified in SupportedLanguages. The
436                                 number of languages supported by a driver is up
437                                 to the driver writer. Language is specified in
438                                 RFC 4646 or ISO 639-2 language code format.
439 
440   @param  ControllerName[out]   A pointer to the Unicode string to return.
441                                 This Unicode string is the name of the
442                                 controller specified by ControllerHandle and
443                                 ChildHandle in the language specified by
444                                 Language from the point of view of the driver
445                                 specified by This.
446 
447   @retval EFI_SUCCESS           The Unicode string for the user readable name in
448                                 the language specified by Language for the
449                                 driver specified by This was returned in
450                                 DriverName.
451 
452   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
453 
454   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
455                                 EFI_HANDLE.
456 
457   @retval EFI_INVALID_PARAMETER Language is NULL.
458 
459   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
460 
461   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
462                                 managing the controller specified by
463                                 ControllerHandle and ChildHandle.
464 
465   @retval EFI_UNSUPPORTED       The driver specified by This does not support
466                                 the language specified by Language.
467 
468 **/
469 EFI_STATUS
470 EFIAPI
ConSplitterSimplePointerComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)471 ConSplitterSimplePointerComponentNameGetControllerName (
472   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
473   IN  EFI_HANDLE                                      ControllerHandle,
474   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
475   IN  CHAR8                                           *Language,
476   OUT CHAR16                                          **ControllerName
477   )
478 {
479   EFI_STATUS                  Status;
480 
481   Status = ConSplitterTestControllerHandles (
482              ControllerHandle,
483              gConSplitterSimplePointerDriverBinding.DriverBindingHandle,
484              &gEfiSimplePointerProtocolGuid,
485              ChildHandle,
486              &gEfiSimplePointerProtocolGuid
487              );
488   if (EFI_ERROR (Status)) {
489     return Status;
490   }
491 
492   return LookupUnicodeString2 (
493            Language,
494            This->SupportedLanguages,
495            mConSplitterSimplePointerControllerNameTable,
496            ControllerName,
497            (BOOLEAN)(This == &gConSplitterSimplePointerComponentName)
498            );
499 }
500 
501 
502 /**
503   Retrieves a Unicode string that is the user readable name of the controller
504   that is being managed by an EFI Driver.
505 
506   @param  This                   A pointer to the EFI_COMPONENT_NAME_PROTOCOL
507                                  instance.
508   @param  ControllerHandle       The handle of a controller that the driver
509                                  specified by This is managing.  This handle
510                                  specifies the controller whose name is to be
511                                  returned.
512   @param  ChildHandle            The handle of the child controller to retrieve the
513                                  name of.  This is an optional parameter that may
514                                  be NULL.  It will be NULL for device drivers.  It
515                                  will also be NULL for a bus drivers that wish to
516                                  retrieve the name of the bus controller.  It will
517                                  not be NULL for a bus driver that wishes to
518                                  retrieve the name of a child controller.
519   @param  Language               A pointer to RFC4646 language identifier. This is
520                                  the language of the controller name that that the
521                                  caller is requesting, and it must match one of the
522                                  languages specified in SupportedLanguages.  The
523                                  number of languages supported by a driver is up to
524                                  the driver writer.
525   @param  ControllerName         A pointer to the Unicode string to return.  This
526                                  Unicode string is the name of the controller
527                                  specified by ControllerHandle and ChildHandle in
528                                  the language specified by Language from the point
529                                  of view of the driver specified by This.
530 
531   @retval EFI_SUCCESS            The Unicode string for the user readable name in
532                                  the language specified by Language for the driver
533                                  specified by This was returned in DriverName.
534   @retval EFI_INVALID_PARAMETER  ControllerHandle is NULL.
535   @retval EFI_INVALID_PARAMETER  ChildHandle is not NULL and it is not a valid
536                                  EFI_HANDLE.
537   @retval EFI_INVALID_PARAMETER  Language is NULL.
538   @retval EFI_INVALID_PARAMETER  ControllerName is NULL.
539   @retval EFI_UNSUPPORTED        The driver specified by This is not currently
540                                  managing the controller specified by
541                                  ControllerHandle and ChildHandle.
542   @retval EFI_UNSUPPORTED        The driver specified by This does not support the
543                                  language specified by Language.
544 
545 **/
546 EFI_STATUS
547 EFIAPI
ConSplitterAbsolutePointerComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)548 ConSplitterAbsolutePointerComponentNameGetControllerName (
549   IN  EFI_COMPONENT_NAME_PROTOCOL                    *This,
550   IN  EFI_HANDLE                                      ControllerHandle,
551   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
552   IN  CHAR8                                           *Language,
553   OUT CHAR16                                          **ControllerName
554   )
555 {
556   EFI_STATUS                    Status;
557 
558   Status = ConSplitterTestControllerHandles (
559              ControllerHandle,
560              gConSplitterAbsolutePointerDriverBinding.DriverBindingHandle,
561              &gEfiAbsolutePointerProtocolGuid,
562              ChildHandle,
563              &gEfiAbsolutePointerProtocolGuid
564              );
565   if (EFI_ERROR (Status)) {
566     return Status;
567   }
568 
569   return LookupUnicodeString2 (
570            Language,
571            This->SupportedLanguages,
572            mConSplitterAbsolutePointerControllerNameTable,
573            ControllerName,
574            (BOOLEAN)(This == &gConSplitterAbsolutePointerComponentName)
575            );
576 }
577 
578 /**
579   Retrieves a Unicode string that is the user readable name of the controller
580   that is being managed by a driver.
581 
582   This function retrieves the user readable name of the controller specified by
583   ControllerHandle and ChildHandle in the form of a Unicode string. If the
584   driver specified by This has a user readable name in the language specified by
585   Language, then a pointer to the controller name is returned in ControllerName,
586   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
587   managing the controller specified by ControllerHandle and ChildHandle,
588   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
589   support the language specified by Language, then EFI_UNSUPPORTED is returned.
590 
591   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
592                                 EFI_COMPONENT_NAME_PROTOCOL instance.
593 
594   @param  ControllerHandle[in]  The handle of a controller that the driver
595                                 specified by This is managing.  This handle
596                                 specifies the controller whose name is to be
597                                 returned.
598 
599   @param  ChildHandle[in]       The handle of the child controller to retrieve
600                                 the name of.  This is an optional parameter that
601                                 may be NULL.  It will be NULL for device
602                                 drivers.  It will also be NULL for a bus drivers
603                                 that wish to retrieve the name of the bus
604                                 controller.  It will not be NULL for a bus
605                                 driver that wishes to retrieve the name of a
606                                 child controller.
607 
608   @param  Language[in]          A pointer to a Null-terminated ASCII string
609                                 array indicating the language.  This is the
610                                 language of the driver name that the caller is
611                                 requesting, and it must match one of the
612                                 languages specified in SupportedLanguages. The
613                                 number of languages supported by a driver is up
614                                 to the driver writer. Language is specified in
615                                 RFC 4646 or ISO 639-2 language code format.
616 
617   @param  ControllerName[out]   A pointer to the Unicode string to return.
618                                 This Unicode string is the name of the
619                                 controller specified by ControllerHandle and
620                                 ChildHandle in the language specified by
621                                 Language from the point of view of the driver
622                                 specified by This.
623 
624   @retval EFI_SUCCESS           The Unicode string for the user readable name in
625                                 the language specified by Language for the
626                                 driver specified by This was returned in
627                                 DriverName.
628 
629   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
630 
631   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
632                                 EFI_HANDLE.
633 
634   @retval EFI_INVALID_PARAMETER Language is NULL.
635 
636   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
637 
638   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
639                                 managing the controller specified by
640                                 ControllerHandle and ChildHandle.
641 
642   @retval EFI_UNSUPPORTED       The driver specified by This does not support
643                                 the language specified by Language.
644 
645 **/
646 EFI_STATUS
647 EFIAPI
ConSplitterConOutComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)648 ConSplitterConOutComponentNameGetControllerName (
649   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
650   IN  EFI_HANDLE                                      ControllerHandle,
651   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
652   IN  CHAR8                                           *Language,
653   OUT CHAR16                                          **ControllerName
654   )
655 {
656   EFI_STATUS                       Status;
657 
658   Status = ConSplitterTestControllerHandles (
659              ControllerHandle,
660              gConSplitterConOutDriverBinding.DriverBindingHandle,
661              &gEfiConsoleOutDeviceGuid,
662              ChildHandle,
663              &gEfiConsoleOutDeviceGuid
664              );
665   if (EFI_ERROR (Status)) {
666     return Status;
667   }
668 
669   return LookupUnicodeString2 (
670            Language,
671            This->SupportedLanguages,
672            mConSplitterConOutControllerNameTable,
673            ControllerName,
674            (BOOLEAN)(This == &gConSplitterConOutComponentName)
675            );
676 }
677 
678 /**
679   Retrieves a Unicode string that is the user readable name of the controller
680   that is being managed by a driver.
681 
682   This function retrieves the user readable name of the controller specified by
683   ControllerHandle and ChildHandle in the form of a Unicode string. If the
684   driver specified by This has a user readable name in the language specified by
685   Language, then a pointer to the controller name is returned in ControllerName,
686   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
687   managing the controller specified by ControllerHandle and ChildHandle,
688   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
689   support the language specified by Language, then EFI_UNSUPPORTED is returned.
690 
691   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
692                                 EFI_COMPONENT_NAME_PROTOCOL instance.
693 
694   @param  ControllerHandle[in]  The handle of a controller that the driver
695                                 specified by This is managing.  This handle
696                                 specifies the controller whose name is to be
697                                 returned.
698 
699   @param  ChildHandle[in]       The handle of the child controller to retrieve
700                                 the name of.  This is an optional parameter that
701                                 may be NULL.  It will be NULL for device
702                                 drivers.  It will also be NULL for a bus drivers
703                                 that wish to retrieve the name of the bus
704                                 controller.  It will not be NULL for a bus
705                                 driver that wishes to retrieve the name of a
706                                 child controller.
707 
708   @param  Language[in]          A pointer to a Null-terminated ASCII string
709                                 array indicating the language.  This is the
710                                 language of the driver name that the caller is
711                                 requesting, and it must match one of the
712                                 languages specified in SupportedLanguages. The
713                                 number of languages supported by a driver is up
714                                 to the driver writer. Language is specified in
715                                 RFC 4646 or ISO 639-2 language code format.
716 
717   @param  ControllerName[out]   A pointer to the Unicode string to return.
718                                 This Unicode string is the name of the
719                                 controller specified by ControllerHandle and
720                                 ChildHandle in the language specified by
721                                 Language from the point of view of the driver
722                                 specified by This.
723 
724   @retval EFI_SUCCESS           The Unicode string for the user readable name in
725                                 the language specified by Language for the
726                                 driver specified by This was returned in
727                                 DriverName.
728 
729   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
730 
731   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
732                                 EFI_HANDLE.
733 
734   @retval EFI_INVALID_PARAMETER Language is NULL.
735 
736   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
737 
738   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
739                                 managing the controller specified by
740                                 ControllerHandle and ChildHandle.
741 
742   @retval EFI_UNSUPPORTED       The driver specified by This does not support
743                                 the language specified by Language.
744 
745 **/
746 EFI_STATUS
747 EFIAPI
ConSplitterStdErrComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)748 ConSplitterStdErrComponentNameGetControllerName (
749   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
750   IN  EFI_HANDLE                                      ControllerHandle,
751   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
752   IN  CHAR8                                           *Language,
753   OUT CHAR16                                          **ControllerName
754   )
755 {
756   EFI_STATUS                       Status;
757 
758   Status = ConSplitterTestControllerHandles (
759              ControllerHandle,
760              gConSplitterStdErrDriverBinding.DriverBindingHandle,
761              &gEfiStandardErrorDeviceGuid,
762              ChildHandle,
763              &gEfiStandardErrorDeviceGuid
764              );
765   if (EFI_ERROR (Status)) {
766     return Status;
767   }
768 
769   return LookupUnicodeString2 (
770            Language,
771            This->SupportedLanguages,
772            mConSplitterStdErrControllerNameTable,
773            ControllerName,
774            (BOOLEAN)(This == &gConSplitterStdErrComponentName)
775            );
776 }
777