smproto.h revision 285809
1184610Salfred/*******************************************************************************
2184610Salfred*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3184610Salfred*
4184610Salfred*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5184610Salfred*that the following conditions are met:
6184610Salfred*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7184610Salfred*following disclaimer.
8184610Salfred*2. Redistributions in binary form must reproduce the above copyright notice,
9184610Salfred*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10184610Salfred*with the distribution.
11184610Salfred*
12184610Salfred*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13184610Salfred*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14184610Salfred*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15184610Salfred*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16184610Salfred*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17184610Salfred*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18184610Salfred*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19184610Salfred*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20184610Salfred*
21184610Salfred* $FreeBSD$
22184610Salfred*
23184610Salfred********************************************************************************/
24184610Salfred#ifndef __SMPROTO_H__
25184610Salfred#define __SMPROTO_H__
26184610Salfred
27184610Salfred#include <dev/pms/RefTisa/sat/src/smtypes.h>
28184610Salfred
29184610Salfred/***************** start of util ****************************************/
30184610SalfredosGLOBAL FORCEINLINE void*
31184610Salfredsm_memset(void *s, int c, bit32 n);
32184610Salfred
33184610SalfredosGLOBAL FORCEINLINE void *
34227843Smariussm_memcpy(void *dst, const void *src, bit32 count);
35227843Smarius
36227843SmariusosGLOBAL char
37184610Salfred*sm_strncpy(char *dst, const char *src, bit32 len);
38184610Salfred
39184610Salfred
40184610SalfredosGLOBAL void
41184610Salfredsmhexdump(const char *ptitle, bit8 *pbuf, size_t len);
42184610Salfred/***************** end of util ****************************************/
43184610Salfred
44184610Salfred/***************** start of timer fns ****************************************/
45184610SalfredosGLOBAL void
46184610SalfredsmTimerTick(smRoot_t 		*smRoot );
47184610Salfred
48184610SalfredosGLOBAL void
49184610SalfredsmInitTimerRequest(
50184610Salfred                   smRoot_t                *smRoot,
51194677Sthompsa                   smTimerRequest_t        *timerRequest
52194677Sthompsa                  );
53194677SthompsaosGLOBAL void
54194677SthompsasmSetTimerRequest(
55194677Sthompsa                  smRoot_t            *smRoot,
56194677Sthompsa                  smTimerRequest_t    *timerRequest,
57194677Sthompsa                  bit32               timeout,
58194677Sthompsa                  smTimerCBFunc_t     CBFunc,
59194677Sthompsa                  void                *timerData1,
60194677Sthompsa                  void                *timerData2,
61194677Sthompsa                  void                *timerData3
62194677Sthompsa                  );
63194677Sthompsa
64194677SthompsaosGLOBAL void
65194677SthompsasmAddTimer(
66194677Sthompsa           smRoot_t            *smRoot,
67194677Sthompsa           smList_t            *timerListHdr,
68194677Sthompsa           smTimerRequest_t    *timerRequest
69194677Sthompsa          );
70188746Sthompsa
71188942SthompsaosGLOBAL void
72194677SthompsasmKillTimer(
73194677Sthompsa            smRoot_t            *smRoot,
74246421Shselasky            smTimerRequest_t    *timerRequest
75242438Shselasky           );
76249796Shselasky
77184610SalfredosGLOBAL void
78184610SalfredsmProcessTimers(
79188942Sthompsa                smRoot_t *smRoot
80184610Salfred               );
81188942Sthompsa
82184610Salfred
83184610Salfred/***************** end of timer fns ****************************************/
84184610Salfred
85193640SariffosGLOBAL void
86193640SariffsmInitTimers(
87193640Sariff             smRoot_t *smRoot
88193640Sariff            );
89184610Salfred
90188957SthompsaosGLOBAL void
91188957SthompsasmDeviceDataInit(
92184610Salfred                 smRoot_t *smRoot,
93184610Salfred                 bit32    max_dev
94184610Salfred                );
95200825Sthompsa
96186730SalfredosGLOBAL void
97200825SthompsasmIOInit(
98308033Shselasky         smRoot_t *smRoot
99186730Salfred        );
100207077Sthompsa
101340352ShselaskyosGLOBAL FORCEINLINE void
102184610SalfredsmIOReInit(
103227309Sed          smRoot_t          *smRoot,
104200825Sthompsa          smIORequestBody_t *smIORequestBody
105192505Sthompsa          );
106184610Salfred
107200825SthompsaosGLOBAL void
108200825SthompsasmDeviceDataReInit(
109192505Sthompsa                   smRoot_t        *smRoot,
110186730Salfred                   smDeviceData_t  *oneDeviceData
111200825Sthompsa                  );
112200825Sthompsa
113192505SthompsaosGLOBAL void
114186730SalfredsmEnqueueIO(
115200825Sthompsa             smRoot_t           *smRoot,
116200825Sthompsa             smSatIOContext_t   *satIOContext
117192505Sthompsa             );
118186730Salfred
119308033ShselaskyosGLOBAL FORCEINLINE void
120308033ShselaskysmsatFreeIntIoResource(
121308033Shselasky             smRoot_t           *smRoot,
122308033Shselasky             smDeviceData_t     *satDevData,
123308033Shselasky             smSatInternalIo_t  *satIntIo
124308033Shselasky             );
125308033Shselasky
126308033ShselaskyosGLOBAL smSatInternalIo_t *
127308033ShselaskysmsatAllocIntIoResource(
128308033Shselasky                        smRoot_t              *smRoot,
129308033Shselasky                        smIORequest_t         *smIORequest,
130308033Shselasky                        smDeviceData_t        *satDevData,
131308033Shselasky                        bit32                 dmaAllocLength,
132308033Shselasky                        smSatInternalIo_t     *satIntIo);
133308033Shselasky
134308033Shselasky
135308033Shselasky
136308033ShselaskyosGLOBAL smDeviceData_t *
137308033ShselaskysmAddToSharedcontext(
138308033Shselasky                     smRoot_t                   *smRoot,
139308033Shselasky                     agsaDevHandle_t            *agDevHandle,
140308033Shselasky                     smDeviceHandle_t           *smDeviceHandle,
141308033Shselasky                     agsaDevHandle_t            *agExpDevHandle,
142308033Shselasky                     bit32                      phyID
143340352Shselasky                    );
144340352Shselasky
145184610SalfredosGLOBAL bit32
146184610SalfredsmRemoveFromSharedcontext(
147199060Sthompsa                          smRoot_t                      *smRoot,
148240609Shselasky                          agsaDevHandle_t               *agDevHandle,
149240609Shselasky                          smDeviceHandle_t              *smDeviceHandle
150283950Shselasky                         );
151283950Shselasky
152184610SalfredosGLOBAL smDeviceData_t *
153184610SalfredsmFindInSharedcontext(
154184610Salfred                      smRoot_t                  *smRoot,
155193465Sthompsa                      agsaDevHandle_t           *agDevHandle
156244567Shselasky                      );
157184610Salfred
158240609ShselaskyosGLOBAL bit32
159240609ShselaskysmsatLogSenseAllocate(
160240609Shselasky                      smRoot_t                  *smRoot,
161240609Shselasky                      smIORequest_t             *smIORequest,
162240609Shselasky                      smDeviceHandle_t          *smDeviceHandle,
163240609Shselasky                      smScsiInitiatorRequest_t  *smSCSIRequest,
164240609Shselasky                      smSatIOContext_t            *satIOContext,
165240609Shselasky                      bit32                     payloadSize,
166240609Shselasky                      bit32                     flag
167240609Shselasky                     );
168240609Shselasky
169240609ShselaskyosGLOBAL bit32
170240609ShselaskysmsatIDSubStart(
171240609Shselasky                 smRoot_t                 *smRoot,
172240609Shselasky                 smIORequest_t            *smIORequest,
173184610Salfred                 smDeviceHandle_t         *smDeviceHandle,
174242438Shselasky                 smScsiInitiatorRequest_t *smSCSIRequest,
175242438Shselasky                 smSatIOContext_t           *satIOContext
176184610Salfred               );
177184610Salfred
178242438Shselasky
179184610SalfredosGLOBAL bit32
180184610SalfredsmsatIDStart(
181184610Salfred              smRoot_t                  *smRoot,
182184610Salfred              smIORequest_t             *smIORequest,
183242438Shselasky              smDeviceHandle_t          *smDeviceHandle,
184184610Salfred              smScsiInitiatorRequest_t  *smSCSIRequest,
185184610Salfred              smSatIOContext_t            *satIOContext
186184610Salfred             );
187184610Salfred
188184610Salfred
189184610SalfredosGLOBAL FORCEINLINE bit32
190184610SalfredsmsatIOStart(
191184610Salfred              smRoot_t                  *smRoot,
192184610Salfred              smIORequest_t             *smIORequest,
193184610Salfred              smDeviceHandle_t          *smDeviceHandle,
194184610Salfred              smScsiInitiatorRequest_t  *smSCSIRequest,
195184610Salfred              smSatIOContext_t            *satIOContext
196184610Salfred             );
197184610Salfred
198184610SalfredosGLOBAL void
199184610SalfredsmsatSetSensePayload(
200184610Salfred                     smScsiRspSense_t   *pSense,
201242453Shselasky                     bit8               SnsKey,
202184610Salfred                     bit32              SnsInfo,
203242438Shselasky                     bit16              SnsCode,
204242438Shselasky                     smSatIOContext_t     *satIOContext
205184610Salfred		    );
206184610Salfred
207184610SalfredosGLOBAL void
208249796ShselaskysmsatSetDeferredSensePayload(
209249796Shselasky                             smScsiRspSense_t *pSense,
210249796Shselasky                             bit8             SnsKey,
211249796Shselasky                             bit32            SnsInfo,
212249796Shselasky                             bit16            SnsCode,
213263642Shselasky                             smSatIOContext_t   *satIOContext
214249796Shselasky                            );
215249796Shselasky
216249796ShselaskyosGLOBAL FORCEINLINE bit32
217249796ShselaskysmsatIOPrepareSGL(
218249796Shselasky                  smRoot_t                 *smRoot,
219249796Shselasky                  smIORequestBody_t        *smIORequestBody,
220249796Shselasky                  smSgl_t                  *smSgl1,
221249796Shselasky                  void                     *sglVirtualAddr
222249796Shselasky                  );
223249796ShselaskyosGLOBAL FORCEINLINE void
224249796ShselaskysmsatBitSet(smRoot_t *smRoot,bit8 *data, bit32 index);
225249796Shselasky
226249796ShselaskyosGLOBAL FORCEINLINE void
227249796ShselaskysmsatBitClear(smRoot_t *smRoot,bit8 *data, bit32 index);
228184610Salfred
229184610SalfredosGLOBAL FORCEINLINE BOOLEAN
230249796ShselaskysmsatBitTest(smRoot_t *smRoot,bit8 *data, bit32 index);
231184610Salfred
232184610SalfredosGLOBAL FORCEINLINE bit32
233184610SalfredsmsatTagAlloc(
234184610Salfred               smRoot_t         *smRoot,
235242223Shselasky               smDeviceData_t   *pSatDevData,
236184610Salfred               bit8             *pTag
237184610Salfred             );
238184610Salfred
239184610SalfredosGLOBAL FORCEINLINE bit32
240184610SalfredsmsatTagRelease(
241184610Salfred                smRoot_t         *smRoot,
242184610Salfred                smDeviceData_t   *pSatDevData,
243199060Sthompsa                bit8              tag
244200825Sthompsa               );
245200825Sthompsa
246200825SthompsaosGLOBAL FORCEINLINE void
247249796ShselaskysmsatDecrementPendingIO(
248280591Shselasky                        smRoot_t                *smRoot,
249280591Shselasky                        smIntContext_t          *smAllShared,
250200825Sthompsa                        smSatIOContext_t        *satIOContext
251280591Shselasky                        );
252280591Shselasky
253184610SalfredosGLOBAL smSatIOContext_t *
254184610SalfredsmsatPrepareNewIO(
255200825Sthompsa                  smSatInternalIo_t       *satNewIntIo,
256184610Salfred                  smIORequest_t           *smOrgIORequest,
257280591Shselasky                  smDeviceData_t          *satDevData,
258280591Shselasky                  smIniScsiCmnd_t         *scsiCmnd,
259280591Shselasky                  smSatIOContext_t        *satOrgIOContext
260280591Shselasky                 );
261280591Shselasky
262280591ShselaskyosGLOBAL void
263249796ShselaskysmsatSetDevInfo(
264249796Shselasky                 smDeviceData_t            *oneDeviceData,
265249796Shselasky                 agsaSATAIdentifyData_t    *SATAIdData
266249796Shselasky               );
267359890Shselasky
268359890ShselaskyosGLOBAL void
269184610SalfredsmsatInquiryStandard(
270184610Salfred                     bit8                    *pInquiry,
271272423Shselasky                     agsaSATAIdentifyData_t  *pSATAIdData,
272224024Shselasky                     smIniScsiCmnd_t         *scsiCmnd
273223727Shselasky                    );
274184610Salfred
275218791ShselaskyosGLOBAL void
276218791ShselaskysmsatInquiryPage0(
277218791Shselasky                   bit8                    *pInquiry,
278218791Shselasky                   agsaSATAIdentifyData_t  *pSATAIdData
279218791Shselasky		 );
280218791Shselasky
281184610SalfredosGLOBAL void
282192984SthompsasmsatInquiryPage83(
283184610Salfred                    bit8                    *pInquiry,
284184610Salfred                    agsaSATAIdentifyData_t  *pSATAIdData,
285184610Salfred                    smDeviceData_t          *oneDeviceData
286184610Salfred		  );
287184610Salfred
288184610Salfred
289184610SalfredosGLOBAL void
290184610SalfredsmsatInquiryPage89(
291184610Salfred                    bit8                    *pInquiry,
292184610Salfred                    agsaSATAIdentifyData_t  *pSATAIdData,
293184610Salfred                    smDeviceData_t          *oneDeviceData,
294184610Salfred                    bit32                   len
295184610Salfred		  );
296184610Salfred
297184610SalfredosGLOBAL void
298184610SalfredsmsatInquiryPage80(
299184610Salfred                    bit8                    *pInquiry,
300184610Salfred                    agsaSATAIdentifyData_t  *pSATAIdData
301184610Salfred		   );
302272423Shselasky
303184610SalfredosGLOBAL void
304184610SalfredsmsatInquiryPageB1(
305192984Sthompsa                    bit8                    *pInquiry,
306184610Salfred                    agsaSATAIdentifyData_t  *pSATAIdData
307184610Salfred		   );
308184610Salfred
309184610SalfredosGLOBAL void
310184610SalfredsmsatDefaultTranslation(
311184610Salfred                        smRoot_t                  *smRoot,
312184610Salfred                        smIORequest_t             *smIORequest,
313184610Salfred                        smSatIOContext_t            *satIOContext,
314272423Shselasky                        smScsiRspSense_t          *pSense,
315184610Salfred                        bit8                      ataStatus,
316223736Shselasky                        bit8                      ataError,
317184610Salfred                        bit32                     interruptContext
318184610Salfred                       );
319240609Shselasky
320240609ShselaskyosGLOBAL bit32
321240609ShselaskysmPhyControlSend(
322240609Shselasky                  smRoot_t             *smRoot,
323240609Shselasky                  smDeviceData_t       *oneDeviceData,
324240609Shselasky                  bit8                 phyOp,
325240609Shselasky                  smIORequest_t        *CurrentTaskTag,
326240609Shselasky                  bit32                queueNumber
327246421Shselasky                );
328246421Shselasky
329246421ShselaskyosGLOBAL bit32
330246421ShselaskysmsatTaskManagement(
331246421Shselasky                    smRoot_t          *smRoot,
332246421Shselasky                    smDeviceHandle_t  *smDeviceHandle,
333246421Shselasky                    bit32             task,
334246421Shselasky                    smLUN_t           *lun,
335246421Shselasky                    smIORequest_t     *taskTag,
336246454Shselasky                    smIORequest_t     *currentTaskTag,
337246421Shselasky                    smIORequestBody_t *smIORequestBody
338246421Shselasky		   );
339246421Shselasky
340246421ShselaskyosGLOBAL bit32
341246421ShselaskysmsatTmAbortTask(
342246454Shselasky                  smRoot_t                  *smRoot,
343246421Shselasky                  smIORequest_t             *currentTaskTag,
344246421Shselasky                  smDeviceHandle_t          *smDeviceHandle,
345246421Shselasky                  smScsiInitiatorRequest_t  *tiScsiRequest,
346246454Shselasky                  smSatIOContext_t            *satIOContext,
347246421Shselasky                  smIORequest_t             *taskTag);
348246421Shselasky
349315249ShselaskyosGLOBAL bit32
350315249ShselaskysmsatStartCheckPowerMode(
351315249Shselasky                         smRoot_t                  *smRoot,
352315249Shselasky                         smIORequest_t             *currentTaskTag,
353315249Shselasky                         smDeviceHandle_t          *smDeviceHandle,
354359890Shselasky                         smScsiInitiatorRequest_t  *smScsiRequest,
355359890Shselasky                         smSatIOContext_t            *satIOContext
356359890Shselasky                        );
357359890ShselaskyosGLOBAL bit32
358359890ShselaskysmsatStartResetDevice(
359359890Shselasky                       smRoot_t                  *smRoot,
360359890Shselasky                       smIORequest_t             *currentTaskTag,
361359890Shselasky                       smDeviceHandle_t          *smDeviceHandle,
362359890Shselasky                       smScsiInitiatorRequest_t  *smScsiRequest,
363359890Shselasky                       smSatIOContext_t            *satIOContext
364359890Shselasky                     );
365359890ShselaskyosGLOBAL void
366359890ShselaskysmsatAbort(
367359890Shselasky           smRoot_t          *smRoot,
368184610Salfred           agsaRoot_t        *agRoot,
369184610Salfred           smSatIOContext_t    *satIOContext
370184610Salfred	  );
371359890Shselasky
372359890ShselaskyosGLOBAL smIORequestBody_t *
373184610SalfredsmDequeueIO(smRoot_t          *smRoot);
374246421Shselasky
375240609ShselaskyosGLOBAL bit32
376244567ShselaskysmsatDecodeSATADeviceType(bit8 * pSignature);
377249796Shselasky
378359890Shselasky/******************************** beginning of start ******************************************************/
379184610Salfred
380192984Sthompsa/*! \brief SAT implementation for ATAPI Packet Command.
381192984Sthompsa *
382184610Salfred *  SAT implementation for ATAPI Packet and send FIS request to LL layer.
383184610Salfred *
384315249Shselasky *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
385184610Salfred *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
386184610Salfred *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
387184610Salfred *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
388184610Salfred *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
389184610Salfred *
390184610Salfred *  \return If command is started successfully
391184610Salfred *    - \e smIOSuccess: 	  I/O request successfully initiated.
392359890Shselasky *    - \e smIOBusy:        No resources available, try again later.
393184610Salfred *    - \e smIOIONoDevice:  Invalid device handle.
394184610Salfred *    - \e smIOError:       Other errors.
395184610Salfred */
396184610Salfred/*****************************************************************************/
397218988ShselaskyosGLOBAL bit32
398283950ShselaskysmsatPacket(
399184610Salfred            smRoot_t                  *smRoot,
400184610Salfred            smIORequest_t             *smIORequest,
401184610Salfred            smDeviceHandle_t          *smDeviceHandle,
402184610Salfred            smScsiInitiatorRequest_t  *smScsiRequest,
403192984Sthompsa            smSatIOContext_t            *satIOContext
404240609Shselasky            );
405240609Shselasky
406240609ShselaskyosGLOBAL void
407240609ShselaskysmsatPacketCB(
408240609Shselasky            agsaRoot_t        *agRoot,
409240609Shselasky            agsaIORequest_t   *agIORequest,
410240609Shselasky            bit32             agIOStatus,
411240609Shselasky            agsaFisHeader_t   *agFirstDword,
412240609Shselasky            bit32             agIOInfoLen,
413240609Shselasky            void              *agParam,
414240609Shselasky            void              *ioContext
415240609Shselasky            );
416240609Shselasky/*****************************************************************************/
417240609Shselasky/*! \brief SAT implementation for smsatExecuteDeviceDiagnostic.
418240609Shselasky *
419240609Shselasky *  This function creates Execute Device Diagnostic fis and sends the request to LL layer
420240609Shselasky *
421240609Shselasky *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
422240609Shselasky *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
423184610Salfred *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
424184610Salfred *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
425184610Salfred *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
426184610Salfred *
427184610Salfred *  \return If command is started successfully
428184610Salfred *    - \e smIOSuccess: 	  I/O request successfully initiated.
429184610Salfred *    - \e smIOBusy:        No resources available, try again later.
430184610Salfred *    - \e smIOIONoDevice:  Invalid device handle.
431184610Salfred *    - \e smIOError:       Other errors.
432184610Salfred
433184610Salfred */
434184610Salfred/*****************************************************************************/
435240609ShselaskyosGLOBAL bit32
436184610SalfredsmsatExecuteDeviceDiagnostic(
437184610Salfred       smRoot_t                  *smRoot,
438184610Salfred       smIORequest_t             *smIORequest,
439184610Salfred       smDeviceHandle_t          *smDeviceHandle,
440184610Salfred       smScsiInitiatorRequest_t  *smScsiRequest,
441184610Salfred       smSatIOContext_t            *satIOContext
442184610Salfred       );
443184610Salfred
444184610SalfredosGLOBAL void
445184610SalfredsmsatExecuteDeviceDiagnosticCB(
446184610Salfred       agsaRoot_t        *agRoot,
447184610Salfred       agsaIORequest_t   *agIORequest,
448184610Salfred       bit32             agIOStatus,
449184610Salfred       agsaFisHeader_t   *agFirstDword,
450184610Salfred       bit32             agIOInfoLen,
451184610Salfred       void              *agParam,
452184610Salfred       void              *ioContext
453240609Shselasky       );
454240609Shselasky/* set feature for auto activate */
455240609ShselaskyosGLOBAL bit32
456240609ShselaskysmsatSetFeaturesAA(
457240609Shselasky           smRoot_t                  *smRoot,
458240609Shselasky           smIORequest_t             *smIORequest,
459240609Shselasky           smDeviceHandle_t          *smDeviceHandle,
460240609Shselasky           smScsiInitiatorRequest_t  *smScsiRequest,
461240609Shselasky           smSatIOContext_t            *satIOContext
462240609Shselasky           );
463240609ShselaskyosGLOBAL void
464240609ShselaskysmsatSetFeaturesAACB(
465240609Shselasky         agsaRoot_t        *agRoot,
466240609Shselasky         agsaIORequest_t   *agIORequest,
467240609Shselasky         bit32             agIOStatus,
468240609Shselasky         agsaFisHeader_t   *agFirstDword,
469240609Shselasky         bit32             agIOInfoLen,
470240609Shselasky         void              *agParam,
471184610Salfred         void              *ioContext
472184610Salfred         );
473184610Salfred
474184610Salfred/*****************************************************************************/
475184610Salfred/*! \brief SAT implementation for satSetFeatures.
476184610Salfred *
477193045Sthompsa *  This function creates SetFeatures fis and sends the request to LL layer
478242223Shselasky *
479193045Sthompsa *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
480242223Shselasky *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
481193045Sthompsa *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
482193045Sthompsa *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
483193045Sthompsa *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
484246421Shselasky *
485184610Salfred *  \return If command is started successfully
486249796Shselasky *    - \e smIOSuccess: 	  I/O request successfully initiated.
487249796Shselasky *    - \e smIOBusy:        No resources available, try again later.
488242438Shselasky *    - \e smIOIONoDevice:  Invalid device handle.
489242438Shselasky *    - \e smIOError:       Other errors.
490242438Shselasky */
491242438Shselasky/*****************************************************************************/
492359890ShselaskyosGLOBAL bit32
493242438ShselaskysmsatSetFeaturesPIO(
494242453Shselasky           smRoot_t                  *smRoot,
495242438Shselasky           smIORequest_t             *smIORequest,
496240609Shselasky           smDeviceHandle_t          *smDeviceHandle,
497240609Shselasky           smScsiInitiatorRequest_t  *smScsiRequest,
498185948Sthompsa           smSatIOContext_t          *satIOContext
499185948Sthompsa           );
500185948SthompsaosGLOBAL void
501185948SthompsasmsatSetFeaturesPIOCB(
502185948Sthompsa          agsaRoot_t        *agRoot,
503203678Sbrucec          agsaIORequest_t   *agIORequest,
504185948Sthompsa          bit32             agIOStatus,
505185948Sthompsa          agsaFisHeader_t   *agFirstDword,
506185948Sthompsa          bit32             agIOInfoLen,
507185948Sthompsa          void              *agParam,
508185948Sthompsa          void              *ioContext
509185948Sthompsa          );
510185948Sthompsa
511185948SthompsaosGLOBAL bit32
512203678SbrucecsmsatSetFeaturesDMA(
513185948Sthompsa           smRoot_t                  *smRoot,
514359881Shselasky           smIORequest_t             *smIORequest,
515185948Sthompsa           smDeviceHandle_t          *smDeviceHandle,
516185948Sthompsa           smScsiInitiatorRequest_t  *smScsiRequest,
517240609Shselasky           smSatIOContext_t            *satIOContext
518240609Shselasky           );
519240609Shselasky
520240609ShselaskyosGLOBAL void
521240609ShselaskysmsatSetFeaturesDMACB(
522240609Shselasky         agsaRoot_t        *agRoot,
523240609Shselasky         agsaIORequest_t   *agIORequest,
524240609Shselasky         bit32             agIOStatus,
525240609Shselasky         agsaFisHeader_t   *agFirstDword,
526240609Shselasky         bit32             agIOInfoLen,
527240609Shselasky         void              *agParam,
528240609Shselasky         void              *ioContext
529240609Shselasky         );
530240609Shselasky
531240609ShselaskyosGLOBAL bit32
532359881ShselaskysmsatSetFeaturesReadLookAhead(
533240609Shselasky           smRoot_t                  *smRoot,
534240609Shselasky           smIORequest_t             *smIORequest,
535240609Shselasky           smDeviceHandle_t          *smDeviceHandle,
536240609Shselasky           smScsiInitiatorRequest_t  *smScsiRequest,
537240609Shselasky           smSatIOContext_t            *satIOContext
538240609Shselasky           );
539240609Shselasky
540240609ShselaskyosGLOBAL void
541240609ShselaskysmsatSetFeaturesReadLookAheadCB(
542240609Shselasky         agsaRoot_t        *agRoot,
543240609Shselasky         agsaIORequest_t   *agIORequest,
544240609Shselasky         bit32             agIOStatus,
545240609Shselasky         agsaFisHeader_t   *agFirstDword,
546240609Shselasky         bit32             agIOInfoLen,
547240609Shselasky         void              *agParam,
548240609Shselasky         void              *ioContext
549185948Sthompsa         );
550192984Sthompsa
551185948SthompsaosGLOBAL bit32
552359890ShselaskysmsatSetFeaturesVolatileWriteCache(
553185948Sthompsa           smRoot_t                  *smRoot,
554192984Sthompsa           smIORequest_t             *smIORequest,
555192984Sthompsa           smDeviceHandle_t          *smDeviceHandle,
556192984Sthompsa           smScsiInitiatorRequest_t  *smScsiRequest,
557192984Sthompsa           smSatIOContext_t            *satIOContext
558192984Sthompsa           );
559192984Sthompsa
560192984SthompsaosGLOBAL void
561192984SthompsasmsatSetFeaturesVolatileWriteCacheCB(
562185948Sthompsa         agsaRoot_t        *agRoot,
563218988Shselasky         agsaIORequest_t   *agIORequest,
564218988Shselasky         bit32             agIOStatus,
565246421Shselasky         agsaFisHeader_t   *agFirstDword,
566246421Shselasky         bit32             agIOInfoLen,
567246421Shselasky         void              *agParam,
568184610Salfred         void              *ioContext
569207077Sthompsa         );
570185948Sthompsa
571203678SbrucecosGLOBAL void
572184610SalfredsmsatSMARTEnablePassCB(
573184610Salfred                     agsaRoot_t        *agRoot,
574192984Sthompsa                     agsaIORequest_t   *agIORequest,
575242223Shselasky                     bit32             agIOStatus,
576184610Salfred                     agsaFisHeader_t   *agFirstDword,
577184610Salfred                     bit32             agIOInfoLen,
578184610Salfred                     agsaFrameHandle_t agFrameHandle,
579184610Salfred                     void              *ioContext
580190734Sthompsa                    );
581199060Sthompsa
582190734SthompsaosGLOBAL void
583190734SthompsasmsatSMARTRStatusPassCB(
584184610Salfred                agsaRoot_t        *agRoot,
585184610Salfred                agsaIORequest_t   *agIORequest,
586184610Salfred                bit32             agIOStatus,
587184610Salfred                agsaFisHeader_t   *agFirstDword,
588184610Salfred                bit32             agIOInfoLen,
589184610Salfred                void              *agParam,
590190734Sthompsa                void              *ioContext
591199060Sthompsa               );
592190734SthompsaosGLOBAL void
593190734SthompsasmsatSMARTReadLogCB(
594184610Salfred                agsaRoot_t        *agRoot,
595242223Shselasky                agsaIORequest_t   *agIORequest,
596242223Shselasky                bit32             agIOStatus,
597242223Shselasky                agsaFisHeader_t   *agFirstDword,
598242223Shselasky                bit32             agIOInfoLen,
599242223Shselasky                void              *agParam,
600242223Shselasky                void              *ioContext
601242223Shselasky               );
602242223Shselasky
603242223Shselasky
604242223Shselasky/*****************************************************************************/
605184610Salfred/*! \brief SAT implementation for SCSI REQUEST SENSE to ATAPI device.
606184610Salfred *
607192984Sthompsa *  SAT implementation for SCSI REQUEST SENSE.
608242223Shselasky *
609184610Salfred *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
610184610Salfred *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
611184610Salfred *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
612184610Salfred *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
613190734Sthompsa *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
614199060Sthompsa *
615190734Sthompsa *  \return If command is started successfully
616190734Sthompsa *    - \e smIOSuccess: 	  I/O request successfully initiated.
617184610Salfred *    - \e smIOBusy:        No resources available, try again later.
618184610Salfred *    - \e smIOIONoDevice:  Invalid device handle.
619184610Salfred *    - \e smIOError:       Other errors.
620184610Salfred */
621184610Salfred/*****************************************************************************/
622184610SalfredosGLOBAL bit32
623190734SthompsasmsatRequestSenseForATAPI(
624199060Sthompsa        smRoot_t                  *smRoot,
625190734Sthompsa        smIORequest_t             *smIORequest,
626190734Sthompsa        smDeviceHandle_t          *smDeviceHandle,
627184610Salfred        smScsiInitiatorRequest_t  *smScsiRequest,
628242223Shselasky        smSatIOContext_t            *satIOContext
629242223Shselasky        );
630242223Shselasky
631242223ShselaskyosGLOBAL void
632242223ShselaskysmsatRequestSenseForATAPICB(
633242223Shselasky        agsaRoot_t        *agRoot,
634242223Shselasky        agsaIORequest_t   *agIORequest,
635242223Shselasky        bit32             agIOStatus,
636242223Shselasky        agsaFisHeader_t   *agFirstDword,
637242223Shselasky        bit32             agIOInfoLen,
638184610Salfred        void              *agParam,
639184610Salfred        void              *ioContext
640192984Sthompsa        );
641184610Salfred
642184610Salfred/*****************************************************************************/
643184610Salfred/*! \brief SAT implementation for smsatDeviceReset.
644184610Salfred *
645184610Salfred *  This function creates DEVICE RESET fis and sends the request to LL layer
646192984Sthompsa *
647190734Sthompsa *  \param   smRoot:           Pointer to TISA initiator driver/port instance.
648190734Sthompsa *  \param   smIORequest:      Pointer to TISA I/O request context for this I/O.
649184610Salfred *  \param   smDeviceHandle:   Pointer to TISA device handle for this I/O.
650184610Salfred *  \param   smScsiRequest:    Pointer to TISA SCSI I/O request and SGL list.
651184610Salfred *  \param   smSatIOContext_t:   Pointer to the SAT IO Context
652184610Salfred *
653184610Salfred *  \return If command is started successfully
654184610Salfred *    - \e smIOSuccess: 	  I/O request successfully initiated.
655184610Salfred *    - \e smIOBusy:        No resources available, try again later.
656184610Salfred *    - \e smIONoDevice:  Invalid device handle.
657184610Salfred *    - \e smIOError:       Other errors.
658184610Salfred */
659184610Salfred/*****************************************************************************/
660184610SalfredosGLOBAL bit32
661184610SalfredsmsatDeviceReset(
662184610Salfred        smRoot_t                  *smRoot,
663184610Salfred        smIORequest_t             *smIORequest,
664184610Salfred        smDeviceHandle_t          *smDeviceHandle,
665184610Salfred        smScsiInitiatorRequest_t  *smScsiRequest,
666184610Salfred        smSatIOContext_t            *satIOContext
667184610Salfred        );
668184610Salfred
669184610SalfredosGLOBAL void
670184610SalfredsmsatDeviceResetCB(
671184610Salfred         agsaRoot_t        *agRoot,
672192984Sthompsa         agsaIORequest_t   *agIORequest,
673184610Salfred         bit32             agIOStatus,
674218791Shselasky         agsaFisHeader_t   *agFirstDword,
675184610Salfred         bit32             agIOInfoLen,
676184610Salfred         void              *agParam,
677184610Salfred         void              *ioContext
678223727Shselasky         );
679303993Shselasky
680190734Sthompsa
681184610SalfredosGLOBAL void
682184610SalfredsmsatTranslateATAPIErrorsToSCSIErrors(
683218791Shselasky        bit8   bCommand,
684184610Salfred        bit8   bATAStatus,
685184610Salfred        bit8   bATAError,
686184610Salfred        bit8   *pSenseKey,
687209450Sthompsa        bit16  *pSenseCodeInfo
688303993Shselasky        );
689190734Sthompsa
690184610SalfredGLOBAL void
691184610SalfredsmsatTranslateATAErrorsToSCSIErrors(
692184610Salfred    bit8   bATAStatus,
693246421Shselasky    bit8   bATAError,
694246421Shselasky    bit8   *pSenseKey,
695246421Shselasky    bit16  *pSenseCodeInfo
696246421Shselasky    );
697246421Shselasky
698246421Shselasky/*****************************************************************************/
699246421Shselasky
700246421ShselaskyosGLOBAL bit32
701246421ShselaskysmsatRead6(
702246421Shselasky           smRoot_t                  *smRoot,
703246421Shselasky           smIORequest_t             *smIORequest,
704246421Shselasky           smDeviceHandle_t          *smDeviceHandle,
705184610Salfred           smScsiInitiatorRequest_t  *smScsiRequest,
706184610Salfred           smSatIOContext_t            *satIOContext
707184610Salfred	  );
708184610Salfred
709184610SalfredosGLOBAL FORCEINLINE bit32
710184610SalfredsmsatRead10(
711184610Salfred            smRoot_t                  *smRoot,
712184610Salfred            smIORequest_t             *smIORequest,
713184610Salfred            smDeviceHandle_t          *smDeviceHandle,
714227843Smarius            smScsiInitiatorRequest_t  *smScsiRequest,
715227843Smarius            smSatIOContext_t            *satIOContext
716184610Salfred	   );
717184610Salfred
718184610SalfredosGLOBAL bit32
719184610SalfredsmsatRead12(
720184610Salfred            smRoot_t                  *smRoot,
721184610Salfred            smIORequest_t             *smIORequest,
722184610Salfred            smDeviceHandle_t          *smDeviceHandle,
723184610Salfred            smScsiInitiatorRequest_t  *smScsiRequest,
724244027Shselasky            smSatIOContext_t            *satIOContext
725244027Shselasky	   );
726244027Shselasky
727244027ShselaskyosGLOBAL bit32
728244027ShselaskysmsatRead16(
729244027Shselasky            smRoot_t                  *smRoot,
730244027Shselasky            smIORequest_t             *smIORequest,
731244027Shselasky            smDeviceHandle_t          *smDeviceHandle,
732244027Shselasky            smScsiInitiatorRequest_t  *smScsiRequest,
733244027Shselasky            smSatIOContext_t            *satIOContext
734244027Shselasky	   );
735244027Shselasky
736244027ShselaskyosGLOBAL bit32
737244027ShselaskysmsatWrite6(
738244027Shselasky            smRoot_t                  *smRoot,
739244027Shselasky            smIORequest_t             *smIORequest,
740244027Shselasky            smDeviceHandle_t          *smDeviceHandle,
741244027Shselasky            smScsiInitiatorRequest_t  *smScsiRequest,
742244027Shselasky            smSatIOContext_t            *satIOContext
743244027Shselasky	   );
744244027Shselasky
745244027ShselaskyosGLOBAL FORCEINLINE bit32
746244027ShselaskysmsatWrite10(
747244027Shselasky             smRoot_t                  *smRoot,
748244027Shselasky             smIORequest_t             *smIORequest,
749244027Shselasky             smDeviceHandle_t          *smDeviceHandle,
750244027Shselasky             smScsiInitiatorRequest_t  *smScsiRequest,
751244027Shselasky             smSatIOContext_t            *satIOContext
752244027Shselasky            );
753244027Shselasky
754244027ShselaskyosGLOBAL bit32
755244027ShselaskysmsatWrite12(
756244027Shselasky             smRoot_t                  *smRoot,
757244027Shselasky             smIORequest_t             *smIORequest,
758244027Shselasky             smDeviceHandle_t          *smDeviceHandle,
759244027Shselasky             smScsiInitiatorRequest_t  *smScsiRequest,
760244027Shselasky             smSatIOContext_t            *satIOContext
761244027Shselasky            );
762244027Shselasky
763244027ShselaskyosGLOBAL bit32
764244027ShselaskysmsatWrite16(
765244027Shselasky             smRoot_t                  *smRoot,
766244027Shselasky             smIORequest_t             *smIORequest,
767244027Shselasky             smDeviceHandle_t          *smDeviceHandle,
768244027Shselasky             smScsiInitiatorRequest_t  *smScsiRequest,
769244027Shselasky             smSatIOContext_t            *satIOContext
770244027Shselasky            );
771244027Shselasky
772244027ShselaskyosGLOBAL bit32
773244027ShselaskysmsatVerify10(
774244027Shselasky              smRoot_t                  *smRoot,
775244027Shselasky              smIORequest_t             *smIORequest,
776244027Shselasky              smDeviceHandle_t          *smDeviceHandle,
777244027Shselasky              smScsiInitiatorRequest_t  *smScsiRequest,
778244027Shselasky              smSatIOContext_t            *satIOContext
779244027Shselasky             );
780244027Shselasky
781244027ShselaskyosGLOBAL bit32
782244027ShselaskysmsatVerify12(
783244027Shselasky              smRoot_t                  *smRoot,
784244027Shselasky              smIORequest_t             *smIORequest,
785244027Shselasky              smDeviceHandle_t          *smDeviceHandle,
786244027Shselasky              smScsiInitiatorRequest_t  *smScsiRequest,
787244027Shselasky              smSatIOContext_t            *satIOContext
788244027Shselasky             );
789244027Shselasky
790244027ShselaskyosGLOBAL bit32
791244027ShselaskysmsatVerify16(
792244027Shselasky              smRoot_t                  *smRoot,
793244027Shselasky              smIORequest_t             *smIORequest,
794244027Shselasky              smDeviceHandle_t          *smDeviceHandle,
795244027Shselasky              smScsiInitiatorRequest_t  *smScsiRequest,
796244027Shselasky              smSatIOContext_t            *satIOContext
797244027Shselasky             );
798244027Shselasky
799244027ShselaskyosGLOBAL bit32
800244027ShselaskysmsatTestUnitReady(
801244027Shselasky                   smRoot_t                  *smRoot,
802244027Shselasky                   smIORequest_t             *smIORequest,
803244027Shselasky                   smDeviceHandle_t          *smDeviceHandle,
804244027Shselasky                   smScsiInitiatorRequest_t  *smScsiRequest,
805244027Shselasky                   smSatIOContext_t            *satIOContext
806244027Shselasky                  );
807244027Shselasky
808244027ShselaskyosGLOBAL bit32
809244027ShselaskysmsatInquiry(
810244027Shselasky             smRoot_t                  *smRoot,
811244027Shselasky             smIORequest_t             *smIORequest,
812244027Shselasky             smDeviceHandle_t          *smDeviceHandle,
813244027Shselasky             smScsiInitiatorRequest_t  *smScsiRequest,
814244027Shselasky             smSatIOContext_t            *satIOContext
815244027Shselasky            );
816244027Shselasky
817244027ShselaskyosGLOBAL bit32
818244027ShselaskysmsatRequestSense(
819244027Shselasky                  smRoot_t                  *smRoot,
820244027Shselasky                  smIORequest_t             *smIORequest,
821244027Shselasky                  smDeviceHandle_t          *smDeviceHandle,
822244027Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
823244027Shselasky                  smSatIOContext_t            *satIOContext
824244027Shselasky                 );
825244027Shselasky
826244027ShselaskyosGLOBAL bit32
827244027ShselaskysmsatModeSense6(
828244027Shselasky                smRoot_t                  *smRoot,
829244027Shselasky                smIORequest_t             *smIORequest,
830244027Shselasky                smDeviceHandle_t          *smDeviceHandle,
831244027Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
832244027Shselasky                smSatIOContext_t            *satIOContext
833223486Shselasky               );
834223486Shselasky
835223486ShselaskyosGLOBAL bit32
836223486ShselaskysmsatModeSense10(
837223486Shselasky                  smRoot_t                  *smRoot,
838223486Shselasky                  smIORequest_t             *smIORequest,
839223486Shselasky                  smDeviceHandle_t          *smDeviceHandle,
840223486Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
841223486Shselasky                  smSatIOContext_t            *satIOContext
842359890Shselasky                 );
843359890Shselasky
844359890ShselaskyosGLOBAL bit32
845359890ShselaskysmsatReadCapacity10(
846359890Shselasky                    smRoot_t                  *smRoot,
847359890Shselasky                    smIORequest_t             *smIORequest,
848359890Shselasky                    smDeviceHandle_t          *smDeviceHandle,
849359890Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
850359890Shselasky                    smSatIOContext_t            *satIOContext
851359890Shselasky                   );
852359890Shselasky
853359890ShselaskyosGLOBAL bit32
854359890ShselaskysmsatReadCapacity16(
855359890Shselasky                    smRoot_t                  *smRoot,
856359890Shselasky                    smIORequest_t             *smIORequest,
857359890Shselasky                    smDeviceHandle_t          *smDeviceHandle,
858359890Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
859359890Shselasky                    smSatIOContext_t            *satIOContext
860359890Shselasky                   );
861359890Shselasky
862359890ShselaskyosGLOBAL bit32
863359890ShselaskysmsatReportLun(
864359890Shselasky               smRoot_t                  *smRoot,
865359890Shselasky               smIORequest_t             *smIORequest,
866359890Shselasky               smDeviceHandle_t          *smDeviceHandle,
867359890Shselasky               smScsiInitiatorRequest_t  *smScsiRequest,
868359890Shselasky               smSatIOContext_t            *satIOContext
869184610Salfred              );
870184610Salfred
871184610SalfredosGLOBAL bit32
872192984SthompsasmsatFormatUnit(
873184610Salfred                smRoot_t                  *smRoot,
874192505Sthompsa                smIORequest_t             *smIORequest,
875184610Salfred                smDeviceHandle_t          *smDeviceHandle,
876188416Sthompsa                smScsiInitiatorRequest_t  *smScsiRequest,
877244027Shselasky                smSatIOContext_t            *satIOContext
878184610Salfred               );
879244027Shselasky
880244027ShselaskyosGLOBAL bit32
881244027ShselaskysmsatSendDiagnostic(
882244027Shselasky                    smRoot_t                  *smRoot,
883244027Shselasky                    smIORequest_t             *smIORequest,
884218988Shselasky                    smDeviceHandle_t          *smDeviceHandle,
885242129Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
886242129Shselasky                    smSatIOContext_t            *satIOContext
887218988Shselasky                   );
888218988Shselasky
889218988ShselaskyosGLOBAL bit32
890218988ShselaskysmsatStartStopUnit(
891218988Shselasky                   smRoot_t                  *smRoot,
892218988Shselasky                   smIORequest_t             *smIORequest,
893194228Sthompsa                   smDeviceHandle_t          *smDeviceHandle,
894184610Salfred                   smScsiInitiatorRequest_t  *smScsiRequest,
895184610Salfred                   smSatIOContext_t            *satIOContext
896222051Savg                  );
897184610Salfred
898199677SthompsaosGLOBAL bit32
899199677SthompsasmsatWriteSame10(
900199677Sthompsa                  smRoot_t                  *smRoot,
901218988Shselasky                  smIORequest_t             *smIORequest,
902218988Shselasky                  smDeviceHandle_t          *smDeviceHandle,
903218988Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
904218988Shselasky                  smSatIOContext_t            *satIOContext
905222051Savg                 );
906199677Sthompsa
907184610SalfredosGLOBAL bit32
908184610SalfredsmsatWriteSame16(
909184610Salfred                  smRoot_t                  *smRoot,
910315249Shselasky                  smIORequest_t             *smIORequest,
911315249Shselasky                  smDeviceHandle_t          *smDeviceHandle,
912315249Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
913315249Shselasky                  smSatIOContext_t            *satIOContext
914184610Salfred                 );
915315249Shselasky
916315249ShselaskyosGLOBAL bit32
917315249ShselaskysmsatLogSense(
918315249Shselasky              smRoot_t                  *smRoot,
919315249Shselasky              smIORequest_t             *smIORequest,
920315249Shselasky              smDeviceHandle_t          *smDeviceHandle,
921315249Shselasky              smScsiInitiatorRequest_t  *smScsiRequest,
922315249Shselasky              smSatIOContext_t            *satIOContext
923315249Shselasky             );
924315249Shselasky
925315249ShselaskyosGLOBAL bit32
926315249ShselaskysmsatModeSelect6(
927315249Shselasky                 smRoot_t                  *smRoot,
928315249Shselasky                 smIORequest_t             *smIORequest,
929315249Shselasky                 smDeviceHandle_t          *smDeviceHandle,
930315249Shselasky                 smScsiInitiatorRequest_t  *smScsiRequest,
931315249Shselasky                 smSatIOContext_t            *satIOContext
932315249Shselasky                );
933315249Shselasky
934315249Shselasky
935315249ShselaskyosGLOBAL bit32
936315249ShselaskysmsatModeSelect10(
937315249Shselasky                  smRoot_t                  *smRoot,
938315249Shselasky                  smIORequest_t             *smIORequest,
939315249Shselasky                  smDeviceHandle_t          *smDeviceHandle,
940315249Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
941315249Shselasky                  smSatIOContext_t            *satIOContext
942315249Shselasky                 );
943315249Shselasky
944315249ShselaskyosGLOBAL bit32
945315249ShselaskysmsatSynchronizeCache10(
946315249Shselasky                        smRoot_t                  *smRoot,
947315249Shselasky                        smIORequest_t             *smIORequest,
948315249Shselasky                        smDeviceHandle_t          *smDeviceHandle,
949315249Shselasky                        smScsiInitiatorRequest_t  *smScsiRequest,
950315249Shselasky                        smSatIOContext_t            *satIOContext
951184610Salfred                       );
952184610Salfred
953192984SthompsaosGLOBAL bit32
954184610SalfredsmsatSynchronizeCache16(
955192984Sthompsa                        smRoot_t                  *smRoot,
956250763Shselasky                        smIORequest_t             *smIORequest,
957359890Shselasky                        smDeviceHandle_t          *smDeviceHandle,
958184610Salfred                        smScsiInitiatorRequest_t  *smScsiRequest,
959184610Salfred                        smSatIOContext_t            *satIOContext
960199060Sthompsa                       );
961199060Sthompsa
962249796ShselaskyosGLOBAL bit32
963249796ShselaskysmsatWriteAndVerify10(
964249796Shselasky                      smRoot_t                  *smRoot,
965249796Shselasky                      smIORequest_t             *smIORequest,
966184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
967194228Sthompsa                      smScsiInitiatorRequest_t  *smScsiRequest,
968184610Salfred                      smSatIOContext_t            *satIOContext
969184610Salfred                     );
970194228Sthompsa
971184610SalfredosGLOBAL bit32
972184610SalfredsmsatWriteAndVerify12(
973194228Sthompsa                      smRoot_t                  *smRoot,
974184610Salfred                      smIORequest_t             *smIORequest,
975184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
976194228Sthompsa                      smScsiInitiatorRequest_t  *smScsiRequest,
977184610Salfred                      smSatIOContext_t            *satIOContext
978184610Salfred                     );
979218988Shselasky
980218988ShselaskyosGLOBAL bit32
981218988ShselaskysmsatWriteAndVerify16(
982315249Shselasky                      smRoot_t                  *smRoot,
983315249Shselasky                      smIORequest_t             *smIORequest,
984315249Shselasky                      smDeviceHandle_t          *smDeviceHandle,
985315249Shselasky                      smScsiInitiatorRequest_t  *smScsiRequest,
986315249Shselasky                      smSatIOContext_t            *satIOContext
987315249Shselasky                     );
988184610Salfred
989184610SalfredosGLOBAL bit32
990194228SthompsasmsatReadMediaSerialNumber(
991184610Salfred                           smRoot_t                  *smRoot,
992194228Sthompsa                           smIORequest_t             *smIORequest,
993184610Salfred                           smDeviceHandle_t          *smDeviceHandle,
994240609Shselasky                           smScsiInitiatorRequest_t  *smScsiRequest,
995240609Shselasky                           smSatIOContext_t            *satIOContext
996240609Shselasky                          );
997240609Shselasky
998184610SalfredosGLOBAL bit32
999184610SalfredsmsatReadBuffer(
1000184610Salfred                smRoot_t                  *smRoot,
1001184610Salfred                smIORequest_t             *smIORequest,
1002184610Salfred                smDeviceHandle_t          *smDeviceHandle,
1003184610Salfred                smScsiInitiatorRequest_t  *smScsiRequest,
1004242453Shselasky                smSatIOContext_t            *satIOContext
1005242453Shselasky               );
1006242453Shselasky
1007242453ShselaskyosGLOBAL bit32
1008242453ShselaskysmsatWriteBuffer(
1009242453Shselasky                 smRoot_t                  *smRoot,
1010242453Shselasky                 smIORequest_t             *smIORequest,
1011242453Shselasky                 smDeviceHandle_t          *smDeviceHandle,
1012242453Shselasky                 smScsiInitiatorRequest_t  *smScsiRequest,
1013184610Salfred                 smSatIOContext_t            *satIOContext
1014184610Salfred                );
1015184610Salfred
1016359890ShselaskyosGLOBAL bit32
1017249796ShselaskysmsatReassignBlocks(
1018250763Shselasky                    smRoot_t                  *smRoot,
1019359890Shselasky                    smIORequest_t             *smIORequest,
1020359890Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1021359890Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
1022250763Shselasky                    smSatIOContext_t            *satIOContext
1023250763Shselasky                   );
1024250763Shselasky
1025250763ShselaskyosGLOBAL bit32
1026250763ShselaskysmsatPassthrough(
1027250763Shselasky                    smRoot_t                  *smRoot,
1028359890Shselasky                    smIORequest_t             *smIORequest,
1029359890Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1030250763Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
1031250763Shselasky                    smSatIOContext_t            *satIOContext
1032250763Shselasky                   );
1033250763Shselasky
1034359890ShselaskyosGLOBAL FORCEINLINE bit32
1035359890ShselaskysmsataLLIOStart(
1036359890Shselasky                smRoot_t                  *smRoot,
1037359890Shselasky                smIORequest_t             *smIORequest,
1038359890Shselasky                smDeviceHandle_t          *smDeviceHandle,
1039359890Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
1040249796Shselasky                smSatIOContext_t            *satIOContext
1041359890Shselasky               );
1042359890ShselaskyosGLOBAL bit32
1043232039ShselaskysmsatTestUnitReady_1(
1044184610Salfred                     smRoot_t                  *smRoot,
1045359890Shselasky                     smIORequest_t             *smIORequest,
1046249796Shselasky                     smDeviceHandle_t          *smDeviceHandle,
1047250763Shselasky                     smScsiInitiatorRequest_t  *smScsiRequest,
1048359890Shselasky                     smSatIOContext_t            *satIOContext
1049359890Shselasky                    );
1050359890ShselaskyosGLOBAL bit32
1051250763ShselaskysmsatStartIDDev(
1052250763Shselasky                smRoot_t                  *smRoot,
1053250763Shselasky                smIORequest_t             *smIORequest,
1054250763Shselasky                smDeviceHandle_t          *smDeviceHandle,
1055250763Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
1056250763Shselasky                smSatIOContext_t            *satIOContext
1057359890Shselasky               );
1058359890Shselasky
1059250763ShselaskyosGLOBAL bit32
1060250763ShselaskysmsatSendIDDev(
1061250763Shselasky                smRoot_t                  *smRoot,
1062250763Shselasky                smIORequest_t             *smIORequest,
1063359890Shselasky                smDeviceHandle_t          *smDeviceHandle,
1064359890Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
1065359890Shselasky                smSatIOContext_t            *satIOContext
1066359890Shselasky               );
1067359890Shselasky
1068359890ShselaskyosGLOBAL bit32
1069249796ShselaskysmsatRequestSense_1(
1070359890Shselasky                    smRoot_t                  *smRoot,
1071359890Shselasky                    smIORequest_t             *smIORequest,
1072232039Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1073184610Salfred                    smScsiInitiatorRequest_t  *smScsiRequest,
1074244027Shselasky                    smSatIOContext_t            *satIOContext
1075244027Shselasky                   );
1076244027Shselasky
1077244027ShselaskyosGLOBAL bit32
1078244027ShselaskysmsatSMARTEnable(
1079244027Shselasky                 smRoot_t                  *smRoot,
1080244027Shselasky                 smIORequest_t             *smIORequest,
1081244027Shselasky                 smDeviceHandle_t          *smDeviceHandle,
1082244027Shselasky                 smScsiInitiatorRequest_t  *smScsiRequest,
1083244027Shselasky                 smSatIOContext_t            *satIOContext
1084184610Salfred               );
1085184610Salfred
1086184610SalfredosGLOBAL bit32
1087184610SalfredsmsatLogSense_2(
1088184610Salfred                smRoot_t                  *smRoot,
1089232039Shselasky                smIORequest_t             *smIORequest,
1090184610Salfred                smDeviceHandle_t          *smDeviceHandle,
1091246421Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
1092184610Salfred                smSatIOContext_t            *satIOContext
1093184610Salfred               );
1094184610Salfred
1095184610SalfredosGLOBAL bit32
1096184610SalfredsmsatLogSense_3(
1097184610Salfred                smRoot_t                  *smRoot,
1098184610Salfred                smIORequest_t             *smIORequest,
1099184610Salfred                smDeviceHandle_t          *smDeviceHandle,
1100232039Shselasky                smScsiInitiatorRequest_t  *smScsiRequest,
1101232039Shselasky                smSatIOContext_t            *satIOContext
1102232039Shselasky               );
1103232039Shselasky
1104359890ShselaskyosGLOBAL bit32
1105359890ShselaskysmsatRead_1(
1106359890Shselasky            smRoot_t                  *smRoot,
1107359890Shselasky            smIORequest_t             *smIORequest,
1108359890Shselasky            smDeviceHandle_t          *smDeviceHandle,
1109359890Shselasky            smScsiInitiatorRequest_t  *smScsiRequest,
1110359890Shselasky            smSatIOContext_t            *satIOContext
1111184610Salfred          );
1112359890Shselasky
1113232039ShselaskyosGLOBAL bit32
1114232039ShselaskysmsatWrite_1(
1115232039Shselasky             smRoot_t                  *smRoot,
1116359890Shselasky             smIORequest_t             *smIORequest,
1117359890Shselasky             smDeviceHandle_t          *smDeviceHandle,
1118184610Salfred             smScsiInitiatorRequest_t  *smScsiRequest,
1119184610Salfred             smSatIOContext_t            *satIOContext
1120184610Salfred           );
1121184610Salfred
1122184610SalfredosGLOBAL bit32
1123184610SalfredsmsatNonChainedWriteNVerify_Verify(
1124242438Shselasky                                   smRoot_t                  *smRoot,
1125246421Shselasky                                   smIORequest_t             *smIORequest,
1126246421Shselasky                                   smDeviceHandle_t          *smDeviceHandle,
1127246421Shselasky                                   smScsiInitiatorRequest_t  *smScsiRequest,
1128246421Shselasky                                   smSatIOContext_t            *satIOContext
1129246421Shselasky                                  );
1130246421Shselasky
1131242438ShselaskyosGLOBAL bit32
1132242438ShselaskysmsatChainedWriteNVerify_Start_Verify(
1133242438Shselasky                                      smRoot_t                  *smRoot,
1134315249Shselasky                                      smIORequest_t             *smIORequest,
1135315249Shselasky                                      smDeviceHandle_t          *smDeviceHandle,
1136315249Shselasky                                      smScsiInitiatorRequest_t  *smScsiRequest,
1137315249Shselasky                                      smSatIOContext_t            *satIOContext
1138315249Shselasky                                     );
1139184610Salfred
1140184610SalfredosGLOBAL bit32
1141184610SalfredsmsatChainedWriteNVerify_Write(
1142184610Salfred                               smRoot_t                  *smRoot,
1143184610Salfred                               smIORequest_t             *smIORequest,
1144184610Salfred                               smDeviceHandle_t          *smDeviceHandle,
1145184610Salfred                               smScsiInitiatorRequest_t  *smScsiRequest,
1146184610Salfred                               smSatIOContext_t            *satIOContext
1147184610Salfred                              );
1148184610Salfred
1149184610SalfredosGLOBAL bit32
1150184610SalfredsmsatChainedWriteNVerify_Verify(
1151184610Salfred                                smRoot_t                  *smRoot,
1152184610Salfred                                smIORequest_t             *smIORequest,
1153184610Salfred                                smDeviceHandle_t          *smDeviceHandle,
1154184610Salfred                                smScsiInitiatorRequest_t  *smScsiRequest,
1155184610Salfred                                smSatIOContext_t            *satIOContext
1156359890Shselasky                               );
1157184610SalfredosGLOBAL bit32
1158184610SalfredsmsatChainedVerify(
1159359890Shselasky                    smRoot_t                  *smRoot,
1160184610Salfred                    smIORequest_t             *smIORequest,
1161184610Salfred                    smDeviceHandle_t          *smDeviceHandle,
1162184610Salfred                    smScsiInitiatorRequest_t  *smScsiRequest,
1163193640Sariff                    smSatIOContext_t            *satIOContext
1164184610Salfred		   );
1165359890Shselasky
1166359890ShselaskyosGLOBAL bit32
1167184610SalfredsmsatWriteSame10_1(
1168184610Salfred                    smRoot_t                  *smRoot,
1169184610Salfred                    smIORequest_t             *smIORequest,
1170184610Salfred                    smDeviceHandle_t          *smDeviceHandle,
1171184610Salfred                    smScsiInitiatorRequest_t  *smScsiRequest,
1172184610Salfred                    smSatIOContext_t            *satIOContext,
1173184610Salfred                    bit32                     lba
1174184610Salfred                  );
1175184610Salfred
1176283950ShselaskyosGLOBAL bit32
1177283950ShselaskysmsatWriteSame10_2(
1178283950Shselasky                    smRoot_t                  *smRoot,
1179283950Shselasky                    smIORequest_t             *smIORequest,
1180242438Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1181184610Salfred                    smScsiInitiatorRequest_t  *smScsiRequest,
1182359890Shselasky                    smSatIOContext_t            *satIOContext,
1183184610Salfred                    bit32                     lba
1184246454Shselasky                  );
1185246454Shselasky
1186184610SalfredosGLOBAL bit32
1187184610SalfredsmsatWriteSame10_3(
1188184610Salfred                    smRoot_t                  *smRoot,
1189359890Shselasky                    smIORequest_t             *smIORequest,
1190359890Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1191184610Salfred                    smScsiInitiatorRequest_t  *smScsiRequest,
1192184610Salfred                    smSatIOContext_t            *satIOContext,
1193193640Sariff                    bit32                     lba
1194193640Sariff                  );
1195359890Shselasky
1196184610SalfredosGLOBAL bit32
1197359890ShselaskysmsatStartStopUnit_1(
1198359890Shselasky                     smRoot_t                  *smRoot,
1199359890Shselasky                     smIORequest_t             *smIORequest,
1200359890Shselasky                     smDeviceHandle_t          *smDeviceHandle,
1201184610Salfred                     smScsiInitiatorRequest_t  *smScsiRequest,
1202359890Shselasky                     smSatIOContext_t            *satIOContext
1203359890Shselasky		    );
1204359890Shselasky
1205359890ShselaskyosGLOBAL bit32
1206359890ShselaskysmsatSendDiagnostic_1(
1207184610Salfred                      smRoot_t                  *smRoot,
1208184610Salfred                      smIORequest_t             *smIORequest,
1209184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
1210359890Shselasky                      smScsiInitiatorRequest_t  *smScsiRequest,
1211242438Shselasky                      smSatIOContext_t            *satIOContext
1212280591Shselasky		     );
1213280591Shselasky
1214359890ShselaskyosGLOBAL bit32
1215280591ShselaskysmsatSendDiagnostic_2(
1216280591Shselasky                      smRoot_t                  *smRoot,
1217184610Salfred                      smIORequest_t             *smIORequest,
1218184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
1219184610Salfred                      smScsiInitiatorRequest_t  *smScsiRequest,
1220184610Salfred                      smSatIOContext_t            *satIOContext
1221184610Salfred		     );
1222184610Salfred
1223184610SalfredosGLOBAL bit32
1224184610SalfredsmsatModeSelect6n10_1(
1225184610Salfred                      smRoot_t                  *smRoot,
1226184610Salfred                      smIORequest_t             *smIORequest,
1227184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
1228359890Shselasky                      smScsiInitiatorRequest_t  *smScsiRequest,
1229184610Salfred                      smSatIOContext_t            *satIOContext
1230184610Salfred		     );
1231184610Salfred
1232359890ShselaskyosGLOBAL bit32
1233184610SalfredsmsatLogSense_1(
1234184610Salfred                smRoot_t                  *smRoot,
1235359890Shselasky                smIORequest_t             *smIORequest,
1236184610Salfred                smDeviceHandle_t          *smDeviceHandle,
1237184610Salfred                smScsiInitiatorRequest_t  *smScsiRequest,
1238184610Salfred                smSatIOContext_t            *satIOContext
1239184610Salfred               );
1240184610Salfred
1241194228SthompsaosGLOBAL bit32
1242184610SalfredsmsatReassignBlocks_2(
1243184610Salfred                      smRoot_t                  *smRoot,
1244184610Salfred                      smIORequest_t             *smIORequest,
1245184610Salfred                      smDeviceHandle_t          *smDeviceHandle,
1246184610Salfred                      smScsiInitiatorRequest_t  *smScsiRequest,
1247184610Salfred                      smSatIOContext_t            *satIOContext,
1248184610Salfred                      bit8                      *LBA
1249184610Salfred                     );
1250184610Salfred
1251359890ShselaskyosGLOBAL bit32
1252184610SalfredsmsatReassignBlocks_1(
1253228484Shselasky                      smRoot_t                  *smRoot,
1254228484Shselasky                      smIORequest_t             *smIORequest,
1255228484Shselasky                      smDeviceHandle_t          *smDeviceHandle,
1256228484Shselasky                      smScsiInitiatorRequest_t  *smScsiRequest,
1257228484Shselasky                      smSatIOContext_t            *satIOContext,
1258249796Shselasky                      smSatIOContext_t            *satOrgIOContext
1259359890Shselasky                     );
1260359890Shselasky
1261359890ShselaskyosGLOBAL bit32
1262359890ShselaskysmsatSendReadLogExt(
1263249796Shselasky                     smRoot_t                  *smRoot,
1264249796Shselasky                     smIORequest_t             *smIORequest,
1265249796Shselasky                     smDeviceHandle_t          *smDeviceHandle,
1266228484Shselasky                     smScsiInitiatorRequest_t  *smScsiRequest,
1267359890Shselasky                     smSatIOContext_t            *satIOContext
1268359890Shselasky		   );
1269359890Shselasky
1270359890ShselaskyosGLOBAL bit32
1271249796ShselaskysmsatCheckPowerMode(
1272246421Shselasky                     smRoot_t                  *smRoot,
1273246421Shselasky                     smIORequest_t             *smIORequest,
1274228484Shselasky                     smDeviceHandle_t          *smDeviceHandle,
1275184610Salfred                     smScsiInitiatorRequest_t  *smScsiRequest,
1276184610Salfred                     smSatIOContext_t            *satIOContext
1277184610Salfred		   );
1278184610Salfred
1279184610SalfredosGLOBAL bit32
1280184610SalfredsmsatResetDevice(
1281184610Salfred                  smRoot_t                  *smRoot,
1282242438Shselasky                  smIORequest_t             *smIORequest,
1283242438Shselasky                  smDeviceHandle_t          *smDeviceHandle,
1284242438Shselasky                  smScsiInitiatorRequest_t  *smScsiRequest,
1285242438Shselasky                  smSatIOContext_t            *satIOContext
1286359890Shselasky                );
1287359890Shselasky
1288359890ShselaskyosGLOBAL bit32
1289184610SalfredsmsatDeResetDevice(
1290184610Salfred                    smRoot_t                  *smRoot,
1291184610Salfred                    smIORequest_t             *smIORequest,
1292249796Shselasky                    smDeviceHandle_t          *smDeviceHandle,
1293249796Shselasky                    smScsiInitiatorRequest_t  *smScsiRequest,
1294249796Shselasky                    smSatIOContext_t            *satIOContext
1295249796Shselasky                   );
1296249796Shselasky/******************************** beginning of completion ******************************************************/
1297249796ShselaskyosGLOBAL FORCEINLINE void
1298249796ShselaskysmllSATACompleted(
1299249796Shselasky                  agsaRoot_t        *agRoot,
1300249796Shselasky                  agsaIORequest_t   *agIORequest,
1301249796Shselasky                  bit32             agIOStatus,
1302249796Shselasky                  void              *agFirstDword,
1303249796Shselasky                  bit32             agIOInfoLen,
1304249796Shselasky                  void              *agParam
1305249796Shselasky                 );
1306249796Shselasky
1307249796Shselasky
1308249796ShselaskyosGLOBAL FORCEINLINE void
1309249796ShselaskysmsatNonChainedDataIOCB(
1310249796Shselasky                        agsaRoot_t        *agRoot,
1311249796Shselasky                        agsaIORequest_t   *agIORequest,
1312249796Shselasky                        bit32             agIOStatus,
1313249796Shselasky                        agsaFisHeader_t   *agFirstDword,
1314249796Shselasky                        bit32             agIOInfoLen,
1315249796Shselasky                        void              *agParam,
1316249796Shselasky                        void              *ioContext
1317249796Shselasky                       );
1318249796Shselasky
1319249796ShselaskyosGLOBAL FORCEINLINE void
1320249796ShselaskysmsatChainedDataIOCB(
1321249796Shselasky                     agsaRoot_t        *agRoot,
1322249796Shselasky                     agsaIORequest_t   *agIORequest,
1323249796Shselasky                     bit32             agIOStatus,
1324249796Shselasky                     agsaFisHeader_t   *agFirstDword,
1325249796Shselasky                     bit32             agIOInfoLen,
1326249796Shselasky                     void              *agParam,
1327249796Shselasky                     void              *ioContext
1328249796Shselasky                    );
1329249796Shselasky
1330249796ShselaskyosGLOBAL void
1331249796ShselaskysmsatNonChainedVerifyCB(
1332249796Shselasky                        agsaRoot_t        *agRoot,
1333249796Shselasky                        agsaIORequest_t   *agIORequest,
1334249796Shselasky                        bit32             agIOStatus,
1335249796Shselasky                        agsaFisHeader_t   *agFirstDword,
1336249796Shselasky                        bit32             agIOInfoLen,
1337249796Shselasky                        agsaFrameHandle_t agFrameHandle,
1338249796Shselasky                        void              *ioContext
1339249796Shselasky                       );
1340249796Shselasky
1341249796ShselaskyosGLOBAL void
1342249796ShselaskysmsatChainedVerifyCB(
1343249796Shselasky                     agsaRoot_t        *agRoot,
1344249796Shselasky                     agsaIORequest_t   *agIORequest,
1345249796Shselasky                     bit32             agIOStatus,
1346249796Shselasky                     agsaFisHeader_t   *agFirstDword,
1347249796Shselasky                     bit32             agIOInfoLen,
1348249796Shselasky                     agsaFrameHandle_t agFrameHandle,
1349249796Shselasky                     void              *ioContext
1350249796Shselasky                    );
1351249796Shselasky
1352249796ShselaskyosGLOBAL void
1353249796ShselaskysmsatTestUnitReadyCB(
1354249796Shselasky                     agsaRoot_t        *agRoot,
1355249796Shselasky                     agsaIORequest_t   *agIORequest,
1356249796Shselasky                     bit32             agIOStatus,
1357249796Shselasky                     agsaFisHeader_t   *agFirstDword,
1358249796Shselasky                     bit32             agIOInfoLen,
1359249796Shselasky                     agsaFrameHandle_t agFrameHandle,
1360249796Shselasky                     void              *ioContext
1361249796Shselasky                    );
1362249796ShselaskyosGLOBAL void
1363249796ShselaskysmsatRequestSenseCB(
1364249796Shselasky                    agsaRoot_t        *agRoot,
1365249796Shselasky                    agsaIORequest_t   *agIORequest,
1366249796Shselasky                    bit32             agIOStatus,
1367249796Shselasky                    agsaFisHeader_t   *agFirstDword,
1368249796Shselasky                    bit32             agIOInfoLen,
1369249796Shselasky                    void              *agParam,
1370249796Shselasky                    void              *ioContext
1371249796Shselasky                   );
1372249796Shselasky
1373249796ShselaskyosGLOBAL void
1374249796ShselaskysmsatSendDiagnosticCB(
1375249796Shselasky                       agsaRoot_t        *agRoot,
1376249796Shselasky                       agsaIORequest_t   *agIORequest,
1377249796Shselasky                       bit32             agIOStatus,
1378249796Shselasky                       agsaFisHeader_t   *agFirstDword,
1379249796Shselasky                       bit32             agIOInfoLen,
1380249796Shselasky                       agsaFrameHandle_t agFrameHandle,
1381249796Shselasky                       void              *ioContext
1382249796Shselasky                     );
1383249796Shselasky
1384249796ShselaskyosGLOBAL void
1385249796ShselaskysmsatStartStopUnitCB(
1386249796Shselasky                     agsaRoot_t        *agRoot,
1387249796Shselasky                     agsaIORequest_t   *agIORequest,
1388249796Shselasky                     bit32             agIOStatus,
1389249796Shselasky                     agsaFisHeader_t   *agFirstDword,
1390249796Shselasky                     bit32             agIOInfoLen,
1391249796Shselasky                     agsaFrameHandle_t agFrameHandle,
1392249796Shselasky                     void              *ioContext
1393249796Shselasky                    );
1394249796Shselasky
1395249796Shselasky
1396249796ShselaskyosGLOBAL void
1397249796ShselaskysmsatWriteSame10CB(
1398249796Shselasky                   agsaRoot_t        *agRoot,
1399249796Shselasky                   agsaIORequest_t   *agIORequest,
1400249796Shselasky                   bit32             agIOStatus,
1401308033Shselasky                   agsaFisHeader_t   *agFirstDword,
1402249796Shselasky                   bit32             agIOInfoLen,
1403249796Shselasky                   agsaFrameHandle_t agFrameHandle,
1404308033Shselasky                   void              *ioContext
1405249796Shselasky                  );
1406249796Shselasky
1407249796Shselasky
1408249796ShselaskyosGLOBAL void
1409249796ShselaskysmsatLogSenseCB(
1410249796Shselasky                agsaRoot_t        *agRoot,
1411249796Shselasky                agsaIORequest_t   *agIORequest,
1412249796Shselasky                bit32             agIOStatus,
1413249796Shselasky                agsaFisHeader_t   *agFirstDword,
1414249796Shselasky                bit32             agIOInfoLen,
1415249796Shselasky                void              *agParam,
1416249796Shselasky                void              *ioCotext
1417249796Shselasky               );
1418249796Shselasky
1419249796ShselaskyosGLOBAL void
1420249796ShselaskysmsatSMARTEnableCB(
1421249796Shselasky                   agsaRoot_t        *agRoot,
1422249796Shselasky                   agsaIORequest_t   *agIORequest,
1423249796Shselasky                   bit32             agIOStatus,
1424249796Shselasky                   agsaFisHeader_t   *agFirstDword,
1425249796Shselasky                   bit32             agIOInfoLen,
1426249796Shselasky                   agsaFrameHandle_t agFrameHandle,
1427249796Shselasky                   void              *ioContext
1428249796Shselasky                  );
1429249796Shselasky
1430249796ShselaskyosGLOBAL void
1431249796ShselaskysmsatModeSelect6n10CB(
1432249796Shselasky                      agsaRoot_t        *agRoot,
1433249796Shselasky                      agsaIORequest_t   *agIORequest,
1434249796Shselasky                      bit32             agIOStatus,
1435249796Shselasky                      agsaFisHeader_t   *agFirstDword,
1436249796Shselasky                      bit32             agIOInfoLen,
1437249796Shselasky                      agsaFrameHandle_t agFrameHandle,
1438249796Shselasky                      void              *ioContext
1439249796Shselasky                     );
1440249796Shselasky
1441249796ShselaskyosGLOBAL void
1442249796ShselaskysmsatSynchronizeCache10n16CB(
1443249796Shselasky                             agsaRoot_t        *agRoot,
1444249796Shselasky                             agsaIORequest_t   *agIORequest,
1445249796Shselasky                             bit32             agIOStatus,
1446249796Shselasky                             agsaFisHeader_t   *agFirstDword,
1447249796Shselasky                             bit32             agIOInfoLen,
1448249796Shselasky                             agsaFrameHandle_t agFrameHandle,
1449249796Shselasky                             void              *ioContext
1450249796Shselasky                            );
1451249796Shselasky
1452249796ShselaskyosGLOBAL void
1453249796ShselaskysmsatNonChainedWriteNVerifyCB(
1454249796Shselasky                              agsaRoot_t        *agRoot,
1455249796Shselasky                              agsaIORequest_t   *agIORequest,
1456249796Shselasky                              bit32             agIOStatus,
1457249796Shselasky                              agsaFisHeader_t   *agFirstDword,
1458249796Shselasky                              bit32             agIOInfoLen,
1459249796Shselasky                              void              *agParam,
1460249796Shselasky                              void              *ioContext
1461249796Shselasky                             );
1462249796Shselasky
1463249796ShselaskyosGLOBAL void
1464249796ShselaskysmsatChainedWriteNVerifyCB(
1465249796Shselasky                           agsaRoot_t        *agRoot,
1466249796Shselasky                           agsaIORequest_t   *agIORequest,
1467249796Shselasky                           bit32             agIOStatus,
1468249796Shselasky                           agsaFisHeader_t   *agFirstDword,
1469249796Shselasky                           bit32             agIOInfoLen,
1470249796Shselasky                           void              *agParam,
1471249796Shselasky                           void              *ioContext
1472249796Shselasky                          );
1473249796Shselasky
1474249796ShselaskyosGLOBAL void
1475249796ShselaskysmsatReadMediaSerialNumberCB(
1476249796Shselasky                             agsaRoot_t        *agRoot,
1477249796Shselasky                             agsaIORequest_t   *agIORequest,
1478249796Shselasky                             bit32             agIOStatus,
1479359890Shselasky                             agsaFisHeader_t   *agFirstDword,
1480249796Shselasky                             bit32             agIOInfoLen,
1481249796Shselasky                             agsaFrameHandle_t agFrameHandle,
1482359890Shselasky                             void              *ioContext
1483359890Shselasky                            );
1484359890Shselasky
1485359890ShselaskyosGLOBAL void
1486249796ShselaskysmsatReadBufferCB(
1487249796Shselasky                  agsaRoot_t        *agRoot,
1488249796Shselasky                  agsaIORequest_t   *agIORequest,
1489184610Salfred                  bit32             agIOStatus,
1490184610Salfred                  agsaFisHeader_t   *agFirstDword,
1491184610Salfred                  bit32             agIOInfoLen,
1492184610Salfred                  agsaFrameHandle_t agFrameHandle,
1493207077Sthompsa                  void              *ioContext
1494184610Salfred                 );
1495203678Sbrucec
1496184610SalfredosGLOBAL void
1497184610SalfredsmsatWriteBufferCB(
1498184610Salfred                   agsaRoot_t        *agRoot,
1499184610Salfred                   agsaIORequest_t   *agIORequest,
1500184610Salfred                   bit32             agIOStatus,
1501184610Salfred                   agsaFisHeader_t   *agFirstDword,
1502184610Salfred                   bit32             agIOInfoLen,
1503184610Salfred                   agsaFrameHandle_t agFrameHandle,
1504184610Salfred                   void              *ioContext
1505209452Sthompsa                  );
1506209452Sthompsa
1507184610SalfredosGLOBAL void
1508184610SalfredsmsatReassignBlocksCB(
1509184610Salfred                      agsaRoot_t        *agRoot,
1510184610Salfred                      agsaIORequest_t   *agIORequest,
1511184610Salfred                      bit32             agIOStatus,
1512221695Shselasky                      agsaFisHeader_t   *agFirstDword,
1513221695Shselasky                      bit32             agIOInfoLen,
1514221695Shselasky                      agsaFrameHandle_t agFrameHandle,
1515221695Shselasky                      void              *ioContext
1516221695Shselasky                     );
1517221695Shselasky
1518221695ShselaskyosGLOBAL void
1519221695ShselaskysmsatProcessAbnormalCompletion(
1520184610Salfred                               agsaRoot_t        *agRoot,
1521221695Shselasky                               agsaIORequest_t   *agIORequest,
1522221695Shselasky                               bit32             agIOStatus,
1523221695Shselasky                               agsaFisHeader_t   *agFirstDword,
1524221695Shselasky                               bit32             agIOInfoLen,
1525221695Shselasky                               void              *agParam,
1526221695Shselasky                               smSatIOContext_t    *satIOContext
1527221695Shselasky                              );
1528221695Shselasky
1529221695ShselaskyosGLOBAL void
1530221695ShselaskysmsatDelayedProcessAbnormalCompletion(
1531221695Shselasky                                      agsaRoot_t        *agRoot,
1532221695Shselasky                                      agsaIORequest_t   *agIORequest,
1533221695Shselasky                                      bit32             agIOStatus,
1534221695Shselasky                                      agsaFisHeader_t   *agFirstDword,
1535221695Shselasky                                      bit32             agIOInfoLen,
1536221695Shselasky                                      void              *agParam,
1537221695Shselasky                                      smSatIOContext_t    *satIOContext
1538221695Shselasky                                     );
1539221695Shselasky
1540221695ShselaskyosGLOBAL void
1541221695ShselaskysmsatIOCompleted(
1542221695Shselasky                 smRoot_t           *smRoot,
1543221695Shselasky                 smIORequest_t      *smIORequest,
1544221695Shselasky                 agsaFisHeader_t    *agFirstDword,
1545221695Shselasky                 bit32              respFisLen,
1546221695Shselasky                 agsaFrameHandle_t  agFrameHandle,
1547221695Shselasky                 smSatIOContext_t     *satIOContext,
1548221695Shselasky                 bit32              interruptContext
1549221695Shselasky		);
1550221695Shselasky
1551221695ShselaskyosGLOBAL void
1552240609ShselaskysmsatEncryptionHandler(
1553240609Shselasky                       smRoot_t                *smRoot,
1554240609Shselasky                       agsaIORequest_t         *agIORequest,
1555240609Shselasky                       bit32                   agIOStatus,
1556240609Shselasky                       bit32                   agIOInfoLen,
1557240609Shselasky                       void                    *agParam,
1558342724Shselasky                       bit32                   agOtherInfo,
1559342724Shselasky                       bit32                   interruptContext
1560240609Shselasky                      );
1561240609Shselasky
1562240609ShselaskyosGLOBAL void
1563240609ShselaskysmsatDifHandler(
1564240609Shselasky                smRoot_t                *smRoot,
1565240609Shselasky                agsaIORequest_t         *agIORequest,
1566240609Shselasky                bit32                   agIOStatus,
1567240609Shselasky                bit32                   agIOInfoLen,
1568240609Shselasky                void                    *agParam,
1569240609Shselasky                bit32                   agOtherInfo,
1570240609Shselasky                bit32                   interruptContext
1571342724Shselasky               );
1572342724Shselasky
1573342724ShselaskyosGLOBAL void
1574342724ShselaskysmsatProcessAbort(
1575342724Shselasky                  smRoot_t           *smRoot,
1576240609Shselasky                  smIORequest_t      *smIORequest,
1577342724Shselasky                  smSatIOContext_t     *satIOContext
1578240609Shselasky                 );
1579240609Shselasky
1580342724ShselaskyosGLOBAL void
1581342724ShselaskysmsatNonDataIOCB(
1582342724Shselasky                  agsaRoot_t        *agRoot,
1583342724Shselasky                  agsaIORequest_t   *agIORequest,
1584342724Shselasky                  bit32             agIOStatus,
1585342724Shselasky                  agsaFisHeader_t   *agFirstDword,
1586342724Shselasky                  bit32             agIOInfoLen,
1587342724Shselasky                  void              *agParam,
1588342724Shselasky                  void              *ioContext
1589342724Shselasky                 );
1590240609Shselasky
1591342724ShselaskyosGLOBAL void
1592342724ShselaskysmsatInquiryCB(
1593342724Shselasky               agsaRoot_t        *agRoot,
1594342724Shselasky               agsaIORequest_t   *agIORequest,
1595342724Shselasky               bit32             agIOStatus,
1596342724Shselasky               agsaFisHeader_t   *agFirstDword,
1597342724Shselasky               bit32             agIOInfoLen,
1598342724Shselasky               void              *agParam,
1599342724Shselasky               void              *ioContext
1600342724Shselasky              );
1601342724Shselasky
1602342724Shselasky
1603342724ShselaskyosGLOBAL void
1604342724ShselaskysmsatInquiryIntCB(
1605342724Shselasky                   smRoot_t                  *smRoot,
1606342724Shselasky                   smIORequest_t             *smIORequest,
1607342724Shselasky                   smDeviceHandle_t          *smDeviceHandle,
1608342724Shselasky                   smScsiInitiatorRequest_t  *smScsiRequest,
1609342724Shselasky                   smSatIOContext_t            *satIOContext
1610342724Shselasky                  );
1611342724Shselasky
1612342724ShselaskyosGLOBAL void
1613342724ShselaskysmsatVerify10CB(
1614342724Shselasky                agsaRoot_t        *agRoot,
1615342724Shselasky                agsaIORequest_t   *agIORequest,
1616342724Shselasky                bit32             agIOStatus,
1617342724Shselasky                agsaFisHeader_t   *agFirstDword,
1618240609Shselasky                bit32             agIOInfoLen,
1619240609Shselasky                void              *agParam,
1620240609Shselasky                void              *ioContext
1621342724Shselasky               );
1622240609Shselasky
1623240609ShselaskyosGLOBAL void
1624240609ShselaskysmsatReadLogExtCB(
1625240609Shselasky                   agsaRoot_t        *agRoot,
1626240609Shselasky                   agsaIORequest_t   *agIORequest,
1627240609Shselasky                   bit32             agIOStatus,
1628240609Shselasky                   agsaFisHeader_t   *agFirstDword,
1629240609Shselasky                   bit32             agIOInfoLen,
1630240609Shselasky                   void              *agParam,
1631240609Shselasky                   void              *ioContext
1632240609Shselasky                 );
1633240609Shselasky
1634240609Shselasky
1635240609ShselaskyosGLOBAL void
1636240609ShselaskysmsatIDStartCB(
1637240609Shselasky                agsaRoot_t        *agRoot,
1638240609Shselasky                agsaIORequest_t   *agIORequest,
1639240609Shselasky                bit32             agIOStatus,
1640240609Shselasky                agsaFisHeader_t   *agFirstDword,
1641240609Shselasky                bit32             agIOInfoLen,
1642240609Shselasky                void              *agParam,
1643240609Shselasky                void              *ioContext
1644240609Shselasky               );
1645240609Shselasky
1646240609ShselaskyosGLOBAL void
1647240609ShselaskysmSMPCompleted(
1648240609Shselasky                agsaRoot_t            *agRoot,
1649240609Shselasky                agsaIORequest_t       *agIORequest,
1650240609Shselasky                bit32                 agIOStatus,
1651359890Shselasky                bit32                 agIOInfoLen,
1652359890Shselasky                agsaFrameHandle_t     agFrameHandle
1653359890Shselasky              );
1654359890Shselasky
1655359890ShselaskyosGLOBAL void
1656359890ShselaskysmSMPCompletedCB(
1657359890Shselasky                  agsaRoot_t            *agRoot,
1658359890Shselasky                  agsaIORequest_t       *agIORequest,
1659359890Shselasky                  bit32                 agIOStatus,
1660359890Shselasky                  bit32                 agIOInfoLen,
1661359890Shselasky                  agsaFrameHandle_t     agFrameHandle
1662359890Shselasky                );
1663359890Shselasky
1664359890ShselaskyosGLOBAL void
1665359890ShselaskysmPhyControlRespRcvd(
1666359890Shselasky                      smRoot_t              *smRoot,
1667221695Shselasky                      agsaRoot_t            *agRoot,
1668192984Sthompsa                      agsaIORequest_t       *agIORequest,
1669200825Sthompsa                      smDeviceData_t        *oneDeviceData,
1670184610Salfred                      smSMPFrameHeader_t    *frameHeader,
1671192984Sthompsa                      agsaFrameHandle_t     frameHandle,
1672240609Shselasky                      smIORequest_t         *CurrentTaskTag
1673240609Shselasky                     );
1674240609Shselasky
1675272423ShselaskyosGLOBAL void
1676221695ShselaskysmsatCheckPowerModeCB(
1677240609Shselasky                      agsaRoot_t        *agRoot,
1678194228Sthompsa                      agsaIORequest_t   *agIORequest,
1679192984Sthompsa                      bit32             agIOStatus,
1680240609Shselasky                      agsaFisHeader_t   *agFirstDword,
1681184610Salfred                      bit32             agIOInfoLen,
1682249796Shselasky                      agsaFrameHandle_t agFrameHandle,
1683249796Shselasky                      void              *ioContext
1684184610Salfred                     );
1685184610Salfred
1686184610SalfredosGLOBAL void
1687240609ShselaskysmsatCheckPowerModePassCB(
1688240609Shselasky                      agsaRoot_t        *agRoot,
1689184610Salfred                      agsaIORequest_t   *agIORequest,
1690184610Salfred                      bit32             agIOStatus,
1691184610Salfred                      agsaFisHeader_t   *agFirstDword,
1692184610Salfred                      bit32             agIOInfoLen,
1693272423Shselasky                      agsaFrameHandle_t agFrameHandle,
1694218988Shselasky                      void              *ioContext
1695184610Salfred                     );
1696194228Sthompsa
1697184610SalfredosGLOBAL void
1698184610SalfredsmsatIDDataPassCB(
1699184610Salfred                  agsaRoot_t        *agRoot,
1700184610Salfred                  agsaIORequest_t   *agIORequest,
1701184610Salfred                  bit32             agIOStatus,
1702184610Salfred                  agsaFisHeader_t   *agFirstDword,
1703184610Salfred                  bit32             agIOInfoLen,
1704184610Salfred                  agsaFrameHandle_t agFrameHandle,
1705184610Salfred                  void              *ioContext
1706184610Salfred                 );
1707184610Salfred
1708184610SalfredosGLOBAL void
1709184610SalfredsmsatResetDeviceCB(
1710184610Salfred                    agsaRoot_t        *agRoot,
1711184610Salfred                    agsaIORequest_t   *agIORequest,
1712246421Shselasky                    bit32             agIOStatus,
1713246421Shselasky                    agsaFisHeader_t   *agFirstDword,
1714246421Shselasky                    bit32             agIOInfoLen,
1715246421Shselasky                    agsaFrameHandle_t agFrameHandle,
1716246421Shselasky                    void              *ioContext
1717246421Shselasky                  );
1718246421Shselasky
1719246421ShselaskyosGLOBAL void
1720246421ShselaskysmsatDeResetDeviceCB(
1721246421Shselasky                      agsaRoot_t        *agRoot,
1722246421Shselasky                      agsaIORequest_t   *agIORequest,
1723246421Shselasky                      bit32             agIOStatus,
1724218988Shselasky                      agsaFisHeader_t   *agFirstDword,
1725218988Shselasky                      bit32             agIOInfoLen,
1726218988Shselasky                      agsaFrameHandle_t agFrameHandle,
1727218988Shselasky                      void              *ioContext
1728218988Shselasky                    );
1729272423ShselaskyosGLOBAL void
1730272423ShselaskysmaSATAAbortCB(
1731184610Salfred                agsaRoot_t        *agRoot,
1732184610Salfred                agsaIORequest_t   *agIORequest,
1733184610Salfred                bit32             flag,
1734184610Salfred                bit32             status
1735184610Salfred	      );
1736218988Shselasky
1737184610SalfredosGLOBAL void
1738184610SalfredsmLocalPhyControlCB(
1739184610Salfred                     agsaRoot_t     *agRoot,
1740184610Salfred                     agsaContext_t  *agContext,
1741184610Salfred                     bit32          phyId,
1742272423Shselasky                     bit32          phyOperation,
1743184610Salfred                     bit32          status,
1744184610Salfred                     void           *parm
1745272423Shselasky                    );
1746184610Salfred/******************************** end of completion ***********************************************************/
1747184610Salfred
1748184610Salfred/******************************** start of utils    ***********************************************************/
1749184610SalfredosGLOBAL bit32 smsatComputeCDB10LBA(smSatIOContext_t            *satIOContext);
1750272423ShselaskyosGLOBAL bit32 smsatComputeCDB10TL(smSatIOContext_t            *satIOContext);
1751272423ShselaskyosGLOBAL bit32 smsatComputeCDB12LBA(smSatIOContext_t            *satIOContext);
1752184610SalfredosGLOBAL bit32 smsatComputeCDB12TL(smSatIOContext_t            *satIOContext);
1753240609ShselaskyosGLOBAL bit32 smsatComputeCDB16LBA(smSatIOContext_t            *satIOContext);
1754240609ShselaskyosGLOBAL bit32 smsatComputeCDB16TL(smSatIOContext_t            *satIOContext);
1755184610SalfredosGLOBAL FORCEINLINE bit32 smsatComputeLoopNum(bit32 a, bit32 b);
1756240609ShselaskyosGLOBAL FORCEINLINE bit32 smsatCheckLimit(bit8 *lba, bit8 *tl, int flag, smDeviceData_t *pSatDevData);
1757283185Shselasky
1758283185ShselaskyosGLOBAL void
1759283185ShselaskysmsatSplitSGL(
1760283185Shselasky            smRoot_t                  *smRoot,
1761283185Shselasky            smIORequest_t             *smIORequest,
1762283185Shselasky            smDeviceHandle_t          *smDeviceHandle,
1763283185Shselasky            smScsiInitiatorRequest_t  *smScsiRequest,
1764283185Shselasky            smSatIOContext_t            *satIOContext,
1765283185Shselasky            bit32                     split,
1766283185Shselasky            bit32                     tl,
1767283185Shselasky            bit32                     flag
1768283185Shselasky	   );
1769283185Shselasky
1770184610SalfredosGLOBAL void
1771240609ShselaskysmsatPrintSgl(
1772241988Shselasky            smRoot_t                  *smRoot,
1773272423Shselasky            agsaEsgl_t                *agEsgl,
1774272423Shselasky            bit32                     idx
1775272423Shselasky            );
1776272423Shselasky/******************************** end   of utils    ***********************************************************/
1777272423Shselasky
1778272423Shselasky
1779272423ShselaskyosGLOBAL void
1780272423ShselaskysmsatPassthroughCB(
1781272423Shselasky                agsaRoot_t        *agRoot,
1782272423Shselasky                agsaIORequest_t   *agIORequest,
1783272423Shselasky                bit32             agIOStatus,
1784272423Shselasky                agsaFisHeader_t   *agFirstDword,
1785272423Shselasky                bit32             agIOInfoLen,
1786272423Shselasky                void              *agParam,
1787272423Shselasky                void              *ioContext
1788272423Shselasky               );
1789272423Shselasky
1790272423Shselasky
1791241988Shselasky#endif                          /* __SMPROTO_H__ */
1792241988Shselasky
1793241988Shselasky