mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
- 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. svn path=/trunk/; revision=26222
This commit is contained in:
parent
fd27183f35
commit
ebf23937a3
2 changed files with 21 additions and 7 deletions
|
@ -318,7 +318,10 @@ ScsiPortFreeDeviceBase(IN PVOID HwDeviceExtension,
|
||||||
|
|
||||||
//DPRINT("ScsiPortFreeDeviceBase() called\n");
|
//DPRINT("ScsiPortFreeDeviceBase() called\n");
|
||||||
|
|
||||||
DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
SCSI_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
|
|
||||||
/* Initialize our pointers */
|
/* Initialize our pointers */
|
||||||
NextMa = DeviceExtension->MappedAddressList;
|
NextMa = DeviceExtension->MappedAddressList;
|
||||||
|
@ -394,7 +397,9 @@ ScsiPortGetDeviceBase(IN PVOID HwDeviceExtension,
|
||||||
|
|
||||||
//DPRINT ("ScsiPortGetDeviceBase() called\n");
|
//DPRINT ("ScsiPortGetDeviceBase() called\n");
|
||||||
|
|
||||||
DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
SCSI_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
AddressSpace = (ULONG)InIoSpace;
|
AddressSpace = (ULONG)InIoSpace;
|
||||||
if (HalTranslateBusAddress(BusType,
|
if (HalTranslateBusAddress(BusType,
|
||||||
|
@ -901,7 +906,7 @@ ScsiPortInitialize(IN PVOID Argument1,
|
||||||
|
|
||||||
/* Fill Device Extension */
|
/* Fill Device Extension */
|
||||||
DeviceExtension = PortDeviceObject->DeviceExtension;
|
DeviceExtension = PortDeviceObject->DeviceExtension;
|
||||||
|
DPRINT1("DeviceExtension: %p\n", DeviceExtension);
|
||||||
DeviceExtension->Length = DeviceExtensionSize;
|
DeviceExtension->Length = DeviceExtensionSize;
|
||||||
DeviceExtension->DeviceObject = PortDeviceObject;
|
DeviceExtension->DeviceObject = PortDeviceObject;
|
||||||
DeviceExtension->PortNumber = SystemConfig->ScsiPortCount;
|
DeviceExtension->PortNumber = SystemConfig->ScsiPortCount;
|
||||||
|
@ -1656,7 +1661,6 @@ ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType,
|
||||||
Srb = (PSCSI_REQUEST_BLOCK) va_arg (ap, PSCSI_REQUEST_BLOCK);
|
Srb = (PSCSI_REQUEST_BLOCK) va_arg (ap, PSCSI_REQUEST_BLOCK);
|
||||||
|
|
||||||
DPRINT("Notify: RequestComplete (Srb %p)\n", Srb);
|
DPRINT("Notify: RequestComplete (Srb %p)\n", Srb);
|
||||||
// DeviceExtension->IrpFlags |= IRP_FLAG_COMPLETE;
|
|
||||||
|
|
||||||
/* Make sure Srb is allright */
|
/* Make sure Srb is allright */
|
||||||
ASSERT(Srb->SrbStatus != SRB_STATUS_PENDING);
|
ASSERT(Srb->SrbStatus != SRB_STATUS_PENDING);
|
||||||
|
@ -2456,7 +2460,15 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
Srb->QueueTag = SP_UNTAGGED;
|
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 */
|
/* Check some special SRBs */
|
||||||
if (Srb->Function == SRB_FUNCTION_ABORT_COMMAND)
|
if (Srb->Function == SRB_FUNCTION_ABORT_COMMAND)
|
||||||
|
@ -2697,7 +2709,8 @@ SpiAllocateLunExtension (IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
|
||||||
/* Initialize timeout counter */
|
/* Initialize timeout counter */
|
||||||
LunExtension->RequestTimeout = -1;
|
LunExtension->RequestTimeout = -1;
|
||||||
|
|
||||||
/* TODO: Initialize other fields */
|
/* Set maximum queue size */
|
||||||
|
LunExtension->MaxQueueCount = 256;
|
||||||
|
|
||||||
/* Initialize request queue */
|
/* Initialize request queue */
|
||||||
KeInitializeDeviceQueue (&LunExtension->DeviceQueue);
|
KeInitializeDeviceQueue (&LunExtension->DeviceQueue);
|
||||||
|
|
|
@ -206,6 +206,7 @@ typedef struct _SCSI_PORT_DEVICE_EXTENSION
|
||||||
ULONG MaxLunCount;
|
ULONG MaxLunCount;
|
||||||
|
|
||||||
KSPIN_LOCK IrqLock; /* Used when there are 2 irqs */
|
KSPIN_LOCK IrqLock; /* Used when there are 2 irqs */
|
||||||
|
ULONG SequenceNumber; /* Global sequence number for packets */
|
||||||
KSPIN_LOCK SpinLock;
|
KSPIN_LOCK SpinLock;
|
||||||
PKINTERRUPT Interrupt;
|
PKINTERRUPT Interrupt;
|
||||||
PIRP CurrentIrp;
|
PIRP CurrentIrp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue