|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1991 Microsoft Corporation ! 4: ! 5: Module Name: ! 6: ! 7: class.h ! 8: ! 9: Abstract: ! 10: ! 11: These are the structures and defines that are used in the ! 12: SCSI class drivers. ! 13: ! 14: Author: ! 15: ! 16: Mike Glass (mglass) ! 17: Jeff Havens (jhavens) ! 18: ! 19: Revision History: ! 20: ! 21: --*/ ! 22: ! 23: #ifndef _CLASS_ ! 24: ! 25: #include <ntdddisk.h> ! 26: #include <ntddcdrm.h> ! 27: #include <ntddtape.h> ! 28: #include "ntddscsi.h" ! 29: #include <stdio.h> ! 30: ! 31: #if DBG ! 32: ! 33: #define DebugPrint(x) ScsiDebugPrint x ! 34: ! 35: #else ! 36: ! 37: #define DebugPrint(x) ! 38: ! 39: #endif // DBG ! 40: ! 41: #define MAXIMUM_RETRIES 4 ! 42: ! 43: typedef ! 44: VOID ! 45: (*PCLASS_ERROR) ( ! 46: IN PDEVICE_OBJECT DeviceObject, ! 47: IN PSCSI_REQUEST_BLOCK Srb, ! 48: IN OUT NTSTATUS *Status, ! 49: IN OUT BOOLEAN *Retry ! 50: ); ! 51: ! 52: typedef struct _DEVICE_EXTENSION { ! 53: ! 54: // ! 55: // Back pointer to device object ! 56: // ! 57: ! 58: PDEVICE_OBJECT DeviceObject; ! 59: ! 60: // ! 61: // Pointer to port device object ! 62: // ! 63: ! 64: PDEVICE_OBJECT PortDeviceObject; ! 65: ! 66: // ! 67: // Length of partition in bytes ! 68: // ! 69: ! 70: LARGE_INTEGER PartitionLength; ! 71: ! 72: // ! 73: // Number of bytes before start of partition ! 74: // ! 75: ! 76: LARGE_INTEGER StartingOffset; ! 77: ! 78: // ! 79: // Pointer to the specific class error routine. ! 80: // ! 81: ! 82: PCLASS_ERROR ClassError; ! 83: ! 84: // ! 85: // SCSI port driver capabilities ! 86: // ! 87: ! 88: PIO_SCSI_CAPABILITIES PortCapabilities; ! 89: ! 90: // ! 91: // Buffer for drive parameters returned in IO device control. ! 92: // ! 93: ! 94: PDISK_GEOMETRY DiskGeometry; ! 95: ! 96: // ! 97: // Back pointer to device object of physical device ! 98: // ! 99: ! 100: PDEVICE_OBJECT PhysicalDevice; ! 101: ! 102: // ! 103: // Request Sense Buffer ! 104: // ! 105: ! 106: PSENSE_DATA SenseData; ! 107: ! 108: // ! 109: // Request timeout in seconds; ! 110: // ! 111: ! 112: ULONG TimeOutValue; ! 113: ! 114: // ! 115: // System device number ! 116: // ! 117: ! 118: ULONG DeviceNumber; ! 119: ! 120: // ! 121: // Add default Srb Flags. ! 122: // ! 123: ! 124: ULONG SrbFlags; ! 125: ! 126: // ! 127: // Total number of SCSI protocol errors on the device. ! 128: // ! 129: ! 130: ULONG ErrorCount; ! 131: ! 132: // ! 133: // Spinlock for split requests ! 134: // ! 135: ! 136: KSPIN_LOCK SplitRequestSpinLock; ! 137: ! 138: // ! 139: // Zone header and spin lock for zoned SRB requests. ! 140: // ! 141: ! 142: PZONE_HEADER SrbZone; ! 143: ! 144: PKSPIN_LOCK SrbZoneSpinLock; ! 145: ! 146: // ! 147: // Scsi port number ! 148: // ! 149: ! 150: UCHAR PortNumber; ! 151: ! 152: // ! 153: // SCSI path id ! 154: // ! 155: ! 156: UCHAR PathId; ! 157: ! 158: // ! 159: // SCSI bus target id ! 160: // ! 161: ! 162: UCHAR TargetId; ! 163: ! 164: // ! 165: // SCSI bus logical unit number ! 166: // ! 167: ! 168: UCHAR Lun; ! 169: ! 170: // ! 171: // Log2 of sector size ! 172: // ! 173: ! 174: UCHAR SectorShift; ! 175: ! 176: // ! 177: // Flag to indicate that the device has write caching enabled. ! 178: // ! 179: ! 180: BOOLEAN WriteCache; ! 181: ! 182: // ! 183: // Build SCSI 1 or SCSI 2 CDBs ! 184: // ! 185: ! 186: BOOLEAN UseScsi1; ! 187: ! 188: } DEVICE_EXTENSION, *PDEVICE_EXTENSION; ! 189: ! 190: // ! 191: // Define context structure for asynchronous completions. ! 192: // ! 193: ! 194: typedef struct _COMPLETION_CONTEXT { ! 195: PDEVICE_OBJECT DeviceObject; ! 196: SCSI_REQUEST_BLOCK Srb; ! 197: }COMPLETION_CONTEXT, *PCOMPLETION_CONTEXT; ! 198: ! 199: ! 200: NTSTATUS ! 201: ScsiClassGetCapabilities( ! 202: IN PDEVICE_OBJECT PortDeviceObject, ! 203: OUT PIO_SCSI_CAPABILITIES *PortCapabilities ! 204: ); ! 205: ! 206: NTSTATUS ! 207: ScsiClassGetInquiryData( ! 208: IN PDEVICE_OBJECT PortDeviceObject, ! 209: IN PSCSI_ADAPTER_BUS_INFO *ConfigInfo ! 210: ); ! 211: ! 212: NTSTATUS ! 213: ScsiClassReadDriveCapacity( ! 214: IN PDEVICE_OBJECT DeviceObject ! 215: ); ! 216: ! 217: VOID ! 218: ScsiClassReleaseQueue( ! 219: IN PDEVICE_OBJECT DeviceObject ! 220: ); ! 221: ! 222: NTSTATUS ! 223: ScsiClassAsynchronousCompletion( ! 224: PDEVICE_OBJECT DeviceObject, ! 225: PIRP Irp, ! 226: PVOID Context ! 227: ); ! 228: ! 229: VOID ! 230: ScsiClassSplitRequest( ! 231: IN PDEVICE_OBJECT DeviceObject, ! 232: IN PIRP Irp, ! 233: IN ULONG MaximumBytes ! 234: ); ! 235: ! 236: NTSTATUS ! 237: ScsiClassDeviceControl( ! 238: PDEVICE_OBJECT DeviceObject, ! 239: PIRP Irp ! 240: ); ! 241: ! 242: NTSTATUS ! 243: ScsiClassIoComplete( ! 244: IN PDEVICE_OBJECT DeviceObject, ! 245: IN PIRP Irp, ! 246: IN PVOID Context ! 247: ); ! 248: ! 249: NTSTATUS ! 250: ScsiClassIoCompleteAssociated( ! 251: IN PDEVICE_OBJECT DeviceObject, ! 252: IN PIRP Irp, ! 253: IN PVOID Context ! 254: ); ! 255: ! 256: BOOLEAN ! 257: ScsiClassInterpretSenseInfo( ! 258: IN PDEVICE_OBJECT DeviceObject, ! 259: IN PSCSI_REQUEST_BLOCK Srb, ! 260: IN UCHAR MajorFunctionCode, ! 261: IN ULONG IoDeviceCode, ! 262: IN ULONG RetryCount, ! 263: OUT NTSTATUS *Status ! 264: ); ! 265: ! 266: NTSTATUS ! 267: ScsiClassSendSrbSynchronous( ! 268: PDEVICE_OBJECT DeviceObject, ! 269: PSCSI_REQUEST_BLOCK Srb, ! 270: PVOID BufferAddress, ! 271: ULONG BufferLength, ! 272: BOOLEAN WriteToDevice ! 273: ); ! 274: ! 275: NTSTATUS ! 276: ScsiClassSendSrbAsynchronous( ! 277: PDEVICE_OBJECT DeviceObject, ! 278: PSCSI_REQUEST_BLOCK Srb, ! 279: PIRP Irp, ! 280: PVOID BufferAddress, ! 281: ULONG BufferLength, ! 282: BOOLEAN WriteToDevice ! 283: ); ! 284: ! 285: VOID ! 286: ScsiClassBuildRequest( ! 287: PDEVICE_OBJECT DeviceObject, ! 288: PIRP Irp ! 289: ); ! 290: ! 291: ULONG ! 292: ScsiClassModeSense( ! 293: IN PDEVICE_OBJECT DeviceObject, ! 294: IN PCHAR ModeSenseBuffer, ! 295: IN ULONG Length, ! 296: IN UCHAR PageMode ! 297: ); ! 298: ! 299: PVOID ! 300: ScsiClassFindModePage( ! 301: IN PCHAR ModeSenseBuffer, ! 302: IN ULONG Length, ! 303: IN UCHAR PageMode ! 304: ); ! 305: ! 306: NTSTATUS ! 307: ScsiClassClaimDevice( ! 308: IN PDEVICE_OBJECT PortDeviceObject, ! 309: IN PSCSI_INQUIRY_DATA LunInfo, ! 310: IN BOOLEAN Release, ! 311: OUT PDEVICE_OBJECT *NewPortDeviceObject OPTIONAL ! 312: ); ! 313: ! 314: NTSTATUS ! 315: ScsiClassInternalIoControl ( ! 316: IN PDEVICE_OBJECT DeviceObject, ! 317: IN PIRP Irp ! 318: ); ! 319: ! 320: #endif /* _CLASS_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.