1285809Sscottl/*******************************************************************************
2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3285809Sscottl*
4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5285809Sscottl*that the following conditions are met:
6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7285809Sscottl*following disclaimer.
8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10285809Sscottl*with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl*
21285809Sscottl* $FreeBSD$
22285809Sscottl*
23285809Sscottl********************************************************************************/
24285809Sscottl#ifndef __SMPROTO_H__
25285809Sscottl#define __SMPROTO_H__
26285809Sscottl
27285809Sscottl#include <dev/pms/RefTisa/sat/src/smtypes.h>
28285809Sscottl
29285809Sscottl/***************** start of util ****************************************/
30285809SscottlosGLOBAL FORCEINLINE void*
31285809Sscottlsm_memset(void *s, int c, bit32 n);
32285809Sscottl
33285809SscottlosGLOBAL FORCEINLINE void *
34285809Sscottlsm_memcpy(void *dst, const void *src, bit32 count);
35285809Sscottl
36285809SscottlosGLOBAL char
37285809Sscottl*sm_strncpy(char *dst, const char *src, bit32 len);
38285809Sscottl
39285809Sscottl
40285809SscottlosGLOBAL void
41285809Sscottlsmhexdump(const char *ptitle, bit8 *pbuf, size_t len);
42285809Sscottl/***************** end of util ****************************************/
43285809Sscottl
44285809Sscottl/***************** start of timer fns ****************************************/
45285809SscottlosGLOBAL void
46285809SscottlsmTimerTick(smRoot_t 		*smRoot );
47285809Sscottl
48285809SscottlosGLOBAL void
49285809SscottlsmInitTimerRequest(
50285809Sscottl                   smRoot_t                *smRoot,
51285809Sscottl                   smTimerRequest_t        *timerRequest
52285809Sscottl                  );
53285809SscottlosGLOBAL void
54285809SscottlsmSetTimerRequest(
55285809Sscottl                  smRoot_t            *smRoot,
56285809Sscottl                  smTimerRequest_t    *timerRequest,
57285809Sscottl                  bit32               timeout,
58285809Sscottl                  smTimerCBFunc_t     CBFunc,
59285809Sscottl                  void                *timerData1,
60285809Sscottl                  void                *timerData2,
61285809Sscottl                  void                *timerData3
62285809Sscottl                  );
63285809Sscottl
64285809SscottlosGLOBAL void
65285809SscottlsmAddTimer(
66285809Sscottl           smRoot_t            *smRoot,
67285809Sscottl           smList_t            *timerListHdr,
68285809Sscottl           smTimerRequest_t    *timerRequest
69285809Sscottl          );
70285809Sscottl
71285809SscottlosGLOBAL void
72285809SscottlsmKillTimer(
73285809Sscottl            smRoot_t            *smRoot,
74285809Sscottl            smTimerRequest_t    *timerRequest
75285809Sscottl           );
76285809Sscottl
77285809SscottlosGLOBAL void
78285809SscottlsmProcessTimers(
79285809Sscottl                smRoot_t *smRoot
80285809Sscottl               );
81285809Sscottl
82285809Sscottl
83285809Sscottl/***************** end of timer fns ****************************************/
84285809Sscottl
85285809SscottlosGLOBAL void
86285809SscottlsmInitTimers(
87285809Sscottl             smRoot_t *smRoot
88285809Sscottl            );
89285809Sscottl
90285809SscottlosGLOBAL void
91285809SscottlsmDeviceDataInit(
92285809Sscottl                 smRoot_t *smRoot,
93285809Sscottl                 bit32    max_dev
94285809Sscottl                );
95285809Sscottl
96285809SscottlosGLOBAL void
97285809SscottlsmIOInit(
98285809Sscottl         smRoot_t *smRoot
99285809Sscottl        );
100285809Sscottl
101285809SscottlosGLOBAL FORCEINLINE void
102285809SscottlsmIOReInit(
103285809Sscottl          smRoot_t          *smRoot,
104285809Sscottl          smIORequestBody_t *smIORequestBody
105285809Sscottl          );
106285809Sscottl
107285809SscottlosGLOBAL void
108285809SscottlsmDeviceDataReInit(
109285809Sscottl                   smRoot_t        *smRoot,
110285809Sscottl                   smDeviceData_t  *oneDeviceData
111285809Sscottl                  );
112285809Sscottl
113285809SscottlosGLOBAL void
114285809SscottlsmEnqueueIO(
115285809Sscottl             smRoot_t           *smRoot,
116285809Sscottl             smSatIOContext_t   *satIOContext
117285809Sscottl             );
118285809Sscottl
119285809SscottlosGLOBAL FORCEINLINE void
120285809SscottlsmsatFreeIntIoResource(
121285809Sscottl             smRoot_t           *smRoot,
122285809Sscottl             smDeviceData_t     *satDevData,
123285809Sscottl             smSatInternalIo_t  *satIntIo
124285809Sscottl             );
125285809Sscottl
126285809SscottlosGLOBAL smSatInternalIo_t *
127285809SscottlsmsatAllocIntIoResource(
128285809Sscottl                        smRoot_t              *smRoot,
129285809Sscottl                        smIORequest_t         *smIORequest,
130285809Sscottl                        smDeviceData_t        *satDevData,
131285809Sscottl                        bit32                 dmaAllocLength,
132285809Sscottl                        smSatInternalIo_t     *satIntIo);
133285809Sscottl
134285809Sscottl
135285809Sscottl
136285809SscottlosGLOBAL smDeviceData_t *
137285809SscottlsmAddToSharedcontext(
138285809Sscottl                     smRoot_t                   *smRoot,
139285809Sscottl                     agsaDevHandle_t            *agDevHandle,
140285809Sscottl                     smDeviceHandle_t           *smDeviceHandle,
141285809Sscottl                     agsaDevHandle_t            *agExpDevHandle,
142285809Sscottl                     bit32                      phyID
143285809Sscottl                    );
144285809Sscottl
145285809SscottlosGLOBAL bit32
146285809SscottlsmRemoveFromSharedcontext(
147285809Sscottl                          smRoot_t                      *smRoot,
148285809Sscottl                          agsaDevHandle_t               *agDevHandle,
149285809Sscottl                          smDeviceHandle_t              *smDeviceHandle
150285809Sscottl                         );
151285809Sscottl
152285809SscottlosGLOBAL smDeviceData_t *
153285809SscottlsmFindInSharedcontext(
154285809Sscottl                      smRoot_t                  *smRoot,
155285809Sscottl                      agsaDevHandle_t           *agDevHandle
156285809Sscottl                      );
157285809Sscottl
158285809SscottlosGLOBAL bit32
159285809SscottlsmsatLogSenseAllocate(
160285809Sscottl                      smRoot_t                  *smRoot,
161285809Sscottl                      smIORequest_t             *smIORequest,
162285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
163285809Sscottl                      smScsiInitiatorRequest_t  *smSCSIRequest,
164285809Sscottl                      smSatIOContext_t            *satIOContext,
165285809Sscottl                      bit32                     payloadSize,
166285809Sscottl                      bit32                     flag
167285809Sscottl                     );
168285809Sscottl
169285809SscottlosGLOBAL bit32
170285809SscottlsmsatIDSubStart(
171285809Sscottl                 smRoot_t                 *smRoot,
172285809Sscottl                 smIORequest_t            *smIORequest,
173285809Sscottl                 smDeviceHandle_t         *smDeviceHandle,
174285809Sscottl                 smScsiInitiatorRequest_t *smSCSIRequest,
175285809Sscottl                 smSatIOContext_t           *satIOContext
176285809Sscottl               );
177285809Sscottl
178285809Sscottl
179285809SscottlosGLOBAL bit32
180285809SscottlsmsatIDStart(
181285809Sscottl              smRoot_t                  *smRoot,
182285809Sscottl              smIORequest_t             *smIORequest,
183285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
184285809Sscottl              smScsiInitiatorRequest_t  *smSCSIRequest,
185285809Sscottl              smSatIOContext_t            *satIOContext
186285809Sscottl             );
187285809Sscottl
188285809Sscottl
189285809SscottlosGLOBAL FORCEINLINE bit32
190285809SscottlsmsatIOStart(
191285809Sscottl              smRoot_t                  *smRoot,
192285809Sscottl              smIORequest_t             *smIORequest,
193285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
194285809Sscottl              smScsiInitiatorRequest_t  *smSCSIRequest,
195285809Sscottl              smSatIOContext_t            *satIOContext
196285809Sscottl             );
197285809Sscottl
198285809SscottlosGLOBAL void
199285809SscottlsmsatSetSensePayload(
200285809Sscottl                     smScsiRspSense_t   *pSense,
201285809Sscottl                     bit8               SnsKey,
202285809Sscottl                     bit32              SnsInfo,
203285809Sscottl                     bit16              SnsCode,
204285809Sscottl                     smSatIOContext_t     *satIOContext
205285809Sscottl		    );
206285809Sscottl
207285809SscottlosGLOBAL void
208285809SscottlsmsatSetDeferredSensePayload(
209285809Sscottl                             smScsiRspSense_t *pSense,
210285809Sscottl                             bit8             SnsKey,
211285809Sscottl                             bit32            SnsInfo,
212285809Sscottl                             bit16            SnsCode,
213285809Sscottl                             smSatIOContext_t   *satIOContext
214285809Sscottl                            );
215285809Sscottl
216285809SscottlosGLOBAL FORCEINLINE bit32
217285809SscottlsmsatIOPrepareSGL(
218285809Sscottl                  smRoot_t                 *smRoot,
219285809Sscottl                  smIORequestBody_t        *smIORequestBody,
220285809Sscottl                  smSgl_t                  *smSgl1,
221285809Sscottl                  void                     *sglVirtualAddr
222285809Sscottl                  );
223285809SscottlosGLOBAL FORCEINLINE void
224285809SscottlsmsatBitSet(smRoot_t *smRoot,bit8 *data, bit32 index);
225285809Sscottl
226285809SscottlosGLOBAL FORCEINLINE void
227285809SscottlsmsatBitClear(smRoot_t *smRoot,bit8 *data, bit32 index);
228285809Sscottl
229285809SscottlosGLOBAL FORCEINLINE BOOLEAN
230285809SscottlsmsatBitTest(smRoot_t *smRoot,bit8 *data, bit32 index);
231285809Sscottl
232285809SscottlosGLOBAL FORCEINLINE bit32
233285809SscottlsmsatTagAlloc(
234285809Sscottl               smRoot_t         *smRoot,
235285809Sscottl               smDeviceData_t   *pSatDevData,
236285809Sscottl               bit8             *pTag
237285809Sscottl             );
238285809Sscottl
239285809SscottlosGLOBAL FORCEINLINE bit32
240285809SscottlsmsatTagRelease(
241285809Sscottl                smRoot_t         *smRoot,
242285809Sscottl                smDeviceData_t   *pSatDevData,
243285809Sscottl                bit8              tag
244285809Sscottl               );
245285809Sscottl
246285809SscottlosGLOBAL FORCEINLINE void
247285809SscottlsmsatDecrementPendingIO(
248285809Sscottl                        smRoot_t                *smRoot,
249285809Sscottl                        smIntContext_t          *smAllShared,
250285809Sscottl                        smSatIOContext_t        *satIOContext
251285809Sscottl                        );
252285809Sscottl
253285809SscottlosGLOBAL smSatIOContext_t *
254285809SscottlsmsatPrepareNewIO(
255285809Sscottl                  smSatInternalIo_t       *satNewIntIo,
256285809Sscottl                  smIORequest_t           *smOrgIORequest,
257285809Sscottl                  smDeviceData_t          *satDevData,
258285809Sscottl                  smIniScsiCmnd_t         *scsiCmnd,
259285809Sscottl                  smSatIOContext_t        *satOrgIOContext
260285809Sscottl                 );
261285809Sscottl
262285809SscottlosGLOBAL void
263285809SscottlsmsatSetDevInfo(
264285809Sscottl                 smDeviceData_t            *oneDeviceData,
265285809Sscottl                 agsaSATAIdentifyData_t    *SATAIdData
266285809Sscottl               );
267285809Sscottl
268285809SscottlosGLOBAL void
269285809SscottlsmsatInquiryStandard(
270285809Sscottl                     bit8                    *pInquiry,
271285809Sscottl                     agsaSATAIdentifyData_t  *pSATAIdData,
272285809Sscottl                     smIniScsiCmnd_t         *scsiCmnd
273285809Sscottl                    );
274285809Sscottl
275285809SscottlosGLOBAL void
276285809SscottlsmsatInquiryPage0(
277285809Sscottl                   bit8                    *pInquiry,
278285809Sscottl                   agsaSATAIdentifyData_t  *pSATAIdData
279285809Sscottl		 );
280285809Sscottl
281285809SscottlosGLOBAL void
282285809SscottlsmsatInquiryPage83(
283285809Sscottl                    bit8                    *pInquiry,
284285809Sscottl                    agsaSATAIdentifyData_t  *pSATAIdData,
285285809Sscottl                    smDeviceData_t          *oneDeviceData
286285809Sscottl		  );
287285809Sscottl
288285809Sscottl
289285809SscottlosGLOBAL void
290285809SscottlsmsatInquiryPage89(
291285809Sscottl                    bit8                    *pInquiry,
292285809Sscottl                    agsaSATAIdentifyData_t  *pSATAIdData,
293285809Sscottl                    smDeviceData_t          *oneDeviceData,
294285809Sscottl                    bit32                   len
295285809Sscottl		  );
296285809Sscottl
297285809SscottlosGLOBAL void
298285809SscottlsmsatInquiryPage80(
299285809Sscottl                    bit8                    *pInquiry,
300285809Sscottl                    agsaSATAIdentifyData_t  *pSATAIdData
301285809Sscottl		   );
302285809Sscottl
303285809SscottlosGLOBAL void
304285809SscottlsmsatInquiryPageB1(
305285809Sscottl                    bit8                    *pInquiry,
306285809Sscottl                    agsaSATAIdentifyData_t  *pSATAIdData
307285809Sscottl		   );
308285809Sscottl
309285809SscottlosGLOBAL void
310285809SscottlsmsatDefaultTranslation(
311285809Sscottl                        smRoot_t                  *smRoot,
312285809Sscottl                        smIORequest_t             *smIORequest,
313285809Sscottl                        smSatIOContext_t            *satIOContext,
314285809Sscottl                        smScsiRspSense_t          *pSense,
315285809Sscottl                        bit8                      ataStatus,
316285809Sscottl                        bit8                      ataError,
317285809Sscottl                        bit32                     interruptContext
318285809Sscottl                       );
319285809Sscottl
320285809SscottlosGLOBAL bit32
321285809SscottlsmPhyControlSend(
322285809Sscottl                  smRoot_t             *smRoot,
323285809Sscottl                  smDeviceData_t       *oneDeviceData,
324285809Sscottl                  bit8                 phyOp,
325285809Sscottl                  smIORequest_t        *CurrentTaskTag,
326285809Sscottl                  bit32                queueNumber
327285809Sscottl                );
328285809Sscottl
329285809SscottlosGLOBAL bit32
330285809SscottlsmsatTaskManagement(
331285809Sscottl                    smRoot_t          *smRoot,
332285809Sscottl                    smDeviceHandle_t  *smDeviceHandle,
333285809Sscottl                    bit32             task,
334285809Sscottl                    smLUN_t           *lun,
335285809Sscottl                    smIORequest_t     *taskTag,
336285809Sscottl                    smIORequest_t     *currentTaskTag,
337285809Sscottl                    smIORequestBody_t *smIORequestBody
338285809Sscottl		   );
339285809Sscottl
340285809SscottlosGLOBAL bit32
341285809SscottlsmsatTmAbortTask(
342285809Sscottl                  smRoot_t                  *smRoot,
343285809Sscottl                  smIORequest_t             *currentTaskTag,
344285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
345285809Sscottl                  smScsiInitiatorRequest_t  *tiScsiRequest,
346285809Sscottl                  smSatIOContext_t            *satIOContext,
347285809Sscottl                  smIORequest_t             *taskTag);
348285809Sscottl
349285809SscottlosGLOBAL bit32
350285809SscottlsmsatStartCheckPowerMode(
351285809Sscottl                         smRoot_t                  *smRoot,
352285809Sscottl                         smIORequest_t             *currentTaskTag,
353285809Sscottl                         smDeviceHandle_t          *smDeviceHandle,
354285809Sscottl                         smScsiInitiatorRequest_t  *smScsiRequest,
355285809Sscottl                         smSatIOContext_t            *satIOContext
356285809Sscottl                        );
357285809SscottlosGLOBAL bit32
358285809SscottlsmsatStartResetDevice(
359285809Sscottl                       smRoot_t                  *smRoot,
360285809Sscottl                       smIORequest_t             *currentTaskTag,
361285809Sscottl                       smDeviceHandle_t          *smDeviceHandle,
362285809Sscottl                       smScsiInitiatorRequest_t  *smScsiRequest,
363285809Sscottl                       smSatIOContext_t            *satIOContext
364285809Sscottl                     );
365285809SscottlosGLOBAL void
366285809SscottlsmsatAbort(
367285809Sscottl           smRoot_t          *smRoot,
368285809Sscottl           agsaRoot_t        *agRoot,
369285809Sscottl           smSatIOContext_t    *satIOContext
370285809Sscottl	  );
371285809Sscottl
372285809SscottlosGLOBAL smIORequestBody_t *
373285809SscottlsmDequeueIO(smRoot_t          *smRoot);
374285809Sscottl
375285809SscottlosGLOBAL bit32
376285809SscottlsmsatDecodeSATADeviceType(bit8 * pSignature);
377285809Sscottl
378285809Sscottl/******************************** beginning of start ******************************************************/
379285809Sscottl
380285809Sscottl/*! \brief SAT implementation for ATAPI Packet Command.
381285809Sscottl *
382285809Sscottl *  SAT implementation for ATAPI Packet and send FIS request to LL layer.
383285809Sscottl *
384285809Sscottl *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
385285809Sscottl *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
386285809Sscottl *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
387285809Sscottl *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
388285809Sscottl *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
389285809Sscottl *
390285809Sscottl *  \return If command is started successfully
391285809Sscottl *    - \e smIOSuccess: 	  I/O request successfully initiated.
392285809Sscottl *    - \e smIOBusy:        No resources available, try again later.
393285809Sscottl *    - \e smIOIONoDevice:  Invalid device handle.
394285809Sscottl *    - \e smIOError:       Other errors.
395285809Sscottl */
396285809Sscottl/*****************************************************************************/
397285809SscottlosGLOBAL bit32
398285809SscottlsmsatPacket(
399285809Sscottl            smRoot_t                  *smRoot,
400285809Sscottl            smIORequest_t             *smIORequest,
401285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
402285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
403285809Sscottl            smSatIOContext_t            *satIOContext
404285809Sscottl            );
405285809Sscottl
406285809SscottlosGLOBAL void
407285809SscottlsmsatPacketCB(
408285809Sscottl            agsaRoot_t        *agRoot,
409285809Sscottl            agsaIORequest_t   *agIORequest,
410285809Sscottl            bit32             agIOStatus,
411285809Sscottl            agsaFisHeader_t   *agFirstDword,
412285809Sscottl            bit32             agIOInfoLen,
413285809Sscottl            void              *agParam,
414285809Sscottl            void              *ioContext
415285809Sscottl            );
416285809Sscottl/*****************************************************************************/
417285809Sscottl/*! \brief SAT implementation for smsatExecuteDeviceDiagnostic.
418285809Sscottl *
419285809Sscottl *  This function creates Execute Device Diagnostic fis and sends the request to LL layer
420285809Sscottl *
421285809Sscottl *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
422285809Sscottl *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
423285809Sscottl *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
424285809Sscottl *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
425285809Sscottl *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
426285809Sscottl *
427285809Sscottl *  \return If command is started successfully
428285809Sscottl *    - \e smIOSuccess: 	  I/O request successfully initiated.
429285809Sscottl *    - \e smIOBusy:        No resources available, try again later.
430285809Sscottl *    - \e smIOIONoDevice:  Invalid device handle.
431285809Sscottl *    - \e smIOError:       Other errors.
432285809Sscottl
433285809Sscottl */
434285809Sscottl/*****************************************************************************/
435285809SscottlosGLOBAL bit32
436285809SscottlsmsatExecuteDeviceDiagnostic(
437285809Sscottl       smRoot_t                  *smRoot,
438285809Sscottl       smIORequest_t             *smIORequest,
439285809Sscottl       smDeviceHandle_t          *smDeviceHandle,
440285809Sscottl       smScsiInitiatorRequest_t  *smScsiRequest,
441285809Sscottl       smSatIOContext_t            *satIOContext
442285809Sscottl       );
443285809Sscottl
444285809SscottlosGLOBAL void
445285809SscottlsmsatExecuteDeviceDiagnosticCB(
446285809Sscottl       agsaRoot_t        *agRoot,
447285809Sscottl       agsaIORequest_t   *agIORequest,
448285809Sscottl       bit32             agIOStatus,
449285809Sscottl       agsaFisHeader_t   *agFirstDword,
450285809Sscottl       bit32             agIOInfoLen,
451285809Sscottl       void              *agParam,
452285809Sscottl       void              *ioContext
453285809Sscottl       );
454285809Sscottl/* set feature for auto activate */
455285809SscottlosGLOBAL bit32
456285809SscottlsmsatSetFeaturesAA(
457285809Sscottl           smRoot_t                  *smRoot,
458285809Sscottl           smIORequest_t             *smIORequest,
459285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
460285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
461285809Sscottl           smSatIOContext_t            *satIOContext
462285809Sscottl           );
463285809SscottlosGLOBAL void
464285809SscottlsmsatSetFeaturesAACB(
465285809Sscottl         agsaRoot_t        *agRoot,
466285809Sscottl         agsaIORequest_t   *agIORequest,
467285809Sscottl         bit32             agIOStatus,
468285809Sscottl         agsaFisHeader_t   *agFirstDword,
469285809Sscottl         bit32             agIOInfoLen,
470285809Sscottl         void              *agParam,
471285809Sscottl         void              *ioContext
472285809Sscottl         );
473285809Sscottl
474285809Sscottl/*****************************************************************************/
475285809Sscottl/*! \brief SAT implementation for satSetFeatures.
476285809Sscottl *
477285809Sscottl *  This function creates SetFeatures fis and sends the request to LL layer
478285809Sscottl *
479285809Sscottl *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
480285809Sscottl *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
481285809Sscottl *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
482285809Sscottl *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
483285809Sscottl *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
484285809Sscottl *
485285809Sscottl *  \return If command is started successfully
486285809Sscottl *    - \e smIOSuccess: 	  I/O request successfully initiated.
487285809Sscottl *    - \e smIOBusy:        No resources available, try again later.
488285809Sscottl *    - \e smIOIONoDevice:  Invalid device handle.
489285809Sscottl *    - \e smIOError:       Other errors.
490285809Sscottl */
491285809Sscottl/*****************************************************************************/
492285809SscottlosGLOBAL bit32
493285809SscottlsmsatSetFeaturesPIO(
494285809Sscottl           smRoot_t                  *smRoot,
495285809Sscottl           smIORequest_t             *smIORequest,
496285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
497285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
498285809Sscottl           smSatIOContext_t          *satIOContext
499285809Sscottl           );
500285809SscottlosGLOBAL void
501285809SscottlsmsatSetFeaturesPIOCB(
502285809Sscottl          agsaRoot_t        *agRoot,
503285809Sscottl          agsaIORequest_t   *agIORequest,
504285809Sscottl          bit32             agIOStatus,
505285809Sscottl          agsaFisHeader_t   *agFirstDword,
506285809Sscottl          bit32             agIOInfoLen,
507285809Sscottl          void              *agParam,
508285809Sscottl          void              *ioContext
509285809Sscottl          );
510285809Sscottl
511285809SscottlosGLOBAL bit32
512285809SscottlsmsatSetFeaturesDMA(
513285809Sscottl           smRoot_t                  *smRoot,
514285809Sscottl           smIORequest_t             *smIORequest,
515285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
516285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
517285809Sscottl           smSatIOContext_t            *satIOContext
518285809Sscottl           );
519285809Sscottl
520285809SscottlosGLOBAL void
521285809SscottlsmsatSetFeaturesDMACB(
522285809Sscottl         agsaRoot_t        *agRoot,
523285809Sscottl         agsaIORequest_t   *agIORequest,
524285809Sscottl         bit32             agIOStatus,
525285809Sscottl         agsaFisHeader_t   *agFirstDword,
526285809Sscottl         bit32             agIOInfoLen,
527285809Sscottl         void              *agParam,
528285809Sscottl         void              *ioContext
529285809Sscottl         );
530285809Sscottl
531285809SscottlosGLOBAL bit32
532285809SscottlsmsatSetFeaturesReadLookAhead(
533285809Sscottl           smRoot_t                  *smRoot,
534285809Sscottl           smIORequest_t             *smIORequest,
535285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
536285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
537285809Sscottl           smSatIOContext_t            *satIOContext
538285809Sscottl           );
539285809Sscottl
540285809SscottlosGLOBAL void
541285809SscottlsmsatSetFeaturesReadLookAheadCB(
542285809Sscottl         agsaRoot_t        *agRoot,
543285809Sscottl         agsaIORequest_t   *agIORequest,
544285809Sscottl         bit32             agIOStatus,
545285809Sscottl         agsaFisHeader_t   *agFirstDword,
546285809Sscottl         bit32             agIOInfoLen,
547285809Sscottl         void              *agParam,
548285809Sscottl         void              *ioContext
549285809Sscottl         );
550285809Sscottl
551285809SscottlosGLOBAL bit32
552285809SscottlsmsatSetFeaturesVolatileWriteCache(
553285809Sscottl           smRoot_t                  *smRoot,
554285809Sscottl           smIORequest_t             *smIORequest,
555285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
556285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
557285809Sscottl           smSatIOContext_t            *satIOContext
558285809Sscottl           );
559285809Sscottl
560285809SscottlosGLOBAL void
561285809SscottlsmsatSetFeaturesVolatileWriteCacheCB(
562285809Sscottl         agsaRoot_t        *agRoot,
563285809Sscottl         agsaIORequest_t   *agIORequest,
564285809Sscottl         bit32             agIOStatus,
565285809Sscottl         agsaFisHeader_t   *agFirstDword,
566285809Sscottl         bit32             agIOInfoLen,
567285809Sscottl         void              *agParam,
568285809Sscottl         void              *ioContext
569285809Sscottl         );
570285809Sscottl
571285809SscottlosGLOBAL void
572285809SscottlsmsatSMARTEnablePassCB(
573285809Sscottl                     agsaRoot_t        *agRoot,
574285809Sscottl                     agsaIORequest_t   *agIORequest,
575285809Sscottl                     bit32             agIOStatus,
576285809Sscottl                     agsaFisHeader_t   *agFirstDword,
577285809Sscottl                     bit32             agIOInfoLen,
578285809Sscottl                     agsaFrameHandle_t agFrameHandle,
579285809Sscottl                     void              *ioContext
580285809Sscottl                    );
581285809Sscottl
582285809SscottlosGLOBAL void
583285809SscottlsmsatSMARTRStatusPassCB(
584285809Sscottl                agsaRoot_t        *agRoot,
585285809Sscottl                agsaIORequest_t   *agIORequest,
586285809Sscottl                bit32             agIOStatus,
587285809Sscottl                agsaFisHeader_t   *agFirstDword,
588285809Sscottl                bit32             agIOInfoLen,
589285809Sscottl                void              *agParam,
590285809Sscottl                void              *ioContext
591285809Sscottl               );
592285809SscottlosGLOBAL void
593285809SscottlsmsatSMARTReadLogCB(
594285809Sscottl                agsaRoot_t        *agRoot,
595285809Sscottl                agsaIORequest_t   *agIORequest,
596285809Sscottl                bit32             agIOStatus,
597285809Sscottl                agsaFisHeader_t   *agFirstDword,
598285809Sscottl                bit32             agIOInfoLen,
599285809Sscottl                void              *agParam,
600285809Sscottl                void              *ioContext
601285809Sscottl               );
602285809Sscottl
603285809Sscottl
604285809Sscottl/*****************************************************************************/
605285809Sscottl/*! \brief SAT implementation for SCSI REQUEST SENSE to ATAPI device.
606285809Sscottl *
607285809Sscottl *  SAT implementation for SCSI REQUEST SENSE.
608285809Sscottl *
609285809Sscottl *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
610285809Sscottl *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
611285809Sscottl *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
612285809Sscottl *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
613285809Sscottl *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
614285809Sscottl *
615285809Sscottl *  \return If command is started successfully
616285809Sscottl *    - \e smIOSuccess: 	  I/O request successfully initiated.
617285809Sscottl *    - \e smIOBusy:        No resources available, try again later.
618285809Sscottl *    - \e smIOIONoDevice:  Invalid device handle.
619285809Sscottl *    - \e smIOError:       Other errors.
620285809Sscottl */
621285809Sscottl/*****************************************************************************/
622285809SscottlosGLOBAL bit32
623285809SscottlsmsatRequestSenseForATAPI(
624285809Sscottl        smRoot_t                  *smRoot,
625285809Sscottl        smIORequest_t             *smIORequest,
626285809Sscottl        smDeviceHandle_t          *smDeviceHandle,
627285809Sscottl        smScsiInitiatorRequest_t  *smScsiRequest,
628285809Sscottl        smSatIOContext_t            *satIOContext
629285809Sscottl        );
630285809Sscottl
631285809SscottlosGLOBAL void
632285809SscottlsmsatRequestSenseForATAPICB(
633285809Sscottl        agsaRoot_t        *agRoot,
634285809Sscottl        agsaIORequest_t   *agIORequest,
635285809Sscottl        bit32             agIOStatus,
636285809Sscottl        agsaFisHeader_t   *agFirstDword,
637285809Sscottl        bit32             agIOInfoLen,
638285809Sscottl        void              *agParam,
639285809Sscottl        void              *ioContext
640285809Sscottl        );
641285809Sscottl
642285809Sscottl/*****************************************************************************/
643285809Sscottl/*! \brief SAT implementation for smsatDeviceReset.
644285809Sscottl *
645285809Sscottl *  This function creates DEVICE RESET fis and sends the request to LL layer
646285809Sscottl *
647285809Sscottl *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
648285809Sscottl *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
649285809Sscottl *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
650285809Sscottl *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
651285809Sscottl *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
652285809Sscottl *
653285809Sscottl *  \return If command is started successfully
654285809Sscottl *    - \e smIOSuccess: 	  I/O request successfully initiated.
655285809Sscottl *    - \e smIOBusy:        No resources available, try again later.
656285809Sscottl *    - \e smIONoDevice:  Invalid device handle.
657285809Sscottl *    - \e smIOError:       Other errors.
658285809Sscottl */
659285809Sscottl/*****************************************************************************/
660285809SscottlosGLOBAL bit32
661285809SscottlsmsatDeviceReset(
662285809Sscottl        smRoot_t                  *smRoot,
663285809Sscottl        smIORequest_t             *smIORequest,
664285809Sscottl        smDeviceHandle_t          *smDeviceHandle,
665285809Sscottl        smScsiInitiatorRequest_t  *smScsiRequest,
666285809Sscottl        smSatIOContext_t            *satIOContext
667285809Sscottl        );
668285809Sscottl
669285809SscottlosGLOBAL void
670285809SscottlsmsatDeviceResetCB(
671285809Sscottl         agsaRoot_t        *agRoot,
672285809Sscottl         agsaIORequest_t   *agIORequest,
673285809Sscottl         bit32             agIOStatus,
674285809Sscottl         agsaFisHeader_t   *agFirstDword,
675285809Sscottl         bit32             agIOInfoLen,
676285809Sscottl         void              *agParam,
677285809Sscottl         void              *ioContext
678285809Sscottl         );
679285809Sscottl
680285809Sscottl
681285809SscottlosGLOBAL void
682285809SscottlsmsatTranslateATAPIErrorsToSCSIErrors(
683285809Sscottl        bit8   bCommand,
684285809Sscottl        bit8   bATAStatus,
685285809Sscottl        bit8   bATAError,
686285809Sscottl        bit8   *pSenseKey,
687285809Sscottl        bit16  *pSenseCodeInfo
688285809Sscottl        );
689285809Sscottl
690285809SscottlGLOBAL void
691285809SscottlsmsatTranslateATAErrorsToSCSIErrors(
692285809Sscottl    bit8   bATAStatus,
693285809Sscottl    bit8   bATAError,
694285809Sscottl    bit8   *pSenseKey,
695285809Sscottl    bit16  *pSenseCodeInfo
696285809Sscottl    );
697285809Sscottl
698285809Sscottl/*****************************************************************************/
699285809Sscottl
700285809SscottlosGLOBAL bit32
701285809SscottlsmsatRead6(
702285809Sscottl           smRoot_t                  *smRoot,
703285809Sscottl           smIORequest_t             *smIORequest,
704285809Sscottl           smDeviceHandle_t          *smDeviceHandle,
705285809Sscottl           smScsiInitiatorRequest_t  *smScsiRequest,
706285809Sscottl           smSatIOContext_t            *satIOContext
707285809Sscottl	  );
708285809Sscottl
709285809SscottlosGLOBAL FORCEINLINE bit32
710285809SscottlsmsatRead10(
711285809Sscottl            smRoot_t                  *smRoot,
712285809Sscottl            smIORequest_t             *smIORequest,
713285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
714285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
715285809Sscottl            smSatIOContext_t            *satIOContext
716285809Sscottl	   );
717285809Sscottl
718285809SscottlosGLOBAL bit32
719285809SscottlsmsatRead12(
720285809Sscottl            smRoot_t                  *smRoot,
721285809Sscottl            smIORequest_t             *smIORequest,
722285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
723285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
724285809Sscottl            smSatIOContext_t            *satIOContext
725285809Sscottl	   );
726285809Sscottl
727285809SscottlosGLOBAL bit32
728285809SscottlsmsatRead16(
729285809Sscottl            smRoot_t                  *smRoot,
730285809Sscottl            smIORequest_t             *smIORequest,
731285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
732285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
733285809Sscottl            smSatIOContext_t            *satIOContext
734285809Sscottl	   );
735285809Sscottl
736285809SscottlosGLOBAL bit32
737285809SscottlsmsatWrite6(
738285809Sscottl            smRoot_t                  *smRoot,
739285809Sscottl            smIORequest_t             *smIORequest,
740285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
741285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
742285809Sscottl            smSatIOContext_t            *satIOContext
743285809Sscottl	   );
744285809Sscottl
745285809SscottlosGLOBAL FORCEINLINE bit32
746285809SscottlsmsatWrite10(
747285809Sscottl             smRoot_t                  *smRoot,
748285809Sscottl             smIORequest_t             *smIORequest,
749285809Sscottl             smDeviceHandle_t          *smDeviceHandle,
750285809Sscottl             smScsiInitiatorRequest_t  *smScsiRequest,
751285809Sscottl             smSatIOContext_t            *satIOContext
752285809Sscottl            );
753285809Sscottl
754285809SscottlosGLOBAL bit32
755285809SscottlsmsatWrite12(
756285809Sscottl             smRoot_t                  *smRoot,
757285809Sscottl             smIORequest_t             *smIORequest,
758285809Sscottl             smDeviceHandle_t          *smDeviceHandle,
759285809Sscottl             smScsiInitiatorRequest_t  *smScsiRequest,
760285809Sscottl             smSatIOContext_t            *satIOContext
761285809Sscottl            );
762285809Sscottl
763285809SscottlosGLOBAL bit32
764285809SscottlsmsatWrite16(
765285809Sscottl             smRoot_t                  *smRoot,
766285809Sscottl             smIORequest_t             *smIORequest,
767285809Sscottl             smDeviceHandle_t          *smDeviceHandle,
768285809Sscottl             smScsiInitiatorRequest_t  *smScsiRequest,
769285809Sscottl             smSatIOContext_t            *satIOContext
770285809Sscottl            );
771285809Sscottl
772285809SscottlosGLOBAL bit32
773285809SscottlsmsatVerify10(
774285809Sscottl              smRoot_t                  *smRoot,
775285809Sscottl              smIORequest_t             *smIORequest,
776285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
777285809Sscottl              smScsiInitiatorRequest_t  *smScsiRequest,
778285809Sscottl              smSatIOContext_t            *satIOContext
779285809Sscottl             );
780285809Sscottl
781285809SscottlosGLOBAL bit32
782285809SscottlsmsatVerify12(
783285809Sscottl              smRoot_t                  *smRoot,
784285809Sscottl              smIORequest_t             *smIORequest,
785285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
786285809Sscottl              smScsiInitiatorRequest_t  *smScsiRequest,
787285809Sscottl              smSatIOContext_t            *satIOContext
788285809Sscottl             );
789285809Sscottl
790285809SscottlosGLOBAL bit32
791285809SscottlsmsatVerify16(
792285809Sscottl              smRoot_t                  *smRoot,
793285809Sscottl              smIORequest_t             *smIORequest,
794285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
795285809Sscottl              smScsiInitiatorRequest_t  *smScsiRequest,
796285809Sscottl              smSatIOContext_t            *satIOContext
797285809Sscottl             );
798285809Sscottl
799285809SscottlosGLOBAL bit32
800285809SscottlsmsatTestUnitReady(
801285809Sscottl                   smRoot_t                  *smRoot,
802285809Sscottl                   smIORequest_t             *smIORequest,
803285809Sscottl                   smDeviceHandle_t          *smDeviceHandle,
804285809Sscottl                   smScsiInitiatorRequest_t  *smScsiRequest,
805285809Sscottl                   smSatIOContext_t            *satIOContext
806285809Sscottl                  );
807285809Sscottl
808285809SscottlosGLOBAL bit32
809285809SscottlsmsatInquiry(
810285809Sscottl             smRoot_t                  *smRoot,
811285809Sscottl             smIORequest_t             *smIORequest,
812285809Sscottl             smDeviceHandle_t          *smDeviceHandle,
813285809Sscottl             smScsiInitiatorRequest_t  *smScsiRequest,
814285809Sscottl             smSatIOContext_t            *satIOContext
815285809Sscottl            );
816285809Sscottl
817285809SscottlosGLOBAL bit32
818285809SscottlsmsatRequestSense(
819285809Sscottl                  smRoot_t                  *smRoot,
820285809Sscottl                  smIORequest_t             *smIORequest,
821285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
822285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
823285809Sscottl                  smSatIOContext_t            *satIOContext
824285809Sscottl                 );
825285809Sscottl
826285809SscottlosGLOBAL bit32
827285809SscottlsmsatModeSense6(
828285809Sscottl                smRoot_t                  *smRoot,
829285809Sscottl                smIORequest_t             *smIORequest,
830285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
831285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
832285809Sscottl                smSatIOContext_t            *satIOContext
833285809Sscottl               );
834285809Sscottl
835285809SscottlosGLOBAL bit32
836285809SscottlsmsatModeSense10(
837285809Sscottl                  smRoot_t                  *smRoot,
838285809Sscottl                  smIORequest_t             *smIORequest,
839285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
840285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
841285809Sscottl                  smSatIOContext_t            *satIOContext
842285809Sscottl                 );
843285809Sscottl
844285809SscottlosGLOBAL bit32
845285809SscottlsmsatReadCapacity10(
846285809Sscottl                    smRoot_t                  *smRoot,
847285809Sscottl                    smIORequest_t             *smIORequest,
848285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
849285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
850285809Sscottl                    smSatIOContext_t            *satIOContext
851285809Sscottl                   );
852285809Sscottl
853285809SscottlosGLOBAL bit32
854285809SscottlsmsatReadCapacity16(
855285809Sscottl                    smRoot_t                  *smRoot,
856285809Sscottl                    smIORequest_t             *smIORequest,
857285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
858285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
859285809Sscottl                    smSatIOContext_t            *satIOContext
860285809Sscottl                   );
861285809Sscottl
862285809SscottlosGLOBAL bit32
863285809SscottlsmsatReportLun(
864285809Sscottl               smRoot_t                  *smRoot,
865285809Sscottl               smIORequest_t             *smIORequest,
866285809Sscottl               smDeviceHandle_t          *smDeviceHandle,
867285809Sscottl               smScsiInitiatorRequest_t  *smScsiRequest,
868285809Sscottl               smSatIOContext_t            *satIOContext
869285809Sscottl              );
870285809Sscottl
871285809SscottlosGLOBAL bit32
872285809SscottlsmsatFormatUnit(
873285809Sscottl                smRoot_t                  *smRoot,
874285809Sscottl                smIORequest_t             *smIORequest,
875285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
876285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
877285809Sscottl                smSatIOContext_t            *satIOContext
878285809Sscottl               );
879285809Sscottl
880285809SscottlosGLOBAL bit32
881285809SscottlsmsatSendDiagnostic(
882285809Sscottl                    smRoot_t                  *smRoot,
883285809Sscottl                    smIORequest_t             *smIORequest,
884285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
885285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
886285809Sscottl                    smSatIOContext_t            *satIOContext
887285809Sscottl                   );
888285809Sscottl
889285809SscottlosGLOBAL bit32
890285809SscottlsmsatStartStopUnit(
891285809Sscottl                   smRoot_t                  *smRoot,
892285809Sscottl                   smIORequest_t             *smIORequest,
893285809Sscottl                   smDeviceHandle_t          *smDeviceHandle,
894285809Sscottl                   smScsiInitiatorRequest_t  *smScsiRequest,
895285809Sscottl                   smSatIOContext_t            *satIOContext
896285809Sscottl                  );
897285809Sscottl
898285809SscottlosGLOBAL bit32
899285809SscottlsmsatWriteSame10(
900285809Sscottl                  smRoot_t                  *smRoot,
901285809Sscottl                  smIORequest_t             *smIORequest,
902285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
903285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
904285809Sscottl                  smSatIOContext_t            *satIOContext
905285809Sscottl                 );
906285809Sscottl
907285809SscottlosGLOBAL bit32
908285809SscottlsmsatWriteSame16(
909285809Sscottl                  smRoot_t                  *smRoot,
910285809Sscottl                  smIORequest_t             *smIORequest,
911285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
912285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
913285809Sscottl                  smSatIOContext_t            *satIOContext
914285809Sscottl                 );
915285809Sscottl
916285809SscottlosGLOBAL bit32
917285809SscottlsmsatLogSense(
918285809Sscottl              smRoot_t                  *smRoot,
919285809Sscottl              smIORequest_t             *smIORequest,
920285809Sscottl              smDeviceHandle_t          *smDeviceHandle,
921285809Sscottl              smScsiInitiatorRequest_t  *smScsiRequest,
922285809Sscottl              smSatIOContext_t            *satIOContext
923285809Sscottl             );
924285809Sscottl
925285809SscottlosGLOBAL bit32
926285809SscottlsmsatModeSelect6(
927285809Sscottl                 smRoot_t                  *smRoot,
928285809Sscottl                 smIORequest_t             *smIORequest,
929285809Sscottl                 smDeviceHandle_t          *smDeviceHandle,
930285809Sscottl                 smScsiInitiatorRequest_t  *smScsiRequest,
931285809Sscottl                 smSatIOContext_t            *satIOContext
932285809Sscottl                );
933285809Sscottl
934285809Sscottl
935285809SscottlosGLOBAL bit32
936285809SscottlsmsatModeSelect10(
937285809Sscottl                  smRoot_t                  *smRoot,
938285809Sscottl                  smIORequest_t             *smIORequest,
939285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
940285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
941285809Sscottl                  smSatIOContext_t            *satIOContext
942285809Sscottl                 );
943285809Sscottl
944285809SscottlosGLOBAL bit32
945285809SscottlsmsatSynchronizeCache10(
946285809Sscottl                        smRoot_t                  *smRoot,
947285809Sscottl                        smIORequest_t             *smIORequest,
948285809Sscottl                        smDeviceHandle_t          *smDeviceHandle,
949285809Sscottl                        smScsiInitiatorRequest_t  *smScsiRequest,
950285809Sscottl                        smSatIOContext_t            *satIOContext
951285809Sscottl                       );
952285809Sscottl
953285809SscottlosGLOBAL bit32
954285809SscottlsmsatSynchronizeCache16(
955285809Sscottl                        smRoot_t                  *smRoot,
956285809Sscottl                        smIORequest_t             *smIORequest,
957285809Sscottl                        smDeviceHandle_t          *smDeviceHandle,
958285809Sscottl                        smScsiInitiatorRequest_t  *smScsiRequest,
959285809Sscottl                        smSatIOContext_t            *satIOContext
960285809Sscottl                       );
961285809Sscottl
962285809SscottlosGLOBAL bit32
963285809SscottlsmsatWriteAndVerify10(
964285809Sscottl                      smRoot_t                  *smRoot,
965285809Sscottl                      smIORequest_t             *smIORequest,
966285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
967285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
968285809Sscottl                      smSatIOContext_t            *satIOContext
969285809Sscottl                     );
970285809Sscottl
971285809SscottlosGLOBAL bit32
972285809SscottlsmsatWriteAndVerify12(
973285809Sscottl                      smRoot_t                  *smRoot,
974285809Sscottl                      smIORequest_t             *smIORequest,
975285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
976285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
977285809Sscottl                      smSatIOContext_t            *satIOContext
978285809Sscottl                     );
979285809Sscottl
980285809SscottlosGLOBAL bit32
981285809SscottlsmsatWriteAndVerify16(
982285809Sscottl                      smRoot_t                  *smRoot,
983285809Sscottl                      smIORequest_t             *smIORequest,
984285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
985285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
986285809Sscottl                      smSatIOContext_t            *satIOContext
987285809Sscottl                     );
988285809Sscottl
989285809SscottlosGLOBAL bit32
990285809SscottlsmsatReadMediaSerialNumber(
991285809Sscottl                           smRoot_t                  *smRoot,
992285809Sscottl                           smIORequest_t             *smIORequest,
993285809Sscottl                           smDeviceHandle_t          *smDeviceHandle,
994285809Sscottl                           smScsiInitiatorRequest_t  *smScsiRequest,
995285809Sscottl                           smSatIOContext_t            *satIOContext
996285809Sscottl                          );
997285809Sscottl
998285809SscottlosGLOBAL bit32
999285809SscottlsmsatReadBuffer(
1000285809Sscottl                smRoot_t                  *smRoot,
1001285809Sscottl                smIORequest_t             *smIORequest,
1002285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1003285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1004285809Sscottl                smSatIOContext_t            *satIOContext
1005285809Sscottl               );
1006285809Sscottl
1007285809SscottlosGLOBAL bit32
1008285809SscottlsmsatWriteBuffer(
1009285809Sscottl                 smRoot_t                  *smRoot,
1010285809Sscottl                 smIORequest_t             *smIORequest,
1011285809Sscottl                 smDeviceHandle_t          *smDeviceHandle,
1012285809Sscottl                 smScsiInitiatorRequest_t  *smScsiRequest,
1013285809Sscottl                 smSatIOContext_t            *satIOContext
1014285809Sscottl                );
1015285809Sscottl
1016285809SscottlosGLOBAL bit32
1017285809SscottlsmsatReassignBlocks(
1018285809Sscottl                    smRoot_t                  *smRoot,
1019285809Sscottl                    smIORequest_t             *smIORequest,
1020285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1021285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1022285809Sscottl                    smSatIOContext_t            *satIOContext
1023285809Sscottl                   );
1024285809Sscottl
1025285809SscottlosGLOBAL bit32
1026285809SscottlsmsatPassthrough(
1027285809Sscottl                    smRoot_t                  *smRoot,
1028285809Sscottl                    smIORequest_t             *smIORequest,
1029285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1030285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1031285809Sscottl                    smSatIOContext_t            *satIOContext
1032285809Sscottl                   );
1033285809Sscottl
1034285809SscottlosGLOBAL FORCEINLINE bit32
1035285809SscottlsmsataLLIOStart(
1036285809Sscottl                smRoot_t                  *smRoot,
1037285809Sscottl                smIORequest_t             *smIORequest,
1038285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1039285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1040285809Sscottl                smSatIOContext_t            *satIOContext
1041285809Sscottl               );
1042285809SscottlosGLOBAL bit32
1043285809SscottlsmsatTestUnitReady_1(
1044285809Sscottl                     smRoot_t                  *smRoot,
1045285809Sscottl                     smIORequest_t             *smIORequest,
1046285809Sscottl                     smDeviceHandle_t          *smDeviceHandle,
1047285809Sscottl                     smScsiInitiatorRequest_t  *smScsiRequest,
1048285809Sscottl                     smSatIOContext_t            *satIOContext
1049285809Sscottl                    );
1050285809SscottlosGLOBAL bit32
1051285809SscottlsmsatStartIDDev(
1052285809Sscottl                smRoot_t                  *smRoot,
1053285809Sscottl                smIORequest_t             *smIORequest,
1054285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1055285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1056285809Sscottl                smSatIOContext_t            *satIOContext
1057285809Sscottl               );
1058285809Sscottl
1059285809SscottlosGLOBAL bit32
1060285809SscottlsmsatSendIDDev(
1061285809Sscottl                smRoot_t                  *smRoot,
1062285809Sscottl                smIORequest_t             *smIORequest,
1063285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1064285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1065285809Sscottl                smSatIOContext_t            *satIOContext
1066285809Sscottl               );
1067285809Sscottl
1068285809SscottlosGLOBAL bit32
1069285809SscottlsmsatRequestSense_1(
1070285809Sscottl                    smRoot_t                  *smRoot,
1071285809Sscottl                    smIORequest_t             *smIORequest,
1072285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1073285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1074285809Sscottl                    smSatIOContext_t            *satIOContext
1075285809Sscottl                   );
1076285809Sscottl
1077285809SscottlosGLOBAL bit32
1078285809SscottlsmsatSMARTEnable(
1079285809Sscottl                 smRoot_t                  *smRoot,
1080285809Sscottl                 smIORequest_t             *smIORequest,
1081285809Sscottl                 smDeviceHandle_t          *smDeviceHandle,
1082285809Sscottl                 smScsiInitiatorRequest_t  *smScsiRequest,
1083285809Sscottl                 smSatIOContext_t            *satIOContext
1084285809Sscottl               );
1085285809Sscottl
1086285809SscottlosGLOBAL bit32
1087285809SscottlsmsatLogSense_2(
1088285809Sscottl                smRoot_t                  *smRoot,
1089285809Sscottl                smIORequest_t             *smIORequest,
1090285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1091285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1092285809Sscottl                smSatIOContext_t            *satIOContext
1093285809Sscottl               );
1094285809Sscottl
1095285809SscottlosGLOBAL bit32
1096285809SscottlsmsatLogSense_3(
1097285809Sscottl                smRoot_t                  *smRoot,
1098285809Sscottl                smIORequest_t             *smIORequest,
1099285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1100285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1101285809Sscottl                smSatIOContext_t            *satIOContext
1102285809Sscottl               );
1103285809Sscottl
1104285809SscottlosGLOBAL bit32
1105285809SscottlsmsatRead_1(
1106285809Sscottl            smRoot_t                  *smRoot,
1107285809Sscottl            smIORequest_t             *smIORequest,
1108285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
1109285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
1110285809Sscottl            smSatIOContext_t            *satIOContext
1111285809Sscottl          );
1112285809Sscottl
1113285809SscottlosGLOBAL bit32
1114285809SscottlsmsatWrite_1(
1115285809Sscottl             smRoot_t                  *smRoot,
1116285809Sscottl             smIORequest_t             *smIORequest,
1117285809Sscottl             smDeviceHandle_t          *smDeviceHandle,
1118285809Sscottl             smScsiInitiatorRequest_t  *smScsiRequest,
1119285809Sscottl             smSatIOContext_t            *satIOContext
1120285809Sscottl           );
1121285809Sscottl
1122285809SscottlosGLOBAL bit32
1123285809SscottlsmsatNonChainedWriteNVerify_Verify(
1124285809Sscottl                                   smRoot_t                  *smRoot,
1125285809Sscottl                                   smIORequest_t             *smIORequest,
1126285809Sscottl                                   smDeviceHandle_t          *smDeviceHandle,
1127285809Sscottl                                   smScsiInitiatorRequest_t  *smScsiRequest,
1128285809Sscottl                                   smSatIOContext_t            *satIOContext
1129285809Sscottl                                  );
1130285809Sscottl
1131285809SscottlosGLOBAL bit32
1132285809SscottlsmsatChainedWriteNVerify_Start_Verify(
1133285809Sscottl                                      smRoot_t                  *smRoot,
1134285809Sscottl                                      smIORequest_t             *smIORequest,
1135285809Sscottl                                      smDeviceHandle_t          *smDeviceHandle,
1136285809Sscottl                                      smScsiInitiatorRequest_t  *smScsiRequest,
1137285809Sscottl                                      smSatIOContext_t            *satIOContext
1138285809Sscottl                                     );
1139285809Sscottl
1140285809SscottlosGLOBAL bit32
1141285809SscottlsmsatChainedWriteNVerify_Write(
1142285809Sscottl                               smRoot_t                  *smRoot,
1143285809Sscottl                               smIORequest_t             *smIORequest,
1144285809Sscottl                               smDeviceHandle_t          *smDeviceHandle,
1145285809Sscottl                               smScsiInitiatorRequest_t  *smScsiRequest,
1146285809Sscottl                               smSatIOContext_t            *satIOContext
1147285809Sscottl                              );
1148285809Sscottl
1149285809SscottlosGLOBAL bit32
1150285809SscottlsmsatChainedWriteNVerify_Verify(
1151285809Sscottl                                smRoot_t                  *smRoot,
1152285809Sscottl                                smIORequest_t             *smIORequest,
1153285809Sscottl                                smDeviceHandle_t          *smDeviceHandle,
1154285809Sscottl                                smScsiInitiatorRequest_t  *smScsiRequest,
1155285809Sscottl                                smSatIOContext_t            *satIOContext
1156285809Sscottl                               );
1157285809SscottlosGLOBAL bit32
1158285809SscottlsmsatChainedVerify(
1159285809Sscottl                    smRoot_t                  *smRoot,
1160285809Sscottl                    smIORequest_t             *smIORequest,
1161285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1162285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1163285809Sscottl                    smSatIOContext_t            *satIOContext
1164285809Sscottl		   );
1165285809Sscottl
1166285809SscottlosGLOBAL bit32
1167285809SscottlsmsatWriteSame10_1(
1168285809Sscottl                    smRoot_t                  *smRoot,
1169285809Sscottl                    smIORequest_t             *smIORequest,
1170285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1171285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1172285809Sscottl                    smSatIOContext_t            *satIOContext,
1173285809Sscottl                    bit32                     lba
1174285809Sscottl                  );
1175285809Sscottl
1176285809SscottlosGLOBAL bit32
1177285809SscottlsmsatWriteSame10_2(
1178285809Sscottl                    smRoot_t                  *smRoot,
1179285809Sscottl                    smIORequest_t             *smIORequest,
1180285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1181285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1182285809Sscottl                    smSatIOContext_t            *satIOContext,
1183285809Sscottl                    bit32                     lba
1184285809Sscottl                  );
1185285809Sscottl
1186285809SscottlosGLOBAL bit32
1187285809SscottlsmsatWriteSame10_3(
1188285809Sscottl                    smRoot_t                  *smRoot,
1189285809Sscottl                    smIORequest_t             *smIORequest,
1190285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1191285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1192285809Sscottl                    smSatIOContext_t            *satIOContext,
1193285809Sscottl                    bit32                     lba
1194285809Sscottl                  );
1195285809Sscottl
1196285809SscottlosGLOBAL bit32
1197285809SscottlsmsatStartStopUnit_1(
1198285809Sscottl                     smRoot_t                  *smRoot,
1199285809Sscottl                     smIORequest_t             *smIORequest,
1200285809Sscottl                     smDeviceHandle_t          *smDeviceHandle,
1201285809Sscottl                     smScsiInitiatorRequest_t  *smScsiRequest,
1202285809Sscottl                     smSatIOContext_t            *satIOContext
1203285809Sscottl		    );
1204285809Sscottl
1205285809SscottlosGLOBAL bit32
1206285809SscottlsmsatSendDiagnostic_1(
1207285809Sscottl                      smRoot_t                  *smRoot,
1208285809Sscottl                      smIORequest_t             *smIORequest,
1209285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
1210285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
1211285809Sscottl                      smSatIOContext_t            *satIOContext
1212285809Sscottl		     );
1213285809Sscottl
1214285809SscottlosGLOBAL bit32
1215285809SscottlsmsatSendDiagnostic_2(
1216285809Sscottl                      smRoot_t                  *smRoot,
1217285809Sscottl                      smIORequest_t             *smIORequest,
1218285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
1219285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
1220285809Sscottl                      smSatIOContext_t            *satIOContext
1221285809Sscottl		     );
1222285809Sscottl
1223285809SscottlosGLOBAL bit32
1224285809SscottlsmsatModeSelect6n10_1(
1225285809Sscottl                      smRoot_t                  *smRoot,
1226285809Sscottl                      smIORequest_t             *smIORequest,
1227285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
1228285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
1229285809Sscottl                      smSatIOContext_t            *satIOContext
1230285809Sscottl		     );
1231285809Sscottl
1232285809SscottlosGLOBAL bit32
1233285809SscottlsmsatLogSense_1(
1234285809Sscottl                smRoot_t                  *smRoot,
1235285809Sscottl                smIORequest_t             *smIORequest,
1236285809Sscottl                smDeviceHandle_t          *smDeviceHandle,
1237285809Sscottl                smScsiInitiatorRequest_t  *smScsiRequest,
1238285809Sscottl                smSatIOContext_t            *satIOContext
1239285809Sscottl               );
1240285809Sscottl
1241285809SscottlosGLOBAL bit32
1242285809SscottlsmsatReassignBlocks_2(
1243285809Sscottl                      smRoot_t                  *smRoot,
1244285809Sscottl                      smIORequest_t             *smIORequest,
1245285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
1246285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
1247285809Sscottl                      smSatIOContext_t            *satIOContext,
1248285809Sscottl                      bit8                      *LBA
1249285809Sscottl                     );
1250285809Sscottl
1251285809SscottlosGLOBAL bit32
1252285809SscottlsmsatReassignBlocks_1(
1253285809Sscottl                      smRoot_t                  *smRoot,
1254285809Sscottl                      smIORequest_t             *smIORequest,
1255285809Sscottl                      smDeviceHandle_t          *smDeviceHandle,
1256285809Sscottl                      smScsiInitiatorRequest_t  *smScsiRequest,
1257285809Sscottl                      smSatIOContext_t            *satIOContext,
1258285809Sscottl                      smSatIOContext_t            *satOrgIOContext
1259285809Sscottl                     );
1260285809Sscottl
1261285809SscottlosGLOBAL bit32
1262285809SscottlsmsatSendReadLogExt(
1263285809Sscottl                     smRoot_t                  *smRoot,
1264285809Sscottl                     smIORequest_t             *smIORequest,
1265285809Sscottl                     smDeviceHandle_t          *smDeviceHandle,
1266285809Sscottl                     smScsiInitiatorRequest_t  *smScsiRequest,
1267285809Sscottl                     smSatIOContext_t            *satIOContext
1268285809Sscottl		   );
1269285809Sscottl
1270285809SscottlosGLOBAL bit32
1271285809SscottlsmsatCheckPowerMode(
1272285809Sscottl                     smRoot_t                  *smRoot,
1273285809Sscottl                     smIORequest_t             *smIORequest,
1274285809Sscottl                     smDeviceHandle_t          *smDeviceHandle,
1275285809Sscottl                     smScsiInitiatorRequest_t  *smScsiRequest,
1276285809Sscottl                     smSatIOContext_t            *satIOContext
1277285809Sscottl		   );
1278285809Sscottl
1279285809SscottlosGLOBAL bit32
1280285809SscottlsmsatResetDevice(
1281285809Sscottl                  smRoot_t                  *smRoot,
1282285809Sscottl                  smIORequest_t             *smIORequest,
1283285809Sscottl                  smDeviceHandle_t          *smDeviceHandle,
1284285809Sscottl                  smScsiInitiatorRequest_t  *smScsiRequest,
1285285809Sscottl                  smSatIOContext_t            *satIOContext
1286285809Sscottl                );
1287285809Sscottl
1288285809SscottlosGLOBAL bit32
1289285809SscottlsmsatDeResetDevice(
1290285809Sscottl                    smRoot_t                  *smRoot,
1291285809Sscottl                    smIORequest_t             *smIORequest,
1292285809Sscottl                    smDeviceHandle_t          *smDeviceHandle,
1293285809Sscottl                    smScsiInitiatorRequest_t  *smScsiRequest,
1294285809Sscottl                    smSatIOContext_t            *satIOContext
1295285809Sscottl                   );
1296285809Sscottl/******************************** beginning of completion ******************************************************/
1297285809SscottlosGLOBAL FORCEINLINE void
1298285809SscottlsmllSATACompleted(
1299285809Sscottl                  agsaRoot_t        *agRoot,
1300285809Sscottl                  agsaIORequest_t   *agIORequest,
1301285809Sscottl                  bit32             agIOStatus,
1302285809Sscottl                  void              *agFirstDword,
1303285809Sscottl                  bit32             agIOInfoLen,
1304285809Sscottl                  void              *agParam
1305285809Sscottl                 );
1306285809Sscottl
1307285809Sscottl
1308285809SscottlosGLOBAL FORCEINLINE void
1309285809SscottlsmsatNonChainedDataIOCB(
1310285809Sscottl                        agsaRoot_t        *agRoot,
1311285809Sscottl                        agsaIORequest_t   *agIORequest,
1312285809Sscottl                        bit32             agIOStatus,
1313285809Sscottl                        agsaFisHeader_t   *agFirstDword,
1314285809Sscottl                        bit32             agIOInfoLen,
1315285809Sscottl                        void              *agParam,
1316285809Sscottl                        void              *ioContext
1317285809Sscottl                       );
1318285809Sscottl
1319285809SscottlosGLOBAL FORCEINLINE void
1320285809SscottlsmsatChainedDataIOCB(
1321285809Sscottl                     agsaRoot_t        *agRoot,
1322285809Sscottl                     agsaIORequest_t   *agIORequest,
1323285809Sscottl                     bit32             agIOStatus,
1324285809Sscottl                     agsaFisHeader_t   *agFirstDword,
1325285809Sscottl                     bit32             agIOInfoLen,
1326285809Sscottl                     void              *agParam,
1327285809Sscottl                     void              *ioContext
1328285809Sscottl                    );
1329285809Sscottl
1330285809SscottlosGLOBAL void
1331285809SscottlsmsatNonChainedVerifyCB(
1332285809Sscottl                        agsaRoot_t        *agRoot,
1333285809Sscottl                        agsaIORequest_t   *agIORequest,
1334285809Sscottl                        bit32             agIOStatus,
1335285809Sscottl                        agsaFisHeader_t   *agFirstDword,
1336285809Sscottl                        bit32             agIOInfoLen,
1337285809Sscottl                        agsaFrameHandle_t agFrameHandle,
1338285809Sscottl                        void              *ioContext
1339285809Sscottl                       );
1340285809Sscottl
1341285809SscottlosGLOBAL void
1342285809SscottlsmsatChainedVerifyCB(
1343285809Sscottl                     agsaRoot_t        *agRoot,
1344285809Sscottl                     agsaIORequest_t   *agIORequest,
1345285809Sscottl                     bit32             agIOStatus,
1346285809Sscottl                     agsaFisHeader_t   *agFirstDword,
1347285809Sscottl                     bit32             agIOInfoLen,
1348285809Sscottl                     agsaFrameHandle_t agFrameHandle,
1349285809Sscottl                     void              *ioContext
1350285809Sscottl                    );
1351285809Sscottl
1352285809SscottlosGLOBAL void
1353285809SscottlsmsatTestUnitReadyCB(
1354285809Sscottl                     agsaRoot_t        *agRoot,
1355285809Sscottl                     agsaIORequest_t   *agIORequest,
1356285809Sscottl                     bit32             agIOStatus,
1357285809Sscottl                     agsaFisHeader_t   *agFirstDword,
1358285809Sscottl                     bit32             agIOInfoLen,
1359285809Sscottl                     agsaFrameHandle_t agFrameHandle,
1360285809Sscottl                     void              *ioContext
1361285809Sscottl                    );
1362285809SscottlosGLOBAL void
1363285809SscottlsmsatRequestSenseCB(
1364285809Sscottl                    agsaRoot_t        *agRoot,
1365285809Sscottl                    agsaIORequest_t   *agIORequest,
1366285809Sscottl                    bit32             agIOStatus,
1367285809Sscottl                    agsaFisHeader_t   *agFirstDword,
1368285809Sscottl                    bit32             agIOInfoLen,
1369285809Sscottl                    void              *agParam,
1370285809Sscottl                    void              *ioContext
1371285809Sscottl                   );
1372285809Sscottl
1373285809SscottlosGLOBAL void
1374285809SscottlsmsatSendDiagnosticCB(
1375285809Sscottl                       agsaRoot_t        *agRoot,
1376285809Sscottl                       agsaIORequest_t   *agIORequest,
1377285809Sscottl                       bit32             agIOStatus,
1378285809Sscottl                       agsaFisHeader_t   *agFirstDword,
1379285809Sscottl                       bit32             agIOInfoLen,
1380285809Sscottl                       agsaFrameHandle_t agFrameHandle,
1381285809Sscottl                       void              *ioContext
1382285809Sscottl                     );
1383285809Sscottl
1384285809SscottlosGLOBAL void
1385285809SscottlsmsatStartStopUnitCB(
1386285809Sscottl                     agsaRoot_t        *agRoot,
1387285809Sscottl                     agsaIORequest_t   *agIORequest,
1388285809Sscottl                     bit32             agIOStatus,
1389285809Sscottl                     agsaFisHeader_t   *agFirstDword,
1390285809Sscottl                     bit32             agIOInfoLen,
1391285809Sscottl                     agsaFrameHandle_t agFrameHandle,
1392285809Sscottl                     void              *ioContext
1393285809Sscottl                    );
1394285809Sscottl
1395285809Sscottl
1396285809SscottlosGLOBAL void
1397285809SscottlsmsatWriteSame10CB(
1398285809Sscottl                   agsaRoot_t        *agRoot,
1399285809Sscottl                   agsaIORequest_t   *agIORequest,
1400285809Sscottl                   bit32             agIOStatus,
1401285809Sscottl                   agsaFisHeader_t   *agFirstDword,
1402285809Sscottl                   bit32             agIOInfoLen,
1403285809Sscottl                   agsaFrameHandle_t agFrameHandle,
1404285809Sscottl                   void              *ioContext
1405285809Sscottl                  );
1406285809Sscottl
1407285809Sscottl
1408285809SscottlosGLOBAL void
1409285809SscottlsmsatLogSenseCB(
1410285809Sscottl                agsaRoot_t        *agRoot,
1411285809Sscottl                agsaIORequest_t   *agIORequest,
1412285809Sscottl                bit32             agIOStatus,
1413285809Sscottl                agsaFisHeader_t   *agFirstDword,
1414285809Sscottl                bit32             agIOInfoLen,
1415285809Sscottl                void              *agParam,
1416285809Sscottl                void              *ioCotext
1417285809Sscottl               );
1418285809Sscottl
1419285809SscottlosGLOBAL void
1420285809SscottlsmsatSMARTEnableCB(
1421285809Sscottl                   agsaRoot_t        *agRoot,
1422285809Sscottl                   agsaIORequest_t   *agIORequest,
1423285809Sscottl                   bit32             agIOStatus,
1424285809Sscottl                   agsaFisHeader_t   *agFirstDword,
1425285809Sscottl                   bit32             agIOInfoLen,
1426285809Sscottl                   agsaFrameHandle_t agFrameHandle,
1427285809Sscottl                   void              *ioContext
1428285809Sscottl                  );
1429285809Sscottl
1430285809SscottlosGLOBAL void
1431285809SscottlsmsatModeSelect6n10CB(
1432285809Sscottl                      agsaRoot_t        *agRoot,
1433285809Sscottl                      agsaIORequest_t   *agIORequest,
1434285809Sscottl                      bit32             agIOStatus,
1435285809Sscottl                      agsaFisHeader_t   *agFirstDword,
1436285809Sscottl                      bit32             agIOInfoLen,
1437285809Sscottl                      agsaFrameHandle_t agFrameHandle,
1438285809Sscottl                      void              *ioContext
1439285809Sscottl                     );
1440285809Sscottl
1441285809SscottlosGLOBAL void
1442285809SscottlsmsatSynchronizeCache10n16CB(
1443285809Sscottl                             agsaRoot_t        *agRoot,
1444285809Sscottl                             agsaIORequest_t   *agIORequest,
1445285809Sscottl                             bit32             agIOStatus,
1446285809Sscottl                             agsaFisHeader_t   *agFirstDword,
1447285809Sscottl                             bit32             agIOInfoLen,
1448285809Sscottl                             agsaFrameHandle_t agFrameHandle,
1449285809Sscottl                             void              *ioContext
1450285809Sscottl                            );
1451285809Sscottl
1452285809SscottlosGLOBAL void
1453285809SscottlsmsatNonChainedWriteNVerifyCB(
1454285809Sscottl                              agsaRoot_t        *agRoot,
1455285809Sscottl                              agsaIORequest_t   *agIORequest,
1456285809Sscottl                              bit32             agIOStatus,
1457285809Sscottl                              agsaFisHeader_t   *agFirstDword,
1458285809Sscottl                              bit32             agIOInfoLen,
1459285809Sscottl                              void              *agParam,
1460285809Sscottl                              void              *ioContext
1461285809Sscottl                             );
1462285809Sscottl
1463285809SscottlosGLOBAL void
1464285809SscottlsmsatChainedWriteNVerifyCB(
1465285809Sscottl                           agsaRoot_t        *agRoot,
1466285809Sscottl                           agsaIORequest_t   *agIORequest,
1467285809Sscottl                           bit32             agIOStatus,
1468285809Sscottl                           agsaFisHeader_t   *agFirstDword,
1469285809Sscottl                           bit32             agIOInfoLen,
1470285809Sscottl                           void              *agParam,
1471285809Sscottl                           void              *ioContext
1472285809Sscottl                          );
1473285809Sscottl
1474285809SscottlosGLOBAL void
1475285809SscottlsmsatReadMediaSerialNumberCB(
1476285809Sscottl                             agsaRoot_t        *agRoot,
1477285809Sscottl                             agsaIORequest_t   *agIORequest,
1478285809Sscottl                             bit32             agIOStatus,
1479285809Sscottl                             agsaFisHeader_t   *agFirstDword,
1480285809Sscottl                             bit32             agIOInfoLen,
1481285809Sscottl                             agsaFrameHandle_t agFrameHandle,
1482285809Sscottl                             void              *ioContext
1483285809Sscottl                            );
1484285809Sscottl
1485285809SscottlosGLOBAL void
1486285809SscottlsmsatReadBufferCB(
1487285809Sscottl                  agsaRoot_t        *agRoot,
1488285809Sscottl                  agsaIORequest_t   *agIORequest,
1489285809Sscottl                  bit32             agIOStatus,
1490285809Sscottl                  agsaFisHeader_t   *agFirstDword,
1491285809Sscottl                  bit32             agIOInfoLen,
1492285809Sscottl                  agsaFrameHandle_t agFrameHandle,
1493285809Sscottl                  void              *ioContext
1494285809Sscottl                 );
1495285809Sscottl
1496285809SscottlosGLOBAL void
1497285809SscottlsmsatWriteBufferCB(
1498285809Sscottl                   agsaRoot_t        *agRoot,
1499285809Sscottl                   agsaIORequest_t   *agIORequest,
1500285809Sscottl                   bit32             agIOStatus,
1501285809Sscottl                   agsaFisHeader_t   *agFirstDword,
1502285809Sscottl                   bit32             agIOInfoLen,
1503285809Sscottl                   agsaFrameHandle_t agFrameHandle,
1504285809Sscottl                   void              *ioContext
1505285809Sscottl                  );
1506285809Sscottl
1507285809SscottlosGLOBAL void
1508285809SscottlsmsatReassignBlocksCB(
1509285809Sscottl                      agsaRoot_t        *agRoot,
1510285809Sscottl                      agsaIORequest_t   *agIORequest,
1511285809Sscottl                      bit32             agIOStatus,
1512285809Sscottl                      agsaFisHeader_t   *agFirstDword,
1513285809Sscottl                      bit32             agIOInfoLen,
1514285809Sscottl                      agsaFrameHandle_t agFrameHandle,
1515285809Sscottl                      void              *ioContext
1516285809Sscottl                     );
1517285809Sscottl
1518285809SscottlosGLOBAL void
1519285809SscottlsmsatProcessAbnormalCompletion(
1520285809Sscottl                               agsaRoot_t        *agRoot,
1521285809Sscottl                               agsaIORequest_t   *agIORequest,
1522285809Sscottl                               bit32             agIOStatus,
1523285809Sscottl                               agsaFisHeader_t   *agFirstDword,
1524285809Sscottl                               bit32             agIOInfoLen,
1525285809Sscottl                               void              *agParam,
1526285809Sscottl                               smSatIOContext_t    *satIOContext
1527285809Sscottl                              );
1528285809Sscottl
1529285809SscottlosGLOBAL void
1530285809SscottlsmsatDelayedProcessAbnormalCompletion(
1531285809Sscottl                                      agsaRoot_t        *agRoot,
1532285809Sscottl                                      agsaIORequest_t   *agIORequest,
1533285809Sscottl                                      bit32             agIOStatus,
1534285809Sscottl                                      agsaFisHeader_t   *agFirstDword,
1535285809Sscottl                                      bit32             agIOInfoLen,
1536285809Sscottl                                      void              *agParam,
1537285809Sscottl                                      smSatIOContext_t    *satIOContext
1538285809Sscottl                                     );
1539285809Sscottl
1540285809SscottlosGLOBAL void
1541285809SscottlsmsatIOCompleted(
1542285809Sscottl                 smRoot_t           *smRoot,
1543285809Sscottl                 smIORequest_t      *smIORequest,
1544285809Sscottl                 agsaFisHeader_t    *agFirstDword,
1545285809Sscottl                 bit32              respFisLen,
1546285809Sscottl                 agsaFrameHandle_t  agFrameHandle,
1547285809Sscottl                 smSatIOContext_t     *satIOContext,
1548285809Sscottl                 bit32              interruptContext
1549285809Sscottl		);
1550285809Sscottl
1551285809SscottlosGLOBAL void
1552285809SscottlsmsatEncryptionHandler(
1553285809Sscottl                       smRoot_t                *smRoot,
1554285809Sscottl                       agsaIORequest_t         *agIORequest,
1555285809Sscottl                       bit32                   agIOStatus,
1556285809Sscottl                       bit32                   agIOInfoLen,
1557285809Sscottl                       void                    *agParam,
1558285809Sscottl                       bit32                   agOtherInfo,
1559285809Sscottl                       bit32                   interruptContext
1560285809Sscottl                      );
1561285809Sscottl
1562285809SscottlosGLOBAL void
1563285809SscottlsmsatDifHandler(
1564285809Sscottl                smRoot_t                *smRoot,
1565285809Sscottl                agsaIORequest_t         *agIORequest,
1566285809Sscottl                bit32                   agIOStatus,
1567285809Sscottl                bit32                   agIOInfoLen,
1568285809Sscottl                void                    *agParam,
1569285809Sscottl                bit32                   agOtherInfo,
1570285809Sscottl                bit32                   interruptContext
1571285809Sscottl               );
1572285809Sscottl
1573285809SscottlosGLOBAL void
1574285809SscottlsmsatProcessAbort(
1575285809Sscottl                  smRoot_t           *smRoot,
1576285809Sscottl                  smIORequest_t      *smIORequest,
1577285809Sscottl                  smSatIOContext_t     *satIOContext
1578285809Sscottl                 );
1579285809Sscottl
1580285809SscottlosGLOBAL void
1581285809SscottlsmsatNonDataIOCB(
1582285809Sscottl                  agsaRoot_t        *agRoot,
1583285809Sscottl                  agsaIORequest_t   *agIORequest,
1584285809Sscottl                  bit32             agIOStatus,
1585285809Sscottl                  agsaFisHeader_t   *agFirstDword,
1586285809Sscottl                  bit32             agIOInfoLen,
1587285809Sscottl                  void              *agParam,
1588285809Sscottl                  void              *ioContext
1589285809Sscottl                 );
1590285809Sscottl
1591285809SscottlosGLOBAL void
1592285809SscottlsmsatInquiryCB(
1593285809Sscottl               agsaRoot_t        *agRoot,
1594285809Sscottl               agsaIORequest_t   *agIORequest,
1595285809Sscottl               bit32             agIOStatus,
1596285809Sscottl               agsaFisHeader_t   *agFirstDword,
1597285809Sscottl               bit32             agIOInfoLen,
1598285809Sscottl               void              *agParam,
1599285809Sscottl               void              *ioContext
1600285809Sscottl              );
1601285809Sscottl
1602285809Sscottl
1603285809SscottlosGLOBAL void
1604285809SscottlsmsatInquiryIntCB(
1605285809Sscottl                   smRoot_t                  *smRoot,
1606285809Sscottl                   smIORequest_t             *smIORequest,
1607285809Sscottl                   smDeviceHandle_t          *smDeviceHandle,
1608285809Sscottl                   smScsiInitiatorRequest_t  *smScsiRequest,
1609285809Sscottl                   smSatIOContext_t            *satIOContext
1610285809Sscottl                  );
1611285809Sscottl
1612285809SscottlosGLOBAL void
1613285809SscottlsmsatVerify10CB(
1614285809Sscottl                agsaRoot_t        *agRoot,
1615285809Sscottl                agsaIORequest_t   *agIORequest,
1616285809Sscottl                bit32             agIOStatus,
1617285809Sscottl                agsaFisHeader_t   *agFirstDword,
1618285809Sscottl                bit32             agIOInfoLen,
1619285809Sscottl                void              *agParam,
1620285809Sscottl                void              *ioContext
1621285809Sscottl               );
1622285809Sscottl
1623285809SscottlosGLOBAL void
1624285809SscottlsmsatReadLogExtCB(
1625285809Sscottl                   agsaRoot_t        *agRoot,
1626285809Sscottl                   agsaIORequest_t   *agIORequest,
1627285809Sscottl                   bit32             agIOStatus,
1628285809Sscottl                   agsaFisHeader_t   *agFirstDword,
1629285809Sscottl                   bit32             agIOInfoLen,
1630285809Sscottl                   void              *agParam,
1631285809Sscottl                   void              *ioContext
1632285809Sscottl                 );
1633285809Sscottl
1634285809Sscottl
1635285809SscottlosGLOBAL void
1636285809SscottlsmsatIDStartCB(
1637285809Sscottl                agsaRoot_t        *agRoot,
1638285809Sscottl                agsaIORequest_t   *agIORequest,
1639285809Sscottl                bit32             agIOStatus,
1640285809Sscottl                agsaFisHeader_t   *agFirstDword,
1641285809Sscottl                bit32             agIOInfoLen,
1642285809Sscottl                void              *agParam,
1643285809Sscottl                void              *ioContext
1644285809Sscottl               );
1645285809Sscottl
1646285809SscottlosGLOBAL void
1647285809SscottlsmSMPCompleted(
1648285809Sscottl                agsaRoot_t            *agRoot,
1649285809Sscottl                agsaIORequest_t       *agIORequest,
1650285809Sscottl                bit32                 agIOStatus,
1651285809Sscottl                bit32                 agIOInfoLen,
1652285809Sscottl                agsaFrameHandle_t     agFrameHandle
1653285809Sscottl              );
1654285809Sscottl
1655285809SscottlosGLOBAL void
1656285809SscottlsmSMPCompletedCB(
1657285809Sscottl                  agsaRoot_t            *agRoot,
1658285809Sscottl                  agsaIORequest_t       *agIORequest,
1659285809Sscottl                  bit32                 agIOStatus,
1660285809Sscottl                  bit32                 agIOInfoLen,
1661285809Sscottl                  agsaFrameHandle_t     agFrameHandle
1662285809Sscottl                );
1663285809Sscottl
1664285809SscottlosGLOBAL void
1665285809SscottlsmPhyControlRespRcvd(
1666285809Sscottl                      smRoot_t              *smRoot,
1667285809Sscottl                      agsaRoot_t            *agRoot,
1668285809Sscottl                      agsaIORequest_t       *agIORequest,
1669285809Sscottl                      smDeviceData_t        *oneDeviceData,
1670285809Sscottl                      smSMPFrameHeader_t    *frameHeader,
1671285809Sscottl                      agsaFrameHandle_t     frameHandle,
1672285809Sscottl                      smIORequest_t         *CurrentTaskTag
1673285809Sscottl                     );
1674285809Sscottl
1675285809SscottlosGLOBAL void
1676285809SscottlsmsatCheckPowerModeCB(
1677285809Sscottl                      agsaRoot_t        *agRoot,
1678285809Sscottl                      agsaIORequest_t   *agIORequest,
1679285809Sscottl                      bit32             agIOStatus,
1680285809Sscottl                      agsaFisHeader_t   *agFirstDword,
1681285809Sscottl                      bit32             agIOInfoLen,
1682285809Sscottl                      agsaFrameHandle_t agFrameHandle,
1683285809Sscottl                      void              *ioContext
1684285809Sscottl                     );
1685285809Sscottl
1686285809SscottlosGLOBAL void
1687285809SscottlsmsatCheckPowerModePassCB(
1688285809Sscottl                      agsaRoot_t        *agRoot,
1689285809Sscottl                      agsaIORequest_t   *agIORequest,
1690285809Sscottl                      bit32             agIOStatus,
1691285809Sscottl                      agsaFisHeader_t   *agFirstDword,
1692285809Sscottl                      bit32             agIOInfoLen,
1693285809Sscottl                      agsaFrameHandle_t agFrameHandle,
1694285809Sscottl                      void              *ioContext
1695285809Sscottl                     );
1696285809Sscottl
1697285809SscottlosGLOBAL void
1698285809SscottlsmsatIDDataPassCB(
1699285809Sscottl                  agsaRoot_t        *agRoot,
1700285809Sscottl                  agsaIORequest_t   *agIORequest,
1701285809Sscottl                  bit32             agIOStatus,
1702285809Sscottl                  agsaFisHeader_t   *agFirstDword,
1703285809Sscottl                  bit32             agIOInfoLen,
1704285809Sscottl                  agsaFrameHandle_t agFrameHandle,
1705285809Sscottl                  void              *ioContext
1706285809Sscottl                 );
1707285809Sscottl
1708285809SscottlosGLOBAL void
1709285809SscottlsmsatResetDeviceCB(
1710285809Sscottl                    agsaRoot_t        *agRoot,
1711285809Sscottl                    agsaIORequest_t   *agIORequest,
1712285809Sscottl                    bit32             agIOStatus,
1713285809Sscottl                    agsaFisHeader_t   *agFirstDword,
1714285809Sscottl                    bit32             agIOInfoLen,
1715285809Sscottl                    agsaFrameHandle_t agFrameHandle,
1716285809Sscottl                    void              *ioContext
1717285809Sscottl                  );
1718285809Sscottl
1719285809SscottlosGLOBAL void
1720285809SscottlsmsatDeResetDeviceCB(
1721285809Sscottl                      agsaRoot_t        *agRoot,
1722285809Sscottl                      agsaIORequest_t   *agIORequest,
1723285809Sscottl                      bit32             agIOStatus,
1724285809Sscottl                      agsaFisHeader_t   *agFirstDword,
1725285809Sscottl                      bit32             agIOInfoLen,
1726285809Sscottl                      agsaFrameHandle_t agFrameHandle,
1727285809Sscottl                      void              *ioContext
1728285809Sscottl                    );
1729285809SscottlosGLOBAL void
1730285809SscottlsmaSATAAbortCB(
1731285809Sscottl                agsaRoot_t        *agRoot,
1732285809Sscottl                agsaIORequest_t   *agIORequest,
1733285809Sscottl                bit32             flag,
1734285809Sscottl                bit32             status
1735285809Sscottl	      );
1736285809Sscottl
1737285809SscottlosGLOBAL void
1738285809SscottlsmLocalPhyControlCB(
1739285809Sscottl                     agsaRoot_t     *agRoot,
1740285809Sscottl                     agsaContext_t  *agContext,
1741285809Sscottl                     bit32          phyId,
1742285809Sscottl                     bit32          phyOperation,
1743285809Sscottl                     bit32          status,
1744285809Sscottl                     void           *parm
1745285809Sscottl                    );
1746285809Sscottl/******************************** end of completion ***********************************************************/
1747285809Sscottl
1748285809Sscottl/******************************** start of utils    ***********************************************************/
1749285809SscottlosGLOBAL bit32 smsatComputeCDB10LBA(smSatIOContext_t            *satIOContext);
1750285809SscottlosGLOBAL bit32 smsatComputeCDB10TL(smSatIOContext_t            *satIOContext);
1751285809SscottlosGLOBAL bit32 smsatComputeCDB12LBA(smSatIOContext_t            *satIOContext);
1752285809SscottlosGLOBAL bit32 smsatComputeCDB12TL(smSatIOContext_t            *satIOContext);
1753285809SscottlosGLOBAL bit32 smsatComputeCDB16LBA(smSatIOContext_t            *satIOContext);
1754285809SscottlosGLOBAL bit32 smsatComputeCDB16TL(smSatIOContext_t            *satIOContext);
1755285809SscottlosGLOBAL FORCEINLINE bit32 smsatComputeLoopNum(bit32 a, bit32 b);
1756285809SscottlosGLOBAL FORCEINLINE bit32 smsatCheckLimit(bit8 *lba, bit8 *tl, int flag, smDeviceData_t *pSatDevData);
1757285809Sscottl
1758285809SscottlosGLOBAL void
1759285809SscottlsmsatSplitSGL(
1760285809Sscottl            smRoot_t                  *smRoot,
1761285809Sscottl            smIORequest_t             *smIORequest,
1762285809Sscottl            smDeviceHandle_t          *smDeviceHandle,
1763285809Sscottl            smScsiInitiatorRequest_t  *smScsiRequest,
1764285809Sscottl            smSatIOContext_t            *satIOContext,
1765285809Sscottl            bit32                     split,
1766285809Sscottl            bit32                     tl,
1767285809Sscottl            bit32                     flag
1768285809Sscottl	   );
1769285809Sscottl
1770285809SscottlosGLOBAL void
1771285809SscottlsmsatPrintSgl(
1772285809Sscottl            smRoot_t                  *smRoot,
1773285809Sscottl            agsaEsgl_t                *agEsgl,
1774285809Sscottl            bit32                     idx
1775285809Sscottl            );
1776285809Sscottl/******************************** end   of utils    ***********************************************************/
1777285809Sscottl
1778285809Sscottl
1779285809SscottlosGLOBAL void
1780285809SscottlsmsatPassthroughCB(
1781285809Sscottl                agsaRoot_t        *agRoot,
1782285809Sscottl                agsaIORequest_t   *agIORequest,
1783285809Sscottl                bit32             agIOStatus,
1784285809Sscottl                agsaFisHeader_t   *agFirstDword,
1785285809Sscottl                bit32             agIOInfoLen,
1786285809Sscottl                void              *agParam,
1787285809Sscottl                void              *ioContext
1788285809Sscottl               );
1789285809Sscottl
1790285809Sscottl
1791285809Sscottl#endif                          /* __SMPROTO_H__ */
1792285809Sscottl
1793