47 WARN_(I8042PRT,
"Can't read i8042 mode\n");
54 WARN_(I8042PRT,
"No response after read i8042 mode\n");
58 Value &= ~FlagsToDisable;
59 Value |= FlagsToEnable;
63 WARN_(I8042PRT,
"Can't set i8042 mode\n");
69 WARN_(I8042PRT,
"Can't send i8042 mode\n");
81 ULONG ResendIterations;
92 ResendIterations = DeviceExtension->Settings.ResendIterations + 1;
93 while (ResendIterations--)
97 WARN_(I8042PRT,
"Writing CTRL_SELF_TEST command failed\n");
104 WARN_(I8042PRT,
"Failed to read CTRL_SELF_TEST response, status 0x%08lx\n",
Status);
110 INFO_(I8042PRT,
"CTRL_SELF_TEST completed successfully!\n");
115 TRACE_(I8042PRT,
"Resending...\n");
120 WARN_(I8042PRT,
"Got 0x%02x instead of 0x55\n",
Value);
141 WARN_(I8042PRT,
"Can't finish SET_LEDS (0x%08lx)\n",
Status);
147 WARN_(I8042PRT,
"Warning: can't write SET_LEDS (0x%08lx)\n",
Status);
161 INFO_(I8042PRT,
"Keyboard detected\n");
180 WARN_(I8042PRT,
"Mouse line test failed\n");
190 WARN_(I8042PRT,
"Failed to write reset command to mouse\n");
206 ReplyByte <
sizeof(ExpectedReply) /
sizeof(ExpectedReply[0]);
224 WARN_(I8042PRT,
"No ACK after mouse reset, status 0x%08lx\n",
Status);
227 else if (
Value != ExpectedReply[ReplyByte])
229 WARN_(I8042PRT,
"Unexpected reply: 0x%02x (expected 0x%02x)\n",
Value, ExpectedReply[ReplyByte]);
240 WARN_(I8042PRT,
"Last byte was not transmitted after mouse reset, status 0x%08lx\n",
Status);
243 else if(
Value != 0x00)
245 WARN_(I8042PRT,
"Last byte after mouse reset was not 0x00, but 0x%02x\n",
Value);
250 INFO_(I8042PRT,
"Mouse detected\n");
263 INFO_(I8042PRT,
"Mouse not detected\n");
274 TRACE_(I8042PRT,
"i8042ConnectKeyboardInterrupt()\n");
276 PortDeviceExtension = DeviceExtension->
Common.PortDeviceExtension;
285 INFO_(I8042PRT,
"KeyboardInterrupt.Vector %lu\n",
287 INFO_(I8042PRT,
"KeyboardInterrupt.Dirql %lu\n",
289 INFO_(I8042PRT,
"KeyboardInterrupt.DirqlMax %lu\n",
291 INFO_(I8042PRT,
"KeyboardInterrupt.InterruptMode %s\n",
293 INFO_(I8042PRT,
"KeyboardInterrupt.ShareInterrupt %s\n",
295 INFO_(I8042PRT,
"KeyboardInterrupt.Affinity 0x%lx\n",
300 DeviceExtension, &PortDeviceExtension->
SpinLock,
306 WARN_(I8042PRT,
"IoConnectInterrupt() failed with status 0x%08x\n",
Status);
324 TRACE_(I8042PRT,
"i8042ConnectMouseInterrupt()\n");
330 PortDeviceExtension = DeviceExtension->
Common.PortDeviceExtension;
335 INFO_(I8042PRT,
"MouseInterrupt.Vector %lu\n",
337 INFO_(I8042PRT,
"MouseInterrupt.Dirql %lu\n",
339 INFO_(I8042PRT,
"MouseInterrupt.DirqlMax %lu\n",
341 INFO_(I8042PRT,
"MouseInterrupt.InterruptMode %s\n",
343 INFO_(I8042PRT,
"MouseInterrupt.ShareInterrupt %s\n",
345 INFO_(I8042PRT,
"MouseInterrupt.Affinity 0x%lx\n",
350 DeviceExtension, &PortDeviceExtension->
SpinLock,
356 WARN_(I8042PRT,
"IoConnectInterrupt() failed with status 0x%08x\n",
Status);
369 PortDeviceExtension->
Flags &= ~MOUSE_INITIALIZED;
398 UCHAR FlagsToDisable = 0;
399 UCHAR FlagsToEnable = 0;
402 if (DeviceExtension->DataPort == 0)
411 TRACE_(I8042PRT,
"Check if the controller is really a i8042\n");
415 WARN_(I8042PRT,
"i8042BasicDetect() failed with status 0x%08lx\n",
Status);
421 TRACE_(I8042PRT,
"Detecting mouse\n");
423 TRACE_(I8042PRT,
"Detecting keyboard\n");
427 INFO_(I8042PRT,
"Mouse present : %s\n", DeviceExtension->Flags &
MOUSE_PRESENT ?
"YES" :
"NO");
429 TRACE_(I8042PRT,
"Enabling i8042 interrupts\n");
444 WARN_(I8042PRT,
"EnableInterrupts failed: %lx\n",
Status);
464 WARN_(I8042PRT,
"i8042ConnectKeyboardInterrupt failed: %lx\n",
Status);
481 WARN_(I8042PRT,
"i8042ConnectMouseInterrupt failed: %lx\n",
Status);
523 WARN_(I8042PRT,
"No allocated resources sent to driver\n");
528 WARN_(I8042PRT,
"Wrong number of allocated resources sent to driver\n");
536 WARN_(I8042PRT,
"Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
547 ResourceDescriptor = &
AllocatedResources->List[0].PartialResourceList.PartialDescriptors[
i];
549 switch (ResourceDescriptor->
Type)
553 if (ResourceDescriptor->
u.
Port.Length == 1)
562 INFO_(I8042PRT,
"Found data port: %p\n", PortDeviceExtension->
DataPort);
563 FoundDataPort =
TRUE;
565 else if (!FoundControlPort)
568 INFO_(I8042PRT,
"Found control port: %p\n", PortDeviceExtension->
ControlPort);
569 FoundControlPort =
TRUE;
574 ERR_(I8042PRT,
"Unhandled I/O ranges provided: 0x%lx\n", ResourceDescriptor->
u.
Port.Length);
578 WARN_(I8042PRT,
"Invalid I/O range length: 0x%lx\n", ResourceDescriptor->
u.
Port.Length);
593 INFO_(I8042PRT,
"Found irq resource: %lu\n", ResourceDescriptor->
u.
Interrupt.Level);
598 WARN_(I8042PRT,
"Unknown resource descriptor type 0x%x\n", ResourceDescriptor->
Type);
604 WARN_(I8042PRT,
"Interrupt resource was not found in allocated resources list\n");
607 else if (DeviceExtension->
Type ==
Keyboard && (!FoundDataPort || !FoundControlPort))
609 WARN_(I8042PRT,
"Some required resources were not found in allocated resources list\n");
612 else if (DeviceExtension->
Type ==
Mouse && (FoundDataPort || FoundControlPort))
614 WARN_(I8042PRT,
"Too much resources were provided in allocated resources list\n");
618 switch (DeviceExtension->
Type)
642 WARN_(I8042PRT,
"Unknown FDO type %u\n", DeviceExtension->
Type);
695 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
709 Stack->Parameters.StartDevice.AllocatedResources,
710 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
720 switch (
Stack->Parameters.QueryDeviceRelations.Type)
724 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
729 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
733 ERR_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
734 Stack->Parameters.QueryDeviceRelations.Type);
741 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
746 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
751 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
756 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n");
761 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n");
766 TRACE_(I8042PRT,
"IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
PDEVICE_OBJECT PhysicalDeviceObject
#define NT_SUCCESS(StatCode)
static void cleanup(void)
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define RemoveEntryList(Entry)
#define KeReleaseSpinLock(sl, irql)
#define KeAcquireSpinLock(sl, irql)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define CmResourceTypePort
#define CmResourceTypeInterrupt
NTSTATUS i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
VOID i8042Flush(IN PPORT_DEVICE_EXTENSION DeviceExtension)
#define KEYBOARD_CONNECTED
KSERVICE_ROUTINE i8042MouInterruptService
NTSTATUS i8042MouInitialize(IN PI8042_MOUSE_EXTENSION DeviceExtension)
KSERVICE_ROUTINE i8042KbdInterruptService
#define KEYBOARD_INITIALIZED
BOOLEAN i8042IsrWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Value, IN UCHAR SelectCmd OPTIONAL)
NTSTATUS NTAPI i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Port, IN UCHAR Value, IN BOOLEAN WaitForAck)
DRIVER_DISPATCH ForwardIrpAndForget
struct _I8042_DRIVER_EXTENSION * PI8042_DRIVER_EXTENSION
#define MOUSE_INITIALIZED
enum _I8042_DEVICE_TYPE I8042_DEVICE_TYPE
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
#define CCB_MOUSE_INT_ENAB
#define KeStallExecutionProcessor(MicroSeconds)
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResourcesTranslated
#define CM_RESOURCE_INTERRUPT_LATCHED
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
#define IoCompleteRequest
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
#define STATUS_REVISION_MISMATCH
PPCI_DRIVER_EXTENSION DriverExtension
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392::@394 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@392::@395 Interrupt
PDEVICE_OBJECT LowerDevice
PPORT_DEVICE_EXTENSION PortDeviceExtension
KINTERRUPT_MODE InterruptMode
INTERRUPT_DATA KeyboardInterrupt
PKINTERRUPT HighestDIRQLInterrupt
INTERRUPT_DATA MouseInterrupt
COMMON_DEVICE_EXTENSION Common
static LARGE_INTEGER Counter
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_IO_DEVICE_ERROR
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define STATUS_IO_TIMEOUT
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ UCHAR _In_ UCHAR MinorFunction
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql