mirror of
https://github.com/reactos/reactos.git
synced 2025-07-12 15:34:12 +00:00
[USBSTOR][SCSIPORT] Use STORAGE_ADAPTER_DESCRIPTOR from WIN8
This way, these drivers are more compatible with classpnp and cdrom used by ReactOS (and don't fire asserts)
This commit is contained in:
parent
139e8f5308
commit
cbe88e287f
4 changed files with 63 additions and 27 deletions
|
@ -335,7 +335,7 @@ FdoHandleQueryProperty(
|
||||||
goto completeIrp;
|
goto completeIrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR))
|
if (ioStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8))
|
||||||
{
|
{
|
||||||
// buffer too small
|
// buffer too small
|
||||||
PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader = Irp->AssociatedIrp.SystemBuffer;
|
PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader = Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
@ -343,8 +343,8 @@ FdoHandleQueryProperty(
|
||||||
>= sizeof(STORAGE_DESCRIPTOR_HEADER));
|
>= sizeof(STORAGE_DESCRIPTOR_HEADER));
|
||||||
|
|
||||||
// return required size
|
// return required size
|
||||||
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
|
Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
|
@ -352,14 +352,14 @@ FdoHandleQueryProperty(
|
||||||
}
|
}
|
||||||
|
|
||||||
// get adapter descriptor, information is returned in the same buffer
|
// get adapter descriptor, information is returned in the same buffer
|
||||||
PSTORAGE_ADAPTER_DESCRIPTOR adapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
|
PSTORAGE_ADAPTER_DESCRIPTOR_WIN8 adapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
// fill out descriptor
|
// fill out descriptor
|
||||||
// NOTE: STORAGE_ADAPTER_DESCRIPTOR may vary in size, so it's important to zero out
|
// NOTE: STORAGE_ADAPTER_DESCRIPTOR_WIN8 may vary in size, so it's important to zero out
|
||||||
// all unused fields
|
// all unused fields
|
||||||
*adapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR) {
|
*adapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR_WIN8) {
|
||||||
.Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR),
|
.Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
|
||||||
.Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR),
|
.Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
|
||||||
.MaximumTransferLength = portExt->PortCapabilities.MaximumTransferLength,
|
.MaximumTransferLength = portExt->PortCapabilities.MaximumTransferLength,
|
||||||
.MaximumPhysicalPages = portExt->PortCapabilities.MaximumPhysicalPages,
|
.MaximumPhysicalPages = portExt->PortCapabilities.MaximumPhysicalPages,
|
||||||
.AlignmentMask = portExt->PortCapabilities.AlignmentMask,
|
.AlignmentMask = portExt->PortCapabilities.AlignmentMask,
|
||||||
|
@ -373,7 +373,7 @@ FdoHandleQueryProperty(
|
||||||
};
|
};
|
||||||
|
|
||||||
// store returned length
|
// store returned length
|
||||||
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
|
|
||||||
completeIrp:
|
completeIrp:
|
||||||
|
|
|
@ -50,6 +50,23 @@
|
||||||
#define LUNEX_REQUEST_PENDING 0x0020
|
#define LUNEX_REQUEST_PENDING 0x0020
|
||||||
#define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
|
#define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
|
||||||
|
|
||||||
|
// we need this to be compatible with ReactOS' classpnp (which is compiled with NTDDI_WIN8)
|
||||||
|
typedef struct _STORAGE_ADAPTER_DESCRIPTOR_WIN8 {
|
||||||
|
ULONG Version;
|
||||||
|
ULONG Size;
|
||||||
|
ULONG MaximumTransferLength;
|
||||||
|
ULONG MaximumPhysicalPages;
|
||||||
|
ULONG AlignmentMask;
|
||||||
|
BOOLEAN AdapterUsesPio;
|
||||||
|
BOOLEAN AdapterScansDown;
|
||||||
|
BOOLEAN CommandQueueing;
|
||||||
|
BOOLEAN AcceleratedTransfer;
|
||||||
|
UCHAR BusType;
|
||||||
|
USHORT BusMajorVersion;
|
||||||
|
USHORT BusMinorVersion;
|
||||||
|
UCHAR SrbType;
|
||||||
|
UCHAR AddressType;
|
||||||
|
} STORAGE_ADAPTER_DESCRIPTOR_WIN8, *PSTORAGE_ADAPTER_DESCRIPTOR_WIN8;
|
||||||
|
|
||||||
typedef enum _SCSI_PORT_TIMER_STATES
|
typedef enum _SCSI_PORT_TIMER_STATES
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,7 +230,7 @@ USBSTOR_HandleQueryProperty(
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
PSTORAGE_PROPERTY_QUERY PropertyQuery;
|
PSTORAGE_PROPERTY_QUERY PropertyQuery;
|
||||||
PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader;
|
PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader;
|
||||||
PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor;
|
PSTORAGE_ADAPTER_DESCRIPTOR_WIN8 AdapterDescriptor;
|
||||||
ULONG FieldLengthVendor, FieldLengthProduct, FieldLengthRevision, TotalLength, FieldLengthSerialNumber;
|
ULONG FieldLengthVendor, FieldLengthProduct, FieldLengthRevision, TotalLength, FieldLengthSerialNumber;
|
||||||
PPDO_DEVICE_EXTENSION PDODeviceExtension;
|
PPDO_DEVICE_EXTENSION PDODeviceExtension;
|
||||||
PINQUIRYDATA InquiryData;
|
PINQUIRYDATA InquiryData;
|
||||||
|
@ -375,39 +375,40 @@ USBSTOR_HandleQueryProperty(
|
||||||
|
|
||||||
DPRINT("USBSTOR_HandleQueryProperty StorageAdapterProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
DPRINT("USBSTOR_HandleQueryProperty StorageAdapterProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
||||||
|
|
||||||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR))
|
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8))
|
||||||
{
|
{
|
||||||
// buffer too small
|
// buffer too small
|
||||||
DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
|
DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
|
||||||
ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
|
ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
|
||||||
|
|
||||||
// return required size
|
// return required size
|
||||||
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
|
Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get adapter descriptor, information is returned in the same buffer
|
// get adapter descriptor, information is returned in the same buffer
|
||||||
AdapterDescriptor = (PSTORAGE_ADAPTER_DESCRIPTOR)Irp->AssociatedIrp.SystemBuffer;
|
AdapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
// fill out descriptor
|
// fill out descriptor
|
||||||
AdapterDescriptor->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
// NOTE: STORAGE_ADAPTER_DESCRIPTOR_WIN8 may vary in size, so it's important to zero out
|
||||||
AdapterDescriptor->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
// all unused fields
|
||||||
AdapterDescriptor->MaximumTransferLength = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH;
|
*AdapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR_WIN8) {
|
||||||
AdapterDescriptor->MaximumPhysicalPages = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH / PAGE_SIZE + 1; // See CORE-10515 and CORE-10755
|
.Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
|
||||||
AdapterDescriptor->AlignmentMask = 0;
|
.Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
|
||||||
AdapterDescriptor->AdapterUsesPio = FALSE;
|
.MaximumTransferLength = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH,
|
||||||
AdapterDescriptor->AdapterScansDown = FALSE;
|
.MaximumPhysicalPages = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH / PAGE_SIZE + 1, // See CORE-10515 and CORE-10755
|
||||||
AdapterDescriptor->CommandQueueing = FALSE;
|
.BusType = BusTypeUsb,
|
||||||
AdapterDescriptor->AcceleratedTransfer = FALSE;
|
.BusMajorVersion = 2, //FIXME verify
|
||||||
AdapterDescriptor->BusType = BusTypeUsb;
|
.BusMinorVersion = 0 //FIXME
|
||||||
AdapterDescriptor->BusMajorVersion = 0x2; //FIXME verify
|
};
|
||||||
AdapterDescriptor->BusMinorVersion = 0x00; //FIXME
|
|
||||||
|
// __debugbreak();
|
||||||
|
|
||||||
// store returned length
|
// store returned length
|
||||||
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
|
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,24 @@ typedef struct _ERRORHANDLER_WORKITEM_DATA
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
} ERRORHANDLER_WORKITEM_DATA, *PERRORHANDLER_WORKITEM_DATA;
|
} ERRORHANDLER_WORKITEM_DATA, *PERRORHANDLER_WORKITEM_DATA;
|
||||||
|
|
||||||
|
// we need this to be compatible with ReactOS' classpnp (which is compiled with NTDDI_WIN8)
|
||||||
|
typedef struct _STORAGE_ADAPTER_DESCRIPTOR_WIN8 {
|
||||||
|
ULONG Version;
|
||||||
|
ULONG Size;
|
||||||
|
ULONG MaximumTransferLength;
|
||||||
|
ULONG MaximumPhysicalPages;
|
||||||
|
ULONG AlignmentMask;
|
||||||
|
BOOLEAN AdapterUsesPio;
|
||||||
|
BOOLEAN AdapterScansDown;
|
||||||
|
BOOLEAN CommandQueueing;
|
||||||
|
BOOLEAN AcceleratedTransfer;
|
||||||
|
UCHAR BusType;
|
||||||
|
USHORT BusMajorVersion;
|
||||||
|
USHORT BusMinorVersion;
|
||||||
|
UCHAR SrbType;
|
||||||
|
UCHAR AddressType;
|
||||||
|
} STORAGE_ADAPTER_DESCRIPTOR_WIN8, *PSTORAGE_ADAPTER_DESCRIPTOR_WIN8;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue