Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p54.h
Go to the documentation of this file.
1 /*
2  * Shared defines for all mac80211 Prism54 code
3  *
4  * Copyright (c) 2006, Michael Wu <[email protected]>
5  *
6  * Based on the islsm (softmac prism54) driver, which is:
7  * Copyright 2004-2006 Jean-Baptiste Note <[email protected]>, et al.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13 
14 #ifndef P54_H
15 #define P54_H
16 
17 #ifdef CONFIG_P54_LEDS
18 #include <linux/leds.h>
19 #endif /* CONFIG_P54_LEDS */
20 
21 #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000
22 
23 #define BR_CODE_MIN 0x80000000
24 #define BR_CODE_COMPONENT_ID 0x80000001
25 #define BR_CODE_COMPONENT_VERSION 0x80000002
26 #define BR_CODE_DEPENDENT_IF 0x80000003
27 #define BR_CODE_EXPOSED_IF 0x80000004
28 #define BR_CODE_DESCR 0x80000101
29 #define BR_CODE_MAX 0x8FFFFFFF
30 #define BR_CODE_END_OF_BRA 0xFF0000FF
31 #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
32 
33 struct bootrec {
36  u32 data[10];
37 } __packed;
38 
39 /* Interface role definitions */
40 #define BR_INTERFACE_ROLE_SERVER 0x0000
41 #define BR_INTERFACE_ROLE_CLIENT 0x8000
42 
43 #define BR_DESC_PRIV_CAP_WEP BIT(0)
44 #define BR_DESC_PRIV_CAP_TKIP BIT(1)
45 #define BR_DESC_PRIV_CAP_MICHAEL BIT(2)
46 #define BR_DESC_PRIV_CAP_CCX_CP BIT(3)
47 #define BR_DESC_PRIV_CAP_CCX_MIC BIT(4)
48 #define BR_DESC_PRIV_CAP_AESCCMP BIT(5)
49 
50 struct bootrec_desc {
63  u8 rates[16];
66 } __packed;
67 
68 #define FW_FMAC 0x464d4143
69 #define FW_LM86 0x4c4d3836
70 #define FW_LM87 0x4c4d3837
71 #define FW_LM20 0x4c4d3230
72 
75 } __packed;
76 
78  char fw_version[24];
79 } __packed;
80 
81 struct bootrec_end {
83  u8 padding[2];
84  u8 md5[16];
85 } __packed;
86 
87 /* provide 16 bytes for the transport back-end */
88 #define P54_TX_INFO_DATA_SIZE 16
89 
90 /* stored in ieee80211_tx_info's rate_driver_data */
91 struct p54_tx_info {
94  union {
95  void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)];
96  struct {
98  };
99  };
100 };
101 
102 #define P54_MAX_CTRL_FRAME_LEN 0x1000
103 
104 #define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, _txop) \
105 do { \
106  queue.aifs = cpu_to_le16(ai_fs); \
107  queue.cwmin = cpu_to_le16(cw_min); \
108  queue.cwmax = cpu_to_le16(cw_max); \
109  queue.txop = cpu_to_le16(_txop); \
110 } while (0)
111 
117 } __packed;
118 
125 };
126 
128  size_t entries;
129  size_t entry_size;
130  size_t offset;
131  size_t len;
132  u8 data[0];
133 };
134 
135 #define EEPROM_READBACK_LEN 0x3fc
136 
137 enum fw_state {
143 };
144 
145 #ifdef CONFIG_P54_LEDS
146 
147 #define P54_LED_MAX_NAME_LEN 31
148 
149 struct p54_led_dev {
150  struct ieee80211_hw *hw_dev;
151  struct led_classdev led_dev;
152  char name[P54_LED_MAX_NAME_LEN + 1];
153 
154  unsigned int toggled;
155  unsigned int index;
156  unsigned int registered;
157 };
158 
159 #endif /* CONFIG_P54_LEDS */
160 
162  unsigned int len;
163  unsigned int limit;
164  unsigned int count;
165 };
166 
167 struct p54_common {
168  struct ieee80211_hw *hw;
170  void (*tx)(struct ieee80211_hw *dev, struct sk_buff *skb);
171  int (*open)(struct ieee80211_hw *dev);
172  void (*stop)(struct ieee80211_hw *dev);
177 
178  /* memory management (as seen by the firmware) */
184 
185  /* firmware/hardware info */
186  unsigned int tx_hdr_len;
187  unsigned int fw_var;
188  unsigned int fw_interface;
190 
191  /* (e)DCF / QOS state */
196 
197  /* Radio data */
201  unsigned int output_power;
205  unsigned int chan_num;
208  struct {
209  unsigned int timestamp;
210  unsigned int cached_cca;
211  unsigned int cached_tx;
212  unsigned int cached_rssi;
217  } survey_raw;
218 
219  int noise;
220  /* calibration, output power limit and rssi<->dBm conversation data */
222  unsigned int iq_autocal_len;
227 
228  /* BBP/MAC state */
233  unsigned int filter_flags;
235  int mode;
240  bool phy_idle;
241  bool phy_ps;
245 
246  /* cryptographic engine information */
249  unsigned long *used_rxkeys;
250 
251  /* LED management */
252 #ifdef CONFIG_P54_LEDS
253  struct p54_led_dev leds[4];
254  struct delayed_work led_work;
255 #endif /* CONFIG_P54_LEDS */
256  u16 softled_state; /* bit field of glowing LEDs */
257 
258  /* statistics */
261 
262  /* eeprom handling */
263  void *eeprom;
266 };
267 
268 /* interfaces for the drivers */
269 int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
270 void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb);
271 int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw);
272 int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
273 int p54_read_eeprom(struct ieee80211_hw *dev);
274 
275 struct ieee80211_hw *p54_init_common(size_t priv_data_len);
276 int p54_register_common(struct ieee80211_hw *dev, struct device *pdev);
277 void p54_free_common(struct ieee80211_hw *dev);
278 
280 
281 #endif /* P54_H */