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