rk: temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / bcmdhd / include / bcmdefs.h
1 /*
2  * Misc system wide definitions
3  *
4  * Copyright (C) 1999-2011, Broadcom Corporation
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 of
16  * the license of that module.  An independent module is a module which is not
17  * 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  * $Id: bcmdefs.h 279282 2011-08-23 22:44:02Z $
25  */
26
27
28 #ifndef _bcmdefs_h_
29 #define _bcmdefs_h_
30
31
32
33
34 #define BCM_REFERENCE(data)     ((void)(data))
35
36
37
38 #define bcmreclaimed            0
39 #define _data   _data
40 #define _fn     _fn
41 #define BCMPREATTACHDATA(_data) _data
42 #define BCMPREATTACHFN(_fn)     _fn
43 #define _data   _data
44 #define _fn             _fn
45 #define _fn     _fn
46 #define BCMNMIATTACHFN(_fn)     _fn
47 #define BCMNMIATTACHDATA(_data) _data
48 #define BCMOVERLAY0DATA(_sym)   _sym
49 #define BCMOVERLAY0FN(_fn)      _fn
50 #define BCMOVERLAY1DATA(_sym)   _sym
51 #define BCMOVERLAY1FN(_fn)      _fn
52 #define BCMOVERLAYERRFN(_fn)    _fn
53 #define CONST   const
54 #define BCMFASTPATH
55
56
57
58
59 #define _data   _data
60 #define BCMROMDAT_NAME(_data)   _data
61 #define _fn             _fn
62 #define _fn     _fn
63 #define STATIC  static
64 #define BCMROMDAT_ARYSIZ(data)  ARRAYSIZE(data)
65 #define BCMROMDAT_SIZEOF(data)  sizeof(data)
66 #define BCMROMDAT_APATCH(data)
67 #define BCMROMDAT_SPATCH(data)
68
69
70
71 #define OVERLAY_INLINE
72 #define OSTATIC                 static
73 #define BCMOVERLAYDATA(_ovly, _sym)     _sym
74 #define BCMOVERLAYFN(_ovly, _fn)        _fn
75 #define BCMOVERLAYERRFN(_fn)    _fn
76 #define BCMROMOVERLAYDATA(_ovly, _data) _data
77 #define BCMROMOVERLAYFN(_ovly, _fn)             _fn
78 #define BCMATTACHOVERLAYDATA(_ovly, _sym)       _sym
79 #define BCMATTACHOVERLAYFN(_ovly, _fn)          _fn
80 #define BCMINITOVERLAYDATA(_ovly, _sym)         _sym
81 #define BCMINITOVERLAYFN(_ovly, _fn)            _fn
82 #define BCMUNINITOVERLAYFN(_ovly, _fn)          _fn
83
84
85
86 #define SI_BUS                  0       
87 #define PCI_BUS                 1       
88 #define PCMCIA_BUS              2       
89 #define SDIO_BUS                3       
90 #define JTAG_BUS                4       
91 #define USB_BUS                 5       
92 #define SPI_BUS                 6       
93 #define RPC_BUS                 7       
94
95
96 #ifdef BCMBUSTYPE
97 #define BUSTYPE(bus)    (BCMBUSTYPE)
98 #else
99 #define BUSTYPE(bus)    (bus)
100 #endif
101
102
103 #ifdef BCMCHIPTYPE
104 #define CHIPTYPE(bus)   (BCMCHIPTYPE)
105 #else
106 #define CHIPTYPE(bus)   (bus)
107 #endif
108
109
110
111 #if defined(BCMSPROMBUS)
112 #define SPROMBUS        (BCMSPROMBUS)
113 #elif defined(SI_PCMCIA_SROM)
114 #define SPROMBUS        (PCMCIA_BUS)
115 #else
116 #define SPROMBUS        (PCI_BUS)
117 #endif
118
119
120 #ifdef BCMCHIPID
121 #define CHIPID(chip)    (BCMCHIPID)
122 #else
123 #define CHIPID(chip)    (chip)
124 #endif
125
126 #ifdef BCMCHIPREV
127 #define CHIPREV(rev)    (BCMCHIPREV)
128 #else
129 #define CHIPREV(rev)    (rev)
130 #endif
131
132
133 #define DMADDR_MASK_32 0x0              
134 #define DMADDR_MASK_30 0xc0000000       
135 #define DMADDR_MASK_0  0xffffffff       
136
137 #define DMADDRWIDTH_30  30 
138 #define DMADDRWIDTH_32  32 
139 #define DMADDRWIDTH_63  63 
140 #define DMADDRWIDTH_64  64 
141
142 #ifdef BCMDMA64OSL
143 typedef struct {
144         uint32 loaddr;
145         uint32 hiaddr;
146 } dma64addr_t;
147
148 typedef dma64addr_t dmaaddr_t;
149 #define PHYSADDRHI(_pa) ((_pa).hiaddr)
150 #define PHYSADDRHISET(_pa, _val) \
151         do { \
152                 (_pa).hiaddr = (_val);          \
153         } while (0)
154 #define PHYSADDRLO(_pa) ((_pa).loaddr)
155 #define PHYSADDRLOSET(_pa, _val) \
156         do { \
157                 (_pa).loaddr = (_val);          \
158         } while (0)
159
160 #else
161 typedef unsigned long dmaaddr_t;
162 #define PHYSADDRHI(_pa) (0)
163 #define PHYSADDRHISET(_pa, _val)
164 #define PHYSADDRLO(_pa) ((_pa))
165 #define PHYSADDRLOSET(_pa, _val) \
166         do { \
167                 (_pa) = (_val);                 \
168         } while (0)
169 #endif 
170
171
172 typedef struct  {
173         dmaaddr_t addr;
174         uint32    length;
175 } hnddma_seg_t;
176
177 #define MAX_DMA_SEGS 4
178
179
180 typedef struct {
181         void *oshdmah; 
182         uint origsize; 
183         uint nsegs;
184         hnddma_seg_t segs[MAX_DMA_SEGS];
185 } hnddma_seg_map_t;
186
187
188
189
190 #if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
191
192 #define BCMEXTRAHDROOM 220
193 #else
194 #define BCMEXTRAHDROOM 172
195 #endif
196
197
198 #define BCMDONGLEHDRSZ 12
199 #define BCMDONGLEPADSZ 16
200
201 #define BCMDONGLEOVERHEAD       (BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
202
203
204 #if defined(BCMASSERT_LOG)
205 #define BCMASSERT_SUPPORT
206 #endif 
207
208
209 #define BITFIELD_MASK(width) \
210                 (((unsigned)1 << (width)) - 1)
211 #define GFIELD(val, field) \
212                 (((val) >> field ## _S) & field ## _M)
213 #define SFIELD(val, field, bits) \
214                 (((val) & (~(field ## _M << field ## _S))) | \
215                  ((unsigned)(bits) << field ## _S))
216
217
218 #ifdef BCMSMALL
219 #undef  BCMSPACE
220 #define bcmspace        FALSE   
221 #else
222 #define BCMSPACE
223 #define bcmspace        TRUE    
224 #endif
225
226
227 #define MAXSZ_NVRAM_VARS        4096
228
229 #define LOCATOR_EXTERN static
230
231 #endif