ReactOS  0.4.13-dev-249-gcba1a2f
class.h
Go to the documentation of this file.
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 <ntddchgr.h>
29 #include <ntddstor.h>
30 #include "ntddscsi.h"
31 #include <stdio.h>
32 
33 // begin_ntminitape
34 
35 #if DBG
36 
37 #define DebugPrint(x) ScsiDebugPrint x
38 
39 #else
40 
41 #define DebugPrint(x)
42 
43 #endif // DBG
44 
45 // end_ntminitape
46 
47 #ifdef POOL_TAGGING
48 #undef ExAllocatePool
49 #undef ExAllocatePoolWithQuota
50 #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'HscS')
51 #define ExAllocatePoolWithQuota(a,b) ExAllocatePoolWithQuotaTag(a,b,'HscS')
52 #endif
53 
54 #define MAXIMUM_RETRIES 4
55 
56 typedef
57 VOID
63  );
64 
65 typedef struct _DEVICE_EXTENSION {
66 
67  //
68  // Back pointer to device object
69  //
70 
72 
73  //
74  // Pointer to port device object
75  //
76 
78 
79  //
80  // Length of partition in bytes
81  //
82 
84 
85  //
86  // Number of bytes before start of partition
87  //
88 
90 
91  //
92  // Bytes to skew all requests, since DM Driver has been placed on an IDE drive.
93  //
94 
96 
97  //
98  // Sectors to skew all requests.
99  //
100 
101  ULONG DMSkew;
102 
103  //
104  // Flag to indicate whether DM driver has been located on an IDE drive.
105  //
106 
108 
109  //
110  // Pointer to the specific class error routine.
111  //
112 
114 
115  //
116  // SCSI port driver capabilities
117  //
118 
120 
121  //
122  // Buffer for drive parameters returned in IO device control.
123  //
124 
126 
127  //
128  // Back pointer to device object of physical device
129  //
130 
132 
133  //
134  // Request Sense Buffer
135  //
136 
138 
139  //
140  // Request timeout in seconds;
141  //
142 
144 
145  //
146  // System device number
147  //
148 
150 
151  //
152  // Add default Srb Flags.
153  //
154 
155  ULONG SrbFlags;
156 
157  //
158  // Total number of SCSI protocol errors on the device.
159  //
160 
162 
163  //
164  // Spinlock for split requests
165  //
166 
168 
169  //
170  // Zone header and spin lock for zoned SRB requests.
171  //
172 
174 
176 
177  //
178  // Lock count for removable media.
179  //
180 
181  LONG LockCount;
182 
183  //
184  // Scsi port number
185  //
186 
188 
189  //
190  // SCSI path id
191  //
192 
193  UCHAR PathId;
194 
195  //
196  // SCSI bus target id
197  //
198 
199  UCHAR TargetId;
200 
201  //
202  // SCSI bus logical unit number
203  //
204 
205  UCHAR Lun;
206 
207  //
208  // Log2 of sector size
209  //
210 
212 
213  //
214  // Flag to indicate that the device has write caching enabled.
215  //
216 
218 
219  //
220  // Build SCSI 1 or SCSI 2 CDBs
221  //
222 
224 
226 
227 //
228 // Define context structure for asynchronous completions.
229 //
230 
231 typedef struct _COMPLETION_CONTEXT {
235 
236 
237 NTSTATUS
239  IN PDEVICE_OBJECT PortDeviceObject,
240  OUT PIO_SCSI_CAPABILITIES *PortCapabilities
241  );
242 
243 NTSTATUS
245  IN PDEVICE_OBJECT PortDeviceObject,
246  IN PSCSI_ADAPTER_BUS_INFO *ConfigInfo
247  );
248 
249 NTSTATUS
252  );
253 
254 VOID
257  );
258 
259 NTSTATUS
261  IN PDEVICE_OBJECT PortDeviceObject,
262  IN UCHAR PathId,
263  IN UCHAR TargetId,
264  IN UCHAR Lun
265  );
266 
267 NTSTATUS
270  PIRP Irp,
271  PVOID Context
272  );
273 
274 VOID
277  IN PIRP Irp,
278  IN ULONG MaximumBytes
279  );
280 
281 NTSTATUS
284  PIRP Irp
285  );
286 
287 NTSTATUS
290  IN PIRP Irp,
292  );
293 
294 NTSTATUS
297  IN PIRP Irp,
299  );
300 
301 BOOLEAN
307  IN ULONG RetryCount,
309  );
310 
311 NTSTATUS
315  PVOID BufferAddress,
317  BOOLEAN WriteToDevice
318  );
319 
320 NTSTATUS
324  PIRP Irp,
325  PVOID BufferAddress,
327  BOOLEAN WriteToDevice
328  );
329 
330 VOID
333  PIRP Irp
334  );
335 
336 ULONG
339  IN PCHAR ModeSenseBuffer,
340  IN ULONG Length,
341  IN UCHAR PageMode
342  );
343 
344 BOOLEAN
347  IN PCHAR ModeSelectBuffer,
348  IN ULONG Length,
349  IN BOOLEAN SavePage
350  );
351 
352 PVOID
354  IN PCHAR ModeSenseBuffer,
355  IN ULONG Length,
356  IN UCHAR PageMode
357  );
358 
359 NTSTATUS
361  IN PDEVICE_OBJECT PortDeviceObject,
362  IN PSCSI_INQUIRY_DATA LunInfo,
364  OUT PDEVICE_OBJECT *NewPortDeviceObject OPTIONAL
365  );
366 
367 NTSTATUS
370  IN PIRP Irp
371  );
372 
373 #endif /* _CLASS_ */
374 
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:38
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
VOID ScsiClassBuildRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: class2.c:3284
ULONG ErrorCount
Definition: class2.h:120
_In_ BOOLEAN Release
Definition: classpnp.h:929
NTSTATUS ScsiClassGetCapabilities(IN PDEVICE_OBJECT PortDeviceObject, OUT PIO_SCSI_CAPABILITIES *PortCapabilities)
Definition: class2.c:846
NTSTATUS ScsiClassSendSrbSynchronous(PDEVICE_OBJECT DeviceObject, PSCSI_REQUEST_BLOCK Srb, PVOID BufferAddress, ULONG BufferLength, BOOLEAN WriteToDevice)
Definition: class2.c:2170
NTSTATUS ScsiClassRemoveDevice(IN PDEVICE_OBJECT PortDeviceObject, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun)
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1117
_In_ PIRP Irp
Definition: csq.h:116
PZONE_HEADER SrbZone
Definition: class.h:173
NTSTATUS ScsiClassGetInquiryData(IN PDEVICE_OBJECT PortDeviceObject, IN PSCSI_ADAPTER_BUS_INFO *ConfigInfo)
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1117
LONG NTSTATUS
Definition: precomp.h:26
ULONG DMByteSkew
Definition: class2.h:103
BOOLEAN DMActive
Definition: class2.h:105
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
PDEVICE_OBJECT DeviceObject
Definition: class2.h:141
PKSPIN_LOCK SrbZoneSpinLock
Definition: class.h:175
NTSTATUS ScsiClassClaimDevice(IN PDEVICE_OBJECT PortDeviceObject, IN PSCSI_INQUIRY_DATA LunInfo, IN BOOLEAN Release, OUT PDEVICE_OBJECT *NewPortDeviceObject OPTIONAL)
Definition: class2.c:4740
ULONG ScsiClassModeSense(IN PDEVICE_OBJECT DeviceObject, IN PCHAR ModeSenseBuffer, IN ULONG Length, IN UCHAR PageMode)
Definition: class2.c:3513
NTSTATUS ScsiClassIoCompleteAssociated(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: class2.c:1955
SCSI_REQUEST_BLOCK Srb
Definition: class2.h:142
ULONG SrbFlags
Definition: class2.h:119
ULONG TimeOutValue
Definition: class2.h:117
NTSTATUS ScsiClassReadDriveCapacity(IN PDEVICE_OBJECT DeviceObject)
Definition: class2.c:1029
NTSTATUS ScsiClassDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: class2.c:3917
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
VOID(* PCLASS_ERROR)(IN PDEVICE_OBJECT DeviceObject, IN PSCSI_REQUEST_BLOCK Srb, IN OUT NTSTATUS *Status, IN OUT BOOLEAN *Retry)
Definition: class.h:58
BOOLEAN ScsiClassInterpretSenseInfo(IN PDEVICE_OBJECT DeviceObject, IN PSCSI_REQUEST_BLOCK Srb, IN UCHAR MajorFunctionCode, IN ULONG IoDeviceCode, IN ULONG RetryCount, OUT NTSTATUS *Status)
Definition: class2.c:2462
unsigned char BOOLEAN
struct _DEVICE_EXTENSION * PDEVICE_EXTENSION
UCHAR PortNumber
Definition: class2.h:124
IN PSCSI_REQUEST_BLOCK IN OUT NTSTATUS IN OUT BOOLEAN * Retry
Definition: class2.h:49
UCHAR TargetId
Definition: class2.h:126
PSENSE_DATA SenseData
Definition: class2.h:116
VOID ScsiClassSplitRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG MaximumBytes)
Definition: class2.c:1612
NTSTATUS ScsiClassInternalIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: class2.c:4907
PDISK_GEOMETRY DiskGeometry
Definition: class.h:125
NTSTATUS ScsiClassSendSrbAsynchronous(PDEVICE_OBJECT DeviceObject, PSCSI_REQUEST_BLOCK Srb, PIRP Irp, PVOID BufferAddress, ULONG BufferLength, BOOLEAN WriteToDevice)
Definition: class2.c:3684
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR MajorFunctionCode
Definition: classpnp.h:465
struct _DEVICE_EXTENSION DEVICE_EXTENSION
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER StartingOffset
Definition: class2.h:102
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VOID
Definition: acefi.h:82
PCLASS_ERROR ClassError
Definition: class2.h:106
Status
Definition: gdiplustypes.h:24
struct _COMPLETION_CONTEXT COMPLETION_CONTEXT
BOOLEAN ScsiClassModeSelect(IN PDEVICE_OBJECT DeviceObject, IN PCHAR ModeSelectBuffer, IN ULONG Length, IN BOOLEAN SavePage)
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS ScsiClassAsynchronousCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
Definition: class2.c:1531
NTSTATUS ScsiClassIoComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: class2.c:1806
VOID ScsiClassReleaseQueue(IN PDEVICE_OBJECT DeviceObject)
Definition: class2.c:1253
BOOLEAN WriteCache
Definition: class.h:217
PDEVICE_OBJECT DeviceObject
Definition: mntmgr.h:15
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
UCHAR SectorShift
Definition: class2.h:128
#define OUT
Definition: typedefs.h:39
struct _COMPLETION_CONTEXT * PCOMPLETION_CONTEXT
unsigned int ULONG
Definition: retypes.h:1
PIO_SCSI_CAPABILITIES PortCapabilities
Definition: class2.h:113
KSPIN_LOCK SplitRequestSpinLock
Definition: class2.h:121
PVOID ScsiClassFindModePage(IN PCHAR ModeSenseBuffer, IN ULONG Length, IN UCHAR PageMode)
LARGE_INTEGER PartitionLength
Definition: class2.h:101
PDEVICE_OBJECT PortDeviceObject
Definition: class2.h:100
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
PDEVICE_OBJECT PhysicalDevice
Definition: class2.h:115
ULONG DeviceNumber
Definition: class2.h:118
BOOLEAN UseScsi1
Definition: class.h:223
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG IoDeviceCode
Definition: classpnp.h:465
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68