FreeBSD kernel pms device code
dmtypes.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 __DMTYPES_H__
25#define __DMTYPES_H__
26
30
34
38
40#ifdef TBD
42#endif
43
44
45/* for SMP only */
46typedef void (*dmSMPCompleted_t) (
47 agsaRoot_t *,
49 bit32 ,
50 bit32 ,
52 );
53
54
55/* timer functions ; both I and T */
56typedef void (*dmTimerCBFunc_t)(dmRoot_t *dmRoot, void *timerData1, void *timerData2, void *timerData3);
57
58
63typedef struct dmTimerRequest_s {
64 /* the number of ticks */
73
74typedef struct dmRootOsData_s {
77 void *dmIni;
79
80typedef struct DMSASAddressID_s
81{
86
87struct dmExpander_s;
88
89typedef struct dmDiscovery_s
90{
93 // tdList_t freeExpanderList;
97 struct dmExpander_s *RootExp; /* Root expander of discovery */
99 bit32 type; /* discovery type: TDSA_DISCOVERY_OPTION_FULL_START
100 or TDSA_DISCOVERY_OPTION_INCREMENTAL_START*/
107 dmTimerRequest_t BCTimer; /* Broadcast Change timer for ResetTriggerred */
110 bit32 pendingSMP; /* the number of pending SMP for this discovery */
111 bit32 SeenBC; /* received Broadcast change */
112 bit32 forcedOK; /* report DiscOK when chance is missed */
113 dmTimerRequest_t SMPBusyTimer; /* SMP retry timer for saSMPStart busy */
114 bit32 SMPRetries; /* number of SMP retries when LL returns busy for saSMPStart*/
115 bit32 ResetTriggerred; /* Hard/Link reset triggerred by discovery */
116 dmTimerRequest_t DiscoverySMPTimer; /* discovery-related SMP application Timer */
117 /* For SAS 2 */
118 bit32 DeferredError; /* Deferred Error for SAS 2 */
119 bit32 ConfiguresOthers; /* exp configures others; no routing configuration */
121
122typedef struct dmSASSubID_s
123{
128
130
131struct dmDeviceData_s;
132
133typedef struct dmIntPortContext_s
134{
139 /* passed by tiINIDiscoverTargets()
140 eg) discovery or rediscovery ....
141 */
143 /* Discovery ready is given? */
145 /* Port has received link up */
147 /* statistics */
149 /* flag: indicates that discovery is trigggered by tiINIDiscoverTargets */
151
152 bit32 id; /* for debugging only */
160
164#ifdef TBD
166 bit8 PhyIDList[DM_MAX_NUM_PHYS];
167#endif
170
171#ifdef TBD
172 /* used in tiINIDiscoverTarget() */
173 agsaRoot_t *agRoot;
174 agsaPortContext_t *agPortContext;
175 /* maybe needs timers for saPhyStart() */
176
177 bit8 nativeSATAMode; /* boolean flag: whether the port is in Native SATA mode */
178 bit8 remoteSignature[8]; /* the remote signature of the port is the port is in native SATA mode */
179#endif
180 bit8 directAttatchedSAS; /* boolean flag: whether the port connected directly to SAS end device*/
181 /* SAS/SATA discovery information such as discoveringExpanderList */
185 bit32 RegisteredDevNums; /* registered number of devices */
186 bit32 eventPhyID; /* used for saHwEventAck() */
187 bit32 Transient; /* transient period between link up and link down/port recovery */
188 bit32 RegFailed; /* Registration of expander belonging to this port failure */
189
191
192typedef struct dmDeviceData_s {
193
194 dmList_t FreeLink; /* free dev list */
195 dmList_t MainLink; /* main(in use) dev list */
196 dmList_t IncDisLink; /* Used for incremental Discovery only */
197 bit32 id; /* for debugging only */
199 /* used in tiINIIOStart() */
201// agsaDevHandle_t *agDevHandle;
202
203 /* for SAS; remote device */
204 // agsaSASDeviceInfo_t agSASDeviceInfo;
205 /* device's sas address */
210
211 /* SATA specific data */
212 bit8 satSignature[8]; /* SATA device Signature*/
213
216 /* validity of device */
219 bit8 processed; /* used in TD discovery */
220#ifdef AGTIAPI_CTL
221 bit8 discovered;
222#endif
225 agsaContext_t agContext; /* used in saRegisterNewDevice()*/
228 struct dmDeviceData_s *ExpDevice; /* Expander device which this device is attached to */
229
230 bit8 phyID; /* PhyID this device is attached to SPC or expander */
231 agsaSASIdentify_t sasIdentify; /* used only in TD discovery */
233// bit8 registered;
235 bit8 SASSpecDeviceType; /* 0 - 3; SAS_NO_DEVICE - SAS_FANOUT_EXPANDER_DEVICE */
238 agsaContext_t agDeviceResetContext; /* used in saLocalPhyControl() */
239 bit32 TRflag; /* transport recovery flag; used only for tiINITransportRecovery */
240 bit32 ResetCnt; /* number of reset to the device */
241 bit32 registered; /* registered to LL */
242 bit32 reported; /* reproted to TDM */
243 bit32 MCN; /* MCN; initialized to 0; current value in discovery */
244 bit32 MCNDone; /* done in updating MCN */
245 bit32 PrevMCN; /* MCN; initialized to 0; previous value in discovery */
246
248
249
250typedef struct dmExpander_s
251{
252 /* start of dmDeviceData */
253#ifdef TBD
254 dmList_t FreeLink; /* free dev list */
255 dmList_t MainLink; /* main(in use) dev list */
256#endif
257 bit32 id; /* for debugging only */
258 bit32 InQID; /* Inbound queue ID */
259 bit32 OutQID; /* Outbound queue ID */
261 /* used in tiINIIOStart() */
264
271 bit16 routingIndex; /* maximum routing table index reported by expander */
272 bit16 currentIndex[DM_MAX_EXPANDER_PHYS]; /* routing table index in use */
273 /*ReportPhySataSend in DM */
274 dmDeviceData_t *dmDeviceToProcess; /* on some callbacks, this is a link to the device of interest */
275
288#ifdef TBD
289 bit32 id; /* for debugging */
290#endif
295 bit32 discoverSMPAllowed; /* used only for configurable routers */
300 /* for SAS 2 */
301 bit32 SAS2; /* supports SAS2 spec of not. The value of LONG RESPONSE
302 in report general response */
303 bit32 TTTSupported; /* Table to Table is supported */
304 bit32 UndoDueToTTTSupported; /* flag that indicates undo exp, device, route
305 configuration due to TTT */
306
308
312
314
315/*
316 should DM allocate a pool of SMP and manages it
317 or
318 depend on ostiAllocMemory()
319*/
320typedef struct dmSMPRequestBody_s {
322 dmSMPCompleted_t SMPCompletionFunc;/* must be the second */
323
324#ifdef TBD
325 tiDeviceHandle_t *tiDevHandle; /* not used for TD generated SMP */
326#endif
331 //agsaSMPFrame_t SMPRsp;
333
334#ifdef TBD
335 void *osMemHandle;
336 // can this be simply dmExpander_t
338 tiIORequest_t *CurrentTaskTag; /* SMP is used for simulate target reset */
339#endif
341// dmExpander_t *dmExpander;
342 dmIntPortContext_t *dmPortContext; /* portcontext where SMP is sent from */
344 only for direct SMP */
345 bit32 retries; /* number of retries */
346 /* for indirect SMP req/rsp */
350 /* used only when SMP is INDIRECT SMP request. On SMP completion,
351 this is used to free up INDIRECT SMP response
352 */
353 void *IndirectSMPResponse; /* dmSMPRequestBody_t */
354
355
356
357#ifdef TBD
358 void *IndirectSMPReqosMemHandle;
359 void *IndirectSMPReq;
360 bit32 IndirectSMPReqLen;
361 bit32 IndirectSMPReqUpper32;
362 bit32 IndirectSMPReqLower32;
363 void *IndirectSMPResposMemHandle;
364 void *IndirectSMPResp;
365 bit32 IndirectSMPRespLen;
366 bit32 IndirectSMPRespUpper32;
367 bit32 IndirectSMPRespLower32;
368#endif
372
373
374typedef struct dmIntContext_s {
377
379#ifdef TBD
380 dmRoot_t dmRootInt; /* for interrupt */
381 dmRoot_t dmRootNonInt; /* for non-interrupt */
382#endif
383
385
388
393
396
401
406
410
418
420
421typedef struct dmIntRoot_s
422{
426
427#endif /* __DMTYPES_H__ */
428
#define DM_MAX_DEV
Definition: dmdefs.h:45
#define DM_MAX_EXPANDER_PHYS
Definition: dmdefs.h:44
#define DM_MAX_NUM_PHYS
Definition: dmdefs.h:43
#define SMP_DIRECT_PAYLOAD_LIMIT
Definition: dmdefs.h:75
struct dmIntPortContext_s dmIntPortContext_t
struct dmDeviceData_s dmDeviceData_t
struct dmSMPRequestBody_s dmSMPRequestBody_t
void(* dmSMPCompleted_t)(agsaRoot_t *, agsaIORequest_t *, bit32, bit32, agsaFrameHandle_t)
Definition: dmtypes.h:46
struct dmSASSubID_s dmSASSubID_t
struct dmRootOsData_s dmRootOsData_t
struct dmIntContext_s dmIntContext_t
struct dmExpander_s dmExpander_t
struct dmIndirectSMPRequestBody_s dmIndirectSMPRequestBody_t
struct dmDiscovery_s dmDiscovery_t
struct dmTimerRequest_s dmTimerRequest_t
data structure for timer request Timer requests are enqueued and dequeued using dmList_t and have a c...
struct DMSASAddressID_s DMSASAddressID_t
struct dmIntRoot_s dmIntRoot_t
void(* dmTimerCBFunc_t)(dmRoot_t *dmRoot, void *timerData1, void *timerData2, void *timerData3)
Definition: dmtypes.h:56
unsigned short bit16
Definition: ostypes.h:98
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.
bit32 sasAddressLo
Definition: dmtypes.h:82
bit8 phyIdentifier
Definition: dmtypes.h:84
bit32 sasAddressHi
Definition: dmtypes.h:83
data structure stores OS specific and LL specific context
Definition: sa.h:1658
data structure provides some information about a SATA device
Definition: sa.h:2561
describe SAS IDENTIFY address frame
Definition: sa_spec.h:448
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
Definition: dm.h:91
bit32 IOStart
Definition: dmtypes.h:236
bit32 ResetCnt
Definition: dmtypes.h:240
agsaContext_t agContext
Definition: dmtypes.h:225
bit32 MCNDone
Definition: dmtypes.h:244
dmList_t MainLink
Definition: dmtypes.h:195
bit8 processed
Definition: dmtypes.h:219
bit8 target_ssp_stp_smp
Definition: dmtypes.h:208
bit8 satSignature[8]
Definition: dmtypes.h:212
bit32 PrevMCN
Definition: dmtypes.h:245
agsaContext_t agDeviceResetContext
Definition: dmtypes.h:238
bit32 TRflag
Definition: dmtypes.h:239
agsaSASIdentify_t sasIdentify
Definition: dmtypes.h:231
bit8 SASSpecDeviceType
Definition: dmtypes.h:235
dmDeviceInfo_t dmDeviceInfo
Definition: dmtypes.h:224
bit8 DeviceType
Definition: dmtypes.h:198
struct dmExpander_s * dmExpander
Definition: dmtypes.h:227
bit32 registered
Definition: dmtypes.h:241
dmList_t FreeLink
Definition: dmtypes.h:194
bit8 numOfPhys
Definition: dmtypes.h:209
bit8 connectionRate
Definition: dmtypes.h:232
struct dmDeviceData_s * ExpDevice
Definition: dmtypes.h:228
agsaDeviceInfo_t agDeviceInfo
Definition: dmtypes.h:223
bit32 reported
Definition: dmtypes.h:242
dmRoot_t * dmRoot
Definition: dmtypes.h:200
dmList_t IncDisLink
Definition: dmtypes.h:196
bit8 initiator_ssp_stp_smp
Definition: dmtypes.h:207
DMSASAddressID_t SASAddressID
Definition: dmtypes.h:206
bit8 directlyAttached
Definition: dmtypes.h:234
struct dmIntPortContext_s * dmPortContext
Definition: dmtypes.h:215
bit32 IOResponse
Definition: dmtypes.h:237
bit32 SMPRetries
Definition: dmtypes.h:114
bit32 ResetTriggerred
Definition: dmtypes.h:115
bit32 SeenBC
Definition: dmtypes.h:111
dmTimerRequest_t discoveryTimer
Definition: dmtypes.h:104
dmList_t UpdiscoveringExpanderList
Definition: dmtypes.h:92
bit32 ConfiguresOthers
Definition: dmtypes.h:119
bit32 configureRouteRetries
Definition: dmtypes.h:102
agsaSATAIdentifyData_t * pSataIdentifyData
Definition: dmtypes.h:96
dmTimerRequest_t DiscoverySMPTimer
Definition: dmtypes.h:116
dmTimerRequest_t configureRouteTimer
Definition: dmtypes.h:105
dmList_t discoveringExpanderList
Definition: dmtypes.h:91
struct dmExpander_s * RootExp
Definition: dmtypes.h:97
bit32 DeferredError
Definition: dmtypes.h:118
dmTimerRequest_t deviceRegistrationTimer
Definition: dmtypes.h:106
DMSASAddressID_t sasAddressIDDiscoverError
Definition: dmtypes.h:95
smpRespDiscover_t SMPDiscoverResp
Definition: dmtypes.h:108
dmTimerRequest_t BCTimer
Definition: dmtypes.h:107
bit32 NumOfUpExp
Definition: dmtypes.h:98
bit32 forcedOK
Definition: dmtypes.h:112
bit32 deviceRetistrationRetries
Definition: dmtypes.h:103
bit32 status
Definition: dmtypes.h:94
smpRespDiscover2_t SMPDiscover2Resp
Definition: dmtypes.h:109
bit32 pendingSMP
Definition: dmtypes.h:110
bit32 retries
Definition: dmtypes.h:101
dmTimerRequest_t SMPBusyTimer
Definition: dmtypes.h:113
bit32 type
Definition: dmtypes.h:99
bit32 underDiscovering
Definition: dmtypes.h:284
bit16 routingIndex
Definition: dmtypes.h:271
bit32 configSASAddressLoTable[DM_MAX_DEV]
Definition: dmtypes.h:298
dmDeviceData_t * dmDeviceToProcess
Definition: dmtypes.h:274
dmRoot_t * dmRoot
Definition: dmtypes.h:262
bit32 configuring
Definition: dmtypes.h:286
bit32 SAS2
Definition: dmtypes.h:301
struct dmExpander_s * dmUpStreamExpander
Definition: dmtypes.h:268
bit32 TTTSupported
Definition: dmtypes.h:303
struct dmExpander_s * dmCurrentDownStreamExpander
Definition: dmtypes.h:278
bit32 OutQID
Definition: dmtypes.h:259
bit32 discoverSMPAllowed
Definition: dmtypes.h:295
bit16 numOfDownStreamPhys
Definition: dmtypes.h:293
bit32 configSASAddressHi
Definition: dmtypes.h:276
bit8 DeviceType
Definition: dmtypes.h:260
bit32 configRouteTable
Definition: dmtypes.h:285
bit32 configSASAddressHiTable[DM_MAX_DEV]
Definition: dmtypes.h:297
bit8 routingAttribute[DM_MAX_EXPANDER_PHYS]
Definition: dmtypes.h:296
bit32 InQID
Definition: dmtypes.h:258
bit32 UndoDueToTTTSupported
Definition: dmtypes.h:304
dmDeviceData_t * dmDevice
Definition: dmtypes.h:267
agsaDevHandle_t * agDevHandle
Definition: dmtypes.h:263
bit32 upStreamSASAddressLo
Definition: dmtypes.h:283
bit8 downStreamPhys[DM_MAX_EXPANDER_PHYS]
Definition: dmtypes.h:292
bit8 currentDownStreamPhyIndex
Definition: dmtypes.h:294
bit8 discoveringPhyId
Definition: dmtypes.h:270
bit8 hasUpStreamDevice
Definition: dmtypes.h:269
bit32 id
Definition: dmtypes.h:257
bit32 configSASAddressLo
Definition: dmtypes.h:277
bit32 configSASAddrTableIndex
Definition: dmtypes.h:299
bit16 currentUpStreamPhyIndex
Definition: dmtypes.h:281
dmList_t linkNode
Definition: dmtypes.h:265
bit16 currentIndex[DM_MAX_EXPANDER_PHYS]
Definition: dmtypes.h:272
bit16 numOfUpStreamPhys
Definition: dmtypes.h:280
dmList_t upNode
Definition: dmtypes.h:266
bit32 configReserved
Definition: dmtypes.h:287
bit32 upStreamSASAddressHi
Definition: dmtypes.h:282
struct dmExpander_s * dmReturnginExpander
Definition: dmtypes.h:291
bit8 upStreamPhys[DM_MAX_EXPANDER_PHYS]
Definition: dmtypes.h:279
bit32 IndirectSMPLower32
Definition: dmtypes.h:414
struct dmRootOsData_s dmRootOsData
Definition: dmtypes.h:376
dmList_t freeSMPList
Definition: dmtypes.h:409
dmExpander_t * ExpanderMem
Definition: dmtypes.h:403
dmList_t MainDeviceList
Definition: dmtypes.h:400
bit32 usecsPerTick
Definition: dmtypes.h:378
dmList_t timerlist
Definition: dmtypes.h:390
dmList_t freeExpanderList
Definition: dmtypes.h:404
bit32 MaxRetryDiscovery
Definition: dmtypes.h:416
dmList_t FreePortContextList
Definition: dmtypes.h:394
dmList_t MainPortContextList
Definition: dmtypes.h:395
bit32 itNexusTimeout
Definition: dmtypes.h:415
dmDeviceData_t * DeviceMem
Definition: dmtypes.h:398
bit32 RateAdjust
Definition: dmtypes.h:417
dmList_t mainExpanderList
Definition: dmtypes.h:405
bit8 * IndirectSMPMem
Definition: dmtypes.h:412
bit32 IndirectSMPUpper32
Definition: dmtypes.h:413
dmSwConfig_t SwConfig
Definition: dmtypes.h:387
dmList_t FreeDeviceList
Definition: dmtypes.h:399
agsaRoot_t * agRoot
Definition: dmtypes.h:384
dmSMPRequestBody_t * SMPMem
Definition: dmtypes.h:408
dmIntPortContext_t * PortContextMem
Definition: dmtypes.h:392
dmList_t FreeLink
Definition: dmtypes.h:153
bit32 RegisteredDevNums
Definition: dmtypes.h:185
bit8 directAttatchedSAS
Definition: dmtypes.h:180
dmList_t MainLink
Definition: dmtypes.h:154
agsaSASIdentify_t sasIDframe
Definition: dmtypes.h:159
bit32 sasRemoteAddressHi
Definition: dmtypes.h:156
bit32 DiscoveryAbortInProgress
Definition: dmtypes.h:138
bit32 sasRemoteAddressLo
Definition: dmtypes.h:157
bit32 numAvailableTargets
Definition: dmtypes.h:148
bit32 DiscoveryState
Definition: dmtypes.h:137
dmPortContext_t * dmPortContext
Definition: dmtypes.h:168
bit32 discoveryOptions
Definition: dmtypes.h:142
dmDiscovery_t discovery
Definition: dmtypes.h:182
bit32 DiscoveryRdyGiven
Definition: dmtypes.h:144
dmRoot_t * dmRoot
Definition: dmtypes.h:169
bit32 sasLocalAddressLo
Definition: dmtypes.h:163
bit32 sasLocalAddressHi
Definition: dmtypes.h:162
bit32 osInitiatedDiscovery
Definition: dmtypes.h:150
dmIntContext_t dmAllShared
Definition: dmtypes.h:424
void * dmAllShared
Definition: dmtypes.h:76
void * dmIni
Definition: dmtypes.h:77
dmRoot_t * dmRoot
Definition: dmtypes.h:75
bit32 sasAddressHi
Definition: dmtypes.h:124
bit8 initiator_ssp_stp_smp
Definition: dmtypes.h:126
bit8 target_ssp_stp_smp
Definition: dmtypes.h:127
bit32 sasAddressLo
Definition: dmtypes.h:125
bit32 IndirectSMPUpper32
Definition: dmtypes.h:348
dmDeviceData_t * dmDevice
Definition: dmtypes.h:332
dmSMPCompleted_t SMPCompletionFunc
Definition: dmtypes.h:322
void * IndirectSMP
Definition: dmtypes.h:347
void * IndirectSMPResponse
Definition: dmtypes.h:353
dmIntPortContext_t * dmPortContext
Definition: dmtypes.h:342
dmList_t Link
Definition: dmtypes.h:321
agsaContext_t agContext
Definition: dmtypes.h:370
agsaSASRequestBody_t agSASRequestBody
Definition: dmtypes.h:328
bit32 IndirectSMPLower32
Definition: dmtypes.h:349
agsaSATAInitiatorRequest_t agSATARequestBody
Definition: dmtypes.h:329
dmRoot_t * dmRoot
Definition: dmtypes.h:340
agsaIORequest_t agIORequest
Definition: dmtypes.h:327
bit8 smpPayload[SMP_DIRECT_PAYLOAD_LIMIT]
Definition: dmtypes.h:343
data structure for timer request Timer requests are enqueued and dequeued using dmList_t and have a c...
Definition: dmtypes.h:63
dmTimerCBFunc_t timerCBFunc
Definition: dmtypes.h:69
void * timerData2
Definition: dmtypes.h:67
void * timerData1
Definition: dmtypes.h:66
dmList_t timerLink
Definition: dmtypes.h:70
void * timerData3
Definition: dmtypes.h:68
bit32 timeout
Definition: dmtypes.h:65
bit32 timerRunning
Definition: dmtypes.h:71
union data structure specifies a request
Definition: sa.h:3104