]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Universal/Console/ConSplitter/Dxe/ComponentName.c
Updated MSA by putting Specification element at the end of the header section
[mirror_edk2.git] / EdkModulePkg / Universal / Console / ConSplitter / Dxe / ComponentName.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
20#include "ConSplitter.h"\r
21\r
22//\r
23// EFI Component Name Functions\r
24//\r
25EFI_STATUS\r
26EFIAPI\r
27ConSplitterComponentNameGetDriverName (\r
28 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
29 IN CHAR8 *Language,\r
30 OUT CHAR16 **DriverName\r
31 );\r
32\r
33EFI_STATUS\r
34EFIAPI\r
35ConSplitterConInComponentNameGetControllerName (\r
36 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
37 IN EFI_HANDLE ControllerHandle,\r
38 IN EFI_HANDLE ChildHandle OPTIONAL,\r
39 IN CHAR8 *Language,\r
40 OUT CHAR16 **ControllerName\r
41 );\r
42\r
43EFI_STATUS\r
44EFIAPI\r
45ConSplitterSimplePointerComponentNameGetControllerName (\r
46 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
47 IN EFI_HANDLE ControllerHandle,\r
48 IN EFI_HANDLE ChildHandle OPTIONAL,\r
49 IN CHAR8 *Language,\r
50 OUT CHAR16 **ControllerName\r
51 );\r
52\r
53EFI_STATUS\r
54EFIAPI\r
55ConSplitterConOutComponentNameGetControllerName (\r
56 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
57 IN EFI_HANDLE ControllerHandle,\r
58 IN EFI_HANDLE ChildHandle OPTIONAL,\r
59 IN CHAR8 *Language,\r
60 OUT CHAR16 **ControllerName\r
61 );\r
62\r
63EFI_STATUS\r
64EFIAPI\r
65ConSplitterStdErrComponentNameGetControllerName (\r
66 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
67 IN EFI_HANDLE ControllerHandle,\r
68 IN EFI_HANDLE ChildHandle OPTIONAL,\r
69 IN CHAR8 *Language,\r
70 OUT CHAR16 **ControllerName\r
71 );\r
72\r
73//\r
74// EFI Component Name Protocol\r
75//\r
76EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName = {\r
77 ConSplitterComponentNameGetDriverName,\r
78 ConSplitterConInComponentNameGetControllerName,\r
79 "eng"\r
80};\r
81\r
82EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName = {\r
83 ConSplitterComponentNameGetDriverName,\r
84 ConSplitterSimplePointerComponentNameGetControllerName,\r
85 "eng"\r
86};\r
87\r
88EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName = {\r
89 ConSplitterComponentNameGetDriverName,\r
90 ConSplitterConOutComponentNameGetControllerName,\r
91 "eng"\r
92};\r
93\r
94EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName = {\r
95 ConSplitterComponentNameGetDriverName,\r
96 ConSplitterStdErrComponentNameGetControllerName,\r
97 "eng"\r
98};\r
99\r
100static EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {\r
101 {\r
102 "eng",\r
103 (CHAR16 *) L"Console Splitter Driver"\r
104 },\r
105 {\r
106 NULL,\r
107 NULL\r
108 }\r
109};\r
110\r
111static EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {\r
112 {\r
113 "eng",\r
114 (CHAR16 *) L"Primary Console Input Device"\r
115 },\r
116 {\r
117 NULL,\r
118 NULL\r
119 }\r
120};\r
121\r
122static EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {\r
123 {\r
124 "eng",\r
125 (CHAR16 *) L"Primary Simple Pointer Device"\r
126 },\r
127 {\r
128 NULL,\r
129 NULL\r
130 }\r
131};\r
132\r
133static EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {\r
134 {\r
135 "eng",\r
136 (CHAR16 *) L"Primary Console Output Device"\r
137 },\r
138 {\r
139 NULL,\r
140 NULL\r
141 }\r
142};\r
143\r
144static EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {\r
145 {\r
146 "eng",\r
147 (CHAR16 *) L"Primary Standard Error Device"\r
148 },\r
149 {\r
150 NULL,\r
151 NULL\r
152 }\r
153};\r
154\r
155EFI_STATUS\r
156EFIAPI\r
157ConSplitterComponentNameGetDriverName (\r
158 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
159 IN CHAR8 *Language,\r
160 OUT CHAR16 **DriverName\r
161 )\r
162/*++\r
163\r
164 Routine Description:\r
165 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
166\r
167 Arguments:\r
168 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
169 Language - A pointer to a three character ISO 639-2 language identifier.\r
170 This is the language of the driver name that that the caller \r
171 is requesting, and it must match one of the languages specified\r
172 in SupportedLanguages. The number of languages supported by a \r
173 driver is up to the driver writer.\r
174 DriverName - A pointer to the Unicode string to return. This Unicode string\r
175 is the name of the driver specified by This in the language \r
176 specified by Language.\r
177\r
178 Returns:\r
179 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
180 and the language specified by Language was returned \r
181 in DriverName.\r
182 EFI_INVALID_PARAMETER - Language is NULL.\r
183 EFI_INVALID_PARAMETER - DriverName is NULL.\r
184 EFI_UNSUPPORTED - The driver specified by This does not support the \r
185 language specified by Language.\r
186\r
187--*/\r
188{\r
189 return LookupUnicodeString (\r
190 Language,\r
191 gConSplitterConInComponentName.SupportedLanguages,\r
192 mConSplitterDriverNameTable,\r
193 DriverName\r
194 );\r
195}\r
196\r
197EFI_STATUS\r
198EFIAPI\r
199ConSplitterConInComponentNameGetControllerName (\r
200 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
201 IN EFI_HANDLE ControllerHandle,\r
202 IN EFI_HANDLE ChildHandle OPTIONAL,\r
203 IN CHAR8 *Language,\r
204 OUT CHAR16 **ControllerName\r
205 )\r
206/*++\r
207\r
208 Routine Description:\r
209 Retrieves a Unicode string that is the user readable name of the controller\r
210 that is being managed by an EFI Driver.\r
211\r
212 Arguments:\r
213 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
214 ControllerHandle - The handle of a controller that the driver specified by \r
215 This is managing. This handle specifies the controller \r
216 whose name is to be returned.\r
217 ChildHandle - The handle of the child controller to retrieve the name \r
218 of. This is an optional parameter that may be NULL. It \r
219 will be NULL for device drivers. It will also be NULL \r
220 for a bus drivers that wish to retrieve the name of the \r
221 bus controller. It will not be NULL for a bus driver \r
222 that wishes to retrieve the name of a child controller.\r
223 Language - A pointer to a three character ISO 639-2 language \r
224 identifier. This is the language of the controller name \r
225 that that the caller is requesting, and it must match one\r
226 of the languages specified in SupportedLanguages. The \r
227 number of languages supported by a driver is up to the \r
228 driver writer.\r
229 ControllerName - A pointer to the Unicode string to return. This Unicode\r
230 string is the name of the controller specified by \r
231 ControllerHandle and ChildHandle in the language \r
232 specified by Language from the point of view of the \r
233 driver specified by This. \r
234\r
235 Returns:\r
236 EFI_SUCCESS - The Unicode string for the user readable name in the\r
237 language specified by Language for the driver \r
238 specified by This was returned in DriverName.\r
239 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
240 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
241 EFI_HANDLE.\r
242 EFI_INVALID_PARAMETER - Language is NULL.\r
243 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
244 EFI_UNSUPPORTED - The driver specified by This is not currently \r
245 managing the controller specified by \r
246 ControllerHandle and ChildHandle.\r
247 EFI_UNSUPPORTED - The driver specified by This does not support the \r
248 language specified by Language.\r
249\r
250--*/\r
251{\r
252 EFI_STATUS Status;\r
253 EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;\r
254 //\r
255 // here ChildHandle is not an Optional parameter.\r
256 //\r
257 if (ChildHandle == NULL) {\r
258 return EFI_UNSUPPORTED;\r
259 }\r
260\r
261 Status = gBS->OpenProtocol (\r
262 ControllerHandle,\r
263 &gEfiSimpleTextInProtocolGuid,\r
264 (VOID **) &TextIn,\r
265 NULL,\r
266 ControllerHandle,\r
267 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
268 );\r
269 if (EFI_ERROR (Status)) {\r
270 return EFI_UNSUPPORTED;\r
271 }\r
272\r
273 return LookupUnicodeString (\r
274 Language,\r
275 gConSplitterConInComponentName.SupportedLanguages,\r
276 mConSplitterConInControllerNameTable,\r
277 ControllerName\r
278 );\r
279}\r
280\r
281EFI_STATUS\r
282EFIAPI\r
283ConSplitterSimplePointerComponentNameGetControllerName (\r
284 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
285 IN EFI_HANDLE ControllerHandle,\r
286 IN EFI_HANDLE ChildHandle OPTIONAL,\r
287 IN CHAR8 *Language,\r
288 OUT CHAR16 **ControllerName\r
289 )\r
290/*++\r
291\r
292 Routine Description:\r
293 Retrieves a Unicode string that is the user readable name of the controller\r
294 that is being managed by an EFI Driver.\r
295\r
296 Arguments:\r
297 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
298 ControllerHandle - The handle of a controller that the driver specified by \r
299 This is managing. This handle specifies the controller \r
300 whose name is to be returned.\r
301 ChildHandle - The handle of the child controller to retrieve the name \r
302 of. This is an optional parameter that may be NULL. It \r
303 will be NULL for device drivers. It will also be NULL \r
304 for a bus drivers that wish to retrieve the name of the \r
305 bus controller. It will not be NULL for a bus driver \r
306 that wishes to retrieve the name of a child controller.\r
307 Language - A pointer to a three character ISO 639-2 language \r
308 identifier. This is the language of the controller name \r
309 that that the caller is requesting, and it must match one\r
310 of the languages specified in SupportedLanguages. The \r
311 number of languages supported by a driver is up to the \r
312 driver writer.\r
313 ControllerName - A pointer to the Unicode string to return. This Unicode\r
314 string is the name of the controller specified by \r
315 ControllerHandle and ChildHandle in the language \r
316 specified by Language from the point of view of the \r
317 driver specified by This. \r
318\r
319 Returns:\r
320 EFI_SUCCESS - The Unicode string for the user readable name in the\r
321 language specified by Language for the driver \r
322 specified by This was returned in DriverName.\r
323 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
324 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
325 EFI_HANDLE.\r
326 EFI_INVALID_PARAMETER - Language is NULL.\r
327 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
328 EFI_UNSUPPORTED - The driver specified by This is not currently \r
329 managing the controller specified by \r
330 ControllerHandle and ChildHandle.\r
331 EFI_UNSUPPORTED - The driver specified by This does not support the \r
332 language specified by Language.\r
333\r
334--*/\r
335{\r
336 EFI_STATUS Status;\r
337 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;\r
338 //\r
339 // here ChildHandle is not an Optional parameter.\r
340 //\r
341 if (ChildHandle == NULL) {\r
342 return EFI_UNSUPPORTED;\r
343 }\r
344\r
345 Status = gBS->OpenProtocol (\r
346 ControllerHandle,\r
347 &gEfiSimplePointerProtocolGuid,\r
348 (VOID **) &SimplePointer,\r
349 NULL,\r
350 ControllerHandle,\r
351 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
352 );\r
353 if (EFI_ERROR (Status)) {\r
354 return EFI_UNSUPPORTED;\r
355 }\r
356\r
357 return LookupUnicodeString (\r
358 Language,\r
359 gConSplitterSimplePointerComponentName.SupportedLanguages,\r
360 mConSplitterSimplePointerControllerNameTable,\r
361 ControllerName\r
362 );\r
363}\r
364\r
365EFI_STATUS\r
366EFIAPI\r
367ConSplitterConOutComponentNameGetControllerName (\r
368 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
369 IN EFI_HANDLE ControllerHandle,\r
370 IN EFI_HANDLE ChildHandle OPTIONAL,\r
371 IN CHAR8 *Language,\r
372 OUT CHAR16 **ControllerName\r
373 )\r
374/*++\r
375\r
376 Routine Description:\r
377 Retrieves a Unicode string that is the user readable name of the controller\r
378 that is being managed by an EFI Driver.\r
379\r
380 Arguments:\r
381 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
382 ControllerHandle - The handle of a controller that the driver specified by \r
383 This is managing. This handle specifies the controller \r
384 whose name is to be returned.\r
385 ChildHandle - The handle of the child controller to retrieve the name \r
386 of. This is an optional parameter that may be NULL. It \r
387 will be NULL for device drivers. It will also be NULL \r
388 for a bus drivers that wish to retrieve the name of the \r
389 bus controller. It will not be NULL for a bus driver \r
390 that wishes to retrieve the name of a child controller.\r
391 Language - A pointer to a three character ISO 639-2 language \r
392 identifier. This is the language of the controller name \r
393 that that the caller is requesting, and it must match one\r
394 of the languages specified in SupportedLanguages. The \r
395 number of languages supported by a driver is up to the \r
396 driver writer.\r
397 ControllerName - A pointer to the Unicode string to return. This Unicode\r
398 string is the name of the controller specified by \r
399 ControllerHandle and ChildHandle in the language \r
400 specified by Language from the point of view of the \r
401 driver specified by This. \r
402\r
403 Returns:\r
404 EFI_SUCCESS - The Unicode string for the user readable name in the\r
405 language specified by Language for the driver \r
406 specified by This was returned in DriverName.\r
407 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
408 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
409 EFI_HANDLE.\r
410 EFI_INVALID_PARAMETER - Language is NULL.\r
411 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
412 EFI_UNSUPPORTED - The driver specified by This is not currently \r
413 managing the controller specified by \r
414 ControllerHandle and ChildHandle.\r
415 EFI_UNSUPPORTED - The driver specified by This does not support the \r
416 language specified by Language.\r
417\r
418--*/\r
419{\r
420 EFI_STATUS Status;\r
421 EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;\r
422 //\r
423 // here ChildHandle is not an Optional parameter.\r
424 //\r
425 if (ChildHandle == NULL) {\r
426 return EFI_UNSUPPORTED;\r
427 }\r
428\r
429 Status = gBS->OpenProtocol (\r
430 ControllerHandle,\r
431 &gEfiSimpleTextOutProtocolGuid,\r
432 (VOID **) &TextOut,\r
433 NULL,\r
434 ControllerHandle,\r
435 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
436 );\r
437 if (EFI_ERROR (Status)) {\r
438 return EFI_UNSUPPORTED;\r
439 }\r
440\r
441 return LookupUnicodeString (\r
442 Language,\r
443 gConSplitterConOutComponentName.SupportedLanguages,\r
444 mConSplitterConOutControllerNameTable,\r
445 ControllerName\r
446 );\r
447}\r
448\r
449EFI_STATUS\r
450EFIAPI\r
451ConSplitterStdErrComponentNameGetControllerName (\r
452 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
453 IN EFI_HANDLE ControllerHandle,\r
454 IN EFI_HANDLE ChildHandle OPTIONAL,\r
455 IN CHAR8 *Language,\r
456 OUT CHAR16 **ControllerName\r
457 )\r
458/*++\r
459\r
460 Routine Description:\r
461 Retrieves a Unicode string that is the user readable name of the controller\r
462 that is being managed by an EFI Driver.\r
463\r
464 Arguments:\r
465 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
466 ControllerHandle - The handle of a controller that the driver specified by \r
467 This is managing. This handle specifies the controller \r
468 whose name is to be returned.\r
469 ChildHandle - The handle of the child controller to retrieve the name \r
470 of. This is an optional parameter that may be NULL. It \r
471 will be NULL for device drivers. It will also be NULL \r
472 for a bus drivers that wish to retrieve the name of the \r
473 bus controller. It will not be NULL for a bus driver \r
474 that wishes to retrieve the name of a child controller.\r
475 Language - A pointer to a three character ISO 639-2 language \r
476 identifier. This is the language of the controller name \r
477 that that the caller is requesting, and it must match one\r
478 of the languages specified in SupportedLanguages. The \r
479 number of languages supported by a driver is up to the \r
480 driver writer.\r
481 ControllerName - A pointer to the Unicode string to return. This Unicode\r
482 string is the name of the controller specified by \r
483 ControllerHandle and ChildHandle in the language \r
484 specified by Language from the point of view of the \r
485 driver specified by This. \r
486\r
487 Returns:\r
488 EFI_SUCCESS - The Unicode string for the user readable name in the\r
489 language specified by Language for the driver \r
490 specified by This was returned in DriverName.\r
491 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
492 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
493 EFI_HANDLE.\r
494 EFI_INVALID_PARAMETER - Language is NULL.\r
495 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
496 EFI_UNSUPPORTED - The driver specified by This is not currently \r
497 managing the controller specified by \r
498 ControllerHandle and ChildHandle.\r
499 EFI_UNSUPPORTED - The driver specified by This does not support the \r
500 language specified by Language.\r
501\r
502--*/\r
503{\r
504 EFI_STATUS Status;\r
505 EFI_SIMPLE_TEXT_OUT_PROTOCOL *ErrOut;\r
506 //\r
507 // here ChildHandle is not an Optional parameter.\r
508 //\r
509 if (ChildHandle == NULL) {\r
510 return EFI_UNSUPPORTED;\r
511 }\r
512\r
513 Status = gBS->OpenProtocol (\r
514 ControllerHandle,\r
515 &gEfiSimpleTextOutProtocolGuid,\r
516 (VOID **) &ErrOut,\r
517 NULL,\r
518 ControllerHandle,\r
519 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
520 );\r
521 if (EFI_ERROR (Status)) {\r
522 return EFI_UNSUPPORTED;\r
523 }\r
524\r
525 return LookupUnicodeString (\r
526 Language,\r
527 gConSplitterStdErrComponentName.SupportedLanguages,\r
528 mConSplitterStdErrControllerNameTable,\r
529 ControllerName\r
530 );\r
531}\r