]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/ComponentName.c
Update copyright header of IsaSerialDxe.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / ComponentName.c
CommitLineData
05fbd06d 1/*++\r
2\r
3Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR>\r
4This software and associated documentation (if any) is furnished\r
5under a license and may only be used or copied in accordance\r
6with the terms of the license. Except as permitted by such\r
7license, no part of this software or documentation may be\r
8reproduced, stored in a retrieval system, or transmitted in any\r
9form or by any means without the express written consent of\r
10Intel Corporation.\r
11\r
12\r
13Module Name:\r
14\r
15 ComponentName.c\r
16\r
17Abstract:\r
18\r
19--*/\r
20\r
21//\r
22// Include common header file for this module.\r
23//\r
24#include "CommonHeader.h"\r
25\r
26#include "Ps2Keyboard.h"\r
27\r
28//\r
29// EFI Component Name Functions\r
30//\r
31EFI_STATUS\r
32EFIAPI\r
33Ps2KeyboardComponentNameGetDriverName (\r
34 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
35 IN CHAR8 *Language,\r
36 OUT CHAR16 **DriverName\r
37 );\r
38\r
39EFI_STATUS\r
40EFIAPI\r
41Ps2KeyboardComponentNameGetControllerName (\r
42 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
43 IN EFI_HANDLE ControllerHandle,\r
44 IN EFI_HANDLE ChildHandle OPTIONAL,\r
45 IN CHAR8 *Language,\r
46 OUT CHAR16 **ControllerName\r
47 );\r
48\r
49//\r
50// EFI Component Name Protocol\r
51//\r
52EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName = {\r
53 Ps2KeyboardComponentNameGetDriverName,\r
54 Ps2KeyboardComponentNameGetControllerName,\r
55 "eng"\r
56};\r
57\r
58static EFI_UNICODE_STRING_TABLE mPs2KeyboardDriverNameTable[] = {\r
59 {\r
60 "eng",\r
61 L"PS/2 Keyboard Driver"\r
62 },\r
63 {\r
64 NULL,\r
65 NULL\r
66 }\r
67};\r
68\r
69EFI_STATUS\r
70EFIAPI\r
71Ps2KeyboardComponentNameGetDriverName (\r
72 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
73 IN CHAR8 *Language,\r
74 OUT CHAR16 **DriverName\r
75 )\r
76/*++\r
77\r
78 Routine Description:\r
79\r
80 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
81\r
82 Arguments:\r
83\r
84 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
85 Language - A pointer to a three character ISO 639-2 language identifier.\r
86 This is the language of the driver name that that the caller\r
87 is requesting, and it must match one of the languages specified\r
88 in SupportedLanguages. The number of languages supported by a\r
89 driver is up to the driver writer.\r
90 DriverName - A pointer to the Unicode string to return. This Unicode string\r
91 is the name of the driver specified by This in the language\r
92 specified by Language.\r
93\r
94 Returns:\r
95\r
96 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
97 and the language specified by Language was returned\r
98 in DriverName.\r
99 EFI_INVALID_PARAMETER - Language is NULL.\r
100 EFI_INVALID_PARAMETER - DriverName is NULL.\r
101 EFI_UNSUPPORTED - The driver specified by This does not support the\r
102 language specified by Language.\r
103\r
104--*/\r
105{\r
106 return LookupUnicodeString (\r
107 Language,\r
108 gPs2KeyboardComponentName.SupportedLanguages,\r
109 mPs2KeyboardDriverNameTable,\r
110 DriverName\r
111 );\r
112}\r
113\r
114EFI_STATUS\r
115EFIAPI\r
116Ps2KeyboardComponentNameGetControllerName (\r
117 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
118 IN EFI_HANDLE ControllerHandle,\r
119 IN EFI_HANDLE ChildHandle OPTIONAL,\r
120 IN CHAR8 *Language,\r
121 OUT CHAR16 **ControllerName\r
122 )\r
123/*++\r
124\r
125 Routine Description:\r
126\r
127 Retrieves a Unicode string that is the user readable name of the controller\r
128 that is being managed by an EFI Driver.\r
129\r
130 Arguments:\r
131\r
132 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
133 ControllerHandle - The handle of a controller that the driver specified by\r
134 This is managing. This handle specifies the controller\r
135 whose name is to be returned.\r
136 ChildHandle - The handle of the child controller to retrieve the name\r
137 of. This is an optional parameter that may be NULL. It\r
138 will be NULL for device drivers. It will also be NULL\r
139 for a bus drivers that wish to retrieve the name of the\r
140 bus controller. It will not be NULL for a bus driver\r
141 that wishes to retrieve the name of a child controller.\r
142 Language - A pointer to a three character ISO 639-2 language\r
143 identifier. This is the language of the controller name\r
144 that that the caller is requesting, and it must match one\r
145 of the languages specified in SupportedLanguages. The\r
146 number of languages supported by a driver is up to the\r
147 driver writer.\r
148 ControllerName - A pointer to the Unicode string to return. This Unicode\r
149 string is the name of the controller specified by\r
150 ControllerHandle and ChildHandle in the language specified\r
151 by Language from the point of view of the driver specified\r
152 by This.\r
153\r
154 Returns:\r
155\r
156 EFI_SUCCESS - The Unicode string for the user readable name in the\r
157 language specified by Language for the driver\r
158 specified by This was returned in DriverName.\r
159 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
160 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
161 EFI_INVALID_PARAMETER - Language is NULL.\r
162 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
163 EFI_UNSUPPORTED - The driver specified by This is not currently managing\r
164 the controller specified by ControllerHandle and\r
165 ChildHandle.\r
166 EFI_UNSUPPORTED - The driver specified by This does not support the\r
167 language specified by Language.\r
168\r
169--*/\r
170{\r
171 EFI_STATUS Status;\r
172 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;\r
173 KEYBOARD_CONSOLE_IN_DEV *ConsoleIn;\r
174 EFI_ISA_IO_PROTOCOL *IsaIoProtocol;\r
175\r
176 //\r
177 // This is a device driver, so ChildHandle must be NULL.\r
178 //\r
179 if (ChildHandle != NULL) {\r
180 return EFI_UNSUPPORTED;\r
181 }\r
182 //\r
183 // Check Controller's handle\r
184 //\r
185 Status = gBS->OpenProtocol (\r
186 ControllerHandle,\r
187 &gEfiIsaIoProtocolGuid,\r
188 (VOID **) &IsaIoProtocol,\r
189 gKeyboardControllerDriver.DriverBindingHandle,\r
190 ControllerHandle,\r
191 EFI_OPEN_PROTOCOL_BY_DRIVER\r
192 );\r
193 if (!EFI_ERROR (Status)) {\r
194 gBS->CloseProtocol (\r
195 ControllerHandle,\r
196 &gEfiIsaIoProtocolGuid,\r
197 gKeyboardControllerDriver.DriverBindingHandle,\r
198 ControllerHandle\r
199 );\r
200\r
201 return EFI_UNSUPPORTED;\r
202 }\r
203\r
204 if (Status != EFI_ALREADY_STARTED) {\r
205 return EFI_UNSUPPORTED;\r
206 }\r
207 //\r
208 // Get the device context\r
209 //\r
210 Status = gBS->OpenProtocol (\r
211 ControllerHandle,\r
212 &gEfiSimpleTextInProtocolGuid,\r
213 (VOID **) &ConIn,\r
214 gKeyboardControllerDriver.DriverBindingHandle,\r
215 ControllerHandle,\r
216 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
217 );\r
218 if (EFI_ERROR (Status)) {\r
219 return Status;\r
220 }\r
221\r
222 ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn);\r
223\r
224 return LookupUnicodeString (\r
225 Language,\r
226 gPs2KeyboardComponentName.SupportedLanguages,\r
227 ConsoleIn->ControllerNameTable,\r
228 ControllerName\r
229 );\r
230}\r