3 * Common definitions to all pieces of the various orinoco
10 #define DRIVER_VERSION "0.15"
12 #include <linux/interrupt.h>
13 #include <linux/suspend.h>
14 #include <linux/netdevice.h>
15 #include <linux/wireless.h>
16 #include <net/iw_handler.h>
17 #include <net/cfg80211.h>
21 /* To enable debug messages */
22 /*#define ORINOCO_DEBUG 3*/
24 #define WIRELESS_SPY /* enable iwspy support */
26 #define MAX_SCAN_LEN 4096
28 #define ORINOCO_MAX_KEY_SIZE 14
29 #define ORINOCO_MAX_KEYS 4
32 __le16 len; /* always stored as little-endian */
33 char data[ORINOCO_MAX_KEY_SIZE];
34 } __attribute__ ((packed));
36 #define TKIP_KEYLEN 16
39 struct orinoco_tkip_key {
41 u8 tx_mic[MIC_KEYLEN];
42 u8 rx_mic[MIC_KEYLEN];
47 FIRMWARE_TYPE_INTERSIL,
53 struct orinoco_private {
54 void *card; /* Pointer to card dependent structure */
56 int (*hard_reset)(struct orinoco_private *);
57 int (*stop_fw)(struct orinoco_private *, int);
59 struct ieee80211_supported_band band;
60 struct ieee80211_channel channels[14];
63 /* Synchronisation stuff */
66 struct work_struct reset_work;
68 /* Interrupt tasklets */
69 struct tasklet_struct rx_tasklet;
70 struct list_head rx_list;
75 struct work_struct join_work;
76 struct work_struct wevent_work;
78 /* Net device stuff */
79 struct net_device *ndev;
80 struct net_device_stats stats;
81 struct iw_statistics wstats;
83 /* Hardware control variables */
87 /* Capabilities of the hardware/firmware */
88 fwtype_t firmware_type;
94 /* Boolean capabilities */
95 unsigned int has_ibss:1;
96 unsigned int has_port3:1;
97 unsigned int has_wep:1;
98 unsigned int has_big_wep:1;
99 unsigned int has_mwo:1;
100 unsigned int has_pm:1;
101 unsigned int has_preamble:1;
102 unsigned int has_sensitivity:1;
103 unsigned int has_hostscan:1;
104 unsigned int has_alt_txcntl:1;
105 unsigned int has_ext_scan:1;
106 unsigned int has_wpa:1;
107 unsigned int do_fw_download:1;
108 unsigned int broken_disableport:1;
109 unsigned int broken_monitor:1;
111 /* Configuration paramaters */
112 enum nl80211_iftype iw_mode;
114 u16 encode_alg, wep_restrict, tx_key;
115 struct orinoco_key keys[ORINOCO_MAX_KEYS];
117 char nick[IW_ESSID_MAX_SIZE+1];
118 char desired_essid[IW_ESSID_MAX_SIZE+1];
119 char desired_bssid[ETH_ALEN];
121 u16 frag_thresh, mwo_robust;
123 u16 ap_density, rts_thresh;
124 u16 pm_on, pm_mcast, pm_period, pm_timeout;
127 struct iw_spy_data spy_data; /* iwspy support */
128 struct iw_public_data wireless_data;
131 /* Configuration dependent variables */
132 int port_type, createibss;
133 int promiscuous, mc_count;
135 /* Scanning support */
136 struct cfg80211_scan_request *scan_request;
137 struct work_struct process_scan;
138 struct list_head scan_list;
139 spinlock_t scan_lock; /* protects the scan list */
145 struct orinoco_tkip_key tkip_key[ORINOCO_MAX_KEYS];
146 struct crypto_hash *rx_tfm_mic;
147 struct crypto_hash *tx_tfm_mic;
149 unsigned int wpa_enabled:1;
150 unsigned int tkip_cm_active:1;
151 unsigned int key_mgmt:3;
153 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
154 /* Cached in memory firmware to use during ->resume. */
155 const struct firmware *cached_pri_fw;
156 const struct firmware *cached_fw;
159 struct notifier_block pm_notifier;
163 extern int orinoco_debug;
164 #define DEBUG(n, args...) do { \
165 if (orinoco_debug > (n)) \
166 printk(KERN_DEBUG args); \
169 #define DEBUG(n, args...) do { } while (0)
170 #endif /* ORINOCO_DEBUG */
172 /********************************************************************/
173 /* Exported prototypes */
174 /********************************************************************/
176 extern struct orinoco_private *alloc_orinocodev(
177 int sizeof_card, struct device *device,
178 int (*hard_reset)(struct orinoco_private *),
179 int (*stop_fw)(struct orinoco_private *, int));
180 extern void free_orinocodev(struct orinoco_private *priv);
181 extern int orinoco_init(struct orinoco_private *priv);
182 extern int orinoco_if_add(struct orinoco_private *priv,
183 unsigned long base_addr,
185 extern void orinoco_if_del(struct orinoco_private *priv);
186 extern int orinoco_up(struct orinoco_private *priv);
187 extern void orinoco_down(struct orinoco_private *priv);
188 extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
190 /********************************************************************/
191 /* Locking and synchronization functions */
192 /********************************************************************/
194 static inline int orinoco_lock(struct orinoco_private *priv,
195 unsigned long *flags)
197 spin_lock_irqsave(&priv->lock, *flags);
198 if (priv->hw_unavailable) {
199 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
201 spin_unlock_irqrestore(&priv->lock, *flags);
207 static inline void orinoco_unlock(struct orinoco_private *priv,
208 unsigned long *flags)
210 spin_unlock_irqrestore(&priv->lock, *flags);
213 /*** Navigate from net_device to orinoco_private ***/
214 static inline struct orinoco_private *ndev_priv(struct net_device *dev)
216 struct wireless_dev *wdev = netdev_priv(dev);
217 return wdev_priv(wdev);
219 #endif /* _ORINOCO_H */