mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 12:26:09 +00:00
Fixed broken handling of SCSI port capabilities.
svn path=/trunk/; revision=3019
This commit is contained in:
parent
0bb513eddf
commit
421ce5c9dc
4 changed files with 42 additions and 64 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: cdrom.c,v 1.10 2002/05/26 20:23:22 ekohl Exp $
|
/* $Id: cdrom.c,v 1.11 2002/06/06 23:19:19 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -202,7 +202,9 @@ CdromClassFindDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("PortCapabilities: %p\n", PortCapabilities);
|
||||||
DPRINT("MaximumTransferLength: %lu\n", PortCapabilities->MaximumTransferLength);
|
DPRINT("MaximumTransferLength: %lu\n", PortCapabilities->MaximumTransferLength);
|
||||||
|
DPRINT("MaximumPhysicalPages: %lu\n", PortCapabilities->MaximumPhysicalPages);
|
||||||
|
|
||||||
/* Get inquiry data */
|
/* Get inquiry data */
|
||||||
Status = ScsiClassGetInquiryData(PortDeviceObject,
|
Status = ScsiClassGetInquiryData(PortDeviceObject,
|
||||||
|
@ -270,7 +272,6 @@ CdromClassFindDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
ExFreePool(PortCapabilities);
|
|
||||||
|
|
||||||
DPRINT("CdromClassFindDevices() done\n");
|
DPRINT("CdromClassFindDevices() done\n");
|
||||||
|
|
||||||
|
@ -433,10 +434,7 @@ CdromClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
||||||
DiskDeviceExtension->DeviceNumber = DeviceNumber;
|
DiskDeviceExtension->DeviceNumber = DeviceNumber;
|
||||||
DiskDeviceExtension->PortDeviceObject = PortDeviceObject;
|
DiskDeviceExtension->PortDeviceObject = PortDeviceObject;
|
||||||
DiskDeviceExtension->PhysicalDevice = DiskDeviceObject;
|
DiskDeviceExtension->PhysicalDevice = DiskDeviceObject;
|
||||||
|
DiskDeviceExtension->PortCapabilities = Capabilities;
|
||||||
/* FIXME: Not yet! Will cause pointer corruption! */
|
|
||||||
// DiskDeviceExtension->PortCapabilities = PortCapabilities;
|
|
||||||
|
|
||||||
DiskDeviceExtension->StartingOffset.QuadPart = 0;
|
DiskDeviceExtension->StartingOffset.QuadPart = 0;
|
||||||
DiskDeviceExtension->PortNumber = (UCHAR)PortNumber;
|
DiskDeviceExtension->PortNumber = (UCHAR)PortNumber;
|
||||||
DiskDeviceExtension->PathId = InquiryData->PathId;
|
DiskDeviceExtension->PathId = InquiryData->PathId;
|
||||||
|
@ -578,7 +576,7 @@ CdromClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
Status = ScsiClassReadDriveCapacity(DeviceObject);
|
Status = ScsiClassReadDriveCapacity(DeviceObject);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer;
|
Geometry = (PDISK_GEOMETRY)Irp->AssociatedIrp.SystemBuffer;
|
||||||
RtlMoveMemory(Geometry,
|
RtlMoveMemory(Geometry,
|
||||||
DeviceExtension->DiskGeometry,
|
DeviceExtension->DiskGeometry,
|
||||||
sizeof(DISK_GEOMETRY));
|
sizeof(DISK_GEOMETRY));
|
||||||
|
|
|
@ -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: class2.c,v 1.20 2002/06/05 19:31:39 hbirr Exp $
|
/* $Id: class2.c,v 1.21 2002/06/06 23:19:36 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -536,20 +536,11 @@ NTSTATUS STDCALL
|
||||||
ScsiClassGetCapabilities(PDEVICE_OBJECT PortDeviceObject,
|
ScsiClassGetCapabilities(PDEVICE_OBJECT PortDeviceObject,
|
||||||
PIO_SCSI_CAPABILITIES *PortCapabilities)
|
PIO_SCSI_CAPABILITIES *PortCapabilities)
|
||||||
{
|
{
|
||||||
PIO_SCSI_CAPABILITIES Buffer;
|
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
|
||||||
*PortCapabilities = NULL;
|
|
||||||
Buffer = ExAllocatePool(NonPagedPool,
|
|
||||||
sizeof(IO_SCSI_CAPABILITIES));
|
|
||||||
if (Buffer == NULL)
|
|
||||||
{
|
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
|
||||||
}
|
|
||||||
|
|
||||||
KeInitializeEvent(&Event,
|
KeInitializeEvent(&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -558,14 +549,13 @@ ScsiClassGetCapabilities(PDEVICE_OBJECT PortDeviceObject,
|
||||||
PortDeviceObject,
|
PortDeviceObject,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
Buffer,
|
PortCapabilities,
|
||||||
sizeof(IO_SCSI_CAPABILITIES),
|
sizeof(PVOID),
|
||||||
FALSE,
|
FALSE,
|
||||||
&Event,
|
&Event,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (Irp == NULL)
|
if (Irp == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool(Buffer);
|
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,14 +571,7 @@ ScsiClassGetCapabilities(PDEVICE_OBJECT PortDeviceObject,
|
||||||
Status = IoStatusBlock.Status;
|
Status = IoStatusBlock.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
DPRINT("PortCapabilities at %p\n", *PortCapabilities);
|
||||||
{
|
|
||||||
ExFreePool(Buffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*PortCapabilities = Buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1486,10 +1469,8 @@ ScsiClassReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IrpStack->Parameters.Read.ByteOffset.QuadPart,
|
IrpStack->Parameters.Read.ByteOffset.QuadPart,
|
||||||
IrpStack->Parameters.Read.Length);
|
IrpStack->Parameters.Read.Length);
|
||||||
|
|
||||||
// MaximumTransferLength = DeviceExtension->PortCapabilities->MaximumTransferLength;
|
MaximumTransferLength = DeviceExtension->PortCapabilities->MaximumTransferLength;
|
||||||
// MaximumTransferPages = DeviceExtension->PortCapabilities->MaximumPhysicalPages;
|
MaximumTransferPages = DeviceExtension->PortCapabilities->MaximumPhysicalPages;
|
||||||
MaximumTransferLength = 0x10000; /* 64 kbytes */
|
|
||||||
MaximumTransferPages = MaximumTransferLength / PAGESIZE;
|
|
||||||
|
|
||||||
CurrentTransferLength = IrpStack->Parameters.Read.Length;
|
CurrentTransferLength = IrpStack->Parameters.Read.Length;
|
||||||
|
|
||||||
|
@ -1560,9 +1541,7 @@ ScsiClassReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
||||||
MaximumTransferLength, CurrentTransferLength);
|
MaximumTransferLength, CurrentTransferLength);
|
||||||
|
|
||||||
/* Adjust the maximum transfer length */
|
/* Adjust the maximum transfer length */
|
||||||
// CurrentTransferPages = DeviceExtension->PortCapabilities->MaximumPhysicalPages - 1;
|
CurrentTransferPages = DeviceExtension->PortCapabilities->MaximumPhysicalPages;
|
||||||
CurrentTransferPages = 0x10000 / PAGESIZE;
|
|
||||||
|
|
||||||
|
|
||||||
if (MaximumTransferLength > CurrentTransferPages * PAGESIZE)
|
if (MaximumTransferLength > CurrentTransferPages * PAGESIZE)
|
||||||
MaximumTransferLength = CurrentTransferPages * PAGESIZE;
|
MaximumTransferLength = CurrentTransferPages * PAGESIZE;
|
||||||
|
|
|
@ -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: disk.c,v 1.14 2002/05/28 09:29:07 ekohl Exp $
|
/* $Id: disk.c,v 1.15 2002/06/06 23:19:53 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -200,7 +200,9 @@ DiskClassFindDevices(PDRIVER_OBJECT DriverObject,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("PortCapabilities: %p\n", PortCapabilities);
|
||||||
DPRINT("MaximumTransferLength: %lu\n", PortCapabilities->MaximumTransferLength);
|
DPRINT("MaximumTransferLength: %lu\n", PortCapabilities->MaximumTransferLength);
|
||||||
|
DPRINT("MaximumPhysicalPages: %lu\n", PortCapabilities->MaximumPhysicalPages);
|
||||||
|
|
||||||
/* Get inquiry data */
|
/* Get inquiry data */
|
||||||
Status = ScsiClassGetInquiryData(PortDeviceObject,
|
Status = ScsiClassGetInquiryData(PortDeviceObject,
|
||||||
|
@ -268,7 +270,6 @@ DiskClassFindDevices(PDRIVER_OBJECT DriverObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
ExFreePool(PortCapabilities);
|
|
||||||
|
|
||||||
DPRINT("DiskClassFindDevices() done\n");
|
DPRINT("DiskClassFindDevices() done\n");
|
||||||
|
|
||||||
|
@ -481,10 +482,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
||||||
DiskDeviceExtension->DeviceNumber = DiskNumber;
|
DiskDeviceExtension->DeviceNumber = DiskNumber;
|
||||||
DiskDeviceExtension->PortDeviceObject = PortDeviceObject;
|
DiskDeviceExtension->PortDeviceObject = PortDeviceObject;
|
||||||
DiskDeviceExtension->PhysicalDevice = DiskDeviceObject;
|
DiskDeviceExtension->PhysicalDevice = DiskDeviceObject;
|
||||||
|
DiskDeviceExtension->PortCapabilities = Capabilities;
|
||||||
/* FIXME: Not yet! Will cause pointer corruption! */
|
|
||||||
// DiskDeviceExtension->PortCapabilities = PortCapabilities;
|
|
||||||
|
|
||||||
DiskDeviceExtension->StartingOffset.QuadPart = 0;
|
DiskDeviceExtension->StartingOffset.QuadPart = 0;
|
||||||
DiskDeviceExtension->PortNumber = (UCHAR)PortNumber;
|
DiskDeviceExtension->PortNumber = (UCHAR)PortNumber;
|
||||||
DiskDeviceExtension->PathId = InquiryData->PathId;
|
DiskDeviceExtension->PathId = InquiryData->PathId;
|
||||||
|
@ -631,10 +629,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
||||||
PartitionDeviceExtension->PortDeviceObject = PortDeviceObject;
|
PartitionDeviceExtension->PortDeviceObject = PortDeviceObject;
|
||||||
PartitionDeviceExtension->DiskGeometry = DiskDeviceExtension->DiskGeometry;
|
PartitionDeviceExtension->DiskGeometry = DiskDeviceExtension->DiskGeometry;
|
||||||
PartitionDeviceExtension->PhysicalDevice = DiskDeviceExtension->PhysicalDevice;
|
PartitionDeviceExtension->PhysicalDevice = DiskDeviceExtension->PhysicalDevice;
|
||||||
|
PartitionDeviceExtension->PortCapabilities = Capabilities;
|
||||||
/* FIXME: Not yet! Will cause pointer corruption! */
|
|
||||||
// PartitionDeviceExtension->PortCapabilities = PortCapabilities;
|
|
||||||
|
|
||||||
PartitionDeviceExtension->StartingOffset.QuadPart =
|
PartitionDeviceExtension->StartingOffset.QuadPart =
|
||||||
PartitionEntry->StartingOffset.QuadPart;
|
PartitionEntry->StartingOffset.QuadPart;
|
||||||
PartitionDeviceExtension->PartitionLength.QuadPart =
|
PartitionDeviceExtension->PartitionLength.QuadPart =
|
||||||
|
@ -659,8 +654,6 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartitionList != NULL)
|
if (PartitionList != NULL)
|
||||||
|
|
|
@ -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.15 2002/05/26 20:25:49 ekohl Exp $
|
/* $Id: scsiport.c,v 1.16 2002/06/06 23:20:08 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -78,6 +78,8 @@ typedef struct _SCSI_PORT_DEVICE_EXTENSION
|
||||||
ULONG PortBusInfoSize;
|
ULONG PortBusInfoSize;
|
||||||
PSCSI_ADAPTER_BUS_INFO PortBusInfo;
|
PSCSI_ADAPTER_BUS_INFO PortBusInfo;
|
||||||
|
|
||||||
|
PIO_SCSI_CAPABILITIES PortCapabilities;
|
||||||
|
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PCONTROLLER_OBJECT ControllerObject;
|
PCONTROLLER_OBJECT ControllerObject;
|
||||||
|
|
||||||
|
@ -896,25 +898,12 @@ ScsiPortDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
case IOCTL_SCSI_GET_CAPABILITIES:
|
case IOCTL_SCSI_GET_CAPABILITIES:
|
||||||
{
|
{
|
||||||
PIO_SCSI_CAPABILITIES Capabilities;
|
|
||||||
|
|
||||||
DPRINT(" IOCTL_SCSI_GET_CAPABILITIES\n");
|
DPRINT(" IOCTL_SCSI_GET_CAPABILITIES\n");
|
||||||
|
|
||||||
Capabilities = (PIO_SCSI_CAPABILITIES)Irp->AssociatedIrp.SystemBuffer;
|
*((PIO_SCSI_CAPABILITIES *)Irp->AssociatedIrp.SystemBuffer) =
|
||||||
Capabilities->Length = sizeof(IO_SCSI_CAPABILITIES);
|
DeviceExtension->PortCapabilities;
|
||||||
Capabilities->MaximumTransferLength =
|
|
||||||
DeviceExtension->PortConfig.MaximumTransferLength;
|
|
||||||
Capabilities->MaximumPhysicalPages = 1;
|
|
||||||
Capabilities->SupportedAsynchronousEvents = 0;
|
|
||||||
Capabilities->AlignmentMask =
|
|
||||||
DeviceExtension->PortConfig.AlignmentMask;
|
|
||||||
Capabilities->TaggedQueuing =
|
|
||||||
DeviceExtension->PortConfig.TaggedQueuing;
|
|
||||||
Capabilities->AdapterScansDown =
|
|
||||||
DeviceExtension->PortConfig.AdapterScansDown;
|
|
||||||
Capabilities->AdapterUsesPio = TRUE;
|
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof(IO_SCSI_CAPABILITIES);
|
Irp->IoStatus.Information = sizeof(PIO_SCSI_CAPABILITIES);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1068,6 +1057,7 @@ ScsiPortCreatePortDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
IN ULONG PortNumber)
|
IN ULONG PortNumber)
|
||||||
{
|
{
|
||||||
PSCSI_PORT_DEVICE_EXTENSION PortDeviceExtension;
|
PSCSI_PORT_DEVICE_EXTENSION PortDeviceExtension;
|
||||||
|
PIO_SCSI_CAPABILITIES PortCapabilities;
|
||||||
PDEVICE_OBJECT PortDeviceObject;
|
PDEVICE_OBJECT PortDeviceObject;
|
||||||
WCHAR NameBuffer[80];
|
WCHAR NameBuffer[80];
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
|
@ -1174,6 +1164,24 @@ ScsiPortCreatePortDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
ScsiPortIoTimer,
|
ScsiPortIoTimer,
|
||||||
PortDeviceExtension);
|
PortDeviceExtension);
|
||||||
|
|
||||||
|
/* Initialize port capabilities */
|
||||||
|
PortCapabilities = ExAllocatePool(NonPagedPool,
|
||||||
|
sizeof(IO_SCSI_CAPABILITIES));
|
||||||
|
PortDeviceExtension->PortCapabilities = PortCapabilities;
|
||||||
|
PortCapabilities->Length = sizeof(IO_SCSI_CAPABILITIES);
|
||||||
|
PortCapabilities->MaximumTransferLength =
|
||||||
|
PortDeviceExtension->PortConfig.MaximumTransferLength;
|
||||||
|
PortCapabilities->MaximumPhysicalPages =
|
||||||
|
PortCapabilities->MaximumTransferLength / PAGESIZE;
|
||||||
|
PortCapabilities->SupportedAsynchronousEvents = 0; /* FIXME */
|
||||||
|
PortCapabilities->AlignmentMask =
|
||||||
|
PortDeviceExtension->PortConfig.AlignmentMask;
|
||||||
|
PortCapabilities->TaggedQueuing =
|
||||||
|
PortDeviceExtension->PortConfig.TaggedQueuing;
|
||||||
|
PortCapabilities->AdapterScansDown =
|
||||||
|
PortDeviceExtension->PortConfig.AdapterScansDown;
|
||||||
|
PortCapabilities->AdapterUsesPio = TRUE; /* FIXME */
|
||||||
|
|
||||||
/* Initialize inquiry data */
|
/* Initialize inquiry data */
|
||||||
PortDeviceExtension->PortBusInfoSize = 0;
|
PortDeviceExtension->PortBusInfoSize = 0;
|
||||||
PortDeviceExtension->PortBusInfo = NULL;
|
PortDeviceExtension->PortBusInfo = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue