0f1b305ee9e700c825d9e9ad1ea1e4311d212eb2Seth Goldberg * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Use is subject to license terms.
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Copyright(c) 2004
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
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 * 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.
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern "C" {
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Intel Wireless PRO/2100 mini-PCI adapter driver
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . implementation of ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . hardware operation and interface define for ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh * . firmware operation and interface define for ipw2100
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Implementation of ipw2100
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_STATUS_SIZE (IPW2100_NUM_RXBD * sizeof (struct ipw2100_status))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_RXBD_SIZE (IPW2100_NUM_RXBD * sizeof (struct ipw2100_bd))
bb5e3b2f129cc39517b925419c22f69a378ec023eh * per-instance soft-state structure
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* interrupt */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* soft interrupt */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* link state */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* mutex to protect interrupt handler */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* flags */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* command */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* reschedule lock */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* tx ring, bd->hdr&buf */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* rx ring, status, bd->buf */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* DMA resources */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_txbd; /* tx buffer descriptor */
bb5e3b2f129cc39517b925419c22f69a378ec023eh struct dma_region sc_dma_rxbd; /* rx buffer descriptor */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* hw configuration values */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* MAC address string */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* tables */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* firmware */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* mfthread related */
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 * note that there must be 0 <= 'x' < 'b' && 0 <= 's' < 'b'
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define RING_FLEN(x, y, b) ((((x) > (y)) ? ((b)+(y)-(x)) : ((y)-(x))))
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define RING_BACKWARD(x, s, b) RING_FORWARD((x), (b)-(s), (b))
bb5e3b2f129cc39517b925419c22f69a378ec023eh * field_offset
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Below structure and functions will be used for statistic
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_get_statistics(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Hardware related definations and interfaces.
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 * 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 * CSR flags: IPW2100_CSR_INTR
bb5e3b2f129cc39517b925419c22f69a378ec023eh * The interrupt register is used to indicate the h/w status
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_MASK_ALL (IPW2100_INTR_TX_TRANSFER | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh#define IPW2100_INTR_MASK_ERR (IPW2100_INTR_FATAL_ERROR | \
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_RST
bb5e3b2f129cc39517b925419c22f69a378ec023eh * The reset register is used to reset hardware
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_CTL
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR flags: IPW2100_CSR_IO
bb5e3b2f129cc39517b925419c22f69a378ec023eh * States code
bb5e3b2f129cc39517b925419c22f69a378ec023eh * table1 offsets
bb5e3b2f129cc39517b925419c22f69a378ec023eh * table2 offsets
bb5e3b2f129cc39517b925419c22f69a378ec023eh * supported rates
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* hw structures, packed */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * firmware binary image header
bb5e3b2f129cc39517b925419c22f69a378ec023eh * buffer descriptor
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* flags */
bb5e3b2f129cc39517b925419c22f69a378ec023eh/* data content */
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* number of fragments, only 1st BD is needed */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * status descriptor
bb5e3b2f129cc39517b925419c22f69a378ec023eh /* received signal strength indicator */
bb5e3b2f129cc39517b925419c22f69a378ec023eh * data header
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IPW2100_CMD_SET_POWER_MODE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * IPW2100_CMD_SET_MODE
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_WEP_KEY
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_SECURITY_INFORMATION
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_SCAN_OPTIONS
bb5e3b2f129cc39517b925419c22f69a378ec023eh * structure for IPW2100_CMD_SET_CONFIGURATION
bb5e3b2f129cc39517b925419c22f69a378ec023eh * element in AP table
bb5e3b2f129cc39517b925419c22f69a378ec023eh * transmit buffer block
bb5e3b2f129cc39517b925419c22f69a378ec023eh * maximum frame header lenght: 4 MAC addresses + 1 fc + 1 id + 1 seqctl
bb5e3b2f129cc39517b925419c22f69a378ec023eh * receive buffer block
bb5e3b2f129cc39517b925419c22f69a378ec023eh * ROM entries
bb5e3b2f129cc39517b925419c22f69a378ec023eh * EEPROM controls
bb5e3b2f129cc39517b925419c22f69a378ec023eh * CSR access routines
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,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_put8(struct ipw2100_softc *sc, uint32_t off,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_csr_rep_put8(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint8_t ipw2100_imem_get8(struct ipw2100_softc *sc, int32_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint16_t ipw2100_imem_get16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint32_t ipw2100_imem_get32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_rep_get16(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_imem_rep_put8(struct ipw2100_softc *sc,
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,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern void ipw2100_table1_put32(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_table2_getbuf(struct ipw2100_softc *sc,
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern uint16_t ipw2100_rom_get16(struct ipw2100_softc *sc, uint8_t addr);
bb5e3b2f129cc39517b925419c22f69a378ec023eh * Firmware related definations and interfaces.
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_cache_firmware(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023ehextern int ipw2100_free_firmware(struct ipw2100_softc *sc);
bb5e3b2f129cc39517b925419c22f69a378ec023eh#endif /* _SYS_IPW2100_IMPL_H */