Reverted refactoring of 'interrogate' cmds to 'query'
[acx-mac80211.git] / acx_struct_pci.h
blobaee87ac1b05468c8dd9b99db0fd4f30cb7b75a23
1 #ifndef _ACXPCI_H_
2 #define _ACXPCI_H_
4 /*
5 * acxpci.h: PCI related constants and structures.
7 * Copyright (c) 2008 Francis Galiegue <fgaliegue@gmail.com> for the ACX100
8 * driver project.
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 */
17 * MMIO registers
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
43 * that means.
45 #define ACX_IO_FEMR 5
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
85 struct txhostdesc {
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!) */
95 u8 *data;
96 struct ieee80211_tx_status txstatus;
97 struct sk_buff *skb;
99 } __attribute__ ((packed));
101 struct rxhostdesc {
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!) */
111 rxbuffer_t *data;
112 } __attribute__ ((packed));
115 * acx_device structure: the ->priv part of the ieee80211_hw structure
118 #if 0
119 struct acx_device {
120 /* most frequent accesses first (dereferencing and cache line!) */
123 * Locking
125 struct mutex mutex;
126 spinlock_t spinlock;
127 spinlock_t irqlock;
129 * IRQ handling
131 /* The IRQ we have inherited */
132 unsigned int irq;
133 /* Are IRQs currently activated? FIXME: should get rid of this */
134 u8 irqs_active;
135 /* The interrupts we can acknowledge (see acx_irq.h) */
136 u16 irq_mask;
137 /* The mask of IRQs saved by the IRQ top half routine */
138 u16 irq_saved_mask;
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?) */
145 u16 irq_status;
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;
159 #endif
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 */
170 #ifdef WIRELESS_EXT
171 // struct iw_statistics wstats; /* wireless statistics */
172 #endif
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;
187 u8 chip_type;
188 u8 form_factor;
189 u8 radio_type;
190 u8 eeprom_version;
192 /*** Config retrieved from EEPROM ***/
193 char cfgopt_NVSv[8];
194 u16 cfgopt_NVS_vendor_offs;
195 u8 cfgopt_MAC[6];
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];
214 u32 firmware_numver;
215 u32 firmware_id;
216 const u16 *ie_len;
217 const u16 *ie_len_dot11;
219 /*** Device state ***/
220 u16 dev_state_mask;
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 */
224 u32 initialized:1;
227 /*** scanning ***/
228 u16 scan_count; /* number of times to do channel scan */
229 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
230 u8 scan_rate;
231 u16 scan_duration;
232 u16 scan_probe_delay;
233 #if WIRELESS_EXT > 15
234 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
235 #endif
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! */
261 u8 channel;
262 u8 reg_dom_id; /* reg domain setting */
263 u16 reg_dom_chanmask;
264 u16 auth_or_assoc_retries;
265 u16 scan_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) */
276 int dup_count;
277 int nondup_count;
278 unsigned long dup_msg_expiry;
279 u16 last_seq_ctrl; /* duplicate packet detection */
281 /* 802.11 power save mode */
282 u8 ps_wakeup_cfg;
283 u8 ps_listen_interval;
284 u8 ps_options;
285 u8 ps_hangover_period;
286 u32 ps_enhanced_transition_time;
287 u32 ps_beacon_rx_time;
289 /*** PHY settings ***/
290 u8 fallback_threshold;
291 u8 stepup_threshold;
292 u16 rate_basic;
293 u16 rate_oper;
294 u16 rate_bcast;
295 u16 rate_bcast100;
296 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
297 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
298 u8 preamble_cur;
300 u8 tx_disabled;
301 u8 tx_level_dbm;
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 */
315 u8 sensitivity;
316 u8 antenna; /* antenna settings */
317 u8 ed_threshold; /* energy detect threshold */
318 u8 cca; /* clear channel assessment */
320 u16 rts_threshold;
321 u16 frag_threshold;
322 u32 short_retry;
323 u32 long_retry;
324 u16 msdu_lifetime;
325 u16 listen_interval; /* given in units of beacon interval */
326 u32 beacon_interval;
328 u16 capabilities;
329 u8 rate_supported_len;
330 u8 rate_supported[13];
332 /*** Encryption settings (WEP) ***/
333 u32 auth_alg; /* used in transmit_authen1 */
334 u8 wep_enabled;
335 u8 wep_restricted;
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];
343 u16 security_offset;
344 u8 default_key_idx;
347 /*** Unknown ***/
348 u8 dtim_interval;
350 /*** Card Rx/Tx management ***/
351 u16 rx_config_1;
352 u16 rx_config_2;
353 u16 memblocksize;
354 unsigned int tx_free;
355 unsigned int tx_head; /* keep as close as possible to Tx stuff below (cache line) */
356 u16 phy_header_len;
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;
374 u8 *txbuf_start;
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];
385 u16 txr[TX_CNT];
387 /* same for rx */
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;
398 u8 need_radio_fw;
400 const u16 *io; /* points to ACX100 or ACX111 PCI I/O register address set */
402 #ifdef CONFIG_PCI
403 struct pci_dev *pdev;
404 #endif
405 #ifdef CONFIG_VLYNQ
406 struct vlynq_device *vdev;
407 #endif
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;
417 #endif
419 #endif /* _ACXPCI_H_ */