xref: /freebsd/sys/dev/pms/RefTisa/sat/api/tdsmapi.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
1*4e1bc9a0SAchim Leubner /*******************************************************************************
2*4e1bc9a0SAchim Leubner *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3*4e1bc9a0SAchim Leubner *
4*4e1bc9a0SAchim Leubner *Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*4e1bc9a0SAchim Leubner *that the following conditions are met:
6*4e1bc9a0SAchim Leubner *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*4e1bc9a0SAchim Leubner *following disclaimer.
8*4e1bc9a0SAchim Leubner *2. Redistributions in binary form must reproduce the above copyright notice,
9*4e1bc9a0SAchim Leubner *this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*4e1bc9a0SAchim Leubner *with the distribution.
11*4e1bc9a0SAchim Leubner *
12*4e1bc9a0SAchim Leubner *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*4e1bc9a0SAchim Leubner *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*4e1bc9a0SAchim Leubner *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*4e1bc9a0SAchim Leubner *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*4e1bc9a0SAchim Leubner *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*4e1bc9a0SAchim Leubner *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*4e1bc9a0SAchim Leubner *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*4e1bc9a0SAchim Leubner *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20*4e1bc9a0SAchim Leubner *
21*4e1bc9a0SAchim Leubner *
22*4e1bc9a0SAchim Leubner ********************************************************************************/
23*4e1bc9a0SAchim Leubner /********************************************************************************
24*4e1bc9a0SAchim Leubner *   tmsmapi.h
25*4e1bc9a0SAchim Leubner *
26*4e1bc9a0SAchim Leubner *   Abstract:   This module contains function prototype of the SAT
27*4e1bc9a0SAchim Leubner *               Module (SM) API callback for initiator.
28*4e1bc9a0SAchim Leubner *******************************************************************************/
29*4e1bc9a0SAchim Leubner 
30*4e1bc9a0SAchim Leubner #ifndef TDSMAPI_H
31*4e1bc9a0SAchim Leubner #define TDSMAPI_H
32*4e1bc9a0SAchim Leubner 
33*4e1bc9a0SAchim Leubner osGLOBAL void
34*4e1bc9a0SAchim Leubner tdsmIDCompletedCB(
35*4e1bc9a0SAchim Leubner                   smRoot_t   *smRoot,
36*4e1bc9a0SAchim Leubner                   smIORequest_t   *smIORequest,
37*4e1bc9a0SAchim Leubner                   smDeviceHandle_t   *smDeviceHandle,
38*4e1bc9a0SAchim Leubner                   bit32    status,
39*4e1bc9a0SAchim Leubner                   void    *IDdata
40*4e1bc9a0SAchim Leubner                  );
41*4e1bc9a0SAchim Leubner 
42*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE void
43*4e1bc9a0SAchim Leubner tdsmIOCompletedCB(
44*4e1bc9a0SAchim Leubner                   smRoot_t   *smRoot,
45*4e1bc9a0SAchim Leubner                   smIORequest_t   *smIORequest,
46*4e1bc9a0SAchim Leubner                   bit32    status,
47*4e1bc9a0SAchim Leubner                   bit32    statusDetail,
48*4e1bc9a0SAchim Leubner                   smSenseData_t   *senseData,
49*4e1bc9a0SAchim Leubner                   bit32    interruptContext
50*4e1bc9a0SAchim Leubner                   );
51*4e1bc9a0SAchim Leubner osGLOBAL void
52*4e1bc9a0SAchim Leubner tdsmEventCB(
53*4e1bc9a0SAchim Leubner                 smRoot_t          *smRoot,
54*4e1bc9a0SAchim Leubner                 smDeviceHandle_t  *smDeviceHandle,
55*4e1bc9a0SAchim Leubner                 smIntrEventType_t  eventType,
56*4e1bc9a0SAchim Leubner                 bit32              eventStatus,
57*4e1bc9a0SAchim Leubner                 void              *parm
58*4e1bc9a0SAchim Leubner                 );
59*4e1bc9a0SAchim Leubner 
60*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE void
61*4e1bc9a0SAchim Leubner tdsmSingleThreadedEnter(
62*4e1bc9a0SAchim Leubner                         smRoot_t   *smRoot,
63*4e1bc9a0SAchim Leubner                         bit32       syncLockId
64*4e1bc9a0SAchim Leubner                        );
65*4e1bc9a0SAchim Leubner 
66*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE void
67*4e1bc9a0SAchim Leubner tdsmSingleThreadedLeave(
68*4e1bc9a0SAchim Leubner                         smRoot_t   *smRoot,
69*4e1bc9a0SAchim Leubner                         bit32       syncLockId
70*4e1bc9a0SAchim Leubner                         );
71*4e1bc9a0SAchim Leubner 
72*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE bit8
73*4e1bc9a0SAchim Leubner tdsmBitScanForward(
74*4e1bc9a0SAchim Leubner                   smRoot_t   *smRoot,
75*4e1bc9a0SAchim Leubner                   bit32      *Index,
76*4e1bc9a0SAchim Leubner                   bit32       Mask
77*4e1bc9a0SAchim Leubner                   );
78*4e1bc9a0SAchim Leubner 
79*4e1bc9a0SAchim Leubner #ifdef LINUX_VERSION_CODE
80*4e1bc9a0SAchim Leubner 
81*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
82*4e1bc9a0SAchim Leubner tdsmInterlockedIncrement(
83*4e1bc9a0SAchim Leubner                    smRoot_t        *smRoot,
84*4e1bc9a0SAchim Leubner                    sbit32 volatile *Addend
85*4e1bc9a0SAchim Leubner                    );
86*4e1bc9a0SAchim Leubner 
87*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
88*4e1bc9a0SAchim Leubner tdsmInterlockedDecrement(
89*4e1bc9a0SAchim Leubner                    smRoot_t         *smRoot,
90*4e1bc9a0SAchim Leubner                    sbit32 volatile  *Addend
91*4e1bc9a0SAchim Leubner                    );
92*4e1bc9a0SAchim Leubner 
93*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
94*4e1bc9a0SAchim Leubner tdsmAtomicBitClear(
95*4e1bc9a0SAchim Leubner                smRoot_t         *smRoot,
96*4e1bc9a0SAchim Leubner                sbit32 volatile  *Destination,
97*4e1bc9a0SAchim Leubner                sbit32            Value
98*4e1bc9a0SAchim Leubner                );
99*4e1bc9a0SAchim Leubner 
100*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
101*4e1bc9a0SAchim Leubner tdsmAtomicBitSet(
102*4e1bc9a0SAchim Leubner                smRoot_t         *smRoot,
103*4e1bc9a0SAchim Leubner                sbit32 volatile  *Destination,
104*4e1bc9a0SAchim Leubner                sbit32            Value
105*4e1bc9a0SAchim Leubner                );
106*4e1bc9a0SAchim Leubner 
107*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
108*4e1bc9a0SAchim Leubner tdsmAtomicExchange(
109*4e1bc9a0SAchim Leubner                smRoot_t        *smRoot,
110*4e1bc9a0SAchim Leubner                sbit32 volatile *Target,
111*4e1bc9a0SAchim Leubner                sbit32           Value
112*4e1bc9a0SAchim Leubner                );
113*4e1bc9a0SAchim Leubner #else
114*4e1bc9a0SAchim Leubner 
115*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
116*4e1bc9a0SAchim Leubner tdsmInterlockedIncrement(
117*4e1bc9a0SAchim Leubner                    smRoot_t        *smRoot,
118*4e1bc9a0SAchim Leubner                    sbit32 volatile *Addend
119*4e1bc9a0SAchim Leubner                    );
120*4e1bc9a0SAchim Leubner 
121*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
122*4e1bc9a0SAchim Leubner tdsmInterlockedDecrement(
123*4e1bc9a0SAchim Leubner                    smRoot_t        *smRoot,
124*4e1bc9a0SAchim Leubner                    sbit32 volatile *Addend
125*4e1bc9a0SAchim Leubner                    );
126*4e1bc9a0SAchim Leubner 
127*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
128*4e1bc9a0SAchim Leubner tdsmInterlockedAnd(
129*4e1bc9a0SAchim Leubner                smRoot_t         *smRoot,
130*4e1bc9a0SAchim Leubner                sbit32 volatile  *Destination,
131*4e1bc9a0SAchim Leubner                sbit32            Value
132*4e1bc9a0SAchim Leubner                );
133*4e1bc9a0SAchim Leubner 
134*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
135*4e1bc9a0SAchim Leubner tdsmInterlockedOr(
136*4e1bc9a0SAchim Leubner                smRoot_t         *smRoot,
137*4e1bc9a0SAchim Leubner                sbit32 volatile  *Destination,
138*4e1bc9a0SAchim Leubner                sbit32            Value
139*4e1bc9a0SAchim Leubner                );
140*4e1bc9a0SAchim Leubner 
141*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE sbit32
142*4e1bc9a0SAchim Leubner tdsmInterlockedExchange(
143*4e1bc9a0SAchim Leubner                smRoot_t        *smRoot,
144*4e1bc9a0SAchim Leubner                sbit32 volatile *Target,
145*4e1bc9a0SAchim Leubner                sbit32           Value
146*4e1bc9a0SAchim Leubner                );
147*4e1bc9a0SAchim Leubner 
148*4e1bc9a0SAchim Leubner #endif /*LINUX_VERSION_CODE*/
149*4e1bc9a0SAchim Leubner 
150*4e1bc9a0SAchim Leubner osGLOBAL bit32
151*4e1bc9a0SAchim Leubner tdsmAllocMemory(
152*4e1bc9a0SAchim Leubner                 smRoot_t    *smRoot,
153*4e1bc9a0SAchim Leubner                 void        **osMemHandle,
154*4e1bc9a0SAchim Leubner                 void        ** virtPtr,
155*4e1bc9a0SAchim Leubner                 bit32       * physAddrUpper,
156*4e1bc9a0SAchim Leubner                 bit32       * physAddrLower,
157*4e1bc9a0SAchim Leubner                 bit32       alignment,
158*4e1bc9a0SAchim Leubner                 bit32       allocLength,
159*4e1bc9a0SAchim Leubner                 smBOOLEAN   isCacheable
160*4e1bc9a0SAchim Leubner                );
161*4e1bc9a0SAchim Leubner 
162*4e1bc9a0SAchim Leubner osGLOBAL bit32
163*4e1bc9a0SAchim Leubner tdsmFreeMemory(
164*4e1bc9a0SAchim Leubner                smRoot_t    *smRoot,
165*4e1bc9a0SAchim Leubner                void        *osDMAHandle,
166*4e1bc9a0SAchim Leubner                bit32        allocLength
167*4e1bc9a0SAchim Leubner               );
168*4e1bc9a0SAchim Leubner 
169*4e1bc9a0SAchim Leubner osGLOBAL FORCEINLINE bit32
170*4e1bc9a0SAchim Leubner tdsmRotateQnumber(smRoot_t        *smRoot,
171*4e1bc9a0SAchim Leubner                          smDeviceHandle_t *smDeviceHandle
172*4e1bc9a0SAchim Leubner                          );
173*4e1bc9a0SAchim Leubner 
174*4e1bc9a0SAchim Leubner osGLOBAL bit32
175*4e1bc9a0SAchim Leubner tdsmSetDeviceQueueDepth(smRoot_t      *smRoot,
176*4e1bc9a0SAchim Leubner                                  smIORequest_t *smIORequest,
177*4e1bc9a0SAchim Leubner                                  bit32          QueueDepth
178*4e1bc9a0SAchim Leubner                                  );
179*4e1bc9a0SAchim Leubner 
180*4e1bc9a0SAchim Leubner 
181*4e1bc9a0SAchim Leubner #ifndef tdsmLogDebugString
182*4e1bc9a0SAchim Leubner GLOBAL void tdsmLogDebugString(
183*4e1bc9a0SAchim Leubner                          smRoot_t     *smRoot,
184*4e1bc9a0SAchim Leubner                          bit32        level,
185*4e1bc9a0SAchim Leubner                          char         *string,
186*4e1bc9a0SAchim Leubner                          void         *ptr1,
187*4e1bc9a0SAchim Leubner                          void         *ptr2,
188*4e1bc9a0SAchim Leubner                          bit32        value1,
189*4e1bc9a0SAchim Leubner                          bit32        value2
190*4e1bc9a0SAchim Leubner                          );
191*4e1bc9a0SAchim Leubner #endif
192*4e1bc9a0SAchim Leubner 
193*4e1bc9a0SAchim Leubner 
194*4e1bc9a0SAchim Leubner 
195*4e1bc9a0SAchim Leubner osGLOBAL bit32 tdsmGetTransportParam(
196*4e1bc9a0SAchim Leubner                         smRoot_t    *smRoot,
197*4e1bc9a0SAchim Leubner                         char        *key,
198*4e1bc9a0SAchim Leubner                         char        *subkey1,
199*4e1bc9a0SAchim Leubner                         char        *subkey2,
200*4e1bc9a0SAchim Leubner                         char        *subkey3,
201*4e1bc9a0SAchim Leubner                         char        *subkey4,
202*4e1bc9a0SAchim Leubner                         char        *subkey5,
203*4e1bc9a0SAchim Leubner                         char        *valueName,
204*4e1bc9a0SAchim Leubner                         char        *buffer,
205*4e1bc9a0SAchim Leubner                         bit32       bufferLen,
206*4e1bc9a0SAchim Leubner                         bit32       *lenReceived
207*4e1bc9a0SAchim Leubner                         );
208*4e1bc9a0SAchim Leubner 
209*4e1bc9a0SAchim Leubner #endif  /* TDSMAPI_H */
210*4e1bc9a0SAchim Leubner 
211