2 * Copyright (c) 2010 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34 #define ON 1 /* ON = 1 */
37 #define AUTO (-1) /* Auto = -1 */
40 #define BCMFASTPATH __attribute__ ((__section__(".text.fastpath")))
46 #define SI_BUS 0 /* SOC Interconnect */
47 #define PCI_BUS 1 /* PCI target */
48 #define SDIO_BUS 3 /* SDIO target */
49 #define JTAG_BUS 4 /* JTAG */
50 #define USB_BUS 5 /* USB (does not support R/W REG) */
51 #define SPI_BUS 6 /* gSPI target */
52 #define RPC_BUS 7 /* RPC target */
55 /* Defines for DMA Address Width - Shared between OSL and HNDDMA */
56 #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
57 #define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */
58 #define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */
60 #define DMADDRWIDTH_30 30 /* 30-bit addressing capability */
61 #define DMADDRWIDTH_32 32 /* 32-bit addressing capability */
62 #define DMADDRWIDTH_63 63 /* 64-bit addressing capability */
63 #define DMADDRWIDTH_64 64 /* 64-bit addressing capability */
71 typedef dma64addr_t dmaaddr_t;
72 #define PHYSADDRHI(_pa) ((_pa).hiaddr)
73 #define PHYSADDRHISET(_pa, _val) \
75 (_pa).hiaddr = (_val); \
77 #define PHYSADDRLO(_pa) ((_pa).loaddr)
78 #define PHYSADDRLOSET(_pa, _val) \
80 (_pa).loaddr = (_val); \
84 typedef unsigned long dmaaddr_t;
85 #define PHYSADDRHI(_pa) (0)
86 #define PHYSADDRHISET(_pa, _val)
87 #define PHYSADDRLO(_pa) ((_pa))
88 #define PHYSADDRLOSET(_pa, _val) \
92 #endif /* BCMDMA64OSL */
94 /* One physical DMA segment */
100 #define MAX_DMA_SEGS 4
103 void *oshdmah; /* Opaque handle for OSL to store its information */
104 uint origsize; /* Size of the virtual packet */
106 hnddma_seg_t segs[MAX_DMA_SEGS];
109 /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
110 * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL.
111 * There is a compile time check in wlc.c which ensure that this value is at least as big
112 * as TXOFF. This value is used in dma_rxfill (hnddma.c).
115 #define BCMEXTRAHDROOM 172
118 #ifndef BCMDBG_ASSERT
119 #define BCMDBG_ASSERT
120 #endif /* BCMDBG_ASSERT */
123 /* Macros for doing definition and get/set of bitfields
124 * Usage example, e.g. a three-bit field (bits 4-6):
125 * #define <NAME>_M BITFIELD_MASK(3)
128 * regval = R_REG(osh, ®s->regfoo);
129 * field = GFIELD(regval, <NAME>);
130 * regval = SFIELD(regval, <NAME>, 1);
131 * W_REG(osh, ®s->regfoo, regval);
133 #define BITFIELD_MASK(width) \
134 (((unsigned)1 << (width)) - 1)
135 #define GFIELD(val, field) \
136 (((val) >> field ## _S) & field ## _M)
137 #define SFIELD(val, field, bits) \
138 (((val) & (~(field ## _M << field ## _S))) | \
139 ((unsigned)(bits) << field ## _S))
141 /* Max. nvram variable table size */
142 #define MAXSZ_NVRAM_VARS 4096
144 /* handle forward declaration */
147 #endif /* _bcmdefs_h_ */