3 Copyright (c) 1991 Microsoft Corporation
11 These are the structures and defines that are used in the
37 #define DebugPrint(x) ScsiDebugPrint x
49 #undef ExAllocatePoolWithQuota
50 #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'HscS')
51 #define ExAllocatePoolWithQuota(a,b) ExAllocatePoolWithQuotaTag(a,b,'HscS')
54 #define MAXIMUM_RETRIES 4
59 IN PDEVICE_OBJECT DeviceObject
,
60 IN PSCSI_REQUEST_BLOCK Srb
,
61 IN OUT NTSTATUS
*Status
,
65 typedef struct _DEVICE_EXTENSION
{
68 // Back pointer to device object
71 PDEVICE_OBJECT DeviceObject
;
74 // Pointer to port device object
77 PDEVICE_OBJECT PortDeviceObject
;
80 // Length of partition in bytes
83 LARGE_INTEGER PartitionLength
;
86 // Number of bytes before start of partition
89 LARGE_INTEGER StartingOffset
;
92 // Bytes to skew all requests, since DM Driver has been placed on an IDE drive.
98 // Sectors to skew all requests.
104 // Flag to indicate whether DM driver has been located on an IDE drive.
110 // Pointer to the specific class error routine.
113 PCLASS_ERROR ClassError
;
116 // SCSI port driver capabilities
119 PIO_SCSI_CAPABILITIES PortCapabilities
;
122 // Buffer for drive parameters returned in IO device control.
125 PDISK_GEOMETRY DiskGeometry
;
128 // Back pointer to device object of physical device
131 PDEVICE_OBJECT PhysicalDevice
;
134 // Request Sense Buffer
137 PSENSE_DATA SenseData
;
140 // Request timeout in seconds;
146 // System device number
152 // Add default Srb Flags.
158 // Total number of SCSI protocol errors on the device.
164 // Spinlock for split requests
167 KSPIN_LOCK SplitRequestSpinLock
;
170 // Zone header and spin lock for zoned SRB requests.
173 PZONE_HEADER SrbZone
;
175 PKSPIN_LOCK SrbZoneSpinLock
;
178 // Lock count for removable media.
196 // SCSI bus target id
202 // SCSI bus logical unit number
208 // Log2 of sector size
214 // Flag to indicate that the device has write caching enabled.
220 // Build SCSI 1 or SCSI 2 CDBs
225 } DEVICE_EXTENSION
, *PDEVICE_EXTENSION
;
228 // Define context structure for asynchronous completions.
231 typedef struct _COMPLETION_CONTEXT
{
232 PDEVICE_OBJECT DeviceObject
;
233 SCSI_REQUEST_BLOCK Srb
;
234 }COMPLETION_CONTEXT
, *PCOMPLETION_CONTEXT
;
238 ScsiClassGetCapabilities(
239 IN PDEVICE_OBJECT PortDeviceObject
,
240 OUT PIO_SCSI_CAPABILITIES
*PortCapabilities
244 ScsiClassGetInquiryData(
245 IN PDEVICE_OBJECT PortDeviceObject
,
246 IN PSCSI_ADAPTER_BUS_INFO
*ConfigInfo
250 ScsiClassReadDriveCapacity(
251 IN PDEVICE_OBJECT DeviceObject
255 ScsiClassReleaseQueue(
256 IN PDEVICE_OBJECT DeviceObject
260 ScsiClassRemoveDevice(
261 IN PDEVICE_OBJECT PortDeviceObject
,
268 ScsiClassAsynchronousCompletion(
269 PDEVICE_OBJECT DeviceObject
,
275 ScsiClassSplitRequest(
276 IN PDEVICE_OBJECT DeviceObject
,
278 IN ULONG MaximumBytes
282 ScsiClassDeviceControl(
283 PDEVICE_OBJECT DeviceObject
,
289 IN PDEVICE_OBJECT DeviceObject
,
295 ScsiClassIoCompleteAssociated(
296 IN PDEVICE_OBJECT DeviceObject
,
302 ScsiClassInterpretSenseInfo(
303 IN PDEVICE_OBJECT DeviceObject
,
304 IN PSCSI_REQUEST_BLOCK Srb
,
305 IN UCHAR MajorFunctionCode
,
306 IN ULONG IoDeviceCode
,
312 ScsiClassSendSrbSynchronous(
313 PDEVICE_OBJECT DeviceObject
,
314 PSCSI_REQUEST_BLOCK Srb
,
317 BOOLEAN WriteToDevice
321 ScsiClassSendSrbAsynchronous(
322 PDEVICE_OBJECT DeviceObject
,
323 PSCSI_REQUEST_BLOCK Srb
,
327 BOOLEAN WriteToDevice
331 ScsiClassBuildRequest(
332 PDEVICE_OBJECT DeviceObject
,
338 IN PDEVICE_OBJECT DeviceObject
,
339 IN PCHAR ModeSenseBuffer
,
346 IN PDEVICE_OBJECT DeviceObject
,
347 IN PCHAR ModeSelectBuffer
,
353 ScsiClassFindModePage(
354 IN PCHAR ModeSenseBuffer
,
360 ScsiClassClaimDevice(
361 IN PDEVICE_OBJECT PortDeviceObject
,
362 IN PSCSI_INQUIRY_DATA LunInfo
,
364 OUT PDEVICE_OBJECT
*NewPortDeviceObject OPTIONAL
368 ScsiClassInternalIoControl (
369 IN PDEVICE_OBJECT DeviceObject
,