1 /* 2 * Misc system wide definitions 3 * 4 * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation 5 * 6 * Copyright (C) 1999-2017, Broadcom Corporation 7 * 8 * Unless you and Broadcom execute a separate written software license 9 * agreement governing use of this software, this software is licensed to you 10 * under the terms of the GNU General Public License version 2 (the "GPL"), 11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 * following added to such license: 13 * 14 * As a special exception, the copyright holders of this software give you 15 * permission to link this software with independent modules, and to copy and 16 * distribute the resulting executable under terms of your choice, provided that 17 * you also meet, for each linked independent module, the terms and conditions of 18 * the license of that module. An independent module is a module which is not 19 * derived from this software. The special exception does not apply to any 20 * modifications of the software. 21 * 22 * Notwithstanding the above, under no circumstances may you combine this 23 * software in any way with any other Broadcom software provided under a license 24 * other than the GPL, without Broadcom's express prior written consent. 25 * 26 * 27 * <<Broadcom-WL-IPTag/Open:>> 28 * 29 * $Id: bcmdefs.h 700870 2017-05-22 19:05:22Z $ 30 */ 31 32 #ifndef _bcmdefs_h_ 33 #define _bcmdefs_h_ 34 35 /* 36 * One doesn't need to include this file explicitly, gets included automatically if 37 * typedefs.h is included. 38 */ 39 40 /* Use BCM_REFERENCE to suppress warnings about intentionally-unused function 41 * arguments or local variables. 42 */ 43 #define BCM_REFERENCE(data) ((void)(data)) 44 #include <linux/compiler.h> 45 /* Allow for suppressing unused variable warnings. */ 46 #ifdef __GNUC__ 47 #define UNUSED_VAR __attribute__ ((unused)) 48 #else 49 #define UNUSED_VAR 50 #endif // endif 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 83 /* Compile-time assert can be used in place of ASSERT if the expression evaluates 84 * to a constant at compile time. 85 */ 86 #if (__GNUC__ <= 4 && __GNUC_MINOR__ >= 4) 87 #define STATIC_ASSERT(expr) { \ 88 /* Make sure the expression is constant. */ \ 89 typedef enum { _STATIC_ASSERT_NOT_CONSTANT = (expr) } _static_assert_e UNUSED_VAR; \ 90 /* Make sure the expression is true. */ \ 91 typedef char STATIC_ASSERT_FAIL[(expr) ? 1 : -1] UNUSED_VAR; \ 92 } 93 #else 94 #define STATIC_ASSERT(expr) compiletime_assert(expr, "Compile time condition failure"); 95 #endif /* __GNUC__ <= 4 && __GNUC_MINOR__ >= 4 */ 96 97 /* Reclaiming text and data : 98 * The following macros specify special linker sections that can be reclaimed 99 * after a system is considered 'up'. 100 * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN, 101 * as in most cases, the attach function calls the detach function to clean up on error). 102 */ 103 #if defined(BCM_RECLAIM) 104 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 */ 133 #define _data _data 134 #define _fn _fn 135 #define BCMPREATTACHDATA(_data) _data 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 */ 161 #define _data _data 162 #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 */ 169 #define BCMNMIATTACHFN(_fn) _fn 170 #define BCMNMIATTACHDATA(_data) _data 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 */ 250 251 #if !defined STB 252 #if defined(BCM47XX) && defined(__ARM_ARCH_7A__) && !defined(OEM_ANDROID) 253 #define BCM47XX_CA9 254 #else 255 #undef BCM47XX_CA9 256 #endif /* BCM47XX && __ARM_ARCH_7A__ && !OEM_ANDROID */ 257 #endif /* STB */ 258 259 /* BCMFASTPATH Related Macro defines 260 */ 261 #ifndef BCMFASTPATH 262 #if defined(STB) 263 #define BCMFASTPATH __attribute__ ((__section__ (".text.fastpath"))) 264 #define BCMFASTPATH_HOST __attribute__ ((__section__ (".text.fastpath_host"))) 265 #else /* mips || BCM47XX_CA9 || STB */ 266 #define BCMFASTPATH 267 #define BCMFASTPATH_HOST 268 #endif // endif 269 #endif /* BCMFASTPATH */ 270 271 /* Use the BCMRAMFN() macro to tag functions in source that must be included in RAM (excluded from 272 * ROM). This should eliminate the need to manually specify these functions in the ROM config file. 273 * It should only be used in special cases where the function must be in RAM for *all* ROM-based 274 * chips. 275 */ 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 280 281 #define STATIC static 282 283 /* Bus types */ 284 #define SI_BUS 0 /* SOC Interconnect */ 285 #define PCI_BUS 1 /* PCI target */ 286 #define PCMCIA_BUS 2 /* PCMCIA target */ 287 #define SDIO_BUS 3 /* SDIO target */ 288 #define JTAG_BUS 4 /* JTAG */ 289 #define USB_BUS 5 /* USB (does not support R/W REG) */ 290 #define SPI_BUS 6 /* gSPI target */ 291 #define RPC_BUS 7 /* RPC target */ 292 293 /* Allows size optimization for single-bus image */ 294 #ifdef BCMBUSTYPE 295 #define BUSTYPE(bus) (BCMBUSTYPE) 296 #else 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 305 306 /* Allows size optimization for single-backplane image */ 307 #ifdef BCMCHIPTYPE 308 #define CHIPTYPE(bus) (BCMCHIPTYPE) 309 #else 310 #define CHIPTYPE(bus) (bus) 311 #endif // endif 312 313 /* Allows size optimization for SPROM support */ 314 #if defined(BCMSPROMBUS) 315 #define SPROMBUS (BCMSPROMBUS) 316 #elif defined(SI_PCMCIA_SROM) 317 #define SPROMBUS (PCMCIA_BUS) 318 #else 319 #define SPROMBUS (PCI_BUS) 320 #endif // endif 321 322 /* Allows size optimization for single-chip image */ 323 #ifdef BCMCHIPID 324 #define CHIPID(chip) (BCMCHIPID) 325 #else 326 #define CHIPID(chip) (chip) 327 #endif // endif 328 329 #ifdef BCMCHIPREV 330 #define CHIPREV(rev) (BCMCHIPREV) 331 #else 332 #define CHIPREV(rev) (rev) 333 #endif // endif 334 335 #ifdef BCMPCIEREV 336 #define PCIECOREREV(rev) (BCMPCIEREV) 337 #else 338 #define PCIECOREREV(rev) (rev) 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 362 363 /* Defines for DMA Address Width - Shared between OSL and HNDDMA */ 364 #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */ 365 #define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */ 366 #define DMADDR_MASK_26 0xFC000000 /* Address maks for 26-bits */ 367 #define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */ 368 369 #define DMADDRWIDTH_26 26 /* 26-bit addressing capability */ 370 #define DMADDRWIDTH_30 30 /* 30-bit addressing capability */ 371 #define DMADDRWIDTH_32 32 /* 32-bit addressing capability */ 372 #define DMADDRWIDTH_63 63 /* 64-bit addressing capability */ 373 #define DMADDRWIDTH_64 64 /* 64-bit addressing capability */ 374 375 typedef struct { 376 uint32 loaddr; 377 uint32 hiaddr; 378 } dma64addr_t; 379 380 #define PHYSADDR64HI(_pa) ((_pa).hiaddr) 381 #define PHYSADDR64HISET(_pa, _val) \ 382 do { \ 383 (_pa).hiaddr = (_val); \ 384 } while (0) 385 #define PHYSADDR64LO(_pa) ((_pa).loaddr) 386 #define PHYSADDR64LOSET(_pa, _val) \ 387 do { \ 388 (_pa).loaddr = (_val); \ 389 } while (0) 390 391 #ifdef BCMDMA64OSL 392 typedef dma64addr_t dmaaddr_t; 393 #define PHYSADDRHI(_pa) PHYSADDR64HI(_pa) 394 #define PHYSADDRHISET(_pa, _val) PHYSADDR64HISET(_pa, _val) 395 #define PHYSADDRLO(_pa) PHYSADDR64LO(_pa) 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) 401 402 #else 403 typedef unsigned long dmaaddr_t; 404 #define PHYSADDRHI(_pa) (0) 405 #define PHYSADDRHISET(_pa, _val) 406 #define PHYSADDRLO(_pa) ((_pa)) 407 #define PHYSADDRLOSET(_pa, _val) \ 408 do { \ 409 (_pa) = (_val); \ 410 } while (0) 411 #endif /* BCMDMA64OSL */ 412 #define PHYSADDRISZERO(_pa) (PHYSADDRLO(_pa) == 0 && PHYSADDRHI(_pa) == 0) 413 414 /* One physical DMA segment */ 415 typedef struct { 416 dmaaddr_t addr; 417 uint32 length; 418 } hnddma_seg_t; 419 420 #define MAX_DMA_SEGS 8 421 422 typedef struct { 423 void *oshdmah; /* Opaque handle for OSL to store its information */ 424 uint origsize; /* Size of the virtual packet */ 425 uint nsegs; 426 hnddma_seg_t segs[MAX_DMA_SEGS]; 427 } hnddma_seg_map_t; 428 429 /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF). 430 * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL. 431 * There is a compile time check in wlc.c which ensure that this value is at least as big 432 * as TXOFF. This value is used in dma_rxfill (hnddma.c). 433 */ 434 435 #if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY) 436 /* add 40 bytes to allow for extra RPC header and info */ 437 #define BCMEXTRAHDROOM 260 438 #else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ 439 #if defined(STB) 440 #define BCMEXTRAHDROOM 224 441 #else 442 #define BCMEXTRAHDROOM 204 443 #endif // endif 444 #endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */ 445 446 /* Packet alignment for most efficient SDIO (can change based on platform) */ 447 #ifndef SDALIGN 448 #define SDALIGN 32 449 #endif // endif 450 451 /* Headroom required for dongle-to-host communication. Packets allocated 452 * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should 453 * leave this much room in front for low-level message headers which may 454 * be needed to get across the dongle bus to the host. (These messages 455 * don't go over the network, so room for the full WL header above would 456 * be a waste.). 457 */ 458 #define BCMDONGLEHDRSZ 12 459 #define BCMDONGLEPADSZ 16 460 461 #define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ) 462 463 #if defined(NO_BCMDBG_ASSERT) 464 # undef BCMDBG_ASSERT 465 # undef BCMASSERT_LOG 466 #endif // endif 467 468 #if defined(BCMASSERT_LOG) 469 #define BCMASSERT_SUPPORT 470 #endif // endif 471 472 /* Macros for doing definition and get/set of bitfields 473 * Usage example, e.g. a three-bit field (bits 4-6): 474 * #define <NAME>_M BITFIELD_MASK(3) 475 * #define <NAME>_S 4 476 * ... 477 * regval = R_REG(osh, ®s->regfoo); 478 * field = GFIELD(regval, <NAME>); 479 * regval = SFIELD(regval, <NAME>, 1); 480 * W_REG(osh, ®s->regfoo, regval); 481 */ 482 #define BITFIELD_MASK(width) \ 483 (((unsigned)1 << (width)) - 1) 484 #define GFIELD(val, field) \ 485 (((val) >> field ## _S) & field ## _M) 486 #define SFIELD(val, field, bits) \ 487 (((val) & (~(field ## _M << field ## _S))) | \ 488 ((unsigned)(bits) << field ## _S)) 489 490 /* define BCMSMALL to remove misc features for memory-constrained environments */ 491 #ifdef BCMSMALL 492 #undef BCMSPACE 493 #define bcmspace FALSE /* if (bcmspace) code is discarded */ 494 #else 495 #define BCMSPACE 496 #define bcmspace TRUE /* if (bcmspace) code is retained */ 497 #endif // endif 498 499 /* Max. nvram variable table size */ 500 #ifndef MAXSZ_NVRAM_VARS 501 #ifdef LARGE_NVRAM_MAXSZ 502 #define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) 503 #else 504 #define LARGE_NVRAM_MAXSZ 8192 505 #define MAXSZ_NVRAM_VARS (LARGE_NVRAM_MAXSZ * 2) 506 #endif /* LARGE_NVRAM_MAXSZ */ 507 #endif /* !MAXSZ_NVRAM_VARS */ 508 509 /* ROM_ENAB_RUNTIME_CHECK may be set based upon the #define below (for ROM builds). It may also 510 * be defined via makefiles (e.g. ROM auto abandon unoptimized compiles). 511 */ 512 513 #ifdef BCMLFRAG /* BCMLFRAG support enab macros */ 514 extern bool _bcmlfrag; 515 #if defined(ROM_ENAB_RUNTIME_CHECK) || !defined(DONGLEBUILD) 516 #define BCMLFRAG_ENAB() (_bcmlfrag) 517 #elif defined(BCMLFRAG_DISABLED) 518 #define BCMLFRAG_ENAB() (0) 519 #else 520 #define BCMLFRAG_ENAB() (1) 521 #endif 522 #else 523 #define BCMLFRAG_ENAB() (0) 524 #endif /* BCMLFRAG_ENAB */ 525 526 #ifdef BCMPCIEDEV /* BCMPCIEDEV support enab macros */ 527 extern bool _pciedevenab; 528 #if defined(ROM_ENAB_RUNTIME_CHECK) 529 #define BCMPCIEDEV_ENAB() (_pciedevenab) 530 #elif defined(BCMPCIEDEV_ENABLED) 531 #define BCMPCIEDEV_ENAB() 1 532 #else 533 #define BCMPCIEDEV_ENAB() 0 534 #endif 535 #else 536 #define BCMPCIEDEV_ENAB() 0 537 #endif /* BCMPCIEDEV */ 538 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 545 #else 546 #define BCMRESVFRAGPOOL_ENAB() 0 547 #endif 548 #else 549 #define BCMRESVFRAGPOOL_ENAB() 0 550 #endif /* BCMPCIEDEV */ 551 552 #define BCMSDIODEV_ENAB() 0 553 554 /* Max size for reclaimable NVRAM array */ 555 #ifdef DL_NVRAM 556 #define NVRAM_ARRAY_MAXSIZE DL_NVRAM 557 #else 558 #define NVRAM_ARRAY_MAXSIZE MAXSZ_NVRAM_VARS 559 #endif /* DL_NVRAM */ 560 561 extern uint32 gFWID; 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 624 625 #endif /* _bcmdefs_h_ */ 626