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 SCSI_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 PHW_TIMER HwScsiTimer
;
186 ULONG MiniportTimerValue
;
187 } SCSI_PORT_INTERRUPT_DATA
, *PSCSI_PORT_INTERRUPT_DATA
;
190 /* Only for interrupt data saving function */
191 typedef struct _SCSI_PORT_SAVE_INTERRUPT
193 PSCSI_PORT_INTERRUPT_DATA InterruptData
;
194 struct _SCSI_PORT_DEVICE_EXTENSION
*DeviceExtension
;
195 } SCSI_PORT_SAVE_INTERRUPT
, *PSCSI_PORT_SAVE_INTERRUPT
;
198 * SCSI_PORT_DEVICE_EXTENSION
201 * First part of the port objects device extension. The second
202 * part is the miniport-specific device extension.
205 typedef struct _SCSI_PORT_DEVICE_EXTENSION
208 ULONG MiniPortExtensionSize
;
209 PPORT_CONFIGURATION_INFORMATION PortConfig
;
210 PBUSES_CONFIGURATION_INFORMATION BusesConfig
;
211 PVOID NonCachedExtension
;
214 LONG ActiveRequestCounter
;
222 KSPIN_LOCK IrqLock
; /* Used when there are 2 irqs */
223 ULONG SequenceNumber
; /* Global sequence number for packets */
225 PKINTERRUPT Interrupt
[2];
229 SCSI_PORT_TIMER_STATES TimerState
;
232 KTIMER MiniportTimer
;
233 KDPC MiniportTimerDpc
;
235 PMAPPED_ADDRESS MappedAddressList
;
237 ULONG LunExtensionSize
;
238 PSCSI_PORT_LUN_EXTENSION LunExtensionList
[LUS_NUMBER
];
240 SCSI_PORT_INTERRUPT_DATA InterruptData
;
242 /* SRB extension stuff*/
243 ULONG SrbExtensionSize
;
244 PVOID SrbExtensionBuffer
;
245 PVOID FreeSrbExtensions
;
247 /* SRB information */
248 PSCSI_REQUEST_BLOCK_INFO SrbInfo
;
249 PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
;
252 IO_SCSI_CAPABILITIES PortCapabilities
;
254 PDEVICE_OBJECT DeviceObject
;
255 PCONTROLLER_OBJECT ControllerObject
;
257 PHW_INITIALIZE HwInitialize
;
258 PHW_STARTIO HwStartIo
;
259 PHW_INTERRUPT HwInterrupt
;
260 PHW_RESET_BUS HwResetBus
;
261 PHW_DMA_STARTED HwDmaStarted
;
262 PHW_TIMER HwScsiTimer
;
264 PSCSI_REQUEST_BLOCK OriginalSrb
;
265 SCSI_REQUEST_BLOCK InternalSrb
;
266 SENSE_DATA InternalSenseData
;
268 /* DMA related stuff */
269 PADAPTER_OBJECT AdapterObject
;
270 ULONG MapRegisterCount
;
272 BOOLEAN MapRegisters
;
273 PVOID MapRegisterBase
;
277 BOOLEAN SupportsTaggedQueuing
;
278 BOOLEAN SupportsAutoSense
;
279 BOOLEAN MultipleReqsPerLun
;
280 BOOLEAN ReceiveEvent
;
282 PHYSICAL_ADDRESS PhysicalAddress
;
283 ULONG CommonBufferLength
;
284 ULONG InterruptLevel
[2];
287 BOOLEAN NeedSrbExtensionAlloc
;
288 BOOLEAN NeedSrbDataAlloc
;
290 ULONG RequestsNumber
;
292 ULONG InterruptCount
;
294 UCHAR MiniPortDeviceExtension
[1]; /* must be the last entry */
295 } SCSI_PORT_DEVICE_EXTENSION
, *PSCSI_PORT_DEVICE_EXTENSION
;
297 typedef struct _RESETBUS_PARAMS
300 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
;
301 } RESETBUS_PARAMS
, *PRESETBUS_PARAMS
;