.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * Misc system wide definitions |
---|
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: bcmdefs.h 715966 2019-05-30 02:36:59Z $ |
---|
| 29 | + * $Id: bcmdefs.h 700870 2017-05-22 19:05:22Z $ |
---|
29 | 30 | */ |
---|
30 | 31 | |
---|
31 | 32 | #ifndef _bcmdefs_h_ |
---|
.. | .. |
---|
40 | 41 | * arguments or local variables. |
---|
41 | 42 | */ |
---|
42 | 43 | #define BCM_REFERENCE(data) ((void)(data)) |
---|
43 | | - |
---|
| 44 | +#include <linux/compiler.h> |
---|
44 | 45 | /* Allow for suppressing unused variable warnings. */ |
---|
45 | 46 | #ifdef __GNUC__ |
---|
46 | 47 | #define UNUSED_VAR __attribute__ ((unused)) |
---|
47 | 48 | #else |
---|
48 | 49 | #define UNUSED_VAR |
---|
49 | | -#endif |
---|
| 50 | +#endif // endif |
---|
50 | 51 | |
---|
| 52 | +/* GNU GCC 4.6+ supports selectively turning off a warning. |
---|
| 53 | + * Define these diagnostic macros to help suppress cast-qual warning |
---|
| 54 | + * until all the work can be done to fix the casting issues. |
---|
| 55 | + */ |
---|
| 56 | +#if (defined(__GNUC__) && defined(STRICT_GCC_WARNINGS) && (__GNUC__ > 4 || (__GNUC__ == \ |
---|
| 57 | + 4 && __GNUC_MINOR__ >= 6))) |
---|
| 58 | +#define GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST() \ |
---|
| 59 | + _Pragma("GCC diagnostic push") \ |
---|
| 60 | + _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") |
---|
| 61 | +#define GCC_DIAGNOSTIC_POP() \ |
---|
| 62 | + _Pragma("GCC diagnostic pop") |
---|
| 63 | +#else |
---|
| 64 | +#define GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST() |
---|
| 65 | +#define GCC_DIAGNOSTIC_POP() |
---|
| 66 | +#endif /* Diagnostic macros not defined */ |
---|
| 67 | + |
---|
| 68 | +/* Support clang for MACOSX compiler */ |
---|
| 69 | +#ifdef __clang__ |
---|
| 70 | +#define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_CAST() \ |
---|
| 71 | + _Pragma("clang diagnostic push") \ |
---|
| 72 | + _Pragma("clang diagnostic ignored \"-Wcast-qual\"") |
---|
| 73 | +#define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_FORMAT() \ |
---|
| 74 | + _Pragma("clang diagnostic push") \ |
---|
| 75 | + _Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"") |
---|
| 76 | +#define CLANG_DIAGNOSTIC_POP() \ |
---|
| 77 | + _Pragma("clang diagnostic pop") |
---|
| 78 | +#else |
---|
| 79 | +#define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_CAST() |
---|
| 80 | +#define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_FORMAT() |
---|
| 81 | +#define CLANG_DIAGNOSTIC_POP() |
---|
| 82 | +#endif // endif |
---|
51 | 83 | /* Compile-time assert can be used in place of ASSERT if the expression evaluates |
---|
52 | 84 | * to a constant at compile time. |
---|
53 | 85 | */ |
---|
| 86 | +#if (__GNUC__ <= 4 && __GNUC_MINOR__ >= 4) |
---|
54 | 87 | #define STATIC_ASSERT(expr) { \ |
---|
55 | 88 | /* Make sure the expression is constant. */ \ |
---|
56 | 89 | typedef enum { _STATIC_ASSERT_NOT_CONSTANT = (expr) } _static_assert_e UNUSED_VAR; \ |
---|
57 | 90 | /* Make sure the expression is true. */ \ |
---|
58 | 91 | typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1] UNUSED_VAR; \ |
---|
59 | 92 | } |
---|
| 93 | +#else |
---|
| 94 | +#define STATIC_ASSERT(expr) compiletime_assert(expr, "Compile time condition failure"); |
---|
| 95 | +#endif /* __GNUC__ <= 4 && __GNUC_MINOR__ >= 4 */ |
---|
60 | 96 | |
---|
61 | 97 | /* Reclaiming text and data : |
---|
62 | 98 | * The following macros specify special linker sections that can be reclaimed |
---|
.. | .. |
---|
64 | 100 | * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN, |
---|
65 | 101 | * as in most cases, the attach function calls the detach function to clean up on error). |
---|
66 | 102 | */ |
---|
| 103 | +#if defined(BCM_RECLAIM) |
---|
67 | 104 | |
---|
68 | | -#define bcmreclaimed 0 |
---|
| 105 | +extern bool bcm_reclaimed; |
---|
| 106 | +extern bool bcm_attach_part_reclaimed; |
---|
| 107 | +extern bool bcm_preattach_part_reclaimed; |
---|
| 108 | +extern bool bcm_postattach_part_reclaimed; |
---|
| 109 | + |
---|
| 110 | +#define RECLAIMED() (bcm_reclaimed) |
---|
| 111 | +#define ATTACH_PART_RECLAIMED() (bcm_attach_part_reclaimed) |
---|
| 112 | +#define PREATTACH_PART_RECLAIMED() (bcm_preattach_part_reclaimed) |
---|
| 113 | +#define POSTATTACH_PART_RECLAIMED() (bcm_postattach_part_reclaimed) |
---|
| 114 | + |
---|
| 115 | +#if defined(BCM_RECLAIM_ATTACH_FN_DATA) |
---|
| 116 | +#define _data __attribute__ ((__section__ (".dataini2." #_data))) _data |
---|
| 117 | +#define _fn __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn |
---|
| 118 | + |
---|
| 119 | +/* Relocate attach symbols to save-restore region to increase pre-reclaim heap size. */ |
---|
| 120 | +#define BCM_SRM_ATTACH_DATA(_data) __attribute__ ((__section__ (".datasrm." #_data))) _data |
---|
| 121 | +#define BCM_SRM_ATTACH_FN(_fn) __attribute__ ((__section__ (".textsrm." #_fn), noinline)) _fn |
---|
| 122 | + |
---|
| 123 | +#ifndef PREATTACH_NORECLAIM |
---|
| 124 | +#define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini3." #_data))) _data |
---|
| 125 | +#define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini3." #_fn), noinline)) _fn |
---|
| 126 | +#else |
---|
| 127 | +#define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini2." #_data))) _data |
---|
| 128 | +#define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn |
---|
| 129 | +#endif /* PREATTACH_NORECLAIM */ |
---|
| 130 | +#define BCMPOSTATTACHDATA(_data) __attribute__ ((__section__ (".dataini5." #_data))) _data |
---|
| 131 | +#define BCMPOSTATTACHFN(_fn) __attribute__ ((__section__ (".textini5." #_fn), noinline)) _fn |
---|
| 132 | +#else /* BCM_RECLAIM_ATTACH_FN_DATA */ |
---|
69 | 133 | #define _data _data |
---|
70 | 134 | #define _fn _fn |
---|
71 | 135 | #define BCMPREATTACHDATA(_data) _data |
---|
72 | 136 | #define BCMPREATTACHFN(_fn) _fn |
---|
| 137 | +#define BCMPOSTATTACHDATA(_data) _data |
---|
| 138 | +#define BCMPOSTATTACHFN(_fn) _fn |
---|
| 139 | +#endif /* BCM_RECLAIM_ATTACH_FN_DATA */ |
---|
| 140 | + |
---|
| 141 | +#ifdef BCMDBG_SR |
---|
| 142 | +/* |
---|
| 143 | + * Don't reclaim so we can compare SR ASM |
---|
| 144 | + */ |
---|
| 145 | +#define BCMPREATTACHDATASR(_data) _data |
---|
| 146 | +#define BCMPREATTACHFNSR(_fn) _fn |
---|
| 147 | +#define BCMATTACHDATASR(_data) _data |
---|
| 148 | +#define BCMATTACHFNSR(_fn) _fn |
---|
| 149 | +#else |
---|
| 150 | +#define BCMPREATTACHDATASR(_data) BCMPREATTACHDATA(_data) |
---|
| 151 | +#define BCMPREATTACHFNSR(_fn) BCMPREATTACHFN(_fn) |
---|
| 152 | +#define BCMATTACHDATASR(_data) _data |
---|
| 153 | +#define BCMATTACHFNSR(_fn) _fn |
---|
| 154 | +#endif // endif |
---|
| 155 | + |
---|
| 156 | +#if defined(BCM_RECLAIM_INIT_FN_DATA) |
---|
| 157 | +#define _data __attribute__ ((__section__ (".dataini1." #_data))) _data |
---|
| 158 | +#define _fn __attribute__ ((__section__ (".textini1." #_fn), noinline)) _fn |
---|
| 159 | +#define CONST |
---|
| 160 | +#else /* BCM_RECLAIM_INIT_FN_DATA */ |
---|
73 | 161 | #define _data _data |
---|
74 | 162 | #define _fn _fn |
---|
75 | | -#define _fn _fn |
---|
| 163 | +#ifndef CONST |
---|
| 164 | +#define CONST const |
---|
| 165 | +#endif // endif |
---|
| 166 | +#endif /* BCM_RECLAIM_INIT_FN_DATA */ |
---|
| 167 | + |
---|
| 168 | +/* Non-manufacture or internal attach function/dat */ |
---|
76 | 169 | #define BCMNMIATTACHFN(_fn) _fn |
---|
77 | 170 | #define BCMNMIATTACHDATA(_data) _data |
---|
78 | | -#define CONST const |
---|
| 171 | + |
---|
| 172 | +#if defined(BCM_CISDUMP_NO_RECLAIM) |
---|
| 173 | +#define BCMCISDUMPATTACHFN(_fn) _fn |
---|
| 174 | +#define BCMCISDUMPATTACHDATA(_data) _data |
---|
| 175 | +#else |
---|
| 176 | +#define BCMCISDUMPATTACHFN(_fn) BCMNMIATTACHFN(_fn) |
---|
| 177 | +#define BCMCISDUMPATTACHDATA(_data) BCMNMIATTACHDATA(_data) |
---|
| 178 | +#endif // endif |
---|
| 179 | + |
---|
| 180 | +/* SROM with OTP support */ |
---|
| 181 | +#if defined(BCMOTPSROM) |
---|
| 182 | +#define BCMSROMATTACHFN(_fn) _fn |
---|
| 183 | +#define BCMSROMATTACHDATA(_data) _data |
---|
| 184 | +#else |
---|
| 185 | +#define BCMSROMATTACHFN(_fn) BCMNMIATTACHFN(_fn) |
---|
| 186 | +#define BCMSROMATTACHDATA(_data) BCMNMIATTACHFN(_data) |
---|
| 187 | +#endif /* BCMOTPSROM */ |
---|
| 188 | + |
---|
| 189 | +#if defined(BCM_CISDUMP_NO_RECLAIM) |
---|
| 190 | +#define BCMSROMCISDUMPATTACHFN(_fn) _fn |
---|
| 191 | +#define BCMSROMCISDUMPATTACHDATA(_data) _data |
---|
| 192 | +#else |
---|
| 193 | +#define BCMSROMCISDUMPATTACHFN(_fn) BCMSROMATTACHFN(_fn) |
---|
| 194 | +#define BCMSROMCISDUMPATTACHDATA(_data) BCMSROMATTACHDATA(_data) |
---|
| 195 | +#endif /* BCM_CISDUMP_NO_RECLAIM */ |
---|
| 196 | + |
---|
| 197 | +#ifdef BCMNODOWN |
---|
| 198 | +#define _fn _fn |
---|
| 199 | +#else |
---|
| 200 | +#define _fn _fn |
---|
| 201 | +#endif // endif |
---|
| 202 | + |
---|
| 203 | +#else /* BCM_RECLAIM */ |
---|
| 204 | + |
---|
| 205 | +#define bcm_reclaimed (1) |
---|
| 206 | +#define bcm_attach_part_reclaimed (1) |
---|
| 207 | +#define bcm_preattach_part_reclaimed (1) |
---|
| 208 | +#define bcm_postattach_part_reclaimed (1) |
---|
| 209 | +#define _data _data |
---|
| 210 | +#define _fn _fn |
---|
| 211 | +#define BCM_SRM_ATTACH_DATA(_data) _data |
---|
| 212 | +#define BCM_SRM_ATTACH_FN(_fn) _fn |
---|
| 213 | +#define BCMPREATTACHDATA(_data) _data |
---|
| 214 | +#define BCMPREATTACHFN(_fn) _fn |
---|
| 215 | +#define BCMPOSTATTACHDATA(_data) _data |
---|
| 216 | +#define BCMPOSTATTACHFN(_fn) _fn |
---|
| 217 | +#define _data _data |
---|
| 218 | +#define _fn _fn |
---|
| 219 | +#define _fn _fn |
---|
| 220 | +#define BCMNMIATTACHFN(_fn) _fn |
---|
| 221 | +#define BCMNMIATTACHDATA(_data) _data |
---|
| 222 | +#define BCMSROMATTACHFN(_fn) _fn |
---|
| 223 | +#define BCMSROMATTACHDATA(_data) _data |
---|
| 224 | +#define BCMPREATTACHFNSR(_fn) _fn |
---|
| 225 | +#define BCMPREATTACHDATASR(_data) _data |
---|
| 226 | +#define BCMATTACHFNSR(_fn) _fn |
---|
| 227 | +#define BCMATTACHDATASR(_data) _data |
---|
| 228 | +#define BCMSROMATTACHFN(_fn) _fn |
---|
| 229 | +#define BCMSROMATTACHDATA(_data) _data |
---|
| 230 | +#define BCMCISDUMPATTACHFN(_fn) _fn |
---|
| 231 | +#define BCMCISDUMPATTACHDATA(_data) _data |
---|
| 232 | +#define BCMSROMCISDUMPATTACHFN(_fn) _fn |
---|
| 233 | +#define BCMSROMCISDUMPATTACHDATA(_data) _data |
---|
| 234 | +#define CONST const |
---|
| 235 | + |
---|
| 236 | +#define RECLAIMED() (bcm_reclaimed) |
---|
| 237 | +#define ATTACH_PART_RECLAIMED() (bcm_attach_part_reclaimed) |
---|
| 238 | +#define PREATTACH_PART_RECLAIMED() (bcm_preattach_part_reclaimed) |
---|
| 239 | +#define POSTATTACH_PART_RECLAIMED() (bcm_postattach_part_reclaimed) |
---|
| 240 | + |
---|
| 241 | +#endif /* BCM_RECLAIM */ |
---|
| 242 | + |
---|
| 243 | +#define BCMUCODEDATA(_data) _data |
---|
| 244 | + |
---|
| 245 | +#if defined(BCM_DMA_CT) && !defined(BCM_DMA_CT_DISABLED) |
---|
| 246 | +#define BCMUCODEFN(_fn) _fn |
---|
| 247 | +#else |
---|
| 248 | +#define BCMUCODEFN(_fn) _fn |
---|
| 249 | +#endif /* BCM_DMA_CT */ |
---|
79 | 250 | |
---|
80 | 251 | #if !defined STB |
---|
| 252 | +#if defined(BCM47XX) && defined(__ARM_ARCH_7A__) && !defined(OEM_ANDROID) |
---|
| 253 | +#define BCM47XX_CA9 |
---|
| 254 | +#else |
---|
81 | 255 | #undef BCM47XX_CA9 |
---|
| 256 | +#endif /* BCM47XX && __ARM_ARCH_7A__ && !OEM_ANDROID */ |
---|
82 | 257 | #endif /* STB */ |
---|
83 | 258 | |
---|
| 259 | +/* BCMFASTPATH Related Macro defines |
---|
| 260 | +*/ |
---|
84 | 261 | #ifndef BCMFASTPATH |
---|
85 | 262 | #if defined(STB) |
---|
86 | 263 | #define BCMFASTPATH __attribute__ ((__section__ (".text.fastpath"))) |
---|
87 | 264 | #define BCMFASTPATH_HOST __attribute__ ((__section__ (".text.fastpath_host"))) |
---|
88 | | -#else |
---|
| 265 | +#else /* mips || BCM47XX_CA9 || STB */ |
---|
89 | 266 | #define BCMFASTPATH |
---|
90 | 267 | #define BCMFASTPATH_HOST |
---|
91 | | -#endif |
---|
| 268 | +#endif // endif |
---|
92 | 269 | #endif /* BCMFASTPATH */ |
---|
93 | | - |
---|
94 | 270 | |
---|
95 | 271 | /* Use the BCMRAMFN() macro to tag functions in source that must be included in RAM (excluded from |
---|
96 | 272 | * ROM). This should eliminate the need to manually specify these functions in the ROM config file. |
---|
.. | .. |
---|
98 | 274 | * chips. |
---|
99 | 275 | */ |
---|
100 | 276 | #define BCMRAMFN(_fn) _fn |
---|
| 277 | + |
---|
| 278 | +/* Use BCMSPECSYM() macro to tag symbols going to a special output section in the binary. */ |
---|
| 279 | +#define BCMSPECSYM(_sym) __attribute__ ((__section__ (".special." #_sym))) _sym |
---|
101 | 280 | |
---|
102 | 281 | #define STATIC static |
---|
103 | 282 | |
---|
.. | .. |
---|
113 | 292 | |
---|
114 | 293 | /* Allows size optimization for single-bus image */ |
---|
115 | 294 | #ifdef BCMBUSTYPE |
---|
116 | | -#define BUSTYPE(bus) (BCMBUSTYPE) |
---|
| 295 | +#define BUSTYPE(bus) (BCMBUSTYPE) |
---|
117 | 296 | #else |
---|
118 | | -#define BUSTYPE(bus) (bus) |
---|
119 | | -#endif |
---|
| 297 | +#define BUSTYPE(bus) (bus) |
---|
| 298 | +#endif // endif |
---|
| 299 | + |
---|
| 300 | +#ifdef BCMBUSCORETYPE |
---|
| 301 | +#define BUSCORETYPE(ct) (BCMBUSCORETYPE) |
---|
| 302 | +#else |
---|
| 303 | +#define BUSCORETYPE(ct) (ct) |
---|
| 304 | +#endif // endif |
---|
120 | 305 | |
---|
121 | 306 | /* Allows size optimization for single-backplane image */ |
---|
122 | 307 | #ifdef BCMCHIPTYPE |
---|
123 | | -#define CHIPTYPE(bus) (BCMCHIPTYPE) |
---|
| 308 | +#define CHIPTYPE(bus) (BCMCHIPTYPE) |
---|
124 | 309 | #else |
---|
125 | | -#define CHIPTYPE(bus) (bus) |
---|
126 | | -#endif |
---|
127 | | - |
---|
| 310 | +#define CHIPTYPE(bus) (bus) |
---|
| 311 | +#endif // endif |
---|
128 | 312 | |
---|
129 | 313 | /* Allows size optimization for SPROM support */ |
---|
130 | 314 | #if defined(BCMSPROMBUS) |
---|
.. | .. |
---|
133 | 317 | #define SPROMBUS (PCMCIA_BUS) |
---|
134 | 318 | #else |
---|
135 | 319 | #define SPROMBUS (PCI_BUS) |
---|
136 | | -#endif |
---|
| 320 | +#endif // endif |
---|
137 | 321 | |
---|
138 | 322 | /* Allows size optimization for single-chip image */ |
---|
139 | 323 | #ifdef BCMCHIPID |
---|
140 | 324 | #define CHIPID(chip) (BCMCHIPID) |
---|
141 | 325 | #else |
---|
142 | 326 | #define CHIPID(chip) (chip) |
---|
143 | | -#endif |
---|
| 327 | +#endif // endif |
---|
144 | 328 | |
---|
145 | 329 | #ifdef BCMCHIPREV |
---|
146 | 330 | #define CHIPREV(rev) (BCMCHIPREV) |
---|
147 | 331 | #else |
---|
148 | 332 | #define CHIPREV(rev) (rev) |
---|
149 | | -#endif |
---|
| 333 | +#endif // endif |
---|
150 | 334 | |
---|
151 | 335 | #ifdef BCMPCIEREV |
---|
152 | 336 | #define PCIECOREREV(rev) (BCMPCIEREV) |
---|
153 | 337 | #else |
---|
154 | 338 | #define PCIECOREREV(rev) (rev) |
---|
155 | | -#endif |
---|
| 339 | +#endif // endif |
---|
| 340 | + |
---|
| 341 | +#ifdef BCMPMUREV |
---|
| 342 | +#define PMUREV(rev) (BCMPMUREV) |
---|
| 343 | +#else |
---|
| 344 | +#define PMUREV(rev) (rev) |
---|
| 345 | +#endif // endif |
---|
| 346 | + |
---|
| 347 | +#ifdef BCMCCREV |
---|
| 348 | +#define CCREV(rev) (BCMCCREV) |
---|
| 349 | +#else |
---|
| 350 | +#define CCREV(rev) (rev) |
---|
| 351 | +#endif // endif |
---|
| 352 | + |
---|
| 353 | +#ifdef BCMGCIREV |
---|
| 354 | +#define GCIREV(rev) (BCMGCIREV) |
---|
| 355 | +#else |
---|
| 356 | +#define GCIREV(rev) (rev) |
---|
| 357 | +#endif // endif |
---|
| 358 | + |
---|
| 359 | +#ifdef BCMCR4REV |
---|
| 360 | +#define CR4REV (BCMCR4REV) |
---|
| 361 | +#endif // endif |
---|
156 | 362 | |
---|
157 | 363 | /* Defines for DMA Address Width - Shared between OSL and HNDDMA */ |
---|
158 | 364 | #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */ |
---|
.. | .. |
---|
188 | 394 | #define PHYSADDRHISET(_pa, _val) PHYSADDR64HISET(_pa, _val) |
---|
189 | 395 | #define PHYSADDRLO(_pa) PHYSADDR64LO(_pa) |
---|
190 | 396 | #define PHYSADDRLOSET(_pa, _val) PHYSADDR64LOSET(_pa, _val) |
---|
| 397 | +#define PHYSADDRTOULONG(_pa, _ulong) \ |
---|
| 398 | + do { \ |
---|
| 399 | + _ulong = ((unsigned long long)(_pa).hiaddr << 32) | ((_pa).loaddr); \ |
---|
| 400 | + } while (0) |
---|
191 | 401 | |
---|
192 | 402 | #else |
---|
193 | 403 | typedef unsigned long dmaaddr_t; |
---|
.. | .. |
---|
209 | 419 | |
---|
210 | 420 | #define MAX_DMA_SEGS 8 |
---|
211 | 421 | |
---|
212 | | - |
---|
213 | 422 | typedef struct { |
---|
214 | 423 | void *oshdmah; /* Opaque handle for OSL to store its information */ |
---|
215 | 424 | uint origsize; /* Size of the virtual packet */ |
---|
216 | 425 | uint nsegs; |
---|
217 | 426 | hnddma_seg_t segs[MAX_DMA_SEGS]; |
---|
218 | 427 | } hnddma_seg_map_t; |
---|
219 | | - |
---|
220 | 428 | |
---|
221 | 429 | /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF). |
---|
222 | 430 | * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL. |
---|
.. | .. |
---|
229 | 437 | #define BCMEXTRAHDROOM 260 |
---|
230 | 438 | #else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ |
---|
231 | 439 | #if defined(STB) |
---|
232 | | -#if defined(BCM_GMAC3) |
---|
233 | | -#define BCMEXTRAHDROOM 32 /* For FullDongle, no D11 headroom space required. */ |
---|
234 | | -#else |
---|
235 | 440 | #define BCMEXTRAHDROOM 224 |
---|
236 | | -#endif /* ! BCM_GMAC3 */ |
---|
237 | 441 | #else |
---|
238 | 442 | #define BCMEXTRAHDROOM 204 |
---|
239 | | -#endif |
---|
| 443 | +#endif // endif |
---|
240 | 444 | #endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ |
---|
241 | 445 | |
---|
242 | 446 | /* Packet alignment for most efficient SDIO (can change based on platform) */ |
---|
243 | 447 | #ifndef SDALIGN |
---|
244 | 448 | #define SDALIGN 32 |
---|
245 | | -#endif |
---|
| 449 | +#endif // endif |
---|
246 | 450 | |
---|
247 | 451 | /* Headroom required for dongle-to-host communication. Packets allocated |
---|
248 | 452 | * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should |
---|
.. | .. |
---|
256 | 460 | |
---|
257 | 461 | #define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ) |
---|
258 | 462 | |
---|
259 | | - |
---|
260 | 463 | #if defined(NO_BCMDBG_ASSERT) |
---|
261 | 464 | # undef BCMDBG_ASSERT |
---|
262 | 465 | # undef BCMASSERT_LOG |
---|
263 | | -#endif |
---|
| 466 | +#endif // endif |
---|
264 | 467 | |
---|
265 | 468 | #if defined(BCMASSERT_LOG) |
---|
266 | 469 | #define BCMASSERT_SUPPORT |
---|
267 | | -#endif |
---|
| 470 | +#endif // endif |
---|
268 | 471 | |
---|
269 | 472 | /* Macros for doing definition and get/set of bitfields |
---|
270 | 473 | * Usage example, e.g. a three-bit field (bits 4-6): |
---|
.. | .. |
---|
291 | 494 | #else |
---|
292 | 495 | #define BCMSPACE |
---|
293 | 496 | #define bcmspace TRUE /* if (bcmspace) code is retained */ |
---|
294 | | -#endif |
---|
| 497 | +#endif // endif |
---|
295 | 498 | |
---|
296 | 499 | /* Max. nvram variable table size */ |
---|
297 | 500 | #ifndef MAXSZ_NVRAM_VARS |
---|
298 | 501 | #ifdef LARGE_NVRAM_MAXSZ |
---|
299 | | -#define MAXSZ_NVRAM_VARS LARGE_NVRAM_MAXSZ |
---|
| 502 | +#define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) |
---|
300 | 503 | #else |
---|
301 | | -/* SROM12 changes */ |
---|
302 | | -#define MAXSZ_NVRAM_VARS 6144 |
---|
| 504 | +#define LARGE_NVRAM_MAXSZ 8192 |
---|
| 505 | +#define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) |
---|
303 | 506 | #endif /* LARGE_NVRAM_MAXSZ */ |
---|
304 | 507 | #endif /* !MAXSZ_NVRAM_VARS */ |
---|
305 | 508 | |
---|
306 | | - |
---|
307 | | - |
---|
308 | | -/* WL_ENAB_RUNTIME_CHECK may be set based upon the #define below (for ROM builds). It may also |
---|
| 509 | +/* ROM_ENAB_RUNTIME_CHECK may be set based upon the #define below (for ROM builds). It may also |
---|
309 | 510 | * be defined via makefiles (e.g. ROM auto abandon unoptimized compiles). |
---|
310 | 511 | */ |
---|
311 | 512 | |
---|
312 | | - |
---|
313 | 513 | #ifdef BCMLFRAG /* BCMLFRAG support enab macros */ |
---|
314 | 514 | extern bool _bcmlfrag; |
---|
315 | | - #if defined(WL_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
| 515 | + #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
316 | 516 | #define BCMLFRAG_ENAB() (_bcmlfrag) |
---|
317 | 517 | #elif defined(BCMLFRAG_DISABLED) |
---|
318 | 518 | #define BCMLFRAG_ENAB() (0) |
---|
.. | .. |
---|
322 | 522 | #else |
---|
323 | 523 | #define BCMLFRAG_ENAB() (0) |
---|
324 | 524 | #endif /* BCMLFRAG_ENAB */ |
---|
325 | | -#define RXMODE1 1 /* descriptor split */ |
---|
326 | | -#define RXMODE2 2 /* descriptor split + classification */ |
---|
327 | | -#define RXMODE3 3 /* fifo split + classification */ |
---|
328 | | -#define RXMODE4 4 /* fifo split + classification + hdr conversion */ |
---|
329 | | - |
---|
330 | | -#ifdef BCMSPLITRX /* BCMLFRAG support enab macros */ |
---|
331 | | - extern bool _bcmsplitrx; |
---|
332 | | - extern uint8 _bcmsplitrx_mode; |
---|
333 | | - #if defined(WL_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
334 | | - #define BCMSPLITRX_ENAB() (_bcmsplitrx) |
---|
335 | | - #define BCMSPLITRX_MODE() (_bcmsplitrx_mode) |
---|
336 | | - #elif defined(BCMSPLITRX_DISABLED) |
---|
337 | | - #define BCMSPLITRX_ENAB() (0) |
---|
338 | | - #define BCMSPLITRX_MODE() (0) |
---|
339 | | - #else |
---|
340 | | - #define BCMSPLITRX_ENAB() (1) |
---|
341 | | - #define BCMSPLITRX_MODE() (_bcmsplitrx_mode) |
---|
342 | | - #endif |
---|
343 | | -#else |
---|
344 | | - #define BCMSPLITRX_ENAB() (0) |
---|
345 | | - #define BCMSPLITRX_MODE() (0) |
---|
346 | | -#endif /* BCMSPLITRX */ |
---|
347 | 525 | |
---|
348 | 526 | #ifdef BCMPCIEDEV /* BCMPCIEDEV support enab macros */ |
---|
349 | 527 | extern bool _pciedevenab; |
---|
350 | | - #if defined(WL_ENAB_RUNTIME_CHECK) |
---|
| 528 | + #if defined(ROM_ENAB_RUNTIME_CHECK) |
---|
351 | 529 | #define BCMPCIEDEV_ENAB() (_pciedevenab) |
---|
352 | 530 | #elif defined(BCMPCIEDEV_ENABLED) |
---|
353 | 531 | #define BCMPCIEDEV_ENAB() 1 |
---|
.. | .. |
---|
358 | 536 | #define BCMPCIEDEV_ENAB() 0 |
---|
359 | 537 | #endif /* BCMPCIEDEV */ |
---|
360 | 538 | |
---|
361 | | -#define SPLIT_RXMODE1() ((BCMSPLITRX_MODE() == RXMODE1)) |
---|
362 | | -#define SPLIT_RXMODE2() ((BCMSPLITRX_MODE() == RXMODE2)) |
---|
363 | | -#define SPLIT_RXMODE3() ((BCMSPLITRX_MODE() == RXMODE3)) |
---|
364 | | -#define SPLIT_RXMODE4() ((BCMSPLITRX_MODE() == RXMODE4)) |
---|
365 | | - |
---|
366 | | -#define PKT_CLASSIFY() (SPLIT_RXMODE2() || SPLIT_RXMODE3() || SPLIT_RXMODE4()) |
---|
367 | | -#define RXFIFO_SPLIT() (SPLIT_RXMODE3() || SPLIT_RXMODE4()) |
---|
368 | | -#define HDR_CONV() (SPLIT_RXMODE4()) |
---|
369 | | - |
---|
370 | | -#define PKT_CLASSIFY_EN(x) ((PKT_CLASSIFY()) && (PKT_CLASSIFY_FIFO == (x))) |
---|
371 | | -#ifdef BCM_SPLITBUF |
---|
372 | | - extern bool _bcmsplitbuf; |
---|
373 | | - #if defined(WL_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
374 | | - #define BCM_SPLITBUF_ENAB() (_bcmsplitbuf) |
---|
375 | | - #elif defined(BCM_SPLITBUF_DISABLED) |
---|
376 | | - #define BCM_SPLITBUF_ENAB() (0) |
---|
| 539 | +#ifdef BCMRESVFRAGPOOL /* BCMRESVFRAGPOOL support enab macros */ |
---|
| 540 | +extern bool _resvfragpool_enab; |
---|
| 541 | + #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
| 542 | + #define BCMRESVFRAGPOOL_ENAB() (_resvfragpool_enab) |
---|
| 543 | + #elif defined(BCMRESVFRAGPOOL_ENABLED) |
---|
| 544 | + #define BCMRESVFRAGPOOL_ENAB() 1 |
---|
377 | 545 | #else |
---|
378 | | - #define BCM_SPLITBUF_ENAB() (1) |
---|
| 546 | + #define BCMRESVFRAGPOOL_ENAB() 0 |
---|
379 | 547 | #endif |
---|
380 | 548 | #else |
---|
381 | | - #define BCM_SPLITBUF_ENAB() (0) |
---|
382 | | -#endif /* BCM_SPLITBUF */ |
---|
| 549 | + #define BCMRESVFRAGPOOL_ENAB() 0 |
---|
| 550 | +#endif /* BCMPCIEDEV */ |
---|
| 551 | + |
---|
| 552 | + #define BCMSDIODEV_ENAB() 0 |
---|
383 | 553 | |
---|
384 | 554 | /* Max size for reclaimable NVRAM array */ |
---|
385 | 555 | #ifdef DL_NVRAM |
---|
.. | .. |
---|
389 | 559 | #endif /* DL_NVRAM */ |
---|
390 | 560 | |
---|
391 | 561 | extern uint32 gFWID; |
---|
392 | | -#define SEC_ENHANCEMENT |
---|
| 562 | + |
---|
| 563 | +#ifdef BCMFRWDPOOLREORG /* BCMFRWDPOOLREORG support enab macros */ |
---|
| 564 | + extern bool _bcmfrwdpoolreorg; |
---|
| 565 | + #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
| 566 | + #define BCMFRWDPOOLREORG_ENAB() (_bcmfrwdpoolreorg) |
---|
| 567 | + #elif defined(BCMFRWDPOOLREORG_DISABLED) |
---|
| 568 | + #define BCMFRWDPOOLREORG_ENAB() (0) |
---|
| 569 | + #else |
---|
| 570 | + #define BCMFRWDPOOLREORG_ENAB() (1) |
---|
| 571 | + #endif |
---|
| 572 | +#else |
---|
| 573 | + #define BCMFRWDPOOLREORG_ENAB() (0) |
---|
| 574 | +#endif /* BCMFRWDPOOLREORG */ |
---|
| 575 | + |
---|
| 576 | +#ifdef BCMPOOLRECLAIM /* BCMPOOLRECLAIM support enab macros */ |
---|
| 577 | + extern bool _bcmpoolreclaim; |
---|
| 578 | + #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) |
---|
| 579 | + #define BCMPOOLRECLAIM_ENAB() (_bcmpoolreclaim) |
---|
| 580 | + #elif defined(BCMPOOLRECLAIM_DISABLED) |
---|
| 581 | + #define BCMPOOLRECLAIM_ENAB() (0) |
---|
| 582 | + #else |
---|
| 583 | + #define BCMPOOLRECLAIM_ENAB() (1) |
---|
| 584 | + #endif |
---|
| 585 | +#else |
---|
| 586 | + #define BCMPOOLRECLAIM_ENAB() (0) |
---|
| 587 | +#endif /* BCMPOOLRECLAIM */ |
---|
| 588 | + |
---|
| 589 | +/* Chip related low power flags (lpflags) */ |
---|
| 590 | + |
---|
| 591 | +#ifndef PAD |
---|
| 592 | +#define _PADLINE(line) pad ## line |
---|
| 593 | +#define _XSTR(line) _PADLINE(line) |
---|
| 594 | +#define PAD _XSTR(__LINE__) |
---|
| 595 | +#endif // endif |
---|
| 596 | + |
---|
| 597 | +#ifndef FRAG_HEADROOM |
---|
| 598 | +#define FRAG_HEADROOM 224 /* In absence of SFD, use default headroom of 224 */ |
---|
| 599 | +#endif // endif |
---|
| 600 | + |
---|
| 601 | +#define MODULE_DETACH(var, detach_func)\ |
---|
| 602 | + if (var) { \ |
---|
| 603 | + detach_func(var); \ |
---|
| 604 | + (var) = NULL; \ |
---|
| 605 | + } |
---|
| 606 | +#define MODULE_DETACH_2(var1, var2, detach_func) detach_func(var1, var2) |
---|
| 607 | +#define MODULE_DETACH_TYPECASTED(var, detach_func) detach_func(var) |
---|
| 608 | + |
---|
| 609 | +/* When building ROML image use runtime conditional to cause the compiler |
---|
| 610 | + * to compile everything but not to complain "defined but not used" |
---|
| 611 | + * as #ifdef would cause at the callsites. |
---|
| 612 | + * In the end functions called under if (0) {} will not be linked |
---|
| 613 | + * into the final binary if they're not called from other places either. |
---|
| 614 | + */ |
---|
| 615 | +#define BCM_ATTACH_REF_DECL() |
---|
| 616 | +#define BCM_ATTACH_REF() (1) |
---|
| 617 | + |
---|
| 618 | +/* Const in ROM else normal data in RAM */ |
---|
| 619 | +#if defined(ROM_ENAB_RUNTIME_CHECK) |
---|
| 620 | + #define ROMCONST CONST |
---|
| 621 | +#else |
---|
| 622 | + #define ROMCONST |
---|
| 623 | +#endif // endif |
---|
393 | 624 | |
---|
394 | 625 | #endif /* _bcmdefs_h_ */ |
---|