xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/include/osl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * OS Abstraction Layer
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2020, Broadcom.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
7*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
8*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
9*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10*4882a593Smuzhiyun  * following added to such license:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
13*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
14*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
15*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
16*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
17*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
18*4882a593Smuzhiyun  * modifications of the software.
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Dual:>>
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun #ifndef _osl_h_
25*4882a593Smuzhiyun #define _osl_h_
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #include <osl_decl.h>
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun enum {
30*4882a593Smuzhiyun 	TAIL_BYTES_TYPE_FCS = 1,
31*4882a593Smuzhiyun 	TAIL_BYTES_TYPE_ICV = 2,
32*4882a593Smuzhiyun 	TAIL_BYTES_TYPE_MIC = 3
33*4882a593Smuzhiyun };
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #ifdef DHD_EFI
36*4882a593Smuzhiyun #define OSL_PKTTAG_SZ	40 /* Size of PktTag */
37*4882a593Smuzhiyun #elif defined(MACOSX)
38*4882a593Smuzhiyun #define OSL_PKTTAG_SZ	56
39*4882a593Smuzhiyun #elif defined(__linux__)
40*4882a593Smuzhiyun #define OSL_PKTTAG_SZ   48 /* standard linux pkttag size is 48 bytes */
41*4882a593Smuzhiyun #else
42*4882a593Smuzhiyun #ifndef OSL_PKTTAG_SZ
43*4882a593Smuzhiyun #define OSL_PKTTAG_SZ	32 /* Size of PktTag */
44*4882a593Smuzhiyun #endif /* !OSL_PKTTAG_SZ */
45*4882a593Smuzhiyun #endif /* DHD_EFI */
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */
48*4882a593Smuzhiyun typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status);
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun /* Drivers use REGOPSSET() to register register read/write funcitons */
51*4882a593Smuzhiyun typedef unsigned int (*osl_rreg_fn_t)(void *ctx, volatile void *reg, unsigned int size);
52*4882a593Smuzhiyun typedef void  (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val, unsigned int size);
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun #if defined(EFI)
55*4882a593Smuzhiyun #include <efi_osl.h>
56*4882a593Smuzhiyun #elif defined(WL_UNITTEST)
57*4882a593Smuzhiyun #include <utest_osl.h>
58*4882a593Smuzhiyun #elif defined(__linux__)
59*4882a593Smuzhiyun #include <linux_osl.h>
60*4882a593Smuzhiyun #include <linux_pkt.h>
61*4882a593Smuzhiyun #elif defined(NDIS)
62*4882a593Smuzhiyun #include <ndis_osl.h>
63*4882a593Smuzhiyun #elif defined(_RTE_)
64*4882a593Smuzhiyun #include <rte_osl.h>
65*4882a593Smuzhiyun #include <hnd_pkt.h>
66*4882a593Smuzhiyun #elif defined(MACOSX)
67*4882a593Smuzhiyun #include <macosx_osl.h>
68*4882a593Smuzhiyun #else
69*4882a593Smuzhiyun #error "Unsupported OSL requested"
70*4882a593Smuzhiyun #endif /* defined(DOS) */
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun #ifndef PKTDBG_TRACE
73*4882a593Smuzhiyun #define PKTDBG_TRACE(osh, pkt, bit)	BCM_REFERENCE(osh)
74*4882a593Smuzhiyun #endif
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun #ifndef BCM_UPTIME_PROFILE
77*4882a593Smuzhiyun #define OSL_GETCYCLES_PROF(x)
78*4882a593Smuzhiyun #endif
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /* --------------------------------------------------------------------------
81*4882a593Smuzhiyun ** Register manipulation macros.
82*4882a593Smuzhiyun */
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define	SET_REG(osh, r, mask, val)	W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun #ifndef AND_REG
87*4882a593Smuzhiyun #define AND_REG(osh, r, v)		W_REG(osh, (r), R_REG(osh, r) & (v))
88*4882a593Smuzhiyun #endif   /* !AND_REG */
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun #ifndef OR_REG
91*4882a593Smuzhiyun #define OR_REG(osh, r, v)		W_REG(osh, (r), R_REG(osh, r) | (v))
92*4882a593Smuzhiyun #endif   /* !OR_REG */
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun #if !defined(OSL_SYSUPTIME)
95*4882a593Smuzhiyun #define OSL_SYSUPTIME() (0)
96*4882a593Smuzhiyun #define OSL_SYSUPTIME_NOT_DEFINED 1
97*4882a593Smuzhiyun #endif /* !defined(OSL_SYSUPTIME) */
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun #if !defined(OSL_SYSUPTIME_US)
100*4882a593Smuzhiyun #define OSL_SYSUPTIME_US() (0)
101*4882a593Smuzhiyun #define OSL_SYSUPTIME_US_NOT_DEFINED 1
102*4882a593Smuzhiyun #endif /* !defined(OSL_SYSUPTIME) */
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun #if defined(OSL_SYSUPTIME_NOT_DEFINED) && defined(OSL_SYSUPTIME_US_NOT_DEFINED)
105*4882a593Smuzhiyun #define OSL_SYSUPTIME_SUPPORT FALSE
106*4882a593Smuzhiyun #else
107*4882a593Smuzhiyun #define OSL_SYSUPTIME_SUPPORT TRUE
108*4882a593Smuzhiyun #endif /* OSL_SYSUPTIME */
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun #ifndef OSL_GET_LOCALTIME
111*4882a593Smuzhiyun #define OSL_GET_LOCALTIME(sec, usec)	\
112*4882a593Smuzhiyun 	do { \
113*4882a593Smuzhiyun 		BCM_REFERENCE(sec); \
114*4882a593Smuzhiyun 		BCM_REFERENCE(usec); \
115*4882a593Smuzhiyun 	} while (0)
116*4882a593Smuzhiyun #endif /* OSL_GET_LOCALTIME */
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #ifndef OSL_LOCALTIME_NS
119*4882a593Smuzhiyun #define OSL_LOCALTIME_NS()	(OSL_SYSUPTIME_US() * NSEC_PER_USEC)
120*4882a593Smuzhiyun #endif /* OSL_LOCALTIME_NS */
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun #ifndef OSL_SYSTZTIME_US
123*4882a593Smuzhiyun #define OSL_SYSTZTIME_US()	OSL_SYSUPTIME_US()
124*4882a593Smuzhiyun #endif /* OSL_GET_SYSTZTIME */
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun #if !defined(OSL_CPU_COUNTS_PER_US)
127*4882a593Smuzhiyun #define OSL_CPU_COUNTS_PER_US() (0)
128*4882a593Smuzhiyun #define OSL_CPU_COUNTS_PER_US_NOT_DEFINED 1
129*4882a593Smuzhiyun #endif /* !defined(OSL_CPU_COUNTS_PER_US) */
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun #ifndef OSL_SYS_HALT
132*4882a593Smuzhiyun #ifdef __COVERITY__
133*4882a593Smuzhiyun /*
134*4882a593Smuzhiyun  * For Coverity builds, provide a definition that allows Coverity
135*4882a593Smuzhiyun  * to model the lack of return. This avoids Coverity False Positive
136*4882a593Smuzhiyun  * defects associated with data inconsistency being detected after
137*4882a593Smuzhiyun  * we otherwise would have halted.
138*4882a593Smuzhiyun  */
139*4882a593Smuzhiyun #define OSL_SYS_HALT()   __coverity_panic__()
140*4882a593Smuzhiyun #else /* __COVERITY__ */
141*4882a593Smuzhiyun #define OSL_SYS_HALT()	do {} while (0)
142*4882a593Smuzhiyun #endif /* __COVERITY__ */
143*4882a593Smuzhiyun #endif /* OSL_SYS_HALT */
144*4882a593Smuzhiyun 
145*4882a593Smuzhiyun #ifndef DMB
146*4882a593Smuzhiyun #define DMB()	do {} while (0)
147*4882a593Smuzhiyun #endif /* DMB */
148*4882a593Smuzhiyun 
149*4882a593Smuzhiyun #ifndef OSL_MEM_AVAIL
150*4882a593Smuzhiyun #define OSL_MEM_AVAIL()	(0xffffffff)
151*4882a593Smuzhiyun #endif
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun #ifndef OSL_OBFUSCATE_BUF
154*4882a593Smuzhiyun #if defined (_RTE_)
155*4882a593Smuzhiyun #define OSL_OBFUSCATE_BUF(x) osl_obfuscate_ptr(x)
156*4882a593Smuzhiyun #else
157*4882a593Smuzhiyun #define OSL_OBFUSCATE_BUF(x) (x)
158*4882a593Smuzhiyun #endif	/* _RTE_ */
159*4882a593Smuzhiyun #endif	/* OSL_OBFUSCATE_BUF */
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun #ifndef OSL_GET_HCAPISTIMESYNC
162*4882a593Smuzhiyun #if defined (_RTE_)
163*4882a593Smuzhiyun #define OSL_GET_HCAPISTIMESYNC() osl_get_hcapistimesync()
164*4882a593Smuzhiyun #else
165*4882a593Smuzhiyun #define OSL_GET_HCAPISTIMESYNC()
166*4882a593Smuzhiyun #endif	/* _RTE_ */
167*4882a593Smuzhiyun #endif	/*  OSL_GET_HCAPISTIMESYNC */
168*4882a593Smuzhiyun 
169*4882a593Smuzhiyun #ifndef OSL_GET_HCAPISPKTTXS
170*4882a593Smuzhiyun #if defined (_RTE_)
171*4882a593Smuzhiyun #define OSL_GET_HCAPISPKTTXS() osl_get_hcapispkttxs()
172*4882a593Smuzhiyun #else
173*4882a593Smuzhiyun #define OSL_GET_HCAPISPKTTXS()
174*4882a593Smuzhiyun #endif	/* _RTE_ */
175*4882a593Smuzhiyun #endif	/*  OSL_GET_HCAPISPKTTXS */
176*4882a593Smuzhiyun 
177*4882a593Smuzhiyun #if !defined(PKTC_DONGLE)
178*4882a593Smuzhiyun #define	PKTCGETATTR(skb)	(0)
179*4882a593Smuzhiyun #define	PKTCSETATTR(skb, f, p, b) BCM_REFERENCE(skb)
180*4882a593Smuzhiyun #define	PKTCCLRATTR(skb)	BCM_REFERENCE(skb)
181*4882a593Smuzhiyun #define	PKTCCNT(skb)		(1)
182*4882a593Smuzhiyun #define	PKTCLEN(skb)		PKTLEN(NULL, skb)
183*4882a593Smuzhiyun #define	PKTCGETFLAGS(skb)	(0)
184*4882a593Smuzhiyun #define	PKTCSETFLAGS(skb, f)	BCM_REFERENCE(skb)
185*4882a593Smuzhiyun #define	PKTCCLRFLAGS(skb)	BCM_REFERENCE(skb)
186*4882a593Smuzhiyun #define	PKTCFLAGS(skb)		(0)
187*4882a593Smuzhiyun #define	PKTCSETCNT(skb, c)	BCM_REFERENCE(skb)
188*4882a593Smuzhiyun #define	PKTCINCRCNT(skb)	BCM_REFERENCE(skb)
189*4882a593Smuzhiyun #define	PKTCADDCNT(skb, c)	BCM_REFERENCE(skb)
190*4882a593Smuzhiyun #define	PKTCSETLEN(skb, l)	BCM_REFERENCE(skb)
191*4882a593Smuzhiyun #define	PKTCADDLEN(skb, l)	BCM_REFERENCE(skb)
192*4882a593Smuzhiyun #define	PKTCSETFLAG(skb, fb)	BCM_REFERENCE(skb)
193*4882a593Smuzhiyun #define	PKTCCLRFLAG(skb, fb)	BCM_REFERENCE(skb)
194*4882a593Smuzhiyun #define	PKTCLINK(skb)		NULL
195*4882a593Smuzhiyun #define	PKTSETCLINK(skb, x)	BCM_REFERENCE(skb)
196*4882a593Smuzhiyun #define FOREACH_CHAINED_PKT(skb, nskb) \
197*4882a593Smuzhiyun 	for ((nskb) = NULL; (skb) != NULL; (skb) = (nskb))
198*4882a593Smuzhiyun #define	PKTCFREE		PKTFREE
199*4882a593Smuzhiyun #define PKTCENQTAIL(h, t, p) \
200*4882a593Smuzhiyun do { \
201*4882a593Smuzhiyun 	if ((t) == NULL) { \
202*4882a593Smuzhiyun 		(h) = (t) = (p); \
203*4882a593Smuzhiyun 	} \
204*4882a593Smuzhiyun } while (0)
205*4882a593Smuzhiyun #endif /* !PKTC_DONGLE */
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun #ifndef PKTSETCHAINED
208*4882a593Smuzhiyun #define PKTSETCHAINED(osh, skb)		BCM_REFERENCE(osh)
209*4882a593Smuzhiyun #endif
210*4882a593Smuzhiyun #ifndef PKTCLRCHAINED
211*4882a593Smuzhiyun #define PKTCLRCHAINED(osh, skb)		BCM_REFERENCE(osh)
212*4882a593Smuzhiyun #endif
213*4882a593Smuzhiyun #ifndef PKTISCHAINED
214*4882a593Smuzhiyun #define PKTISCHAINED(skb)		FALSE
215*4882a593Smuzhiyun #endif
216*4882a593Smuzhiyun 
217*4882a593Smuzhiyun #ifndef PKTGETPROFILEIDX
218*4882a593Smuzhiyun #define PKTGETPROFILEIDX(p)		(-1)
219*4882a593Smuzhiyun #endif
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun #ifndef PKTCLRPROFILEIDX
222*4882a593Smuzhiyun #define PKTCLRPROFILEIDX(p)
223*4882a593Smuzhiyun #endif
224*4882a593Smuzhiyun 
225*4882a593Smuzhiyun #ifndef PKTSETPROFILEIDX
226*4882a593Smuzhiyun #define PKTSETPROFILEIDX(p, idx)	BCM_REFERENCE(idx)
227*4882a593Smuzhiyun #endif
228*4882a593Smuzhiyun 
229*4882a593Smuzhiyun #ifndef _RTE_
230*4882a593Smuzhiyun /* Lbuf with fraglist */
231*4882a593Smuzhiyun #ifndef PKTFRAGPKTID
232*4882a593Smuzhiyun #define PKTFRAGPKTID(osh, lb)		(0)
233*4882a593Smuzhiyun #endif
234*4882a593Smuzhiyun #ifndef PKTSETFRAGPKTID
235*4882a593Smuzhiyun #define PKTSETFRAGPKTID(osh, lb, id)	BCM_REFERENCE(osh)
236*4882a593Smuzhiyun #endif
237*4882a593Smuzhiyun #ifndef PKTFRAGTOTNUM
238*4882a593Smuzhiyun #define PKTFRAGTOTNUM(osh, lb)		(0)
239*4882a593Smuzhiyun #endif
240*4882a593Smuzhiyun #ifndef PKTSETFRAGTOTNUM
241*4882a593Smuzhiyun #define PKTSETFRAGTOTNUM(osh, lb, tot)	BCM_REFERENCE(osh)
242*4882a593Smuzhiyun #endif
243*4882a593Smuzhiyun #ifndef PKTFRAGTOTLEN
244*4882a593Smuzhiyun #define PKTFRAGTOTLEN(osh, lb)		(0)
245*4882a593Smuzhiyun #endif
246*4882a593Smuzhiyun #ifndef PKTSETFRAGTOTLEN
247*4882a593Smuzhiyun #define PKTSETFRAGTOTLEN(osh, lb, len)	BCM_REFERENCE(osh)
248*4882a593Smuzhiyun #endif
249*4882a593Smuzhiyun #ifndef PKTIFINDEX
250*4882a593Smuzhiyun #define PKTIFINDEX(osh, lb)		(0)
251*4882a593Smuzhiyun #endif
252*4882a593Smuzhiyun #ifndef PKTSETIFINDEX
253*4882a593Smuzhiyun #define PKTSETIFINDEX(osh, lb, idx)	BCM_REFERENCE(osh)
254*4882a593Smuzhiyun #endif
255*4882a593Smuzhiyun #ifndef PKTGETLF
256*4882a593Smuzhiyun #define	PKTGETLF(osh, len, send, lbuf_type)	(0)
257*4882a593Smuzhiyun #endif
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun /* in rx path, reuse totlen as used len */
260*4882a593Smuzhiyun #ifndef PKTFRAGUSEDLEN
261*4882a593Smuzhiyun #define PKTFRAGUSEDLEN(osh, lb)			(0)
262*4882a593Smuzhiyun #endif
263*4882a593Smuzhiyun #ifndef PKTSETFRAGUSEDLEN
264*4882a593Smuzhiyun #define PKTSETFRAGUSEDLEN(osh, lb, len)		BCM_REFERENCE(osh)
265*4882a593Smuzhiyun #endif
266*4882a593Smuzhiyun #ifndef PKTFRAGLEN
267*4882a593Smuzhiyun #define PKTFRAGLEN(osh, lb, ix)			(0)
268*4882a593Smuzhiyun #endif
269*4882a593Smuzhiyun #ifndef PKTSETFRAGLEN
270*4882a593Smuzhiyun #define PKTSETFRAGLEN(osh, lb, ix, len)		BCM_REFERENCE(osh)
271*4882a593Smuzhiyun #endif
272*4882a593Smuzhiyun #ifndef PKTFRAGDATA_LO
273*4882a593Smuzhiyun #define PKTFRAGDATA_LO(osh, lb, ix)		(0)
274*4882a593Smuzhiyun #endif
275*4882a593Smuzhiyun #ifndef PKTSETFRAGDATA_LO
276*4882a593Smuzhiyun #define PKTSETFRAGDATA_LO(osh, lb, ix, addr)	BCM_REFERENCE(osh)
277*4882a593Smuzhiyun #endif
278*4882a593Smuzhiyun #ifndef PKTFRAGDATA_HI
279*4882a593Smuzhiyun #define PKTFRAGDATA_HI(osh, lb, ix)		(0)
280*4882a593Smuzhiyun #endif
281*4882a593Smuzhiyun #ifndef PKTSETFRAGDATA_HI
282*4882a593Smuzhiyun #define PKTSETFRAGDATA_HI(osh, lb, ix, addr)	BCM_REFERENCE(osh)
283*4882a593Smuzhiyun #endif
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun #ifndef PKTFRAGMOVE
286*4882a593Smuzhiyun #define PKTFRAGMOVE(osh, dst, src) (BCM_REFERENCE(osh), BCM_REFERENCE(dst), BCM_REFERENCE(src))
287*4882a593Smuzhiyun #endif
288*4882a593Smuzhiyun 
289*4882a593Smuzhiyun /* RX FRAG */
290*4882a593Smuzhiyun #ifndef PKTISRXFRAG
291*4882a593Smuzhiyun #define PKTISRXFRAG(osh, lb)		(0)
292*4882a593Smuzhiyun #endif
293*4882a593Smuzhiyun #ifndef PKTSETRXFRAG
294*4882a593Smuzhiyun #define PKTSETRXFRAG(osh, lb)		BCM_REFERENCE(osh)
295*4882a593Smuzhiyun #endif
296*4882a593Smuzhiyun #ifndef PKTRESETRXFRAG
297*4882a593Smuzhiyun #define PKTRESETRXFRAG(osh, lb)		BCM_REFERENCE(osh)
298*4882a593Smuzhiyun #endif
299*4882a593Smuzhiyun 
300*4882a593Smuzhiyun /* TX FRAG */
301*4882a593Smuzhiyun #ifndef PKTISTXFRAG
302*4882a593Smuzhiyun #define PKTISTXFRAG(osh, lb)		(0)
303*4882a593Smuzhiyun #endif
304*4882a593Smuzhiyun #ifndef PKTSETTXFRAG
305*4882a593Smuzhiyun #define PKTSETTXFRAG(osh, lb)		BCM_REFERENCE(osh)
306*4882a593Smuzhiyun #endif
307*4882a593Smuzhiyun 
308*4882a593Smuzhiyun /* TX ALFRAG */
309*4882a593Smuzhiyun #ifndef PKTISTXALFRAG
310*4882a593Smuzhiyun #define PKTISTXALFRAG(osh, lb)		(0)
311*4882a593Smuzhiyun #endif
312*4882a593Smuzhiyun #ifndef PKTSETTXALFRAG
313*4882a593Smuzhiyun #define PKTSETTXALFRAG(osh, lb)		BCM_REFERENCE(osh)
314*4882a593Smuzhiyun #endif
315*4882a593Smuzhiyun #ifndef PKTRESETTXALFRAG
316*4882a593Smuzhiyun #define PKTRESETTXALFRAG(osh, lb)	BCM_REFERENCE(osh)
317*4882a593Smuzhiyun #endif
318*4882a593Smuzhiyun 
319*4882a593Smuzhiyun #ifndef PKTNUMMPDUS
320*4882a593Smuzhiyun #define PKTNUMMPDUS(osh, lb)		(1)
321*4882a593Smuzhiyun #endif
322*4882a593Smuzhiyun #ifndef PKTNUMPKTS
323*4882a593Smuzhiyun #define PKTNUMPKTS(osh, lb)		(1)
324*4882a593Smuzhiyun #endif
325*4882a593Smuzhiyun 
326*4882a593Smuzhiyun #ifndef PKTISHWCSO
327*4882a593Smuzhiyun #define PKTISHWCSO(osh, lb)		(FALSE)
328*4882a593Smuzhiyun #endif
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun #ifndef PKTISSUBMSDUTOEHDR
331*4882a593Smuzhiyun #define PKTISSUBMSDUTOEHDR(osh, lb)	(FALSE)
332*4882a593Smuzhiyun #endif
333*4882a593Smuzhiyun 
334*4882a593Smuzhiyun #ifndef PKT_IS_HOST_SFHLLC
335*4882a593Smuzhiyun #define PKT_IS_HOST_SFHLLC(osh, lb)	(FALSE)
336*4882a593Smuzhiyun #endif
337*4882a593Smuzhiyun 
338*4882a593Smuzhiyun #ifndef PKT_SET_HOST_SFHLLC
339*4882a593Smuzhiyun #define PKT_SET_HOST_SFHLLC(osh, lb)	BCM_REFERENCE(osh)
340*4882a593Smuzhiyun #endif
341*4882a593Smuzhiyun 
342*4882a593Smuzhiyun #ifndef PKT_IS_HOST_SFHLLC_DONE
343*4882a593Smuzhiyun #define PKT_IS_HOST_SFHLLC_DONE(osh, lb)	(FALSE)
344*4882a593Smuzhiyun #endif
345*4882a593Smuzhiyun 
346*4882a593Smuzhiyun #ifndef PKT_SET_HOST_SFHLLC_DONE
347*4882a593Smuzhiyun #define PKT_SET_HOST_SFHLLC_DONE(osh, lb)	BCM_REFERENCE(osh)
348*4882a593Smuzhiyun #endif
349*4882a593Smuzhiyun 
350*4882a593Smuzhiyun /* Need Rx completion used for AMPDU reordering */
351*4882a593Smuzhiyun #ifndef PKTNEEDRXCPL
352*4882a593Smuzhiyun #define PKTNEEDRXCPL(osh, lb)           (TRUE)
353*4882a593Smuzhiyun #endif
354*4882a593Smuzhiyun #ifndef PKTSETNORXCPL
355*4882a593Smuzhiyun #define PKTSETNORXCPL(osh, lb)          BCM_REFERENCE(osh)
356*4882a593Smuzhiyun #endif
357*4882a593Smuzhiyun #ifndef PKTRESETNORXCPL
358*4882a593Smuzhiyun #define PKTRESETNORXCPL(osh, lb)        BCM_REFERENCE(osh)
359*4882a593Smuzhiyun #endif
360*4882a593Smuzhiyun #ifndef PKTISFRAG
361*4882a593Smuzhiyun #define PKTISFRAG(osh, lb)		(0)
362*4882a593Smuzhiyun #endif
363*4882a593Smuzhiyun #ifndef PKTFRAGISCHAINED
364*4882a593Smuzhiyun #define PKTFRAGISCHAINED(osh, i)	(0)
365*4882a593Smuzhiyun #endif
366*4882a593Smuzhiyun #ifndef PKTISHDRCONVTD
367*4882a593Smuzhiyun #define PKTISHDRCONVTD(osh, lb)		(0)
368*4882a593Smuzhiyun #endif
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun /* Forwarded pkt indication */
371*4882a593Smuzhiyun #ifndef PKTISFRWDPKT
372*4882a593Smuzhiyun #define PKTISFRWDPKT(osh, lb)		0
373*4882a593Smuzhiyun #endif
374*4882a593Smuzhiyun #ifndef PKTSETFRWDPKT
375*4882a593Smuzhiyun #define PKTSETFRWDPKT(osh, lb)		BCM_REFERENCE(osh)
376*4882a593Smuzhiyun #endif
377*4882a593Smuzhiyun #ifndef PKTRESETFRWDPKT
378*4882a593Smuzhiyun #define PKTRESETFRWDPKT(osh, lb)	BCM_REFERENCE(osh)
379*4882a593Smuzhiyun #endif
380*4882a593Smuzhiyun 
381*4882a593Smuzhiyun /* PKT consumed for totlen calculation */
382*4882a593Smuzhiyun #ifndef PKTISUSEDTOTLEN
383*4882a593Smuzhiyun #define PKTISUSEDTOTLEN(osh, lb)		0
384*4882a593Smuzhiyun #endif
385*4882a593Smuzhiyun #ifndef PKTSETUSEDTOTLEN
386*4882a593Smuzhiyun #define PKTSETUSEDTOTLEN(osh, lb)		BCM_REFERENCE(osh)
387*4882a593Smuzhiyun #endif
388*4882a593Smuzhiyun #ifndef PKTRESETUSEDTOTLEN
389*4882a593Smuzhiyun #define PKTRESETUSEDTOTLEN(osh, lb)             BCM_REFERENCE(osh)
390*4882a593Smuzhiyun #endif
391*4882a593Smuzhiyun 
392*4882a593Smuzhiyun /* UDR Packet Indication */
393*4882a593Smuzhiyun #ifndef PKTISUDR
394*4882a593Smuzhiyun #define PKTISUDR(osh, lb)			0
395*4882a593Smuzhiyun #endif
396*4882a593Smuzhiyun 
397*4882a593Smuzhiyun #ifndef PKTSETUDR
398*4882a593Smuzhiyun #define PKTSETUDR(osh, lb)			BCM_REFERENCE(osh)
399*4882a593Smuzhiyun #endif
400*4882a593Smuzhiyun 
401*4882a593Smuzhiyun #ifndef PKTSETUDR
402*4882a593Smuzhiyun #define PKTRESETUDR(osh, lb)			BCM_REFERENCE(osh)
403*4882a593Smuzhiyun #endif
404*4882a593Smuzhiyun #endif	/* _RTE_ */
405*4882a593Smuzhiyun 
406*4882a593Smuzhiyun #if !(defined(__linux__))
407*4882a593Smuzhiyun #define PKTLIST_INIT(x)			BCM_REFERENCE(x)
408*4882a593Smuzhiyun #define PKTLIST_ENQ(x, y)		BCM_REFERENCE(x)
409*4882a593Smuzhiyun #define PKTLIST_DEQ(x)			BCM_REFERENCE(x)
410*4882a593Smuzhiyun #define PKTLIST_UNLINK(x, y)		BCM_REFERENCE(x)
411*4882a593Smuzhiyun #define PKTLIST_FINI(x)			BCM_REFERENCE(x)
412*4882a593Smuzhiyun #endif
413*4882a593Smuzhiyun 
414*4882a593Smuzhiyun #ifndef ROMMABLE_ASSERT
415*4882a593Smuzhiyun #define ROMMABLE_ASSERT(exp) ASSERT(exp)
416*4882a593Smuzhiyun #endif /* ROMMABLE_ASSERT */
417*4882a593Smuzhiyun 
418*4882a593Smuzhiyun #ifndef MALLOC_NOPERSIST
419*4882a593Smuzhiyun 	#define MALLOC_NOPERSIST MALLOC
420*4882a593Smuzhiyun #endif /* !MALLOC_NOPERSIST */
421*4882a593Smuzhiyun 
422*4882a593Smuzhiyun #ifndef MALLOC_PERSIST
423*4882a593Smuzhiyun 	#define MALLOC_PERSIST MALLOC
424*4882a593Smuzhiyun #endif /* !MALLOC_PERSIST */
425*4882a593Smuzhiyun 
426*4882a593Smuzhiyun #ifndef MALLOC_RA
427*4882a593Smuzhiyun 	#define MALLOC_RA(osh, size, callsite) MALLOCZ(osh, size)
428*4882a593Smuzhiyun #endif /* !MALLOC_RA */
429*4882a593Smuzhiyun 
430*4882a593Smuzhiyun #ifndef MALLOC_PERSIST_ATTACH
431*4882a593Smuzhiyun 	#define MALLOC_PERSIST_ATTACH MALLOC
432*4882a593Smuzhiyun #endif /* !MALLOC_PERSIST_ATTACH */
433*4882a593Smuzhiyun 
434*4882a593Smuzhiyun #ifndef MALLOCZ_PERSIST_ATTACH
435*4882a593Smuzhiyun 	#define MALLOCZ_PERSIST_ATTACH MALLOCZ
436*4882a593Smuzhiyun #endif /* !MALLOCZ_PERSIST_ATTACH */
437*4882a593Smuzhiyun 
438*4882a593Smuzhiyun #ifndef MALLOCZ_NOPERSIST
439*4882a593Smuzhiyun 	#define MALLOCZ_NOPERSIST MALLOCZ
440*4882a593Smuzhiyun #endif /* !MALLOCZ_NOPERSIST */
441*4882a593Smuzhiyun 
442*4882a593Smuzhiyun #ifndef MALLOCZ_PERSIST
443*4882a593Smuzhiyun 	#define MALLOCZ_PERSIST MALLOCZ
444*4882a593Smuzhiyun #endif /* !MALLOCZ_PERSIST */
445*4882a593Smuzhiyun 
446*4882a593Smuzhiyun #ifndef MFREE_PERSIST
447*4882a593Smuzhiyun 	#define MFREE_PERSIST MFREE
448*4882a593Smuzhiyun #endif /* !MFREE_PERSIST */
449*4882a593Smuzhiyun 
450*4882a593Smuzhiyun #ifndef MALLOC_SET_NOPERSIST
451*4882a593Smuzhiyun 	#define MALLOC_SET_NOPERSIST(osh)	do { } while (0)
452*4882a593Smuzhiyun #endif /* !MALLOC_SET_NOPERSIST */
453*4882a593Smuzhiyun 
454*4882a593Smuzhiyun #ifndef MALLOC_CLEAR_NOPERSIST
455*4882a593Smuzhiyun 	#define MALLOC_CLEAR_NOPERSIST(osh)	do { } while (0)
456*4882a593Smuzhiyun #endif /* !MALLOC_CLEAR_NOPERSIST */
457*4882a593Smuzhiyun 
458*4882a593Smuzhiyun #if defined(OSL_MEMCHECK)
459*4882a593Smuzhiyun #define MEMCHECK(f, l)	osl_memcheck(f, l)
460*4882a593Smuzhiyun #else
461*4882a593Smuzhiyun #define MEMCHECK(f, l)
462*4882a593Smuzhiyun #endif /* OSL_MEMCHECK */
463*4882a593Smuzhiyun 
464*4882a593Smuzhiyun #ifndef BCMDBGPERF
465*4882a593Smuzhiyun #define PERF_TRACE_START(id)				do {} while (0)
466*4882a593Smuzhiyun #define PERF_TRACE_END(id)				do {} while (0)
467*4882a593Smuzhiyun #define PERF_TRACE_END2(id, mycounters)			do {} while (0)
468*4882a593Smuzhiyun #define PERF_TRACE_END3(id, mycounters, coreunit)	do {} while (0)
469*4882a593Smuzhiyun #define UPDATE_PERF_TRACE_COUNTER(counter, val)		do {} while (0)
470*4882a593Smuzhiyun #define ADD_PERF_TRACE_COUNTER(counter, val)		do {} while (0)
471*4882a593Smuzhiyun #endif /* OSL_MEMCHECK */
472*4882a593Smuzhiyun 
473*4882a593Smuzhiyun /* Virtual/physical address translation. */
474*4882a593Smuzhiyun #if !defined(OSL_VIRT_TO_PHYS_ADDR)
475*4882a593Smuzhiyun 	#define OSL_VIRT_TO_PHYS_ADDR(va)	((void*)(uintptr)(va))
476*4882a593Smuzhiyun #endif
477*4882a593Smuzhiyun 
478*4882a593Smuzhiyun #if !defined(OSL_PHYS_TO_VIRT_ADDR)
479*4882a593Smuzhiyun 	#define OSL_PHYS_TO_VIRT_ADDR(pa)	((void*)(uintptr)(pa))
480*4882a593Smuzhiyun #endif
481*4882a593Smuzhiyun 
482*4882a593Smuzhiyun #endif	/* _osl_h_ */
483