Check in the known good version of the wi driver, with prism/symbol
support stripped out and minimally renamed to owi. This driver attaches to lucent cards only. This is designed to aid in the testing of fixes to the wi driver for lucent cards. It is supported only as a module (you cannot compile it into your kernel). You cannot have the wi driver in your kernel (or loaded as a moudle) to use the owi module. I've not connected it to build, as this module is currently for debugging purposes. This is for developers only at the present time. If we can't get lucent support fixed by 5.2 code freeze, then we'll re-evaulate this support level. Please use this to fix the lucent support in dev/wi. This will be removed from the system when lucent support has been fixed in dev/wi. Note to developers: Do not connect this to the build, make it possible to build into the kernel or otherwise 'integrate' this into system without checking with me first. This is for debugging purposes only. If this doesn't work for you, I don't want to hear about it unless you are fixing the wi driver :-)
This commit is contained in:
parent
76387a8ff1
commit
53e655ce37
273
sys/dev/owi/if_ieee80211.h
Normal file
273
sys/dev/owi/if_ieee80211.h
Normal file
@ -0,0 +1,273 @@
|
||||
/* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _NET_IF_IEEE80211_H_
|
||||
#define _NET_IF_IEEE80211_H_
|
||||
|
||||
/*
|
||||
* generic definitions for IEEE 802.11 frames
|
||||
*/
|
||||
struct ieee80211_frame {
|
||||
u_int8_t i_fc[2];
|
||||
u_int8_t i_dur[2];
|
||||
u_int8_t i_addr1[ETHER_ADDR_LEN];
|
||||
u_int8_t i_addr2[ETHER_ADDR_LEN];
|
||||
u_int8_t i_addr3[ETHER_ADDR_LEN];
|
||||
u_int8_t i_seq[2];
|
||||
/* possibly followed by addr4[ETHER_ADDR_LEN]; */
|
||||
};
|
||||
|
||||
#define IEEE80211_FC0_VERSION_MASK 0x03
|
||||
#define IEEE80211_FC0_VERSION_0 0x00
|
||||
#define IEEE80211_FC0_TYPE_MASK 0x0c
|
||||
#define IEEE80211_FC0_TYPE_MGT 0x00
|
||||
#define IEEE80211_FC0_TYPE_CTL 0x04
|
||||
#define IEEE80211_FC0_TYPE_DATA 0x08
|
||||
|
||||
#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
|
||||
/* for TYPE_MGT */
|
||||
#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
|
||||
#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
|
||||
#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
|
||||
#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
|
||||
#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
|
||||
#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
|
||||
#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
|
||||
#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
|
||||
#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
|
||||
#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
|
||||
#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
|
||||
/* for TYPE_CTL */
|
||||
#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
|
||||
#define IEEE80211_FC0_SUBTYPE_RTS 0xb0
|
||||
#define IEEE80211_FC0_SUBTYPE_CTS 0xc0
|
||||
#define IEEE80211_FC0_SUBTYPE_ACK 0xd0
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
|
||||
/* for TYPE_DATA (bit combination) */
|
||||
#define IEEE80211_FC0_SUBTYPE_DATA 0x00
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
|
||||
#define IEEE80211_FC0_SUBTYPE_NODATA 0x40
|
||||
#define IEEE80211_FC0_SUBTYPE_CFACK 0x50
|
||||
#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
|
||||
#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
|
||||
|
||||
#define IEEE80211_FC1_DIR_MASK 0x03
|
||||
#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
|
||||
#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
|
||||
#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
|
||||
#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
|
||||
|
||||
#define IEEE80211_FC1_MORE_FRAG 0x04
|
||||
#define IEEE80211_FC1_RETRY 0x08
|
||||
#define IEEE80211_FC1_PWR_MGT 0x10
|
||||
#define IEEE80211_FC1_MORE_DATA 0x20
|
||||
#define IEEE80211_FC1_WEP 0x40
|
||||
#define IEEE80211_FC1_ORDER 0x80
|
||||
|
||||
#define IEEE80211_NWID_LEN 32
|
||||
|
||||
/*
|
||||
* BEACON management packets
|
||||
*
|
||||
* octect timestamp[8]
|
||||
* octect beacon interval[2]
|
||||
* octect capability information[2]
|
||||
* information element
|
||||
* octect elemid
|
||||
* octect length
|
||||
* octect information[length[
|
||||
*/
|
||||
typedef u_int8_t * ieee80211_mgt_beacon_t;
|
||||
|
||||
#define IEEE80211_BEACON_INTERVAL(beacon) \
|
||||
(beacon[8] + (beacon[9] << 8))
|
||||
#define IEEE80211_BEACON_CAPABILITY(beacon) \
|
||||
(beacon[10] + (beacon[11] << 8))
|
||||
|
||||
#define IEEE80211_CAPINFO_ESS 0x01
|
||||
#define IEEE80211_CAPINFO_IBSS 0x02
|
||||
#define IEEE80211_CAPINFO_CF_POLLABLE 0x04
|
||||
#define IEEE80211_CAPINFO_CF_POLLREQ 0x08
|
||||
#define IEEE80211_CAPINFO_PRIVACY 0x10
|
||||
#define IEEE80211_CAPINFO_BITS "\20\01ESS\02IBSS\03POLLABLE\04POLLREQ\5PRIVACY"
|
||||
|
||||
/*
|
||||
* Management information elements
|
||||
*/
|
||||
struct ieee80211_information {
|
||||
char ssid[IEEE80211_NWID_LEN+1];
|
||||
struct rates {
|
||||
u_int8_t *p;
|
||||
} rates;
|
||||
struct fh {
|
||||
u_int16_t dwell;
|
||||
u_int8_t set;
|
||||
u_int8_t pattern;
|
||||
u_int8_t index;
|
||||
} fh;
|
||||
struct ds {
|
||||
u_int8_t channel;
|
||||
} ds;
|
||||
struct cf {
|
||||
u_int8_t count;
|
||||
u_int8_t period;
|
||||
u_int8_t maxdur[2];
|
||||
u_int8_t dur[2];
|
||||
} cf;
|
||||
struct tim {
|
||||
u_int8_t count;
|
||||
u_int8_t period;
|
||||
u_int8_t bitctl;
|
||||
/* u_int8_t pvt[251]; The driver never needs to use this */
|
||||
} tim;
|
||||
struct ibss {
|
||||
u_int16_t atim;
|
||||
} ibss;
|
||||
struct challenge {
|
||||
u_int8_t *p;
|
||||
u_int8_t len;
|
||||
} challenge;
|
||||
};
|
||||
|
||||
#define IEEE80211_ELEMID_SSID 0
|
||||
#define IEEE80211_ELEMID_RATES 1
|
||||
#define IEEE80211_ELEMID_FHPARMS 2
|
||||
#define IEEE80211_ELEMID_DSPARMS 3
|
||||
#define IEEE80211_ELEMID_CFPARMS 4
|
||||
#define IEEE80211_ELEMID_TIM 5
|
||||
#define IEEE80211_ELEMID_IBSSPARMS 6
|
||||
#define IEEE80211_ELEMID_CHALLENGE 16
|
||||
|
||||
/*
|
||||
* AUTH management packets
|
||||
*
|
||||
* octect algo[2]
|
||||
* octect seq[2]
|
||||
* octect status[2]
|
||||
* octect chal.id
|
||||
* octect chal.length
|
||||
* octect chal.text[253]
|
||||
*/
|
||||
typedef u_int8_t * ieee80211_mgt_auth_t;
|
||||
|
||||
#define IEEE80211_AUTH_ALGORITHM(auth) \
|
||||
(auth[0] + (auth[1] << 8))
|
||||
#define IEEE80211_AUTH_TRANSACTION(auth) \
|
||||
(auth[2] + (auth[3] << 8))
|
||||
#define IEEE80211_AUTH_STATUS(auth) \
|
||||
(auth[4] + (auth[5] << 8))
|
||||
|
||||
#define IEEE80211_AUTH_ALG_OPEN 0x0000
|
||||
#define IEEE80211_AUTH_ALG_SHARED 0x0001
|
||||
|
||||
#define IEEE80211_AUTH_OPEN_REQUEST 1
|
||||
#define IEEE80211_AUTH_OPEN_RESPONSE 2
|
||||
|
||||
#define IEEE80211_AUTH_SHARED_REQUEST 1
|
||||
#define IEEE80211_AUTH_SHARED_CHALLENGE 2
|
||||
#define IEEE80211_AUTH_SHARED_RESPONSE 3
|
||||
#define IEEE80211_AUTH_SHARED_PASS 4
|
||||
|
||||
/*
|
||||
* Reason codes
|
||||
*
|
||||
* Unlisted codes are reserved
|
||||
*/
|
||||
#define IEEE80211_REASON_UNSPECIFIED 1
|
||||
#define IEEE80211_REASON_AUTH_EXPIRE 2
|
||||
#define IEEE80211_REASON_AUTH_LEAVE 3
|
||||
#define IEEE80211_REASON_ASSOC_EXPIRE 4
|
||||
#define IEEE80211_REASON_ASSOC_TOOMANY 5
|
||||
#define IEEE80211_REASON_NOT_AUTHED 6
|
||||
#define IEEE80211_REASON_NOT_ASSOCED 7
|
||||
#define IEEE80211_REASON_ASSOC_LEAVE 8
|
||||
#define IEEE80211_REASON_ASSOC_NOT_AUTHED 9
|
||||
|
||||
/*
|
||||
* Status code
|
||||
*
|
||||
* Unlisted codes are reserved
|
||||
*/
|
||||
#define IEEE80211_STATUS_SUCCESS 0x0000
|
||||
#define IEEE80211_STATUS_UNSPECIFIED 1
|
||||
#define IEEE80211_STATUS_CAPINFO 10
|
||||
#define IEEE80211_STATUS_NOT_ASSOCED 11
|
||||
#define IEEE80211_STATUS_OTHER 12
|
||||
#define IEEE80211_STATUS_ALG 13
|
||||
#define IEEE80211_STATUS_SEQUENCE 14
|
||||
#define IEEE80211_STATUS_CHALLENGE 15
|
||||
#define IEEE80211_STATUS_TIMEOUT 16
|
||||
#define IEEE80211_STATUS_TOO_MANY_STATIONS 17
|
||||
#define IEEE80211_STATUS_RATES 18
|
||||
|
||||
#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
|
||||
#define IEEE80211_WEP_IVLEN 3 /* 24bit */
|
||||
#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
|
||||
#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
|
||||
#define IEEE80211_WEP_NKID 4 /* number of key ids */
|
||||
|
||||
/* nwid is pointed at by ifr.ifr_data */
|
||||
struct ieee80211_nwid {
|
||||
u_int8_t i_len;
|
||||
u_int8_t i_nwid[IEEE80211_NWID_LEN];
|
||||
};
|
||||
|
||||
#define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
|
||||
#define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
|
||||
|
||||
/* the first member must be matched with struct ifreq */
|
||||
struct ieee80211_nwkey {
|
||||
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
||||
int i_wepon; /* wep enabled flag */
|
||||
int i_defkid; /* default encrypt key id */
|
||||
struct {
|
||||
int i_keylen;
|
||||
u_int8_t *i_keydat;
|
||||
} i_key[IEEE80211_WEP_NKID];
|
||||
};
|
||||
#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
|
||||
#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
|
||||
|
||||
#define IEEE80211_WEP_NOSUP -1
|
||||
#define IEEE80211_WEP_OFF 0
|
||||
#define IEEE80211_WEP_ON 1
|
||||
#define IEEE80211_WEP_MIXED 2
|
||||
|
||||
#define IEEE80211_AUTH_NONE 0
|
||||
#define IEEE80211_AUTH_OPEN 1
|
||||
#define IEEE80211_AUTH_SHARED 2
|
||||
|
||||
#define IEEE80211_POWERSAVE_NOSUP -1
|
||||
#define IEEE80211_POWERSAVE_OFF 0
|
||||
#define IEEE80211_POWERSAVE_CAM 1
|
||||
#define IEEE80211_POWERSAVE_PSP 2
|
||||
#define IEEE80211_POWERSAVE_PSP_CAM 3
|
||||
#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
|
||||
|
||||
/* the first member must be matched with struct ifreq */
|
||||
struct ieee80211req {
|
||||
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
||||
u_int16_t i_type; /* req type */
|
||||
int16_t i_val; /* Index or simple value */
|
||||
int16_t i_len; /* Index or simple value */
|
||||
void *i_data; /* Extra data */
|
||||
};
|
||||
#define SIOCS80211 _IOW('i', 234, struct ieee80211req)
|
||||
#define SIOCG80211 _IOWR('i', 235, struct ieee80211req)
|
||||
|
||||
#define IEEE80211_IOC_SSID 1
|
||||
#define IEEE80211_IOC_NUMSSIDS 2
|
||||
#define IEEE80211_IOC_WEP 3
|
||||
#define IEEE80211_IOC_WEPKEY 4
|
||||
#define IEEE80211_IOC_NUMWEPKEYS 5
|
||||
#define IEEE80211_IOC_WEPTXKEY 6
|
||||
#define IEEE80211_IOC_AUTHMODE 7
|
||||
#define IEEE80211_IOC_STATIONNAME 8
|
||||
#define IEEE80211_IOC_CHANNEL 9
|
||||
#define IEEE80211_IOC_POWERSAVE 10
|
||||
#define IEEE80211_IOC_POWERSAVESLEEP 11
|
||||
|
||||
#endif /* !_NET_IF_IEEE80211_H_ */
|
2421
sys/dev/owi/if_owi.c
Normal file
2421
sys/dev/owi/if_owi.c
Normal file
File diff suppressed because it is too large
Load Diff
205
sys/dev/owi/if_owi_pccard.c
Normal file
205
sys/dev/owi/if_owi_pccard.c
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bill Paul.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD.
|
||||
*
|
||||
* Written by Bill Paul <wpaul@ctr.columbia.edu>
|
||||
* Electrical Engineering Department
|
||||
* Columbia University, New York City
|
||||
*/
|
||||
|
||||
#include "opt_wi.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
#include <dev/owi/if_ieee80211.h>
|
||||
|
||||
#include <dev/pccard/pccardvar.h>
|
||||
#include <dev/pccard/pccarddevs.h>
|
||||
|
||||
#include <dev/wi/if_wavelan_ieee.h>
|
||||
#include <dev/owi/if_wivar.h>
|
||||
#include <dev/owi/if_wireg.h>
|
||||
|
||||
#include "card_if.h"
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif
|
||||
|
||||
static int wi_pccard_probe(device_t);
|
||||
static int wi_pccard_attach(device_t);
|
||||
static int wi_pccard_match(device_t);
|
||||
|
||||
static device_method_t wi_pccard_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pccard_compat_probe),
|
||||
DEVMETHOD(device_attach, pccard_compat_attach),
|
||||
DEVMETHOD(device_detach, owi_generic_detach),
|
||||
DEVMETHOD(device_shutdown, owi_shutdown),
|
||||
|
||||
/* Card interface */
|
||||
DEVMETHOD(card_compat_match, wi_pccard_match),
|
||||
DEVMETHOD(card_compat_probe, wi_pccard_probe),
|
||||
DEVMETHOD(card_compat_attach, wi_pccard_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t wi_pccard_driver = {
|
||||
"owi",
|
||||
wi_pccard_methods,
|
||||
sizeof(struct wi_softc)
|
||||
};
|
||||
|
||||
DRIVER_MODULE(if_owi, pccard, wi_pccard_driver, owi_devclass, 0, 0);
|
||||
|
||||
static const struct pccard_product wi_pccard_products[] = {
|
||||
PCMCIA_CARD(3COM, 3CRWE737A, 0),
|
||||
PCMCIA_CARD(3COM, 3CRWE777A, 0),
|
||||
PCMCIA_CARD(ACTIONTEC, PRISM, 0),
|
||||
PCMCIA_CARD(ADDTRON, AWP100, 0),
|
||||
PCMCIA_CARD(BAY, EMOBILITY_11B, 0),
|
||||
PCMCIA_CARD(BUFFALO, WLI_PCM_S11, 0),
|
||||
PCMCIA_CARD(BUFFALO, WLI_CF_S11G, 0),
|
||||
PCMCIA_CARD(COMPAQ, NC5004, 0),
|
||||
PCMCIA_CARD(CONTEC, FX_DS110_PCC, 0),
|
||||
PCMCIA_CARD(COREGA, WIRELESS_LAN_PCC_11, 0),
|
||||
PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCA_11, 0),
|
||||
PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCB_11, 0),
|
||||
PCMCIA_CARD(ELSA, XI300_IEEE, 0),
|
||||
PCMCIA_CARD(ELSA, XI325_IEEE, 0),
|
||||
PCMCIA_CARD(ELSA, XI800_IEEE, 0),
|
||||
PCMCIA_CARD(EMTAC, WLAN, 0),
|
||||
PCMCIA_CARD(ERICSSON, WIRELESSLAN, 0),
|
||||
PCMCIA_CARD(GEMTEK, WLAN, 0),
|
||||
PCMCIA_CARD(HWN, AIRWAY80211, 0),
|
||||
PCMCIA_CARD(INTEL, PRO_WLAN_2011, 0),
|
||||
PCMCIA_CARD(INTERSIL, MA401RA, 0),
|
||||
PCMCIA_CARD(INTERSIL2, PRISM2, 0),
|
||||
PCMCIA_CARD(IODATA2, WNB11PCM, 0),
|
||||
PCMCIA_CARD(BROMAX, IWN, 0),
|
||||
PCMCIA_CARD(BROMAX, IWN3, 0),
|
||||
PCMCIA_CARD(BROMAX, WCF11, 0),
|
||||
/* Now that we do PRISM detection, I don't think we need these - imp */
|
||||
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NANOSPEED_PRISM2, 0),
|
||||
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NEC_CMZ_RT_WP, 0),
|
||||
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NTT_ME_WLAN, 0),
|
||||
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, SMC_2632W, 0),
|
||||
/* Must be after other LUCENT ones because it is less specific */
|
||||
PCMCIA_CARD(LUCENT, WAVELAN_IEEE, 0),
|
||||
PCMCIA_CARD(NOKIA, C110_WLAN, 0),
|
||||
PCMCIA_CARD(PLANEX_2, GWNS11H, 0),
|
||||
PCMCIA_CARD(PROXIM, RANGELANDS_8430, 0),
|
||||
PCMCIA_CARD(SAMSUNG, SWL_2000N, 0),
|
||||
PCMCIA_CARD(SIMPLETECH, SPECTRUM24_ALT, 0),
|
||||
PCMCIA_CARD(SOCKET, LP_WLAN_CF, 0),
|
||||
PCMCIA_CARD(SYMBOL, LA4100, 0),
|
||||
PCMCIA_CARD(TDK, LAK_CD011WL, 0),
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
wi_pccard_match(dev)
|
||||
device_t dev;
|
||||
{
|
||||
const struct pccard_product *pp;
|
||||
|
||||
if ((pp = pccard_product_lookup(dev, wi_pccard_products,
|
||||
sizeof(wi_pccard_products[0]), NULL)) != NULL) {
|
||||
device_set_desc(dev, pp->pp_name);
|
||||
return 0;
|
||||
}
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
static int
|
||||
wi_pccard_probe(dev)
|
||||
device_t dev;
|
||||
{
|
||||
struct wi_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->wi_gone = 0;
|
||||
sc->wi_bus_type = WI_BUS_PCCARD;
|
||||
|
||||
error = owi_alloc(dev, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
owi_get_id(sc);
|
||||
|
||||
/* Make sure interrupts are disabled. */
|
||||
CSR_WRITE_2(sc, WI_INT_EN, 0);
|
||||
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
|
||||
|
||||
owi_free(dev);
|
||||
|
||||
if (sc->sc_firmware_type != WI_LUCENT)
|
||||
return ENXIO;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
wi_pccard_attach(device_t dev)
|
||||
{
|
||||
struct wi_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
error = owi_alloc(dev, 0);
|
||||
if (error) {
|
||||
device_printf(dev, "wi_alloc() failed! (%d)\n", error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
return (owi_generic_attach(dev));
|
||||
}
|
618
sys/dev/owi/if_wireg.h
Normal file
618
sys/dev/owi/if_wireg.h
Normal file
@ -0,0 +1,618 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bill Paul.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#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_PCI_LMEMRES 0x10 /* PCI Memory (native PCI implementations) */
|
||||
#define WI_PCI_LOCALRES 0x14 /* The PLX chip's local registers */
|
||||
#define WI_PCI_MEMRES 0x18 /* The PCCard's attribute memory */
|
||||
#define WI_PCI_IORES 0x1C /* The PCCard's I/O space */
|
||||
|
||||
#define WI_LOCAL_INTCSR 0x4c
|
||||
#define WI_LOCAL_INTEN 0x40
|
||||
|
||||
/* 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
|
||||
|
||||
/* Default network name: ANY */
|
||||
/*
|
||||
* [sommerfeld 1999/07/15] Changed from "ANY" to ""; according to Bill Fenner,
|
||||
* ANY is used in MS driver user interfaces, while "" is used over the
|
||||
* wire..
|
||||
*/
|
||||
#define WI_DEFAULT_NETNAME ""
|
||||
|
||||
#define WI_DEFAULT_AP_DENSITY 1
|
||||
|
||||
#define WI_DEFAULT_RTS_THRESH 2347
|
||||
|
||||
#define WI_DEFAULT_DATALEN 2304
|
||||
|
||||
#define WI_DEFAULT_CREATE_IBSS 0
|
||||
|
||||
#define WI_DEFAULT_PM_ENABLED 0
|
||||
|
||||
#define WI_DEFAULT_MAX_SLEEP 100
|
||||
|
||||
#define WI_DEFAULT_ROAMING 1
|
||||
|
||||
#define WI_DEFAULT_AUTHTYPE 1
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define OS_STRING_NAME "NetBSD"
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#define OS_STRING_NAME "FreeBSD"
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
#define OS_STRING_NAME "OpenBSD"
|
||||
#endif
|
||||
|
||||
#define WI_DEFAULT_NODENAME OS_STRING_NAME " WaveLAN/IEEE node"
|
||||
|
||||
#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) */
|
||||
|
||||
/*
|
||||
* register space access macros
|
||||
*/
|
||||
#define CSR_WRITE_4(sc, reg, val) \
|
||||
bus_space_write_4((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
|
||||
#define CSR_WRITE_2(sc, reg, val) \
|
||||
bus_space_write_2((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
|
||||
#define CSR_WRITE_1(sc, reg, val) \
|
||||
bus_space_write_1((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
|
||||
|
||||
#define CSR_READ_4(sc, reg) \
|
||||
bus_space_read_4((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
|
||||
#define CSR_READ_2(sc, reg) \
|
||||
bus_space_read_2((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
|
||||
#define CSR_READ_1(sc, reg) \
|
||||
bus_space_read_1((sc)->wi_btag, (sc)->wi_bhandle, \
|
||||
(sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
|
||||
|
||||
#define CSM_WRITE_1(sc, off, val) \
|
||||
bus_space_write_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off, val)
|
||||
|
||||
#define CSM_READ_1(sc, off) \
|
||||
bus_space_read_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off)
|
||||
|
||||
#define CSR_WRITE_STREAM_2(sc, reg, val) \
|
||||
bus_space_write_stream_2(sc->wi_btag, sc->wi_bhandle, \
|
||||
(sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val)
|
||||
#define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
|
||||
bus_space_write_multi_stream_2(sc->wi_btag, sc->wi_bhandle, \
|
||||
(sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val, count)
|
||||
#define CSR_READ_STREAM_2(sc, reg) \
|
||||
bus_space_read_stream_2(sc->wi_btag, sc->wi_bhandle, \
|
||||
(sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)))
|
||||
#define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
|
||||
bus_space_read_multi_stream_2(sc->wi_btag, sc->wi_bhandle, \
|
||||
(sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), buf, count)
|
||||
|
||||
/*
|
||||
* The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent
|
||||
* calls 'Hermes.' In typical fashion, getting documentation about this
|
||||
* controller is about as easy as squeezing blood from a stone. Here
|
||||
* is more or less what I know:
|
||||
*
|
||||
* - The Hermes controller is firmware driven, and the host interacts
|
||||
* with the Hermes via a firmware interface, which can change.
|
||||
*
|
||||
* - The Hermes is described in a document called: "Hermes Firmware
|
||||
* WaveLAN/IEEE Station Functions," document #010245, which of course
|
||||
* Lucent will not release without an NDA.
|
||||
*
|
||||
* - Lucent has created a library called HCF (Hardware Control Functions)
|
||||
* though which it wants developers to interact with the card. The HCF
|
||||
* is needlessly complex, ill conceived and badly documented. Actually,
|
||||
* the comments in the HCP code itself aren't bad, but the publically
|
||||
* available manual that comes with it is awful, probably due largely to
|
||||
* the fact that it has been emasculated in order to hide information
|
||||
* that Lucent wants to keep proprietary. The purpose of the HCF seems
|
||||
* to be to insulate the driver programmer from the Hermes itself so that
|
||||
* Lucent has an excuse not to release programming in for it.
|
||||
*
|
||||
* - Lucent only makes available documentation and code for 'HCF Light'
|
||||
* which is a stripped down version of HCF with certain features not
|
||||
* implemented, most notably support for 802.11 frames.
|
||||
*
|
||||
* - The HCF code which I have seen blows goats. Whoever decided to
|
||||
* use a 132 column format should be shot.
|
||||
*
|
||||
* Rather than actually use the Lucent HCF library, I have stripped all
|
||||
* the useful information from it and used it to create a driver in the
|
||||
* usual BSD form. Note: I don't want to hear anybody whining about the
|
||||
* fact that the Lucent code is GPLed and mine isn't. I did not actually
|
||||
* put any of Lucent's code in this driver: I only used it as a reference
|
||||
* to obtain information about the underlying hardware. The Hermes
|
||||
* programming interface is not GPLed, so bite me.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Size of Hermes & Prism2 I/O space.
|
||||
*/
|
||||
#define WI_IOSIZ 0x40
|
||||
|
||||
/*
|
||||
* Hermes & Prism2 register definitions
|
||||
*/
|
||||
|
||||
/* Hermes command/status registers. */
|
||||
#define WI_COMMAND 0x00
|
||||
#define WI_PARAM0 0x02
|
||||
#define WI_PARAM1 0x04
|
||||
#define WI_PARAM2 0x06
|
||||
#define WI_STATUS 0x08
|
||||
#define WI_RESP0 0x0A
|
||||
#define WI_RESP1 0x0C
|
||||
#define WI_RESP2 0x0E
|
||||
|
||||
/* Command register values. */
|
||||
#define WI_CMD_BUSY 0x8000 /* busy bit */
|
||||
#define WI_CMD_INI 0x0000 /* initialize */
|
||||
#define WI_CMD_ENABLE 0x0001 /* enable */
|
||||
#define WI_CMD_DISABLE 0x0002 /* disable */
|
||||
#define WI_CMD_DIAG 0x0003
|
||||
#define WI_CMD_ALLOC_MEM 0x000A /* allocate NIC memory */
|
||||
#define WI_CMD_TX 0x000B /* transmit */
|
||||
#define WI_CMD_NOTIFY 0x0010
|
||||
#define WI_CMD_INQUIRE 0x0011
|
||||
#define WI_CMD_ACCESS 0x0021
|
||||
#define WI_CMD_ACCESS_WRITE 0x0121
|
||||
#define WI_CMD_PROGRAM 0x0022
|
||||
#define WI_CMD_READEE 0x0030 /* symbol only */
|
||||
#define WI_CMD_READMIF 0x0030 /* prism2 */
|
||||
#define WI_CMD_WRITEMIF 0x0031 /* prism2 */
|
||||
#define WI_CMD_DEBUG 0x0038 /* Various test commands */
|
||||
|
||||
#define WI_CMD_CODE_MASK 0x003F
|
||||
|
||||
/*
|
||||
* Various cmd test stuff.
|
||||
*/
|
||||
#define WI_TEST_MONITOR 0x0B
|
||||
#define WI_TEST_STOP 0x0F
|
||||
#define WI_TEST_CFG_BITS 0x15
|
||||
#define WI_TEST_CFG_BIT_ALC 0x08
|
||||
|
||||
/*
|
||||
* Reclaim qualifier bit, applicable to the
|
||||
* TX and INQUIRE commands.
|
||||
*/
|
||||
#define WI_RECLAIM 0x0100 /* reclaim NIC memory */
|
||||
|
||||
/*
|
||||
* ACCESS command qualifier bits.
|
||||
*/
|
||||
#define WI_ACCESS_READ 0x0000
|
||||
#define WI_ACCESS_WRITE 0x0100
|
||||
|
||||
/*
|
||||
* PROGRAM command qualifier bits.
|
||||
*/
|
||||
#define WI_PROGRAM_DISABLE 0x0000
|
||||
#define WI_PROGRAM_ENABLE_RAM 0x0100
|
||||
#define WI_PROGRAM_ENABLE_NVRAM 0x0200
|
||||
#define WI_PROGRAM_NVRAM 0x0300
|
||||
|
||||
/* Status register values */
|
||||
#define WI_STAT_CMD_CODE 0x003F
|
||||
#define WI_STAT_DIAG_ERR 0x0100
|
||||
#define WI_STAT_INQ_ERR 0x0500
|
||||
#define WI_STAT_CMD_RESULT 0x7F00
|
||||
|
||||
/* memory handle management registers */
|
||||
#define WI_INFO_FID 0x10
|
||||
#define WI_RX_FID 0x20
|
||||
#define WI_ALLOC_FID 0x22
|
||||
#define WI_TX_CMP_FID 0x24
|
||||
|
||||
/*
|
||||
* Buffer Access Path (BAP) registers.
|
||||
* These are I/O channels. I believe you can use each one for
|
||||
* any desired purpose independently of the other. In general
|
||||
* though, we use BAP1 for reading and writing LTV records and
|
||||
* reading received data frames, and BAP0 for writing transmit
|
||||
* frames. This is a convention though, not a rule.
|
||||
*/
|
||||
#define WI_SEL0 0x18
|
||||
#define WI_SEL1 0x1A
|
||||
#define WI_OFF0 0x1C
|
||||
#define WI_OFF1 0x1E
|
||||
#define WI_DATA0 0x36
|
||||
#define WI_DATA1 0x38
|
||||
#define WI_BAP0 WI_DATA0
|
||||
#define WI_BAP1 WI_DATA1
|
||||
|
||||
#define WI_OFF_BUSY 0x8000
|
||||
#define WI_OFF_ERR 0x4000
|
||||
#define WI_OFF_DATAOFF 0x0FFF
|
||||
|
||||
/* Event registers */
|
||||
#define WI_EVENT_STAT 0x30 /* Event status */
|
||||
#define WI_INT_EN 0x32 /* Interrupt enable/disable */
|
||||
#define WI_EVENT_ACK 0x34 /* Ack event */
|
||||
|
||||
/* Events */
|
||||
#define WI_EV_TICK 0x8000 /* aux timer tick */
|
||||
#define WI_EV_RES 0x4000 /* controller h/w error (time out) */
|
||||
#define WI_EV_INFO_DROP 0x2000 /* no RAM to build unsolicited frame */
|
||||
#define WI_EV_NO_CARD 0x0800 /* card removed (hunh?) */
|
||||
#define WI_EV_DUIF_RX 0x0400 /* wavelan management packet received */
|
||||
#define WI_EV_INFO 0x0080 /* async info frame */
|
||||
#define WI_EV_CMD 0x0010 /* command completed */
|
||||
#define WI_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
|
||||
#define WI_EV_TX_EXC 0x0004 /* async xmit completed with failure */
|
||||
#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
|
||||
#define WI_SW2 0x2C
|
||||
#define WI_SW3 0x2E /* does not appear in Prism2 */
|
||||
|
||||
#define WI_CNTL 0x14
|
||||
|
||||
#define WI_CNTL_AUX_ENA 0xC000
|
||||
#define WI_CNTL_AUX_ENA_STAT 0xC000
|
||||
#define WI_CNTL_AUX_DIS_STAT 0x0000
|
||||
#define WI_CNTL_AUX_ENA_CNTL 0x8000
|
||||
#define WI_CNTL_AUX_DIS_CNTL 0x4000
|
||||
|
||||
#define WI_AUX_PAGE 0x3A
|
||||
#define WI_AUX_OFFSET 0x3C
|
||||
#define WI_AUX_DATA 0x3E
|
||||
|
||||
#define WI_AUX_PGSZ 128
|
||||
#define WI_AUX_KEY0 0xfe01
|
||||
#define WI_AUX_KEY1 0xdc23
|
||||
#define WI_AUX_KEY2 0xba45
|
||||
|
||||
#define WI_COR 0x40 /* only for Symbol */
|
||||
#define WI_COR_RESET 0x0080
|
||||
#define WI_COR_IOMODE 0x0041
|
||||
|
||||
#define WI_HCR 0x42 /* only for Symbol */
|
||||
#define WI_HCR_4WIRE 0x0010
|
||||
#define WI_HCR_RUN 0x0007
|
||||
#define WI_HCR_HOLD 0x000f
|
||||
#define WI_HCR_EEHOLD 0x00ce
|
||||
|
||||
#define WI_COR_OFFSET 0x3e0 /* OK for PCI, must be bogus for pccard */
|
||||
#define WI_COR_VALUE 0x41
|
||||
|
||||
/*
|
||||
* One form of communication with the Hermes is with what Lucent calls
|
||||
* LTV records, where LTV stands for Length, Type and Value. The length
|
||||
* 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 {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_val;
|
||||
};
|
||||
|
||||
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;
|
||||
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 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Mem sizes (0xFD02).
|
||||
*/
|
||||
struct wi_ltv_memsz {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_mem_ram;
|
||||
u_int16_t wi_mem_nvram;
|
||||
};
|
||||
|
||||
/*
|
||||
* NIC Identification (0xFD0B, 0xFD20)
|
||||
*/
|
||||
struct wi_ltv_ver {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_ver[4];
|
||||
};
|
||||
|
||||
/* define card ident */
|
||||
#define WI_NIC_LUCENT_ID 0x0001
|
||||
#define WI_NIC_LUCENT_STR "Lucent Technologies, WaveLAN/IEEE"
|
||||
|
||||
#define WI_NIC_SONY_ID 0x0002
|
||||
#define WI_NIC_SONY_STR "Sony WaveLAN/IEEE"
|
||||
|
||||
#define WI_NIC_LUCENT_EMB_ID 0x0005
|
||||
#define WI_NIC_LUCENT_EMB_STR "Lucent Embedded WaveLAN/IEEE"
|
||||
|
||||
/*
|
||||
* List of intended regulatory domains (0xFD11).
|
||||
*/
|
||||
struct wi_ltv_domains {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_num_dom;
|
||||
u_int8_t wi_domains[10];
|
||||
};
|
||||
|
||||
/*
|
||||
* CIS struct (0xFD13).
|
||||
*/
|
||||
struct wi_ltv_cis {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_cis[240];
|
||||
};
|
||||
|
||||
/*
|
||||
* Communications quality (0xFD43).
|
||||
*/
|
||||
struct wi_ltv_commqual {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_coms_qual;
|
||||
u_int16_t wi_sig_lvl;
|
||||
u_int16_t wi_noise_lvl;
|
||||
};
|
||||
|
||||
/*
|
||||
* Actual system scale thresholds (0xFC06, 0xFD46).
|
||||
*/
|
||||
struct wi_ltv_scalethresh {
|
||||
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_out_of_range;
|
||||
u_int16_t wi_delta_snr;
|
||||
};
|
||||
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
/*
|
||||
* Connection control characteristics. (0xFC00)
|
||||
* 0 == IBSS (802.11 compliant mode) (Only PRISM2)
|
||||
* 1 == Basic Service Set (BSS)
|
||||
* 2 == Wireless Distribudion System (WDS)
|
||||
* 3 == Pseudo IBSS
|
||||
* (Only PRISM2; not 802.11 compliant mode, testing use only)
|
||||
* 6 == HOST AP (Only PRISM2)
|
||||
*/
|
||||
#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
|
||||
|
||||
/*
|
||||
* 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];
|
||||
};
|
||||
|
||||
/*
|
||||
* Station set identification (SSID). (0xFC02, 0xFC04)
|
||||
*/
|
||||
struct wi_ltv_ssid {
|
||||
u_int16_t wi_len;
|
||||
u_int16_t wi_type;
|
||||
u_int16_t wi_id[17];
|
||||
};
|
||||
|
||||
/*
|
||||
* 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];
|
||||
};
|
||||
|
||||
/*
|
||||
* 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 ether_addr wi_mcast[16];
|
||||
};
|
||||
|
||||
/*
|
||||
* supported rates. (0xFCB4)
|
||||
*/
|
||||
#define WI_SUPPRATES_1M 0x0001
|
||||
#define WI_SUPPRATES_2M 0x0002
|
||||
#define WI_SUPPRATES_5M 0x0004
|
||||
#define WI_SUPPRATES_11M 0x0008
|
||||
#define WI_RATES_BITS "\20\0011M\0022M\0035.5M\00411M"
|
||||
|
||||
/*
|
||||
* Information frame types.
|
||||
*/
|
||||
#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_LINK_STAT 0xF200 /* Link status */
|
||||
#define WI_INFO_ASSOC_STAT 0xF201 /* Association status */
|
||||
|
||||
/*
|
||||
* Hermes 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 */
|
||||
};
|
||||
|
||||
#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
|
||||
|
||||
#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_RXSTAT_MSG_TYPE 0xE000
|
||||
|
||||
#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
|
186
sys/dev/owi/if_wivar.h
Normal file
186
sys/dev/owi/if_wivar.h
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2002
|
||||
* M Warner Losh <imp@freebsd.org>. All rights reserved.
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bill Paul.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define WICACHE /* turn on signal strength cache code */
|
||||
#define MAXWICACHE 10
|
||||
|
||||
/*
|
||||
* Encryption controls. We can enable or disable encryption as
|
||||
* well as specify up to 4 encryption keys. We can also specify
|
||||
* which of the four keys will be used for transmit encryption.
|
||||
*/
|
||||
#define WI_RID_ENCRYPTION 0xFC20
|
||||
#define WI_RID_AUTHTYPE 0xFC21
|
||||
#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
|
||||
#define WI_RID_TX_CRYPT_KEY 0xFCB1
|
||||
#define WI_RID_WEP_AVAIL 0xFD4F
|
||||
#define WI_RID_P2_TX_CRYPT_KEY 0xFC23
|
||||
#define WI_RID_P2_CRYPT_KEY0 0xFC24
|
||||
#define WI_RID_P2_CRYPT_KEY1 0xFC25
|
||||
#define WI_RID_MICROWAVE_OVEN 0xFC25
|
||||
#define WI_RID_P2_CRYPT_KEY2 0xFC26
|
||||
#define WI_RID_P2_CRYPT_KEY3 0xFC27
|
||||
#define WI_RID_P2_ENCRYPTION 0xFC28
|
||||
#define WI_RID_ROAMING_MODE 0xFC2D
|
||||
#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
|
||||
|
||||
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;
|
||||
int sc_firmware_type;
|
||||
#define WI_NOTYPE 0
|
||||
#define WI_LUCENT 1
|
||||
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
|
||||
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
|
||||
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 {
|
||||
u_int16_t wi_sleep;
|
||||
u_int16_t wi_delaysupp;
|
||||
u_int16_t wi_txsupp;
|
||||
u_int16_t wi_monitor;
|
||||
u_int16_t wi_ledtest;
|
||||
u_int16_t wi_ledtest_param0;
|
||||
u_int16_t wi_ledtest_param1;
|
||||
u_int16_t wi_conttx;
|
||||
u_int16_t wi_conttx_param0;
|
||||
u_int16_t wi_contrx;
|
||||
u_int16_t wi_sigstate;
|
||||
u_int16_t wi_sigstate_param0;
|
||||
u_int16_t wi_confbits;
|
||||
u_int16_t wi_confbits_param0;
|
||||
} wi_debug;
|
||||
|
||||
};
|
||||
|
||||
struct wi_card_ident {
|
||||
u_int16_t card_id;
|
||||
char *card_name;
|
||||
u_int8_t firm_type;
|
||||
};
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
/*
|
||||
* Various compat hacks/kludges
|
||||
*/
|
||||
#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)
|
||||
#else
|
||||
#define WI_LOCK(_sc, _s) _s = 1
|
||||
#define WI_UNLOCK(_sc, _s)
|
||||
#endif
|
||||
|
||||
int owi_generic_attach(device_t);
|
||||
int owi_generic_detach(device_t);
|
||||
void owi_shutdown(device_t);
|
||||
int owi_alloc(device_t, int);
|
||||
void owi_free(device_t);
|
||||
void owi_stop(struct wi_softc *);
|
||||
void owi_get_id(struct wi_softc *);
|
||||
extern devclass_t owi_devclass;
|
12
sys/modules/owi/Makefile
Normal file
12
sys/modules/owi/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/owi
|
||||
|
||||
KMOD= if_owi
|
||||
SRCS= opt_wi.h if_owi.c if_owi_pccard.c \
|
||||
card_if.h device_if.h bus_if.h pci_if.h
|
||||
|
||||
opt_wi.h:
|
||||
touch ${.TARGET}
|
||||
|
||||
.include <bsd.kmod.mk>
|
Loading…
x
Reference in New Issue
Block a user