5 * acxpci.h: PCI related constants and structures.
7 * Copyright (c) 2008 Francis Galiegue <fgaliegue@gmail.com> for the ACX100
10 * This file is licensed under the GPLv2. See the README file for details.
13 #include "acx_config.h" /* For PARANOID_LOCKING */
14 #include "acx_mac80211.h" /* For struct acx_interface */
20 /* Register I/O offsets */
21 #define ACX100_EEPROM_ID_OFFSET 0x380
24 * Please add further ACX hardware register definitions only when
25 * it turns out you need them in the driver, and please try to use firmware
26 * functionality instead, since using direct I/O access instead of letting the
27 * firmware do it might confuse the firmware's state machine.
30 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
31 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
34 * NOTE about ACX_IO_IRQ_REASON: this register is CLEARED ON READ.
36 #define ACX_IO_SOFT_RESET 0
37 #define ACX_IO_SLV_MEM_ADDR 1
38 #define ACX_IO_SLV_MEM_DATA 2
39 #define ACX_IO_SLV_MEM_CTL 3
40 #define ACX_IO_SLV_END_CTL 4
42 * Original code said that the following is the "function event mask". Whatever
46 #define ACX_IO_INT_TRIG 6
47 #define ACX_IO_IRQ_MASK 7
48 #define ACX_IO_IRQ_STATUS_NON_DES 8
49 #define ACX_IO_IRQ_REASON 9
50 #define ACX_IO_IRQ_ACK 10
51 #define ACX_IO_HINT_TRIG 11
52 #define ACX_IO_ENABLE 12
53 #define ACX_IO_EEPROM_CTL 13
54 #define ACX_IO_EEPROM_ADDR 14
55 #define ACX_IO_EEPROM_DATA 15
56 #define ACX_IO_EEPROM_CFG 16
57 #define ACX_IO_PHY_ADDR 17
58 #define ACX_IO_PHY_DATA 18
59 #define ACX_IO_PHY_CTL 19
60 #define ACX_IO_GPIO_OE 20
61 #define ACX_IO_GPIO_OUT 21
62 #define ACX_IO_CMD_MAILBOX_OFFS 22
63 #define ACX_IO_INFO_MAILBOX_OFFS 23
64 #define ACX_IO_EEPROM_INFORMATION 24
65 #define ACX_IO_EE_START 25
66 #define ACX_IO_SOR_CFG 26
67 #define ACX_IO_ECPU_CTRL 27
68 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
69 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
71 /* Values for ACX_IO_INT_TRIG register: */
72 /* inform hw that rxdesc in queue needs processing */
73 #define INT_TRIG_RXPRC 0x08
74 /* inform hw that txdesc in queue needs processing */
75 #define INT_TRIG_TXPRC 0x04
76 /* ack that we received info from info mailbox */
77 #define INT_TRIG_INFOACK 0x02
78 /* inform hw that we have filled command mailbox */
79 #define INT_TRIG_CMD 0x01
82 * In-hardware TX/RX structures
86 acx_ptr data_phy
; /* 0x00 [u8 *] */
87 u16 data_offset
; /* 0x04 */
88 u16 reserved
; /* 0x06 */
89 u16 Ctl_16
; /* 16bit value, endianness!! */
90 u16 length
; /* 0x0a */
91 acx_ptr desc_phy_next
; /* 0x0c [txhostdesc *] */
92 acx_ptr pNext
; /* 0x10 [txhostdesc *] */
93 u32 Status
; /* 0x14, unused on Tx */
94 /* From here on you can use this area as you want (variable length, too!) */
96 struct ieee80211_tx_status txstatus
;
99 } __attribute__ ((packed
));
102 acx_ptr data_phy
; /* 0x00 [rxbuffer_t *] */
103 u16 data_offset
; /* 0x04 */
104 u16 reserved
; /* 0x06 */
105 u16 Ctl_16
; /* 0x08; 16bit value, endianness!! */
106 u16 length
; /* 0x0a */
107 acx_ptr desc_phy_next
; /* 0x0c [rxhostdesc_t *] */
108 acx_ptr pNext
; /* 0x10 [rxhostdesc_t *] */
109 u32 Status
; /* 0x14 */
110 /* From here on you can use this area as you want (variable length, too!) */
112 } __attribute__ ((packed
));
115 * acx_device structure: the ->priv part of the ieee80211_hw structure
120 /* most frequent accesses first (dereferencing and cache line!) */
131 /* The IRQ we have inherited */
133 /* Are IRQs currently activated? FIXME: should get rid of this */
135 /* The interrupts we can acknowledge (see acx_irq.h) */
137 /* The mask of IRQs saved by the IRQ top half routine */
140 * FIXME: these ones should disappear
142 unsigned int irq_loops_this_jiffy
;
143 unsigned long irq_last_jiffies
;
144 /* Barely used in USB case (FIXME?) */
146 int irq_reason
; /* FIXME: should be u16 */
147 /* Mask of jobs we have to schedule post interrupt */
148 u8 after_interrupt_jobs
;
150 * Work queue for the bottom half. FIXME: only one, consider a
151 * delayed_work struct some day?
153 struct work_struct after_interrupt_task
;
154 #if defined(PARANOID_LOCKING) /* Lock debugging */
155 const char *last_sem
;
156 const char *last_lock
;
157 unsigned long sem_time
;
158 unsigned long lock_time
;
161 /*** Linux network device ***/
162 //struct device *dev; /* pointer to linux netdevice */
164 /*** Device statistics ***/
165 struct ieee80211_low_level_stats ieee_stats
; /* wireless device statistics */
167 /*** Device statistics ***/
168 struct net_device_stats stats
; /* net device statistics */
171 // struct iw_statistics wstats; /* wireless statistics */
173 struct ieee80211_hw
*ieee
;
174 struct ieee80211_hw_mode modes
[2];
175 struct ieee80211_rx_status rx_status
;
177 struct ieee80211_vif
*vif
;
179 /*** Power managment ***/
180 struct pm_dev
*pm
; /* PM crap */
182 /*** Management timer ***/
183 struct timer_list mgmt_timer
;
185 /*** Hardware identification ***/
186 const char *chip_name
;
192 /*** Config retrieved from EEPROM ***/
194 u16 cfgopt_NVS_vendor_offs
;
196 u16 cfgopt_probe_delay
;
197 u32 cfgopt_eof_memory
;
198 u8 cfgopt_dot11CCAModes
;
199 u8 cfgopt_dot11Diversity
;
200 u8 cfgopt_dot11ShortPreambleOption
;
201 u8 cfgopt_dot11PBCCOption
;
202 u8 cfgopt_dot11ChannelAgility
;
203 u8 cfgopt_dot11PhyType
;
204 u8 cfgopt_dot11TempType
;
205 co_antennas_t cfgopt_antennas
;
206 co_powerlevels_t cfgopt_power_levels
;
207 co_datarates_t cfgopt_data_rates
;
208 co_domains_t cfgopt_domains
;
209 co_product_id_t cfgopt_product_id
;
210 co_manuf_t cfgopt_manufacturer
;
212 /*** Firmware identification ***/
213 char firmware_version
[FW_ID_SIZE
+1];
217 const u16
*ie_len_dot11
;
219 /*** Device state ***/
221 u8 led_power
; /* power LED status */
222 u32 get_mask
; /* mask of settings to fetch from the card */
223 u32 set_mask
; /* mask of settings to write to the card */
228 u16 scan_count
; /* number of times to do channel scan */
229 u8 scan_mode
; /* 0 == active, 1 == passive, 2 == background */
232 u16 scan_probe_delay
;
233 #if WIRELESS_EXT > 15
234 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
237 /*** Virtual interface struct ***/
238 struct acx_interface interface
;
240 /*** Wireless network settings ***/
241 /* copy of the device address (ifconfig hw ether) that we actually use
242 ** for 802.11; copied over from the network device's MAC address
243 ** (ifconfig) when it makes sense only */
244 u8 dev_addr
[MAX_ADDR_LEN
];
245 u8 bssid
[ETH_ALEN
]; /* the BSSID after having joined */
246 u8 ap
[ETH_ALEN
]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
247 u16 aid
; /* The Association ID sent from the AP / last used AID if we're an AP */
248 u16 mode
; /* mode from iwconfig */
249 int monitor_type
; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
250 u16 status
; /* 802.11 association status */
251 u8 essid_active
; /* specific ESSID active, or select any? */
252 u8 essid_len
; /* to avoid dozens of strlen() */
253 /* INCLUDES \0 termination for easy printf - but many places
254 ** simply want the string data memcpy'd plus a length indicator!
255 ** Keep that in mind... */
256 char essid
[IW_ESSID_MAX_SIZE
+1];
257 /* essid we are going to use for association, in case of "essid 'any'"
258 ** and in case of hidden ESSID (use configured ESSID then) */
259 char essid_for_assoc
[IW_ESSID_MAX_SIZE
+1];
260 char nick
[IW_ESSID_MAX_SIZE
+1]; /* see essid! */
262 u8 reg_dom_id
; /* reg domain setting */
263 u16 reg_dom_chanmask
;
264 u16 auth_or_assoc_retries
;
266 unsigned long scan_start
; /* YES, jiffies is defined as "unsigned long" */
269 /* MAC80211 Template Reference */
270 struct sk_buff
*beacon_cache
;
271 /* stations known to us (if we're an ap) */
272 // client_t sta_list[32]; /* tab is larger than list, so that */
273 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
274 // client_t *ap_client; /* this one is our AP (STA mode only) */
278 unsigned long dup_msg_expiry
;
279 u16 last_seq_ctrl
; /* duplicate packet detection */
281 /* 802.11 power save mode */
283 u8 ps_listen_interval
;
285 u8 ps_hangover_period
;
286 u32 ps_enhanced_transition_time
;
287 u32 ps_beacon_rx_time
;
289 /*** PHY settings ***/
290 u8 fallback_threshold
;
296 u8 rate_auto
; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
297 u8 preamble_mode
; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
302 /* u8 tx_level_val; */
303 /* u8 tx_level_auto; whether to do automatic power adjustment */
305 unsigned long recalib_time_last_success
;
306 unsigned long recalib_time_last_attempt
;
307 int recalib_failure_count
;
308 int recalib_msg_ratelimit
;
309 int retry_errors_msg_ratelimit
;
311 unsigned long brange_time_last_state_change
; /* time the power LED was last changed */
312 u8 brange_last_state
; /* last state of the LED */
313 u8 brange_max_quality
; /* maximum quality that equates to full speed */
316 u8 antenna
; /* antenna settings */
317 u8 ed_threshold
; /* energy detect threshold */
318 u8 cca
; /* clear channel assessment */
325 u16 listen_interval
; /* given in units of beacon interval */
329 u8 rate_supported_len
;
330 u8 rate_supported
[13];
332 /*** Encryption settings (WEP) ***/
333 u32 auth_alg
; /* used in transmit_authen1 */
336 u8 wep_current_index
;
337 wep_key_t wep_keys
[DOT11_MAX_DEFAULT_WEP_KEYS
]; /* the default WEP keys */
339 key_struct_t wep_key_struct
[10];
341 /*** Encryption Replacement for mac80211 ***/
342 struct acx_key key
[54];
350 /*** Card Rx/Tx management ***/
354 unsigned int tx_free
;
355 unsigned int tx_head
; /* keep as close as possible to Tx stuff below (cache line) */
358 /*************************************************************************
359 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
360 *************************************************************************/
362 * Bus specific (PCI here) code.
364 * The original header file said "must be last or else hw agnostic code
365 * breaks horribly" - huh?
368 /* hack to let common code compile. FIXME */
369 dma_addr_t rxhostdesc_startphy
;
371 /* pointers to tx buffers, tx host descriptors (in host memory)
372 ** and tx descs in device memory */
373 unsigned int tx_tail
;
375 txhostdesc_t
*txhostdesc_start
;
376 txdesc_t
*txdesc_start
; /* points to PCI-mapped memory */
377 dma_addr_t txbuf_startphy
;
378 dma_addr_t txhostdesc_startphy
;
379 /* sizes of above host memory areas */
380 unsigned int txbuf_area_size
;
381 unsigned int txhostdesc_area_size
;
383 unsigned int txdesc_size
; /* size of txdesc; ACX111 = ACX100 + 4 */
384 client_t
*txc
[TX_CNT
];
388 unsigned int rx_tail
;
389 rxbuffer_t
*rxbuf_start
;
390 rxhostdesc_t
*rxhostdesc_start
;
391 rxdesc_t
*rxdesc_start
;
392 /* physical addresses of above host memory areas */
393 dma_addr_t rxbuf_startphy
;
394 /* dma_addr_t rxhostdesc_startphy; */
395 unsigned int rxbuf_area_size
;
396 unsigned int rxhostdesc_area_size
;
400 const u16
*io
; /* points to ACX100 or ACX111 PCI I/O register address set */
403 struct pci_dev
*pdev
;
406 struct vlynq_device
*vdev
;
408 struct device
*bus_dev
;
409 unsigned long membase
;
410 unsigned long membase2
;
411 void __iomem
*iobase
;
412 void __iomem
*iobase2
;
413 /* command interface */
414 u8 __iomem
*cmd_area
;
415 u8 __iomem
*info_area
;
419 #endif /* _ACXPCI_H_ */