]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.h
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2MouseAbsolutePointerDxe / Ps2MouseAbsolutePointer.h
CommitLineData
18a73eb7 1/** @file\r
afd0fe22 2 A Ps2MouseAbsolutePointer driver header file\r
0a6f4824
LG
3\r
4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
180a5a35 5This program and the accompanying materials\r
afd0fe22 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
18a73eb7 15#ifndef __PS2MOUSEABSOLUTEPOINTER_H__\r
16#define __PS2MOUSEABSOLUTEPOINTER_H__\r
afd0fe22 17\r
76f016bf 18#include <Uefi.h>\r
afd0fe22 19\r
20#include <Protocol/AbsolutePointer.h>\r
21#include <Protocol/IsaIo.h>\r
22#include <Protocol/DevicePath.h>\r
23\r
24#include <Library/DebugLib.h>\r
25#include <Library/UefiDriverEntryPoint.h>\r
26#include <Library/UefiLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/MemoryAllocationLib.h>\r
29#include <Library/UefiBootServicesTableLib.h>\r
30#include <Library/ReportStatusCodeLib.h>\r
ace74c67 31#include <Library/PcdLib.h>\r
afd0fe22 32\r
9f6531d1 33//\r
34// Global Variables\r
35//\r
36extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseAbsolutePointerDriver;\r
37extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseAbsolutePointerComponentName;\r
38extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseAbsolutePointerComponentName2;\r
39\r
afd0fe22 40//\r
41// PS/2 mouse sample rate\r
42//\r
43typedef enum {\r
3ae99102 44 SampleRate10,\r
45 SampleRate20,\r
46 SampleRate40,\r
47 SampleRate60,\r
48 SampleRate80,\r
49 SampleRate100,\r
50 SampleRate200,\r
51 MaxSampleRate\r
afd0fe22 52} MOUSE_SR;\r
53\r
54//\r
55// PS/2 mouse resolution\r
56//\r
57typedef enum {\r
3ae99102 58 MouseResolution1,\r
59 MouseResolution2,\r
60 MouseResolution4,\r
61 MouseResolution8,\r
62 MaxResolution\r
afd0fe22 63} MOUSE_RE;\r
64\r
65//\r
66// PS/2 mouse scaling\r
67//\r
68typedef enum {\r
3ae99102 69 Scaling1,\r
70 Scaling2\r
afd0fe22 71} MOUSE_SF;\r
72\r
73//\r
74// Driver Private Data\r
75//\r
f02bd376 76#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE SIGNATURE_32 ('p', '2', 's', 't')\r
afd0fe22 77\r
78typedef struct {\r
79 UINTN Signature;\r
80\r
81 EFI_HANDLE Handle;\r
82 EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol;\r
83 EFI_ABSOLUTE_POINTER_STATE State;\r
84 EFI_ABSOLUTE_POINTER_MODE Mode;\r
85 BOOLEAN StateChanged;\r
86\r
87 //\r
88 // PS2 Mouse device specific information\r
89 //\r
90 MOUSE_SR SampleRate;\r
91 MOUSE_RE Resolution;\r
92 MOUSE_SF Scaling;\r
93 UINT8 DataPackageSize;\r
94\r
95 EFI_ISA_IO_PROTOCOL *IsaIo;\r
96\r
97 EFI_EVENT TimerEvent;\r
98\r
99 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
100 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
101} PS2_MOUSE_ABSOLUTE_POINTER_DEV;\r
102\r
103#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_ABSOLUTE_POINTER_DEV, AbsolutePointerProtocol, PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE)\r
104\r
afd0fe22 105//\r
106// Function prototypes\r
107//\r
18a73eb7 108/**\r
109 Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
110 than contains a IsaIo protocol can be supported.\r
111\r
112 @param This Protocol instance pointer.\r
113 @param ControllerHandle Handle of device to test\r
114 @param RemainingDevicePath Optional parameter use to pick a specific child\r
115 device to start.\r
116\r
117 @retval EFI_SUCCESS This driver supports this device\r
118 @retval EFI_ALREADY_STARTED This driver is already running on this device\r
119 @retval other This driver does not support this device\r
120\r
121**/\r
afd0fe22 122EFI_STATUS\r
123EFIAPI\r
124PS2MouseAbsolutePointerDriverSupported (\r
125 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
126 IN EFI_HANDLE Controller,\r
127 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
128 );\r
129\r
18a73eb7 130/**\r
131 Start this driver on ControllerHandle by opening a IsaIo\r
132 protocol, creating PS2_MOUSE_ABSOLUTE_POINTER_DEV device and install gEfiAbsolutePointerProtocolGuid\r
133 finnally.\r
134\r
135 @param This Protocol instance pointer.\r
136 @param ControllerHandle Handle of device to bind driver to\r
137 @param RemainingDevicePath Optional parameter use to pick a specific child\r
138 device to start.\r
139\r
140 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
141 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
142 @retval other This driver does not support this device\r
143\r
144**/\r
afd0fe22 145EFI_STATUS\r
146EFIAPI\r
147PS2MouseAbsolutePointerDriverStart (\r
148 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
149 IN EFI_HANDLE Controller,\r
150 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
151 );\r
152\r
18a73eb7 153/**\r
70d3fe9d 154 Stop this driver on ControllerHandle. Support stopping any child handles\r
18a73eb7 155 created by this driver.\r
156\r
157 @param This Protocol instance pointer.\r
158 @param ControllerHandle Handle of device to stop driver on\r
159 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
160 children is zero stop the entire bus driver.\r
161 @param ChildHandleBuffer List of Child Handles to Stop.\r
162\r
163 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
164 @retval other This driver was not removed from this device\r
165\r
166**/\r
afd0fe22 167EFI_STATUS\r
168EFIAPI\r
169PS2MouseAbsolutePointerDriverStop (\r
170 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
171 IN EFI_HANDLE Controller,\r
172 IN UINTN NumberOfChildren,\r
173 IN EFI_HANDLE *ChildHandleBuffer\r
174 );\r
175\r
176//\r
177// EFI Component Name Functions\r
178//\r
179/**\r
180 Retrieves a Unicode string that is the user readable name of the driver.\r
181\r
182 This function retrieves the user readable name of a driver in the form of a\r
183 Unicode string. If the driver specified by This has a user readable name in\r
184 the language specified by Language, then a pointer to the driver name is\r
185 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
186 by This does not support the language specified by Language,\r
187 then EFI_UNSUPPORTED is returned.\r
188\r
189 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
190 EFI_COMPONENT_NAME_PROTOCOL instance.\r
191\r
192 @param Language[in] A pointer to a Null-terminated ASCII string\r
193 array indicating the language. This is the\r
194 language of the driver name that the caller is\r
195 requesting, and it must match one of the\r
196 languages specified in SupportedLanguages. The\r
197 number of languages supported by a driver is up\r
198 to the driver writer. Language is specified\r
4bca47e1 199 in RFC 4646 or ISO 639-2 language code format.\r
afd0fe22 200\r
201 @param DriverName[out] A pointer to the Unicode string to return.\r
202 This Unicode string is the name of the\r
203 driver specified by This in the language\r
204 specified by Language.\r
205\r
206 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
207 This and the language specified by Language was\r
208 returned in DriverName.\r
209\r
210 @retval EFI_INVALID_PARAMETER Language is NULL.\r
211\r
212 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
213\r
214 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
215 the language specified by Language.\r
216\r
217**/\r
218EFI_STATUS\r
219EFIAPI\r
220Ps2MouseAbsolutePointerComponentNameGetDriverName (\r
221 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
222 IN CHAR8 *Language,\r
223 OUT CHAR16 **DriverName\r
224 );\r
225\r
226\r
227/**\r
228 Retrieves a Unicode string that is the user readable name of the controller\r
229 that is being managed by a driver.\r
230\r
231 This function retrieves the user readable name of the controller specified by\r
232 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
233 driver specified by This has a user readable name in the language specified by\r
234 Language, then a pointer to the controller name is returned in ControllerName,\r
235 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
236 managing the controller specified by ControllerHandle and ChildHandle,\r
237 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
238 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
239\r
240 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
241 EFI_COMPONENT_NAME_PROTOCOL instance.\r
242\r
243 @param ControllerHandle[in] The handle of a controller that the driver\r
244 specified by This is managing. This handle\r
245 specifies the controller whose name is to be\r
246 returned.\r
247\r
248 @param ChildHandle[in] The handle of the child controller to retrieve\r
249 the name of. This is an optional parameter that\r
250 may be NULL. It will be NULL for device\r
251 drivers. It will also be NULL for a bus drivers\r
252 that wish to retrieve the name of the bus\r
253 controller. It will not be NULL for a bus\r
254 driver that wishes to retrieve the name of a\r
255 child controller.\r
256\r
257 @param Language[in] A pointer to a Null-terminated ASCII string\r
258 array indicating the language. This is the\r
259 language of the driver name that the caller is\r
260 requesting, and it must match one of the\r
261 languages specified in SupportedLanguages. The\r
262 number of languages supported by a driver is up\r
263 to the driver writer. Language is specified in\r
4bca47e1 264 RFC 4646 or ISO 639-2 language code format.\r
afd0fe22 265\r
266 @param ControllerName[out] A pointer to the Unicode string to return.\r
267 This Unicode string is the name of the\r
268 controller specified by ControllerHandle and\r
269 ChildHandle in the language specified by\r
270 Language from the point of view of the driver\r
271 specified by This.\r
272\r
273 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
274 the language specified by Language for the\r
275 driver specified by This was returned in\r
276 DriverName.\r
277\r
c2d9a4d2 278 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
afd0fe22 279\r
280 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
281 EFI_HANDLE.\r
282\r
283 @retval EFI_INVALID_PARAMETER Language is NULL.\r
284\r
285 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
286\r
287 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
288 managing the controller specified by\r
289 ControllerHandle and ChildHandle.\r
290\r
291 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
292 the language specified by Language.\r
293\r
294**/\r
295EFI_STATUS\r
296EFIAPI\r
297Ps2MouseAbsolutePointerComponentNameGetControllerName (\r
298 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
299 IN EFI_HANDLE ControllerHandle,\r
300 IN EFI_HANDLE ChildHandle OPTIONAL,\r
301 IN CHAR8 *Language,\r
302 OUT CHAR16 **ControllerName\r
303 );\r
304\r
18a73eb7 305/**\r
70d3fe9d 306 Reset the Mouse and do BAT test for it, if ExtendedVerification is TRUE and there is a mouse device connected to system.\r
18a73eb7 307\r
308 @param This - Pointer of simple pointer Protocol.\r
309 @param ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip.\r
afd0fe22 310\r
18a73eb7 311\r
312 @retval EFI_SUCCESS - The command byte is written successfully.\r
70d3fe9d 313 @retval EFI_DEVICE_ERROR - Errors occurred during resetting keyboard.\r
18a73eb7 314\r
315**/\r
afd0fe22 316EFI_STATUS\r
317EFIAPI\r
318MouseAbsolutePointerReset (\r
319 IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
320 IN BOOLEAN ExtendedVerification\r
321 );\r
322\r
18a73eb7 323/**\r
324 Get and Clear mouse status.\r
0a6f4824 325\r
18a73eb7 326 @param This - Pointer of simple pointer Protocol.\r
327 @param State - Output buffer holding status.\r
328\r
329 @retval EFI_INVALID_PARAMETER Output buffer is invalid.\r
330 @retval EFI_NOT_READY Mouse is not changed status yet.\r
331 @retval EFI_SUCCESS Mouse status is changed and get successful.\r
332**/\r
afd0fe22 333EFI_STATUS\r
334EFIAPI\r
335MouseAbsolutePointerGetState (\r
336 IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
337 IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
338 );\r
339\r
18a73eb7 340/**\r
341\r
342 Event notification function for SIMPLE_POINTER.WaitForInput event.\r
343 Signal the event if there is input from mouse.\r
344\r
345 @param Event event object\r
346 @param Context event context\r
347\r
348**/\r
afd0fe22 349VOID\r
350EFIAPI\r
351MouseAbsolutePointerWaitForInput (\r
352 IN EFI_EVENT Event,\r
353 IN VOID *Context\r
354 );\r
355\r
18a73eb7 356/**\r
357 Event notification function for TimerEvent event.\r
358 If mouse device is connected to system, try to get the mouse packet data.\r
359\r
360 @param Event - TimerEvent in PS2_MOUSE_DEV\r
361 @param Context - Pointer to PS2_MOUSE_DEV structure\r
362\r
363**/\r
afd0fe22 364VOID\r
365EFIAPI\r
366PollMouseAbsolutePointer (\r
367 IN EFI_EVENT Event,\r
368 IN VOID *Context\r
369 );\r
370\r
18a73eb7 371/**\r
372 I/O work flow of in 8042 data.\r
0a6f4824 373\r
18a73eb7 374 @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
375 @param Data Data value\r
0a6f4824 376\r
70d3fe9d 377 @retval EFI_SUCCESS Success to execute I/O work flow\r
18a73eb7 378 @retval EFI_TIMEOUT Keyboard controller time out.\r
379**/\r
afd0fe22 380EFI_STATUS\r
381In8042Data (\r
382 IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
383 IN OUT UINT8 *Data\r
384 );\r
18a73eb7 385\r
386/**\r
387 Check whether there is Ps/2 mouse device in system\r
388\r
389 @param MouseAbsolutePointerDev - Absolute Pointer Device Private Data Structure\r
390\r
391 @retval TRUE - Keyboard in System.\r
392 @retval FALSE - Keyboard not in System.\r
393\r
394**/\r
afd0fe22 395BOOLEAN\r
396CheckMouseAbsolutePointerConnect (\r
397 IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev\r
398 );\r
399\r
400#endif\r