- Check for the current irql, if there is a call to IoStartNextPacket.

If it is  necessary, raise the irql to DISPATCH_LEVEL.

svn path=/trunk/; revision=6487
This commit is contained in:
Hartmut Birr 2003-11-01 10:42:32 +00:00
parent 7e110a9faa
commit 49a370ce14
6 changed files with 122 additions and 24 deletions

View file

@ -708,10 +708,21 @@ VOID STDCALL KbdStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (KeSynchronizeExecution(KbdInterrupt, KbdSynchronizeRoutine, Irp))
{
KIRQL oldIrql;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoStartNextPacket(DeviceObject, FALSE);
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
}
DPRINT("stk->Parameters.Read.Length %d\n",stk->Parameters.Read.Length);

View file

@ -248,6 +248,7 @@ VOID MouseClassStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if(DeviceExtension->InputCount>0)
{
KIRQL oldIrql;
// FIXME: We should not send too much input data.. depends on the max buffer size of the win32k
ReadSize = DeviceExtension->InputCount * sizeof(MOUSE_INPUT_DATA);
@ -263,9 +264,18 @@ VOID MouseClassStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Irp->IoStatus.Information = ReadSize;
Stack->Parameters.Read.Length = ReadSize;
IoStartNextPacket(DeviceObject, FALSE);
IoCompleteRequest(Irp, IO_MOUSE_INCREMENT);
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
} else {
DeviceExtension->ReadIsPending = TRUE;
}

View file

@ -41,10 +41,21 @@ PS2MouseStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (KeSynchronizeExecution(DeviceExtension->MouseInterrupt, MouseSynchronizeRoutine, Irp))
{
KIRQL oldIrql;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoStartNextPacket(DeviceObject, FALSE);
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
}
}

View file

@ -254,10 +254,21 @@ SerialMouseStartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (KeSynchronizeExecution(DeviceExtension->MouseInterrupt, MouseSynchronizeRoutine, Irp))
{
KIRQL oldIrql;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoStartNextPacket(DeviceObject, FALSE);
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
}
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: class2.c,v 1.41 2003/10/15 22:16:44 vizzini Exp $
/* $Id: class2.c,v 1.42 2003/11/01 10:42:32 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1269,8 +1269,18 @@ ScsiClassIoComplete(IN PDEVICE_OBJECT DeviceObject,
{
if (IrpStack->MajorFunction != IRP_MJ_DEVICE_CONTROL)
{
IoStartNextPacket(DeviceObject,
FALSE);
KIRQL oldIrql;
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
}
}
@ -1372,8 +1382,18 @@ ScsiClassIoCompleteAssociated(IN PDEVICE_OBJECT DeviceObject,
if (DeviceExtension->ClassStartIo)
{
IoStartNextPacket(DeviceObject,
FALSE);
KIRQL oldIrql;
oldIrql = KeGetCurrentIrql();
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL, &oldIrql);
IoStartNextPacket (DeviceObject, FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject, FALSE);
}
}
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: scsiport.c,v 1.42 2003/10/19 10:43:10 robd Exp $
/* $Id: scsiport.c,v 1.43 2003/11/01 10:42:32 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1553,6 +1553,8 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
DPRINT("DeviceExtension %p\n", DeviceExtension);
oldIrql = KeGetCurrentIrql();
if (IrpStack->MajorFunction != IRP_MJ_SCSI)
{
DPRINT("No IRP_MJ_SCSI!\n");
@ -1560,8 +1562,19 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
Irp->IoStatus.Information = 0;
IoCompleteRequest (Irp,
IO_NO_INCREMENT);
IoStartNextPacket (DeviceObject,
FALSE);
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL,
&oldIrql);
IoStartNextPacket (DeviceObject,
FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject,
FALSE);
}
return;
}
@ -1578,8 +1591,19 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
Irp->IoStatus.Information = 0;
IoCompleteRequest (Irp,
IO_NO_INCREMENT);
IoStartNextPacket (DeviceObject,
FALSE);
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL,
&oldIrql);
IoStartNextPacket (DeviceObject,
FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject,
FALSE);
}
return;
}
@ -1619,8 +1643,19 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
IoStartNextPacket(DeviceObject,
FALSE);
if (oldIrql < DISPATCH_LEVEL)
{
KeRaiseIrql (DISPATCH_LEVEL,
&oldIrql);
IoStartNextPacket (DeviceObject,
FALSE);
KeLowerIrql(oldIrql);
}
else
{
IoStartNextPacket (DeviceObject,
FALSE);
}
}
KeAcquireSpinLock(&DeviceExtension->IrpLock, &oldIrql);
@ -1634,9 +1669,10 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
if (DeviceExtension->IrpFlags & IRP_FLAG_NEXT)
{
DeviceExtension->IrpFlags &= ~IRP_FLAG_NEXT;
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
KeReleaseSpinLockFromDpcLevel(&DeviceExtension->IrpLock);
IoStartNextPacket(DeviceObject,
FALSE);
KeLowerIrql(oldIrql);
}
else
{
@ -2015,14 +2051,13 @@ ScsiPortDpcForIsr(IN PKDPC Dpc,
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
PIO_STACK_LOCATION IrpStack;
PSCSI_REQUEST_BLOCK Srb;
KIRQL oldIrql;
DPRINT("ScsiPortDpcForIsr(Dpc %p DpcDeviceObject %p DpcIrp %p DpcContext %p)\n",
Dpc, DpcDeviceObject, DpcIrp, DpcContext);
DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)DpcContext;
KeAcquireSpinLock(&DeviceExtension->IrpLock, &oldIrql);
KeAcquireSpinLockAtDpcLevel(&DeviceExtension->IrpLock);
if (DeviceExtension->IrpFlags)
{
IrpStack = IoGetCurrentIrpStackLocation(DeviceExtension->CurrentIrp);
@ -2068,7 +2103,7 @@ ScsiPortDpcForIsr(IN PKDPC Dpc,
DeviceExtension->OriginalSrb = Srb;
IrpStack->Parameters.Scsi.Srb = ScsiPortInitSenseRequestSrb(DeviceExtension,
Srb);
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
KeReleaseSpinLockFromDpcLevel(&DeviceExtension->IrpLock);
if (!KeSynchronizeExecution(DeviceExtension->Interrupt,
ScsiPortStartPacket,
DeviceExtension))
@ -2100,17 +2135,17 @@ ScsiPortDpcForIsr(IN PKDPC Dpc,
if (DeviceExtension->IrpFlags & IRP_FLAG_NEXT)
{
DeviceExtension->IrpFlags &= ~IRP_FLAG_NEXT;
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
KeReleaseSpinLockFromDpcLevel(&DeviceExtension->IrpLock);
IoStartNextPacket(DpcDeviceObject, FALSE);
}
else
{
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
KeReleaseSpinLockFromDpcLevel(&DeviceExtension->IrpLock);
}
}
else
{
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
KeReleaseSpinLockFromDpcLevel(&DeviceExtension->IrpLock);
}
DPRINT("ScsiPortDpcForIsr() done\n");