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