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