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