5 #include <linux/kernel.h>
9 #include <linux/netdevice.h>
10 #include <linux/pci.h>
25 #define B43legacy_IRQWAIT_MAX_RETRIES 20
28 #define B43legacy_MMIO_DMA0_REASON 0x20
29 #define B43legacy_MMIO_DMA0_IRQ_MASK 0x24
30 #define B43legacy_MMIO_DMA1_REASON 0x28
31 #define B43legacy_MMIO_DMA1_IRQ_MASK 0x2C
32 #define B43legacy_MMIO_DMA2_REASON 0x30
33 #define B43legacy_MMIO_DMA2_IRQ_MASK 0x34
34 #define B43legacy_MMIO_DMA3_REASON 0x38
35 #define B43legacy_MMIO_DMA3_IRQ_MASK 0x3C
36 #define B43legacy_MMIO_DMA4_REASON 0x40
37 #define B43legacy_MMIO_DMA4_IRQ_MASK 0x44
38 #define B43legacy_MMIO_DMA5_REASON 0x48
39 #define B43legacy_MMIO_DMA5_IRQ_MASK 0x4C
40 #define B43legacy_MMIO_MACCTL 0x120
41 #define B43legacy_MMIO_MACCMD 0x124
42 #define B43legacy_MMIO_GEN_IRQ_REASON 0x128
43 #define B43legacy_MMIO_GEN_IRQ_MASK 0x12C
44 #define B43legacy_MMIO_RAM_CONTROL 0x130
45 #define B43legacy_MMIO_RAM_DATA 0x134
46 #define B43legacy_MMIO_PS_STATUS 0x140
47 #define B43legacy_MMIO_RADIO_HWENABLED_HI 0x158
48 #define B43legacy_MMIO_SHM_CONTROL 0x160
49 #define B43legacy_MMIO_SHM_DATA 0x164
50 #define B43legacy_MMIO_SHM_DATA_UNALIGNED 0x166
51 #define B43legacy_MMIO_XMITSTAT_0 0x170
52 #define B43legacy_MMIO_XMITSTAT_1 0x174
53 #define B43legacy_MMIO_REV3PLUS_TSF_LOW 0x180
54 #define B43legacy_MMIO_REV3PLUS_TSF_HIGH 0x184
55 #define B43legacy_MMIO_TSF_CFP_REP 0x188
56 #define B43legacy_MMIO_TSF_CFP_START 0x18C
58 #define B43legacy_MMIO_DMA32_BASE0 0x200
59 #define B43legacy_MMIO_DMA32_BASE1 0x220
60 #define B43legacy_MMIO_DMA32_BASE2 0x240
61 #define B43legacy_MMIO_DMA32_BASE3 0x260
62 #define B43legacy_MMIO_DMA32_BASE4 0x280
63 #define B43legacy_MMIO_DMA32_BASE5 0x2A0
65 #define B43legacy_MMIO_DMA64_BASE0 0x200
66 #define B43legacy_MMIO_DMA64_BASE1 0x240
67 #define B43legacy_MMIO_DMA64_BASE2 0x280
68 #define B43legacy_MMIO_DMA64_BASE3 0x2C0
69 #define B43legacy_MMIO_DMA64_BASE4 0x300
70 #define B43legacy_MMIO_DMA64_BASE5 0x340
72 #define B43legacy_MMIO_PIO1_BASE 0x300
73 #define B43legacy_MMIO_PIO2_BASE 0x310
74 #define B43legacy_MMIO_PIO3_BASE 0x320
75 #define B43legacy_MMIO_PIO4_BASE 0x330
77 #define B43legacy_MMIO_PHY_VER 0x3E0
78 #define B43legacy_MMIO_PHY_RADIO 0x3E2
79 #define B43legacy_MMIO_PHY0 0x3E6
80 #define B43legacy_MMIO_ANTENNA 0x3E8
81 #define B43legacy_MMIO_CHANNEL 0x3F0
82 #define B43legacy_MMIO_CHANNEL_EXT 0x3F4
83 #define B43legacy_MMIO_RADIO_CONTROL 0x3F6
84 #define B43legacy_MMIO_RADIO_DATA_HIGH 0x3F8
85 #define B43legacy_MMIO_RADIO_DATA_LOW 0x3FA
86 #define B43legacy_MMIO_PHY_CONTROL 0x3FC
87 #define B43legacy_MMIO_PHY_DATA 0x3FE
88 #define B43legacy_MMIO_MACFILTER_CONTROL 0x420
89 #define B43legacy_MMIO_MACFILTER_DATA 0x422
90 #define B43legacy_MMIO_RCMTA_COUNT 0x43C
91 #define B43legacy_MMIO_RADIO_HWENABLED_LO 0x49A
92 #define B43legacy_MMIO_GPIO_CONTROL 0x49C
93 #define B43legacy_MMIO_GPIO_MASK 0x49E
94 #define B43legacy_MMIO_TSF_CFP_PRETBTT 0x612
95 #define B43legacy_MMIO_TSF_0 0x632
96 #define B43legacy_MMIO_TSF_1 0x634
97 #define B43legacy_MMIO_TSF_2 0x636
98 #define B43legacy_MMIO_TSF_3 0x638
99 #define B43legacy_MMIO_RNG 0x65A
100 #define B43legacy_MMIO_POWERUP_DELAY 0x6A8
103 #define B43legacy_BFL_PACTRL 0x0002
104 #define B43legacy_BFL_RSSI 0x0008
105 #define B43legacy_BFL_EXTLNA 0x1000
108 #define B43legacy_GPIO_CONTROL 0x6c
111 #define B43legacy_SHM_SHARED 0x0001
112 #define B43legacy_SHM_WIRELESS 0x0002
113 #define B43legacy_SHM_HW 0x0004
114 #define B43legacy_SHM_UCODE 0x0300
117 #define B43legacy_SHM_AUTOINC_R 0x0200
118 #define B43legacy_SHM_AUTOINC_W 0x0100
119 #define B43legacy_SHM_AUTOINC_RW (B43legacy_SHM_AUTOINC_R | \
120 B43legacy_SHM_AUTOINC_W)
123 #define B43legacy_SHM_SH_WLCOREREV 0x0016
124 #define B43legacy_SHM_SH_HOSTFLO 0x005E
125 #define B43legacy_SHM_SH_HOSTFHI 0x0060
127 #define B43legacy_SHM_SH_KEYIDXBLOCK 0x05D4
129 #define B43legacy_SHM_SH_DTIMP 0x0012
130 #define B43legacy_SHM_SH_BTL0 0x0018
131 #define B43legacy_SHM_SH_BTL1 0x001A
132 #define B43legacy_SHM_SH_BTSFOFF 0x001C
133 #define B43legacy_SHM_SH_TIMPOS 0x001E
134 #define B43legacy_SHM_SH_BEACPHYCTL 0x0054
136 #define B43legacy_SHM_SH_ACKCTSPHYCTL 0x0022
138 #define B43legacy_SHM_SH_PRTLEN 0x004A
139 #define B43legacy_SHM_SH_PRMAXTIME 0x0074
140 #define B43legacy_SHM_SH_PRPHYCTL 0x0188
142 #define B43legacy_SHM_SH_OFDMDIRECT 0x0480
143 #define B43legacy_SHM_SH_OFDMBASIC 0x04A0
144 #define B43legacy_SHM_SH_CCKDIRECT 0x04C0
145 #define B43legacy_SHM_SH_CCKBASIC 0x04E0
147 #define B43legacy_SHM_SH_UCODEREV 0x0000
148 #define B43legacy_SHM_SH_UCODEPATCH 0x0002
149 #define B43legacy_SHM_SH_UCODEDATE 0x0004
150 #define B43legacy_SHM_SH_UCODETIME 0x0006
151 #define B43legacy_SHM_SH_SPUWKUP 0x0094
152 #define B43legacy_SHM_SH_PRETBTT 0x0096
154 #define B43legacy_UCODEFLAGS_OFFSET 0x005E
157 #define B43legacy_MMIO_RADIO_HWENABLED_HI_MASK (1 << 16)
158 #define B43legacy_MMIO_RADIO_HWENABLED_LO_MASK (1 << 4)
161 #define B43legacy_HF_SYMW 0x00000002
162 #define B43legacy_HF_GDCW 0x00000020
163 #define B43legacy_HF_OFDMPABOOST 0x00000040
164 #define B43legacy_HF_EDCF 0x00000100
167 #define B43legacy_MACFILTER_SELF 0x0000
168 #define B43legacy_MACFILTER_BSSID 0x0003
169 #define B43legacy_MACFILTER_MAC 0x0010
172 #define B43legacy_PHYTYPE_B 0x01
173 #define B43legacy_PHYTYPE_G 0x02
176 #define B43legacy_PHY_G_LO_CONTROL 0x0810
177 #define B43legacy_PHY_ILT_G_CTRL 0x0472
178 #define B43legacy_PHY_ILT_G_DATA1 0x0473
179 #define B43legacy_PHY_ILT_G_DATA2 0x0474
180 #define B43legacy_PHY_G_PCTL 0x0029
181 #define B43legacy_PHY_RADIO_BITFIELD 0x0401
182 #define B43legacy_PHY_G_CRS 0x0429
183 #define B43legacy_PHY_NRSSILT_CTRL 0x0803
184 #define B43legacy_PHY_NRSSILT_DATA 0x0804
187 #define B43legacy_RADIOCTL_ID 0x01
190 #define B43legacy_MACCTL_ENABLED 0x00000001
191 #define B43legacy_MACCTL_PSM_RUN 0x00000002
192 #define B43legacy_MACCTL_PSM_JMP0 0x00000004
193 #define B43legacy_MACCTL_SHM_ENABLED 0x00000100
194 #define B43legacy_MACCTL_IHR_ENABLED 0x00000400
195 #define B43legacy_MACCTL_BE 0x00010000
196 #define B43legacy_MACCTL_INFRA 0x00020000
197 #define B43legacy_MACCTL_AP 0x00040000
198 #define B43legacy_MACCTL_RADIOLOCK 0x00080000
199 #define B43legacy_MACCTL_BEACPROMISC 0x00100000
200 #define B43legacy_MACCTL_KEEP_BADPLCP 0x00200000
201 #define B43legacy_MACCTL_KEEP_CTL 0x00400000
202 #define B43legacy_MACCTL_KEEP_BAD 0x00800000
203 #define B43legacy_MACCTL_PROMISC 0x01000000
204 #define B43legacy_MACCTL_HWPS 0x02000000
205 #define B43legacy_MACCTL_AWAKE 0x04000000
206 #define B43legacy_MACCTL_TBTTHOLD 0x10000000
207 #define B43legacy_MACCTL_GMODE 0x80000000
210 #define B43legacy_MACCMD_BEACON0_VALID 0x00000001
211 #define B43legacy_MACCMD_BEACON1_VALID 0x00000002
212 #define B43legacy_MACCMD_DFQ_VALID 0x00000004
213 #define B43legacy_MACCMD_CCA 0x00000008
214 #define B43legacy_MACCMD_BGNOISE 0x00000010
217 #define B43legacy_TMSLOW_GMODE 0x20000000
218 #define B43legacy_TMSLOW_PLLREFSEL 0x00200000
219 #define B43legacy_TMSLOW_MACPHYCLKEN 0x00100000
220 #define B43legacy_TMSLOW_PHYRESET 0x00080000
221 #define B43legacy_TMSLOW_PHYCLKEN 0x00040000
224 #define B43legacy_TMSHIGH_FCLOCK 0x00040000
225 #define B43legacy_TMSHIGH_GPHY 0x00010000
227 #define B43legacy_UCODEFLAG_AUTODIV 0x0001
230 #define B43legacy_IRQ_MAC_SUSPENDED 0x00000001
231 #define B43legacy_IRQ_BEACON 0x00000002
232 #define B43legacy_IRQ_TBTT_INDI 0x00000004
233 #define B43legacy_IRQ_BEACON_TX_OK 0x00000008
234 #define B43legacy_IRQ_BEACON_CANCEL 0x00000010
235 #define B43legacy_IRQ_ATIM_END 0x00000020
236 #define B43legacy_IRQ_PMQ 0x00000040
237 #define B43legacy_IRQ_PIO_WORKAROUND 0x00000100
238 #define B43legacy_IRQ_MAC_TXERR 0x00000200
239 #define B43legacy_IRQ_PHY_TXERR 0x00000800
240 #define B43legacy_IRQ_PMEVENT 0x00001000
241 #define B43legacy_IRQ_TIMER0 0x00002000
242 #define B43legacy_IRQ_TIMER1 0x00004000
243 #define B43legacy_IRQ_DMA 0x00008000
244 #define B43legacy_IRQ_TXFIFO_FLUSH_OK 0x00010000
245 #define B43legacy_IRQ_CCA_MEASURE_OK 0x00020000
246 #define B43legacy_IRQ_NOISESAMPLE_OK 0x00040000
247 #define B43legacy_IRQ_UCODE_DEBUG 0x08000000
248 #define B43legacy_IRQ_RFKILL 0x10000000
249 #define B43legacy_IRQ_TX_OK 0x20000000
250 #define B43legacy_IRQ_PHY_G_CHANGED 0x40000000
251 #define B43legacy_IRQ_TIMEOUT 0x80000000
253 #define B43legacy_IRQ_ALL 0xFFFFFFFF
254 #define B43legacy_IRQ_MASKTEMPLATE (B43legacy_IRQ_MAC_SUSPENDED | \
255 B43legacy_IRQ_TBTT_INDI | \
256 B43legacy_IRQ_ATIM_END | \
257 B43legacy_IRQ_PMQ | \
258 B43legacy_IRQ_MAC_TXERR | \
259 B43legacy_IRQ_PHY_TXERR | \
260 B43legacy_IRQ_DMA | \
261 B43legacy_IRQ_TXFIFO_FLUSH_OK | \
262 B43legacy_IRQ_NOISESAMPLE_OK | \
263 B43legacy_IRQ_UCODE_DEBUG | \
264 B43legacy_IRQ_RFKILL | \
270 #define B43legacy_CCK_RATE_1MB 2
271 #define B43legacy_CCK_RATE_2MB 4
272 #define B43legacy_CCK_RATE_5MB 11
273 #define B43legacy_CCK_RATE_11MB 22
274 #define B43legacy_OFDM_RATE_6MB 12
275 #define B43legacy_OFDM_RATE_9MB 18
276 #define B43legacy_OFDM_RATE_12MB 24
277 #define B43legacy_OFDM_RATE_18MB 36
278 #define B43legacy_OFDM_RATE_24MB 48
279 #define B43legacy_OFDM_RATE_36MB 72
280 #define B43legacy_OFDM_RATE_48MB 96
281 #define B43legacy_OFDM_RATE_54MB 108
283 #define B43legacy_RATE_TO_100KBPS(rate) (((rate) * 10) / 2)
286 #define B43legacy_DEFAULT_SHORT_RETRY_LIMIT 7
287 #define B43legacy_DEFAULT_LONG_RETRY_LIMIT 4
289 #define B43legacy_PHY_TX_BADNESS_LIMIT 1000
292 #define B43legacy_SEC_KEYSIZE 16
304 #define B43legacy_CIR_BASE 0xf00
305 #define B43legacy_CIR_SBTPSFLAG (B43legacy_CIR_BASE + 0x18)
306 #define B43legacy_CIR_SBIMSTATE (B43legacy_CIR_BASE + 0x90)
307 #define B43legacy_CIR_SBINTVEC (B43legacy_CIR_BASE + 0x94)
308 #define B43legacy_CIR_SBTMSTATELOW (B43legacy_CIR_BASE + 0x98)
309 #define B43legacy_CIR_SBTMSTATEHIGH (B43legacy_CIR_BASE + 0x9c)
310 #define B43legacy_CIR_SBIMCONFIGLOW (B43legacy_CIR_BASE + 0xa8)
311 #define B43legacy_CIR_SB_ID_HI (B43legacy_CIR_BASE + 0xfc)
314 #define B43legacy_SBTMSTATEHIGH_SERROR 0x00000001
315 #define B43legacy_SBTMSTATEHIGH_BUSY 0x00000004
316 #define B43legacy_SBTMSTATEHIGH_TIMEOUT 0x00000020
317 #define B43legacy_SBTMSTATEHIGH_G_PHY_AVAIL 0x00010000
318 #define B43legacy_SBTMSTATEHIGH_COREFLAGS 0x1FFF0000
319 #define B43legacy_SBTMSTATEHIGH_DMA64BIT 0x10000000
320 #define B43legacy_SBTMSTATEHIGH_GATEDCLK 0x20000000
321 #define B43legacy_SBTMSTATEHIGH_BISTFAILED 0x40000000
322 #define B43legacy_SBTMSTATEHIGH_BISTCOMPLETE 0x80000000
325 #define B43legacy_SBIMSTATE_IB_ERROR 0x20000
326 #define B43legacy_SBIMSTATE_TIMEOUT 0x40000
328 #define PFX KBUILD_MODNAME ": "
332 #ifdef CONFIG_B43LEGACY_DEBUG
333 # define B43legacy_WARN_ON(x) WARN_ON(x)
334 # define B43legacy_BUG_ON(expr) \
336 if (unlikely((expr))) { \
337 printk(KERN_INFO PFX "Test (%s) failed\n", \
342 # define B43legacy_DEBUG 1
345 static inline bool __b43legacy_warn_on_dummy(
bool x) {
return x; }
346 # define B43legacy_WARN_ON(x) __b43legacy_warn_on_dummy(unlikely(!!(x)))
347 # define B43legacy_BUG_ON(x) do { } while (0)
348 # define B43legacy_DEBUG 0
354 struct b43legacy_dmaring;
355 struct b43legacy_pioqueue;
358 #define B43legacy_FW_TYPE_UCODE 'u'
359 #define B43legacy_FW_TYPE_PCM 'p'
360 #define B43legacy_FW_TYPE_IV 'i'
373 #define B43legacy_IV_OFFSET_MASK 0x7FFF
374 #define B43legacy_IV_32BIT 0x8000
383 #define B43legacy_PHYMODE(phytype) (1 << (phytype))
384 #define B43legacy_PHYMODE_B B43legacy_PHYMODE \
385 ((B43legacy_PHYTYPE_B))
386 #define B43legacy_PHYMODE_G B43legacy_PHYMODE \
387 ((B43legacy_PHYTYPE_G))
395 #define B43legacy_LO_COUNT (14*4)
492 #define B43legacy_INTERFSTACK_SIZE 26
513 bool manual_txpower_control;
563 #define B43legacy_QOS_QUEUE_NUM 4
605 #ifdef CONFIG_B43LEGACY_HWRNG
608 char rng_name[30 + 1];
661 #define b43legacy_status(wldev) atomic_read(&(wldev)->__init_status)
662 #define b43legacy_set_status(wldev, stat) do { \
663 atomic_set(&(wldev)->__init_status, (stat)); \
741 #ifdef CONFIG_B43LEGACY_DEBUG
742 struct b43legacy_dfsentry *dfsentry;
756 #if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO)
762 #elif defined(CONFIG_B43LEGACY_DMA)
768 #elif defined(CONFIG_B43LEGACY_PIO)
775 # error "Using neither DMA nor PIO? Confused..."
782 struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
783 return ssb_get_drvdata(ssb_dev);
803 return ssb_read16(dev->
dev, offset);
809 ssb_write16(dev->
dev, offset, value);
815 return ssb_read32(dev->
dev, offset);
821 ssb_write32(dev->
dev, offset, value);
826 u16 radio_attenuation,
827 u16 baseband_attenuation)
829 return phy->
_lo_pairs + (radio_attenuation
830 + 14 * (baseband_attenuation / 2));
846 # define b43legacydbg(wl, fmt...) do { } while (0)
850 #define Q52_FMT "%u.%u"
851 #define Q52_ARG(q52) ((q52) / 4), (((q52) & 3) * 100 / 4)