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/tisa/sassata/sata/host/sathw.c

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 ********************************************************************************/
   22 /*****************************************************************************/
   23 /** \file
   24  *
   25  * The file implementing LL HW encapsulation for SCSI/ATA Translation (SAT).
   26  *
   27  */
   28 /*****************************************************************************/
   29 #include <sys/cdefs.h>
   30 __FBSDID("$FreeBSD$");
   31 #include <dev/pms/config.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 SATA_ENABLE
   42 
   43 #include <dev/pms/RefTisa/tisa/api/titypes.h>
   44 #include <dev/pms/RefTisa/tisa/api/ostiapi.h>
   45 #include <dev/pms/RefTisa/tisa/api/tiapi.h>
   46 #include <dev/pms/RefTisa/tisa/api/tiglobal.h>
   47 
   48 #ifdef FDS_SM
   49 #include <dev/pms/RefTisa/sat/api/sm.h>
   50 #include <dev/pms/RefTisa/sat/api/smapi.h>
   51 #include <dev/pms/RefTisa/sat/api/tdsmapi.h>
   52 #endif
   53 
   54 #ifdef FDS_DM
   55 #include <dev/pms/RefTisa/discovery/api/dm.h>
   56 #include <dev/pms/RefTisa/discovery/api/dmapi.h>
   57 #include <dev/pms/RefTisa/discovery/api/tddmapi.h>
   58 #endif
   59 
   60 #include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
   61 #include <dev/pms/freebsd/driver/common/osstring.h>
   62 #include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
   63 
   64 #ifdef INITIATOR_DRIVER
   65 #include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
   66 #include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
   67 #include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
   68 #endif
   69 
   70 #ifdef TARGET_DRIVER
   71 #include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
   72 #include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
   73 #include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
   74 #endif
   75 
   76 #include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
   77 #include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
   78 
   79 #include <dev/pms/RefTisa/tisa/sassata/sata/host/sat.h>
   80 #include <dev/pms/RefTisa/tisa/sassata/sata/host/satproto.h>
   81 
   82 /*
   83  * This table is used to map LL Layer saSATAStart() status to TISA status.
   84  */
   85 static bit32 mapStat[3] =
   86 {
   87   tiSuccess,
   88   tiError,
   89   tiBusy
   90 };
   91 
   92 
   93 /*****************************************************************************
   94  *! \brief  sataLLIOStart
   95  *
   96  *   This routine is called to initiate a new SATA request to LL layer.
   97  *   This function implements/encapsulates HW and LL API dependency.
   98  *
   99  *  \param   tiRoot:           Pointer to TISA initiator driver/port instance.
  100  *  \param   tiIORequest:      Pointer to TISA I/O request context for this I/O.
  101  *  \param   tiDeviceHandle:   Pointer to TISA device handle for this I/O.
  102  *  \param   tiScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
  103  *  \param   satIOContext_t:   Pointer to the SAT IO Context
  104  *
  105  *  \return:
  106  *
  107  *  \e tiSuccess:     I/O request successfully initiated.
  108  *  \e tiBusy:        No resources available, try again later.
  109  *  \e tiIONoDevice:  Invalid device handle.
  110  *  \e tiError:       Other errors that prevent the I/O request to be started.
  111  *
  112  *
  113  *****************************************************************************/
  114 
  115 GLOBAL bit32  sataLLIOStart (
  116                    tiRoot_t                  *tiRoot,
  117                    tiIORequest_t             *tiIORequest,
  118                    tiDeviceHandle_t          *tiDeviceHandle,
  119                    tiScsiInitiatorRequest_t  *tiScsiRequest,
  120                    satIOContext_t            *satIOContext
  121                   )
  122 {
  123 
  124   tdsaDeviceData_t            *oneDeviceData;
  125   agsaRoot_t                  *agRoot;
  126   agsaIORequest_t             *agIORequest;
  127   agsaDevHandle_t             *agDevHandle;
  128   bit32                       status;
  129   tdIORequestBody_t           *tdIORequestBody;
  130   agsaSATAInitiatorRequest_t  *agSATAReq;
  131   satDeviceData_t             *pSatDevData;
  132   satInternalIo_t             *satIntIo;
  133   bit32                       RLERecovery = agFALSE;
  134 
  135   oneDeviceData   = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
  136   agRoot          = oneDeviceData->agRoot;
  137   agDevHandle     = oneDeviceData->agDevHandle;
  138   tdIORequestBody = (tdIORequestBody_t *)satIOContext->tiRequestBody;
  139   agSATAReq       = &(tdIORequestBody->transport.SATA.agSATARequestBody);
  140   pSatDevData     = satIOContext->pSatDevData;
  141   satIntIo        = satIOContext->satIntIoContext;
  142 
  143   /*
  144    * If this is a super I/O request, check for optional settings.
  145    * Be careful. Use the superRequest pointer for all references
  146    * in this block of code.
  147    */
  148   agSATAReq->option = 0;
  149   if (satIOContext->superIOFlag)
  150   {
  151       tiSuperScsiInitiatorRequest_t *superRequest = (tiSuperScsiInitiatorRequest_t *) tiScsiRequest;
  152       agBOOLEAN                 needPlusDataLenAdjustment = agFALSE;
  153       agBOOLEAN                 needMinusDataLenAdjustment = agFALSE;
  154       bit32                     adjusted_length;
  155 
  156       if (superRequest->flags & TI_SCSI_INITIATOR_ENCRYPT)
  157       {
  158         /*
  159          * Copy all of the relevant encrypt information
  160          */
  161         agSATAReq->option |= AGSA_SATA_ENABLE_ENCRYPTION;
  162         osti_memcpy(&agSATAReq->encrypt, &superRequest->Encrypt, sizeof(agsaEncrypt_t));
  163       }
  164 
  165       if (superRequest->flags & TI_SCSI_INITIATOR_DIF)
  166       {
  167           /*
  168            * Copy all of the relevant DIF information
  169            */
  170           agSATAReq->option |= AGSA_SATA_ENABLE_DIF;
  171           osti_memcpy(&agSATAReq->dif, &superRequest->Dif, sizeof(agsaDif_t));
  172 
  173           /*
  174            * Set SGL data len
  175            * XXX This code needs to support more sector sizes
  176            */
  177           if (needPlusDataLenAdjustment == agTRUE)
  178           {
  179               adjusted_length = superRequest->scsiCmnd.expDataLength;
  180               adjusted_length += (adjusted_length/512) * 8;
  181               agSATAReq->dataLength = adjusted_length;
  182           }
  183           else if (needMinusDataLenAdjustment == agTRUE)
  184           {
  185               adjusted_length = superRequest->scsiCmnd.expDataLength;
  186               adjusted_length -= (adjusted_length/520) * 8;
  187               agSATAReq->dataLength = adjusted_length;
  188           }
  189           else
  190           {
  191               /* setting the data length */
  192               agSATAReq->dataLength  = superRequest->scsiCmnd.expDataLength;
  193           }
  194 
  195           tdIORequestBody->IOType.InitiatorRegIO.expDataLength = agSATAReq->dataLength;
  196       }
  197       else
  198       {
  199            /* initialize expDataLength */
  200           if (satIOContext->reqType == AGSA_SATA_PROTOCOL_NON_DATA ||
  201               satIOContext->reqType == AGSA_SATA_PROTOCOL_SRST_ASSERT ||
  202               satIOContext->reqType == AGSA_SATA_PROTOCOL_SRST_DEASSERT
  203              )
  204           {
  205               tdIORequestBody->IOType.InitiatorRegIO.expDataLength = 0;
  206           }
  207           else
  208           {
  209               tdIORequestBody->IOType.InitiatorRegIO.expDataLength = tiScsiRequest->scsiCmnd.expDataLength;
  210           }
  211 
  212           agSATAReq->dataLength = tdIORequestBody->IOType.InitiatorRegIO.expDataLength;
  213       }
  214   }
  215   else
  216   {
  217       agSATAReq->option = 0;
  218       /* initialize expDataLength */
  219       if (satIOContext->reqType == AGSA_SATA_PROTOCOL_NON_DATA ||
  220           satIOContext->reqType == AGSA_SATA_PROTOCOL_SRST_ASSERT ||
  221           satIOContext->reqType == AGSA_SATA_PROTOCOL_SRST_DEASSERT
  222          )
  223       {
  224           tdIORequestBody->IOType.InitiatorRegIO.expDataLength = 0;
  225       }
  226       else
  227       {
  228           tdIORequestBody->IOType.InitiatorRegIO.expDataLength = tiScsiRequest->scsiCmnd.expDataLength;
  229       }
  230 
  231       agSATAReq->dataLength = tdIORequestBody->IOType.InitiatorRegIO.expDataLength;
  232   }
  233 
  234   if ( (pSatDevData->satDriveState == SAT_DEV_STATE_IN_RECOVERY) &&
  235        (satIOContext->pFis->h.command == SAT_READ_LOG_EXT)
  236        )
  237    {
  238      RLERecovery = agTRUE;
  239    }
  240 
  241   /* check max io */
  242   /* be sure to free */
  243   if ( (pSatDevData->satDriveState != SAT_DEV_STATE_IN_RECOVERY) ||
  244        (RLERecovery == agTRUE)
  245       )
  246   {
  247     if (RLERecovery == agFALSE) /* RLE is not checked against pending IO's */
  248     {
  249       if ( (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_WRITE) ||
  250            (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_READ) )
  251       {
  252         if (pSatDevData->satPendingNCQIO >= pSatDevData->satNCQMaxIO ||
  253             pSatDevData->satPendingNONNCQIO != 0)
  254         {
  255           TI_DBG1(("sataLLIOStart: 1st busy NCQ. NCQ Pending %d NONNCQ Pending %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
  256           /* free resource */
  257           satFreeIntIoResource( tiRoot,
  258                                 pSatDevData,
  259                                 satIntIo);
  260           return tiBusy;
  261         }
  262       }
  263       else
  264       {
  265         if (pSatDevData->satPendingNONNCQIO >= SAT_NONNCQ_MAX ||
  266             pSatDevData->satPendingNCQIO != 0)
  267         {
  268           TI_DBG1(("sataLLIOStart: 2nd busy NON-NCQ. NCQ Pending %d NON-NCQ Pending %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
  269           /* free resource */
  270           satFreeIntIoResource( tiRoot,
  271                                 pSatDevData,
  272                                 satIntIo);
  273           return tiBusy;
  274         }
  275       }
  276     } /* RLE */
  277     /* for internal SATA command only */
  278     if (satIOContext->satOrgIOContext != agNULL)
  279     {
  280       /* Initialize tiIORequest */
  281       tdIORequestBody->tiIORequest = tiIORequest;
  282     }
  283     /* Initialize tiDevhandle */
  284     tdIORequestBody->tiDevHandle = tiDeviceHandle;
  285 
  286     /* Initializes Scatter Gather and ESGL */
  287     status = itdsataIOPrepareSGL( tiRoot,
  288                                   tdIORequestBody,
  289                                   &tiScsiRequest->agSgl1,
  290                                   tiScsiRequest->sglVirtualAddr );
  291 
  292     if (status != tiSuccess)
  293     {
  294       TI_DBG1(("sataLLIOStart: can't get SGL\n"));
  295       return status;
  296     }
  297 
  298 
  299     /* Initialize LL Layer agIORequest */
  300     agIORequest = &(tdIORequestBody->agIORequest);
  301     agIORequest->osData = (void *) tdIORequestBody;
  302     agIORequest->sdkData = agNULL; /* SA takes care of this */
  303 
  304     tdIORequestBody->ioStarted = agTRUE;
  305     tdIORequestBody->ioCompleted = agFALSE;
  306 
  307     /*
  308 
  309   #ifdef PRE_SALL_v033
  310 GLOBAL bit32 saSATAStart(
  311                         agsaRoot_t      *agRoot,
  312                         agsaIORequest_t *agIORequest,
  313                         agsaDevHandle_t *agDevHandle,
  314                         bit32           agRequestType,
  315                         agsaSATAInitiatorRequest_t  *agSATAReq,
  316                         bit8            *agTag
  317                         );
  318 #endif
  319 GLOBAL bit32 saSATAStart(
  320                         agsaRoot_t                  *agRoot,
  321                         agsaIORequest_t             *agIORequest,
  322                         agsaDevHandle_t             *agDevHandle,
  323                         bit32                       agRequestType,
  324                         agsaSATAInitiatorRequest_t  *agSATAReq,
  325                         bit8                        agTag,
  326                         ossaSATACompletedCB_t       agCB
  327                         );
  328   */
  329 
  330     /* assign tag value for SATA */
  331     if ( (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_WRITE) ||
  332          (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_READ) )
  333     {
  334       if (agFALSE == satTagAlloc(tiRoot, pSatDevData, &satIOContext->sataTag))
  335       {
  336         TI_DBG1(("sataLLIOStart: No more NCQ tag\n"));
  337         tdIORequestBody->ioStarted = agFALSE;
  338         tdIORequestBody->ioCompleted = agTRUE;
  339         return tiBusy;
  340       }
  341       TI_DBG3(("sataLLIOStart: ncq tag 0x%x\n",satIOContext->sataTag));
  342     }
  343     else
  344     {
  345       satIOContext->sataTag = 0xFF;
  346     }
  347   }
  348   else /* AGSA_SATA_PROTOCOL_SRST_ASSERT or AGSA_SATA_PROTOCOL_SRST_DEASSERT
  349           or SAT_CHECK_POWER_MODE as ABORT */
  350   {
  351     agsaSgl_t          *agSgl;
  352 
  353     /* for internal SATA command only */
  354     if (satIOContext->satOrgIOContext != agNULL)
  355     {
  356       /* Initialize tiIORequest */
  357       tdIORequestBody->tiIORequest = tiIORequest;
  358     }
  359     /* Initialize tiDevhandle */
  360     tdIORequestBody->tiDevHandle = tiDeviceHandle;
  361 
  362 
  363     tdIORequestBody->IOType.InitiatorRegIO.expDataLength = 0;
  364     /* SGL for SATA request */
  365     agSgl = &(tdIORequestBody->transport.SATA.agSATARequestBody.agSgl);
  366     agSgl->len = 0;
  367 
  368     agSgl->sgUpper = 0;
  369     agSgl->sgLower = 0;
  370     agSgl->len = 0;
  371     CLEAR_ESGL_EXTEND(agSgl->extReserved);
  372 
  373     /* Initialize LL Layer agIORequest */
  374     agIORequest = &(tdIORequestBody->agIORequest);
  375     agIORequest->osData = (void *) tdIORequestBody;
  376     agIORequest->sdkData = agNULL; /* SA takes care of this */
  377 
  378     tdIORequestBody->ioStarted = agTRUE;
  379     tdIORequestBody->ioCompleted = agFALSE;
  380 
  381     /* setting the data length */
  382     agSATAReq->dataLength = 0;
  383 
  384   }
  385 
  386   tdIORequestBody->reTries = 0;
  387   osti_memset(agSATAReq->scsiCDB, 0, 16);
  388   osti_memcpy(agSATAReq->scsiCDB, tiScsiRequest->scsiCmnd.cdb, 16);
  389 #ifdef TD_INTERNAL_DEBUG
  390   tdhexdump("sataLLIOStart", (bit8 *)satIOContext->pFis, sizeof(agsaFisRegHostToDevice_t));
  391   tdhexdump("sataLLIOStart LL", (bit8 *)&agSATAReq->fis.fisRegHostToDev,
  392             sizeof(agsaFisRegHostToDevice_t));
  393 #endif
  394 
  395   TI_DBG6(("sataLLIOStart: agDevHandle %p\n", agDevHandle));
  396   status = saSATAStart( agRoot,
  397                         agIORequest,
  398                         tdsaRotateQnumber(tiRoot, oneDeviceData),
  399                         agDevHandle,
  400                         satIOContext->reqType,
  401                         agSATAReq,
  402                         satIOContext->sataTag,
  403                         ossaSATACompleted
  404                         );
  405 
  406   if (status == AGSA_RC_SUCCESS)
  407   {
  408     tdsaSingleThreadedEnter(tiRoot, TD_SATA_LOCK);
  409     oneDeviceData->satDevData.satPendingIO++;
  410     if ( (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_WRITE) ||
  411          (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_READ) )
  412     {
  413       oneDeviceData->satDevData.satPendingNCQIO++;
  414     }
  415     else
  416     {
  417       oneDeviceData->satDevData.satPendingNONNCQIO++;
  418     }
  419 
  420     TDLIST_INIT_ELEMENT (&satIOContext->satIoContextLink);
  421     TDLIST_ENQUEUE_AT_TAIL (&satIOContext->satIoContextLink,
  422                             &oneDeviceData->satDevData.satIoLinkList);
  423     tdsaSingleThreadedLeave(tiRoot, TD_SATA_LOCK);
  424     //    TI_DBG5(("sataLLIOStart: device %p pending IO %d\n", oneDeviceData->satDevData,oneDeviceData->satDevData.satPendingIO));
  425   }
  426   else
  427   {
  428     if (status == AGSA_RC_BUSY)
  429     {
  430       TI_DBG1(("sataLLIOStart: saSATAStart busy\n"));
  431     }
  432     else
  433     {
  434       TI_DBG1(("sataLLIOStart: saSATAStart failed\n"));
  435     }
  436     if ( (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_WRITE) ||
  437          (satIOContext->reqType == AGSA_SATA_PROTOCOL_FPDMA_READ) )
  438     {
  439       satTagRelease(tiRoot, pSatDevData, satIOContext->sataTag);
  440     }
  441 
  442     /* Free the ESGL pages associated with this I/O */
  443     tdIORequestBody->ioStarted = agFALSE;
  444     tdIORequestBody->ioCompleted = agTRUE;
  445     /*
  446      * Map the SAS/SATA LL layer status to the TISA status
  447      */
  448     status = mapStat[status];
  449     return (status);
  450   }
  451 
  452   return (tiSuccess);
  453 
  454 }
  455 
  456 
  457 /*****************************************************************************
  458 *! \brief itdsataIOPrepareSGL
  459 *
  460 *  This function is called to prepare and translate the TISA SGL information
  461 *  to the SAS/SATA LL layer specific SGL. This function is similar to
  462 *  itdssIOPrepareSGL(), except the request body reflects SATA host request.
  463 *
  464 *  \param    tiRoot:         Pointer to initiator driver/port instance.
  465 *  \param    IORequestBody:  TD layer request body for the I/O.
  466 *  \param    tiSgl1:         First TISA SGL info.
  467 *  \param    tiSgl2:         Second TISA SGL info.
  468 *  \param    sglVirtualAddr: The virtual address of the first element in
  469 *                            tiSgl1 when tiSgl1 is used with the type tiSglList.
  470 *
  471 *  \return:
  472 *
  473 *  \e tiSuccess:     SGL initialized successfully.
  474 *  \e tiError:       Failed to initialize SGL.
  475 *
  476 *
  477 *****************************************************************************/\
  478 osGLOBAL bit32 itdsataIOPrepareSGL(
  479                   tiRoot_t                 *tiRoot,
  480                   tdIORequestBody_t        *tdIORequestBody,
  481                   tiSgl_t                  *tiSgl1,
  482                   void                     *sglVirtualAddr
  483                   )
  484 {
  485   agsaSgl_t          *agSgl;
  486 
  487   /* Uppper should be zero-out */
  488   TI_DBG5(("itdsataIOPrepareSGL: start\n"));
  489 
  490   TI_DBG5(("itdsataIOPrepareSGL: tiSgl1->upper %d tiSgl1->lower %d tiSgl1->len %d\n",
  491     tiSgl1->upper, tiSgl1->lower, tiSgl1->len));
  492   TI_DBG5(("itdsataIOPrepareSGL: tiSgl1->type %d\n", tiSgl1->type));
  493 
  494   /* SGL for SATA request */
  495   agSgl = &(tdIORequestBody->transport.SATA.agSATARequestBody.agSgl);
  496   agSgl->len = 0;
  497 
  498   if (tiSgl1 == agNULL)
  499   {
  500     TI_DBG1(("itdsataIOPrepareSGL: Error tiSgl1 is NULL\n"));
  501     return tiError;
  502   }
  503 
  504   if (tdIORequestBody->IOType.InitiatorRegIO.expDataLength == 0)
  505   {
  506     TI_DBG3(("itdsataIOPrepareSGL: expDataLength is 0\n"));
  507     agSgl->sgUpper = 0;
  508     agSgl->sgLower = 0;
  509     agSgl->len = 0;
  510     CLEAR_ESGL_EXTEND(agSgl->extReserved);
  511     return tiSuccess;
  512   }
  513 
  514   agSgl->sgUpper = tiSgl1->upper;
  515   agSgl->sgLower = tiSgl1->lower;
  516   agSgl->len = tiSgl1->len;
  517   agSgl->extReserved = tiSgl1->type;
  518 
  519   return tiSuccess;
  520 
  521 }
  522 
  523 /*****************************************************************************
  524  *! \brief  sataLLIOAbort
  525  *
  526  *   This routine is called to initiate an I/O abort to LL layer.
  527  *   This function implements/encapsulates HW and LL API dependency.
  528  *
  529  *  \param   tiRoot:      Pointer to TISA initiator driver/port instance.
  530  *  \param   taskTag:     Pointer to TISA I/O context to be aborted.
  531  *
  532  *  \return:
  533  *
  534  *  \e tiSuccess:     Abort request was successfully initiated.
  535  *  \e tiBusy:        No resources available, try again later.
  536  *  \e tiError:       Other errors that prevent the abort request from being
  537  *                    started..
  538  *
  539  *
  540  *****************************************************************************/
  541 #ifdef REMOVED /* not in use */
  542 GLOBAL bit32 sataLLIOAbort (
  543                 tiRoot_t        *tiRoot,
  544                 tiIORequest_t   *taskTag )
  545 
  546 {
  547   tdsaRoot_t            *tdsaRoot;
  548   tdsaContext_t         *tdsaAllShared;
  549   agsaRoot_t            *agRoot;
  550   tdIORequestBody_t     *tdIORequestBody;
  551   agsaIORequest_t       *agIORequest;
  552   bit32                 status;
  553 
  554   TI_DBG2(("sataLLIOAbort: start\n"));
  555 
  556   tdsaRoot        = (tdsaRoot_t *) tiRoot->tdData;
  557   tdsaAllShared   = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
  558   agRoot          = &(tdsaAllShared->agRootNonInt);
  559   tdIORequestBody = (tdIORequestBody_t *)taskTag->tdData;
  560   agIORequest     = &(tdIORequestBody->agIORequest);
  561 
  562   status = saSATAAbort(agRoot, 0, agIORequest);
  563 
  564   TI_DBG2(("sataLLIOAbort: agIORequest %p\n", agIORequest));
  565   TI_DBG2(("sataLLIOAbort: saSATAAbort returns status, %x\n", status));
  566 
  567   if (status == AGSA_RC_SUCCESS)
  568   {
  569     return tiSuccess;
  570   }
  571   else
  572   {
  573     return tiError;
  574   }
  575 
  576 }
  577 #endif
  578 
  579 #ifdef REMOVED
  580 /*****************************************************************************
  581  *! \brief  sataLLReset
  582  *
  583  *   This routine is called to initiate a SATA device reset to LL layer.
  584  *   This function implements/encapsulates HW and LL API dependency.
  585  *
  586  *  \param   tiRoot:           Pointer to TISA initiator driver/port instance.
  587  *  \param   tiDeviceHandle:   Pointer to TISA device handle for this I/O.
  588  *  \param   option:           SATA device reset option
  589  *
  590  *  \return: None
  591  *
  592  *
  593  *****************************************************************************/
  594 /* not in use */
  595 GLOBAL  void  sataLLReset(
  596                   tiRoot_t          *tiRoot,
  597                   tiDeviceHandle_t  *tiDeviceHandle,
  598                   bit32             option)
  599 {
  600 
  601   tdsaRoot_t            *tdsaRoot;
  602   tdsaContext_t         *tdsaAllShared;
  603   tdsaDeviceData_t      *oneDeviceData;
  604   agsaRoot_t            *agRoot;
  605   agsaDevHandle_t       *agDevHandle;
  606 
  607   TI_DBG2(("sataLLReset: extry\n"));
  608 
  609   tdsaRoot        = (tdsaRoot_t *) tiRoot->tdData;
  610   tdsaAllShared   = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
  611   agRoot          = &(tdsaAllShared->agRootNonInt);
  612   oneDeviceData   = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
  613   agDevHandle     = oneDeviceData->agDevHandle;
  614 
  615   satSATADeviceReset( tiRoot,
  616                       oneDeviceData,
  617                       AGSA_PHY_HARD_RESET);
  618 
  619 }
  620 #endif /* 0 */
  621 #endif  /* #ifdef SATA_ENABLE */

Cache object: d39121c38f3df1cfb74a0469274c458d


[ 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.