1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Misc system wide definitions 4 * 5 * Copyright (C) 1999-2019, Broadcom. 6 * 7 * Unless you and Broadcom execute a separate written software license 8 * agreement governing use of this software, this software is licensed to you 9 * under the terms of the GNU General Public License version 2 (the "GPL"), 10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 * following added to such license: 12 * 13 * As a special exception, the copyright holders of this software give you 14 * permission to link this software with independent modules, and to copy and 15 * distribute the resulting executable under terms of your choice, provided that 16 * you also meet, for each linked independent module, the terms and conditions of 17 * the license of that module. An independent module is a module which is not 18 * derived from this software. The special exception does not apply to any 19 * modifications of the software. 20 * 21 * Notwithstanding the above, under no circumstances may you combine this 22 * software in any way with any other Broadcom software provided under a license 23 * other than the GPL, without Broadcom's express prior written consent. 24 * 25 * 26 * <<Broadcom-WL-IPTag/Open:>> 27 * 28 * $Id: bcmdefs.h 788740 2018-11-13 21:45:01Z $ 29 */ 30 31 #ifndef _bcmdefs_h_ 32 #define _bcmdefs_h_ 33 34 /* 35 * One doesn't need to include this file explicitly, gets included automatically if 36 * typedefs.h is included. 37 */ 38 39 /* Use BCM_REFERENCE to suppress warnings about intentionally-unused function 40 * arguments or local variables. 41 */ 42 #define BCM_REFERENCE(data) ((void)(data)) 43 44 /* Allow for suppressing unused variable warnings. */ 45 #ifdef __GNUC__ 46 #define UNUSED_VAR __attribute__ ((unused)) 47 #else 48 #define UNUSED_VAR 49 #endif // endif 50 51 /* GNU GCC 4.6+ supports selectively turning off a warning. 52 * Define these diagnostic macros to help suppress cast-qual warning 53 * until all the work can be done to fix the casting issues. 54 */ 55 #if (defined(__GNUC__) && defined(STRICT_GCC_WARNINGS) && (__GNUC__ > 4 || (__GNUC__ == \ 56 4 && __GNUC_MINOR__ >= 6))) 57 #define GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST() \ 58 _Pragma("GCC diagnostic push") \ 59 _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") 60 #define GCC_DIAGNOSTIC_POP() \ 61 _Pragma("GCC diagnostic pop") 62 #else 63 #define GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST() 64 #define GCC_DIAGNOSTIC_POP() 65 #endif /* Diagnostic macros not defined */ 66 67 /* Support clang for MACOSX compiler */ 68 #ifdef __clang__ 69 #define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_CAST() \ 70 _Pragma("clang diagnostic push") \ 71 _Pragma("clang diagnostic ignored \"-Wcast-qual\"") 72 #define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_FORMAT() \ 73 _Pragma("clang diagnostic push") \ 74 _Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"") 75 #define CLANG_DIAGNOSTIC_POP() \ 76 _Pragma("clang diagnostic pop") 77 #else 78 #define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_CAST() 79 #define CLANG_DIAGNOSTIC_PUSH_SUPPRESS_FORMAT() 80 #define CLANG_DIAGNOSTIC_POP() 81 #endif // endif 82 /* Compile-time assert can be used in place of ASSERT if the expression evaluates 83 * to a constant at compile time. 84 */ 85 #define STATIC_ASSERT(expr) { \ 86 /* Make sure the expression is constant. */ \ 87 typedef enum { _STATIC_ASSERT_NOT_CONSTANT = (expr) } _static_assert_e UNUSED_VAR; \ 88 /* Make sure the expression is true. */ \ 89 typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1] UNUSED_VAR; \ 90 } 91 92 /* Reclaiming text and data : 93 * The following macros specify special linker sections that can be reclaimed 94 * after a system is considered 'up'. 95 * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN, 96 * as in most cases, the attach function calls the detach function to clean up on error). 97 */ 98 #if defined(BCM_RECLAIM) 99 100 extern bool bcm_reclaimed; 101 extern bool bcm_attach_part_reclaimed; 102 extern bool bcm_preattach_part_reclaimed; 103 extern bool bcm_postattach_part_reclaimed; 104 105 #define RECLAIMED() (bcm_reclaimed) 106 #define ATTACH_PART_RECLAIMED() (bcm_attach_part_reclaimed) 107 #define PREATTACH_PART_RECLAIMED() (bcm_preattach_part_reclaimed) 108 #define POSTATTACH_PART_RECLAIMED() (bcm_postattach_part_reclaimed) 109 110 #if defined(BCM_RECLAIM_ATTACH_FN_DATA) 111 #define _data __attribute__ ((__section__ (".dataini2." #_data))) _data 112 #define _fn __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn 113 114 /* Relocate attach symbols to save-restore region to increase pre-reclaim heap size. */ 115 #define BCM_SRM_ATTACH_DATA(_data) __attribute__ ((__section__ (".datasrm." #_data))) _data 116 #define BCM_SRM_ATTACH_FN(_fn) __attribute__ ((__section__ (".textsrm." #_fn), noinline)) _fn 117 118 #ifndef PREATTACH_NORECLAIM 119 #define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini3." #_data))) _data 120 #define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini3." #_fn), noinline)) _fn 121 #else 122 #define BCMPREATTACHDATA(_data) __attribute__ ((__section__ (".dataini2." #_data))) _data 123 #define BCMPREATTACHFN(_fn) __attribute__ ((__section__ (".textini2." #_fn), noinline)) _fn 124 #endif /* PREATTACH_NORECLAIM */ 125 #define BCMPOSTATTACHDATA(_data) __attribute__ ((__section__ (".dataini5." #_data))) _data 126 #define BCMPOSTATTACHFN(_fn) __attribute__ ((__section__ (".textini5." #_fn), noinline)) _fn 127 #else /* BCM_RECLAIM_ATTACH_FN_DATA */ 128 #define _data _data 129 #define _fn _fn 130 #define BCMPREATTACHDATA(_data) _data 131 #define BCMPREATTACHFN(_fn) _fn 132 #define BCMPOSTATTACHDATA(_data) _data 133 #define BCMPOSTATTACHFN(_fn) _fn 134 #endif /* BCM_RECLAIM_ATTACH_FN_DATA */ 135 136 #ifdef BCMDBG_SR 137 /* 138 * Don't reclaim so we can compare SR ASM 139 */ 140 #define BCMPREATTACHDATASR(_data) _data 141 #define BCMPREATTACHFNSR(_fn) _fn 142 #define BCMATTACHDATASR(_data) _data 143 #define BCMATTACHFNSR(_fn) _fn 144 #else 145 #define BCMPREATTACHDATASR(_data) BCMPREATTACHDATA(_data) 146 #define BCMPREATTACHFNSR(_fn) BCMPREATTACHFN(_fn) 147 #define BCMATTACHDATASR(_data) _data 148 #define BCMATTACHFNSR(_fn) _fn 149 #endif // endif 150 151 #if defined(BCM_RECLAIM_INIT_FN_DATA) 152 #define _data __attribute__ ((__section__ (".dataini1." #_data))) _data 153 #define _fn __attribute__ ((__section__ (".textini1." #_fn), noinline)) _fn 154 #define CONST 155 #else /* BCM_RECLAIM_INIT_FN_DATA */ 156 #define _data _data 157 #define _fn _fn 158 #ifndef CONST 159 #define CONST const 160 #endif // endif 161 #endif /* BCM_RECLAIM_INIT_FN_DATA */ 162 163 /* Non-manufacture or internal attach function/dat */ 164 #define BCMNMIATTACHFN(_fn) _fn 165 #define BCMNMIATTACHDATA(_data) _data 166 167 #if defined(BCM_CISDUMP_NO_RECLAIM) 168 #define BCMCISDUMPATTACHFN(_fn) _fn 169 #define BCMCISDUMPATTACHDATA(_data) _data 170 #else 171 #define BCMCISDUMPATTACHFN(_fn) BCMNMIATTACHFN(_fn) 172 #define BCMCISDUMPATTACHDATA(_data) BCMNMIATTACHDATA(_data) 173 #endif // endif 174 175 /* SROM with OTP support */ 176 #if defined(BCMOTPSROM) 177 #define BCMSROMATTACHFN(_fn) _fn 178 #define BCMSROMATTACHDATA(_data) _data 179 #else 180 #define BCMSROMATTACHFN(_fn) BCMNMIATTACHFN(_fn) 181 #define BCMSROMATTACHDATA(_data) BCMNMIATTACHFN(_data) 182 #endif /* BCMOTPSROM */ 183 184 #if defined(BCM_CISDUMP_NO_RECLAIM) 185 #define BCMSROMCISDUMPATTACHFN(_fn) _fn 186 #define BCMSROMCISDUMPATTACHDATA(_data) _data 187 #else 188 #define BCMSROMCISDUMPATTACHFN(_fn) BCMSROMATTACHFN(_fn) 189 #define BCMSROMCISDUMPATTACHDATA(_data) BCMSROMATTACHDATA(_data) 190 #endif /* BCM_CISDUMP_NO_RECLAIM */ 191 192 #ifdef BCMNODOWN 193 #define _fn _fn 194 #else 195 #define _fn _fn 196 #endif // endif 197 198 #else /* BCM_RECLAIM */ 199 200 #define bcm_reclaimed (1) 201 #define bcm_attach_part_reclaimed (1) 202 #define bcm_preattach_part_reclaimed (1) 203 #define bcm_postattach_part_reclaimed (1) 204 #define _data _data 205 #define _fn _fn 206 #define BCM_SRM_ATTACH_DATA(_data) _data 207 #define BCM_SRM_ATTACH_FN(_fn) _fn 208 #define BCMPREATTACHDATA(_data) _data 209 #define BCMPREATTACHFN(_fn) _fn 210 #define BCMPOSTATTACHDATA(_data) _data 211 #define BCMPOSTATTACHFN(_fn) _fn 212 #define _data _data 213 #define _fn _fn 214 #define _fn _fn 215 #define BCMNMIATTACHFN(_fn) _fn 216 #define BCMNMIATTACHDATA(_data) _data 217 #define BCMSROMATTACHFN(_fn) _fn 218 #define BCMSROMATTACHDATA(_data) _data 219 #define BCMPREATTACHFNSR(_fn) _fn 220 #define BCMPREATTACHDATASR(_data) _data 221 #define BCMATTACHFNSR(_fn) _fn 222 #define BCMATTACHDATASR(_data) _data 223 #define BCMSROMATTACHFN(_fn) _fn 224 #define BCMSROMATTACHDATA(_data) _data 225 #define BCMCISDUMPATTACHFN(_fn) _fn 226 #define BCMCISDUMPATTACHDATA(_data) _data 227 #define BCMSROMCISDUMPATTACHFN(_fn) _fn 228 #define BCMSROMCISDUMPATTACHDATA(_data) _data 229 #define CONST const 230 231 #define RECLAIMED() (bcm_reclaimed) 232 #define ATTACH_PART_RECLAIMED() (bcm_attach_part_reclaimed) 233 #define PREATTACH_PART_RECLAIMED() (bcm_preattach_part_reclaimed) 234 #define POSTATTACH_PART_RECLAIMED() (bcm_postattach_part_reclaimed) 235 236 #endif /* BCM_RECLAIM */ 237 238 #define BCMUCODEDATA(_data) _data 239 240 #if defined(BCM_DMA_CT) && !defined(BCM_DMA_CT_DISABLED) 241 #define BCMUCODEFN(_fn) _fn 242 #else 243 #define BCMUCODEFN(_fn) _fn 244 #endif /* BCM_DMA_CT */ 245 246 #if !defined STB 247 #undef BCM47XX_CA9 248 #endif /* STB */ 249 250 /* BCMFASTPATH Related Macro defines 251 */ 252 #ifndef BCMFASTPATH 253 #if defined(STB) 254 #define BCMFASTPATH __attribute__ ((__section__ (".text.fastpath"))) 255 #define BCMFASTPATH_HOST __attribute__ ((__section__ (".text.fastpath_host"))) 256 #else /* mips || BCM47XX_CA9 || STB */ 257 #define BCMFASTPATH 258 #define BCMFASTPATH_HOST 259 #endif // endif 260 #endif /* BCMFASTPATH */ 261 262 /* Use the BCMRAMFN() macro to tag functions in source that must be included in RAM (excluded from 263 * ROM). This should eliminate the need to manually specify these functions in the ROM config file. 264 * It should only be used in special cases where the function must be in RAM for *all* ROM-based 265 * chips. 266 */ 267 #define BCMRAMFN(_fn) _fn 268 269 /* Use BCMSPECSYM() macro to tag symbols going to a special output section in the binary. */ 270 #define BCMSPECSYM(_sym) __attribute__ ((__section__ (".special." #_sym))) _sym 271 272 #define STATIC static 273 274 /* Bus types */ 275 #define SI_BUS 0 /* SOC Interconnect */ 276 #define PCI_BUS 1 /* PCI target */ 277 #define PCMCIA_BUS 2 /* PCMCIA target */ 278 #define SDIO_BUS 3 /* SDIO target */ 279 #define JTAG_BUS 4 /* JTAG */ 280 #define USB_BUS 5 /* USB (does not support R/W REG) */ 281 #define SPI_BUS 6 /* gSPI target */ 282 #define RPC_BUS 7 /* RPC target */ 283 284 /* Allows size optimization for single-bus image */ 285 #ifdef BCMBUSTYPE 286 #define BUSTYPE(bus) (BCMBUSTYPE) 287 #else 288 #define BUSTYPE(bus) (bus) 289 #endif // endif 290 291 #ifdef BCMBUSCORETYPE 292 #define BUSCORETYPE(ct) (BCMBUSCORETYPE) 293 #else 294 #define BUSCORETYPE(ct) (ct) 295 #endif // endif 296 297 /* Allows size optimization for single-backplane image */ 298 #ifdef BCMCHIPTYPE 299 #define CHIPTYPE(bus) (BCMCHIPTYPE) 300 #else 301 #define CHIPTYPE(bus) (bus) 302 #endif // endif 303 304 /* Allows size optimization for SPROM support */ 305 #if defined(BCMSPROMBUS) 306 #define SPROMBUS (BCMSPROMBUS) 307 #elif defined(SI_PCMCIA_SROM) 308 #define SPROMBUS (PCMCIA_BUS) 309 #else 310 #define SPROMBUS (PCI_BUS) 311 #endif // endif 312 313 /* Allows size optimization for single-chip image */ 314 #ifdef BCMCHIPID 315 #define CHIPID(chip) (BCMCHIPID) 316 #else 317 #define CHIPID(chip) (chip) 318 #endif // endif 319 320 #ifdef BCMCHIPREV 321 #define CHIPREV(rev) (BCMCHIPREV) 322 #else 323 #define CHIPREV(rev) (rev) 324 #endif // endif 325 326 #ifdef BCMPCIEREV 327 #define PCIECOREREV(rev) (BCMPCIEREV) 328 #else 329 #define PCIECOREREV(rev) (rev) 330 #endif // endif 331 332 #ifdef BCMPMUREV 333 #define PMUREV(rev) (BCMPMUREV) 334 #else 335 #define PMUREV(rev) (rev) 336 #endif // endif 337 338 #ifdef BCMCCREV 339 #define CCREV(rev) (BCMCCREV) 340 #else 341 #define CCREV(rev) (rev) 342 #endif // endif 343 344 #ifdef BCMGCIREV 345 #define GCIREV(rev) (BCMGCIREV) 346 #else 347 #define GCIREV(rev) (rev) 348 #endif // endif 349 350 #ifdef BCMCR4REV 351 #define CR4REV (BCMCR4REV) 352 #endif // endif 353 354 /* Defines for DMA Address Width - Shared between OSL and HNDDMA */ 355 #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */ 356 #define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */ 357 #define DMADDR_MASK_26 0xFC000000 /* Address maks for 26-bits */ 358 #define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */ 359 360 #define DMADDRWIDTH_26 26 /* 26-bit addressing capability */ 361 #define DMADDRWIDTH_30 30 /* 30-bit addressing capability */ 362 #define DMADDRWIDTH_32 32 /* 32-bit addressing capability */ 363 #define DMADDRWIDTH_63 63 /* 64-bit addressing capability */ 364 #define DMADDRWIDTH_64 64 /* 64-bit addressing capability */ 365 366 typedef struct { 367 uint32 loaddr; 368 uint32 hiaddr; 369 } dma64addr_t; 370 371 #define PHYSADDR64HI(_pa) ((_pa).hiaddr) 372 #define PHYSADDR64HISET(_pa, _val) \ 373 do { \ 374 (_pa).hiaddr = (_val); \ 375 } while (0) 376 #define PHYSADDR64LO(_pa) ((_pa).loaddr) 377 #define PHYSADDR64LOSET(_pa, _val) \ 378 do { \ 379 (_pa).loaddr = (_val); \ 380 } while (0) 381 382 #ifdef BCMDMA64OSL 383 typedef dma64addr_t dmaaddr_t; 384 #define PHYSADDRHI(_pa) PHYSADDR64HI(_pa) 385 #define PHYSADDRHISET(_pa, _val) PHYSADDR64HISET(_pa, _val) 386 #define PHYSADDRLO(_pa) PHYSADDR64LO(_pa) 387 #define PHYSADDRLOSET(_pa, _val) PHYSADDR64LOSET(_pa, _val) 388 #define PHYSADDRTOULONG(_pa, _ulong) \ 389 do { \ 390 _ulong = ((unsigned long long)(_pa).hiaddr << 32) | ((_pa).loaddr); \ 391 } while (0) 392 393 #else 394 typedef unsigned long dmaaddr_t; 395 #define PHYSADDRHI(_pa) (0) 396 #define PHYSADDRHISET(_pa, _val) 397 #define PHYSADDRLO(_pa) ((_pa)) 398 #define PHYSADDRLOSET(_pa, _val) \ 399 do { \ 400 (_pa) = (_val); \ 401 } while (0) 402 #endif /* BCMDMA64OSL */ 403 #define PHYSADDRISZERO(_pa) (PHYSADDRLO(_pa) == 0 && PHYSADDRHI(_pa) == 0) 404 405 /* One physical DMA segment */ 406 typedef struct { 407 dmaaddr_t addr; 408 uint32 length; 409 } hnddma_seg_t; 410 411 #define MAX_DMA_SEGS 8 412 413 typedef struct { 414 void *oshdmah; /* Opaque handle for OSL to store its information */ 415 uint origsize; /* Size of the virtual packet */ 416 uint nsegs; 417 hnddma_seg_t segs[MAX_DMA_SEGS]; 418 } hnddma_seg_map_t; 419 420 /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF). 421 * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL. 422 * There is a compile time check in wlc.c which ensure that this value is at least as big 423 * as TXOFF. This value is used in dma_rxfill (hnddma.c). 424 */ 425 426 #if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY) 427 /* add 40 bytes to allow for extra RPC header and info */ 428 #define BCMEXTRAHDROOM 260 429 #else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ 430 #if defined(STB) 431 #define BCMEXTRAHDROOM 224 432 #else 433 #define BCMEXTRAHDROOM 204 434 #endif // endif 435 #endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ 436 437 /* Packet alignment for most efficient SDIO (can change based on platform) */ 438 #ifndef SDALIGN 439 #define SDALIGN 32 440 #endif // endif 441 442 /* Headroom required for dongle-to-host communication. Packets allocated 443 * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should 444 * leave this much room in front for low-level message headers which may 445 * be needed to get across the dongle bus to the host. (These messages 446 * don't go over the network, so room for the full WL header above would 447 * be a waste.). 448 */ 449 #define BCMDONGLEHDRSZ 12 450 #define BCMDONGLEPADSZ 16 451 452 #define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ) 453 454 #if defined(NO_BCMDBG_ASSERT) 455 # undef BCMDBG_ASSERT 456 # undef BCMASSERT_LOG 457 #endif // endif 458 459 #if defined(BCMASSERT_LOG) 460 #define BCMASSERT_SUPPORT 461 #endif // endif 462 463 /* Macros for doing definition and get/set of bitfields 464 * Usage example, e.g. a three-bit field (bits 4-6): 465 * #define <NAME>_M BITFIELD_MASK(3) 466 * #define <NAME>_S 4 467 * ... 468 * regval = R_REG(osh, ®s->regfoo); 469 * field = GFIELD(regval, <NAME>); 470 * regval = SFIELD(regval, <NAME>, 1); 471 * W_REG(osh, ®s->regfoo, regval); 472 */ 473 #define BITFIELD_MASK(width) \ 474 (((unsigned)1 << (width)) - 1) 475 #define GFIELD(val, field) \ 476 (((val) >> field ## _S) & field ## _M) 477 #define SFIELD(val, field, bits) \ 478 (((val) & (~(field ## _M << field ## _S))) | \ 479 ((unsigned)(bits) << field ## _S)) 480 481 /* define BCMSMALL to remove misc features for memory-constrained environments */ 482 #ifdef BCMSMALL 483 #undef BCMSPACE 484 #define bcmspace FALSE /* if (bcmspace) code is discarded */ 485 #else 486 #define BCMSPACE 487 #define bcmspace TRUE /* if (bcmspace) code is retained */ 488 #endif // endif 489 490 /* Max. nvram variable table size */ 491 #ifndef MAXSZ_NVRAM_VARS 492 #ifdef LARGE_NVRAM_MAXSZ 493 #define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) 494 #else 495 #define LARGE_NVRAM_MAXSZ 8192 496 #define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) 497 #endif /* LARGE_NVRAM_MAXSZ */ 498 #endif /* !MAXSZ_NVRAM_VARS */ 499 500 /* ROM_ENAB_RUNTIME_CHECK may be set based upon the #define below (for ROM builds). It may also 501 * be defined via makefiles (e.g. ROM auto abandon unoptimized compiles). 502 */ 503 504 #ifdef BCMLFRAG /* BCMLFRAG support enab macros */ 505 extern bool _bcmlfrag; 506 #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) 507 #define BCMLFRAG_ENAB() (_bcmlfrag) 508 #elif defined(BCMLFRAG_DISABLED) 509 #define BCMLFRAG_ENAB() (0) 510 #else 511 #define BCMLFRAG_ENAB() (1) 512 #endif 513 #else 514 #define BCMLFRAG_ENAB() (0) 515 #endif /* BCMLFRAG_ENAB */ 516 517 #ifdef BCMPCIEDEV /* BCMPCIEDEV support enab macros */ 518 extern bool _pciedevenab; 519 #if defined(ROM_ENAB_RUNTIME_CHECK) 520 #define BCMPCIEDEV_ENAB() (_pciedevenab) 521 #elif defined(BCMPCIEDEV_ENABLED) 522 #define BCMPCIEDEV_ENAB() 1 523 #else 524 #define BCMPCIEDEV_ENAB() 0 525 #endif 526 #else 527 #define BCMPCIEDEV_ENAB() 0 528 #endif /* BCMPCIEDEV */ 529 530 #ifdef BCMRESVFRAGPOOL /* BCMRESVFRAGPOOL support enab macros */ 531 extern bool _resvfragpool_enab; 532 #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) 533 #define BCMRESVFRAGPOOL_ENAB() (_resvfragpool_enab) 534 #elif defined(BCMRESVFRAGPOOL_ENABLED) 535 #define BCMRESVFRAGPOOL_ENAB() 1 536 #else 537 #define BCMRESVFRAGPOOL_ENAB() 0 538 #endif 539 #else 540 #define BCMRESVFRAGPOOL_ENAB() 0 541 #endif /* BCMPCIEDEV */ 542 543 #define BCMSDIODEV_ENAB() 0 544 545 /* Max size for reclaimable NVRAM array */ 546 #ifdef DL_NVRAM 547 #define NVRAM_ARRAY_MAXSIZE DL_NVRAM 548 #else 549 #define NVRAM_ARRAY_MAXSIZE MAXSZ_NVRAM_VARS 550 #endif /* DL_NVRAM */ 551 552 extern uint32 gFWID; 553 554 #ifdef BCMFRWDPOOLREORG /* BCMFRWDPOOLREORG support enab macros */ 555 extern bool _bcmfrwdpoolreorg; 556 #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) 557 #define BCMFRWDPOOLREORG_ENAB() (_bcmfrwdpoolreorg) 558 #elif defined(BCMFRWDPOOLREORG_DISABLED) 559 #define BCMFRWDPOOLREORG_ENAB() (0) 560 #else 561 #define BCMFRWDPOOLREORG_ENAB() (1) 562 #endif 563 #else 564 #define BCMFRWDPOOLREORG_ENAB() (0) 565 #endif /* BCMFRWDPOOLREORG */ 566 567 #ifdef BCMPOOLRECLAIM /* BCMPOOLRECLAIM support enab macros */ 568 extern bool _bcmpoolreclaim; 569 #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) 570 #define BCMPOOLRECLAIM_ENAB() (_bcmpoolreclaim) 571 #elif defined(BCMPOOLRECLAIM_DISABLED) 572 #define BCMPOOLRECLAIM_ENAB() (0) 573 #else 574 #define BCMPOOLRECLAIM_ENAB() (1) 575 #endif 576 #else 577 #define BCMPOOLRECLAIM_ENAB() (0) 578 #endif /* BCMPOOLRECLAIM */ 579 580 /* Chip related low power flags (lpflags) */ 581 582 #ifndef PAD 583 #define _PADLINE(line) pad ## line 584 #define _XSTR(line) _PADLINE(line) 585 #define PAD _XSTR(__LINE__) 586 #endif // endif 587 588 #ifndef FRAG_HEADROOM 589 #define FRAG_HEADROOM 224 /* In absence of SFD, use default headroom of 224 */ 590 #endif // endif 591 592 #define MODULE_DETACH(var, detach_func)\ 593 if (var) { \ 594 detach_func(var); \ 595 (var) = NULL; \ 596 } 597 #define MODULE_DETACH_2(var1, var2, detach_func) detach_func(var1, var2) 598 #define MODULE_DETACH_TYPECASTED(var, detach_func) detach_func(var) 599 600 /* When building ROML image use runtime conditional to cause the compiler 601 * to compile everything but not to complain "defined but not used" 602 * as #ifdef would cause at the callsites. 603 * In the end functions called under if (0) {} will not be linked 604 * into the final binary if they're not called from other places either. 605 */ 606 #define BCM_ATTACH_REF_DECL() 607 #define BCM_ATTACH_REF() (1) 608 609 /* Const in ROM else normal data in RAM */ 610 #if defined(ROM_ENAB_RUNTIME_CHECK) 611 #define ROMCONST CONST 612 #else 613 #define ROMCONST 614 #endif // endif 615 616 #endif /* _bcmdefs_h_ */ 617