new wi driver that uses the 802.11 link layer code

Reviewed by:	imp
Obtained from:	NetBSD (originally)
This commit is contained in:
Sam Leffler 2003-01-15 20:11:31 +00:00
parent 8d95b0ce40
commit 474b12ddf0
6 changed files with 2505 additions and 2837 deletions

View File

@ -77,7 +77,8 @@ struct wi_req {
#define WI_RID_FWDOWNLOAD 0x0500
#define WI_RID_MONITOR_MODE 0x0600
#define WI_RID_MIF 0x0700
#define WI_RID_SCAN_APS 0x0800
#define WI_RID_READ_APS 0x0900
struct wi_80211_hdr {
u_int16_t frame_ctl;
@ -166,7 +167,6 @@ struct wi_fwdownload {
caddr_t sec_data; /* Pointer (user) to secondary data */
};
#ifndef _KERNEL
struct wi_counters {
u_int32_t wi_tx_unicast_frames;
u_int32_t wi_tx_multicast_frames;
@ -190,7 +190,6 @@ struct wi_counters {
u_int32_t wi_rx_msg_in_msg_frags;
u_int32_t wi_rx_msg_in_bad_msg_frags;
};
#endif
/*
* Network parameters, static configuration entities.
@ -238,7 +237,9 @@ struct wi_counters {
#define WI_RID_WEP_MAPTABLE 0xFC29
#define WI_RID_CNFAUTHMODE 0xFC2A
#define WI_RID_ROAMING_MODE 0xFC2D
#define WI_RID_OWN_BEACON_INT 0xFC33 /* beacon xmit time for BSS creation */
#define WI_RID_CNF_DBM_ADJUST 0xFC46
#define WI_RID_DBM_ADJUST 0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */
#define WI_RID_BASIC_RATE 0xFCB3
#define WI_RID_SUPPORT_RATE 0xFCB4
@ -280,18 +281,17 @@ struct wi_counters {
#define WI_RID_TX_CRYPT_KEY 0xFCB1
#define WI_RID_TICK_TIME 0xFCE0
#ifndef _KERNEL
struct wi_key {
u_int16_t wi_keylen;
u_int8_t wi_keydat[14];
};
#define WI_NLTV_KEYS 4
struct wi_ltv_keys {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_key wi_keys[4];
struct wi_key wi_keys[WI_NLTV_KEYS];
};
#endif
/*
* NIC information
@ -327,7 +327,7 @@ struct wi_ltv_keys {
#define WI_RID_CURRENT_BSSID 0xFD42 /* ID of actually connected BSS */
#define WI_RID_COMMS_QUALITY 0xFD43 /* quality of BSS connection */
#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
#define WI_RID_OWN_BEACON_INT 0xFD45 /* beacon xmit time for BSS creation */
#define WI_RID_CUR_BEACON_INT 0xFD45 /* current beacon interval */
#define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */
#define WI_RID_PROT_RESP_TIME 0xFD47 /* time to wait for resp to req msg */
#define WI_RID_SHORT_RTR_LIM 0xFD48 /* max tx attempts for short frames */
@ -348,6 +348,34 @@ struct wi_ltv_keys {
#define WI_RID_OWN_MAC 0xFD86 /* unique local MAC addr */
#define WI_RID_PCI_INFO 0xFD87 /* point coordination func cap */
/*
* Scan Information
*/
#define WI_RID_BCAST_SCAN_REQ 0xFCAB /* Broadcast Scan request (Symbol) */
#define BSCAN_5SEC 0x01
#define BSCAN_ONETIME 0x02
#define BSCAN_PASSIVE 0x40
#define BSCAN_BCAST 0x80
#define WI_RID_SCAN_REQ 0xFCE1 /* Scan request (STA only) */
#define WI_RID_JOIN_REQ 0xFCE2 /* Join request (STA only) */
#define WI_RID_AUTH_STATION 0xFCE3 /* Authenticates Station (AP) */
#define WI_RID_CHANNEL_REQ 0xFCE4 /* Channel Information Request (AP) */
#define WI_RID_SCAN_RESULTS 0xFD88 /* Scan Results Table */
struct wi_apinfo {
int scanreason; /* ScanReason */
char bssid[6]; /* BSSID (mac address) */
int channel; /* Channel */
int signal; /* Signal level */
int noise; /* Average Noise Level*/
int quality; /* Quality */
int namelen; /* Length of SSID string */
char name[32]; /* SSID string */
int capinfo; /* Capability info. */
int interval; /* BSS Beacon Interval */
int rate; /* Data Rate */
};
/*
* Modem information
*/

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,6 @@
#endif
#include <dev/wi/if_wavelan_ieee.h>
#include <dev/wi/wi_hostap.h>
#include <dev/wi/if_wivar.h>
#include <dev/wi/if_wireg.h>
#ifdef WI_SYMBOL_FIRMWARE
@ -87,7 +86,7 @@ static device_method_t wi_pccard_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, wi_pccard_probe),
DEVMETHOD(device_attach, wi_pccard_attach),
DEVMETHOD(device_detach, wi_generic_detach),
DEVMETHOD(device_detach, wi_detach),
DEVMETHOD(device_shutdown, wi_shutdown),
{ 0, 0 }
@ -100,7 +99,7 @@ static device_method_t wi_pccard_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pccard_compat_probe),
DEVMETHOD(device_attach, pccard_compat_attach),
DEVMETHOD(device_detach, wi_generic_detach),
DEVMETHOD(device_detach, wi_detach),
DEVMETHOD(device_shutdown, wi_shutdown),
/* Card interface */
@ -120,6 +119,7 @@ static driver_t wi_pccard_driver = {
};
DRIVER_MODULE(if_wi, pccard, wi_pccard_driver, wi_devclass, 0, 0);
MODULE_DEPEND(if_wi, wlan, 1, 1, 1);
#if __FreeBSD_version >= 500000
static const struct pccard_product wi_pccard_products[] = {
@ -245,5 +245,5 @@ wi_pccard_attach(device_t dev)
}
#endif
return (wi_generic_attach(dev));
return (wi_attach(dev));
}

View File

@ -63,7 +63,6 @@
#include <net/if_ieee80211.h>
#include <dev/wi/if_wavelan_ieee.h>
#include <dev/wi/wi_hostap.h>
#include <dev/wi/if_wivar.h>
#include <dev/wi/if_wireg.h>
@ -76,7 +75,7 @@ static device_method_t wi_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, wi_pci_probe),
DEVMETHOD(device_attach, wi_pci_attach),
DEVMETHOD(device_detach, wi_generic_detach),
DEVMETHOD(device_detach, wi_detach),
DEVMETHOD(device_shutdown, wi_shutdown),
DEVMETHOD(device_suspend, wi_pci_suspend),
DEVMETHOD(device_resume, wi_pci_resume),
@ -108,6 +107,7 @@ static struct {
};
DRIVER_MODULE(if_wi, pci, wi_pci_driver, wi_devclass, 0, 0);
MODULE_DEPEND(if_wi, wlan, 1, 1, 1);
static int
wi_pci_probe(dev)
@ -231,7 +231,7 @@ wi_pci_attach(device_t dev)
return (ENXIO);
}
error = wi_generic_attach(dev);
error = wi_attach(dev);
if (error != 0)
return (error);
@ -239,23 +239,25 @@ wi_pci_attach(device_t dev)
}
static int
wi_pci_suspend (device_t dev)
wi_pci_suspend(device_t dev)
{
struct wi_softc *sc;
struct ifnet *ifp;
sc = device_get_softc(dev);
ifp = &sc->sc_if;
wi_stop(sc);
wi_stop(ifp, 1);
return (0);
}
static int
wi_pci_resume (device_t dev)
wi_pci_resume(device_t dev)
{
struct wi_softc *sc;
struct ifnet *ifp;
sc = device_get_softc(dev);
ifp = &sc->arpcom.ac_if;
ifp = &sc->sc_if;
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE)
return (0);

