bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
0f1b305ee9e700c825d9e9ad1ea1e4311d212eb2Seth Goldberg * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Use is subject to license terms.
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Copyright(c) 2004
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh *
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Redistribution and use in source and binary forms, with or without
bb5e3b2f129cc39517b925419c22f69a378ec023eh * modification, are permitted provided that the following conditions
bb5e3b2f129cc39517b925419c22f69a378ec023eh * are met:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * 1. Redistributions of source code must retain the above copyright
bb5e3b2f129cc39517b925419c22f69a378ec023eh * notice unmodified, this list of conditions, and the following
bb5e3b2f129cc39517b925419c22f69a378ec023eh * disclaimer.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * 2. Redistributions in binary form must reproduce the above copyright
bb5e3b2f129cc39517b925419c22f69a378ec023eh * notice, this list of conditions and the following disclaimer in the
bb5e3b2f129cc39517b925419c22f69a378ec023eh * documentation and/or other materials provided with the distribution.
bb5e3b2f129cc39517b925419c22f69a378ec023eh *
bb5e3b2f129cc39517b925419c22f69a378ec023eh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bb5e3b2f129cc39517b925419c22f69a378ec023eh * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
bb5e3b2f129cc39517b925419c22f69a378ec023eh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
bb5e3b2f129cc39517b925419c22f69a378ec023eh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
bb5e3b2f129cc39517b925419c22f69a378ec023eh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
bb5e3b2f129cc39517b925419c22f69a378ec023eh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
bb5e3b2f129cc39517b925419c22f69a378ec023eh * SUCH DAMAGE.
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#ifndef _SYS_IPW2100_IMPL_H
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define _SYS_IPW2100_IMPL_H
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#ifdef __cplusplus
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern "C" {
bb5e3b2f129cc39517b925419c22f69a378ec023eh#endif
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Intel Wireless PRO/2100 mini-PCI adapter driver
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ipw2100_impl.h includes:
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . implementation of ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . hardware operation and interface define for ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . firmware operation and interface define for ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#include <sys/ddi.h>
bb5e3b2f129cc39517b925419c22f69a378ec023eh#include <sys/sunddi.h>
bb5e3b2f129cc39517b925419c22f69a378ec023eh#include <sys/mac.h>
bb5e3b2f129cc39517b925419c22f69a378ec023eh#include <sys/net80211.h>
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Implementation of ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_NODENAME "ipw"
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_PCI_CFG_RNUM (0) /* pci config space */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_PCI_CSR_RNUM (1) /* device CSR space */
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_NUM_TXBD (128)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_TXBD_SIZE (IPW2100_NUM_TXBD * sizeof (struct ipw2100_bd))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_NUM_TXBUF (IPW2100_NUM_TXBD/2) /* ipw2100_txb number */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_TXBUF_SIZE (sizeof (struct ipw2100_txb))
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_NUM_RXBD (128)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_SIZE (IPW2100_NUM_RXBD * sizeof (struct ipw2100_status))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RXBD_SIZE (IPW2100_NUM_RXBD * sizeof (struct ipw2100_bd))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_NUM_RXBUF (IPW2100_NUM_RXBD)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RXBUF_SIZE (sizeof (struct ipw2100_rxb))
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SIZE (sizeof (struct ipw2100_cmd))
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct dma_region {
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_dma_handle_t dr_hnd;
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_acc_handle_t dr_acc;
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_dma_cookie_t dr_cookie;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint_t dr_ccnt;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t dr_pbase;
bb5e3b2f129cc39517b925419c22f69a378ec023eh caddr_t dr_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh size_t dr_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh const char *dr_name;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_firmware {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t *bin_base; /* image */
bb5e3b2f129cc39517b925419c22f69a378ec023eh size_t bin_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t *fw_base; /* firmware code */
bb5e3b2f129cc39517b925419c22f69a378ec023eh size_t fw_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t *uc_base; /* u-controller code */
bb5e3b2f129cc39517b925419c22f69a378ec023eh size_t uc_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * per-instance soft-state structure
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_softc {
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ieee80211com sc_ic;
bb5e3b2f129cc39517b925419c22f69a378ec023eh dev_info_t *sc_dip;
bb5e3b2f129cc39517b925419c22f69a378ec023eh int (*sc_newstate)(struct ieee80211com *,
bb5e3b2f129cc39517b925419c22f69a378ec023eh enum ieee80211_state, int);
bb5e3b2f129cc39517b925419c22f69a378ec023eh int sc_authmode;
0f1b305ee9e700c825d9e9ad1ea1e4311d212eb2Seth Goldberg int sc_suspended;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* CSR */
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_acc_handle_t sc_ioh;
bb5e3b2f129cc39517b925419c22f69a378ec023eh caddr_t sc_regs;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* interrupt */
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_iblock_cookie_t sc_iblk;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* soft interrupt */
bb5e3b2f129cc39517b925419c22f69a378ec023eh ddi_softintr_t sc_link_softint;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* link state */
bb5e3b2f129cc39517b925419c22f69a378ec023eh int32_t sc_linkstate;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* mutex to protect interrupt handler */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kmutex_t sc_ilock;
bb5e3b2f129cc39517b925419c22f69a378ec023eh kcondvar_t sc_fw_cond;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* flags */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint_t sc_flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_FW_CACHED (1 << 0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_FW_INITED (1 << 1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_RUNNING (1 << 2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_LINK_CHANGE (1 << 3)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_TX_SCHED (1 << 4)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_CMD_WAIT (1 << 5)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_SCAN_COMPLETE (1 << 6)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_HW_ERR_RECOVER (1 << 7)
799aa485da68fdaa1850eaf833ad108e5af82adbKonstantin Ananyev#define IPW2100_FLAG_QUIESCED (1 << 8)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_FLAG_HAS_RADIO_SWITCH (1 << 16)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* command */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_cmd *sc_cmd;
bb5e3b2f129cc39517b925419c22f69a378ec023eh int sc_done; /* command is done */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kcondvar_t sc_cmd_cond;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* reschedule lock */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kmutex_t sc_resched_lock;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* tx ring, bd->hdr&buf */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kmutex_t sc_tx_lock;
bb5e3b2f129cc39517b925419c22f69a378ec023eh kcondvar_t sc_tx_cond;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_tx_cur;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_tx_free;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_bd *sc_txbd;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_txb *sc_txbufs[IPW2100_NUM_TXBUF];
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* rx ring, status, bd->buf */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_rx_cur;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_rx_free;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_status *sc_status;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_bd *sc_rxbd;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_rxb *sc_rxbufs[IPW2100_NUM_RXBUF];
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* DMA resources */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_txbd; /* tx buffer descriptor */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_txbufs[IPW2100_NUM_TXBUF];
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_rxbd; /* rx buffer descriptor */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_rxbufs[IPW2100_NUM_RXBUF];
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_status;
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_cmd; /* command */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* hw configuration values */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t sc_macaddr[IEEE80211_ADDR_LEN];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t sc_chmask;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* MAC address string */
bb5e3b2f129cc39517b925419c22f69a378ec023eh char sc_macstr[32];
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* tables */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_table1_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_table2_base;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* firmware */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_firmware sc_fw;
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* mfthread related */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kmutex_t sc_mflock;
bb5e3b2f129cc39517b925419c22f69a378ec023eh kcondvar_t sc_mfthread_cv;
bb5e3b2f129cc39517b925419c22f69a378ec023eh kcondvar_t sc_scan_cv; /* used for active scan */
bb5e3b2f129cc39517b925419c22f69a378ec023eh kthread_t *sc_mf_thread;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t sc_mfthread_switch; /* 0/1 indicate off/on */
bb5e3b2f129cc39517b925419c22f69a378ec023eh int if_flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * RING_BACKWARD - move 'x' backward 's' steps in a 'b'-sized ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh * RING_FORWARD - move 'x' forward 's' steps in a 'b'-sized ring
bb5e3b2f129cc39517b925419c22f69a378ec023eh *
bb5e3b2f129cc39517b925419c22f69a378ec023eh * note that there must be 0 <= 'x' < 'b' && 0 <= 's' < 'b'
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define RING_FLEN(x, y, b) ((((x) > (y)) ? ((b)+(y)-(x)) : ((y)-(x))))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define RING_FORWARD(x, s, b) (((x)+(s))%(b))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define RING_BACKWARD(x, s, b) RING_FORWARD((x), (b)-(s), (b))
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * field_offset
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define OFFSETOF(s, m) ((size_t)(&(((s *)0)->m)))
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_init(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_disable(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Below structure and functions will be used for statistic
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct statistic {
bb5e3b2f129cc39517b925419c22f69a378ec023eh int index;
bb5e3b2f129cc39517b925419c22f69a378ec023eh const char *desc;
bb5e3b2f129cc39517b925419c22f69a378ec023eh int unit;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define INT 1
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define HEX 2
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define MASK HEX
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define PERCENTAGE 3
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define BOOL 4
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_get_statistics(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Hardware related definations and interfaces.
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_INTR (0x0008)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_INTR_MASK (0x000c)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_INDIRECT_ADDR (0x0010)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_INDIRECT_DATA (0x0014)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_AUTOINC_ADDR (0x0018)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_AUTOINC_DATA (0x001c)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RST (0x0020)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_CTL (0x0024)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_IO (0x0030)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_DEBUG_AREA (0x0090)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TX_BD_BASE (0x0200)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TX_BD_SIZE (0x0204)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RX_BD_BASE (0x0240)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RX_STATUS_BASE (0x0244)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RX_BD_SIZE (0x0248)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TABLE1_BASE (0x0380)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TABLE2_BASE (0x0384)
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx-rd-index the entry to be processed by HW, i.e. empty tx buffer
bb5e3b2f129cc39517b925419c22f69a378ec023eh * tx-wr-index the entry just being filled by SW with new data to transmit
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TX_READ_INDEX (0x0280)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_TX_WRITE_INDEX (0x0f80)
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * rx-rd-index the entry just being processed by HW, i.e. new received data
bb5e3b2f129cc39517b925419c22f69a378ec023eh * rx-wr-index the entry just being set by SW to empty buffer to receive
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RX_READ_INDEX (0x02a0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CSR_RX_WRITE_INDEX (0x0fa0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_INTR
bb5e3b2f129cc39517b925419c22f69a378ec023eh * The interrupt register is used to indicate the h/w status
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_TX_TRANSFER (0x00000001)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_RX_TRANSFER (0x00000002)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_STATUS_CHANGE (0x00000010)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_COMMAND_DONE (0x00010000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_FW_INIT_DONE (0x01000000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_FATAL_ERROR (0x40000000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_PARITY_ERROR (0x80000000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_MASK_ALL (IPW2100_INTR_TX_TRANSFER | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_RX_TRANSFER | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_STATUS_CHANGE | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_COMMAND_DONE | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_FW_INIT_DONE | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_FATAL_ERROR | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_PARITY_ERROR)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_MASK_ERR (IPW2100_INTR_FATAL_ERROR | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh IPW2100_INTR_PARITY_ERROR)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_RST
bb5e3b2f129cc39517b925419c22f69a378ec023eh * The reset register is used to reset hardware
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RST_PRINCETON_RESET (0x00000001)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RST_SW_RESET (0x00000080)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RST_MASTER_DISABLED (0x00000100)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RST_STOP_MASTER (0x00000200)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_CTL
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CTL_CLOCK_READY (0x00000001)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CTL_ALLOW_STANDBY (0x00000002)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CTL_INIT (0x00000004)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_IO
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IO_GPIO1_ENABLE (0x00000008)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IO_GPIO1_MASK (0x0000000c)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IO_GPIO3_MASK (0x000000c0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IO_LED_OFF (0x00002000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IO_RADIO_DISABLED (0x00010000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * States code
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_ASSOCIATED (0x0004)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_ASSOCIATION_LOST (0x0008)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_SCAN_COMPLETE (0x0020)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_RADIO_DISABLED (0x0100)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_DISABLED (0x0200)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATE_SCANNING (0x0800)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * table1 offsets
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_LOCK (480)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_APS_CNT (604)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_APS_BASE (608)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_CARD_DISABLED (628)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_CURRENT_CHANNEL (756)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_CURRENT_TX_RATE (768)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * table2 offsets
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_CURRENT_SSID (48)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INFO_CURRENT_BSSID (112)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * supported rates
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RATE_DS1 (1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RATE_DS2 (2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RATE_DS5 (4)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RATE_DS11 (8)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* hw structures, packed */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#pragma pack(1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * firmware binary image header
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_firmware_hdr {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t version;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t fw_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t uc_size;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * buffer descriptor
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_bd {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t phyaddr;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t len;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* flags */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_BD_FLAG_TX_LAST_FRAGMENT (0x08)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_BD_FLAG_TX_NOT_LAST_FRAGMENT (0x01)
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* data content */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_BD_FLAG_TX_FRAME_802_3 (0x00)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_BD_FLAG_TX_FRAME_COMMAND (0x02)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_BD_FLAG_TX_FRAME_802_11 (0x04)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* number of fragments, only 1st BD is needed */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t nfrag;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t reserved[6];
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * status descriptor
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_status {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t len;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t code;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_CODE_COMMAND (0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_CODE_NEWSTATE (1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_CODE_DATA_802_11 (2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_CODE_DATA_802_3 (3)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_CODE_NOTIFICATION (4)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_FLAG_DECRYPTED (0x01)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_FLAG_WEP_ENCRYPTED (0x02)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_STATUS_FLAG_CRC_ERROR (0x04)
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* received signal strength indicator */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t rssi;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * data header
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_hdr {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t type;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t subtype;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t encrypted;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t encrypt;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t keyidx;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t keysz;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t key[IEEE80211_KEYBUF_SIZE];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t reserved[10];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t saddr[IEEE80211_ADDR_LEN];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t daddr[IEEE80211_ADDR_LEN];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t fragsz;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * command
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_cmd {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t type;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_ENABLE (2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_CONFIGURATION (6)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_ESSID (8)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_MANDATORY_BSSID (9)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_AUTH_TYPE (10)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_MAC_ADDRESS (11)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_MODE (12)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_I18N_MODE (13)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_CHANNEL (14)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_RTS_THRESHOLD (15)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_FRAG_THRESHOLD (16)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_POWER_MODE (17)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_TX_RATES (18)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_BASIC_TX_RATES (19)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_WEP_KEY (20)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_WEP_KEY_INDEX (25)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_WEP_FLAGS (26)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_ADD_MULTICAST (27)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_CLR_MULTICAST (28)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_BEACON_INTERVAL (29)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_CLR_STATISTICS (31)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SEND (33)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_TX_POWER_INDEX (36)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_BROADCAST_SCAN (43)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_DISABLE (44)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_DESIRED_BSSID (45)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_SCAN_OPTIONS (46)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_PREPARE_POWER_DOWN (58)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_DISABLE_PHY (61)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_SECURITY_INFORMATION (67)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CMD_SET_WPA_IE (69)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t subtype;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t seq;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t len;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t data[400];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t status;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t reserved[68];
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IPW2100_CMD_SET_POWER_MODE
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_POWER_MODE_CAM (0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_POWER_AUTOMATIC (6)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IPW2100_CMD_SET_MODE
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_MODE_BSS (0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_MODE_IBSS (1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_MODE_MONITOR (2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_WEP_KEY
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_wep_key {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t idx;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t len;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t key[13];
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_SECURITY_INFORMATION
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_security {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t ciphers;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CIPHER_NONE (0x00000001)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CIPHER_WEP40 (0x00000002)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CIPHER_WEP104 (0x00000020)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t version;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t authmode;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_AUTH_OPEN (0)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_AUTH_SHARED (1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t replay_counters_number;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t unicast_using_group;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_SCAN_OPTIONS
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_scan_options {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_SCAN_DO_NOT_ASSOCIATE (0x00000001)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_SCAN_PASSIVE (0x00000008)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t channels;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_CONFIGURATION
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_configuration {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t flags;
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_PROMISCUOUS (0x00000004)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_PREAMBLE_AUTO (0x00000010)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_IBSS_AUTO_START (0x00000020)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_802_1x_ENABLE (0x00004000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_BSS_MASK (0x00008000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_CFG_IBSS_MASK (0x00010000)
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t bss_chan;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t ibss_chan;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * element in AP table
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_node {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t reserved_1[2];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t bssid[IEEE80211_ADDR_LEN];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t chan;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t rates;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t reserved_2;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t capinfo;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t reserved_3;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t intval;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t reserved_4[28];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t essid[IEEE80211_NWID_LEN];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t reserved_5;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t esslen;
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t reserved_6[7];
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t rssi;
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh#pragma pack()
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * transmit buffer block
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_txb {
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct ipw2100_hdr txb_hdr; /* header */
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t txb_dat[IEEE80211_MAX_LEN]; /* payload */
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * maximum frame header lenght: 4 MAC addresses + 1 fc + 1 id + 1 seqctl
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IEEE80211_MAX_FHLEN (4*6+2+2+2)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * receive buffer block
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehstruct ipw2100_rxb {
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t rxb_dat[IEEE80211_MAX_FHLEN /* frame */
bb5e3b2f129cc39517b925419c22f69a378ec023eh + IEEE80211_MAX_LEN /* payload */
bb5e3b2f129cc39517b925419c22f69a378ec023eh + IEEE80211_CRC_LEN]; /* FCS */
bb5e3b2f129cc39517b925419c22f69a378ec023eh};
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ROM entries
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_ROM_RADIO (0x11)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_ROM_MAC (0x21)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_ROM_CHANNEL_LIST (0x37)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * EEPROM controls
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_IMEM_EEPROM_CTL (0x00300040)
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_EEPROM_DELAY (1)
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR access routines
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint8_t ipw2100_csr_get8(struct ipw2100_softc *sc, uint32_t off);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint16_t ipw2100_csr_get16(struct ipw2100_softc *sc, uint32_t off);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint32_t ipw2100_csr_get32(struct ipw2100_softc *sc, uint32_t off);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_rep_get16(struct ipw2100_softc *sc, uint32_t off,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint16_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_put8(struct ipw2100_softc *sc, uint32_t off,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint8_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_put16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off, uint16_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_put32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off, uint32_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_rep_put8(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off, uint8_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint8_t ipw2100_imem_get8(struct ipw2100_softc *sc, int32_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint16_t ipw2100_imem_get16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint32_t ipw2100_imem_get32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_rep_get16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint16_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_put8(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint8_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_put16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint16_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_put32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint32_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_rep_put8(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint8_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_getbuf(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint8_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_putbuf(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t addr, uint8_t *buf, size_t cnt);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_rom_control(struct ipw2100_softc *sc, uint32_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint8_t ipw2100_table1_get8(struct ipw2100_softc *sc, uint32_t off);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint32_t ipw2100_table1_get32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_table1_put32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off, uint32_t val);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_table2_getbuf(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023eh uint32_t off, uint8_t *buf, uint32_t *len);
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint16_t ipw2100_rom_get16(struct ipw2100_softc *sc, uint8_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh/*
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Firmware related definations and interfaces.
bb5e3b2f129cc39517b925419c22f69a378ec023eh */
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_cache_firmware(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_free_firmware(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_load_uc(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_load_fw(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#ifdef __cplusplus
bb5e3b2f129cc39517b925419c22f69a378ec023eh}
bb5e3b2f129cc39517b925419c22f69a378ec023eh#endif
bb5e3b2f129cc39517b925419c22f69a378ec023eh
bb5e3b2f129cc39517b925419c22f69a378ec023eh#endif /* _SYS_IPW2100_IMPL_H */