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