Author: cgutman
Date: Fri Sep 30 23:01:45 2011
New Revision: 53911
URL:
http://svn.reactos.org/svn/reactos?rev=53911&view=rev
Log:
[I8042PRT]
- Enable all interrupts at the same time to avoid a condition where the controller stops
responding to KBD_READ_MODE on some systems
- See bug #6271 for details
Modified:
trunk/reactos/drivers/input/i8042prt/pnp.c
Modified: trunk/reactos/drivers/input/i8042prt/pnp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/i8042prt/pnp…
==============================================================================
--- trunk/reactos/drivers/input/i8042prt/pnp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/input/i8042prt/pnp.c [iso-8859-1] Fri Sep 30 23:01:45 2011
@@ -381,16 +381,6 @@
if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable))
return STATUS_UNSUCCESSFUL;
- /* Reset the mouse (if any) to start the detection */
- if (DeviceExtension->Flags & MOUSE_PRESENT)
- {
- KIRQL Irql;
-
- Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt);
- i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE);
- KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql);
- }
-
return STATUS_SUCCESS;
}
@@ -401,6 +391,7 @@
NTSTATUS Status;
UCHAR FlagsToDisable = 0;
UCHAR FlagsToEnable = 0;
+ KIRQL Irql;
if (DeviceExtension->DataPort == 0)
{
@@ -434,6 +425,25 @@
INFO_(I8042PRT, "Keyboard present: %s\n", DeviceExtension->Flags
& KEYBOARD_PRESENT ? "YES" : "NO");
INFO_(I8042PRT, "Mouse present : %s\n", DeviceExtension->Flags
& MOUSE_PRESENT ? "YES" : "NO");
+
+ TRACE_(I8042PRT, "Enabling i8042 interrupts\n");
+ if (DeviceExtension->Flags & KEYBOARD_PRESENT)
+ {
+ FlagsToDisable |= CCB_KBD_DISAB;
+ FlagsToEnable |= CCB_KBD_INT_ENAB;
+ }
+ if (DeviceExtension->Flags & MOUSE_PRESENT)
+ {
+ FlagsToDisable |= CCB_MOUSE_DISAB;
+ FlagsToEnable |= CCB_MOUSE_INT_ENAB;
+ }
+
+ Status = EnableInterrupts(DeviceExtension, FlagsToDisable, FlagsToEnable);
+ if (!NT_SUCCESS(Status))
+ {
+ DeviceExtension->Flags &= ~(KEYBOARD_PRESENT | MOUSE_PRESENT);
+ return Status;
+ }
}
/* Connect interrupts */
@@ -447,8 +457,6 @@
if (NT_SUCCESS(Status))
{
DeviceExtension->Flags |= KEYBOARD_INITIALIZED;
- FlagsToDisable |= CCB_KBD_DISAB;
- FlagsToEnable |= CCB_KBD_INT_ENAB;
}
}
@@ -462,15 +470,13 @@
if (NT_SUCCESS(Status))
{
DeviceExtension->Flags |= MOUSE_INITIALIZED;
- FlagsToDisable |= CCB_MOUSE_DISAB;
- FlagsToEnable |= CCB_MOUSE_INT_ENAB;
- }
- }
-
- if (FlagsToEnable)
- Status = EnableInterrupts(DeviceExtension, FlagsToDisable, FlagsToEnable);
- else
- Status = STATUS_SUCCESS;
+ }
+
+ /* Start the mouse */
+ Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt);
+ i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE);
+ KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql);
+ }
return Status;
}