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