2005-04-17 05:20:36 +07:00
|
|
|
/* orinoco.h
|
2009-01-26 03:08:43 +07:00
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* Common definitions to all pieces of the various orinoco
|
|
|
|
* drivers
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ORINOCO_H
|
|
|
|
#define _ORINOCO_H
|
|
|
|
|
2006-04-07 15:11:02 +07:00
|
|
|
#define DRIVER_VERSION "0.15"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-08-22 05:28:04 +07:00
|
|
|
#include <linux/interrupt.h>
|
2008-11-22 17:37:28 +07:00
|
|
|
#include <linux/suspend.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/wireless.h>
|
2005-09-10 05:43:02 +07:00
|
|
|
#include <net/iw_handler.h>
|
2009-06-19 05:21:26 +07:00
|
|
|
#include <net/cfg80211.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include "hermes.h"
|
|
|
|
|
|
|
|
/* To enable debug messages */
|
2009-01-26 03:08:43 +07:00
|
|
|
/*#define ORINOCO_DEBUG 3*/
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-01-26 03:08:43 +07:00
|
|
|
#define WIRELESS_SPY /* enable iwspy support */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-06-19 06:27:51 +07:00
|
|
|
#define MAX_SCAN_LEN 4096
|
|
|
|
|
2009-08-06 03:23:28 +07:00
|
|
|
#define ORINOCO_SEQ_LEN 8
|
2005-04-17 05:20:36 +07:00
|
|
|
#define ORINOCO_MAX_KEY_SIZE 14
|
|
|
|
#define ORINOCO_MAX_KEYS 4
|
|
|
|
|
|
|
|
struct orinoco_key {
|
2005-09-23 15:18:06 +07:00
|
|
|
__le16 len; /* always stored as little-endian */
|
2005-04-17 05:20:36 +07:00
|
|
|
char data[ORINOCO_MAX_KEY_SIZE];
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2008-08-22 05:28:02 +07:00
|
|
|
#define TKIP_KEYLEN 16
|
|
|
|
#define MIC_KEYLEN 8
|
|
|
|
|
|
|
|
struct orinoco_tkip_key {
|
|
|
|
u8 tkip[TKIP_KEYLEN];
|
|
|
|
u8 tx_mic[MIC_KEYLEN];
|
|
|
|
u8 rx_mic[MIC_KEYLEN];
|
|
|
|
};
|
|
|
|
|
2009-08-06 03:23:28 +07:00
|
|
|
enum orinoco_alg {
|
|
|
|
ORINOCO_ALG_NONE,
|
|
|
|
ORINOCO_ALG_WEP,
|
|
|
|
ORINOCO_ALG_TKIP
|
|
|
|
};
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
typedef enum {
|
|
|
|
FIRMWARE_TYPE_AGERE,
|
|
|
|
FIRMWARE_TYPE_INTERSIL,
|
|
|
|
FIRMWARE_TYPE_SYMBOL
|
|
|
|
} fwtype_t;
|
|
|
|
|
2008-10-19 15:06:11 +07:00
|
|
|
struct firmware;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct orinoco_private {
|
|
|
|
void *card; /* Pointer to card dependent structure */
|
2008-08-22 05:27:54 +07:00
|
|
|
struct device *dev;
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*hard_reset)(struct orinoco_private *);
|
2008-08-22 05:27:54 +07:00
|
|
|
int (*stop_fw)(struct orinoco_private *, int);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-06-19 05:21:26 +07:00
|
|
|
struct ieee80211_supported_band band;
|
|
|
|
struct ieee80211_channel channels[14];
|
|
|
|
u32 cipher_suites[3];
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* Synchronisation stuff */
|
|
|
|
spinlock_t lock;
|
|
|
|
int hw_unavailable;
|
|
|
|
struct work_struct reset_work;
|
|
|
|
|
2008-08-22 05:28:04 +07:00
|
|
|
/* Interrupt tasklets */
|
|
|
|
struct tasklet_struct rx_tasklet;
|
|
|
|
struct list_head rx_list;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* driver state */
|
|
|
|
int open;
|
|
|
|
u16 last_linkstatus;
|
2005-06-19 06:27:51 +07:00
|
|
|
struct work_struct join_work;
|
2005-06-19 06:27:56 +07:00
|
|
|
struct work_struct wevent_work;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Net device stuff */
|
|
|
|
struct net_device *ndev;
|
|
|
|
struct net_device_stats stats;
|
|
|
|
struct iw_statistics wstats;
|
|
|
|
|
|
|
|
/* Hardware control variables */
|
|
|
|
hermes_t hw;
|
|
|
|
u16 txfid;
|
|
|
|
|
|
|
|
/* Capabilities of the hardware/firmware */
|
|
|
|
fwtype_t firmware_type;
|
|
|
|
int ibss_port;
|
|
|
|
int nicbuf_size;
|
|
|
|
u16 channel_mask;
|
|
|
|
|
|
|
|
/* Boolean capabilities */
|
|
|
|
unsigned int has_ibss:1;
|
|
|
|
unsigned int has_port3:1;
|
|
|
|
unsigned int has_wep:1;
|
|
|
|
unsigned int has_big_wep:1;
|
|
|
|
unsigned int has_mwo:1;
|
|
|
|
unsigned int has_pm:1;
|
|
|
|
unsigned int has_preamble:1;
|
|
|
|
unsigned int has_sensitivity:1;
|
2005-06-19 06:27:56 +07:00
|
|
|
unsigned int has_hostscan:1;
|
2008-08-22 05:27:56 +07:00
|
|
|
unsigned int has_alt_txcntl:1;
|
2008-08-22 05:27:58 +07:00
|
|
|
unsigned int has_ext_scan:1;
|
2008-08-22 05:28:02 +07:00
|
|
|
unsigned int has_wpa:1;
|
2008-08-22 05:27:54 +07:00
|
|
|
unsigned int do_fw_download:1;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int broken_disableport:1;
|
2005-06-19 06:28:06 +07:00
|
|
|
unsigned int broken_monitor:1;
|
2009-08-06 03:23:27 +07:00
|
|
|
unsigned int prefer_port3:1;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Configuration paramaters */
|
2009-06-19 05:21:32 +07:00
|
|
|
enum nl80211_iftype iw_mode;
|
2009-08-06 03:23:28 +07:00
|
|
|
enum orinoco_alg encode_alg;
|
|
|
|
u16 wep_restrict, tx_key;
|
2009-08-06 03:23:32 +07:00
|
|
|
struct key_params keys[ORINOCO_MAX_KEYS];
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
int bitratemode;
|
2009-01-26 03:08:43 +07:00
|
|
|
char nick[IW_ESSID_MAX_SIZE+1];
|
2005-04-17 05:20:36 +07:00
|
|
|
char desired_essid[IW_ESSID_MAX_SIZE+1];
|
2005-06-19 06:27:51 +07:00
|
|
|
char desired_bssid[ETH_ALEN];
|
|
|
|
int bssid_fixed;
|
2005-04-17 05:20:36 +07:00
|
|
|
u16 frag_thresh, mwo_robust;
|
|
|
|
u16 channel;
|
|
|
|
u16 ap_density, rts_thresh;
|
|
|
|
u16 pm_on, pm_mcast, pm_period, pm_timeout;
|
|
|
|
u16 preamble;
|
|
|
|
#ifdef WIRELESS_SPY
|
2009-01-26 03:08:43 +07:00
|
|
|
struct iw_spy_data spy_data; /* iwspy support */
|
2005-09-10 05:43:02 +07:00
|
|
|
struct iw_public_data wireless_data;
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Configuration dependent variables */
|
|
|
|
int port_type, createibss;
|
|
|
|
int promiscuous, mc_count;
|
2005-06-19 06:27:56 +07:00
|
|
|
|
|
|
|
/* Scanning support */
|
2009-06-19 05:21:33 +07:00
|
|
|
struct cfg80211_scan_request *scan_request;
|
|
|
|
struct work_struct process_scan;
|
|
|
|
struct list_head scan_list;
|
|
|
|
spinlock_t scan_lock; /* protects the scan list */
|
2008-08-22 05:28:02 +07:00
|
|
|
|
|
|
|
/* WPA support */
|
|
|
|
u8 *wpa_ie;
|
|
|
|
int wpa_ie_len;
|
|
|
|
|
2008-08-22 05:28:05 +07:00
|
|
|
struct crypto_hash *rx_tfm_mic;
|
|
|
|
struct crypto_hash *tx_tfm_mic;
|
2008-08-22 05:28:02 +07:00
|
|
|
|
|
|
|
unsigned int wpa_enabled:1;
|
|
|
|
unsigned int tkip_cm_active:1;
|
|
|
|
unsigned int key_mgmt:3;
|
2008-10-19 15:06:11 +07:00
|
|
|
|
2009-03-01 03:09:09 +07:00
|
|
|
#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
|
2008-11-22 17:37:26 +07:00
|
|
|
/* Cached in memory firmware to use during ->resume. */
|
|
|
|
const struct firmware *cached_pri_fw;
|
2008-10-19 15:06:11 +07:00
|
|
|
const struct firmware *cached_fw;
|
2009-03-01 03:09:09 +07:00
|
|
|
#endif
|
2008-11-22 17:37:28 +07:00
|
|
|
|
|
|
|
struct notifier_block pm_notifier;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef ORINOCO_DEBUG
|
|
|
|
extern int orinoco_debug;
|
2009-01-26 03:08:43 +07:00
|
|
|
#define DEBUG(n, args...) do { \
|
|
|
|
if (orinoco_debug > (n)) \
|
|
|
|
printk(KERN_DEBUG args); \
|
|
|
|
} while (0)
|
2005-04-17 05:20:36 +07:00
|
|
|
#else
|
|
|
|
#define DEBUG(n, args...) do { } while (0)
|
|
|
|
#endif /* ORINOCO_DEBUG */
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
/* Exported prototypes */
|
|
|
|
/********************************************************************/
|
|
|
|
|
2009-06-19 05:21:23 +07:00
|
|
|
extern struct orinoco_private *alloc_orinocodev(
|
2008-08-22 05:27:54 +07:00
|
|
|
int sizeof_card, struct device *device,
|
|
|
|
int (*hard_reset)(struct orinoco_private *),
|
|
|
|
int (*stop_fw)(struct orinoco_private *, int));
|
2009-06-19 05:21:23 +07:00
|
|
|
extern void free_orinocodev(struct orinoco_private *priv);
|
2009-06-19 05:21:24 +07:00
|
|
|
extern int orinoco_init(struct orinoco_private *priv);
|
2009-06-19 05:21:28 +07:00
|
|
|
extern int orinoco_if_add(struct orinoco_private *priv,
|
|
|
|
unsigned long base_addr,
|
|
|
|
unsigned int irq);
|
|
|
|
extern void orinoco_if_del(struct orinoco_private *priv);
|
2009-06-19 05:21:30 +07:00
|
|
|
extern int orinoco_up(struct orinoco_private *priv);
|
|
|
|
extern void orinoco_down(struct orinoco_private *priv);
|
2009-01-26 03:08:43 +07:00
|
|
|
extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
/* Locking and synchronization functions */
|
|
|
|
/********************************************************************/
|
|
|
|
|
2006-08-16 07:45:00 +07:00
|
|
|
static inline int orinoco_lock(struct orinoco_private *priv,
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned long *flags)
|
|
|
|
{
|
|
|
|
spin_lock_irqsave(&priv->lock, *flags);
|
|
|
|
if (priv->hw_unavailable) {
|
|
|
|
DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
|
|
|
|
priv->ndev);
|
|
|
|
spin_unlock_irqrestore(&priv->lock, *flags);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-16 07:45:00 +07:00
|
|
|
static inline void orinoco_unlock(struct orinoco_private *priv,
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned long *flags)
|
|
|
|
{
|
|
|
|
spin_unlock_irqrestore(&priv->lock, *flags);
|
|
|
|
}
|
|
|
|
|
2009-06-19 05:21:26 +07:00
|
|
|
/*** Navigate from net_device to orinoco_private ***/
|
|
|
|
static inline struct orinoco_private *ndev_priv(struct net_device *dev)
|
|
|
|
{
|
|
|
|
struct wireless_dev *wdev = netdev_priv(dev);
|
|
|
|
return wdev_priv(wdev);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif /* _ORINOCO_H */
|