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