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(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
18 #define TAG_SCSIPORT TAG('S', 'C', 'S', 'I')
20 /* Defines how many logical unit arrays will be in a device extension */
23 #define MAX_SG_LIST 17
26 #define SCSI_PORT_DEVICE_BUSY 0x0001
27 #define SCSI_PORT_LU_ACTIVE 0x0002
28 #define SCSI_PORT_NOTIFICATION_NEEDED 0x0004
29 #define SCSI_PORT_NEXT_REQUEST_READY 0x0008
30 #define SCSI_PORT_FLUSH_ADAPTERS 0x0010
31 #define SCSI_PORT_MAP_TRANSFER 0x0020
32 #define SCSI_PORT_RESET 0x0080
33 #define SCSI_PORT_RESET_REQUEST 0x0100
34 #define SCSI_PORT_RESET_REPORTED 0x0200
35 #define SCSI_PORT_REQUEST_PENDING 0x0800
36 #define SCSI_PORT_DISCONNECT_ALLOWED 0x1000
37 #define SCSI_PORT_DISABLE_INT_REQUESET 0x2000
38 #define SCSI_PORT_DISABLE_INTERRUPTS 0x4000
39 #define SCSI_PORT_ENABLE_INT_REQUEST 0x8000
40 #define SCIS_PORT_TIMER_NEEDED 0x10000
42 /* LUN Extension flags*/
43 #define LUNEX_FROZEN_QUEUE 0x0001
44 #define LUNEX_NEED_REQUEST_SENSE 0x0004
45 #define LUNEX_BUSY 0x0008
46 #define LUNEX_FULL_QUEUE 0x0010
47 #define LUNEX_REQUEST_PENDING 0x0020
48 #define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
51 typedef enum _SCSI_PORT_TIMER_STATES
55 IDETimerResetWaitForBusyNegate
,
56 IDETimerResetWaitForDrdyAssert
57 } SCSI_PORT_TIMER_STATES
;
59 typedef struct _CONFIGURATION_INFO
63 ULONG LastAdapterNumber
;
66 /* Registry related */
72 BOOLEAN DisableTaggedQueueing
;
73 BOOLEAN DisableMultipleLun
;
77 PACCESS_RANGE AccessRanges
;
78 } CONFIGURATION_INFO
, *PCONFIGURATION_INFO
;
80 typedef struct _SCSI_PORT_DEVICE_BASE
86 SCSI_PHYSICAL_ADDRESS IoAddress
;
87 ULONG SystemIoBusNumber
;
88 } SCSI_PORT_DEVICE_BASE
, *PSCSI_PORT_DEVICE_BASE
;
90 typedef struct _SCSI_SG_ADDRESS
92 PHYSICAL_ADDRESS PhysicalAddress
;
94 } SCSI_SG_ADDRESS
, *PSCSI_SG_ADDRESS
;
96 typedef struct _SCSI_REQUEST_BLOCK_INFO
99 PSCSI_REQUEST_BLOCK Srb
;
101 PVOID SaveSenseRequest
;
103 ULONG SequenceNumber
;
106 PVOID BaseOfMapRegister
;
107 ULONG NumberOfMapRegisters
;
109 struct _SCSI_REQUEST_BLOCK_INFO
*CompletedRequests
;
111 /* Scatter-gather list */
112 PSCSI_SG_ADDRESS ScatterGather
;
113 SCSI_SG_ADDRESS ScatterGatherList
[MAX_SG_LIST
];
114 } SCSI_REQUEST_BLOCK_INFO
, *PSCSI_REQUEST_BLOCK_INFO
;
116 typedef struct _SCSI_PORT_LUN_EXTENSION
124 struct _SCSI_PORT_LUN_EXTENSION
*Next
;
126 BOOLEAN DeviceClaimed
;
127 PDEVICE_OBJECT DeviceObject
;
129 INQUIRYDATA InquiryData
;
131 KDEVICE_QUEUE DeviceQueue
;
142 struct _SCSI_PORT_LUN_EXTENSION
*ReadyLun
;
143 struct _SCSI_PORT_LUN_EXTENSION
*CompletedAbortRequests
;
145 SCSI_REQUEST_BLOCK_INFO SrbInfo
;
149 UCHAR MiniportLunExtension
[1]; /* must be the last entry */
150 } SCSI_PORT_LUN_EXTENSION
, *PSCSI_PORT_LUN_EXTENSION
;
152 /* Structures for inquiries support */
154 typedef struct _SCSI_LUN_INFO
159 BOOLEAN DeviceClaimed
;
161 struct _SCSI_LUN_INFO
*Next
;
162 UCHAR InquiryData
[INQUIRYDATABUFFERSIZE
];
163 } SCSI_LUN_INFO
, *PSCSI_LUN_INFO
;
165 typedef struct _SCSI_BUS_SCAN_INFO
168 UCHAR LogicalUnitsCount
;
170 PSCSI_LUN_INFO LunInfo
;
171 } SCSI_BUS_SCAN_INFO
, *PSCSI_BUS_SCAN_INFO
;
173 typedef struct _BUSES_CONFIGURATION_INFORMATION
176 PSCSI_BUS_SCAN_INFO BusScanInfo
[1];
177 } BUSES_CONFIGURATION_INFORMATION
, *PBUSES_CONFIGURATION_INFORMATION
;
180 typedef struct _SCSI_PORT_INTERRUPT_DATA
182 ULONG Flags
; /* Interrupt-time flags */
183 PSCSI_REQUEST_BLOCK_INFO CompletedRequests
; /* Linked list of Srb info data */
184 PSCSI_PORT_LUN_EXTENSION CompletedAbort
;
185 PSCSI_PORT_LUN_EXTENSION ReadyLun
;
186 } SCSI_PORT_INTERRUPT_DATA
, *PSCSI_PORT_INTERRUPT_DATA
;
189 /* Only for interrupt data saving function */
190 typedef struct _SCSI_PORT_SAVE_INTERRUPT
192 PSCSI_PORT_INTERRUPT_DATA InterruptData
;
193 struct _SCSI_PORT_DEVICE_EXTENSION
*DeviceExtension
;
194 } SCSI_PORT_SAVE_INTERRUPT
, *PSCSI_PORT_SAVE_INTERRUPT
;
197 * SCSI_PORT_DEVICE_EXTENSION
200 * First part of the port objects device extension. The second
201 * part is the miniport-specific device extension.
204 typedef struct _SCSI_PORT_DEVICE_EXTENSION
207 ULONG MiniPortExtensionSize
;
208 PPORT_CONFIGURATION_INFORMATION PortConfig
;
209 PBUSES_CONFIGURATION_INFORMATION BusesConfig
;
210 PVOID NonCachedExtension
;
213 LONG ActiveRequestCounter
;
221 KSPIN_LOCK IrqLock
; /* Used when there are 2 irqs */
222 ULONG SequenceNumber
; /* Global sequence number for packets */
224 PKINTERRUPT Interrupt
;
228 SCSI_PORT_TIMER_STATES TimerState
;
231 KTIMER MiniportTimer
;
232 KDPC MiniportTimerDpc
;
234 PMAPPED_ADDRESS MappedAddressList
;
236 ULONG LunExtensionSize
;
237 PSCSI_PORT_LUN_EXTENSION LunExtensionList
[LUS_NUMBER
];
239 SCSI_PORT_INTERRUPT_DATA InterruptData
;
241 /* SRB extension stuff*/
242 ULONG SrbExtensionSize
;
243 PVOID SrbExtensionBuffer
;
244 PVOID FreeSrbExtensions
;
246 /* SRB information */
247 PSCSI_REQUEST_BLOCK_INFO SrbInfo
;
248 PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
;
251 IO_SCSI_CAPABILITIES PortCapabilities
;
253 PDEVICE_OBJECT DeviceObject
;
254 PCONTROLLER_OBJECT ControllerObject
;
256 PHW_INITIALIZE HwInitialize
;
257 PHW_STARTIO HwStartIo
;
258 PHW_INTERRUPT HwInterrupt
;
259 PHW_RESET_BUS HwResetBus
;
260 PHW_DMA_STARTED HwDmaStarted
;
262 PSCSI_REQUEST_BLOCK OriginalSrb
;
263 SCSI_REQUEST_BLOCK InternalSrb
;
264 SENSE_DATA InternalSenseData
;
266 /* DMA related stuff */
267 PADAPTER_OBJECT AdapterObject
;
268 ULONG MapRegisterCount
;
270 BOOLEAN MapRegisters
;
271 PVOID MapRegisterBase
;
275 BOOLEAN SupportsTaggedQueuing
;
276 BOOLEAN SupportsAutoSense
;
277 BOOLEAN MultipleReqsPerLun
;
278 BOOLEAN ReceiveEvent
;
280 PHYSICAL_ADDRESS PhysicalAddress
;
281 ULONG CommonBufferLength
;
282 ULONG InterruptLevel
;
285 BOOLEAN NeedSrbExtensionAlloc
;
286 BOOLEAN NeedSrbDataAlloc
;
288 ULONG RequestsNumber
;
290 UCHAR MiniPortDeviceExtension
[1]; /* must be the last entry */
291 } SCSI_PORT_DEVICE_EXTENSION
, *PSCSI_PORT_DEVICE_EXTENSION
;
293 typedef struct _RESETBUS_PARAMS
296 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
;
297 } RESETBUS_PARAMS
, *PRESETBUS_PARAMS
;