mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Minor cleanup.
svn path=/trunk/; revision=4958
This commit is contained in:
parent
1b854f5f2a
commit
39825a170b
1 changed files with 72 additions and 71 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: scsiport.c,v 1.28 2003/02/27 20:32:31 ekohl Exp $
|
/* $Id: scsiport.c,v 1.29 2003/06/24 12:31:40 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1457,93 +1457,94 @@ ScsiPortDpcForIsr(IN PKDPC Dpc,
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
DPRINT("ScsiPortDpcForIsr(Dpc %p DpcDeviceObject %p DpcIrp %p DpcContext %p)\n",
|
DPRINT("ScsiPortDpcForIsr(Dpc %p DpcDeviceObject %p DpcIrp %p DpcContext %p)\n",
|
||||||
Dpc, DpcDeviceObject, DpcIrp, DpcContext);
|
Dpc, DpcDeviceObject, DpcIrp, DpcContext);
|
||||||
|
|
||||||
DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)DpcContext;
|
DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)DpcContext;
|
||||||
|
|
||||||
KeAcquireSpinLock(&DeviceExtension->IrpLock, &oldIrql);
|
KeAcquireSpinLock(&DeviceExtension->IrpLock, &oldIrql);
|
||||||
if (DeviceExtension->IrpFlags)
|
if (DeviceExtension->IrpFlags)
|
||||||
{
|
|
||||||
IrpStack = IoGetCurrentIrpStackLocation(DeviceExtension->CurrentIrp);
|
|
||||||
Srb = IrpStack->Parameters.Scsi.Srb;
|
|
||||||
|
|
||||||
if (DeviceExtension->OriginalSrb != NULL)
|
|
||||||
{
|
{
|
||||||
DPRINT("Got sense data!\n");
|
IrpStack = IoGetCurrentIrpStackLocation(DeviceExtension->CurrentIrp);
|
||||||
|
Srb = IrpStack->Parameters.Scsi.Srb;
|
||||||
|
|
||||||
DPRINT("Valid: %x\n", DeviceExtension->InternalSenseData.Valid);
|
if (DeviceExtension->OriginalSrb != NULL)
|
||||||
DPRINT("ErrorCode: %x\n", DeviceExtension->InternalSenseData.ErrorCode);
|
|
||||||
DPRINT("SenseKey: %x\n", DeviceExtension->InternalSenseData.SenseKey);
|
|
||||||
DPRINT("SenseCode: %x\n", DeviceExtension->InternalSenseData.AdditionalSenseCode);
|
|
||||||
|
|
||||||
/* Copy sense data */
|
|
||||||
if (DeviceExtension->OriginalSrb->SenseInfoBufferLength != 0)
|
|
||||||
{
|
{
|
||||||
RtlCopyMemory(DeviceExtension->OriginalSrb->SenseInfoBuffer,
|
DPRINT("Got sense data!\n");
|
||||||
&DeviceExtension->InternalSenseData,
|
|
||||||
sizeof(SENSE_DATA));
|
DPRINT("Valid: %x\n", DeviceExtension->InternalSenseData.Valid);
|
||||||
DeviceExtension->OriginalSrb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
|
DPRINT("ErrorCode: %x\n", DeviceExtension->InternalSenseData.ErrorCode);
|
||||||
|
DPRINT("SenseKey: %x\n", DeviceExtension->InternalSenseData.SenseKey);
|
||||||
|
DPRINT("SenseCode: %x\n", DeviceExtension->InternalSenseData.AdditionalSenseCode);
|
||||||
|
|
||||||
|
/* Copy sense data */
|
||||||
|
if (DeviceExtension->OriginalSrb->SenseInfoBufferLength != 0)
|
||||||
|
{
|
||||||
|
RtlCopyMemory(DeviceExtension->OriginalSrb->SenseInfoBuffer,
|
||||||
|
&DeviceExtension->InternalSenseData,
|
||||||
|
sizeof(SENSE_DATA));
|
||||||
|
DeviceExtension->OriginalSrb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clear current sense data */
|
||||||
|
RtlZeroMemory(&DeviceExtension->InternalSenseData, sizeof(SENSE_DATA));
|
||||||
|
|
||||||
|
IrpStack->Parameters.Scsi.Srb = DeviceExtension->OriginalSrb;
|
||||||
|
DeviceExtension->OriginalSrb = NULL;
|
||||||
|
}
|
||||||
|
else if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) &&
|
||||||
|
(Srb->ScsiStatus == SCSISTAT_CHECK_CONDITION))
|
||||||
|
{
|
||||||
|
DPRINT("SCSIOP_REQUEST_SENSE required!\n");
|
||||||
|
|
||||||
|
DeviceExtension->OriginalSrb = Srb;
|
||||||
|
IrpStack->Parameters.Scsi.Srb = ScsiPortInitSenseRequestSrb(DeviceExtension,
|
||||||
|
Srb);
|
||||||
|
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
||||||
|
if (!KeSynchronizeExecution(DeviceExtension->Interrupt,
|
||||||
|
ScsiPortStartPacket,
|
||||||
|
DeviceExtension))
|
||||||
|
{
|
||||||
|
DPRINT1("Synchronization failed!\n");
|
||||||
|
|
||||||
|
DpcIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DpcIrp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(DpcIrp,
|
||||||
|
IO_NO_INCREMENT);
|
||||||
|
IoStartNextPacket(DpcDeviceObject,
|
||||||
|
FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear current sense data */
|
DeviceExtension->CurrentIrp = NULL;
|
||||||
RtlZeroMemory(&DeviceExtension->InternalSenseData, sizeof(SENSE_DATA));
|
|
||||||
|
|
||||||
IrpStack->Parameters.Scsi.Srb = DeviceExtension->OriginalSrb;
|
|
||||||
DeviceExtension->OriginalSrb = NULL;
|
|
||||||
}
|
|
||||||
else if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) &&
|
|
||||||
(Srb->ScsiStatus == SCSISTAT_CHECK_CONDITION))
|
|
||||||
{
|
|
||||||
DPRINT("SCSIOP_REQUEST_SENSE required!\n");
|
|
||||||
|
|
||||||
DeviceExtension->OriginalSrb = Srb;
|
// DpcIrp->IoStatus.Information = 0;
|
||||||
IrpStack->Parameters.Scsi.Srb = ScsiPortInitSenseRequestSrb(DeviceExtension,
|
// DpcIrp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Srb);
|
|
||||||
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
if (DeviceExtension->IrpFlags & IRP_FLAG_COMPLETE)
|
||||||
if (!KeSynchronizeExecution(DeviceExtension->Interrupt,
|
|
||||||
ScsiPortStartPacket,
|
|
||||||
DeviceExtension))
|
|
||||||
{
|
{
|
||||||
DPRINT("Synchronization failed!\n");
|
DeviceExtension->IrpFlags &= ~IRP_FLAG_COMPLETE;
|
||||||
|
IoCompleteRequest(DpcIrp, IO_NO_INCREMENT);
|
||||||
DpcIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
|
||||||
DpcIrp->IoStatus.Information = 0;
|
|
||||||
IoCompleteRequest(DpcIrp,
|
|
||||||
IO_NO_INCREMENT);
|
|
||||||
IoStartNextPacket(DpcDeviceObject,
|
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
if (DeviceExtension->IrpFlags & IRP_FLAG_NEXT)
|
||||||
|
{
|
||||||
|
DeviceExtension->IrpFlags &= ~IRP_FLAG_NEXT;
|
||||||
|
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
||||||
|
IoStartNextPacket(DpcDeviceObject, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceExtension->CurrentIrp = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
// DpcIrp->IoStatus.Information = 0;
|
|
||||||
// DpcIrp->IoStatus.Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
if (DeviceExtension->IrpFlags & IRP_FLAG_COMPLETE)
|
|
||||||
{
|
|
||||||
DeviceExtension->IrpFlags &= ~IRP_FLAG_COMPLETE;
|
|
||||||
IoCompleteRequest(DpcIrp, IO_NO_INCREMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DeviceExtension->IrpFlags & IRP_FLAG_NEXT)
|
|
||||||
{
|
|
||||||
DeviceExtension->IrpFlags &= ~IRP_FLAG_NEXT;
|
|
||||||
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
|
||||||
IoStartNextPacket(DpcDeviceObject, FALSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
KeReleaseSpinLock(&DeviceExtension->IrpLock, oldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("ScsiPortDpcForIsr() done\n");
|
DPRINT("ScsiPortDpcForIsr() done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue