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