xref: /reactos/drivers/storage/ide/uniata/ntddscsi.h (revision 5100859e)
1 /*++ BUILD Version: 0001    // Increment this if a change has global effects
2 
3 Copyright (c) 1990-1993  Microsoft Corporation
4 
5 Module Name:
6 
7     ntddscsi.h
8 
9 Abstract:
10 
11     This is the include file that defines all constants and types for
12     accessing the SCSI port adapters.
13 
14 Author:
15 
16     Jeff Havens
17 
18 Revision History:
19 
20 --*/
21 
22 #ifndef _NTDDSCSIH_
23 #define _NTDDSCSIH_
24 
25 #pragma pack(push, 8)
26 
27 //
28 // Device Name - this string is the name of the device.  It is the name
29 // that should be passed to NtOpenFile when accessing the device.
30 //
31 // Note:  For devices that support multiple units, it should be suffixed
32 //        with the Ascii representation of the unit number.
33 //
34 
35 #define IOCTL_SCSI_BASE                 FILE_DEVICE_CONTROLLER
36 
37 #define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
38 
39 
40 //
41 // NtDeviceIoControlFile IoControlCode values for this device.
42 //
43 // Warning:  Remember that the low two bits of the code specify how the
44 //           buffers are passed to the driver!
45 //
46 
47 #define IOCTL_SCSI_PASS_THROUGH         CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
48 #define IOCTL_SCSI_MINIPORT             CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
49 #define IOCTL_SCSI_GET_INQUIRY_DATA     CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
50 #define IOCTL_SCSI_GET_CAPABILITIES     CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
51 #define IOCTL_SCSI_PASS_THROUGH_DIRECT  CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
52 #define IOCTL_SCSI_GET_ADDRESS          CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
53 #define IOCTL_SCSI_RESCAN_BUS           CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS)
54 #define IOCTL_SCSI_GET_DUMP_POINTERS    CTL_CODE(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS)
55 
56 //
57 // Define the SCSI pass through structure.
58 //
59 
60 typedef struct _SCSI_PASS_THROUGH {
61     USHORT Length;
62     UCHAR ScsiStatus;
63     UCHAR PathId;
64     UCHAR TargetId;
65     UCHAR Lun;
66     UCHAR CdbLength;
67     UCHAR SenseInfoLength;
68     UCHAR DataIn;
69     ULONG DataTransferLength;
70     ULONG TimeOutValue;
71     ULONG DataBufferOffset;
72     ULONG SenseInfoOffset;
73     UCHAR Cdb[16];
74 }SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
75 
76 //
77 // Define the SCSI pass through direct structure.
78 //
79 
80 typedef struct _SCSI_PASS_THROUGH_DIRECT {
81     USHORT Length;
82     UCHAR ScsiStatus;
83     UCHAR PathId;
84     UCHAR TargetId;
85     UCHAR Lun;
86     UCHAR CdbLength;
87     UCHAR SenseInfoLength;
88     UCHAR DataIn;
89     ULONG DataTransferLength;
90     ULONG TimeOutValue;
91     PVOID DataBuffer;
92     ULONG SenseInfoOffset;
93     UCHAR Cdb[16];
94 }SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
95 
96 //
97 // Define SCSI information.
98 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
99 //
100 
101 typedef struct _SCSI_BUS_DATA {
102     UCHAR NumberOfLogicalUnits;
103     UCHAR InitiatorBusId;
104     ULONG InquiryDataOffset;
105 }SCSI_BUS_DATA, *PSCSI_BUS_DATA;
106 
107 //
108 // Define SCSI adapter bus information structure..
109 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
110 //
111 
112 typedef struct _SCSI_ADAPTER_BUS_INFO {
113     UCHAR NumberOfBuses;
114     SCSI_BUS_DATA BusData[1];
115 } SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
116 
117 //
118 // Define SCSI adapter bus information.
119 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
120 //
121 
122 typedef struct _SCSI_INQUIRY_DATA {
123     UCHAR PathId;
124     UCHAR TargetId;
125     UCHAR Lun;
126     BOOLEAN DeviceClaimed;
127     ULONG InquiryDataLength;
128     ULONG NextInquiryDataOffset;
129     UCHAR InquiryData[1];
130 }SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
131 
132 //
133 // Define header for I/O control SRB.
134 //
135 
136 typedef struct _SRB_IO_CONTROL {
137         ULONG HeaderLength;
138         UCHAR Signature[8];
139         ULONG Timeout;
140         ULONG ControlCode;
141         ULONG ReturnCode;
142         ULONG Length;
143 } SRB_IO_CONTROL, *PSRB_IO_CONTROL;
144 
145 //
146 // SCSI port driver capabilities structure.
147 //
148 
149 typedef struct _IO_SCSI_CAPABILITIES {
150 
151     //
152     // Length of this structure
153     //
154 
155     ULONG Length;
156 
157     //
158     // Maximum transfer size in single SRB
159     //
160 
161     ULONG MaximumTransferLength;
162 
163     //
164     // Maximum number of physical pages per data buffer
165     //
166 
167     ULONG MaximumPhysicalPages;
168 
169     //
170     // Async calls from port to class
171     //
172 
173     ULONG SupportedAsynchronousEvents;
174 
175     //
176     // Alignment mask for data transfers.
177     //
178 
179     ULONG AlignmentMask;
180 
181     //
182     // Supports tagged queuing
183     //
184 
185     BOOLEAN TaggedQueuing;
186 
187     //
188     // Host adapter scans down for bios devices.
189     //
190 
191     BOOLEAN AdapterScansDown;
192 
193     //
194     // The host adapter uses programmed I/O.
195     //
196 
197     BOOLEAN AdapterUsesPio;
198 
199 } IO_SCSI_CAPABILITIES, *PIO_SCSI_CAPABILITIES;
200 
201 typedef struct _SCSI_ADDRESS {
202     ULONG Length;
203     UCHAR PortNumber;
204     UCHAR PathId;
205     UCHAR TargetId;
206     UCHAR Lun;
207 }SCSI_ADDRESS, *PSCSI_ADDRESS;
208 
209 //
210 // Define structure for returning crash dump pointers.
211 //
212 
213 struct _ADAPTER_OBJECT;
214 
215 typedef struct _DUMP_POINTERS {
216     struct _ADAPTER_OBJECT *AdapterObject;
217     PVOID MappedRegisterBase;
218     PVOID PortConfiguration;
219     PVOID CommonBufferVa;
220     LARGE_INTEGER CommonBufferPa;
221     ULONG CommonBufferSize;
222 } DUMP_POINTERS, *PDUMP_POINTERS;
223 
224 //
225 // Define values for pass-through DataIn field.
226 //
227 
228 #define SCSI_IOCTL_DATA_OUT          0
229 #define SCSI_IOCTL_DATA_IN           1
230 #define SCSI_IOCTL_DATA_UNSPECIFIED  2
231 
232 #pragma pack(pop)
233 
234 #endif
235 
236