FreeBSD kernel pms device code
smtypes.h
Go to the documentation of this file.
1/*******************************************************************************
2*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
3*
4*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*that the following conditions are met:
6*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*following disclaimer.
8*2. Redistributions in binary form must reproduce the above copyright notice,
9*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*with the distribution.
11*
12*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20*
21* $FreeBSD$
22*
23********************************************************************************/
24#ifndef __SMTYPES_H__
25#define __SMTYPES_H__
26
30
34
38
40
41/*
42 * SAT specific structure per SATA drive
43 */
44#define SAT_NONNCQ_MAX 1
45#define SAT_NCQ_MAX 32
46#define SAT_MAX_INT_IO 16
47#define SAT_APAPI_CMDQ_MAX 2
48
49/* SMP direct payload size limit: IOMB direct payload size = 48 */
50#define SMP_DIRECT_PAYLOAD_LIMIT 44
51
52/* timer functions ; both I and T */
53typedef void (*smTimerCBFunc_t)(smRoot_t *smRoot, void *timerData1, void *timerData2, void *timerData3);
54
55
60typedef struct smTimerRequest_s {
61 /* the number of ticks */
70
71
72
73typedef struct smSatInternalIo_s
74{
76 smIORequest_t satIntSmIORequest; /* old satIntTiIORequest */
77 void *satIntRequestBody; /* maps to smIOrequestBody */
78 smScsiInitiatorRequest_t satIntSmScsiXchg; /* old satIntTiScsiXchg*/
82 smIORequest_t *satOrgSmIORequest; /* old satOrgTiIORequest */
85
86
87
88typedef struct smDeviceData_s {
89 smList_t FreeLink; /* free dev list */
90 smList_t MainLink; /* main(in use) dev list */
91 bit32 id; /* for debugging only */
94 bit32 valid; /* valid or registered */
95 smTimerRequest_t SATAIDDeviceTimer; /* ID Device Data timer for SATA device */
96 bit32 SMAbortAll; /* flag for abortall case */
99 agsaDevHandle_t *agExpDevHandle; /* expander a device is attached to if expander attached */
101 agsaContext_t agDeviceResetContext; /* used in saLocalPhyControl() */
103
104 /* from satDeviceData_t */
105 smList_t satIoLinkList; /* Normal I/O from TISA */
106 smList_t satFreeIntIoLinkList; /* SAT internal I/O free list */
107 smList_t satActiveIntIoLinkList; /* SAT internal I/O active list */
108 smSatInternalIo_t satIntIo[SAT_MAX_INT_IO]; /* Internal I/O resource */
109 agsaSATAIdentifyData_t satIdentifyData; /* Copy of SATA Id Dev data */
110 bit32 satNCQ; /* Flag for NCQ support */
111 bit32 sat48BitSupport; /* Flag for 48-bit addressing */
112 bit32 satSMARTSelfTest; /* Flag for SMART self test */
113 bit32 satSMARTFeatureSet; /* Flag for SMART feature set */
114 bit32 satSMARTEnabled; /* Flag for SMART enabled */
115 bit32 satRemovableMedia; /* Flag for Removable Media */
116 bit32 satRemovableMediaEnabled; /* Flag for Removable Media Enabled */
117 bit32 satDMASupport; /* Flag for DMA Support */
118 bit32 satDMAEnabled; /* Flag for DMA Enabled */
119 bit32 satUltraDMAMode; /* Ultra DMA mode value */
120 bit32 satDMADIRSupport; /* Flag for DMA direction */
121 bit32 satReadLookAheadSupport; /* Flag for Read Look Ahead */
122 bit32 satVolatileWriteCacheSupport; /* Flag for Volatile Write Cache support*/
123 bit32 satWWNSupport; /* Flag for DMA Enabled */
124 bit32 satDMASetupAA; /* Flag for DMA Setup Auto-Activate */
125 bit32 satNCQQMgntCmd; /* Flag for NCQ Queue Management Command */
126 bit32 volatile satPendingIO; /* Number of pending I/O */
127 bit32 volatile satPendingNCQIO; /* Number of pending NCQ I/O */
128 bit32 volatile satPendingNONNCQIO; /* Number of pending NON NCW I/O*/
129 bit32 satNCQMaxIO; /* Max NCQ I/O in SAT or drive */
130 bit32 satDriveState; /* State of SAT/drive */
131 bit32 satAbortAfterReset; /* Flag: abort after SATA reset */
132 bit32 satAbortCalled; /* Flag: abort called indication*/
133 bit32 satVerifyState; /* Flag: Read Vrf state for diag*/
134 bit32 satMaxUserAddrSectors; /* max user addressable setctors*/
135 bit32 satWriteCacheEnabled; /* Flag for write cache enabled */
136 bit32 satLookAheadEnabled; /* Flag for look ahead enabled */
137 bit32 satDeviceFaultState; /* State of DF */
138 bit32 satStopState; /* State of Start and Stop */
139 bit32 satFormatState; /* State of format */
140 bit32 satPMField; /* PM field, first 4 bits */
141 bit8 satSignature[8]; /* Signature */
142 bit32 satDeviceType; /* ATA device type */
143 bit32 satSectorDone; /* Number of Sector done by Cmnd*/
144 bit32 freeSATAFDMATagBitmap; /* SATA NCQ tag bit map */
145 bit32 IDDeviceValid; /* ID DeviceData valid bit */
146 bit8 satMaxLBA[8]; /* MAXLBA is from read capacity */
147 bit32 satBGPendingDiag; /* Pending Diagnostic in backgound */
148 bit32 NumOfFCA; /* number of SMP HARD RESET on this device */
149 bit32 NumOfIDRetries; /* number of SMP HARD RESET after ID retries */
150 smIORequest_t *satTmTaskTag; /* TM Task Tag */
151 void *satSaDeviceData; /* Pointer back to sa dev data */
152 bit32 ID_Retries; /* identify device data retries */
153 bit32 OSAbortAll; /* OS calls abort all */
154 bit32 ReadCapacity; /* Read Capacity Type; 10, 16 */
159
161{
172
174
175/*
176 * SCSI Sense Data
177 */
178typedef struct
179{
182 bit8 senseKey; /* sense key */
183 bit8 info[4];
184 bit8 addSenseLen; /* 11 always */
185 bit8 cmdSpecific[4];
186 bit8 addSenseCode; /* additional sense code */
187 bit8 senseQual; /* additional sense code qualifier */
189 bit8 skeySpecific[3];
191
192
193/*
194 * SATA SAT specific function pointer for SATA completion for SAT commands.
195 */
196typedef void (*smSatCompleteCbPtr_t )(
197 agsaRoot_t *agRoot,
198 agsaIORequest_t *agIORequest,
199 bit32 agIOStatus,
200 agsaFisHeader_t *agFirstDword,
201 bit32 agIOInfoLen,
202 agsaFrameHandle_t agFrameHandle,
203 void *satIOContext
204 );
205
206/* for SMP only */
207typedef void (*smSMPCompleted_t)(
208 agsaRoot_t *,
210 bit32 ,
211 bit32 ,
213 );
214
215
216/*
217 * SATA SAT specific function for I/O context
218 */
219typedef struct smSatIOContext_s
220{
226 smSenseData_t *pSmSenseData; /* old pTiSenseData */
227 void *smRequestBody; /* smIORequestBody_t; old tiRequestBody*/
228 void *smScsiXchg; /* for writesame10(); old tiScsiXchg */
232 smSatInternalIo_t *satIntIoContext; /* SATM generated IOs */
233 smDeviceHandle_t *psmDeviceHandle; /* old ptiDeviceHandle */
235 bit8 superIOFlag;/* Flag indicating type for smScsiXchg */
236 bit8 reserved1; /* Padding for allignment */
237 bit8 reserved2; /* Padding for allignment */
238 bit32 currentLBA; /* current LBA for read and write */
239 bit32 ATACmd; /* ATA command */
240 bit32 OrgTL; /* original tranfer length(tl) */
241 bit32 LoopNum; /* denominator tl */
242 bit32 LoopNum2; /* denominator tl */
243 bit8 LBA[8]; /* for reassign blocks; current LBA */
244 bit32 ParmIndex; /* for reassign blocks;current idx in defective LBA LIST */
245 bit32 ParmLen; /* for reassign blocks; defective LBA list length */
246 bit32 NotifyOS; /* only for task management */
247 bit32 TMF; /* task management function */
255 /* For the SAT Passthrough */
264 bit32 pid; /* port id; used to protect double completion */
265 bit32 id; /* for debugging */
267
268typedef struct smIORequestBody_s {
273 smIORequest_t *smIOToBeAbortedRequest; /* IO to be aborted; old tiIOToBeAbortedRequest */
276 union {
277 struct {
280 smSenseData_t smSenseData; /* old tiSenseData */
287 union {
288 struct {
290 smSgl_t smSgl1; /* old tiSgl1 */
291 smSgl_t smSgl2; /* old tiSgl2 */
293 } InitiatorRegIO; /* regular IO */
294 struct {
298 } InitiatorTMIO; /* task management */
300
302
303typedef struct smSMPRequestBody_s {
304 smSMPCompleted_t SMPCompletionFunc;/* must be the second */
305
306 smDeviceHandle_t *smDevHandle; /* not used for SM generated SMP */
311 smIORequest_t *CurrentTaskTag; /* SMP is used for simulate target reset */
312// tdsaPortContext_t *tdPortContext; /* portcontext where SMP is sent from */
314 only for direct SMP */
315 bit32 retries; /* number of retries */
316
318
319
320typedef struct smRootOsData_s {
323 void *smIni;
325
326typedef struct smIntContext_s {
329
332
335
338
343
350
351typedef struct smIntRoot_s
352{
356
357
358#endif /* __SMTYPES_H__ */
359
unsigned int bit32
Definition: ostypes.h:99
unsigned char bit8
Definition: ostypes.h:97
The file defines the constants, data structure, and functions defined by LL API.
void * agsaFrameHandle_t
handle to access frame
Definition: sa.h:1719
The file defines the declaration of tSDK APIs.
The file defines the declaration of OS APIs.
struct smDeviceData_s smDeviceData_t
struct smAtaPassThroughHdr_s smAtaPassThroughHdr_t
#define SAT_MAX_INT_IO
Definition: smtypes.h:46
struct smSatInternalIo_s smSatInternalIo_t
struct smSMPRequestBody_s smSMPRequestBody_t
struct smIntRoot_s smIntRoot_t
struct smSatIOContext_s smSatIOContext_t
struct smIORequestBody_s smIORequestBody_t
void(* smSMPCompleted_t)(agsaRoot_t *, agsaIORequest_t *, bit32, bit32, agsaFrameHandle_t)
Definition: smtypes.h:207
void(* smSatCompleteCbPtr_t)(agsaRoot_t *agRoot, agsaIORequest_t *agIORequest, bit32 agIOStatus, agsaFisHeader_t *agFirstDword, bit32 agIOInfoLen, agsaFrameHandle_t agFrameHandle, void *satIOContext)
Definition: smtypes.h:196
void(* smTimerCBFunc_t)(smRoot_t *smRoot, void *timerData1, void *timerData2, void *timerData3)
Definition: smtypes.h:53
struct smTimerRequest_s smTimerRequest_t
data structure for timer request Timer requests are enqueued and dequeued using smList_t and have a c...
struct smIntContext_s smIntContext_t
struct smRootOsData_s smRootOsData_t
#define SMP_DIRECT_PAYLOAD_LIMIT
Definition: smtypes.h:50
data structure stores OS specific and LL specific context
Definition: sa.h:1658
data structure provides the identify data of the SATA device
Definition: sa_spec.h:530
data structure describes an STP or direct connect SATA command
Definition: sa.h:3129
bit32 satWWNSupport
Definition: smtypes.h:123
bit32 phyID
Definition: smtypes.h:100
smIORequest_t * satTmTaskTag
Definition: smtypes.h:150
bit32 sasAddressLo
Definition: smtypes.h:155
bit32 satDeviceFaultState
Definition: smtypes.h:137
bit8 satSignature[8]
Definition: smtypes.h:141
bit8 satMaxLBA[8]
Definition: smtypes.h:146
bit32 satNCQ
Definition: smtypes.h:110
smDeviceHandle_t * smDevHandle
Definition: smtypes.h:97
bit32 IDDeviceValid
Definition: smtypes.h:145
void * satSaDeviceData
Definition: smtypes.h:151
bit32 NumOfFCA
Definition: smtypes.h:148
bit32 satDeviceType
Definition: smtypes.h:142
bit32 satDMADIRSupport
Definition: smtypes.h:120
smList_t satFreeIntIoLinkList
Definition: smtypes.h:106
bit32 SMAbortAll
Definition: smtypes.h:96
agsaSATAIdentifyData_t satIdentifyData
Definition: smtypes.h:109
bit32 OSAbortAll
Definition: smtypes.h:153
smList_t MainLink
Definition: smtypes.h:90
smRoot_t * smRoot
Definition: smtypes.h:92
agsaContext_t agDeviceResetContext
Definition: smtypes.h:101
bit32 satSectorDone
Definition: smtypes.h:143
bit32 satVerifyState
Definition: smtypes.h:133
bit32 satSMARTSelfTest
Definition: smtypes.h:112
bit32 satAbortAfterReset
Definition: smtypes.h:131
agsaDevHandle_t * agDevHandle
Definition: smtypes.h:93
bit32 sasAddressHi
Definition: smtypes.h:156
bit32 volatile satPendingNONNCQIO
Definition: smtypes.h:128
bit32 satUltraDMAMode
Definition: smtypes.h:119
bit32 satLookAheadEnabled
Definition: smtypes.h:136
bit32 volatile satPendingNCQIO
Definition: smtypes.h:127
bit32 satAbortCalled
Definition: smtypes.h:132
bit32 valid
Definition: smtypes.h:94
bit32 directlyAttached
Definition: smtypes.h:98
bit32 SMNumOfFCA
Definition: smtypes.h:102
bit32 ID_Retries
Definition: smtypes.h:152
bit32 satFormatState
Definition: smtypes.h:139
bit32 satPMField
Definition: smtypes.h:140
agsaDevHandle_t * agExpDevHandle
Definition: smtypes.h:99
smSatInternalIo_t satIntIo[SAT_MAX_INT_IO]
Definition: smtypes.h:108
bit32 satDriveState
Definition: smtypes.h:130
bit32 satNCQQMgntCmd
Definition: smtypes.h:125
bit32 satSMARTEnabled
Definition: smtypes.h:114
bit32 satDMASupport
Definition: smtypes.h:117
bit32 satReadLookAheadSupport
Definition: smtypes.h:121
bit32 satBGPendingDiag
Definition: smtypes.h:147
smList_t FreeLink
Definition: smtypes.h:89
smList_t satActiveIntIoLinkList
Definition: smtypes.h:107
bit32 sat48BitSupport
Definition: smtypes.h:111
bit32 freeSATAFDMATagBitmap
Definition: smtypes.h:144
bit32 satVolatileWriteCacheSupport
Definition: smtypes.h:122
bit32 volatile satPendingIO
Definition: smtypes.h:126
bit32 ReadCapacity
Definition: smtypes.h:154
bit32 satWriteCacheEnabled
Definition: smtypes.h:135
bit32 satSMARTFeatureSet
Definition: smtypes.h:113
bit32 satRemovableMediaEnabled
Definition: smtypes.h:116
bit32 satMaxUserAddrSectors
Definition: smtypes.h:134
bit32 satStopState
Definition: smtypes.h:138
bit32 id
Definition: smtypes.h:91
bit32 satRemovableMedia
Definition: smtypes.h:115
bit32 NumOfIDRetries
Definition: smtypes.h:149
bit32 satNCQMaxIO
Definition: smtypes.h:129
bit32 satDMASetupAA
Definition: smtypes.h:124
smTimerRequest_t SATAIDDeviceTimer
Definition: smtypes.h:95
smList_t satIoLinkList
Definition: smtypes.h:105
bit32 satDMAEnabled
Definition: smtypes.h:118
smDeviceHandle_t * smDevHandle
Definition: smtypes.h:270
void * osMemHandle
Definition: smtypes.h:295
smSenseData_t smSenseData
Definition: smtypes.h:280
struct smIORequestBody_s::@5::@7 SATA
union smIORequestBody_s::@6 IOType
struct smIORequestBody_s::@6::@8 InitiatorRegIO
smIORequest_t * smIOToBeAbortedRequest
Definition: smtypes.h:273
bit32 ioCompleted
Definition: smtypes.h:285
agsaSATAInitiatorRequest_t agSATARequestBody
Definition: smtypes.h:278
smScsiRspSense_t sensePayload
Definition: smtypes.h:279
smSgl_t smSgl2
Definition: smtypes.h:291
smIORequest_t * TaskTag
Definition: smtypes.h:297
struct smIORequestBody_s::@6::@9 InitiatorTMIO
agsaIORequest_t agIORequest
Definition: smtypes.h:272
smList_t satIoBodyLink
Definition: smtypes.h:269
void * sglVirtualAddr
Definition: smtypes.h:292
smIORequest_t * CurrentTaskTag
Definition: smtypes.h:296
union smIORequestBody_s::@5 transport
bit32 expDataLength
Definition: smtypes.h:289
smIORequest_t * smIORequest
Definition: smtypes.h:271
smSgl_t smSgl1
Definition: smtypes.h:290
smSatIOContext_t satIOContext
Definition: smtypes.h:281
smList_t MainDeviceList
Definition: smtypes.h:342
smList_t FreeDeviceList
Definition: smtypes.h:341
smList_t mainIOList
Definition: smtypes.h:347
smDeviceData_t * DeviceMem
Definition: smtypes.h:340
struct smRootOsData_s smRootOsData
Definition: smtypes.h:328
smSwConfig_t SwConfig
Definition: smtypes.h:334
smIORequestBody_t * IOMem
Definition: smtypes.h:345
smList_t freeIOList
Definition: smtypes.h:346
smList_t timerlist
Definition: smtypes.h:337
bit32 usecsPerTick
Definition: smtypes.h:330
agsaRoot_t * agRoot
Definition: smtypes.h:331
smIntContext_t smAllShared
Definition: smtypes.h:354
Definition: sm.h:164
void * smAllShared
Definition: smtypes.h:322
smRoot_t * smRoot
Definition: smtypes.h:321
void * smIni
Definition: smtypes.h:323
agsaSASRequestBody_t agSASRequestBody
Definition: smtypes.h:308
smDeviceHandle_t * smDevHandle
Definition: smtypes.h:306
smDeviceData_t * smDeviceData
Definition: smtypes.h:310
smIORequest_t * CurrentTaskTag
Definition: smtypes.h:311
agsaIORequest_t agIORequest
Definition: smtypes.h:307
void * osMemHandle
Definition: smtypes.h:309
smSMPCompleted_t SMPCompletionFunc
Definition: smtypes.h:304
bit8 smpPayload[SMP_DIRECT_PAYLOAD_LIMIT]
Definition: smtypes.h:313
struct smSatIOContext_s * satOrgIOContext
Definition: smtypes.h:249
smSatInternalIo_t * satIntIoContext
Definition: smtypes.h:232
bit32 LoopNum2
Definition: smtypes.h:242
bit32 currentLBA
Definition: smtypes.h:238
bit32 LowerAddr
Definition: smtypes.h:251
void * smRequestBody
Definition: smtypes.h:227
struct smSatIOContext_s * satToBeAbortedIOContext
Definition: smtypes.h:248
smList_t satIoContextLink
Definition: smtypes.h:221
bit8 LBA_Upper_Nonzero
Definition: smtypes.h:263
bit32 ParmIndex
Definition: smtypes.h:244
bit8 superIOFlag
Definition: smtypes.h:235
bit8 sectorCnt07
Definition: smtypes.h:258
smScsiRspSense_t * pSense
Definition: smtypes.h:225
bit8 LBA[8]
Definition: smtypes.h:243
bit32 interruptContext
Definition: smtypes.h:230
bit8 Sector_Cnt_Upper_Nonzero
Definition: smtypes.h:262
smDeviceHandle_t * psmDeviceHandle
Definition: smtypes.h:233
bit32 AdjustBytes
Definition: smtypes.h:253
smIniScsiCmnd_t * pScsiCmnd
Definition: smtypes.h:224
bit32 UpperAddr
Definition: smtypes.h:250
void * smScsiXchg
Definition: smtypes.h:228
smSatCompleteCbPtr_t satCompleteCB
Definition: smtypes.h:231
smSenseData_t * pSmSenseData
Definition: smtypes.h:226
agsaFisRegHostToDevice_t * pFis
Definition: smtypes.h:223
smDeviceData_t * pSatDevData
Definition: smtypes.h:222
bit32 SplitIdx
Definition: smtypes.h:252
bit32 NotifyOS
Definition: smtypes.h:246
smIORequest_t satIntSmIORequest
Definition: smtypes.h:76
bit32 satIntFlag
Definition: smtypes.h:81
void * satIntRequestBody
Definition: smtypes.h:77
smScsiInitiatorRequest_t satIntSmScsiXchg
Definition: smtypes.h:78
smMem_t satIntDmaMem
Definition: smtypes.h:79
smIORequest_t * satOrgSmIORequest
Definition: smtypes.h:82
smMem_t satIntReqBodyMem
Definition: smtypes.h:80
smList_t satIntIoLink
Definition: smtypes.h:75
bit8 addSenseCode
Definition: smtypes.h:186
bit8 snsRespCode
Definition: smtypes.h:180
bit8 addSenseLen
Definition: smtypes.h:184
Definition: sm.h:184
data structure for timer request Timer requests are enqueued and dequeued using smList_t and have a c...
Definition: smtypes.h:60
void * timerData1
Definition: smtypes.h:63
smTimerCBFunc_t timerCBFunc
Definition: smtypes.h:66
bit32 timerRunning
Definition: smtypes.h:68
void * timerData2
Definition: smtypes.h:64
smList_t timerLink
Definition: smtypes.h:67
void * timerData3
Definition: smtypes.h:65
bit32 timeout
Definition: smtypes.h:62
union data structure specifies a request
Definition: sa.h:3104