2 * SCSI_PORT_TIMER_STATES
5 * An enumeration containing the states in the timer DFA
18 #define VERSION "0.0.3"
21 #define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
24 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
27 #define TAG_SCSIPORT 'ISCS'
29 /* Defines how many logical unit arrays will be in a device extension */
32 #define MAX_SG_LIST 17
35 #define SCSI_PORT_DEVICE_BUSY 0x0001
36 #define SCSI_PORT_LU_ACTIVE 0x0002
37 #define SCSI_PORT_NOTIFICATION_NEEDED 0x0004
38 #define SCSI_PORT_NEXT_REQUEST_READY 0x0008
39 #define SCSI_PORT_FLUSH_ADAPTERS 0x0010
40 #define SCSI_PORT_MAP_TRANSFER 0x0020
41 #define SCSI_PORT_RESET 0x0080
42 #define SCSI_PORT_RESET_REQUEST 0x0100
43 #define SCSI_PORT_RESET_REPORTED 0x0200
44 #define SCSI_PORT_REQUEST_PENDING 0x0800
45 #define SCSI_PORT_DISCONNECT_ALLOWED 0x1000
46 #define SCSI_PORT_DISABLE_INT_REQUESET 0x2000
47 #define SCSI_PORT_DISABLE_INTERRUPTS 0x4000
48 #define SCSI_PORT_ENABLE_INT_REQUEST 0x8000
49 #define SCSI_PORT_TIMER_NEEDED 0x10000
51 /* LUN Extension flags*/
52 #define LUNEX_FROZEN_QUEUE 0x0001
53 #define LUNEX_NEED_REQUEST_SENSE 0x0004
54 #define LUNEX_BUSY 0x0008
55 #define LUNEX_FULL_QUEUE 0x0010
56 #define LUNEX_REQUEST_PENDING 0x0020
57 #define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
60 typedef enum _SCSI_PORT_TIMER_STATES
64 IDETimerResetWaitForBusyNegate
,
65 IDETimerResetWaitForDrdyAssert
66 } SCSI_PORT_TIMER_STATES
;
68 typedef struct _CONFIGURATION_INFO
72 ULONG LastAdapterNumber
;
75 /* Registry related */
81 BOOLEAN DisableTaggedQueueing
;
82 BOOLEAN DisableMultipleLun
;
86 PACCESS_RANGE AccessRanges
;
87 } CONFIGURATION_INFO
, *PCONFIGURATION_INFO
;
89 typedef struct _SCSI_PORT_DEVICE_BASE
95 SCSI_PHYSICAL_ADDRESS IoAddress
;
96 ULONG SystemIoBusNumber
;
97 } SCSI_PORT_DEVICE_BASE
, *PSCSI_PORT_DEVICE_BASE
;
99 typedef struct _SCSI_SG_ADDRESS
101 PHYSICAL_ADDRESS PhysicalAddress
;
103 } SCSI_SG_ADDRESS
, *PSCSI_SG_ADDRESS
;
105 typedef struct _SCSI_REQUEST_BLOCK_INFO
108 PSCSI_REQUEST_BLOCK Srb
;
110 PVOID SaveSenseRequest
;
112 ULONG SequenceNumber
;
115 PVOID BaseOfMapRegister
;
116 ULONG NumberOfMapRegisters
;
118 struct _SCSI_REQUEST_BLOCK_INFO
*CompletedRequests
;
120 /* Scatter-gather list */
121 PSCSI_SG_ADDRESS ScatterGather
;
122 SCSI_SG_ADDRESS ScatterGatherList
[MAX_SG_LIST
];
123 } SCSI_REQUEST_BLOCK_INFO
, *PSCSI_REQUEST_BLOCK_INFO
;
125 typedef struct _SCSI_PORT_LUN_EXTENSION
133 struct _SCSI_PORT_LUN_EXTENSION
*Next
;
135 BOOLEAN DeviceClaimed
;
136 PDEVICE_OBJECT DeviceObject
;
138 INQUIRYDATA InquiryData
;
140 KDEVICE_QUEUE DeviceQueue
;
151 struct _SCSI_PORT_LUN_EXTENSION
*ReadyLun
;
152 struct _SCSI_PORT_LUN_EXTENSION
*CompletedAbortRequests
;
154 SCSI_REQUEST_BLOCK_INFO SrbInfo
;
158 UCHAR MiniportLunExtension
[1]; /* must be the last entry */
159 } SCSI_PORT_LUN_EXTENSION
, *PSCSI_PORT_LUN_EXTENSION
;
161 /* Structures for inquiries support */
163 typedef struct _SCSI_LUN_INFO
168 BOOLEAN DeviceClaimed
;
170 struct _SCSI_LUN_INFO
*Next
;
171 UCHAR InquiryData
[INQUIRYDATABUFFERSIZE
];
172 } SCSI_LUN_INFO
, *PSCSI_LUN_INFO
;
174 typedef struct _SCSI_BUS_SCAN_INFO
177 UCHAR LogicalUnitsCount
;
179 PSCSI_LUN_INFO LunInfo
;
180 } SCSI_BUS_SCAN_INFO
, *PSCSI_BUS_SCAN_INFO
;
182 typedef struct _BUSES_CONFIGURATION_INFORMATION
185 PSCSI_BUS_SCAN_INFO BusScanInfo
[1];
186 } BUSES_CONFIGURATION_INFORMATION
, *PBUSES_CONFIGURATION_INFORMATION
;
189 typedef struct _SCSI_PORT_INTERRUPT_DATA
191 ULONG Flags
; /* Interrupt-time flags */
192 PSCSI_REQUEST_BLOCK_INFO CompletedRequests
; /* Linked list of Srb info data */
193 PSCSI_PORT_LUN_EXTENSION CompletedAbort
;
194 PSCSI_PORT_LUN_EXTENSION ReadyLun
;
195 PHW_TIMER HwScsiTimer
;
196 ULONG MiniportTimerValue
;
197 } SCSI_PORT_INTERRUPT_DATA
, *PSCSI_PORT_INTERRUPT_DATA
;
200 /* Only for interrupt data saving function */
201 typedef struct _SCSI_PORT_SAVE_INTERRUPT
203 PSCSI_PORT_INTERRUPT_DATA InterruptData
;
204 struct _SCSI_PORT_DEVICE_EXTENSION
*DeviceExtension
;
205 } SCSI_PORT_SAVE_INTERRUPT
, *PSCSI_PORT_SAVE_INTERRUPT
;
208 * SCSI_PORT_DEVICE_EXTENSION
211 * First part of the port objects device extension. The second
212 * part is the miniport-specific device extension.
215 typedef struct _SCSI_PORT_DEVICE_EXTENSION
218 ULONG MiniPortExtensionSize
;
219 PPORT_CONFIGURATION_INFORMATION PortConfig
;
220 PBUSES_CONFIGURATION_INFORMATION BusesConfig
;
221 PVOID NonCachedExtension
;
224 LONG ActiveRequestCounter
;
232 KSPIN_LOCK IrqLock
; /* Used when there are 2 irqs */
233 ULONG SequenceNumber
; /* Global sequence number for packets */
235 PKINTERRUPT Interrupt
[2];
239 SCSI_PORT_TIMER_STATES TimerState
;
242 KTIMER MiniportTimer
;
243 KDPC MiniportTimerDpc
;
245 PMAPPED_ADDRESS MappedAddressList
;
247 ULONG LunExtensionSize
;
248 PSCSI_PORT_LUN_EXTENSION LunExtensionList
[LUS_NUMBER
];
250 SCSI_PORT_INTERRUPT_DATA InterruptData
;
252 /* SRB extension stuff*/
253 ULONG SrbExtensionSize
;
254 PVOID SrbExtensionBuffer
;
255 PVOID FreeSrbExtensions
;
257 /* SRB information */
258 PSCSI_REQUEST_BLOCK_INFO SrbInfo
;
259 PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
;
262 IO_SCSI_CAPABILITIES PortCapabilities
;
264 PDEVICE_OBJECT DeviceObject
;
265 PCONTROLLER_OBJECT ControllerObject
;
267 PHW_INITIALIZE HwInitialize
;
268 PHW_STARTIO HwStartIo
;
269 PHW_INTERRUPT HwInterrupt
;
270 PHW_RESET_BUS HwResetBus
;
271 PHW_DMA_STARTED HwDmaStarted
;
272 PHW_TIMER HwScsiTimer
;
274 PSCSI_REQUEST_BLOCK OriginalSrb
;
275 SCSI_REQUEST_BLOCK InternalSrb
;
276 SENSE_DATA InternalSenseData
;
278 /* DMA related stuff */
279 PADAPTER_OBJECT AdapterObject
;
280 ULONG MapRegisterCount
;
282 BOOLEAN MapRegisters
;
283 PVOID MapRegisterBase
;
287 BOOLEAN SupportsTaggedQueuing
;
288 BOOLEAN SupportsAutoSense
;
289 BOOLEAN MultipleReqsPerLun
;
290 BOOLEAN ReceiveEvent
;
292 PHYSICAL_ADDRESS PhysicalAddress
;
293 ULONG CommonBufferLength
;
294 ULONG InterruptLevel
[2];
297 BOOLEAN NeedSrbExtensionAlloc
;
298 BOOLEAN NeedSrbDataAlloc
;
300 ULONG RequestsNumber
;
302 ULONG InterruptCount
;
304 UCHAR MiniPortDeviceExtension
[1]; /* must be the last entry */
305 } SCSI_PORT_DEVICE_EXTENSION
, *PSCSI_PORT_DEVICE_EXTENSION
;
307 typedef struct _RESETBUS_PARAMS
310 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
;
311 } RESETBUS_PARAMS
, *PRESETBUS_PARAMS
;