ReactOS  0.4.14-dev-606-g14ebc0b
scsi_port.h
Go to the documentation of this file.
1 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 // This file was released under the GPLv2 on June 2015.
6 /*
7 
8 Module Name:
9 
10  scsi_port.h
11 
12 Abstract:
13 
14  This is the include file that defines all constants and types for
15  accessing the SCSI port adapters.
16 
17 Environment:
18 
19  kernel mode only
20  */
21 
22 #ifndef __SCSI_PORT_H__
23 #define __SCSI_PORT_H__
24 
25 #include "srb.h"
26 
27 #ifdef SCSIPORT_API
28 #undef SCSIPORT_API
29 #endif
30 
31 // Device Name - this string is the name of the device. It is the name
32 // that should be passed to NtOpenFile when accessing the device.
33 //
34 // Note: For devices that support multiple units, it should be suffixed
35 // with the Ascii representation of the unit number.
36 
37 #define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER
38 
39 #define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
40 
41 
42 // NtDeviceIoControlFile IoControlCode values for this device.
43 //
44 // Warning: Remember that the low two bits of the code specify how the
45 // buffers are passed to the driver!
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 // Define the SCSI pass through structure.
57 
58 typedef struct _SCSI_PASS_THROUGH {
71  UCHAR Cdb[16];
73 
74 // Define the SCSI pass through direct structure.
75 
76 typedef struct _SCSI_PASS_THROUGH_DIRECT {
89  UCHAR Cdb[16];
91 
92 // Define SCSI information.
93 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
94 
95 typedef struct _SCSI_BUS_DATA {
100 
101 // Define SCSI adapter bus information structure..
102 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
103 
104 typedef struct _SCSI_ADAPTER_BUS_INFO {
108 
109 // Define SCSI adapter bus information.
110 // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
111 
112 typedef struct _SCSI_INQUIRY_DATA {
121 
122 // Define header for I/O control SRB.
123 
124 typedef struct _SRB_IO_CONTROL {
132 
133 // SCSI port driver capabilities structure.
134 
135 typedef struct _IO_SCSI_CAPABILITIES {
136  ULONG Length; // Length of this structure
137  ULONG MaximumTransferLength; // Maximum transfer size in single SRB (obsolete)
138  ULONG MaximumPhysicalPages; // Maximum number of physical pages per data buffer
139  ULONG SupportedAsynchronousEvents; // Async calls from port to class
140  ULONG AlignmentMask; // Alignment mask for data transfers.
141  BOOLEAN TaggedQueuing; // Supports tagged queuing
142  BOOLEAN AdapterScansDown; // Host adapter scans down for bios devices.
143  BOOLEAN AdapterUsesPio; // The host adapter uses programmed I/O.
145 
146 typedef struct _SCSI_ADDRESS {
153 
154 // Define structure for returning crash dump pointers.
155 
156 struct _ADAPTER_OBJECT;
157 
158 typedef struct _DUMP_POINTERS {
166 
167 
168 
169 // Define values for pass-through DataIn field.
170 
171 #define SCSI_IOCTL_DATA_OUT 0
172 #define SCSI_IOCTL_DATA_IN 1
173 #define SCSI_IOCTL_DATA_UNSPECIFIED 2
174 
175 #define CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK 0x00000020
176 
177 #define SCSIPORT_API
178 
179 #ifndef USER_MODE
180 extern NTSTATUS ScsiClassGetInquiryData(IN PDEVICE_OBJECT PortDeviceObject,
181  IN PSCSI_ADAPTER_BUS_INFO *ConfigInfo);
183  IN BOOLEAN DirectAccess);
185 
186 #ifndef CDRW_W32
187 
188 // Class dll routines called by class drivers
189 
190 extern NTSTATUS ScsiClassGetCapabilities(IN PDEVICE_OBJECT PortDeviceObject,
191  OUT PIO_SCSI_CAPABILITIES *PortCapabilities);
192 extern NTSTATUS ScsiClassGetAddress(IN PDEVICE_OBJECT ClassDeviceObject,
197 extern NTSTATUS ScsiClassClaimDevice(IN PDEVICE_OBJECT PortDeviceObject,
199  OUT PDEVICE_OBJECT *NewPortDeviceObject OPTIONAL);
202  IN PVOID Context);
204  IN PSCSI_REQUEST_BLOCK _srb,
205  IN PKEVENT event);
206 
207 #endif //CDRW_W32
208 
210  PVOID DeviceExtension);
211 
212 extern NTSTATUS
214  IN PVOID Object,
216  );
217 #endif //USER_MODE
218 
219 #endif //__SCSI_PORT_H__
UCHAR PathId
Definition: scsi_port.h:149
struct _SCSI_BUS_DATA * PSCSI_BUS_DATA
UCHAR PortNumber
Definition: scsi_port.h:148
#define IN
Definition: typedefs.h:38
struct _SCSI_ADAPTER_BUS_INFO SCSI_ADAPTER_BUS_INFO
ULONG SupportedAsynchronousEvents
Definition: scsi_port.h:139
PVOID MappedRegisterBase
Definition: scsi_port.h:160
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
_In_ BOOLEAN Release
Definition: classpnp.h:929
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1117
_In_ PIRP Irp
Definition: csq.h:116
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1117
struct _SCSI_ADDRESS * PSCSI_ADDRESS
struct _DUMP_POINTERS * PDUMP_POINTERS
BOOLEAN AdapterScansDown
Definition: scsi_port.h:142
LONG NTSTATUS
Definition: precomp.h:26
ULONG Length
Definition: scsi_port.h:147
struct _IO_SCSI_CAPABILITIES * PIO_SCSI_CAPABILITIES
ULONG DataBufferOffset
Definition: scsi_port.h:69
NTSTATUS ScsiClassReadDeviceInquiryData(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN DirectAccess)
ULONG ControlCode
Definition: scsi_port.h:128
VOID ScsiClassReleaseQueue(IN PDEVICE_OBJECT DeviceObject)
Definition: class2.c:938
NTSTATUS ScsiClassInternalIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: class2.c:4655
ULONG SenseInfoOffset
Definition: scsi_port.h:70
PVOID CommonBufferVa
Definition: scsi_port.h:162
struct _DUMP_POINTERS DUMP_POINTERS
ULONG NextInquiryDataOffset
Definition: scsi_port.h:118
NTSTATUS ScsiClassGetInquiryData(IN PDEVICE_OBJECT PortDeviceObject, IN PSCSI_ADAPTER_BUS_INFO *ConfigInfo)
UCHAR TargetId
Definition: scsi_port.h:150
VOID ScsiClassInitSrbBusAddr(PSCSI_REQUEST_BLOCK Srb, PVOID DeviceExtension)
struct _SCSI_PASS_THROUGH_DIRECT SCSI_PASS_THROUGH_DIRECT
NTSTATUS ScsiClassGetAddress(IN PDEVICE_OBJECT ClassDeviceObject, OUT PSCSI_ADDRESS Address)
SCSI_BUS_DATA BusData[1]
Definition: scsi_port.h:106
struct _SCSI_INQUIRY_DATA SCSI_INQUIRY_DATA
UCHAR Cdb[16]
Definition: scsi_port.h:71
ULONG DataTransferLength
Definition: scsi_port.h:67
ULONG ReturnCode
Definition: scsi_port.h:129
ULONG CommonBufferSize
Definition: scsi_port.h:164
UCHAR SenseInfoLength
Definition: scsi_port.h:65
struct _SRB_IO_CONTROL * PSRB_IO_CONTROL
struct _SCSI_INQUIRY_DATA * PSCSI_INQUIRY_DATA
NTSTATUS ScsiClassRemoveDevice(IN PDEVICE_OBJECT PortDeviceObject, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun)
NTSTATUS ScsiClassReadDriveCapacity(IN PDEVICE_OBJECT DeviceObject)
Definition: class2.c:714
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
ULONG InquiryDataOffset
Definition: scsi_port.h:98
PVOID PortConfiguration
Definition: scsi_port.h:161
static IUnknown Object
Definition: main.c:512
struct _ADAPTER_OBJECT * AdapterObject
Definition: scsi_port.h:159
LARGE_INTEGER CommonBufferPa
Definition: scsi_port.h:163
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _cl_event * event
Definition: glext.h:7739
NTSTATUS ScsiClassSendSrbSynchronous(IN PDEVICE_OBJECT TargetDeviceObject, IN PSCSI_REQUEST_BLOCK _srb, IN PKEVENT event)
UCHAR InquiryData[1]
Definition: scsi_port.h:119
NTSTATUS ScsiClassIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS ScsiClassClaimDevice(IN PDEVICE_OBJECT PortDeviceObject, IN PSCSI_INQUIRY_DATA LunInfo, IN BOOLEAN Release, OUT PDEVICE_OBJECT *NewPortDeviceObject OPTIONAL)
Definition: class2.c:4488
static ULONG Timeout
Definition: ping.c:61
struct _SCSI_BUS_DATA SCSI_BUS_DATA
unsigned short USHORT
Definition: pedump.c:61
ULONG InquiryDataLength
Definition: scsi_port.h:117
struct _SCSI_PASS_THROUGH SCSI_PASS_THROUGH
struct _SRB_IO_CONTROL SRB_IO_CONTROL
UCHAR InitiatorBusId
Definition: scsi_port.h:97
NTSTATUS ScsiClassGetCapabilities(IN PDEVICE_OBJECT PortDeviceObject, OUT PIO_SCSI_CAPABILITIES *PortCapabilities)
Definition: class2.c:531
struct _SCSI_PASS_THROUGH_DIRECT * PSCSI_PASS_THROUGH_DIRECT
BOOLEAN DeviceClaimed
Definition: scsi_port.h:116
#define OUT
Definition: typedefs.h:39
UCHAR Signature[8]
Definition: scsi_port.h:126
struct _SCSI_ADDRESS SCSI_ADDRESS
struct _SCSI_PASS_THROUGH * PSCSI_PASS_THROUGH
unsigned int ULONG
Definition: retypes.h:1
struct _SCSI_ADAPTER_BUS_INFO * PSCSI_ADAPTER_BUS_INFO
UCHAR NumberOfLogicalUnits
Definition: scsi_port.h:96
ULONG HeaderLength
Definition: scsi_port.h:125
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1664
struct _IO_SCSI_CAPABILITIES IO_SCSI_CAPABILITIES
NTSTATUS DbgWaitForSingleObject_(IN PVOID Object, IN PLARGE_INTEGER Timeout OPTIONAL)
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68