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