The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/pms/RefTisa/sat/src/smtypes.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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 
   27 #include <dev/pms/freebsd/driver/common/osenv.h>
   28 #include <dev/pms/freebsd/driver/common/ostypes.h>
   29 #include <dev/pms/freebsd/driver/common/osdebug.h>
   30 
   31 #include <dev/pms/RefTisa/sallsdk/api/sa.h>
   32 #include <dev/pms/RefTisa/sallsdk/api/saapi.h>
   33 #include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
   34 
   35 #include <dev/pms/RefTisa/sat/api/sm.h>
   36 #include <dev/pms/RefTisa/sat/api/smapi.h>
   37 #include <dev/pms/RefTisa/sat/api/tdsmapi.h>
   38 
   39 #include <dev/pms/RefTisa/sat/src/smlist.h>
   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 */
   53 typedef void (*smTimerCBFunc_t)(smRoot_t *smRoot, void *timerData1, void *timerData2, void *timerData3);
   54 
   55 
   56 /** \brief data structure for timer request
   57  *  Timer requests are enqueued and dequeued using smList_t
   58  *  and have a callback function
   59  */
   60 typedef struct smTimerRequest_s {
   61   /* the number of ticks */
   62   bit32             timeout;
   63   void              *timerData1;
   64   void              *timerData2;
   65   void              *timerData3;
   66   smTimerCBFunc_t   timerCBFunc;
   67   smList_t          timerLink;
   68   bit32             timerRunning;
   69 }  smTimerRequest_t;
   70 
   71 
   72 
   73 typedef struct smSatInternalIo_s
   74 {
   75   smList_t                    satIntIoLink;
   76   smIORequest_t               satIntSmIORequest; /* old satIntTiIORequest */
   77   void                        *satIntRequestBody; /* maps to smIOrequestBody */
   78   smScsiInitiatorRequest_t    satIntSmScsiXchg; /* old satIntTiScsiXchg*/
   79   smMem_t                     satIntDmaMem;
   80   smMem_t                     satIntReqBodyMem;
   81   bit32                       satIntFlag;
   82   smIORequest_t               *satOrgSmIORequest; /* old satOrgTiIORequest */
   83   bit32                       id;
   84 } smSatInternalIo_t;
   85 
   86 
   87 
   88 typedef 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 */
   92   smRoot_t                *smRoot;
   93   agsaDevHandle_t         *agDevHandle;
   94   bit32                   valid; /* valid or registered */
   95   smTimerRequest_t        SATAIDDeviceTimer; /* ID Device Data timer for SATA device */
   96   bit32                   SMAbortAll; /* flag for abortall case */ 
   97   smDeviceHandle_t        *smDevHandle;
   98   bit32                   directlyAttached;
   99   agsaDevHandle_t         *agExpDevHandle; /* expander a device is attached to if expander attached */
  100   bit32                   phyID;
  101   agsaContext_t           agDeviceResetContext; /* used in saLocalPhyControl() */
  102   bit32                   SMNumOfFCA;
  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   */
  155   bit32                   sasAddressLo;             /**< HOST SAS address lower part */
  156   bit32                   sasAddressHi;             /**< HOST SAS address higher part */
  157 
  158 }  smDeviceData_t;
  159 
  160 typedef struct smAtaPassThroughHdr_s
  161 {
  162   bit8 opc;
  163   bit8 mulCount : 3;
  164   bit8 proto : 4;
  165   bit8 extend : 1;
  166   bit8 offline : 2;
  167   bit8 ckCond : 1;
  168   bit8 tType : 1;
  169   bit8 tDir : 1;
  170   bit8 byteBlock : 1;
  171   bit8 tlength : 2;
  172   
  173 }smAtaPassThroughHdr_t;
  174 
  175 /*
  176  * SCSI Sense Data
  177  */
  178 typedef struct 
  179 {
  180   bit8       snsRespCode;
  181   bit8       snsSegment;
  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          */
  188   bit8       fru;
  189   bit8       skeySpecific[3];
  190 } smScsiRspSense_t;
  191 
  192 
  193 /* 
  194  * SATA SAT specific function pointer for SATA completion for SAT commands.
  195  */
  196 typedef 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 */
  207 typedef void (*smSMPCompleted_t)(
  208                                   agsaRoot_t            *,
  209                                   agsaIORequest_t       *,
  210                                   bit32                 ,
  211                                   bit32                 ,
  212                                   agsaFrameHandle_t     
  213                                 );
  214 
  215 
  216 /* 
  217  * SATA SAT specific function for I/O context
  218  */
  219 typedef struct smSatIOContext_s 
  220 {
  221   smList_t                    satIoContextLink;
  222   smDeviceData_t              *pSatDevData;
  223   agsaFisRegHostToDevice_t    *pFis;
  224   smIniScsiCmnd_t             *pScsiCmnd;
  225   smScsiRspSense_t            *pSense;
  226   smSenseData_t               *pSmSenseData; /* old pTiSenseData */
  227   void                        *smRequestBody;  /* smIORequestBody_t; old tiRequestBody*/
  228   void                        *smScsiXchg; /* for writesame10(); old tiScsiXchg */
  229   bit32                       reqType;
  230   bit32                       interruptContext;
  231   smSatCompleteCbPtr_t        satCompleteCB;
  232   smSatInternalIo_t           *satIntIoContext; /* SATM generated IOs */
  233   smDeviceHandle_t            *psmDeviceHandle; /* old ptiDeviceHandle */
  234   bit8                        sataTag;
  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 */
  248   struct smSatIOContext_s     *satToBeAbortedIOContext; 
  249   struct smSatIOContext_s     *satOrgIOContext;
  250   bit32                       UpperAddr;
  251   bit32                       LowerAddr;
  252   bit32                       SplitIdx;
  253   bit32                       AdjustBytes;
  254   bit32                       EsglLen;
  255   /* For the SAT Passthrough */
  256   bit8                        ck_cond;  
  257   bit8                        extend;
  258   bit8                        sectorCnt07;
  259   bit8                        LBAHigh07;
  260   bit8                        LBAMid07;
  261   bit8                        LBALow07;
  262   bit8                        Sector_Cnt_Upper_Nonzero;
  263   bit8                        LBA_Upper_Nonzero;  
  264   bit32                       pid;        /* port id; used to protect double completion */
  265   bit32                       id;         /* for debugging */
  266 } smSatIOContext_t;
  267 
  268 typedef struct smIORequestBody_s {
  269   smList_t                    satIoBodyLink;
  270   smDeviceHandle_t            *smDevHandle;
  271   smIORequest_t               *smIORequest;
  272   agsaIORequest_t             agIORequest;
  273   smIORequest_t               *smIOToBeAbortedRequest; /* IO to be aborted; old tiIOToBeAbortedRequest */
  274   bit32                       id;
  275   bit32                       InUse;  
  276   union {
  277     struct {
  278       agsaSATAInitiatorRequest_t    agSATARequestBody;
  279       smScsiRspSense_t              sensePayload;
  280       smSenseData_t                 smSenseData; /* old tiSenseData */
  281       smSatIOContext_t              satIOContext;
  282     } SATA;
  283   } transport;  
  284   bit32                          ioStarted;
  285   bit32                          ioCompleted;
  286   bit32                          reTries;
  287   union {
  288     struct {
  289       bit32                     expDataLength;
  290       smSgl_t                   smSgl1; /* old tiSgl1 */
  291       smSgl_t                   smSgl2; /* old tiSgl2 */
  292       void                      *sglVirtualAddr;
  293     } InitiatorRegIO;  /* regular IO */
  294     struct {
  295       void                      *osMemHandle;
  296       smIORequest_t             *CurrentTaskTag;
  297       smIORequest_t             *TaskTag;
  298     } InitiatorTMIO;  /* task management */
  299   } IOType;
  300   
  301 } smIORequestBody_t;
  302 
  303 typedef struct smSMPRequestBody_s {
  304   smSMPCompleted_t               SMPCompletionFunc;/* must be the second */
  305   
  306   smDeviceHandle_t               *smDevHandle;    /* not used for SM generated SMP */
  307   agsaIORequest_t                agIORequest;
  308   agsaSASRequestBody_t           agSASRequestBody;
  309   void                           *osMemHandle;
  310   smDeviceData_t                 *smDeviceData;
  311   smIORequest_t                  *CurrentTaskTag; /* SMP is used for simulate target reset */
  312 //  tdsaPortContext_t              *tdPortContext; /* portcontext where SMP is sent from */
  313   bit8                           smpPayload[SMP_DIRECT_PAYLOAD_LIMIT]; /* for smp retries; 
  314                                                                           only for direct SMP */
  315   bit32                          retries; /* number of retries */
  316  
  317 }  smSMPRequestBody_t;
  318 
  319 
  320 typedef struct smRootOsData_s {
  321   smRoot_t  *smRoot;            /**< Pointer back to smRoot                 */
  322   void      *smAllShared;       /**< Pointer to smIntContext_t               */
  323   void      *smIni;             /**< Pointer to SAS/SATA initiator               */
  324 }  smRootOsData_t;
  325 
  326 typedef struct smIntContext_s {
  327   /**< agsaRoot_t->osData points to this */
  328   struct smRootOsData_s      smRootOsData;
  329   
  330   bit32               usecsPerTick;
  331   agsaRoot_t          *agRoot;
  332   
  333   /**< software-related initialization params used in saInitialize() */
  334   smSwConfig_t        SwConfig;  
  335   
  336   /**< timers used commonly in SAS/SATA */
  337   smList_t                      timerlist;
  338   
  339   /**< pointer to Device memory */
  340   smDeviceData_t             *DeviceMem;  
  341   smList_t                   FreeDeviceList;
  342   smList_t                   MainDeviceList;
  343 
  344   /**< pointer to IO memory */
  345   smIORequestBody_t         *IOMem; 
  346   smList_t                   freeIOList;
  347   smList_t                   mainIOList;  
  348   bit32                      FCA;
  349 }  smIntContext_t;
  350 
  351 typedef struct smIntRoot_s
  352 {
  353   /**<< common data structure for SAS/SATA */
  354   smIntContext_t          smAllShared;
  355 } smIntRoot_t;
  356 
  357 
  358 #endif                          /* __SMTYPES_H__ */
  359 

Cache object: 6d4c4cbc04be09ce72af6df1be7369cb


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.