2 * SCSI_PORT_TIMER_STATES
5 * An enumeration containing the states in the timer DFA
8 #define VERSION "0.0.3"
11 #define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
14 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
17 #define TAG_SCSIPORT 'ISCS'
19 /* Defines how many logical unit arrays will be in a device extension */
22 #define MAX_SG_LIST 17
25 #define SCSI_PORT_DEVICE_BUSY 0x0001
26 #define SCSI_PORT_LU_ACTIVE 0x0002
27 #define SCSI_PORT_NOTIFICATION_NEEDED 0x0004
28 #define SCSI_PORT_NEXT_REQUEST_READY 0x0008
29 #define SCSI_PORT_FLUSH_ADAPTERS 0x0010
30 #define SCSI_PORT_MAP_TRANSFER 0x0020
31 #define SCSI_PORT_RESET 0x0080
32 #define SCSI_PORT_RESET_REQUEST 0x0100
33 #define SCSI_PORT_RESET_REPORTED 0x0200
34 #define SCSI_PORT_REQUEST_PENDING 0x0800
35 #define SCSI_PORT_DISCONNECT_ALLOWED 0x1000
36 #define SCSI_PORT_DISABLE_INT_REQUESET 0x2000
37 #define SCSI_PORT_DISABLE_INTERRUPTS 0x4000
38 #define SCSI_PORT_ENABLE_INT_REQUEST 0x8000
39 #define SCIS_PORT_TIMER_NEEDED 0x10000
41 /* LUN Extension flags*/
42 #define LUNEX_FROZEN_QUEUE 0x0001
43 #define LUNEX_NEED_REQUEST_SENSE 0x0004
44 #define LUNEX_BUSY 0x0008
45 #define LUNEX_FULL_QUEUE 0x0010
46 #define LUNEX_REQUEST_PENDING 0x0020
47 #define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
50 typedef enum _SCSI_PORT_TIMER_STATES
54 IDETimerResetWaitForBusyNegate
,
55 IDETimerResetWaitForDrdyAssert
56 } SCSI_PORT_TIMER_STATES
;
58 typedef struct _CONFIGURATION_INFO
62 ULONG LastAdapterNumber
;
65 /* Registry related */
71 BOOLEAN DisableTaggedQueueing
;
72 BOOLEAN DisableMultipleLun
;
76 PACCESS_RANGE AccessRanges
;
77 } CONFIGURATION_INFO
, *PCONFIGURATION_INFO
;
79 typedef struct _SCSI_PORT_DEVICE_BASE
85 SCSI_PHYSICAL_ADDRESS IoAddress
;
86 ULONG SystemIoBusNumber
;
87 } SCSI_PORT_DEVICE_BASE
, *PSCSI_PORT_DEVICE_BASE
;
89 typedef struct _SCSI_SG_ADDRESS
91 PHYSICAL_ADDRESS PhysicalAddress
;
93 } SCSI_SG_ADDRESS
, *PSCSI_SG_ADDRESS
;
95 typedef struct _SCSI_REQUEST_BLOCK_INFO
98 PSCSI_REQUEST_BLOCK Srb
;
100 PVOID SaveSenseRequest
;
102 ULONG SequenceNumber
;
105 PVOID BaseOfMapRegister
;
106 ULONG NumberOfMapRegisters
;
108 struct _SCSI_REQUEST_BLOCK_INFO
*CompletedRequests
;
110 /* Scatter-gather list */
111 PSCSI_SG_ADDRESS ScatterGather
;
112 SCSI_SG_ADDRESS ScatterGatherList
[MAX_SG_LIST
];
113 } SCSI_REQUEST_BLOCK_INFO
, *PSCSI_REQUEST_BLOCK_INFO
;
115 typedef struct _SCSI_PORT_LUN_EXTENSION
123 struct _SCSI_PORT_LUN_EXTENSION
*Next
;
125 BOOLEAN DeviceClaimed
;
126 PDEVICE_OBJECT DeviceObject
;
128 INQUIRYDATA InquiryData
;
130 KDEVICE_QUEUE DeviceQueue
;
141 struct _SCSI_PORT_LUN_EXTENSION
*ReadyLun
;
142 struct _SCSI_PORT_LUN_EXTENSION
*CompletedAbortRequests
;
144 SCSI_REQUEST_BLOCK_INFO SrbInfo
;
148 UCHAR MiniportLunExtension
[1]; /* must be the last entry */
149 } SCSI_PORT_LUN_EXTENSION
, *PSCSI_PORT_LUN_EXTENSION
;
151 /* Structures for inquiries support */
153 typedef struct _SCSI_LUN_INFO
158 BOOLEAN DeviceClaimed
;
160 struct _SCSI_LUN_INFO
*Next
;
161 UCHAR InquiryData
[INQUIRYDATABUFFERSIZE
];
162 } SCSI_LUN_INFO
, *PSCSI_LUN_INFO
;
164 typedef struct _SCSI_BUS_SCAN_INFO
167 UCHAR LogicalUnitsCount
;
169 PSCSI_LUN_INFO LunInfo
;
170 } SCSI_BUS_SCAN_INFO
, *PSCSI_BUS_SCAN_INFO
;
172 typedef struct _BUSES_CONFIGURATION_INFORMATION
175 PSCSI_BUS_SCAN_INFO BusScanInfo
[1];
176 } BUSES_CONFIGURATION_INFORMATION
, *PBUSES_CONFIGURATION_INFORMATION
;
179 typedef struct _SCSI_PORT_INTERRUPT_DATA
181 ULONG Flags
; /* Interrupt-time flags */
182 PSCSI_REQUEST_BLOCK_INFO CompletedRequests
; /* Linked list of Srb info data */
183 PSCSI_PORT_LUN_EXTENSION CompletedAbort
;
184 PSCSI_PORT_LUN_EXTENSION ReadyLun
;
185 } SCSI_PORT_INTERRUPT_DATA
, *PSCSI_PORT_INTERRUPT_DATA
;
188 /* Only for interrupt data saving function */
189 typedef struct _SCSI_PORT_SAVE_INTERRUPT
191 PSCSI_PORT_INTERRUPT_DATA InterruptData
;
192 struct _SCSI_PORT_DEVICE_EXTENSION
*DeviceExtension
;
193 } SCSI_PORT_SAVE_INTERRUPT
, *PSCSI_PORT_SAVE_INTERRUPT
;
196 * SCSI_PORT_DEVICE_EXTENSION
199 * First part of the port objects device extension. The second
200 * part is the miniport-specific device extension.
203 typedef struct _SCSI_PORT_DEVICE_EXTENSION
206 ULONG MiniPortExtensionSize
;
207 PPORT_CONFIGURATION_INFORMATION PortConfig
;
208 PBUSES_CONFIGURATION_INFORMATION BusesConfig
;
209 PVOID NonCachedExtension
;
212 LONG ActiveRequestCounter
;
220 KSPIN_LOCK IrqLock
; /* Used when there are 2 irqs */
221 ULONG SequenceNumber
; /* Global sequence number for packets */
223 PKINTERRUPT Interrupt
;
227 SCSI_PORT_TIMER_STATES TimerState
;
230 KTIMER MiniportTimer
;
231 KDPC MiniportTimerDpc
;
233 PMAPPED_ADDRESS MappedAddressList
;
235 ULONG LunExtensionSize
;
236 PSCSI_PORT_LUN_EXTENSION LunExtensionList
[LUS_NUMBER
];
238 SCSI_PORT_INTERRUPT_DATA InterruptData
;
240 /* SRB extension stuff*/
241 ULONG SrbExtensionSize
;
242 PVOID SrbExtensionBuffer
;
243 PVOID FreeSrbExtensions
;
245 /* SRB information */
246 PSCSI_REQUEST_BLOCK_INFO SrbInfo
;
247 PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
;
250 IO_SCSI_CAPABILITIES PortCapabilities
;
252 PDEVICE_OBJECT DeviceObject
;
253 PCONTROLLER_OBJECT ControllerObject
;
255 PHW_INITIALIZE HwInitialize
;
256 PHW_STARTIO HwStartIo
;
257 PHW_INTERRUPT HwInterrupt
;
258 PHW_RESET_BUS HwResetBus
;
259 PHW_DMA_STARTED HwDmaStarted
;
261 PSCSI_REQUEST_BLOCK OriginalSrb
;
262 SCSI_REQUEST_BLOCK InternalSrb
;
263 SENSE_DATA InternalSenseData
;
265 /* DMA related stuff */
266 PADAPTER_OBJECT AdapterObject
;
267 ULONG MapRegisterCount
;
269 BOOLEAN MapRegisters
;
270 PVOID MapRegisterBase
;
274 BOOLEAN SupportsTaggedQueuing
;
275 BOOLEAN SupportsAutoSense
;
276 BOOLEAN MultipleReqsPerLun
;
277 BOOLEAN ReceiveEvent
;
279 PHYSICAL_ADDRESS PhysicalAddress
;
280 ULONG CommonBufferLength
;
281 ULONG InterruptLevel
;
284 BOOLEAN NeedSrbExtensionAlloc
;
285 BOOLEAN NeedSrbDataAlloc
;
287 ULONG RequestsNumber
;
289 UCHAR MiniPortDeviceExtension
[1]; /* must be the last entry */
290 } SCSI_PORT_DEVICE_EXTENSION
, *PSCSI_PORT_DEVICE_EXTENSION
;
292 typedef struct _RESETBUS_PARAMS
295 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
;
296 } RESETBUS_PARAMS
, *PRESETBUS_PARAMS
;