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 * 22 ********************************************************************************/ 23 /*******************************************************************************/ 24 /** \file 25 * 26 * The file defines data structures for SAS/SATA TD layer 27 * 28 */ 29 #ifndef __TDTYPES_H__ 30 #define __TDTYPES_H__ 31 32 #include <dev/pms/freebsd/driver/common/osenv.h> 33 #include <dev/pms/freebsd/driver/common/ostypes.h> 34 #include <dev/pms/freebsd/driver/common/osdebug.h> 35 36 #include <dev/pms/RefTisa/sallsdk/api/sa.h> 37 #include <dev/pms/RefTisa/sallsdk/api/saapi.h> 38 #include <dev/pms/RefTisa/sallsdk/api/saosapi.h> 39 40 #ifdef FDS_SM 41 #include <dev/pms/RefTisa/sat/api/sm.h> 42 #include <dev/pms/RefTisa/sat/src/smtypes.h> 43 #endif 44 45 #ifdef FDS_DM 46 #include <dev/pms/RefTisa/discovery/api/dm.h> 47 #endif 48 49 #include <dev/pms/RefTisa/tisa/sassata/common/tddefs.h> 50 #include <dev/pms/RefTisa/tisa/sassata/common/tdlist.h> 51 #include <dev/pms/RefTisa/tisa/api/tiscsi.h> 52 53 54 /* function definitions */ 55 typedef void (*tdssSSPReqReceived_t) ( 56 agsaRoot_t *, 57 agsaDevHandle_t *, 58 agsaFrameHandle_t, 59 bit32, 60 bit32, 61 bit32 62 ); 63 typedef void (*tdssSMPReqReceived_t) ( 64 agsaRoot_t *, 65 agsaDevHandle_t *, 66 agsaSMPFrameHeader_t *, 67 agsaFrameHandle_t, 68 bit32, 69 bit32 70 ); 71 72 typedef bit32 (*tdssGetSGLChunk_t) (agsaRoot_t *agRoot, 73 agsaIORequest_t *agIORequest, 74 bit32 agChunkOffset, 75 bit32 *agChunkUpper32, 76 bit32 *agChunkLower32, 77 bit32 *agChunkLen); 78 /* for SSP only */ 79 typedef void (*tdssIOCompleted_t) (agsaRoot_t *, 80 agsaIORequest_t *, 81 bit32, 82 bit32, 83 agsaFrameHandle_t, 84 bit32); 85 /* for SMP only */ 86 typedef void (*tdssSMPCompleted_t) ( 87 agsaRoot_t *, 88 agsaIORequest_t *, 89 bit32 , 90 bit32 , 91 agsaFrameHandle_t 92 ); 93 94 95 /** \brief data structure for callback function jumptableESLG page 96 * 97 * This data structure defines callback fucntions for SSP, SMP and SATA 98 * This is used for jump table used for instance specific function callback jump 99 * 100 */ 101 typedef struct tdsaJumpTable_s { 102 /**< function that called to process received SSP frame */ 103 tdssSSPReqReceived_t pSSPReqReceived; 104 /**< function that called to process received SSP frame */ 105 tdssSMPReqReceived_t pSMPReqReceived; 106 /**< SSP IO completion callback function eg) ossaSSPcompleted() */ 107 tdssIOCompleted_t pSSPIOCompleted; 108 /**< SMP IO completion callback function eg) ossaSMPcompleted() */ 109 tdssSMPCompleted_t pSMPCompleted; 110 /* callback function for LL getSGL. Simple place holder for now */ 111 tdssGetSGLChunk_t pGetSGLChunk; 112 } tdsaJumpTable_t; 113 114 /* timer functions ; both I and T */ 115 typedef void (*tdsaTimerCBFunc_t)(tiRoot_t *tiRoot, void *timerData1, void *timerData2, void *timerData3); 116 117 /** \brief data structure for timer request 118 * Timer requests are enqueued and dequeued using tdList_t 119 * and have a callback function 120 */ 121 typedef struct tdsaTimerRequest_s { 122 /* the number of ticks */ 123 bit32 timeout; 124 void *timerData1; 125 void *timerData2; 126 void *timerData3; 127 tdsaTimerCBFunc_t timerCBFunc; 128 tdList_t timerLink; 129 bit32 timerRunning; 130 } tdsaTimerRequest_t; 131 132 133 /** \brief data structure for IO request data 134 * used at target only in ttdtxchg_t structure 135 * just a place holder for now 136 */ 137 typedef struct tdssIORequestData_s { 138 /* jump table has to be the first */ 139 tdsaJumpTable_t *pJumpTable; /* this is just a pointer */ 140 } tdssIORequestData_t; 141 142 143 144 /** \brief data structure OS root from the view of lower layer. 145 * TD Layer interrupt/non-interrupt context support structure for agsaRoot_t. 146 * The osData part of agsaRoot points to this tdsaRootOsData_t structure. 147 * In other words, agsaRoot_t->osData points to this structure and used for 148 * both SAS and SATA 149 */ 150 typedef struct tdsaRootOsData_s { 151 tiRoot_t *tiRoot; /**< Pointer back to tiRoot */ 152 void *tdsaAllShared; /**< Pointer to tdsaContext_t */ 153 void *itdsaIni; /**< Pointer to SAS/SATA initiator */ 154 void *ttdsaTgt; /**< Pointer to SAS/SATA target */ 155 /* for sata */ 156 void *tdstHost; /**< Pointer to SATA Host */ 157 void *tdstDevice; /**< Pointer to SATA Device */ 158 agBOOLEAN IntContext; /**< Interrupt context */ 159 } tdsaRootOsData_t; 160 161 /** \brief data structure for port/phy related flags 162 * Some fields are just place holders and not used yet 163 */ 164 typedef struct tdssPortFlags_s { 165 /**< port started flag */ 166 agBOOLEAN portStarted; 167 168 /**< port initialized flag */ 169 agBOOLEAN portInitialized; 170 171 agBOOLEAN portReadyForDiscoverySent; 172 173 /**< port stopped by oslayer */ 174 agBOOLEAN portStoppedByOSLayer; 175 176 /**< fail portinit/start */ 177 agBOOLEAN failPortInit; 178 179 agBOOLEAN pseudoPortInitDone; 180 agBOOLEAN pseudoPortStartDone; 181 } tdssPortFlags_t; 182 183 /** \brief data structure for both SAS/SATA related flags 184 * Some fields are just place holders and not used yet 185 * 186 */ 187 typedef struct tdsaComMemFlags_s { 188 /**< current interrupt setting */ 189 agBOOLEAN sysIntsActive; 190 191 /**< reset in progress */ 192 agBOOLEAN resetInProgress; 193 194 /**< reset status */ 195 agBOOLEAN resetFailed; 196 197 } tdsaComMemFlags_t; 198 199 200 /* 201 * SAT related structure 202 */ 203 typedef struct satInternalIo_s 204 { 205 tdList_t satIntIoLink; 206 tiIORequest_t satIntTiIORequest; 207 void *satIntRequestBody; 208 tiScsiInitiatorRequest_t satIntTiScsiXchg; 209 tiMem_t satIntDmaMem; 210 tiMem_t satIntReqBodyMem; 211 bit32 satIntFlag; 212 tiIORequest_t *satOrgTiIORequest; 213 bit32 id; 214 } satInternalIo_t; 215 216 217 218 /* 219 * SAT specific structure per SATA drive 220 */ 221 #define SAT_NONNCQ_MAX 1 222 #define SAT_NCQ_MAX 32 223 #define SAT_MAX_INT_IO 16 224 225 typedef struct TDSASAddressID_s 226 { 227 bit32 sasAddressLo; /**< HOST SAS address lower part */ 228 bit32 sasAddressHi; /**< HOST SAS address higher part */ 229 bit8 phyIdentifier; /**< PHY IDENTIFIER of the PHY */ 230 } TDSASAddressID_t; 231 232 233 struct tdsaExpander_s; 234 235 236 typedef struct tdsaDiscovery_s 237 { 238 tdList_t discoveringExpanderList; 239 tdList_t UpdiscoveringExpanderList; 240 // tdList_t freeExpanderList; 241 bit32 status; 242 TDSASAddressID_t sasAddressIDDiscoverError; 243 agsaSATAIdentifyData_t *pSataIdentifyData; 244 struct tdsaExpander_s *RootExp; /* Root expander of discovery */ 245 bit32 NumOfUpExp; 246 bit32 type; /* discovery type: TDSA_DISCOVERY_OPTION_FULL_START 247 or TDSA_DISCOVERY_OPTION_INCREMENTAL_START*/ 248 bit32 retries; 249 bit32 configureRouteRetries; 250 bit32 deviceRetistrationRetries; 251 tdsaTimerRequest_t discoveryTimer; 252 tdsaTimerRequest_t configureRouteTimer; 253 tdsaTimerRequest_t deviceRegistrationTimer; 254 tdsaTimerRequest_t BCTimer; /* Broadcast Change timer for ResetTriggerred */ 255 smpRespDiscover_t SMPDiscoverResp; 256 bit32 pendingSMP; /* the number of pending SMP for this discovery */ 257 bit32 SeenBC; /* received Broadcast change */ 258 bit32 forcedOK; /* report DiscOK when chance is missed */ 259 tdsaTimerRequest_t SMPBusyTimer; /* SMP retry timer for saSMPStart busy */ 260 bit32 SMPRetries; /* number of SMP retries when LL returns busy for saSMPStart*/ 261 bit32 ResetTriggerred; /* Hard/Link reset triggerred by discovery */ 262 tdsaTimerRequest_t DiscoverySMPTimer; /* discovery-related SMP application Timer */ 263 } tdsaDiscovery_t; 264 265 266 typedef struct 267 { 268 tdList_t satIoLinkList; /* Normal I/O from TISA */ 269 tdList_t satFreeIntIoLinkList; /* SAT internal I/O free list */ 270 tdList_t satActiveIntIoLinkList; /* SAT internal I/O active list */ 271 satInternalIo_t satIntIo[SAT_MAX_INT_IO]; /* Internal I/O resource */ 272 agsaSATAIdentifyData_t satIdentifyData; /* Copy of SATA Id Dev data */ 273 bit8 SN_id_limit[25]; /* temporary serial number id info */ 274 bit32 satNCQ; /* Flag for NCQ support */ 275 bit32 sat48BitSupport; /* Flag for 48-bit addressing */ 276 bit32 satSMARTSelfTest; /* Flag for SMART self test */ 277 bit32 satSMARTFeatureSet; /* Flag for SMART feature set */ 278 bit32 satSMARTEnabled; /* Flag for SMART enabled */ 279 bit32 satRemovableMedia; /* Flag for Removable Media */ 280 bit32 satRemovableMediaEnabled; /* Flag for Removable Media Enabled */ 281 bit32 satDMASupport; /* Flag for DMA Support */ 282 bit32 satDMAEnabled; /* Flag for DMA Enabled */ 283 bit32 satDMADIRSupport; /* Flag in PACKET command for DMA transfer */ 284 bit32 satWWNSupport; /* Flag for DMA Enabled */ 285 bit32 satPendingIO; /* Number of pending I/O */ 286 bit32 satPendingNCQIO; /* Number of pending NCQ I/O */ 287 bit32 satPendingNONNCQIO; /* Number of pending NON NCW I/O*/ 288 bit32 satNCQMaxIO; /* Max NCQ I/O in SAT or drive */ 289 bit32 satDriveState; /* State of SAT/drive */ 290 bit32 satAbortAfterReset; /* Flag: abort after SATA reset */ 291 bit32 satAbortCalled; /* Flag: abort called indication*/ 292 bit32 satVerifyState; /* Flag: Read Vrf state for diag*/ 293 bit32 satMaxUserAddrSectors; /* max user addressable setctors*/ 294 bit32 satWriteCacheEnabled; /* Flag for write cache enabled */ 295 bit32 satLookAheadEnabled; /* Flag for look ahead enabled */ 296 bit32 satDeviceFaultState; /* State of DF */ 297 bit32 satStopState; /* State of Start and Stop */ 298 bit32 satFormatState; /* State of format */ 299 bit32 satPMField; /* PM field, first 4 bits */ 300 bit8 satSignature[8]; /* Signature */ 301 bit32 satDeviceType; /* ATA device type */ 302 bit32 satSectorDone; /* Number of Sector done by Cmnd*/ 303 bit32 freeSATAFDMATagBitmap; /* SATA NCQ tag bit map */ 304 bit32 IDDeviceValid; /* ID DeviceData valid bit */ 305 bit8 satMaxLBA[8]; /* MAXLBA is from read capacity */ 306 bit32 satBGPendingDiag; /* Pending Diagnostic in backgound */ 307 bit32 NumOfFCA; /* number of SMP HARD RESET on this device */ 308 bit32 NumOfIDRetries; /* number of SMP HARD RESET after ID retries */ 309 tiIORequest_t *satTmTaskTag; /* TM Task Tag */ 310 void *satSaDeviceData; /* Pointer back to sa dev data */ 311 bit32 ID_Retries; /* identify device data retries */ 312 bit32 IDPending; /* number of pending identify device data */ 313 } satDeviceData_t; 314 315 316 /** \brief data structure for SAS device list 317 * This structure maintains the device as a list and information about 318 * the device such as the device type and ID address frame. 319 * agsaDeviceHandle_t->osData points to this structure. 320 */ 321 typedef struct tdsaDeviceData_s { 322 /* in tdtypes.h */ 323 tdsaJumpTable_t *pJumpTable; /**< a pointer to callback function jumptable */ 324 tiDeviceHandle_t tiDeviceHandle; 325 326 tdList_t FreeLink; /* free dev list */ 327 tdList_t MainLink; /* main(in use) dev list */ 328 tdList_t IncDisLink; /* Used for incremental Discovery only */ 329 bit32 id; /* for debugging only */ 330 bit32 InQID; /* Inbound queue ID */ 331 bit32 OutQID; /* Outbound queue ID */ 332 bit8 DeviceType; 333 /* used in tiINIIOStart() */ 334 agsaRoot_t *agRoot; 335 agsaDevHandle_t *agDevHandle; 336 337 /* for SAS; remote device */ 338 // agsaSASDeviceInfo_t agSASDeviceInfo; 339 /* device's sas address */ 340 TDSASAddressID_t SASAddressID; 341 bit8 initiator_ssp_stp_smp; 342 bit8 target_ssp_stp_smp; 343 bit8 numOfPhys; 344 /* SATA specific data */ 345 satDeviceData_t satDevData; 346 347 /**< pointer to tdsaPortcontext which the device belongs to */ 348 struct tdsaPortContext_s *tdPortContext; 349 /* validity of device */ 350 bit8 valid; 351 bit8 valid2; 352 bit8 processed; /* used in TD discovery */ 353 #ifdef AGTIAPI_CTL 354 bit8 discovered; 355 #endif 356 agsaDeviceInfo_t agDeviceInfo; 357 agsaContext_t agContext; /* used in saRegisterNewDevice()*/ 358 /**< pointer to tdsaExpander if Device is expander */ 359 struct tdsaExpander_s *tdExpander; 360 struct tdsaDeviceData_s *ExpDevice; /* Expander device which this device is attached to */ 361 362 bit8 phyID; /* PhyID this device is attached to SPC or expander */ 363 agsaSASIdentify_t sasIdentify; /* used only in TD discovery */ 364 bit8 connectionRate; 365 bit8 registered; 366 bit8 directlyAttached; 367 bit8 SASSpecDeviceType; /* 0 - 3; SAS_NO_DEVICE - SAS_FANOUT_EXPANDER_DEVICE */ 368 bit32 IOStart; 369 bit32 IOResponse; 370 agsaContext_t agDeviceResetContext; /* used in saLocalPhyControl() */ 371 tiIORequest_t TransportRecoveryIO; 372 bit32 TRflag; /* transport recovery flag; used only for tiINITransportRecovery */ 373 bit32 ResetCnt; /* number of reset to the device */ 374 tdsaTimerRequest_t SATAIDDeviceTimer; /* ID Device Data timer for SATA device */ 375 bit32 OSAbortAll; 376 #ifdef FDS_DM 377 bit32 devMCN; /* MCN reported by DM */ 378 bit32 finalMCN; /* final MCN using devMCN and local MCN */ 379 #endif 380 #ifdef FDS_SM 381 smDeviceHandle_t smDeviceHandle; /* for SATM */ 382 bit32 SMNumOfFCA; 383 bit32 SMNumOfID; 384 tdsaTimerRequest_t tdIDTimer; /* ID Device Data timer for SATA device */ 385 #endif 386 } tdsaDeviceData_t; 387 388 /* 389 this field is used to add or remove SAS device from sharedcontext 390 */ 391 typedef struct tdsaSASSubID_s 392 { 393 bit32 sasAddressHi; 394 bit32 sasAddressLo; 395 bit8 initiator_ssp_stp_smp; 396 bit8 target_ssp_stp_smp; 397 398 } tdsaSASSubID_t; 399 400 401 struct tdsaDeviceData_s; 402 //struct itdssDiscoveryData_s; 403 404 /** \brief data structure for TD port context 405 * This structure maintains information about the port such as ID address frame 406 * and the discovery status and the list of devices discovered by this port. 407 * itdsaIni_t->PortContext[] points to this structure. 408 * agsaPortContext->osData points to this structure, too. 409 */ 410 typedef struct tdsaPortContext_s 411 { 412 /**< current number of devices in this PortContext */ 413 bit32 Count; 414 415 bit32 DiscoveryState; 416 417 bit32 discoveryOptions; 418 /* Discovery ready is given? */ 419 bit32 DiscoveryRdyGiven; 420 /* Port has received link up */ 421 bit32 SeenLinkUp; 422 /* statistics */ 423 bit32 numAvailableTargets; 424 /* flag: indicates that discovery is trigggered by tiINIDiscoverTargets */ 425 bit32 osInitiatedDiscovery; 426 427 bit32 id; /* for debugging only */ 428 tdList_t FreeLink; /**< free portcontext list */ 429 tdList_t MainLink; /**< in-use portcontext list */ 430 /**< SAS address of the remote device */ 431 bit32 sasRemoteAddressHi; /**< SAS address high part */ 432 bit32 sasRemoteAddressLo; /**< SAS address low part */ 433 /**< SAS ID frame of the remote device */ 434 agsaSASIdentify_t sasIDframe; 435 436 /**< SAS address of the local device*/ 437 bit32 sasLocalAddressHi; /**< SAS address high part */ 438 bit32 sasLocalAddressLo; /**< SAS address low part */ 439 440 /**< the list of PhyID belonging to this port */ 441 bit8 PhyIDList[TD_MAX_NUM_PHYS]; 442 tiPortalContext_t *tiPortalContext; 443 /* used in tiINIDiscoverTarget() */ 444 agsaRoot_t *agRoot; 445 agsaPortContext_t *agPortContext; 446 /* maybe needs timers for saPhyStart() */ 447 448 bit8 nativeSATAMode; /* boolean flag: whether the port is in Native SATA mode */ 449 bit8 remoteSignature[8]; /* the remote signature of the port is the port is in native SATA mode */ 450 bit8 directAttatchedSAS; /* boolean flag: whether the port connected directly to SAS end device*/ 451 /* SAS/SATA discovery information such as discoveringExpanderList */ 452 tdsaDiscovery_t discovery; 453 bit32 valid; 454 bit8 LinkRate; 455 bit32 RegisteredDevNums; /* registered number of devices */ 456 bit32 eventPhyID; /* used for saHwEventAck() */ 457 bit32 Transient; /* transient period between link up and link down/port recovery */ 458 agsaContext_t agContext; /* used in tiCOMPortStop()*/ 459 bit32 PortRecoverPhyID; /* used to remember PhyID in Port_Recover event; used in ossaDeviceRegistrationCB() */ 460 bit32 DiscFailNSeenBC; /* used to remember broadcast change after discovery failure */ 461 bit8 remoteName[68]; 462 #ifdef FDS_DM 463 dmPortContext_t dmPortContext; 464 bit32 DMDiscoveryState; /* DM discovery state returned by tddmDiscoverCB or tddmQueryDiscoveryCB */ 465 bit32 UseDM; /* set only when the directly attached target is SMP target(expander) */ 466 bit32 UpdateMCN; /* flag for inidicating update MCN */ 467 #endif 468 } tdsaPortContext_t; 469 470 /** \brief data structure for TD port information 471 * This structure contains information in order to start the port 472 * The most of fields are filled in by OS layer and there can be up to 473 * 8 of these structures 474 * tiPortalContext_t->tdData points to this structure. 475 */ 476 typedef struct tdsaPortStartInfo_s { 477 tiPortalContext_t *tiPortalContext; 478 tdsaPortContext_t *portContext; /* tdsaportcontext */ 479 agsaSASIdentify_t SASID; /* SAS ID of the local */ 480 tdssPortFlags_t flags; 481 agsaPhyConfig_t agPhyConfig; 482 } tdsaPortStartInfo_t; 483 /* 484 expander data structure 485 */ 486 487 #define REPORT_LUN_LEN 16 488 #define REPORT_LUN_OPCODE 0xa0 489 typedef struct tdDeviceLUNInfo_s 490 { 491 unsigned long tiDeviceHandle; 492 bit32 numOfLun; 493 }tdDeviceLUNInfoIOCTL_t; 494 495 typedef struct tdsaExpander_s 496 { 497 tdList_t linkNode; /**< the link node data structure of the expander */ 498 tdList_t upNode; /**< the link node data structure of the expander */ 499 tdsaDeviceData_t *tdDevice; /**< the pointer to the device */ 500 struct tdsaExpander_s *tdUpStreamExpander; /**< the pointer to the upstream expander device */ 501 bit8 hasUpStreamDevice; 502 bit8 discoveringPhyId; 503 bit16 routingIndex; /* maximum routing table index reported by expander */ 504 bit16 currentIndex[TD_MAX_EXPANDER_PHYS]; /* routing table index in use */ 505 tdsaDeviceData_t *tdDeviceToProcess; /* on some callbacks, this is a link to the device of interest */ 506 bit32 configSASAddressHi; 507 bit32 configSASAddressLo; 508 struct tdsaExpander_s *tdCurrentDownStreamExpander; 509 bit8 upStreamPhys[TD_MAX_EXPANDER_PHYS]; 510 bit16 numOfUpStreamPhys; 511 bit16 currentUpStreamPhyIndex; 512 bit32 upStreamSASAddressHi; 513 bit32 upStreamSASAddressLo; 514 bit32 underDiscovering; 515 bit32 configRouteTable: 1; 516 bit32 configuring: 1; 517 bit32 configReserved: 30; 518 bit32 id; /* for debugging */ 519 struct tdsaExpander_s *tdReturnginExpander; 520 bit8 downStreamPhys[TD_MAX_EXPANDER_PHYS]; 521 bit16 numOfDownStreamPhys; 522 bit16 currentDownStreamPhyIndex; 523 bit32 discoverSMPAllowed; /* used only for configurable routers */ 524 bit8 routingAttribute[TD_MAX_EXPANDER_PHYS]; 525 bit32 configSASAddressHiTable[DEFAULT_MAX_DEV]; 526 bit32 configSASAddressLoTable[DEFAULT_MAX_DEV]; 527 bit32 configSASAddrTableIndex; 528 529 } tdsaExpander_t; 530 531 /* 532 * SATA SAT specific function pointer for SATA completion for SAT commands. 533 */ 534 typedef void (*satCompleteCbPtr_t )( 535 agsaRoot_t *agRoot, 536 agsaIORequest_t *agIORequest, 537 bit32 agIOStatus, 538 agsaFisHeader_t *agFirstDword, 539 bit32 agIOInfoLen, 540 agsaFrameHandle_t agFrameHandle, 541 void *satIOContext 542 ); 543 544 /* 545 * SATA SAT specific function for I/O context 546 */ 547 typedef struct satIOContext_s 548 { 549 tdList_t satIoContextLink; 550 satDeviceData_t *pSatDevData; 551 agsaFisRegHostToDevice_t *pFis; 552 tiIniScsiCmnd_t *pScsiCmnd; 553 scsiRspSense_t *pSense; 554 tiSenseData_t *pTiSenseData; 555 void *tiRequestBody; 556 void *tiScsiXchg; /* for writesame10() */ 557 bit32 reqType; 558 bit32 interruptContext; 559 satCompleteCbPtr_t satCompleteCB; 560 satInternalIo_t *satIntIoContext; 561 tiDeviceHandle_t *ptiDeviceHandle; 562 bit8 sataTag; 563 bit8 superIOFlag;/* Flag indicating type for tiScsiXchg */ 564 bit8 reserved1; /* Padding for allignment */ 565 bit8 reserved2; /* Padding for allignment */ 566 bit32 currentLBA; /* current LBA for read and write */ 567 bit32 ATACmd; /* ATA command */ 568 bit32 OrgTL; /* original tranfer length(tl) */ 569 bit32 LoopNum; /* denominator tl */ 570 bit32 LoopNum2; /* denominator tl */ 571 bit8 LBA[8]; /* for reassign blocks; current LBA */ 572 bit32 ParmIndex; /* for reassign blocks;current idx in defective LBA LIST */ 573 bit32 ParmLen; /* for reassign blocks; defective LBA list length */ 574 bit32 NotifyOS; /* only for task management */ 575 bit32 TMF; /* task management function */ 576 struct satIOContext_s *satToBeAbortedIOContext; 577 struct satIOContext_s *satOrgIOContext; 578 bit32 pid; /* port id; used to protect double completion */ 579 } satIOContext_t; 580 581 582 /** \brief data structure for SAS SSP IO reuqest body 583 * This structure contains IO related fields. 584 * agsaIORequest->osData points to this 585 */ 586 typedef struct tdIORequestBody_s { 587 tdssIOCompleted_t IOCompletionFunc; 588 tiDeviceHandle_t *tiDevHandle; 589 tiIORequest_t *tiIORequest; /* for ini */ 590 agsaIORequest_t agIORequest; /* for command and task and tm response and response */ 591 tiIORequest_t *tiIOToBeAbortedRequest; /* IO to be aborted */ 592 agsaContext_t agContext; 593 #ifdef FDS_SM 594 smIORequestBody_t smIORequestBody; /*SATA IO request body*/ 595 smIORequest_t smIORequest; /* for SATM */ 596 void *osMemHandle; /* for ID data */ 597 bit32 pid; /* port id for SATA completion */ 598 bit32 superIOFlag; /* Super IO or not */ 599 union { 600 smScsiInitiatorRequest_t smSCSIRequest; 601 smSuperScsiInitiatorRequest_t smSuperSCSIRequest; 602 } SM; 603 #endif 604 union { 605 struct { 606 agsaSASRequestBody_t agSASRequestBody; 607 // agsaSASRequestBody_t agSASResponseBody; 608 /* SSP response */ 609 // agsaSSPResponseInfoUnit_t agSSPRspIU; 610 } SAS; 611 struct { 612 agsaSATAInitiatorRequest_t agSATARequestBody; 613 scsiRspSense_t sensePayload; 614 tiSenseData_t tiSenseData; 615 satIOContext_t satIOContext; 616 } SATA; 617 } transport; 618 bit32 ioStarted; 619 bit32 ioCompleted; 620 bit32 reTries; 621 /**< for ESGL */ 622 tdList_t EsglPageList; 623 bit32 agRequestType; 624 union { 625 struct { 626 bit32 expDataLength; 627 tiSgl_t tiSgl1; 628 tiSgl_t tiSgl2; 629 void *sglVirtualAddr; 630 } InitiatorRegIO; /* regular IO */ 631 struct { 632 void *osMemHandle; 633 tiIORequest_t *CurrentTaskTag; 634 tiIORequest_t *TaskTag; 635 } InitiatorTMIO; /* task management */ 636 637 struct { 638 tiIORequest_t tiIORequest; /* for target */ 639 640 union { 641 struct { 642 tiSgl_t tiSgl1; 643 void * sglVirtualAddr; 644 } RegIO; 645 646 struct { 647 tiSgl_t tiSgl1; 648 void * sglVirtualAddr; 649 tiSgl_t tiSglMirror; 650 void * sglMirrorVirtualAddr; 651 tdList_t EsglMirrorPageList; 652 } MirrorIO; 653 654 } TargetIOType; 655 656 } TargetIO; /* target regular IO */ 657 658 659 } IOType; 660 } tdIORequestBody_t; 661 662 /** \brief data structure for SAS SMP reuqest body 663 * This structure contains IO related fields. 664 * agsaIORequest->osData points to this 665 * 666 */ 667 typedef struct tdssSMPRequestBody_s { 668 tdIORequestBody_t IORequestBody; /* for combo, must be the first */ 669 tdssSMPCompleted_t SMPCompletionFunc;/* must be the second */ 670 671 tiDeviceHandle_t *tiDevHandle; /* not used for TD generated SMP */ 672 agsaIORequest_t agIORequest; 673 agsaSASRequestBody_t agSASRequestBody; 674 agsaSATAInitiatorRequest_t agSATARequestBody; 675 void *osMemHandle; 676 tdsaDeviceData_t *tdDevice; 677 tiIORequest_t *CurrentTaskTag; /* SMP is used for simulate target reset */ 678 tdsaPortContext_t *tdPortContext; /* portcontext where SMP is sent from */ 679 bit8 smpPayload[SMP_DIRECT_PAYLOAD_LIMIT]; /* for smp retries; 680 only for direct SMP */ 681 bit32 retries; /* number of retries */ 682 bit32 queueNumber; /* number of retries */ 683 /* for indirect SMP req/rsp */ 684 void *IndirectSMPReqosMemHandle; 685 void *IndirectSMPReq; 686 bit32 IndirectSMPReqLen; 687 void *IndirectSMPResposMemHandle; 688 void *IndirectSMPResp; 689 bit32 IndirectSMPRespLen; 690 691 } tdssSMPRequestBody_t; 692 693 #ifdef AGTIAPI_CTL 694 typedef struct tdIORequest_s 695 { 696 tiIORequest_t tiIORequest; 697 tdIORequestBody_t tdIORequestBody; 698 void *osMemHandle; 699 700 void *osMemHandle2; 701 bit32 physUpper32; 702 bit32 physLower32; 703 void *virtAddr; 704 705 tiIntrEventType_t eventType; 706 bit32 eventStatus; 707 } tdIORequest_t; 708 #endif 709 710 #ifdef PASSTHROUGH 711 /* this is allocated by OS layer but used in TD layer just like tdIORequestBody */ 712 typedef struct tdPassthroughCmndBody_s 713 { 714 ostiPassthroughCmndEvent_t EventCB; 715 tiPassthroughRequest_t *tiPassthroughRequest; 716 tiDeviceHandle_t *tiDevHandle; 717 bit32 tiPassthroughCmndType; /* used in local abort */ 718 union { 719 struct { 720 #ifdef TO_DO 721 tiSMPFunction_t SMPFn; 722 tiSMPFunctionResult_t SMPFnResult; /* for SMP target only */ 723 bit32 IT; /* 0: initiator 1: target */ 724 tiSMPFrameHeader_t SMPHeader; 725 #endif 726 tdssSMPRequestBody_t SMPBody; 727 } SMP; 728 struct { 729 tiDataDirection_t dataDirection; 730 } RMC; 731 } protocol; 732 } tdPassthroughCmndBody_t; 733 734 #endif 735 736 #endif /* __TDTYPES_H__ */ 737