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