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