ReactOS  0.4.15-dev-1206-g731eddf
scsiport.h
Go to the documentation of this file.
1 /*
2  * SCSI_PORT_TIMER_STATES
3  *
4  * DESCRIPTION
5  * An enumeration containing the states in the timer DFA
6  */
7 
8 #pragma once
9 
10 #include <wdm.h>
11 #include <ntddk.h>
12 #include <stdio.h>
13 #include <scsi.h>
14 #include <ntddscsi.h>
15 #include <ntdddisk.h>
16 #include <mountdev.h>
17 
18 #define VERSION "0.0.3"
19 
20 #define TAG_SCSIPORT 'ISCS'
21 
22 /* Defines how many logical unit arrays will be in a device extension */
23 #define LUS_NUMBER 8
24 
25 #define MAX_SG_LIST 17
26 
27 /* Flags */
28 #define SCSI_PORT_DEVICE_BUSY 0x0001
29 #define SCSI_PORT_LU_ACTIVE 0x0002
30 #define SCSI_PORT_NOTIFICATION_NEEDED 0x0004
31 #define SCSI_PORT_NEXT_REQUEST_READY 0x0008
32 #define SCSI_PORT_FLUSH_ADAPTERS 0x0010
33 #define SCSI_PORT_MAP_TRANSFER 0x0020
34 #define SCSI_PORT_RESET 0x0080
35 #define SCSI_PORT_RESET_REQUEST 0x0100
36 #define SCSI_PORT_RESET_REPORTED 0x0200
37 #define SCSI_PORT_REQUEST_PENDING 0x0800
38 #define SCSI_PORT_DISCONNECT_ALLOWED 0x1000
39 #define SCSI_PORT_DISABLE_INT_REQUESET 0x2000
40 #define SCSI_PORT_DISABLE_INTERRUPTS 0x4000
41 #define SCSI_PORT_ENABLE_INT_REQUEST 0x8000
42 #define SCSI_PORT_TIMER_NEEDED 0x10000
43 
44 /* LUN Extension flags*/
45 #define LUNEX_FROZEN_QUEUE 0x0001
46 #define LUNEX_NEED_REQUEST_SENSE 0x0004
47 #define LUNEX_BUSY 0x0008
48 #define LUNEX_FULL_QUEUE 0x0010
49 #define LUNEX_REQUEST_PENDING 0x0020
50 #define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
51 
52 
54 {
60 
61 typedef struct _CONFIGURATION_INFO
62 {
63  /* Identify info */
67 
68  /* Registry related */
72 
73  /* Features */
76 
77  /* Parameters */
81 
82 typedef struct _SCSI_PORT_DEVICE_BASE
83 {
85 
91 
92 typedef struct _SCSI_SG_ADDRESS
93 {
97 
99 {
104 
106 
107  /* DMA stuff */
110 
112 
113  /* Scatter-gather list */
117 
119 {
123 
125 
127 
130 
132 
137 
140 
143 
146 
148 
149  /* More data? */
150 
151  UCHAR MiniportLunExtension[1]; /* must be the last entry */
153 
154 /* Structures for inquiries support */
155 
156 typedef struct _SCSI_LUN_INFO
157 {
166 
167 typedef struct _SCSI_BUS_SCAN_INFO
168 {
174 
176 {
180 
181 
183 {
184  ULONG Flags; /* Interrupt-time flags */
185  PSCSI_REQUEST_BLOCK_INFO CompletedRequests; /* Linked list of Srb info data */
191 
192 
193 /* Only for interrupt data saving function */
195 {
199 
200 /*
201  * SCSI_PORT_DEVICE_EXTENSION
202  *
203  * DESCRIPTION
204  * First part of the port objects device extension. The second
205  * part is the miniport-specific device extension.
206  */
207 
209 {
216 
220 
224 
225  KSPIN_LOCK IrqLock; /* Used when there are 2 irqs */
226  ULONG SequenceNumber; /* Global sequence number for packets */
231 
234 
237 
239 
242 
244 
245  /* SRB extension stuff*/
249 
250  /* SRB information */
254 
256 
259 
266 
270 
271  /* DMA related stuff */
277 
278  /* Features */
284 
289 
292 
294 
296 
297  UCHAR MiniPortDeviceExtension[1]; /* must be the last entry */
299 
300 typedef struct _RESETBUS_PARAMS
301 {
305 
306 
307 // ioctl.c
308 
309 NTSTATUS
310 NTAPI
313  _In_ PIRP Irp);
314 
315 // fdo.c
316 
317 VOID
319  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension);
320 
321 NTSTATUS
323  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension);
324 
325 VOID
327  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension);
328 
329 // pdo.c
330 
333  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension);
334 
337  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
338  _In_ UCHAR PathId,
340  _In_ UCHAR Lun);
341 
344  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
345  _In_ UCHAR PathId,
347  _In_ UCHAR Lun,
348  _In_ UCHAR QueueTag);
349 
350 // registry.c
351 
352 VOID
354  _Inout_ PCONFIGURATION_INFO ConfigInfo,
356 
357 NTSTATUS
359  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
361 
362 // scsi.c
363 
364 VOID
366  _In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
367  _Inout_ PSCSI_PORT_LUN_EXTENSION LunExtension);
368 
369 IO_DPC_ROUTINE ScsiPortDpcForIsr;
371 KSYNCHRONIZE_ROUTINE ScsiPortStartPacket;
372 DRIVER_STARTIO ScsiPortStartIo;
373 
374 
375 // scsiport.c
376 
377 KSERVICE_ROUTINE ScsiPortIsr;
378 
380 NTAPI
383  _In_ PIRP Irp,
385  _In_ PVOID Context);
386 
388 NTAPI
391  _In_ PIRP Irp,
393  _In_ PVOID Context);
PCONTROLLER_OBJECT ControllerObject
Definition: scsiport.h:258
struct _SCSI_REQUEST_BLOCK_INFO * CompletedRequests
Definition: scsiport.h:111
struct _RESETBUS_PARAMS * PRESETBUS_PARAMS
PSCSI_PORT_LUN_EXTENSION SpiAllocateLunExtension(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: pdo.c:16
signed char * PCHAR
Definition: retypes.h:7
enum _IO_ALLOCATION_ACTION IO_ALLOCATION_ACTION
struct _BUSES_CONFIGURATION_INFORMATION * PBUSES_CONFIGURATION_INFORMATION
PSCSI_REQUEST_BLOCK_INFO SpiGetSrbData(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ UCHAR QueueTag)
Definition: pdo.c:92
PSCSI_LUN_INFO LunInfo
Definition: scsiport.h:172
struct _SCSI_LUN_INFO SCSI_LUN_INFO
KDEVICE_QUEUE DeviceQueue
Definition: scsiport.h:133
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1310
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
Definition: scsiport.h:303
BOOLEAN DisableMultipleLun
Definition: scsiport.h:75
KSERVICE_ROUTINE ScsiPortIsr
Definition: scsiport.h:377
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1310
BOOLEAN(NTAPI * PHW_RESET_BUS)(IN PVOID DeviceExtension, IN ULONG PathId)
Definition: srb.h:471
_In_ PIRP Irp
Definition: csq.h:116
PKINTERRUPT Interrupt[2]
Definition: scsiport.h:228
SCSI_PHYSICAL_ADDRESS IoAddress
Definition: scsiport.h:88
UCHAR MiniportLunExtension[1]
Definition: scsiport.h:151
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1310
struct _SCSI_SG_ADDRESS SCSI_SG_ADDRESS
KSYNCHRONIZE_ROUTINE ScsiPortStartPacket
Definition: scsiport.h:371
#define MAX_SG_LIST
Definition: scsiport.h:25
LONG NTSTATUS
Definition: precomp.h:26
PHW_INITIALIZE HwInitialize
Definition: scsiport.h:260
PDEVICE_OBJECT DeviceObject
Definition: scsiport.h:129
struct _SCSI_PORT_DEVICE_BASE * PSCSI_PORT_DEVICE_BASE
PSCSI_REQUEST_BLOCK_INFO CompletedRequests
Definition: scsiport.h:185
PVOID DeviceObject
Definition: scsiport.h:162
struct _SCSI_PORT_LUN_EXTENSION * PSCSI_PORT_LUN_EXTENSION
_SCSI_PORT_TIMER_STATES
Definition: scsiport.h:53
IO_DPC_ROUTINE ScsiPortDpcForIsr
Definition: scsiport.h:369
IO_ALLOCATION_ACTION NTAPI SpiAdapterControl(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID MapRegisterBase, _In_ PVOID Context)
PADAPTER_OBJECT AdapterObject
Definition: scsiport.h:272
struct _BUSES_CONFIGURATION_INFORMATION BUSES_CONFIGURATION_INFORMATION
DRIVER_DISPATCH ScsiPortDispatchScsi
Definition: scsiport.h:370
struct _SCSI_PORT_LUN_EXTENSION SCSI_PORT_LUN_EXTENSION
#define LUS_NUMBER
Definition: scsiport.h:23
struct _SCSI_PORT_DEVICE_BASE SCSI_PORT_DEVICE_BASE
NTSTATUS SpiBuildDeviceMap(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, _In_ PUNICODE_STRING RegistryPath)
Definition: registry.c:107
struct _SCSI_PORT_LUN_EXTENSION * Next
Definition: scsiport.h:126
struct _RESETBUS_PARAMS RESETBUS_PARAMS
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOLEAN(NTAPI * PHW_INITIALIZE)(IN PVOID DeviceExtension)
Definition: srb.h:429
long LONG
Definition: pedump.c:60
PSCSI_BUS_SCAN_INFO BusScanInfo[1]
Definition: scsiport.h:178
PSCSI_REQUEST_BLOCK_INFO SrbInfo
Definition: scsiport.h:251
unsigned char BOOLEAN
struct _SCSI_REQUEST_BLOCK_INFO * PSCSI_REQUEST_BLOCK_INFO
#define INQUIRYDATABUFFERSIZE
Definition: cdrw_hw.h:1113
PACCESS_RANGE AccessRanges
Definition: scsiport.h:79
PSCSI_SG_ADDRESS ScatterGather
Definition: scsiport.h:114
struct _CONFIGURATION_INFO CONFIGURATION_INFO
PMAPPED_ADDRESS MappedAddressList
Definition: scsiport.h:238
UCHAR InquiryData[INQUIRYDATABUFFERSIZE]
Definition: scsiport.h:164
PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
Definition: scsiport.h:252
PSCSI_PORT_LUN_EXTENSION SpiGetLunExtension(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun)
Definition: pdo.c:57
PPORT_CONFIGURATION_INFORMATION PortConfig
Definition: scsiport.h:212
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
struct _SCSI_PORT_DEVICE_EXTENSION * PSCSI_PORT_DEVICE_EXTENSION
BOOLEAN DeviceClaimed
Definition: scsiport.h:161
UCHAR PathId
Definition: scsiport.h:158
SCSI_REQUEST_BLOCK_INFO SrbInfo
Definition: scsiport.h:147
struct _SCSI_PORT_INTERRUPT_DATA SCSI_PORT_INTERRUPT_DATA
BOOLEAN(NTAPI * PHW_STARTIO)(IN PVOID DeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
Definition: srb.h:435
IO_ALLOCATION_ACTION NTAPI ScsiPortAllocateAdapterChannel(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID MapRegisterBase, _In_ PVOID Context)
IO_SCSI_CAPABILITIES PortCapabilities
Definition: scsiport.h:255
PSCSI_PORT_INTERRUPT_DATA InterruptData
Definition: scsiport.h:196
#define _Inout_
Definition: no_sal2.h:162
struct _SCSI_PORT_SAVE_INTERRUPT SCSI_PORT_SAVE_INTERRUPT
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID SpiGetNextRequestFromLun(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, _Inout_ PSCSI_PORT_LUN_EXTENSION LunExtension)
Definition: scsi.c:372
PSCSI_PORT_LUN_EXTENSION CompletedAbort
Definition: scsiport.h:186
Definition: ketypes.h:687
PHYSICAL_ADDRESS PhysicalAddress
Definition: scsiport.h:285
struct _CONFIGURATION_INFO * PCONFIGURATION_INFO
struct _SCSI_PORT_LUN_EXTENSION * CompletedAbortRequests
Definition: scsiport.h:145
Definition: typedefs.h:119
struct _SCSI_PORT_DEVICE_EXTENSION SCSI_PORT_DEVICE_EXTENSION
struct _SCSI_REQUEST_BLOCK_INFO SCSI_REQUEST_BLOCK_INFO
SCSI_PORT_TIMER_STATES TimerState
Definition: scsiport.h:232
DRIVER_DISPATCH(nfs41_FsdDispatch)
PSCSI_REQUEST_BLOCK Srb
Definition: scsiport.h:101
struct _SCSI_PORT_INTERRUPT_DATA * PSCSI_PORT_INTERRUPT_DATA
PHYSICAL_ADDRESS PhysicalAddress
Definition: scsiport.h:94
VOID SpiCleanupAfterInit(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:596
SCSI_SG_ADDRESS ScatterGatherList[MAX_SG_LIST]
Definition: scsiport.h:115
enum _SCSI_PORT_TIMER_STATES SCSI_PORT_TIMER_STATES
struct _SCSI_LUN_INFO * PSCSI_LUN_INFO
#define _In_
Definition: no_sal2.h:158
PDEVICE_OBJECT DeviceObject
Definition: scsiport.h:257
struct _SCSI_SG_ADDRESS * PSCSI_SG_ADDRESS
ULONG LastAdapterNumber
Definition: scsiport.h:65
INQUIRYDATA InquiryData
Definition: scsiport.h:131
UCHAR TargetId
Definition: scsiport.h:159
_Inout_ struct _IRP _In_ PVOID MapRegisterBase
Definition: iotypes.h:191
unsigned short USHORT
Definition: pedump.c:61
UCHAR LogicalUnitsCount
Definition: scsiport.h:170
NTSTATUS CallHWInitialize(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
Calls HwInitialize routine of the miniport and sets up interrupts Should be called inside ScsiPortIni...
Definition: fdo.c:459
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
UCHAR MiniPortDeviceExtension[1]
Definition: scsiport.h:297
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
BOOLEAN(NTAPI * PHW_INTERRUPT)(IN PVOID DeviceExtension)
Definition: srb.h:442
struct _SCSI_PORT_LUN_EXTENSION * ReadyLun
Definition: scsiport.h:144
struct _SCSI_LUN_INFO * Next
Definition: scsiport.h:163
PHW_DMA_STARTED HwDmaStarted
Definition: scsiport.h:264
DRIVER_STARTIO ScsiPortStartIo
Definition: scsiport.h:372
SCSI_REQUEST_BLOCK InternalSrb
Definition: scsiport.h:268
NTSTATUS NTAPI ScsiPortDeviceControl(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: ioctl.c:150
struct _SCSI_PORT_SAVE_INTERRUPT * PSCSI_PORT_SAVE_INTERRUPT
VOID(NTAPI * PHW_TIMER)(IN PVOID DeviceExtension)
Definition: srb.h:448
PSCSI_PORT_LUN_EXTENSION ReadyLun
Definition: scsiport.h:187
unsigned int ULONG
Definition: retypes.h:1
PSCSI_PORT_LUN_EXTENSION LunExtensionList[LUS_NUMBER]
Definition: scsiport.h:241
PHW_INTERRUPT HwInterrupt
Definition: scsiport.h:262
PBUSES_CONFIGURATION_INFORMATION BusesConfig
Definition: scsiport.h:213
PSCSI_REQUEST_BLOCK OriginalSrb
Definition: scsiport.h:267
VOID SpiScanAdapter(_In_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:231
BOOLEAN DisableTaggedQueueing
Definition: scsiport.h:74
SCSI_PORT_INTERRUPT_DATA InterruptData
Definition: scsiport.h:243
struct _SCSI_PORT_DEVICE_EXTENSION * DeviceExtension
Definition: scsiport.h:197
PHW_RESET_BUS HwResetBus
Definition: scsiport.h:263
VOID(NTAPI * PHW_DMA_STARTED)(IN PVOID DeviceExtension)
Definition: srb.h:454
struct _SCSI_BUS_SCAN_INFO SCSI_BUS_SCAN_INFO
struct _SCSI_BUS_SCAN_INFO * PSCSI_BUS_SCAN_INFO
VOID SpiInitOpenKeys(_Inout_ PCONFIGURATION_INFO ConfigInfo, _In_ PUNICODE_STRING RegistryPath)
Definition: registry.c:16
SENSE_DATA InternalSenseData
Definition: scsiport.h:269