xref: /freebsd/sys/dev/pms/RefTisa/sat/src/smproto.h (revision 43a5ec4eb41567cc92586503212743d89686d78f)
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 __SMPROTO_H__
25 #define __SMPROTO_H__
26 
27 #include <dev/pms/RefTisa/sat/src/smtypes.h>
28 
29 /***************** start of util ****************************************/
30 osGLOBAL FORCEINLINE void*
31 sm_memset(void *s, int c, bit32 n);
32 
33 osGLOBAL FORCEINLINE void *
34 sm_memcpy(void *dst, const void *src, bit32 count);
35 
36 osGLOBAL char
37 *sm_strncpy(char *dst, const char *src, bit32 len);
38 
39 
40 osGLOBAL void
41 smhexdump(const char *ptitle, bit8 *pbuf, size_t len);
42 /***************** end of util ****************************************/
43 
44 /***************** start of timer fns ****************************************/
45 osGLOBAL void
46 smTimerTick(smRoot_t 		*smRoot );
47 
48 osGLOBAL void
49 smInitTimerRequest(
50                    smRoot_t                *smRoot,
51                    smTimerRequest_t        *timerRequest
52                   );
53 osGLOBAL void
54 smSetTimerRequest(
55                   smRoot_t            *smRoot,
56                   smTimerRequest_t    *timerRequest,
57                   bit32               timeout,
58                   smTimerCBFunc_t     CBFunc,
59                   void                *timerData1,
60                   void                *timerData2,
61                   void                *timerData3
62                   );
63 
64 osGLOBAL void
65 smAddTimer(
66            smRoot_t            *smRoot,
67            smList_t            *timerListHdr,
68            smTimerRequest_t    *timerRequest
69           );
70 
71 osGLOBAL void
72 smKillTimer(
73             smRoot_t            *smRoot,
74             smTimerRequest_t    *timerRequest
75            );
76 
77 osGLOBAL void
78 smProcessTimers(
79                 smRoot_t *smRoot
80                );
81 
82 
83 /***************** end of timer fns ****************************************/
84 
85 osGLOBAL void
86 smInitTimers(
87              smRoot_t *smRoot
88             );
89 
90 osGLOBAL void
91 smDeviceDataInit(
92                  smRoot_t *smRoot,
93                  bit32    max_dev
94                 );
95 
96 osGLOBAL void
97 smIOInit(
98          smRoot_t *smRoot
99         );
100 
101 osGLOBAL FORCEINLINE void
102 smIOReInit(
103           smRoot_t          *smRoot,
104           smIORequestBody_t *smIORequestBody
105           );
106 
107 osGLOBAL void
108 smDeviceDataReInit(
109                    smRoot_t        *smRoot,
110                    smDeviceData_t  *oneDeviceData
111                   );
112 
113 osGLOBAL void
114 smEnqueueIO(
115              smRoot_t           *smRoot,
116              smSatIOContext_t   *satIOContext
117              );
118 
119 osGLOBAL FORCEINLINE void
120 smsatFreeIntIoResource(
121              smRoot_t           *smRoot,
122              smDeviceData_t     *satDevData,
123              smSatInternalIo_t  *satIntIo
124              );
125 
126 osGLOBAL smSatInternalIo_t *
127 smsatAllocIntIoResource(
128                         smRoot_t              *smRoot,
129                         smIORequest_t         *smIORequest,
130                         smDeviceData_t        *satDevData,
131                         bit32                 dmaAllocLength,
132                         smSatInternalIo_t     *satIntIo);
133 
134 
135 
136 osGLOBAL smDeviceData_t *
137 smAddToSharedcontext(
138                      smRoot_t                   *smRoot,
139                      agsaDevHandle_t            *agDevHandle,
140                      smDeviceHandle_t           *smDeviceHandle,
141                      agsaDevHandle_t            *agExpDevHandle,
142                      bit32                      phyID
143                     );
144 
145 osGLOBAL bit32
146 smRemoveFromSharedcontext(
147                           smRoot_t                      *smRoot,
148                           agsaDevHandle_t               *agDevHandle,
149                           smDeviceHandle_t              *smDeviceHandle
150                          );
151 
152 osGLOBAL smDeviceData_t *
153 smFindInSharedcontext(
154                       smRoot_t                  *smRoot,
155                       agsaDevHandle_t           *agDevHandle
156                       );
157 
158 osGLOBAL bit32
159 smsatLogSenseAllocate(
160                       smRoot_t                  *smRoot,
161                       smIORequest_t             *smIORequest,
162                       smDeviceHandle_t          *smDeviceHandle,
163                       smScsiInitiatorRequest_t  *smSCSIRequest,
164                       smSatIOContext_t            *satIOContext,
165                       bit32                     payloadSize,
166                       bit32                     flag
167                      );
168 
169 osGLOBAL bit32
170 smsatIDSubStart(
171                  smRoot_t                 *smRoot,
172                  smIORequest_t            *smIORequest,
173                  smDeviceHandle_t         *smDeviceHandle,
174                  smScsiInitiatorRequest_t *smSCSIRequest,
175                  smSatIOContext_t           *satIOContext
176                );
177 
178 
179 osGLOBAL bit32
180 smsatIDStart(
181               smRoot_t                  *smRoot,
182               smIORequest_t             *smIORequest,
183               smDeviceHandle_t          *smDeviceHandle,
184               smScsiInitiatorRequest_t  *smSCSIRequest,
185               smSatIOContext_t            *satIOContext
186              );
187 
188 
189 osGLOBAL FORCEINLINE bit32
190 smsatIOStart(
191               smRoot_t                  *smRoot,
192               smIORequest_t             *smIORequest,
193               smDeviceHandle_t          *smDeviceHandle,
194               smScsiInitiatorRequest_t  *smSCSIRequest,
195               smSatIOContext_t            *satIOContext
196              );
197 
198 osGLOBAL void
199 smsatSetSensePayload(
200                      smScsiRspSense_t   *pSense,
201                      bit8               SnsKey,
202                      bit32              SnsInfo,
203                      bit16              SnsCode,
204                      smSatIOContext_t     *satIOContext
205 		    );
206 
207 osGLOBAL void
208 smsatSetDeferredSensePayload(
209                              smScsiRspSense_t *pSense,
210                              bit8             SnsKey,
211                              bit32            SnsInfo,
212                              bit16            SnsCode,
213                              smSatIOContext_t   *satIOContext
214                             );
215 
216 osGLOBAL FORCEINLINE bit32
217 smsatIOPrepareSGL(
218                   smRoot_t                 *smRoot,
219                   smIORequestBody_t        *smIORequestBody,
220                   smSgl_t                  *smSgl1,
221                   void                     *sglVirtualAddr
222                   );
223 osGLOBAL FORCEINLINE void
224 smsatBitSet(smRoot_t *smRoot,bit8 *data, bit32 index);
225 
226 osGLOBAL FORCEINLINE void
227 smsatBitClear(smRoot_t *smRoot,bit8 *data, bit32 index);
228 
229 osGLOBAL FORCEINLINE BOOLEAN
230 smsatBitTest(smRoot_t *smRoot,bit8 *data, bit32 index);
231 
232 osGLOBAL FORCEINLINE bit32
233 smsatTagAlloc(
234                smRoot_t         *smRoot,
235                smDeviceData_t   *pSatDevData,
236                bit8             *pTag
237              );
238 
239 osGLOBAL FORCEINLINE bit32
240 smsatTagRelease(
241                 smRoot_t         *smRoot,
242                 smDeviceData_t   *pSatDevData,
243                 bit8              tag
244                );
245 
246 osGLOBAL FORCEINLINE void
247 smsatDecrementPendingIO(
248                         smRoot_t                *smRoot,
249                         smIntContext_t          *smAllShared,
250                         smSatIOContext_t        *satIOContext
251                         );
252 
253 osGLOBAL smSatIOContext_t *
254 smsatPrepareNewIO(
255                   smSatInternalIo_t       *satNewIntIo,
256                   smIORequest_t           *smOrgIORequest,
257                   smDeviceData_t          *satDevData,
258                   smIniScsiCmnd_t         *scsiCmnd,
259                   smSatIOContext_t        *satOrgIOContext
260                  );
261 
262 osGLOBAL void
263 smsatSetDevInfo(
264                  smDeviceData_t            *oneDeviceData,
265                  agsaSATAIdentifyData_t    *SATAIdData
266                );
267 
268 osGLOBAL void
269 smsatInquiryStandard(
270                      bit8                    *pInquiry,
271                      agsaSATAIdentifyData_t  *pSATAIdData,
272                      smIniScsiCmnd_t         *scsiCmnd
273                     );
274 
275 osGLOBAL void
276 smsatInquiryPage0(
277                    bit8                    *pInquiry,
278                    agsaSATAIdentifyData_t  *pSATAIdData
279 		 );
280 
281 osGLOBAL void
282 smsatInquiryPage83(
283                     bit8                    *pInquiry,
284                     agsaSATAIdentifyData_t  *pSATAIdData,
285                     smDeviceData_t          *oneDeviceData
286 		  );
287 
288 
289 osGLOBAL void
290 smsatInquiryPage89(
291                     bit8                    *pInquiry,
292                     agsaSATAIdentifyData_t  *pSATAIdData,
293                     smDeviceData_t          *oneDeviceData,
294                     bit32                   len
295 		  );
296 
297 osGLOBAL void
298 smsatInquiryPage80(
299                     bit8                    *pInquiry,
300                     agsaSATAIdentifyData_t  *pSATAIdData
301 		   );
302 
303 osGLOBAL void
304 smsatInquiryPageB1(
305                     bit8                    *pInquiry,
306                     agsaSATAIdentifyData_t  *pSATAIdData
307 		   );
308 
309 osGLOBAL void
310 smsatDefaultTranslation(
311                         smRoot_t                  *smRoot,
312                         smIORequest_t             *smIORequest,
313                         smSatIOContext_t            *satIOContext,
314                         smScsiRspSense_t          *pSense,
315                         bit8                      ataStatus,
316                         bit8                      ataError,
317                         bit32                     interruptContext
318                        );
319 
320 osGLOBAL bit32
321 smPhyControlSend(
322                   smRoot_t             *smRoot,
323                   smDeviceData_t       *oneDeviceData,
324                   bit8                 phyOp,
325                   smIORequest_t        *CurrentTaskTag,
326                   bit32                queueNumber
327                 );
328 
329 osGLOBAL bit32
330 smsatTaskManagement(
331                     smRoot_t          *smRoot,
332                     smDeviceHandle_t  *smDeviceHandle,
333                     bit32             task,
334                     smLUN_t           *lun,
335                     smIORequest_t     *taskTag,
336                     smIORequest_t     *currentTaskTag,
337                     smIORequestBody_t *smIORequestBody
338 		   );
339 
340 osGLOBAL bit32
341 smsatTmAbortTask(
342                   smRoot_t                  *smRoot,
343                   smIORequest_t             *currentTaskTag,
344                   smDeviceHandle_t          *smDeviceHandle,
345                   smScsiInitiatorRequest_t  *tiScsiRequest,
346                   smSatIOContext_t            *satIOContext,
347                   smIORequest_t             *taskTag);
348 
349 osGLOBAL bit32
350 smsatStartCheckPowerMode(
351                          smRoot_t                  *smRoot,
352                          smIORequest_t             *currentTaskTag,
353                          smDeviceHandle_t          *smDeviceHandle,
354                          smScsiInitiatorRequest_t  *smScsiRequest,
355                          smSatIOContext_t            *satIOContext
356                         );
357 osGLOBAL bit32
358 smsatStartResetDevice(
359                        smRoot_t                  *smRoot,
360                        smIORequest_t             *currentTaskTag,
361                        smDeviceHandle_t          *smDeviceHandle,
362                        smScsiInitiatorRequest_t  *smScsiRequest,
363                        smSatIOContext_t            *satIOContext
364                      );
365 osGLOBAL void
366 smsatAbort(
367            smRoot_t          *smRoot,
368            agsaRoot_t        *agRoot,
369            smSatIOContext_t    *satIOContext
370 	  );
371 
372 osGLOBAL smIORequestBody_t *
373 smDequeueIO(smRoot_t          *smRoot);
374 
375 osGLOBAL bit32
376 smsatDecodeSATADeviceType(bit8 * pSignature);
377 
378 /******************************** beginning of start ******************************************************/
379 
380 /*! \brief SAT implementation for ATAPI Packet Command.
381  *
382  *  SAT implementation for ATAPI Packet and send FIS request to LL layer.
383  *
384  *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
385  *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
386  *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
387  *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
388  *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
389  *
390  *  \return If command is started successfully
391  *    - \e smIOSuccess: 	  I/O request successfully initiated.
392  *    - \e smIOBusy:        No resources available, try again later.
393  *    - \e smIOIONoDevice:  Invalid device handle.
394  *    - \e smIOError:       Other errors.
395  */
396 /*****************************************************************************/
397 osGLOBAL bit32
398 smsatPacket(
399             smRoot_t                  *smRoot,
400             smIORequest_t             *smIORequest,
401             smDeviceHandle_t          *smDeviceHandle,
402             smScsiInitiatorRequest_t  *smScsiRequest,
403             smSatIOContext_t            *satIOContext
404             );
405 
406 osGLOBAL void
407 smsatPacketCB(
408             agsaRoot_t        *agRoot,
409             agsaIORequest_t   *agIORequest,
410             bit32             agIOStatus,
411             agsaFisHeader_t   *agFirstDword,
412             bit32             agIOInfoLen,
413             void              *agParam,
414             void              *ioContext
415             );
416 /*****************************************************************************/
417 /*! \brief SAT implementation for smsatExecuteDeviceDiagnostic.
418  *
419  *  This function creates Execute Device Diagnostic fis and sends the request to LL layer
420  *
421  *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
422  *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
423  *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
424  *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
425  *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
426  *
427  *  \return If command is started successfully
428  *    - \e smIOSuccess: 	  I/O request successfully initiated.
429  *    - \e smIOBusy:        No resources available, try again later.
430  *    - \e smIOIONoDevice:  Invalid device handle.
431  *    - \e smIOError:       Other errors.
432 
433  */
434 /*****************************************************************************/
435 osGLOBAL bit32
436 smsatExecuteDeviceDiagnostic(
437        smRoot_t                  *smRoot,
438        smIORequest_t             *smIORequest,
439        smDeviceHandle_t          *smDeviceHandle,
440        smScsiInitiatorRequest_t  *smScsiRequest,
441        smSatIOContext_t            *satIOContext
442        );
443 
444 osGLOBAL void
445 smsatExecuteDeviceDiagnosticCB(
446        agsaRoot_t        *agRoot,
447        agsaIORequest_t   *agIORequest,
448        bit32             agIOStatus,
449        agsaFisHeader_t   *agFirstDword,
450        bit32             agIOInfoLen,
451        void              *agParam,
452        void              *ioContext
453        );
454 /* set feature for auto activate */
455 osGLOBAL bit32
456 smsatSetFeaturesAA(
457            smRoot_t                  *smRoot,
458            smIORequest_t             *smIORequest,
459            smDeviceHandle_t          *smDeviceHandle,
460            smScsiInitiatorRequest_t  *smScsiRequest,
461            smSatIOContext_t            *satIOContext
462            );
463 osGLOBAL void
464 smsatSetFeaturesAACB(
465          agsaRoot_t        *agRoot,
466          agsaIORequest_t   *agIORequest,
467          bit32             agIOStatus,
468          agsaFisHeader_t   *agFirstDword,
469          bit32             agIOInfoLen,
470          void              *agParam,
471          void              *ioContext
472          );
473 
474 /*****************************************************************************/
475 /*! \brief SAT implementation for satSetFeatures.
476  *
477  *  This function creates SetFeatures fis and sends the request to LL layer
478  *
479  *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
480  *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
481  *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
482  *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
483  *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
484  *
485  *  \return If command is started successfully
486  *    - \e smIOSuccess: 	  I/O request successfully initiated.
487  *    - \e smIOBusy:        No resources available, try again later.
488  *    - \e smIOIONoDevice:  Invalid device handle.
489  *    - \e smIOError:       Other errors.
490  */
491 /*****************************************************************************/
492 osGLOBAL bit32
493 smsatSetFeaturesPIO(
494            smRoot_t                  *smRoot,
495            smIORequest_t             *smIORequest,
496            smDeviceHandle_t          *smDeviceHandle,
497            smScsiInitiatorRequest_t  *smScsiRequest,
498            smSatIOContext_t          *satIOContext
499            );
500 osGLOBAL void
501 smsatSetFeaturesPIOCB(
502           agsaRoot_t        *agRoot,
503           agsaIORequest_t   *agIORequest,
504           bit32             agIOStatus,
505           agsaFisHeader_t   *agFirstDword,
506           bit32             agIOInfoLen,
507           void              *agParam,
508           void              *ioContext
509           );
510 
511 osGLOBAL bit32
512 smsatSetFeaturesDMA(
513            smRoot_t                  *smRoot,
514            smIORequest_t             *smIORequest,
515            smDeviceHandle_t          *smDeviceHandle,
516            smScsiInitiatorRequest_t  *smScsiRequest,
517            smSatIOContext_t            *satIOContext
518            );
519 
520 osGLOBAL void
521 smsatSetFeaturesDMACB(
522          agsaRoot_t        *agRoot,
523          agsaIORequest_t   *agIORequest,
524          bit32             agIOStatus,
525          agsaFisHeader_t   *agFirstDword,
526          bit32             agIOInfoLen,
527          void              *agParam,
528          void              *ioContext
529          );
530 
531 osGLOBAL bit32
532 smsatSetFeaturesReadLookAhead(
533            smRoot_t                  *smRoot,
534            smIORequest_t             *smIORequest,
535            smDeviceHandle_t          *smDeviceHandle,
536            smScsiInitiatorRequest_t  *smScsiRequest,
537            smSatIOContext_t            *satIOContext
538            );
539 
540 osGLOBAL void
541 smsatSetFeaturesReadLookAheadCB(
542          agsaRoot_t        *agRoot,
543          agsaIORequest_t   *agIORequest,
544          bit32             agIOStatus,
545          agsaFisHeader_t   *agFirstDword,
546          bit32             agIOInfoLen,
547          void              *agParam,
548          void              *ioContext
549          );
550 
551 osGLOBAL bit32
552 smsatSetFeaturesVolatileWriteCache(
553            smRoot_t                  *smRoot,
554            smIORequest_t             *smIORequest,
555            smDeviceHandle_t          *smDeviceHandle,
556            smScsiInitiatorRequest_t  *smScsiRequest,
557            smSatIOContext_t            *satIOContext
558            );
559 
560 osGLOBAL void
561 smsatSetFeaturesVolatileWriteCacheCB(
562          agsaRoot_t        *agRoot,
563          agsaIORequest_t   *agIORequest,
564          bit32             agIOStatus,
565          agsaFisHeader_t   *agFirstDword,
566          bit32             agIOInfoLen,
567          void              *agParam,
568          void              *ioContext
569          );
570 
571 osGLOBAL void
572 smsatSMARTEnablePassCB(
573                      agsaRoot_t        *agRoot,
574                      agsaIORequest_t   *agIORequest,
575                      bit32             agIOStatus,
576                      agsaFisHeader_t   *agFirstDword,
577                      bit32             agIOInfoLen,
578                      agsaFrameHandle_t agFrameHandle,
579                      void              *ioContext
580                     );
581 
582 osGLOBAL void
583 smsatSMARTRStatusPassCB(
584                 agsaRoot_t        *agRoot,
585                 agsaIORequest_t   *agIORequest,
586                 bit32             agIOStatus,
587                 agsaFisHeader_t   *agFirstDword,
588                 bit32             agIOInfoLen,
589                 void              *agParam,
590                 void              *ioContext
591                );
592 osGLOBAL void
593 smsatSMARTReadLogCB(
594                 agsaRoot_t        *agRoot,
595                 agsaIORequest_t   *agIORequest,
596                 bit32             agIOStatus,
597                 agsaFisHeader_t   *agFirstDword,
598                 bit32             agIOInfoLen,
599                 void              *agParam,
600                 void              *ioContext
601                );
602 
603 
604 /*****************************************************************************/
605 /*! \brief SAT implementation for SCSI REQUEST SENSE to ATAPI device.
606  *
607  *  SAT implementation for SCSI REQUEST SENSE.
608  *
609  *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
610  *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
611  *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
612  *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
613  *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
614  *
615  *  \return If command is started successfully
616  *    - \e smIOSuccess: 	  I/O request successfully initiated.
617  *    - \e smIOBusy:        No resources available, try again later.
618  *    - \e smIOIONoDevice:  Invalid device handle.
619  *    - \e smIOError:       Other errors.
620  */
621 /*****************************************************************************/
622 osGLOBAL bit32
623 smsatRequestSenseForATAPI(
624         smRoot_t                  *smRoot,
625         smIORequest_t             *smIORequest,
626         smDeviceHandle_t          *smDeviceHandle,
627         smScsiInitiatorRequest_t  *smScsiRequest,
628         smSatIOContext_t            *satIOContext
629         );
630 
631 osGLOBAL void
632 smsatRequestSenseForATAPICB(
633         agsaRoot_t        *agRoot,
634         agsaIORequest_t   *agIORequest,
635         bit32             agIOStatus,
636         agsaFisHeader_t   *agFirstDword,
637         bit32             agIOInfoLen,
638         void              *agParam,
639         void              *ioContext
640         );
641 
642 /*****************************************************************************/
643 /*! \brief SAT implementation for smsatDeviceReset.
644  *
645  *  This function creates DEVICE RESET fis and sends the request to LL layer
646  *
647  *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
648  *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
649  *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
650  *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
651  *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
652  *
653  *  \return If command is started successfully
654  *    - \e smIOSuccess: 	  I/O request successfully initiated.
655  *    - \e smIOBusy:        No resources available, try again later.
656  *    - \e smIONoDevice:  Invalid device handle.
657  *    - \e smIOError:       Other errors.
658  */
659 /*****************************************************************************/
660 osGLOBAL bit32
661 smsatDeviceReset(
662         smRoot_t                  *smRoot,
663         smIORequest_t             *smIORequest,
664         smDeviceHandle_t          *smDeviceHandle,
665         smScsiInitiatorRequest_t  *smScsiRequest,
666         smSatIOContext_t            *satIOContext
667         );
668 
669 osGLOBAL void
670 smsatDeviceResetCB(
671          agsaRoot_t        *agRoot,
672          agsaIORequest_t   *agIORequest,
673          bit32             agIOStatus,
674          agsaFisHeader_t   *agFirstDword,
675          bit32             agIOInfoLen,
676          void              *agParam,
677          void              *ioContext
678          );
679 
680 
681 osGLOBAL void
682 smsatTranslateATAPIErrorsToSCSIErrors(
683         bit8   bCommand,
684         bit8   bATAStatus,
685         bit8   bATAError,
686         bit8   *pSenseKey,
687         bit16  *pSenseCodeInfo
688         );
689 
690 GLOBAL void
691 smsatTranslateATAErrorsToSCSIErrors(
692     bit8   bATAStatus,
693     bit8   bATAError,
694     bit8   *pSenseKey,
695     bit16  *pSenseCodeInfo
696     );
697 
698 /*****************************************************************************/
699 
700 osGLOBAL bit32
701 smsatRead6(
702            smRoot_t                  *smRoot,
703            smIORequest_t             *smIORequest,
704            smDeviceHandle_t          *smDeviceHandle,
705            smScsiInitiatorRequest_t  *smScsiRequest,
706            smSatIOContext_t            *satIOContext
707 	  );
708 
709 osGLOBAL FORCEINLINE bit32
710 smsatRead10(
711             smRoot_t                  *smRoot,
712             smIORequest_t             *smIORequest,
713             smDeviceHandle_t          *smDeviceHandle,
714             smScsiInitiatorRequest_t  *smScsiRequest,
715             smSatIOContext_t            *satIOContext
716 	   );
717 
718 osGLOBAL bit32
719 smsatRead12(
720             smRoot_t                  *smRoot,
721             smIORequest_t             *smIORequest,
722             smDeviceHandle_t          *smDeviceHandle,
723             smScsiInitiatorRequest_t  *smScsiRequest,
724             smSatIOContext_t            *satIOContext
725 	   );
726 
727 osGLOBAL bit32
728 smsatRead16(
729             smRoot_t                  *smRoot,
730             smIORequest_t             *smIORequest,
731             smDeviceHandle_t          *smDeviceHandle,
732             smScsiInitiatorRequest_t  *smScsiRequest,
733             smSatIOContext_t            *satIOContext
734 	   );
735 
736 osGLOBAL bit32
737 smsatWrite6(
738             smRoot_t                  *smRoot,
739             smIORequest_t             *smIORequest,
740             smDeviceHandle_t          *smDeviceHandle,
741             smScsiInitiatorRequest_t  *smScsiRequest,
742             smSatIOContext_t            *satIOContext
743 	   );
744 
745 osGLOBAL FORCEINLINE bit32
746 smsatWrite10(
747              smRoot_t                  *smRoot,
748              smIORequest_t             *smIORequest,
749              smDeviceHandle_t          *smDeviceHandle,
750              smScsiInitiatorRequest_t  *smScsiRequest,
751              smSatIOContext_t            *satIOContext
752             );
753 
754 osGLOBAL bit32
755 smsatWrite12(
756              smRoot_t                  *smRoot,
757              smIORequest_t             *smIORequest,
758              smDeviceHandle_t          *smDeviceHandle,
759              smScsiInitiatorRequest_t  *smScsiRequest,
760              smSatIOContext_t            *satIOContext
761             );
762 
763 osGLOBAL bit32
764 smsatWrite16(
765              smRoot_t                  *smRoot,
766              smIORequest_t             *smIORequest,
767              smDeviceHandle_t          *smDeviceHandle,
768              smScsiInitiatorRequest_t  *smScsiRequest,
769              smSatIOContext_t            *satIOContext
770             );
771 
772 osGLOBAL bit32
773 smsatVerify10(
774               smRoot_t                  *smRoot,
775               smIORequest_t             *smIORequest,
776               smDeviceHandle_t          *smDeviceHandle,
777               smScsiInitiatorRequest_t  *smScsiRequest,
778               smSatIOContext_t            *satIOContext
779              );
780 
781 osGLOBAL bit32
782 smsatVerify12(
783               smRoot_t                  *smRoot,
784               smIORequest_t             *smIORequest,
785               smDeviceHandle_t          *smDeviceHandle,
786               smScsiInitiatorRequest_t  *smScsiRequest,
787               smSatIOContext_t            *satIOContext
788              );
789 
790 osGLOBAL bit32
791 smsatVerify16(
792               smRoot_t                  *smRoot,
793               smIORequest_t             *smIORequest,
794               smDeviceHandle_t          *smDeviceHandle,
795               smScsiInitiatorRequest_t  *smScsiRequest,
796               smSatIOContext_t            *satIOContext
797              );
798 
799 osGLOBAL bit32
800 smsatTestUnitReady(
801                    smRoot_t                  *smRoot,
802                    smIORequest_t             *smIORequest,
803                    smDeviceHandle_t          *smDeviceHandle,
804                    smScsiInitiatorRequest_t  *smScsiRequest,
805                    smSatIOContext_t            *satIOContext
806                   );
807 
808 osGLOBAL bit32
809 smsatInquiry(
810              smRoot_t                  *smRoot,
811              smIORequest_t             *smIORequest,
812              smDeviceHandle_t          *smDeviceHandle,
813              smScsiInitiatorRequest_t  *smScsiRequest,
814              smSatIOContext_t            *satIOContext
815             );
816 
817 osGLOBAL bit32
818 smsatRequestSense(
819                   smRoot_t                  *smRoot,
820                   smIORequest_t             *smIORequest,
821                   smDeviceHandle_t          *smDeviceHandle,
822                   smScsiInitiatorRequest_t  *smScsiRequest,
823                   smSatIOContext_t            *satIOContext
824                  );
825 
826 osGLOBAL bit32
827 smsatModeSense6(
828                 smRoot_t                  *smRoot,
829                 smIORequest_t             *smIORequest,
830                 smDeviceHandle_t          *smDeviceHandle,
831                 smScsiInitiatorRequest_t  *smScsiRequest,
832                 smSatIOContext_t            *satIOContext
833                );
834 
835 osGLOBAL bit32
836 smsatModeSense10(
837                   smRoot_t                  *smRoot,
838                   smIORequest_t             *smIORequest,
839                   smDeviceHandle_t          *smDeviceHandle,
840                   smScsiInitiatorRequest_t  *smScsiRequest,
841                   smSatIOContext_t            *satIOContext
842                  );
843 
844 osGLOBAL bit32
845 smsatReadCapacity10(
846                     smRoot_t                  *smRoot,
847                     smIORequest_t             *smIORequest,
848                     smDeviceHandle_t          *smDeviceHandle,
849                     smScsiInitiatorRequest_t  *smScsiRequest,
850                     smSatIOContext_t            *satIOContext
851                    );
852 
853 osGLOBAL bit32
854 smsatReadCapacity16(
855                     smRoot_t                  *smRoot,
856                     smIORequest_t             *smIORequest,
857                     smDeviceHandle_t          *smDeviceHandle,
858                     smScsiInitiatorRequest_t  *smScsiRequest,
859                     smSatIOContext_t            *satIOContext
860                    );
861 
862 osGLOBAL bit32
863 smsatReportLun(
864                smRoot_t                  *smRoot,
865                smIORequest_t             *smIORequest,
866                smDeviceHandle_t          *smDeviceHandle,
867                smScsiInitiatorRequest_t  *smScsiRequest,
868                smSatIOContext_t            *satIOContext
869               );
870 
871 osGLOBAL bit32
872 smsatFormatUnit(
873                 smRoot_t                  *smRoot,
874                 smIORequest_t             *smIORequest,
875                 smDeviceHandle_t          *smDeviceHandle,
876                 smScsiInitiatorRequest_t  *smScsiRequest,
877                 smSatIOContext_t            *satIOContext
878                );
879 
880 osGLOBAL bit32
881 smsatSendDiagnostic(
882                     smRoot_t                  *smRoot,
883                     smIORequest_t             *smIORequest,
884                     smDeviceHandle_t          *smDeviceHandle,
885                     smScsiInitiatorRequest_t  *smScsiRequest,
886                     smSatIOContext_t            *satIOContext
887                    );
888 
889 osGLOBAL bit32
890 smsatStartStopUnit(
891                    smRoot_t                  *smRoot,
892                    smIORequest_t             *smIORequest,
893                    smDeviceHandle_t          *smDeviceHandle,
894                    smScsiInitiatorRequest_t  *smScsiRequest,
895                    smSatIOContext_t            *satIOContext
896                   );
897 
898 osGLOBAL bit32
899 smsatWriteSame10(
900                   smRoot_t                  *smRoot,
901                   smIORequest_t             *smIORequest,
902                   smDeviceHandle_t          *smDeviceHandle,
903                   smScsiInitiatorRequest_t  *smScsiRequest,
904                   smSatIOContext_t            *satIOContext
905                  );
906 
907 osGLOBAL bit32
908 smsatWriteSame16(
909                   smRoot_t                  *smRoot,
910                   smIORequest_t             *smIORequest,
911                   smDeviceHandle_t          *smDeviceHandle,
912                   smScsiInitiatorRequest_t  *smScsiRequest,
913                   smSatIOContext_t            *satIOContext
914                  );
915 
916 osGLOBAL bit32
917 smsatLogSense(
918               smRoot_t                  *smRoot,
919               smIORequest_t             *smIORequest,
920               smDeviceHandle_t          *smDeviceHandle,
921               smScsiInitiatorRequest_t  *smScsiRequest,
922               smSatIOContext_t            *satIOContext
923              );
924 
925 osGLOBAL bit32
926 smsatModeSelect6(
927                  smRoot_t                  *smRoot,
928                  smIORequest_t             *smIORequest,
929                  smDeviceHandle_t          *smDeviceHandle,
930                  smScsiInitiatorRequest_t  *smScsiRequest,
931                  smSatIOContext_t            *satIOContext
932                 );
933 
934 
935 osGLOBAL bit32
936 smsatModeSelect10(
937                   smRoot_t                  *smRoot,
938                   smIORequest_t             *smIORequest,
939                   smDeviceHandle_t          *smDeviceHandle,
940                   smScsiInitiatorRequest_t  *smScsiRequest,
941                   smSatIOContext_t            *satIOContext
942                  );
943 
944 osGLOBAL bit32
945 smsatSynchronizeCache10(
946                         smRoot_t                  *smRoot,
947                         smIORequest_t             *smIORequest,
948                         smDeviceHandle_t          *smDeviceHandle,
949                         smScsiInitiatorRequest_t  *smScsiRequest,
950                         smSatIOContext_t            *satIOContext
951                        );
952 
953 osGLOBAL bit32
954 smsatSynchronizeCache16(
955                         smRoot_t                  *smRoot,
956                         smIORequest_t             *smIORequest,
957                         smDeviceHandle_t          *smDeviceHandle,
958                         smScsiInitiatorRequest_t  *smScsiRequest,
959                         smSatIOContext_t            *satIOContext
960                        );
961 
962 osGLOBAL bit32
963 smsatWriteAndVerify10(
964                       smRoot_t                  *smRoot,
965                       smIORequest_t             *smIORequest,
966                       smDeviceHandle_t          *smDeviceHandle,
967                       smScsiInitiatorRequest_t  *smScsiRequest,
968                       smSatIOContext_t            *satIOContext
969                      );
970 
971 osGLOBAL bit32
972 smsatWriteAndVerify12(
973                       smRoot_t                  *smRoot,
974                       smIORequest_t             *smIORequest,
975                       smDeviceHandle_t          *smDeviceHandle,
976                       smScsiInitiatorRequest_t  *smScsiRequest,
977                       smSatIOContext_t            *satIOContext
978                      );
979 
980 osGLOBAL bit32
981 smsatWriteAndVerify16(
982                       smRoot_t                  *smRoot,
983                       smIORequest_t             *smIORequest,
984                       smDeviceHandle_t          *smDeviceHandle,
985                       smScsiInitiatorRequest_t  *smScsiRequest,
986                       smSatIOContext_t            *satIOContext
987                      );
988 
989 osGLOBAL bit32
990 smsatReadMediaSerialNumber(
991                            smRoot_t                  *smRoot,
992                            smIORequest_t             *smIORequest,
993                            smDeviceHandle_t          *smDeviceHandle,
994                            smScsiInitiatorRequest_t  *smScsiRequest,
995                            smSatIOContext_t            *satIOContext
996                           );
997 
998 osGLOBAL bit32
999 smsatReadBuffer(
1000                 smRoot_t                  *smRoot,
1001                 smIORequest_t             *smIORequest,
1002                 smDeviceHandle_t          *smDeviceHandle,
1003                 smScsiInitiatorRequest_t  *smScsiRequest,
1004                 smSatIOContext_t            *satIOContext
1005                );
1006 
1007 osGLOBAL bit32
1008 smsatWriteBuffer(
1009                  smRoot_t                  *smRoot,
1010                  smIORequest_t             *smIORequest,
1011                  smDeviceHandle_t          *smDeviceHandle,
1012                  smScsiInitiatorRequest_t  *smScsiRequest,
1013                  smSatIOContext_t            *satIOContext
1014                 );
1015 
1016 osGLOBAL bit32
1017 smsatReassignBlocks(
1018                     smRoot_t                  *smRoot,
1019                     smIORequest_t             *smIORequest,
1020                     smDeviceHandle_t          *smDeviceHandle,
1021                     smScsiInitiatorRequest_t  *smScsiRequest,
1022                     smSatIOContext_t            *satIOContext
1023                    );
1024 
1025 osGLOBAL bit32
1026 smsatPassthrough(
1027                     smRoot_t                  *smRoot,
1028                     smIORequest_t             *smIORequest,
1029                     smDeviceHandle_t          *smDeviceHandle,
1030                     smScsiInitiatorRequest_t  *smScsiRequest,
1031                     smSatIOContext_t            *satIOContext
1032                    );
1033 
1034 osGLOBAL FORCEINLINE bit32
1035 smsataLLIOStart(
1036                 smRoot_t                  *smRoot,
1037                 smIORequest_t             *smIORequest,
1038                 smDeviceHandle_t          *smDeviceHandle,
1039                 smScsiInitiatorRequest_t  *smScsiRequest,
1040                 smSatIOContext_t            *satIOContext
1041                );
1042 osGLOBAL bit32
1043 smsatTestUnitReady_1(
1044                      smRoot_t                  *smRoot,
1045                      smIORequest_t             *smIORequest,
1046                      smDeviceHandle_t          *smDeviceHandle,
1047                      smScsiInitiatorRequest_t  *smScsiRequest,
1048                      smSatIOContext_t            *satIOContext
1049                     );
1050 osGLOBAL bit32
1051 smsatStartIDDev(
1052                 smRoot_t                  *smRoot,
1053                 smIORequest_t             *smIORequest,
1054                 smDeviceHandle_t          *smDeviceHandle,
1055                 smScsiInitiatorRequest_t  *smScsiRequest,
1056                 smSatIOContext_t            *satIOContext
1057                );
1058 
1059 osGLOBAL bit32
1060 smsatSendIDDev(
1061                 smRoot_t                  *smRoot,
1062                 smIORequest_t             *smIORequest,
1063                 smDeviceHandle_t          *smDeviceHandle,
1064                 smScsiInitiatorRequest_t  *smScsiRequest,
1065                 smSatIOContext_t            *satIOContext
1066                );
1067 
1068 osGLOBAL bit32
1069 smsatRequestSense_1(
1070                     smRoot_t                  *smRoot,
1071                     smIORequest_t             *smIORequest,
1072                     smDeviceHandle_t          *smDeviceHandle,
1073                     smScsiInitiatorRequest_t  *smScsiRequest,
1074                     smSatIOContext_t            *satIOContext
1075                    );
1076 
1077 osGLOBAL bit32
1078 smsatSMARTEnable(
1079                  smRoot_t                  *smRoot,
1080                  smIORequest_t             *smIORequest,
1081                  smDeviceHandle_t          *smDeviceHandle,
1082                  smScsiInitiatorRequest_t  *smScsiRequest,
1083                  smSatIOContext_t            *satIOContext
1084                );
1085 
1086 osGLOBAL bit32
1087 smsatLogSense_2(
1088                 smRoot_t                  *smRoot,
1089                 smIORequest_t             *smIORequest,
1090                 smDeviceHandle_t          *smDeviceHandle,
1091                 smScsiInitiatorRequest_t  *smScsiRequest,
1092                 smSatIOContext_t            *satIOContext
1093                );
1094 
1095 osGLOBAL bit32
1096 smsatLogSense_3(
1097                 smRoot_t                  *smRoot,
1098                 smIORequest_t             *smIORequest,
1099                 smDeviceHandle_t          *smDeviceHandle,
1100                 smScsiInitiatorRequest_t  *smScsiRequest,
1101                 smSatIOContext_t            *satIOContext
1102                );
1103 
1104 osGLOBAL bit32
1105 smsatRead_1(
1106             smRoot_t                  *smRoot,
1107             smIORequest_t             *smIORequest,
1108             smDeviceHandle_t          *smDeviceHandle,
1109             smScsiInitiatorRequest_t  *smScsiRequest,
1110             smSatIOContext_t            *satIOContext
1111           );
1112 
1113 osGLOBAL bit32
1114 smsatWrite_1(
1115              smRoot_t                  *smRoot,
1116              smIORequest_t             *smIORequest,
1117              smDeviceHandle_t          *smDeviceHandle,
1118              smScsiInitiatorRequest_t  *smScsiRequest,
1119              smSatIOContext_t            *satIOContext
1120            );
1121 
1122 osGLOBAL bit32
1123 smsatNonChainedWriteNVerify_Verify(
1124                                    smRoot_t                  *smRoot,
1125                                    smIORequest_t             *smIORequest,
1126                                    smDeviceHandle_t          *smDeviceHandle,
1127                                    smScsiInitiatorRequest_t  *smScsiRequest,
1128                                    smSatIOContext_t            *satIOContext
1129                                   );
1130 
1131 osGLOBAL bit32
1132 smsatChainedWriteNVerify_Start_Verify(
1133                                       smRoot_t                  *smRoot,
1134                                       smIORequest_t             *smIORequest,
1135                                       smDeviceHandle_t          *smDeviceHandle,
1136                                       smScsiInitiatorRequest_t  *smScsiRequest,
1137                                       smSatIOContext_t            *satIOContext
1138                                      );
1139 
1140 osGLOBAL bit32
1141 smsatChainedWriteNVerify_Write(
1142                                smRoot_t                  *smRoot,
1143                                smIORequest_t             *smIORequest,
1144                                smDeviceHandle_t          *smDeviceHandle,
1145                                smScsiInitiatorRequest_t  *smScsiRequest,
1146                                smSatIOContext_t            *satIOContext
1147                               );
1148 
1149 osGLOBAL bit32
1150 smsatChainedWriteNVerify_Verify(
1151                                 smRoot_t                  *smRoot,
1152                                 smIORequest_t             *smIORequest,
1153                                 smDeviceHandle_t          *smDeviceHandle,
1154                                 smScsiInitiatorRequest_t  *smScsiRequest,
1155                                 smSatIOContext_t            *satIOContext
1156                                );
1157 osGLOBAL bit32
1158 smsatChainedVerify(
1159                     smRoot_t                  *smRoot,
1160                     smIORequest_t             *smIORequest,
1161                     smDeviceHandle_t          *smDeviceHandle,
1162                     smScsiInitiatorRequest_t  *smScsiRequest,
1163                     smSatIOContext_t            *satIOContext
1164 		   );
1165 
1166 osGLOBAL bit32
1167 smsatWriteSame10_1(
1168                     smRoot_t                  *smRoot,
1169                     smIORequest_t             *smIORequest,
1170                     smDeviceHandle_t          *smDeviceHandle,
1171                     smScsiInitiatorRequest_t  *smScsiRequest,
1172                     smSatIOContext_t            *satIOContext,
1173                     bit32                     lba
1174                   );
1175 
1176 osGLOBAL bit32
1177 smsatWriteSame10_2(
1178                     smRoot_t                  *smRoot,
1179                     smIORequest_t             *smIORequest,
1180                     smDeviceHandle_t          *smDeviceHandle,
1181                     smScsiInitiatorRequest_t  *smScsiRequest,
1182                     smSatIOContext_t            *satIOContext,
1183                     bit32                     lba
1184                   );
1185 
1186 osGLOBAL bit32
1187 smsatWriteSame10_3(
1188                     smRoot_t                  *smRoot,
1189                     smIORequest_t             *smIORequest,
1190                     smDeviceHandle_t          *smDeviceHandle,
1191                     smScsiInitiatorRequest_t  *smScsiRequest,
1192                     smSatIOContext_t            *satIOContext,
1193                     bit32                     lba
1194                   );
1195 
1196 osGLOBAL bit32
1197 smsatStartStopUnit_1(
1198                      smRoot_t                  *smRoot,
1199                      smIORequest_t             *smIORequest,
1200                      smDeviceHandle_t          *smDeviceHandle,
1201                      smScsiInitiatorRequest_t  *smScsiRequest,
1202                      smSatIOContext_t            *satIOContext
1203 		    );
1204 
1205 osGLOBAL bit32
1206 smsatSendDiagnostic_1(
1207                       smRoot_t                  *smRoot,
1208                       smIORequest_t             *smIORequest,
1209                       smDeviceHandle_t          *smDeviceHandle,
1210                       smScsiInitiatorRequest_t  *smScsiRequest,
1211                       smSatIOContext_t            *satIOContext
1212 		     );
1213 
1214 osGLOBAL bit32
1215 smsatSendDiagnostic_2(
1216                       smRoot_t                  *smRoot,
1217                       smIORequest_t             *smIORequest,
1218                       smDeviceHandle_t          *smDeviceHandle,
1219                       smScsiInitiatorRequest_t  *smScsiRequest,
1220                       smSatIOContext_t            *satIOContext
1221 		     );
1222 
1223 osGLOBAL bit32
1224 smsatModeSelect6n10_1(
1225                       smRoot_t                  *smRoot,
1226                       smIORequest_t             *smIORequest,
1227                       smDeviceHandle_t          *smDeviceHandle,
1228                       smScsiInitiatorRequest_t  *smScsiRequest,
1229                       smSatIOContext_t            *satIOContext
1230 		     );
1231 
1232 osGLOBAL bit32
1233 smsatLogSense_1(
1234                 smRoot_t                  *smRoot,
1235                 smIORequest_t             *smIORequest,
1236                 smDeviceHandle_t          *smDeviceHandle,
1237                 smScsiInitiatorRequest_t  *smScsiRequest,
1238                 smSatIOContext_t            *satIOContext
1239                );
1240 
1241 osGLOBAL bit32
1242 smsatReassignBlocks_2(
1243                       smRoot_t                  *smRoot,
1244                       smIORequest_t             *smIORequest,
1245                       smDeviceHandle_t          *smDeviceHandle,
1246                       smScsiInitiatorRequest_t  *smScsiRequest,
1247                       smSatIOContext_t            *satIOContext,
1248                       bit8                      *LBA
1249                      );
1250 
1251 osGLOBAL bit32
1252 smsatReassignBlocks_1(
1253                       smRoot_t                  *smRoot,
1254                       smIORequest_t             *smIORequest,
1255                       smDeviceHandle_t          *smDeviceHandle,
1256                       smScsiInitiatorRequest_t  *smScsiRequest,
1257                       smSatIOContext_t            *satIOContext,
1258                       smSatIOContext_t            *satOrgIOContext
1259                      );
1260 
1261 osGLOBAL bit32
1262 smsatSendReadLogExt(
1263                      smRoot_t                  *smRoot,
1264                      smIORequest_t             *smIORequest,
1265                      smDeviceHandle_t          *smDeviceHandle,
1266                      smScsiInitiatorRequest_t  *smScsiRequest,
1267                      smSatIOContext_t            *satIOContext
1268 		   );
1269 
1270 osGLOBAL bit32
1271 smsatCheckPowerMode(
1272                      smRoot_t                  *smRoot,
1273                      smIORequest_t             *smIORequest,
1274                      smDeviceHandle_t          *smDeviceHandle,
1275                      smScsiInitiatorRequest_t  *smScsiRequest,
1276                      smSatIOContext_t            *satIOContext
1277 		   );
1278 
1279 osGLOBAL bit32
1280 smsatResetDevice(
1281                   smRoot_t                  *smRoot,
1282                   smIORequest_t             *smIORequest,
1283                   smDeviceHandle_t          *smDeviceHandle,
1284                   smScsiInitiatorRequest_t  *smScsiRequest,
1285                   smSatIOContext_t            *satIOContext
1286                 );
1287 
1288 osGLOBAL bit32
1289 smsatDeResetDevice(
1290                     smRoot_t                  *smRoot,
1291                     smIORequest_t             *smIORequest,
1292                     smDeviceHandle_t          *smDeviceHandle,
1293                     smScsiInitiatorRequest_t  *smScsiRequest,
1294                     smSatIOContext_t            *satIOContext
1295                    );
1296 /******************************** beginning of completion ******************************************************/
1297 osGLOBAL FORCEINLINE void
1298 smllSATACompleted(
1299                   agsaRoot_t        *agRoot,
1300                   agsaIORequest_t   *agIORequest,
1301                   bit32             agIOStatus,
1302                   void              *agFirstDword,
1303                   bit32             agIOInfoLen,
1304                   void              *agParam
1305                  );
1306 
1307 
1308 osGLOBAL FORCEINLINE void
1309 smsatNonChainedDataIOCB(
1310                         agsaRoot_t        *agRoot,
1311                         agsaIORequest_t   *agIORequest,
1312                         bit32             agIOStatus,
1313                         agsaFisHeader_t   *agFirstDword,
1314                         bit32             agIOInfoLen,
1315                         void              *agParam,
1316                         void              *ioContext
1317                        );
1318 
1319 osGLOBAL FORCEINLINE void
1320 smsatChainedDataIOCB(
1321                      agsaRoot_t        *agRoot,
1322                      agsaIORequest_t   *agIORequest,
1323                      bit32             agIOStatus,
1324                      agsaFisHeader_t   *agFirstDword,
1325                      bit32             agIOInfoLen,
1326                      void              *agParam,
1327                      void              *ioContext
1328                     );
1329 
1330 osGLOBAL void
1331 smsatNonChainedVerifyCB(
1332                         agsaRoot_t        *agRoot,
1333                         agsaIORequest_t   *agIORequest,
1334                         bit32             agIOStatus,
1335                         agsaFisHeader_t   *agFirstDword,
1336                         bit32             agIOInfoLen,
1337                         agsaFrameHandle_t agFrameHandle,
1338                         void              *ioContext
1339                        );
1340 
1341 osGLOBAL void
1342 smsatChainedVerifyCB(
1343                      agsaRoot_t        *agRoot,
1344                      agsaIORequest_t   *agIORequest,
1345                      bit32             agIOStatus,
1346                      agsaFisHeader_t   *agFirstDword,
1347                      bit32             agIOInfoLen,
1348                      agsaFrameHandle_t agFrameHandle,
1349                      void              *ioContext
1350                     );
1351 
1352 osGLOBAL void
1353 smsatTestUnitReadyCB(
1354                      agsaRoot_t        *agRoot,
1355                      agsaIORequest_t   *agIORequest,
1356                      bit32             agIOStatus,
1357                      agsaFisHeader_t   *agFirstDword,
1358                      bit32             agIOInfoLen,
1359                      agsaFrameHandle_t agFrameHandle,
1360                      void              *ioContext
1361                     );
1362 osGLOBAL void
1363 smsatRequestSenseCB(
1364                     agsaRoot_t        *agRoot,
1365                     agsaIORequest_t   *agIORequest,
1366                     bit32             agIOStatus,
1367                     agsaFisHeader_t   *agFirstDword,
1368                     bit32             agIOInfoLen,
1369                     void              *agParam,
1370                     void              *ioContext
1371                    );
1372 
1373 osGLOBAL void
1374 smsatSendDiagnosticCB(
1375                        agsaRoot_t        *agRoot,
1376                        agsaIORequest_t   *agIORequest,
1377                        bit32             agIOStatus,
1378                        agsaFisHeader_t   *agFirstDword,
1379                        bit32             agIOInfoLen,
1380                        agsaFrameHandle_t agFrameHandle,
1381                        void              *ioContext
1382                      );
1383 
1384 osGLOBAL void
1385 smsatStartStopUnitCB(
1386                      agsaRoot_t        *agRoot,
1387                      agsaIORequest_t   *agIORequest,
1388                      bit32             agIOStatus,
1389                      agsaFisHeader_t   *agFirstDword,
1390                      bit32             agIOInfoLen,
1391                      agsaFrameHandle_t agFrameHandle,
1392                      void              *ioContext
1393                     );
1394 
1395 
1396 osGLOBAL void
1397 smsatWriteSame10CB(
1398                    agsaRoot_t        *agRoot,
1399                    agsaIORequest_t   *agIORequest,
1400                    bit32             agIOStatus,
1401                    agsaFisHeader_t   *agFirstDword,
1402                    bit32             agIOInfoLen,
1403                    agsaFrameHandle_t agFrameHandle,
1404                    void              *ioContext
1405                   );
1406 
1407 
1408 osGLOBAL void
1409 smsatLogSenseCB(
1410                 agsaRoot_t        *agRoot,
1411                 agsaIORequest_t   *agIORequest,
1412                 bit32             agIOStatus,
1413                 agsaFisHeader_t   *agFirstDword,
1414                 bit32             agIOInfoLen,
1415                 void              *agParam,
1416                 void              *ioCotext
1417                );
1418 
1419 osGLOBAL void
1420 smsatSMARTEnableCB(
1421                    agsaRoot_t        *agRoot,
1422                    agsaIORequest_t   *agIORequest,
1423                    bit32             agIOStatus,
1424                    agsaFisHeader_t   *agFirstDword,
1425                    bit32             agIOInfoLen,
1426                    agsaFrameHandle_t agFrameHandle,
1427                    void              *ioContext
1428                   );
1429 
1430 osGLOBAL void
1431 smsatModeSelect6n10CB(
1432                       agsaRoot_t        *agRoot,
1433                       agsaIORequest_t   *agIORequest,
1434                       bit32             agIOStatus,
1435                       agsaFisHeader_t   *agFirstDword,
1436                       bit32             agIOInfoLen,
1437                       agsaFrameHandle_t agFrameHandle,
1438                       void              *ioContext
1439                      );
1440 
1441 osGLOBAL void
1442 smsatSynchronizeCache10n16CB(
1443                              agsaRoot_t        *agRoot,
1444                              agsaIORequest_t   *agIORequest,
1445                              bit32             agIOStatus,
1446                              agsaFisHeader_t   *agFirstDword,
1447                              bit32             agIOInfoLen,
1448                              agsaFrameHandle_t agFrameHandle,
1449                              void              *ioContext
1450                             );
1451 
1452 osGLOBAL void
1453 smsatNonChainedWriteNVerifyCB(
1454                               agsaRoot_t        *agRoot,
1455                               agsaIORequest_t   *agIORequest,
1456                               bit32             agIOStatus,
1457                               agsaFisHeader_t   *agFirstDword,
1458                               bit32             agIOInfoLen,
1459                               void              *agParam,
1460                               void              *ioContext
1461                              );
1462 
1463 osGLOBAL void
1464 smsatChainedWriteNVerifyCB(
1465                            agsaRoot_t        *agRoot,
1466                            agsaIORequest_t   *agIORequest,
1467                            bit32             agIOStatus,
1468                            agsaFisHeader_t   *agFirstDword,
1469                            bit32             agIOInfoLen,
1470                            void              *agParam,
1471                            void              *ioContext
1472                           );
1473 
1474 osGLOBAL void
1475 smsatReadMediaSerialNumberCB(
1476                              agsaRoot_t        *agRoot,
1477                              agsaIORequest_t   *agIORequest,
1478                              bit32             agIOStatus,
1479                              agsaFisHeader_t   *agFirstDword,
1480                              bit32             agIOInfoLen,
1481                              agsaFrameHandle_t agFrameHandle,
1482                              void              *ioContext
1483                             );
1484 
1485 osGLOBAL void
1486 smsatReadBufferCB(
1487                   agsaRoot_t        *agRoot,
1488                   agsaIORequest_t   *agIORequest,
1489                   bit32             agIOStatus,
1490                   agsaFisHeader_t   *agFirstDword,
1491                   bit32             agIOInfoLen,
1492                   agsaFrameHandle_t agFrameHandle,
1493                   void              *ioContext
1494                  );
1495 
1496 osGLOBAL void
1497 smsatWriteBufferCB(
1498                    agsaRoot_t        *agRoot,
1499                    agsaIORequest_t   *agIORequest,
1500                    bit32             agIOStatus,
1501                    agsaFisHeader_t   *agFirstDword,
1502                    bit32             agIOInfoLen,
1503                    agsaFrameHandle_t agFrameHandle,
1504                    void              *ioContext
1505                   );
1506 
1507 osGLOBAL void
1508 smsatReassignBlocksCB(
1509                       agsaRoot_t        *agRoot,
1510                       agsaIORequest_t   *agIORequest,
1511                       bit32             agIOStatus,
1512                       agsaFisHeader_t   *agFirstDword,
1513                       bit32             agIOInfoLen,
1514                       agsaFrameHandle_t agFrameHandle,
1515                       void              *ioContext
1516                      );
1517 
1518 osGLOBAL void
1519 smsatProcessAbnormalCompletion(
1520                                agsaRoot_t        *agRoot,
1521                                agsaIORequest_t   *agIORequest,
1522                                bit32             agIOStatus,
1523                                agsaFisHeader_t   *agFirstDword,
1524                                bit32             agIOInfoLen,
1525                                void              *agParam,
1526                                smSatIOContext_t    *satIOContext
1527                               );
1528 
1529 osGLOBAL void
1530 smsatDelayedProcessAbnormalCompletion(
1531                                       agsaRoot_t        *agRoot,
1532                                       agsaIORequest_t   *agIORequest,
1533                                       bit32             agIOStatus,
1534                                       agsaFisHeader_t   *agFirstDword,
1535                                       bit32             agIOInfoLen,
1536                                       void              *agParam,
1537                                       smSatIOContext_t    *satIOContext
1538                                      );
1539 
1540 osGLOBAL void
1541 smsatIOCompleted(
1542                  smRoot_t           *smRoot,
1543                  smIORequest_t      *smIORequest,
1544                  agsaFisHeader_t    *agFirstDword,
1545                  bit32              respFisLen,
1546                  agsaFrameHandle_t  agFrameHandle,
1547                  smSatIOContext_t     *satIOContext,
1548                  bit32              interruptContext
1549 		);
1550 
1551 osGLOBAL void
1552 smsatEncryptionHandler(
1553                        smRoot_t                *smRoot,
1554                        agsaIORequest_t         *agIORequest,
1555                        bit32                   agIOStatus,
1556                        bit32                   agIOInfoLen,
1557                        void                    *agParam,
1558                        bit32                   agOtherInfo,
1559                        bit32                   interruptContext
1560                       );
1561 
1562 osGLOBAL void
1563 smsatDifHandler(
1564                 smRoot_t                *smRoot,
1565                 agsaIORequest_t         *agIORequest,
1566                 bit32                   agIOStatus,
1567                 bit32                   agIOInfoLen,
1568                 void                    *agParam,
1569                 bit32                   agOtherInfo,
1570                 bit32                   interruptContext
1571                );
1572 
1573 osGLOBAL void
1574 smsatProcessAbort(
1575                   smRoot_t           *smRoot,
1576                   smIORequest_t      *smIORequest,
1577                   smSatIOContext_t     *satIOContext
1578                  );
1579 
1580 osGLOBAL void
1581 smsatNonDataIOCB(
1582                   agsaRoot_t        *agRoot,
1583                   agsaIORequest_t   *agIORequest,
1584                   bit32             agIOStatus,
1585                   agsaFisHeader_t   *agFirstDword,
1586                   bit32             agIOInfoLen,
1587                   void              *agParam,
1588                   void              *ioContext
1589                  );
1590 
1591 osGLOBAL void
1592 smsatInquiryCB(
1593                agsaRoot_t        *agRoot,
1594                agsaIORequest_t   *agIORequest,
1595                bit32             agIOStatus,
1596                agsaFisHeader_t   *agFirstDword,
1597                bit32             agIOInfoLen,
1598                void              *agParam,
1599                void              *ioContext
1600               );
1601 
1602 
1603 osGLOBAL void
1604 smsatInquiryIntCB(
1605                    smRoot_t                  *smRoot,
1606                    smIORequest_t             *smIORequest,
1607                    smDeviceHandle_t          *smDeviceHandle,
1608                    smScsiInitiatorRequest_t  *smScsiRequest,
1609                    smSatIOContext_t            *satIOContext
1610                   );
1611 
1612 osGLOBAL void
1613 smsatVerify10CB(
1614                 agsaRoot_t        *agRoot,
1615                 agsaIORequest_t   *agIORequest,
1616                 bit32             agIOStatus,
1617                 agsaFisHeader_t   *agFirstDword,
1618                 bit32             agIOInfoLen,
1619                 void              *agParam,
1620                 void              *ioContext
1621                );
1622 
1623 osGLOBAL void
1624 smsatReadLogExtCB(
1625                    agsaRoot_t        *agRoot,
1626                    agsaIORequest_t   *agIORequest,
1627                    bit32             agIOStatus,
1628                    agsaFisHeader_t   *agFirstDword,
1629                    bit32             agIOInfoLen,
1630                    void              *agParam,
1631                    void              *ioContext
1632                  );
1633 
1634 
1635 osGLOBAL void
1636 smsatIDStartCB(
1637                 agsaRoot_t        *agRoot,
1638                 agsaIORequest_t   *agIORequest,
1639                 bit32             agIOStatus,
1640                 agsaFisHeader_t   *agFirstDword,
1641                 bit32             agIOInfoLen,
1642                 void              *agParam,
1643                 void              *ioContext
1644                );
1645 
1646 osGLOBAL void
1647 smSMPCompleted(
1648                 agsaRoot_t            *agRoot,
1649                 agsaIORequest_t       *agIORequest,
1650                 bit32                 agIOStatus,
1651                 bit32                 agIOInfoLen,
1652                 agsaFrameHandle_t     agFrameHandle
1653               );
1654 
1655 osGLOBAL void
1656 smSMPCompletedCB(
1657                   agsaRoot_t            *agRoot,
1658                   agsaIORequest_t       *agIORequest,
1659                   bit32                 agIOStatus,
1660                   bit32                 agIOInfoLen,
1661                   agsaFrameHandle_t     agFrameHandle
1662                 );
1663 
1664 osGLOBAL void
1665 smPhyControlRespRcvd(
1666                       smRoot_t              *smRoot,
1667                       agsaRoot_t            *agRoot,
1668                       agsaIORequest_t       *agIORequest,
1669                       smDeviceData_t        *oneDeviceData,
1670                       smSMPFrameHeader_t    *frameHeader,
1671                       agsaFrameHandle_t     frameHandle,
1672                       smIORequest_t         *CurrentTaskTag
1673                      );
1674 
1675 osGLOBAL void
1676 smsatCheckPowerModeCB(
1677                       agsaRoot_t        *agRoot,
1678                       agsaIORequest_t   *agIORequest,
1679                       bit32             agIOStatus,
1680                       agsaFisHeader_t   *agFirstDword,
1681                       bit32             agIOInfoLen,
1682                       agsaFrameHandle_t agFrameHandle,
1683                       void              *ioContext
1684                      );
1685 
1686 osGLOBAL void
1687 smsatCheckPowerModePassCB(
1688                       agsaRoot_t        *agRoot,
1689                       agsaIORequest_t   *agIORequest,
1690                       bit32             agIOStatus,
1691                       agsaFisHeader_t   *agFirstDword,
1692                       bit32             agIOInfoLen,
1693                       agsaFrameHandle_t agFrameHandle,
1694                       void              *ioContext
1695                      );
1696 
1697 osGLOBAL void
1698 smsatIDDataPassCB(
1699                   agsaRoot_t        *agRoot,
1700                   agsaIORequest_t   *agIORequest,
1701                   bit32             agIOStatus,
1702                   agsaFisHeader_t   *agFirstDword,
1703                   bit32             agIOInfoLen,
1704                   agsaFrameHandle_t agFrameHandle,
1705                   void              *ioContext
1706                  );
1707 
1708 osGLOBAL void
1709 smsatResetDeviceCB(
1710                     agsaRoot_t        *agRoot,
1711                     agsaIORequest_t   *agIORequest,
1712                     bit32             agIOStatus,
1713                     agsaFisHeader_t   *agFirstDword,
1714                     bit32             agIOInfoLen,
1715                     agsaFrameHandle_t agFrameHandle,
1716                     void              *ioContext
1717                   );
1718 
1719 osGLOBAL void
1720 smsatDeResetDeviceCB(
1721                       agsaRoot_t        *agRoot,
1722                       agsaIORequest_t   *agIORequest,
1723                       bit32             agIOStatus,
1724                       agsaFisHeader_t   *agFirstDword,
1725                       bit32             agIOInfoLen,
1726                       agsaFrameHandle_t agFrameHandle,
1727                       void              *ioContext
1728                     );
1729 osGLOBAL void
1730 smaSATAAbortCB(
1731                 agsaRoot_t        *agRoot,
1732                 agsaIORequest_t   *agIORequest,
1733                 bit32             flag,
1734                 bit32             status
1735 	      );
1736 
1737 osGLOBAL void
1738 smLocalPhyControlCB(
1739                      agsaRoot_t     *agRoot,
1740                      agsaContext_t  *agContext,
1741                      bit32          phyId,
1742                      bit32          phyOperation,
1743                      bit32          status,
1744                      void           *parm
1745                     );
1746 /******************************** end of completion ***********************************************************/
1747 
1748 /******************************** start of utils    ***********************************************************/
1749 osGLOBAL bit32 smsatComputeCDB10LBA(smSatIOContext_t            *satIOContext);
1750 osGLOBAL bit32 smsatComputeCDB10TL(smSatIOContext_t            *satIOContext);
1751 osGLOBAL bit32 smsatComputeCDB12LBA(smSatIOContext_t            *satIOContext);
1752 osGLOBAL bit32 smsatComputeCDB12TL(smSatIOContext_t            *satIOContext);
1753 osGLOBAL bit32 smsatComputeCDB16LBA(smSatIOContext_t            *satIOContext);
1754 osGLOBAL bit32 smsatComputeCDB16TL(smSatIOContext_t            *satIOContext);
1755 osGLOBAL FORCEINLINE bit32 smsatComputeLoopNum(bit32 a, bit32 b);
1756 osGLOBAL FORCEINLINE bit32 smsatCheckLimit(bit8 *lba, bit8 *tl, int flag, smDeviceData_t *pSatDevData);
1757 
1758 osGLOBAL void
1759 smsatSplitSGL(
1760             smRoot_t                  *smRoot,
1761             smIORequest_t             *smIORequest,
1762             smDeviceHandle_t          *smDeviceHandle,
1763             smScsiInitiatorRequest_t  *smScsiRequest,
1764             smSatIOContext_t            *satIOContext,
1765             bit32                     split,
1766             bit32                     tl,
1767             bit32                     flag
1768 	   );
1769 
1770 osGLOBAL void
1771 smsatPrintSgl(
1772             smRoot_t                  *smRoot,
1773             agsaEsgl_t                *agEsgl,
1774             bit32                     idx
1775             );
1776 /******************************** end   of utils    ***********************************************************/
1777 
1778 
1779 osGLOBAL void
1780 smsatPassthroughCB(
1781                 agsaRoot_t        *agRoot,
1782                 agsaIORequest_t   *agIORequest,
1783                 bit32             agIOStatus,
1784                 agsaFisHeader_t   *agFirstDword,
1785                 bit32             agIOInfoLen,
1786                 void              *agParam,
1787                 void              *ioContext
1788                );
1789 
1790 
1791 #endif                          /* __SMPROTO_H__ */
1792 
1793