Author: fireball
Date: Sun Apr 1 00:47:42 2007
New Revision: 26222
URL:
http://svn.reactos.org/svn/reactos?rev=26222&view=rev
Log:
- Fix a few obvious bugs (incorrect DeviceExtension pointer arithmetic, non-initialized
field usage).
- Packets are sequentially numbered.
Now all devices are perfectly enumerated (SpBuildDeviceMap() may still need work, but
later), and problem occurs later when servicing IOCTLs.
Modified:
trunk/reactos/drivers/storage/scsiport-new/scsiport.c
trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h
Modified: trunk/reactos/drivers/storage/scsiport-new/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport-n…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport-new/scsiport.c (original)
+++ trunk/reactos/drivers/storage/scsiport-new/scsiport.c Sun Apr 1 00:47:42 2007
@@ -318,7 +318,10 @@
//DPRINT("ScsiPortFreeDeviceBase() called\n");
- DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
+ DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
+ SCSI_PORT_DEVICE_EXTENSION,
+ MiniPortDeviceExtension);
+
/* Initialize our pointers */
NextMa = DeviceExtension->MappedAddressList;
@@ -394,7 +397,9 @@
//DPRINT ("ScsiPortGetDeviceBase() called\n");
- DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
+ DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
+ SCSI_PORT_DEVICE_EXTENSION,
+ MiniPortDeviceExtension);
AddressSpace = (ULONG)InIoSpace;
if (HalTranslateBusAddress(BusType,
@@ -901,7 +906,7 @@
/* Fill Device Extension */
DeviceExtension = PortDeviceObject->DeviceExtension;
-
+ DPRINT1("DeviceExtension: %p\n", DeviceExtension);
DeviceExtension->Length = DeviceExtensionSize;
DeviceExtension->DeviceObject = PortDeviceObject;
DeviceExtension->PortNumber = SystemConfig->ScsiPortCount;
@@ -1656,7 +1661,6 @@
Srb = (PSCSI_REQUEST_BLOCK) va_arg (ap, PSCSI_REQUEST_BLOCK);
DPRINT("Notify: RequestComplete (Srb %p)\n", Srb);
- // DeviceExtension->IrpFlags |= IRP_FLAG_COMPLETE;
/* Make sure Srb is allright */
ASSERT(Srb->SrbStatus != SRB_STATUS_PENDING);
@@ -2456,7 +2460,15 @@
Srb->QueueTag = SP_UNTAGGED;
}
- /* FIXME: Increase sequence number here of SRB, if it's ever needed */
+ /* Increase sequence number of SRB */
+ if (!SrbInfo->SequenceNumber)
+ {
+ /* Increase global sequence number */
+ DeviceExtension->SequenceNumber++;
+
+ /* Assign it */
+ SrbInfo->SequenceNumber = DeviceExtension->SequenceNumber;
+ }
/* Check some special SRBs */
if (Srb->Function == SRB_FUNCTION_ABORT_COMMAND)
@@ -2656,7 +2668,7 @@
/* Call HwStartIo routine */
Result =
DeviceExtension->HwStartIo(&DeviceExtension->MiniPortDeviceExtension,
- Srb);
+ Srb);
/* If notification is needed, then request a DPC */
if (DeviceExtension->InterruptData.Flags & SCSI_PORT_NOTIFICATION_NEEDED)
@@ -2697,7 +2709,8 @@
/* Initialize timeout counter */
LunExtension->RequestTimeout = -1;
- /* TODO: Initialize other fields */
+ /* Set maximum queue size */
+ LunExtension->MaxQueueCount = 256;
/* Initialize request queue */
KeInitializeDeviceQueue (&LunExtension->DeviceQueue);
Modified: trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport-n…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h (original)
+++ trunk/reactos/drivers/storage/scsiport-new/scsiport_int.h Sun Apr 1 00:47:42 2007
@@ -206,6 +206,7 @@
ULONG MaxLunCount;
KSPIN_LOCK IrqLock; /* Used when there are 2 irqs */
+ ULONG SequenceNumber; /* Global sequence number for packets */
KSPIN_LOCK SpinLock;
PKINTERRUPT Interrupt;
PIRP CurrentIrp;