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 SI_BUS 0 /* SOC Interconnect */
41 #define PCI_BUS 1 /* PCI target */
42 #define SDIO_BUS 3 /* SDIO target */
43 #define JTAG_BUS 4 /* JTAG */
44 #define USB_BUS 5 /* USB (does not support R/W REG) */
45 #define SPI_BUS 6 /* gSPI target */
46 #define RPC_BUS 7 /* RPC target */
49 /* Defines for DMA Address Width - Shared between OSL and HNDDMA */
50 #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
51 #define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */
52 #define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */
54 #define DMADDRWIDTH_30 30 /* 30-bit addressing capability */
55 #define DMADDRWIDTH_32 32 /* 32-bit addressing capability */
56 #define DMADDRWIDTH_63 63 /* 64-bit addressing capability */
57 #define DMADDRWIDTH_64 64 /* 64-bit addressing capability */
65 typedef dma64addr_t dmaaddr_t
;
66 #define PHYSADDRHI(_pa) ((_pa).hiaddr)
67 #define PHYSADDRHISET(_pa, _val) \
69 (_pa).hiaddr = (_val); \
71 #define PHYSADDRLO(_pa) ((_pa).loaddr)
72 #define PHYSADDRLOSET(_pa, _val) \
74 (_pa).loaddr = (_val); \
78 typedef unsigned long dmaaddr_t
;
79 #define PHYSADDRHI(_pa) (0)
80 #define PHYSADDRHISET(_pa, _val)
81 #define PHYSADDRLO(_pa) ((_pa))
82 #define PHYSADDRLOSET(_pa, _val) \
86 #endif /* BCMDMA64OSL */
88 /* One physical DMA segment */
94 #define MAX_DMA_SEGS 4
97 void *oshdmah
; /* Opaque handle for OSL to store its information */
98 uint origsize
; /* Size of the virtual packet */
100 hnddma_seg_t segs
[MAX_DMA_SEGS
];
103 /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
104 * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL.
105 * There is a compile time check in wlc.c which ensure that this value is at least as big
106 * as TXOFF. This value is used in dma_rxfill (hnddma.c).
109 #define BCMEXTRAHDROOM 172
111 /* Macros for doing definition and get/set of bitfields
112 * Usage example, e.g. a three-bit field (bits 4-6):
113 * #define <NAME>_M BITFIELD_MASK(3)
116 * regval = R_REG(osh, ®s->regfoo);
117 * field = GFIELD(regval, <NAME>);
118 * regval = SFIELD(regval, <NAME>, 1);
119 * W_REG(osh, ®s->regfoo, regval);
121 #define BITFIELD_MASK(width) \
122 (((unsigned)1 << (width)) - 1)
123 #define GFIELD(val, field) \
124 (((val) >> field ## _S) & field ## _M)
125 #define SFIELD(val, field, bits) \
126 (((val) & (~(field ## _M << field ## _S))) | \
127 ((unsigned)(bits) << field ## _S))
130 * Priority definitions according 802.1D
132 #define PRIO_8021D_NONE 2
133 #define PRIO_8021D_BK 1
134 #define PRIO_8021D_BE 0
135 #define PRIO_8021D_EE 3
136 #define PRIO_8021D_CL 4
137 #define PRIO_8021D_VI 5
138 #define PRIO_8021D_VO 6
139 #define PRIO_8021D_NC 7
141 #define NUMPRIO (MAXPRIO + 1)
143 /* Max. nvram variable table size */
144 #define MAXSZ_NVRAM_VARS 4096
146 /* handle forward declaration */
150 #endif /* _bcmdefs_h_ */