2 * SCSI_PORT_TIMER_STATES
5 * An enumeration containing the states in the timer DFA
10 #define VERSION "0.0.3"
13 #define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
16 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
19 #define TAG_SCSIPORT 'ISCS'
21 /* Defines how many logical unit arrays will be in a device extension */
24 #define MAX_SG_LIST 17
27 #define SCSI_PORT_DEVICE_BUSY 0x0001
28 #define SCSI_PORT_LU_ACTIVE 0x0002
29 #define SCSI_PORT_NOTIFICATION_NEEDED 0x0004
30 #define SCSI_PORT_NEXT_REQUEST_READY 0x0008
31 #define SCSI_PORT_FLUSH_ADAPTERS 0x0010
32 #define SCSI_PORT_MAP_TRANSFER 0x0020
33 #define SCSI_PORT_RESET 0x0080
34 #define SCSI_PORT_RESET_REQUEST 0x0100
35 #define SCSI_PORT_RESET_REPORTED 0x0200
36 #define SCSI_PORT_REQUEST_PENDING 0x0800
37 #define SCSI_PORT_DISCONNECT_ALLOWED 0x1000
38 #define SCSI_PORT_DISABLE_INT_REQUESET 0x2000
39 #define SCSI_PORT_DISABLE_INTERRUPTS 0x4000
40 #define SCSI_PORT_ENABLE_INT_REQUEST 0x8000
41 #define SCSI_PORT_TIMER_NEEDED 0x10000
43 /* LUN Extension flags*/
44 #define LUNEX_FROZEN_QUEUE 0x0001
45 #define LUNEX_NEED_REQUEST_SENSE 0x0004
46 #define LUNEX_BUSY 0x0008
47 #define LUNEX_FULL_QUEUE 0x0010
48 #define LUNEX_REQUEST_PENDING 0x0020
49 #define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
52 typedef enum _SCSI_PORT_TIMER_STATES
56 IDETimerResetWaitForBusyNegate
,
57 IDETimerResetWaitForDrdyAssert
58 } SCSI_PORT_TIMER_STATES
;
60 typedef struct _CONFIGURATION_INFO
64 ULONG LastAdapterNumber
;
67 /* Registry related */
73 BOOLEAN DisableTaggedQueueing
;
74 BOOLEAN DisableMultipleLun
;
78 PACCESS_RANGE AccessRanges
;
79 } CONFIGURATION_INFO
, *PCONFIGURATION_INFO
;
81 typedef struct _SCSI_PORT_DEVICE_BASE
87 SCSI_PHYSICAL_ADDRESS IoAddress
;
88 ULONG SystemIoBusNumber
;
89 } SCSI_PORT_DEVICE_BASE
, *PSCSI_PORT_DEVICE_BASE
;
91 typedef struct _SCSI_SG_ADDRESS
93 PHYSICAL_ADDRESS PhysicalAddress
;
95 } SCSI_SG_ADDRESS
, *PSCSI_SG_ADDRESS
;
97 typedef struct _SCSI_REQUEST_BLOCK_INFO
100 PSCSI_REQUEST_BLOCK Srb
;
102 PVOID SaveSenseRequest
;
104 ULONG SequenceNumber
;
107 PVOID BaseOfMapRegister
;
108 ULONG NumberOfMapRegisters
;
110 struct _SCSI_REQUEST_BLOCK_INFO
*CompletedRequests
;
112 /* Scatter-gather list */
113 PSCSI_SG_ADDRESS ScatterGather
;
114 SCSI_SG_ADDRESS ScatterGatherList
[MAX_SG_LIST
];
115 } SCSI_REQUEST_BLOCK_INFO
, *PSCSI_REQUEST_BLOCK_INFO
;
117 typedef struct _SCSI_PORT_LUN_EXTENSION
125 struct _SCSI_PORT_LUN_EXTENSION
*Next
;
127 BOOLEAN DeviceClaimed
;
128 PDEVICE_OBJECT DeviceObject
;
130 INQUIRYDATA InquiryData
;
132 KDEVICE_QUEUE DeviceQueue
;
143 struct _SCSI_PORT_LUN_EXTENSION
*ReadyLun
;
144 struct _SCSI_PORT_LUN_EXTENSION
*CompletedAbortRequests
;
146 SCSI_REQUEST_BLOCK_INFO SrbInfo
;
150 UCHAR MiniportLunExtension
[1]; /* must be the last entry */
151 } SCSI_PORT_LUN_EXTENSION
, *PSCSI_PORT_LUN_EXTENSION
;
153 /* Structures for inquiries support */
155 typedef struct _SCSI_LUN_INFO
160 BOOLEAN DeviceClaimed
;
162 struct _SCSI_LUN_INFO
*Next
;
163 UCHAR InquiryData
[INQUIRYDATABUFFERSIZE
];
164 } SCSI_LUN_INFO
, *PSCSI_LUN_INFO
;
166 typedef struct _SCSI_BUS_SCAN_INFO
169 UCHAR LogicalUnitsCount
;
171 PSCSI_LUN_INFO LunInfo
;
172 } SCSI_BUS_SCAN_INFO
, *PSCSI_BUS_SCAN_INFO
;
174 typedef struct _BUSES_CONFIGURATION_INFORMATION
177 PSCSI_BUS_SCAN_INFO BusScanInfo
[1];
178 } BUSES_CONFIGURATION_INFORMATION
, *PBUSES_CONFIGURATION_INFORMATION
;
181 typedef struct _SCSI_PORT_INTERRUPT_DATA
183 ULONG Flags
; /* Interrupt-time flags */
184 PSCSI_REQUEST_BLOCK_INFO CompletedRequests
; /* Linked list of Srb info data */
185 PSCSI_PORT_LUN_EXTENSION CompletedAbort
;
186 PSCSI_PORT_LUN_EXTENSION ReadyLun
;
187 PHW_TIMER HwScsiTimer
;
188 ULONG MiniportTimerValue
;
189 } SCSI_PORT_INTERRUPT_DATA
, *PSCSI_PORT_INTERRUPT_DATA
;
192 /* Only for interrupt data saving function */
193 typedef struct _SCSI_PORT_SAVE_INTERRUPT
195 PSCSI_PORT_INTERRUPT_DATA InterruptData
;
196 struct _SCSI_PORT_DEVICE_EXTENSION
*DeviceExtension
;
197 } SCSI_PORT_SAVE_INTERRUPT
, *PSCSI_PORT_SAVE_INTERRUPT
;
200 * SCSI_PORT_DEVICE_EXTENSION
203 * First part of the port objects device extension. The second
204 * part is the miniport-specific device extension.
207 typedef struct _SCSI_PORT_DEVICE_EXTENSION
210 ULONG MiniPortExtensionSize
;
211 PPORT_CONFIGURATION_INFORMATION PortConfig
;
212 PBUSES_CONFIGURATION_INFORMATION BusesConfig
;
213 PVOID NonCachedExtension
;
216 LONG ActiveRequestCounter
;
224 KSPIN_LOCK IrqLock
; /* Used when there are 2 irqs */
225 ULONG SequenceNumber
; /* Global sequence number for packets */
227 PKINTERRUPT Interrupt
[2];
231 SCSI_PORT_TIMER_STATES TimerState
;
234 KTIMER MiniportTimer
;
235 KDPC MiniportTimerDpc
;
237 PMAPPED_ADDRESS MappedAddressList
;
239 ULONG LunExtensionSize
;
240 PSCSI_PORT_LUN_EXTENSION LunExtensionList
[LUS_NUMBER
];
242 SCSI_PORT_INTERRUPT_DATA InterruptData
;
244 /* SRB extension stuff*/
245 ULONG SrbExtensionSize
;
246 PVOID SrbExtensionBuffer
;
247 PVOID FreeSrbExtensions
;
249 /* SRB information */
250 PSCSI_REQUEST_BLOCK_INFO SrbInfo
;
251 PSCSI_REQUEST_BLOCK_INFO FreeSrbInfo
;
254 IO_SCSI_CAPABILITIES PortCapabilities
;
256 PDEVICE_OBJECT DeviceObject
;
257 PCONTROLLER_OBJECT ControllerObject
;
259 PHW_INITIALIZE HwInitialize
;
260 PHW_STARTIO HwStartIo
;
261 PHW_INTERRUPT HwInterrupt
;
262 PHW_RESET_BUS HwResetBus
;
263 PHW_DMA_STARTED HwDmaStarted
;
264 PHW_TIMER HwScsiTimer
;
266 PSCSI_REQUEST_BLOCK OriginalSrb
;
267 SCSI_REQUEST_BLOCK InternalSrb
;
268 SENSE_DATA InternalSenseData
;
270 /* DMA related stuff */
271 PADAPTER_OBJECT AdapterObject
;
272 ULONG MapRegisterCount
;
274 BOOLEAN MapRegisters
;
275 PVOID MapRegisterBase
;
279 BOOLEAN SupportsTaggedQueuing
;
280 BOOLEAN SupportsAutoSense
;
281 BOOLEAN MultipleReqsPerLun
;
282 BOOLEAN ReceiveEvent
;
284 PHYSICAL_ADDRESS PhysicalAddress
;
285 ULONG CommonBufferLength
;
286 ULONG InterruptLevel
[2];
289 BOOLEAN NeedSrbExtensionAlloc
;
290 BOOLEAN NeedSrbDataAlloc
;
292 ULONG RequestsNumber
;
294 ULONG InterruptCount
;
296 UCHAR MiniPortDeviceExtension
[1]; /* must be the last entry */
297 } SCSI_PORT_DEVICE_EXTENSION
, *PSCSI_PORT_DEVICE_EXTENSION
;
299 typedef struct _RESETBUS_PARAMS
302 PSCSI_PORT_DEVICE_EXTENSION DeviceExtension
;
303 } RESETBUS_PARAMS
, *PRESETBUS_PARAMS
;