pcwl.h revision 305a15047c0c4be5ad9c852e8de5c2c56cb6134b
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* 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
* 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.
*/
/*
* Hardware specific driver declarations for Lucent and PrismII
* chipsets.
*/
#ifndef _SYS_PCWL_H
#define _SYS_PCWL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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 WL_RID_ENCRYPTION 0xFC20
#define WL_RID_ENCRYPTION_P2 0xFC28
#define WL_RID_DEFLT_CRYPT_KEYS 0xFCB0
#define WL_RID_CRYPT_KEY0_P2 0xFC24
#define WL_RID_TX_CRYPT_KEY 0xFCB1
#define WL_RID_TX_CRYPT_KEY_P2 0xFC23
#define WL_RID_WEP_AVAIL 0xFD4F
#define WL_AUTHTYPE_SYS_P2 0x1
#define WL_AUTHTYPE_KEY_P2 0x2
#define WL_SPEED_1Mbps_P2 0x1
#define WL_SPEED_2Mbps_P2 0x2
#define WL_SPEED_55Mbps_P2 0x4
#define WL_SPEED_11Mbps_P2 0x8
/*
* PrismII Tx rate
*/
#define WL_P_TX_RATE_FIX_1M WL_SPEED_1Mbps_P2
#define WL_P_TX_RATE_FIX_2M WL_SPEED_2Mbps_P2
#define WL_P_TX_RATE_AUTO_H \
#define WL_P_TX_RATE_AUTO_M \
#define WL_P_TX_RATE_AUTO_L \
#define WL_TIMEOUT 500000
/*
* Default port: 0 (only 0 exists on stations)
*/
#define WL_DEFAULT_PORT 0
/*
* Lucent TX rate: Default 11Mbps
*/
#define WL_L_TX_RATE_FIX_1M 1
#define WL_L_TX_RATE_FIX_2M 2
#define WL_L_TX_RATE_AUTO_H 3
#define WL_L_TX_RATE_FIX_11M 5
#define WL_L_TX_RATE_AUTO_L 6
#define WL_L_TX_RATE_AUTO_M 7
#define WL_TX_RATE_FIX_1M(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_FIX_2M(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_AUTO_H(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_FIX_5M(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_FIX_11M(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_AUTO_L(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
#define WL_TX_RATE_AUTO_M(p) \
(p->pcwl_chip_type == PCWL_CHIP_PRISMII ? \
/*
* Default network name: empty string implies any
*/
#define WL_DEFAULT_NETNAME ("")
#define WL_DEFAULT_NODENAME ("solaris node")
#define WL_DEFAULT_AP_DENSITY 1
#define WL_DEFAULT_RTS_THRESH 2347
#define WL_DEFAULT_DATALEN 2304
#define WL_DEFAULT_CREATE_IBSS 0
#define WL_DEFAULT_PM_ENABLED 0
#define WL_DEFAULT_MAX_SLEEP 100
#define WL_DEFAULT_CHAN 3
#define WL_DEFAULT_TX_CRYPT_KEY 0
/*
* Size of Hermes I/O space.
*/
#define WL_IOSIZ 0x40
/*
*/
#define WL_COMMAND 0x00
#define WL_PARAM0 0x02
#define WL_PARAM1 0x04
#define WL_PARAM2 0x06
#define WL_STATUS 0x08
#define WL_RESP0 0x0A
#define WL_RESP1 0x0C
#define WL_RESP2 0x0E
/*
* Command register values.
*/
#define WL_CMD_DIAG 0x0003
#define WL_CMD_NOTIFY 0x0010
#define WL_CMD_INQUIRE 0x0011
#define WL_CMD_ACCESS 0x0021
#define WL_CMD_PROGRAM 0x0022
#define WL_CMD_CODE_MASK 0x003F
/*
* Reclaim qualifier bit, applicable to the
* TX and INQUIRE commands.
*/
/*
* ACCESS command qualifier bits.
*/
#define WL_ACCESS_READ 0x0000
#define WL_ACCESS_WRITE 0x0100
/*
* PROGRAM command qualifier bits.
*/
#define WL_PROGRAM_DISABLE 0x0000
#define WL_PROGRAM_ENABLE_RAM 0x0100
#define WL_PROGRAM_ENABLE_NVRAM 0x0200
#define WL_PROGRAM_NVRAM 0x0300
/*
* Status register values
*/
#define WL_STAT_CMD_CODE 0x003F
#define WL_STAT_DIAG_ERR 0x0100
#define WL_STAT_INQ_ERR 0x0500
#define WL_STAT_CMD_RESULT 0x7F00
/*
* memory handle management registers
*/
#define WL_INFO_FID 0x10
#define WL_RX_FID 0x20
#define WL_ALLOC_FID 0x22
#define WL_TX_CMP_FID 0x24
#define WL_INVALID_FID 0xffff
/*
* Buffer Access Path (BAP) registers.
* These are I/O channels. 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.
* For PrismII chip, frequently overlap between BAP0 and BAP1
* may hang the hardware. this is a known bug, so just use BAP1
* for PrismII.
*/
#define WL_SEL0 0x18
#define WL_SEL1 0x1A
#define WL_OFF0 0x1C
#define WL_OFF1 0x1E
#define WL_DATA0 0x36
#define WL_DATA1 0x38
#define WL_OFF_BUSY 0x8000
#define WL_OFF_ERR 0x4000
#define WL_OFF_DATAOFF 0x0FFF
/*
* Event registers
*/
/*
* Events
*/
#define WL_INTRS \
/*
* Host software registers
*/
#define WL_SW0 0x28
#define WL_SW1 0x2A
#define WL_SW2 0x2C
#define WL_SW3 0x2E
#define WL_CNTL 0x14
#define WL_CNTL_AUX_ENA 0xC000
#define WL_CNTL_AUX_ENA_STAT 0xC000
#define WL_CNTL_AUX_DIS_STAT 0x0000
#define WL_CNTL_AUX_ENA_CNTL 0x8000
#define WL_CNTL_AUX_DIS_CNTL 0x4000
#define WL_AUX_PAGE 0x3A
#define WL_AUX_OFFSET 0x3C
#define WL_AUX_DATA 0x3E
#define WL_RID_DNLD_BUF 0xFD01
/*
* Mem sizes (0xFD02).
*/
#define WL_RID_MEMSZ 0xFD02
#define WL_RID_FWIDENT_P2 0xFD02
/*
* NIC Identification (0xFD0B).
*/
#define WL_RID_CARD_ID 0xFD0B
typedef struct pcwl_ltv_ver {
#define WL_RID_FWVER 0xFFFF
typedef struct pcwl_ltv_fwver {
#define WI_NIC_EVB2 0x8000
#define WI_NIC_HWB3763 0x8001
#define WI_NIC_HWB3163 0x8002
#define WI_NIC_HWB3163B 0x8003
#define WI_NIC_EVB3 0x8004
#define WI_NIC_HWB1153 0x8007
#define WI_NIC_PRISM2_5 0x800C
/*
* List of intended regulatory domains (0xFD11).
*/
#define WL_RID_DOMAINS 0xFD11
/*
* CIS struct (0xFD13).
*/
#define WL_RID_CIS 0xFD13
/*
* Current MAC port connection status
*/
#define WL_RID_PORTSTATUS 0xFD40
#define WL_PORT_DISABLED 1
#define WL_PORT_INITIAL 2
#define WL_PORT_TO_IBSS 3
#define WL_PORT_TO_BSS 4
#define WL_PORT_OOR 5
/*
* Current Service Set the station is connected to
*/
#define WL_RID_SSID 0xFD41
/*
* MAC address used as identifier of the BSS the station
* is connected to
*/
#define WL_RID_BSSID 0xFD42
/*
* Communications quality (0xFD43).
*/
#define WL_RID_COMMQUAL 0xFD43
/*
* Actual system scale thresholds (0xFD46).
*/
#define WL_RID_SYSTEM_SCALE 0xFC06
/*
* Actual current transmission rate
*/
#define WL_RID_CUR_TX_RATE 0xFD44
/*
* Connection control characteristics.
* 1 == Basic Service Set (BSS), a.k.a IEEE 802.11 Infrastructure
* 2 == Wireless Distribudion System (WDS), Access Point only
* 3 == Pseudo IBSS / Ad Hoc
*/
#define WL_RID_PORTTYPE 0xFC00
#define WL_PORTTYPE_BSS 0x1
#define WL_PORTTYPE_WDS 0x2
#define WL_PORTTYPE_ADHOC 0x3
/*
* Mac addresses.
*/
#define WL_RID_MAC_NODE 0xFC01
#define WL_RID_MAC_WDS 0xFC08
/*
* Station set identification (SSID).
*/
#define WL_RID_DESIRED_SSID 0xFC02
#define WL_RID_OWN_SSID 0xFC04
/*
* Set communications channel (radio frequency).
*/
#define WL_RID_OWN_CHNL 0xFC03
#define WL_RID_CURRENT_CHNL 0xFDC1
/*
* Frame data size.
*/
#define WL_RID_MAX_DATALEN 0xFC07
/*
* ESS power management enable
*/
#define WL_RID_PM_ENABLED 0xFC09
/*
* ESS max PM sleep internal
*/
#define WL_RID_MAX_SLEEP 0xFC0C
/*
* Set our station name.
*/
#define WL_RID_NODENAME 0xFC0E
/*
* Multicast addresses to be put in filter. We're
* allowed up to 16 addresses in the filter.
*/
#define WL_RID_MCAST 0xFC80
/*
* Create IBSS.
*/
#define WL_RID_CREATE_IBSS 0xFC81
#define WL_RID_FRAG_THRESH 0xFC82
#define WL_RID_RTS_THRESH 0xFC83
/*
* TX rate control
* 0 == Fixed 1mbps
* 1 == Fixed 2mbps
* 2 == auto fallback
*/
#define WL_RID_TX_RATE 0xFC84
/*
* promiscuous mode.
*/
#define WL_RID_PROMISC 0xFC85
/*
* scan ssid
*/
#define WL_RID_SCAN_SSID 0xFCB2
/*
* Auxiliary Timer tick interval
*/
#define WL_RID_TICK_TIME 0xFCE0
/*
* PrismII scan
*/
#define WL_RID_SCAN_REQUEST 0xFCE1
#define WL_RID_HSCAN_REQUEST 0xFCE5
/*
* Information frame types.
*/
/*
* Link status
*/
#define WL_LINK_CONNECT 1
#define WL_LINK_DISCONNECT 2
typedef struct wl_scan_result {
typedef struct wl_scan_list {
#define WL_FTYPE_MGMT 0x0000
#define WL_FTYPE_CTL 0x0004
#define WL_FTYPE_DATA 0x0008
/*
* SNAP (sub-network access protocol) constants for transmission
* of IP datagrams over IEEE 802 networks, taken from RFC1042.
* structure.
*/
#define WL_SNAP_K2 0x00
#define WL_SNAPHDR_LEN 0x6
/*
*/
typedef struct wl_frame {
} wl_frame_t;
static wl_frame_t wl_frame_default = {
0, /* wl_status 0x00 */
0, /* wl_rsvd0 0x02 */
0, /* wl_rsvd1 0x04 */
0, /* wl_q_info 0x06 */
0, /* wl_rsvd2 0x08 */
0, /* wl_rsvd3 0x0A */
0, /* wl_tx_ctl 0x0C */
WL_FTYPE_DATA, /* wl_frame_ctl 0x0E */
0, /* wl_id 0x10 */
{ 0, 0, 0, 0, 0, 0 }, /* wl_addr1[6] 0x12 */
{ 0, 0, 0, 0, 0, 0 }, /* wl_addr2[6] 0x18 */
{ 0, 0, 0, 0, 0, 0 }, /* wl_addr3[6] 0x1E */
0, /* wl_seq_ctl 0x24 */
{ 0, 0, 0, 0, 0, 0 }, /* wl_addr4[6] 0x26 */
{ 0, 0, 0, 0, 0, 0 }, /* wl_dst_addr[6] 0x2E */
{ 0, 0, 0, 0, 0, 0 }, /* wl_src_addr[6] 0x34 */
0 /* wl_type 0x42 */
};
#define ETH_HDRLEN (sizeof (struct ether_header))
#define WL_802_3_HDRLEN 0x2E
#define WL_802_11_HDRLEN 0x44
#define WL_802_11_RAW_HDRLEN 0x3C
#define WL_STAT_BADCRC 0x0001
#define WL_STAT_UNDECRYPTABLE 0x0002
#define WL_STAT_ERRSTAT 0x0003
#define WL_STAT_MAC_PORT 0x0700
#define WL_RXSTAT_MSG_TYPE 0xE000
#define WL_ENC_TX_802_3 0x00
#define WL_ENC_TX_802_11 0x11
#define WL_ENC_TX_E_II 0x0E
#define WL_ENC_TX_1042 0x00
#define WL_ENC_TX_TUNNEL 0xF8
#define WL_TXCNTL_MACPORT 0x00FF
#define WL_TXCNTL_STRUCTTYPE 0xFF00
#define WL_TXCNTL_TXOK 0x2
#define WL_TXCNTL_TXEX 0x4
typedef struct rf_ckey {
} rf_ckey_t;
/*
* Configurable parameters of the RF interface
* All the info here is passed to the card through PIO.
*/
typedef struct pcwl_rf {
char rf_own_ssid[34];
char rf_desired_ssid[34];
char rf_nodename[34];
} pcwl_rf_t;
#define PCWL_MCAST_ENTSHIFT 4
typedef enum {
WLC_TX_UNICAST_FRAMES, /* 0+ */
WLC_TX_MULTICAST_FRAMES, /* 1+ */
WLC_TX_FRAGMENTS, /* 2+ */
WLC_TX_UNICAST_OCTETS, /* 3+ */
WLC_TX_MULTICAST_OCTETS, /* 4 */
WLC_TX_DEFERRED_XMITS, /* 5+ */
WLC_TX_SINGLE_RETRIES, /* 6+ */
WLC_TX_MULTI_RETRIES, /* 7+ */
WLC_TX_RETRY_LIMIT, /* 8+ */
WLC_TX_DISCARDS, /* 9+ */
WLC_RX_UNICAST_FRAMES, /* 10+ */
WLC_RX_MULTICAST_FRAMES, /* 11+ */
WLC_RX_FRAGMENTS, /* 12+ */
WLC_RX_UNICAST_OCTETS, /* 13+ */
WLC_RX_MULTICAST_OCTETS, /* 14 */
WLC_RX_FCS_ERRORS, /* 15+ */
WLC_RX_DISCARDS_NOBUF, /* 16+ */
WLC_TX_DISCARDS_WRONG_SA, /* 17+ */
WLC_RX_WEP_CANT_DECRYPT, /* 18+ */
WLC_RX_MSG_IN_MSG_FRAGS, /* 19+ */
WLC_RX_MSG_IN_BAD_MSG_FRAGS, /* 20+ */
WLC_STAT_CNT /* 21 - keep it as the last entry */
#define WL_XMT_BUF_NUM 8
typedef struct wl_tx_ring_data {
int wl_tx_prod;
int wl_tx_cons;
#define PCWL_DEVICE_PCI 0
#define PCWL_DEVICE_PCCARD 1
/*
* The macinfo is really used as the softstate structure.
*
* pcwl_mh - mac_handle_t structure
* pcwl_cslock - lock for card services request. Used with pcwl_cscv
* pcwl_cscv - condition variable to wait for card events
* pcwl_chdl - client handle, an uint32_t bit mask encoding for socket,
* function, and client info.
* See cs_priv.h MAKE_CLIENT_HANDLE.
* pcwl_log_sock - holds the logical to physical translation for this card.
* Specifically has physical adapter and socket #.
* Socket # is the same as part of the pcwl_chdl encoding.
* Physical adapter # is from card service socket impl.
*/
typedef struct pcwl_macinfo {
int pcwl_device_type; /* pci or pcmcia card */
int pcwl_socket; /* socket number */
int pcwl_config_hi; /* cfttbl index */
int pcwl_config; /* default config index */
int pcwl_vcc; /* vcc level */
int pcwl_iodecode; /* # of address lines */
int pcwl_chip_type; /* Lucent or Prism-II */
} pcwl_maci_t;
#define PCWL_CHIP_LUCENT 0
#define PCWL_CHIP_PRISMII 1
#define PCWL_CARD_INTREN 0x1
#define PCWL_CARD_GSTAT 0x8
#define PCWL_ATTACHED 0x10
#define PCWL_CS_REGISTERED 0x20
#define PCWL_ENABLED 0x40
#define PCWL_CARD_READY 0x80
#define PCWL_CARD_FAILED 0x100
#define PCWL_CARD_INTR 0x200
#define PCWL_STATE_IDLE 0x1
/*
* high level device access primitives, glock must held before calling
*/
/*
* Required driver entry points for mac
*/
static int pcwl_start(void *);
static void pcwl_stop(void *);
static int pcwl_saddr(void *, const uint8_t *);
/*
* prototypes of the function for wifi ioctl
*/
static void pcwl_scanlist_timeout(void *);
static void pcwl_get_rssi(pcwl_maci_t *);
static void pcwl_connect_timeout(void *arg);
#define PCWL_READ(p, o, v) { \
if (p->pcwl_device_type == PCWL_DEVICE_PCI) { \
v = LE_16(t); \
} else { \
v = LE_16(t); \
}\
}
#define PCWL_WRITE(p, o, v) { \
if (p->pcwl_device_type == PCWL_DEVICE_PCI) { \
ddi_put16(p->pcwl_handle, \
} else { \
}\
}
#define PCWL_READ_P(p, o, v, h) { \
if (p->pcwl_device_type == PCWL_DEVICE_PCI) { \
*(v) = h ? LE_16(t) : t; \
} else { \
*(v) = h ? LE_16(t) : t; \
}\
}
#define PCWL_WRITE_P(p, o, v, h) { \
if (p->pcwl_device_type == PCWL_DEVICE_PCI) { \
h ? LE_16(*(v)) : (*(v))); \
} else {\
}\
}
#ifdef _BIG_ENDIAN
int pcwl_swap_len = len; \
pcwl_swap_len--; \
} \
}
#else /* _BIG_ENDIAN */
#endif /* _BIG_ENDIAN */
#define PCWL_ENABLE_INTR(pcwl_p) {\
}
#define PCWL_DISABLE_INTR(pcwl_p) { \
}
/*
* 16-bit driver private status code
*/
#define PCWL_SUCCESS 0x0
#define PCWL_FAIL 0x1
#define PCWL_TIMEDOUT_CMD 0x10
#define PCWL_TIMEDOUT_ACCESS 0x11
#define PCWL_TIMEDOUT_TARGET 0x12
#define PCWL_BADLEN 0x13
#define PCWL_BADTYPE 0x14
#define PCWL_TIMEDOUT_ALLOC 0x15
#define PCWL_FAILURE_CMD 0x16
#define PCWL_STATUS_MAX 0xffff
#define N_PCWL 2
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PCWL_H */