View File

@ -35,12 +35,12 @@
#define WI_DELAY 5
#define WI_TIMEOUT (500000/WI_DELAY) /* 500 ms */
#define WI_PORT0 0
#define WI_PORT1 1
#define WI_PORT2 2
#define WI_PORT3 3
#define WI_PORT4 4
#define WI_PORT5 5
#define WI_PORT0 (0 << 8)
#define WI_PORT1 (1 << 8)
#define WI_PORT2 (2 << 8)
#define WI_PORT3 (3 << 8)
#define WI_PORT4 (4 << 8)
#define WI_PORT5 (5 << 8)
#define WI_PCI_LMEMRES 0x10 /* PCI Memory (native PCI implementations) */
#define WI_PCI_LOCALRES 0x14 /* The PLX chip's local registers */
@ -54,10 +54,7 @@
#define WI_HFA384X_PCICOR_OFF 0x26
/* Default port: 0 (only 0 exists on stations) */
#define WI_DEFAULT_PORT (WI_PORT0 << 8)
/* Default TX rate: 2Mbps, auto fallback */
#define WI_DEFAULT_TX_RATE 3
#define WI_DEFAULT_PORT WI_PORT0
/* Default network name: ANY */
/*
@ -97,8 +94,6 @@
#define WI_DEFAULT_IBSS OS_STRING_NAME " IBSS"
#define WI_DEFAULT_CHAN 3
#define WI_BUS_PCCARD 0 /* pccard device */
#define WI_BUS_PCI_PLX 1 /* PCI card w/ PLX PCI/PCMICA bridge */
#define WI_BUS_PCI_NATIVE 2 /* native PCI device (Prism 2.5) */
@ -302,9 +297,6 @@
#define WI_EV_TX 0x0002 /* async xmit completed succesfully */
#define WI_EV_RX 0x0001 /* async rx completed */
#define WI_INTRS \
(WI_EV_RX|WI_EV_TX|WI_EV_TX_EXC|WI_EV_ALLOC|WI_EV_INFO|WI_EV_INFO_DROP)
/* Host software registers */
#define WI_SW0 0x28
#define WI_SW1 0x2A
@ -347,48 +339,16 @@
* and type are 16 bits and are in native byte order. The value is in
* multiples of 16 bits and is in little endian byte order.
*/
struct wi_ltv_gen {
struct wi_lt_hdr {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_val;
/* value is vary depends on resource id */
};
struct wi_ltv_str {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_str[17];
};
#define WI_SETVAL(recno, val) \
do { \
struct wi_ltv_gen g; \
\
g.wi_len = 2; \
g.wi_type = recno; \
g.wi_val = htole16(val); \
wi_write_record(sc, &g); \
} while (0)
#define WI_SETSTR(recno, str) \
do { \
struct wi_ltv_str s; \
int l; \
\
l = (strlen(str) + 1) & ~0x1; \
bzero((char *)&s, sizeof(s)); \
s.wi_len = (l / 2) + 2; \
s.wi_type = recno; \
s.wi_str[0] = htole16(strlen(str)); \
bcopy(str, (char *)&s.wi_str[1], strlen(str)); \
wi_write_record(sc, (struct wi_ltv_gen *)&s); \
} while (0)
/*
* Download buffer location and length (0xFD01).
*/
struct wi_ltv_dnld_buf {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_dnld_buf {
u_int16_t wi_buf_pg; /* page addr of intermediate dl buf*/
u_int16_t wi_buf_off; /* offset of idb */
u_int16_t wi_buf_len; /* len of idb */
@ -397,9 +357,7 @@ struct wi_ltv_dnld_buf {
/*
* Mem sizes (0xFD02).
*/
struct wi_ltv_memsz {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_memsz {
u_int16_t wi_mem_ram;
u_int16_t wi_mem_nvram;
};
@ -407,9 +365,7 @@ struct wi_ltv_memsz {
/*
* NIC Identification (0xFD0B, 0xFD20)
*/
struct wi_ltv_ver {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_ver {
u_int16_t wi_ver[4];
};
@ -493,18 +449,14 @@ struct wi_ltv_domains {
/*
* CIS struct (0xFD13).
*/
struct wi_ltv_cis {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_cis {
u_int16_t wi_cis[240];
};
/*
* Communications quality (0xFD43).
*/
struct wi_ltv_commqual {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_commqual {
u_int16_t wi_coms_qual;
u_int16_t wi_sig_lvl;
u_int16_t wi_noise_lvl;
@ -513,9 +465,7 @@ struct wi_ltv_commqual {
/*
* Actual system scale thresholds (0xFC06, 0xFD46).
*/
struct wi_ltv_scalethresh {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_scalethresh {
u_int16_t wi_energy_detect;
u_int16_t wi_carrier_detect;
u_int16_t wi_defer;
@ -527,14 +477,10 @@ struct wi_ltv_scalethresh {
/*
* PCF info struct (0xFD87).
*/
struct wi_ltv_pcf {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_energy_detect;
u_int16_t wi_carrier_detect;
u_int16_t wi_defer;
u_int16_t wi_cell_search;
u_int16_t wi_range;
struct wi_pcf {
u_int16_t wi_medium_occupancy_limit;
u_int16_t wi_cfp_period;
u_int16_t wi_cfp_max_duration;
};
/*
@ -546,49 +492,51 @@ struct wi_ltv_pcf {
* (Only PRISM2; not 802.11 compliant mode, testing use only)
* 6 == HOST AP (Only PRISM2)
*/
#define WI_PORTTYPE_IBSS 0x0
#define WI_PORTTYPE_BSS 0x1
#define WI_PORTTYPE_WDS 0x2
#define WI_PORTTYPE_ADHOC 0x3
#define WI_PORTTYPE_IBSS 0x4
#define WI_PORTTYPE_HOSTAP 0x6
#define WI_PORTTYPE_HOSTAP 0x6
/*
* Mac addresses. (0xFC01, 0xFC08)
*/
struct wi_ltv_macaddr {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_mac_addr[3];
struct wi_macaddr {
u_int8_t wi_mac_addr[6];
};
/*
* Station set identification (SSID). (0xFC02, 0xFC04)
*/
struct wi_ltv_ssid {
struct wi_ssid {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_id[17];
u_int8_t wi_ssid[32];
};
/*
* Set our station name. (0xFC0E)
*/
struct wi_ltv_nodename {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_nodename[17];
struct wi_nodename {
u_int16_t wi_nodelen;
u_int8_t wi_nodename[32];
};
/*
* Multicast addresses to be put in filter. We're
* allowed up to 16 addresses in the filter. (0xFC80)
*/
struct wi_ltv_mcast {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_mcast {
struct ether_addr wi_mcast[16];
};
/*
* Join request. (0xFCE2)
*/
struct wi_joinreq {
struct ether_addr wi_bssid;
u_int16_t wi_chan;
};
/*
* supported rates. (0xFCB4)
*/
@ -604,78 +552,127 @@ struct wi_ltv_mcast {
#define WI_INFO_NOTIFY 0xF000 /* Handover address */
#define WI_INFO_COUNTERS 0xF100 /* Statistics counters */
#define WI_INFO_SCAN_RESULTS 0xF101 /* Scan results */
#define WI_INFO_HOST_SCAN_RESULTS 0xF104 /* Scan results */
#define WI_INFO_LINK_STAT 0xF200 /* Link status */
#define WI_INFO_LINK_STAT_CONNECTED 1
#define WI_INFO_LINK_STAT_DISCONNECTED 2
#define WI_INFO_LINK_STAT_AP_CHG 3 /* AP Change */
#define WI_INFO_LINK_STAT_AP_OOR 4 /* AP Out Of Range */
#define WI_INFO_LINK_STAT_AP_INR 5 /* AP In Range */
#define WI_INFO_LINK_STAT_ASSOC_FAILED 6
#define WI_INFO_ASSOC_STAT 0xF201 /* Association status */
#define WI_INFO_AUTH_REQUEST 0xF202 /* Authentication Request (AP) */
#define WI_INFO_POWERSAVE_COUNT 0xF203 /* PowerSave User Count (AP) */
struct wi_assoc {
u_int16_t wi_assoc_stat; /* Association Status */
#define ASSOC 1
#define REASSOC 2
#define DISASSOC 3
#define ASSOCFAIL 4
#define AUTHFAIL 5
u_int8_t wi_assoc_sta[6]; /* Station Address */
u_int8_t wi_assoc_osta[6]; /* OLD Station Address */
u_int16_t wi_assoc_reason; /* Reason */
u_int16_t wi_assoc_reserve; /* Reserved */
};
/*
* Hermes transmit/receive frame structure
* Scan Results of Prism2 chip
*/
struct wi_scan_header {
u_int16_t wi_reserve; /* future use */
u_int16_t wi_reason; /* The reason this scan was initiated
1: Host initiated
2: Firmware initiated
3: Inquiry request from host */
};
struct wi_scan_data_p2 {
u_int16_t wi_chid; /* BSS Channel ID from Probe Res.(PR)*/
u_int16_t wi_noise; /* Average Noise Level of the PR */
u_int16_t wi_signal; /* Signal Level on the PR */
u_int8_t wi_bssid[6]; /* MACaddress of BSS responder from PR */
u_int16_t wi_interval; /* BSS beacon interval */
u_int16_t wi_capinfo; /* BSS Capability Information
IEEE Std 802.11(1997) ,see 7.3.1.4 */
u_int16_t wi_namelen; /* Length of SSID strings */
u_int8_t wi_name[32]; /* SSID strings */
u_int16_t wi_suprate[5]; /* Supported Rates element from the PR
IEEE Std 802.11(1997) ,see 7.3.2.2 */
u_int16_t wi_rate; /* Data rate of the PR */
#define WI_APRATE_1 0x0A /* 1 Mbps */
#define WI_APRATE_2 0x14 /* 2 Mbps */
#define WI_APRATE_5 0x37 /* 5.5 Mbps */
#define WI_APRATE_11 0x6E /* 11 Mbps */
};
/*
* Scan Results of Lucent chip
*/
struct wi_scan_data {
u_int16_t wi_chid; /* BSS Channel ID from PR */
u_int16_t wi_noise; /* Average Noise Level of the PR */
u_int16_t wi_signal; /* Signal Level on the PR */
u_int8_t wi_bssid[6]; /* MACaddress of BSS responder from PR */
u_int16_t wi_interval; /* BSS beacon interval */
u_int16_t wi_capinfo; /* BSS Capability Information
IEEE Std 802.11(1997) ,see 7.3.1.4 */
u_int16_t wi_namelen; /* Length of SSID strings */
u_int8_t wi_name[32]; /* SSID strings */
};
/*
* transmit/receive frame structure
*/
struct wi_frame {
u_int16_t wi_status; /* 0x00 */
u_int16_t wi_rsvd0; /* 0x02 */
u_int16_t wi_rsvd1; /* 0x04 */
u_int16_t wi_q_info; /* 0x06 */
u_int16_t wi_rsvd2; /* 0x08 */
u_int8_t wi_tx_rtry; /* 0x0A */
u_int8_t wi_tx_rate; /* 0x0B */
u_int16_t wi_tx_ctl; /* 0x0C */
u_int16_t wi_frame_ctl; /* 0x0E */
u_int16_t wi_id; /* 0x10 */
u_int8_t wi_addr1[6]; /* 0x12 */
u_int8_t wi_addr2[6]; /* 0x18 */
u_int8_t wi_addr3[6]; /* 0x1E */
u_int16_t wi_seq_ctl; /* 0x24 */
u_int8_t wi_addr4[6]; /* 0x26 */
u_int16_t wi_dat_len; /* 0x2C */
u_int8_t wi_dst_addr[6]; /* 0x2E */
u_int8_t wi_src_addr[6]; /* 0x34 */
u_int16_t wi_len; /* 0x3A */
u_int16_t wi_dat[3]; /* 0x3C */ /* SNAP header */
u_int16_t wi_type; /* 0x42 */
};
u_int16_t wi_rx_tstamp1; /* 0x02 */
u_int16_t wi_rx_tstamp0; /* 0x04 */
u_int8_t wi_rx_silence; /* 0x06 */
u_int8_t wi_rx_signal; /* 0x07 */
u_int8_t wi_rx_rate; /* 0x08 */
u_int8_t wi_rx_flow; /* 0x09 */
u_int8_t wi_tx_rtry; /* 0x0a */ /* Prism2 AP Only */
u_int8_t wi_tx_rate; /* 0x0b */ /* Prism2 AP Only */
u_int16_t wi_tx_ctl; /* 0x0c */
struct ieee80211_frame_addr4 wi_whdr; /* 0x0e */
u_int16_t wi_dat_len; /* 0x2c */
struct ether_header wi_ehdr; /* 0x2e */
} __attribute__((__packed__));
#define WI_802_3_OFFSET 0x2E
#define WI_802_11_OFFSET 0x44
#define WI_802_11_OFFSET_RAW 0x3C
#define WI_802_11_OFFSET_HDR 0x0E
/* Tx Status Field */
#define WI_TXSTAT_RET_ERR 0x0001
#define WI_TXSTAT_AGED_ERR 0x0002
#define WI_TXSTAT_DISCONNECT 0x0004
#define WI_TXSTAT_FORM_ERR 0x0008
/* Rx Status Field */
#define WI_STAT_BADCRC 0x0001
#define WI_STAT_UNDECRYPTABLE 0x0002
#define WI_STAT_ERRSTAT 0x0003
#define WI_STAT_MAC_PORT 0x0700
#define WI_STAT_1042 0x2000 /* RFC1042 encoded */
#define WI_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */
#define WI_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */
#define WI_STAT_MGMT 0x8000 /* 802.11b management frames */
#define WI_STAT_PCF 0x1000
#define WI_RXSTAT_MSG_TYPE 0xE000
#define WI_STAT_1042 0x2000 /* RFC1042 encoded */
#define WI_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */
#define WI_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */
#define WI_STAT_MGMT 0x8000 /* 802.11b management frames */
#define WI_ENC_TX_802_3 0x00
#define WI_ENC_TX_802_11 0x11
#define WI_ENC_TX_MGMT 0x08
#define WI_ENC_TX_E_II 0x0E
#define WI_ENC_TX_1042 0x00
#define WI_ENC_TX_TUNNEL 0xF8
#define WI_TXCNTL_MACPORT 0x00FF
#define WI_TXCNTL_STRUCTTYPE 0xFF00
#define WI_TXCNTL_TX_EX 0x0004
#define WI_TXCNTL_TX_OK 0x0002
#define WI_TXCNTL_NOCRYPT 0x0080
/*
* SNAP (sub-network access protocol) constants for transmission
* of IP datagrams over IEEE 802 networks, taken from RFC1042.
* We need these for the LLC/SNAP header fields in the TX/RX frame
* structure.
*/
#define WI_SNAP_K1 0xaa /* assigned global SAP for SNAP */
#define WI_SNAP_K2 0x00
#define WI_SNAP_CONTROL 0x03 /* unnumbered information format */
#define WI_SNAP_WORD0 (WI_SNAP_K1 | (WI_SNAP_K1 << 8))
#define WI_SNAP_WORD1 (WI_SNAP_K2 | (WI_SNAP_CONTROL << 8))
#define WI_SNAPHDR_LEN 0x6
#define WI_FCS_LEN 0x4
/* TxControl Field (enhanced) */
#define WI_TXCNTL_TX_OK 0x0002
#define WI_TXCNTL_TX_EX 0x0004
#define WI_TXCNTL_STRUCT_TYPE 0x0018
#define WI_ENC_TX_802_3 0x00
#define WI_ENC_TX_802_11 0x08
#define WI_TXCNTL_ALTRTRY 0x0020
#define WI_TXCNTL_NOCRYPT 0x0080
/*
* HFA3861/3863 (BBP) Control Registers

View File

@ -34,32 +34,10 @@
* $FreeBSD$
*/
#if 0
#define WICACHE /* turn on signal strength cache code */
#define MAXWICACHE 10
struct wi_counters {
u_int32_t wi_tx_unicast_frames;
u_int32_t wi_tx_multicast_frames;
u_int32_t wi_tx_fragments;
u_int32_t wi_tx_unicast_octets;
u_int32_t wi_tx_multicast_octets;
u_int32_t wi_tx_deferred_xmits;
u_int32_t wi_tx_single_retries;
u_int32_t wi_tx_multi_retries;
u_int32_t wi_tx_retry_limit;
u_int32_t wi_tx_discards;
u_int32_t wi_rx_unicast_frames;
u_int32_t wi_rx_multicast_frames;
u_int32_t wi_rx_fragments;
u_int32_t wi_rx_unicast_octets;
u_int32_t wi_rx_multicast_octets;
u_int32_t wi_rx_fcs_errors;
u_int32_t wi_rx_discards_nobuf;
u_int32_t wi_tx_discards_wrong_sa;
u_int32_t wi_rx_WEP_cant_decrypt;
u_int32_t wi_rx_msg_in_msg_frags;
u_int32_t wi_rx_msg_in_bad_msg_frags;
};
#endif
/*
* Encryption controls. We can enable or disable encryption as
@ -80,38 +58,16 @@ struct wi_counters {
#define WI_RID_P2_ENCRYPTION 0xFC28
#define WI_RID_ROAMING_MODE 0xFC2D
#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
struct wi_key {
u_int16_t wi_keylen;
u_int8_t wi_keydat[14];
};
#define WI_NLTV_KEYS 4
struct wi_ltv_keys {
u_int16_t wi_len;
u_int16_t wi_type;
struct wi_key wi_keys[WI_NLTV_KEYS];
};
struct wi_softc {
struct arpcom arpcom;
struct ifmedia ifmedia;
device_t dev;
int wi_unit;
struct resource * local;
int local_rid;
struct resource * iobase;
int iobase_rid;
struct resource * irq;
int irq_rid;
struct resource * mem;
int mem_rid;
bus_space_handle_t wi_localhandle;
bus_space_tag_t wi_localtag;
bus_space_handle_t wi_bhandle;
bus_space_tag_t wi_btag;
bus_space_handle_t wi_bmemhandle;
bus_space_tag_t wi_bmemtag;
void * wi_intrhand;
struct ieee80211com sc_ic;
device_t sc_dev;
#if __FreeBSD_version >= 500000
struct mtx sc_mtx;
#endif
int sc_unit;
int wi_gone;
int sc_enabled;
int sc_firmware_type;
#define WI_NOTYPE 0
#define WI_LUCENT 1
@ -119,64 +75,68 @@ struct wi_softc {
#define WI_SYMBOL 3
int sc_pri_firmware_ver; /* Primary firmware */
int sc_sta_firmware_ver; /* Station firmware */
int sc_enabled;
int wi_io_addr;
int wi_tx_data_id;
int wi_tx_mgmt_id;
int wi_gone;
int wi_flags;
#define WI_FLAGS_ATTACHED 0x01
#define WI_FLAGS_INITIALIZED 0x02
#define WI_FLAGS_HAS_WEP 0x04
#define WI_FLAGS_HAS_IBSS 0x08
#define WI_FLAGS_HAS_CREATE_IBSS 0x10
#define WI_FLAGS_HAS_MOR 0x20
#define WI_FLAGS_HAS_ROAMING 0x30
#define WI_FLAGS_HAS_DIVERSITY 0x40
#define WI_FLAGS_HAS_HOSTAP 0x80
int wi_if_flags;
u_int16_t wi_procframe;
u_int16_t wi_ptype;
u_int16_t wi_portnum;
u_int16_t wi_max_data_len;
u_int16_t wi_rts_thresh;
u_int16_t wi_ap_density;
u_int16_t wi_tx_rate;
u_int16_t wi_create_ibss;
u_int16_t wi_channel;
u_int16_t wi_pm_enabled;
u_int16_t wi_mor_enabled;
u_int16_t wi_max_sleep;
u_int16_t wi_supprates;
u_int16_t wi_authtype;
u_int16_t wi_roaming;
char wi_node_name[32];
char wi_net_name[32];
char wi_ibss_name[32];
u_int8_t wi_txbuf[1596];
u_int8_t wi_scanbuf[1596];
int wi_scanbuf_len;
struct wi_counters wi_stats;
int wi_has_wep;
int wi_use_wep;
int wi_authmode;
int wi_tx_key;
struct wi_ltv_keys wi_keys;
#ifdef WICACHE
int wi_sigitems;
struct wi_sigcache wi_sigcache[MAXWICACHE];
int wi_nextitem;
#endif
struct wihap_info wi_hostap_info;
u_int32_t wi_icv;
int wi_icv_flag;
int wi_ibss_port;
struct callout_handle wi_stat_ch;
#if __FreeBSD_version >= 500000
struct mtx wi_mtx;
#endif
int wi_nic_type;
int wi_bus_type; /* Bus attachment type */
struct resource * local;
int local_rid;
struct resource * iobase;
int iobase_rid;
struct resource * irq;
int irq_rid;
struct resource * mem;
int mem_rid;
bus_space_handle_t wi_localhandle;
bus_space_tag_t wi_localtag;
bus_space_handle_t wi_bhandle;
bus_space_tag_t wi_btag;
bus_space_handle_t wi_bmemhandle;
bus_space_tag_t wi_bmemtag;
void * wi_intrhand;
int wi_io_addr;
struct ifmedia sc_media;
struct bpf_if *sc_drvbpf;
int sc_flags;
int sc_if_flags;
int sc_bap_id;
int sc_bap_off;
u_int16_t sc_procframe;
u_int16_t sc_portnum;
u_int16_t sc_dbm_adjust;
u_int16_t sc_max_datalen;
u_int16_t sc_frag_thresh;
u_int16_t sc_rts_thresh;
u_int16_t sc_system_scale;
u_int16_t sc_cnfauthmode;
u_int16_t sc_roaming_mode;
u_int16_t sc_microwave_oven;
u_int16_t sc_authtype;
int sc_nodelen;
char sc_nodename[IEEE80211_NWID_LEN];
char sc_net_name[IEEE80211_NWID_LEN];
int sc_buflen; /* TX buffer size */
#define WI_NTXBUF 3
struct {
int d_fid;
int d_len;
} sc_txd[WI_NTXBUF]; /* TX buffers */
int sc_txnext; /* index of next TX */
int sc_txcur; /* index of current TX*/
int sc_tx_timer;
int sc_scan_timer;
int sc_syn_timer;
struct wi_counters sc_stats;
u_int16_t sc_ibss_port;
#define WI_MAXAPINFO 30
struct wi_apinfo sc_aps[WI_MAXAPINFO];
int sc_naps;
struct {
u_int16_t wi_sleep;
u_int16_t wi_delaysupp;
@ -194,7 +154,28 @@ struct wi_softc {
u_int16_t wi_confbits_param0;
} wi_debug;
int sc_false_syns;
u_int16_t sc_txbuf[IEEE80211_MAX_LEN/2];
};
#define sc_if sc_ic.ic_if
/* maximum consecutive false change-of-BSSID indications */
#define WI_MAX_FALSE_SYNS 10
#define WI_SCAN_INQWAIT 3 /* wait sec before inquire */
#define WI_SCAN_WAIT 5 /* maximum scan wait */
#define WI_FLAGS_ATTACHED 0x0001
#define WI_FLAGS_INITIALIZED 0x0002
#define WI_FLAGS_OUTRANGE 0x0004
#define WI_FLAGS_HAS_MOR 0x0010
#define WI_FLAGS_HAS_ROAMING 0x0020
#define WI_FLAGS_HAS_DIVERSITY 0x0040
#define WI_FLAGS_HAS_SYSSCALE 0x0080
#define WI_FLAGS_BUG_AUTOINC 0x0100
#define WI_FLAGS_HAS_FRAGTHR 0x0200
#define WI_FLAGS_HAS_DBMADJUST 0x0400
struct wi_card_ident {
u_int16_t card_id;
@ -209,19 +190,23 @@ struct wi_card_ident {
#define le16toh(x) (x)
#define htole16(x) (x)
#define ifaddr_byindex(idx) ifnet_addrs[(idx) - 1];
#define WI_LOCK(_sc, _s) s = splimp()
#define WI_UNLOCK(_sc, _s) splx(s)
#define WI_LOCK_DECL() int s
#define WI_LOCK(_sc) s = splimp()
#define WI_UNLOCK(_sc) splx(s)
#else
#define WI_LOCK(_sc, _s) _s = 1
#define WI_UNLOCK(_sc, _s)
#define WI_LOCK_DECL()
#define WI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
#define WI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
#endif
int wi_generic_attach(device_t);
int wi_generic_detach(device_t);
void wi_shutdown(device_t);
int wi_alloc(device_t, int);
void wi_free(device_t);
void wi_stop(struct wi_softc *);
int wi_attach(device_t);
int wi_detach(device_t);
void wi_shutdown(device_t);
int wi_alloc(device_t, int);
void wi_free(device_t);
extern devclass_t wi_devclass;
int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
int wi_symbol_load_firm(struct wi_softc *, const void *, int, const void *, int);
void wi_init(void *);
void wi_intr(void *);
int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
void wi_stop(struct ifnet *, int);
int wi_symbol_load_firm(struct wi_softc *, const void *, int, const void *, int);