.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * OS Abstraction Layer |
---|
4 | 3 | * |
---|
5 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
---|
6 | | - * |
---|
| 4 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
---|
| 5 | + * |
---|
| 6 | + * Copyright (C) 1999-2017, Broadcom Corporation |
---|
| 7 | + * |
---|
7 | 8 | * Unless you and Broadcom execute a separate written software license |
---|
8 | 9 | * agreement governing use of this software, this software is licensed to you |
---|
9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
---|
10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
---|
11 | 12 | * following added to such license: |
---|
12 | | - * |
---|
| 13 | + * |
---|
13 | 14 | * As a special exception, the copyright holders of this software give you |
---|
14 | 15 | * permission to link this software with independent modules, and to copy and |
---|
15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
---|
.. | .. |
---|
17 | 18 | * the license of that module. An independent module is a module which is not |
---|
18 | 19 | * derived from this software. The special exception does not apply to any |
---|
19 | 20 | * modifications of the software. |
---|
20 | | - * |
---|
| 21 | + * |
---|
21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
---|
22 | 23 | * software in any way with any other Broadcom software provided under a license |
---|
23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
---|
.. | .. |
---|
25 | 26 | * |
---|
26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
---|
27 | 28 | * |
---|
28 | | - * $Id: osl.h 585315 2015-09-10 06:02:11Z $ |
---|
| 29 | + * $Id: osl.h 673906 2016-12-05 19:59:39Z $ |
---|
29 | 30 | */ |
---|
30 | 31 | |
---|
31 | 32 | #ifndef _osl_h_ |
---|
.. | .. |
---|
33 | 34 | |
---|
34 | 35 | #include <osl_decl.h> |
---|
35 | 36 | |
---|
36 | | -#define OSL_PKTTAG_SZ 32 /* Size of PktTag */ |
---|
| 37 | +enum { |
---|
| 38 | + TAIL_BYTES_TYPE_FCS = 1, |
---|
| 39 | + TAIL_BYTES_TYPE_ICV = 2, |
---|
| 40 | + TAIL_BYTES_TYPE_MIC = 3 |
---|
| 41 | +}; |
---|
| 42 | + |
---|
| 43 | +#define OSL_PKTTAG_SZ 48 /* standard linux pkttag size is 48 bytes */ |
---|
37 | 44 | |
---|
38 | 45 | /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */ |
---|
39 | 46 | typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status); |
---|
.. | .. |
---|
42 | 49 | typedef unsigned int (*osl_rreg_fn_t)(void *ctx, volatile void *reg, unsigned int size); |
---|
43 | 50 | typedef void (*osl_wreg_fn_t)(void *ctx, volatile void *reg, unsigned int val, unsigned int size); |
---|
44 | 51 | |
---|
45 | | - |
---|
46 | | - |
---|
47 | 52 | #if defined(WL_UNITTEST) |
---|
48 | 53 | #include <utest_osl.h> |
---|
49 | 54 | #else |
---|
50 | 55 | #include <linux_osl.h> |
---|
51 | | -#endif |
---|
| 56 | +#include <linux_pkt.h> |
---|
| 57 | +#endif // endif |
---|
52 | 58 | |
---|
53 | 59 | #ifndef PKTDBG_TRACE |
---|
54 | 60 | #define PKTDBG_TRACE(osh, pkt, bit) BCM_REFERENCE(osh) |
---|
55 | | -#endif |
---|
| 61 | +#endif // endif |
---|
56 | 62 | |
---|
57 | 63 | #define PKTCTFMAP(osh, p) BCM_REFERENCE(osh) |
---|
58 | 64 | |
---|
.. | .. |
---|
72 | 78 | |
---|
73 | 79 | #if !defined(OSL_SYSUPTIME) |
---|
74 | 80 | #define OSL_SYSUPTIME() (0) |
---|
| 81 | +#define OSL_SYSUPTIME_NOT_DEFINED 1 |
---|
| 82 | +#endif /* !defined(OSL_SYSUPTIME) */ |
---|
| 83 | + |
---|
| 84 | +#if !defined(OSL_SYSUPTIME_US) |
---|
| 85 | +#define OSL_SYSUPTIME_US() (0) |
---|
| 86 | +#define OSL_SYSUPTIME_US_NOT_DEFINED 1 |
---|
| 87 | +#endif /* !defined(OSL_SYSUPTIME) */ |
---|
| 88 | + |
---|
| 89 | +#if defined(OSL_SYSUPTIME_NOT_DEFINED) && defined(OSL_SYSUPTIME_US_NOT_DEFINED) |
---|
75 | 90 | #define OSL_SYSUPTIME_SUPPORT FALSE |
---|
76 | 91 | #else |
---|
77 | 92 | #define OSL_SYSUPTIME_SUPPORT TRUE |
---|
78 | 93 | #endif /* OSL_SYSUPTIME */ |
---|
79 | 94 | |
---|
| 95 | +#ifndef OSL_GET_LOCALTIME |
---|
| 96 | +#define OSL_GET_LOCALTIME(sec, usec) \ |
---|
| 97 | + do { \ |
---|
| 98 | + BCM_REFERENCE(sec); \ |
---|
| 99 | + BCM_REFERENCE(usec); \ |
---|
| 100 | + } while (0) |
---|
| 101 | +#endif /* OSL_GET_LOCALTIME */ |
---|
| 102 | + |
---|
| 103 | +#ifndef OSL_LOCALTIME_NS |
---|
| 104 | +#define OSL_LOCALTIME_NS() (OSL_SYSUPTIME_US() * NSEC_PER_USEC) |
---|
| 105 | +#endif /* OSL_LOCALTIME_NS */ |
---|
| 106 | + |
---|
| 107 | +#ifndef OSL_SYSTZTIME_US |
---|
| 108 | +#define OSL_SYSTZTIME_US() OSL_SYSUPTIME_US() |
---|
| 109 | +#endif /* OSL_GET_SYSTZTIME */ |
---|
| 110 | + |
---|
80 | 111 | #ifndef OSL_SYS_HALT |
---|
81 | 112 | #define OSL_SYS_HALT() do {} while (0) |
---|
82 | | -#endif |
---|
| 113 | +#endif // endif |
---|
| 114 | + |
---|
| 115 | +#ifndef DMB |
---|
| 116 | +#if defined(STB) |
---|
| 117 | +#define DMB() mb(); |
---|
| 118 | +#else /* STB */ |
---|
| 119 | +#define DMB() do {} while (0) |
---|
| 120 | +#endif /* STB */ |
---|
| 121 | +#endif /* DMB */ |
---|
83 | 122 | |
---|
84 | 123 | #ifndef OSL_MEM_AVAIL |
---|
85 | 124 | #define OSL_MEM_AVAIL() (0xffffffff) |
---|
86 | | -#endif |
---|
| 125 | +#endif // endif |
---|
87 | 126 | |
---|
88 | | -#if !defined(PKTC) && !defined(PKTC_DONGLE) |
---|
| 127 | +#ifndef OSL_OBFUSCATE_BUF |
---|
| 128 | +/* For security reasons printing pointers is not allowed. |
---|
| 129 | + * Some OSLs implement OSL_OBFUSCATE_BUF to OS specific obfuscate API. |
---|
| 130 | + * If OSL_OBFUSCATE_BUF() is not implemented in OSL, then default to |
---|
| 131 | + * printing the input pointer |
---|
| 132 | + */ |
---|
| 133 | +#define OSL_OBFUSCATE_BUF(x) (x) |
---|
| 134 | +#endif /* OSL_OBFUSCATE_BUF */ |
---|
| 135 | + |
---|
| 136 | +#if !defined(PKTC_DONGLE) |
---|
| 137 | + |
---|
89 | 138 | #define PKTCGETATTR(skb) (0) |
---|
90 | 139 | #define PKTCSETATTR(skb, f, p, b) BCM_REFERENCE(skb) |
---|
91 | 140 | #define PKTCCLRATTR(skb) BCM_REFERENCE(skb) |
---|
.. | .. |
---|
113 | 162 | (h) = (t) = (p); \ |
---|
114 | 163 | } \ |
---|
115 | 164 | } while (0) |
---|
116 | | -#endif /* !linux || !PKTC */ |
---|
| 165 | +#endif // endif |
---|
117 | 166 | |
---|
118 | | -#if !defined(HNDCTF) && !defined(PKTC_TX_DONGLE) |
---|
| 167 | +#ifndef PKTSETCHAINED |
---|
119 | 168 | #define PKTSETCHAINED(osh, skb) BCM_REFERENCE(osh) |
---|
| 169 | +#endif // endif |
---|
| 170 | +#ifndef PKTCLRCHAINED |
---|
120 | 171 | #define PKTCLRCHAINED(osh, skb) BCM_REFERENCE(osh) |
---|
| 172 | +#endif // endif |
---|
| 173 | +#ifndef PKTISCHAINED |
---|
121 | 174 | #define PKTISCHAINED(skb) FALSE |
---|
122 | | -#endif |
---|
| 175 | +#endif // endif |
---|
123 | 176 | |
---|
124 | 177 | /* Lbuf with fraglist */ |
---|
| 178 | +#ifndef PKTFRAGPKTID |
---|
125 | 179 | #define PKTFRAGPKTID(osh, lb) (0) |
---|
| 180 | +#endif // endif |
---|
| 181 | +#ifndef PKTSETFRAGPKTID |
---|
126 | 182 | #define PKTSETFRAGPKTID(osh, lb, id) BCM_REFERENCE(osh) |
---|
| 183 | +#endif // endif |
---|
| 184 | +#ifndef PKTFRAGTOTNUM |
---|
127 | 185 | #define PKTFRAGTOTNUM(osh, lb) (0) |
---|
| 186 | +#endif // endif |
---|
| 187 | +#ifndef PKTSETFRAGTOTNUM |
---|
128 | 188 | #define PKTSETFRAGTOTNUM(osh, lb, tot) BCM_REFERENCE(osh) |
---|
| 189 | +#endif // endif |
---|
| 190 | +#ifndef PKTFRAGTOTLEN |
---|
129 | 191 | #define PKTFRAGTOTLEN(osh, lb) (0) |
---|
| 192 | +#endif // endif |
---|
| 193 | +#ifndef PKTSETFRAGTOTLEN |
---|
130 | 194 | #define PKTSETFRAGTOTLEN(osh, lb, len) BCM_REFERENCE(osh) |
---|
| 195 | +#endif // endif |
---|
| 196 | +#ifndef PKTIFINDEX |
---|
131 | 197 | #define PKTIFINDEX(osh, lb) (0) |
---|
| 198 | +#endif // endif |
---|
| 199 | +#ifndef PKTSETIFINDEX |
---|
132 | 200 | #define PKTSETIFINDEX(osh, lb, idx) BCM_REFERENCE(osh) |
---|
| 201 | +#endif // endif |
---|
| 202 | +#ifndef PKTGETLF |
---|
133 | 203 | #define PKTGETLF(osh, len, send, lbuf_type) (0) |
---|
| 204 | +#endif // endif |
---|
134 | 205 | |
---|
135 | 206 | /* in rx path, reuse totlen as used len */ |
---|
| 207 | +#ifndef PKTFRAGUSEDLEN |
---|
136 | 208 | #define PKTFRAGUSEDLEN(osh, lb) (0) |
---|
| 209 | +#endif // endif |
---|
| 210 | +#ifndef PKTSETFRAGUSEDLEN |
---|
137 | 211 | #define PKTSETFRAGUSEDLEN(osh, lb, len) BCM_REFERENCE(osh) |
---|
138 | | - |
---|
| 212 | +#endif // endif |
---|
| 213 | +#ifndef PKTFRAGLEN |
---|
139 | 214 | #define PKTFRAGLEN(osh, lb, ix) (0) |
---|
| 215 | +#endif // endif |
---|
| 216 | +#ifndef PKTSETFRAGLEN |
---|
140 | 217 | #define PKTSETFRAGLEN(osh, lb, ix, len) BCM_REFERENCE(osh) |
---|
| 218 | +#endif // endif |
---|
| 219 | +#ifndef PKTFRAGDATA_LO |
---|
141 | 220 | #define PKTFRAGDATA_LO(osh, lb, ix) (0) |
---|
| 221 | +#endif // endif |
---|
| 222 | +#ifndef PKTSETFRAGDATA_LO |
---|
142 | 223 | #define PKTSETFRAGDATA_LO(osh, lb, ix, addr) BCM_REFERENCE(osh) |
---|
| 224 | +#endif // endif |
---|
| 225 | +#ifndef PKTFRAGDATA_HI |
---|
143 | 226 | #define PKTFRAGDATA_HI(osh, lb, ix) (0) |
---|
| 227 | +#endif // endif |
---|
| 228 | +#ifndef PKTSETFRAGDATA_HI |
---|
144 | 229 | #define PKTSETFRAGDATA_HI(osh, lb, ix, addr) BCM_REFERENCE(osh) |
---|
| 230 | +#endif // endif |
---|
145 | 231 | |
---|
146 | 232 | /* RX FRAG */ |
---|
| 233 | +#ifndef PKTISRXFRAG |
---|
147 | 234 | #define PKTISRXFRAG(osh, lb) (0) |
---|
| 235 | +#endif // endif |
---|
| 236 | +#ifndef PKTSETRXFRAG |
---|
148 | 237 | #define PKTSETRXFRAG(osh, lb) BCM_REFERENCE(osh) |
---|
| 238 | +#endif // endif |
---|
| 239 | +#ifndef PKTRESETRXFRAG |
---|
149 | 240 | #define PKTRESETRXFRAG(osh, lb) BCM_REFERENCE(osh) |
---|
| 241 | +#endif // endif |
---|
150 | 242 | |
---|
151 | 243 | /* TX FRAG */ |
---|
| 244 | +#ifndef PKTISTXFRAG |
---|
152 | 245 | #define PKTISTXFRAG(osh, lb) (0) |
---|
| 246 | +#endif // endif |
---|
| 247 | +#ifndef PKTSETTXFRAG |
---|
153 | 248 | #define PKTSETTXFRAG(osh, lb) BCM_REFERENCE(osh) |
---|
| 249 | +#endif // endif |
---|
154 | 250 | |
---|
155 | 251 | /* Need Rx completion used for AMPDU reordering */ |
---|
| 252 | +#ifndef PKTNEEDRXCPL |
---|
156 | 253 | #define PKTNEEDRXCPL(osh, lb) (TRUE) |
---|
| 254 | +#endif // endif |
---|
| 255 | +#ifndef PKTSETNORXCPL |
---|
157 | 256 | #define PKTSETNORXCPL(osh, lb) BCM_REFERENCE(osh) |
---|
| 257 | +#endif // endif |
---|
| 258 | +#ifndef PKTRESETNORXCPL |
---|
158 | 259 | #define PKTRESETNORXCPL(osh, lb) BCM_REFERENCE(osh) |
---|
159 | | - |
---|
| 260 | +#endif // endif |
---|
| 261 | +#ifndef PKTISFRAG |
---|
160 | 262 | #define PKTISFRAG(osh, lb) (0) |
---|
| 263 | +#endif // endif |
---|
| 264 | +#ifndef PKTFRAGISCHAINED |
---|
161 | 265 | #define PKTFRAGISCHAINED(osh, i) (0) |
---|
| 266 | +#endif // endif |
---|
162 | 267 | /* TRIM Tail bytes from lfrag */ |
---|
| 268 | +#ifndef PKTFRAG_TRIM_TAILBYTES |
---|
163 | 269 | #define PKTFRAG_TRIM_TAILBYTES(osh, p, len, type) PKTSETLEN(osh, p, PKTLEN(osh, p) - len) |
---|
| 270 | +#endif // endif |
---|
| 271 | +#ifndef PKTISHDRCONVTD |
---|
| 272 | +#define PKTISHDRCONVTD(osh, lb) (0) |
---|
| 273 | +#endif // endif |
---|
| 274 | + |
---|
| 275 | +/* Forwarded pkt indication */ |
---|
| 276 | +#ifndef PKTISFRWDPKT |
---|
| 277 | +#define PKTISFRWDPKT(osh, lb) 0 |
---|
| 278 | +#endif // endif |
---|
| 279 | +#ifndef PKTSETFRWDPKT |
---|
| 280 | +#define PKTSETFRWDPKT(osh, lb) BCM_REFERENCE(osh) |
---|
| 281 | +#endif // endif |
---|
| 282 | +#ifndef PKTRESETFRWDPKT |
---|
| 283 | +#define PKTRESETFRWDPKT(osh, lb) BCM_REFERENCE(osh) |
---|
| 284 | +#endif // endif |
---|
| 285 | + |
---|
| 286 | +/* SFD Frame */ |
---|
| 287 | +#ifndef PKTISSFDFRAME |
---|
| 288 | +#define PKTISSFDFRAME(osh, lb) (0) |
---|
| 289 | +#endif // endif |
---|
| 290 | +#ifndef PKTSETSFDFRAME |
---|
| 291 | +#define PKTSETSFDFRAME(osh, lb) BCM_REFERENCE(osh) |
---|
| 292 | +#endif // endif |
---|
| 293 | +#ifndef PKTRESETSFDFRAME |
---|
| 294 | +#define PKTRESETSFDFRAME(osh, lb) BCM_REFERENCE(osh) |
---|
| 295 | +#endif // endif |
---|
| 296 | +#ifndef PKTISSFDTXC |
---|
| 297 | +#define PKTISSFDTXC(osh, lb) (0) |
---|
| 298 | +#endif // endif |
---|
| 299 | +#ifndef PKTSETSFDTXC |
---|
| 300 | +#define PKTSETSFDTXC(osh, lb) BCM_REFERENCE(osh) |
---|
| 301 | +#endif // endif |
---|
| 302 | +#ifndef PKTRESETSFDTXC |
---|
| 303 | +#define PKTRESETSFDTXC(osh, lb) BCM_REFERENCE(osh) |
---|
| 304 | +#endif // endif |
---|
164 | 305 | |
---|
165 | 306 | #ifdef BCM_SECURE_DMA |
---|
166 | 307 | #define SECURE_DMA_ENAB(osh) (1) |
---|
167 | 308 | #else |
---|
168 | 309 | |
---|
169 | 310 | #define SECURE_DMA_ENAB(osh) (0) |
---|
170 | | -#define SECURE_DMA_MAP(osh, va, size, direction, p, dmah, pcma, offset) ((dmaaddr_t) {(0)}) |
---|
| 311 | +#ifndef BCMDMA64OSL |
---|
| 312 | +#define SECURE_DMA_MAP(osh, va, size, direction, p, dmah, pcma, offset) ((dmaaddr_t) ((0))) |
---|
| 313 | +#else |
---|
| 314 | +#define SECURE_DMA_MAP(osh, va, size, direction, p, dmah, pcma, offset) \ |
---|
| 315 | + ((dmaaddr_t) {.hiaddr = 0, .loaddr = 0}) |
---|
| 316 | +#endif // endif |
---|
171 | 317 | #define SECURE_DMA_DD_MAP(osh, va, size, direction, p, dmah) 0 |
---|
172 | | -#define SECURE_DMA_MAP_TXMETA(osh, va, size, direction, p, dmah, pcma) ((dmaaddr_t) {(0)}) |
---|
| 318 | +#ifndef BCMDMA64OSL |
---|
| 319 | +#define SECURE_DMA_MAP_TXMETA(osh, va, size, direction, p, dmah, pcma) ((dmaaddr_t) ((0))) |
---|
| 320 | +#else |
---|
| 321 | +#define SECURE_DMA_MAP_TXMETA(osh, va, size, direction, p, dmah, pcma) \ |
---|
| 322 | + ((dmaaddr_t) {.hiaddr = 0, .loaddr = 0}) |
---|
| 323 | +#endif // endif |
---|
173 | 324 | #define SECURE_DMA_UNMAP(osh, pa, size, direction, p, dmah, pcma, offset) |
---|
174 | 325 | #define SECURE_DMA_UNMAP_ALL(osh, pcma) |
---|
175 | 326 | |
---|
176 | | -#endif |
---|
| 327 | +#endif /* BCMDMA64OSL */ |
---|
177 | 328 | |
---|
| 329 | +#ifndef ROMMABLE_ASSERT |
---|
| 330 | +#define ROMMABLE_ASSERT(exp) ASSERT(exp) |
---|
| 331 | +#endif /* ROMMABLE_ASSERT */ |
---|
| 332 | + |
---|
| 333 | +#ifndef MALLOC_NOPERSIST |
---|
| 334 | + #define MALLOC_NOPERSIST MALLOC |
---|
| 335 | +#endif /* !MALLOC_NOPERSIST */ |
---|
| 336 | + |
---|
| 337 | +#ifndef MALLOC_PERSIST |
---|
| 338 | + #define MALLOC_PERSIST MALLOC |
---|
| 339 | +#endif /* !MALLOC_PERSIST */ |
---|
| 340 | + |
---|
| 341 | +#ifndef MALLOC_NOPERSIST |
---|
| 342 | + #define MALLOC_NOPERSIST MALLOC |
---|
| 343 | +#endif /* !MALLOC_NOPERSIST */ |
---|
| 344 | + |
---|
| 345 | +#ifndef MALLOC_PERSIST_ATTACH |
---|
| 346 | + #define MALLOC_PERSIST_ATTACH MALLOC |
---|
| 347 | +#endif /* !MALLOC_PERSIST_ATTACH */ |
---|
| 348 | + |
---|
| 349 | +#ifndef MALLOCZ_PERSIST_ATTACH |
---|
| 350 | + #define MALLOCZ_PERSIST_ATTACH MALLOCZ |
---|
| 351 | +#endif /* !MALLOCZ_PERSIST_ATTACH */ |
---|
| 352 | + |
---|
| 353 | +#ifndef MALLOCZ_NOPERSIST |
---|
| 354 | + #define MALLOCZ_NOPERSIST MALLOCZ |
---|
| 355 | +#endif /* !MALLOCZ_NOPERSIST */ |
---|
| 356 | + |
---|
| 357 | +#ifndef MALLOCZ_PERSIST |
---|
| 358 | + #define MALLOCZ_PERSIST MALLOCZ |
---|
| 359 | +#endif /* !MALLOCZ_PERSIST */ |
---|
| 360 | + |
---|
| 361 | +#ifndef MFREE_PERSIST |
---|
| 362 | + #define MFREE_PERSIST MFREE |
---|
| 363 | +#endif /* !MFREE_PERSIST */ |
---|
| 364 | + |
---|
| 365 | +#ifndef MALLOC_SET_NOPERSIST |
---|
| 366 | + #define MALLOC_SET_NOPERSIST(osh) do { } while (0) |
---|
| 367 | +#endif /* !MALLOC_SET_NOPERSIST */ |
---|
| 368 | + |
---|
| 369 | +#ifndef MALLOC_CLEAR_NOPERSIST |
---|
| 370 | + #define MALLOC_CLEAR_NOPERSIST(osh) do { } while (0) |
---|
| 371 | +#endif /* !MALLOC_CLEAR_NOPERSIST */ |
---|
| 372 | + |
---|
| 373 | +#if defined(OSL_MEMCHECK) |
---|
| 374 | +#define MEMCHECK(f, l) osl_memcheck(f, l) |
---|
| 375 | +#else |
---|
| 376 | +#define MEMCHECK(f, l) |
---|
| 377 | +#endif /* OSL_MEMCHECK */ |
---|
178 | 378 | |
---|
179 | 379 | #endif /* _osl_h_ */ |
---|