Home | History | Annotate | Line # | Download | only in pci
if_ipwvar.h revision 1.6
      1 /*	$NetBSD: if_ipwvar.h,v 1.6 2005/06/22 06:16:02 dyoung Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2004
      5  *      Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice unmodified, this list of conditions, and the following
     12  *    disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27  * SUCH DAMAGE.
     28  */
     29 
     30 struct ipw_soft_bd {
     31 	struct ipw_bd	*bd;
     32 	int		type;
     33 #define IPW_SBD_TYPE_NOASSOC	0
     34 #define IPW_SBD_TYPE_COMMAND	1
     35 #define IPW_SBD_TYPE_HEADER	2
     36 #define IPW_SBD_TYPE_DATA	3
     37 	void		*priv;
     38 };
     39 
     40 struct ipw_soft_hdr {
     41 	struct ipw_hdr			hdr;
     42 	bus_dmamap_t			map;
     43 	TAILQ_ENTRY(ipw_soft_hdr)	next;
     44 };
     45 
     46 struct ipw_soft_buf {
     47 	struct mbuf			*m;
     48 	struct ieee80211_node		*ni;
     49 	bus_dmamap_t			map;
     50 	TAILQ_ENTRY(ipw_soft_buf)	next;
     51 };
     52 
     53 struct ipw_rx_radiotap_header {
     54 	struct ieee80211_radiotap_header wr_ihdr;
     55 	u_int8_t	wr_flags;
     56 	u_int16_t	wr_chan_freq;
     57 	u_int16_t	wr_chan_flags;
     58 	u_int8_t	wr_antsignal;
     59 };
     60 
     61 #define IPW_RX_RADIOTAP_PRESENT						\
     62 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     63 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     64 	 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
     65 
     66 struct ipw_tx_radiotap_header {
     67 	struct ieee80211_radiotap_header wt_ihdr;
     68 	u_int8_t	wt_flags;
     69 	u_int16_t	wt_chan_freq;
     70 	u_int16_t	wt_chan_flags;
     71 };
     72 
     73 #define IPW_TX_RADIOTAP_PRESENT						\
     74 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     75 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     76 
     77 struct ipw_softc {
     78 	struct device			sc_dev;
     79 
     80 	struct ethercom			sc_ec;
     81 	struct ieee80211com		sc_ic;
     82 	int				(*sc_newstate)(struct ieee80211com *,
     83 					    enum ieee80211_state, int);
     84 
     85 	u_int32_t			flags;
     86 #define IPW_FLAG_FW_INITED	(1 << 0)
     87 
     88 	struct resource			*irq;
     89 	struct resource			*mem;
     90 	bus_space_tag_t			sc_st;
     91 	bus_space_handle_t		sc_sh;
     92 	void				*sc_ih;
     93 	pci_chipset_tag_t		sc_pct;
     94 	bus_size_t			sc_sz;
     95 
     96 	int				sc_tx_timer;
     97 
     98 	bus_dma_tag_t			sc_dmat;
     99 
    100 	bus_dmamap_t			tbd_map;
    101 	bus_dmamap_t			rbd_map;
    102 	bus_dmamap_t			status_map;
    103 	bus_dmamap_t			cmd_map;
    104 
    105 	bus_dma_segment_t		tbd_seg;
    106 	bus_dma_segment_t		rbd_seg;
    107 	bus_dma_segment_t		status_seg;
    108 	bus_dma_segment_t		cmd_seg;
    109 
    110 	struct ipw_bd			*tbd_list;
    111 	struct ipw_bd			*rbd_list;
    112 	struct ipw_status		*status_list;
    113 
    114 	struct ipw_cmd			*cmd;
    115 	struct ipw_soft_bd		*stbd_list;
    116 	struct ipw_soft_bd		*srbd_list;
    117 	struct ipw_soft_hdr		*shdr_list;
    118 	struct ipw_soft_buf		*tx_sbuf_list;
    119 	struct ipw_soft_buf		*rx_sbuf_list;
    120 
    121 	TAILQ_HEAD(, ipw_soft_hdr)	sc_free_shdr;
    122 	TAILQ_HEAD(, ipw_soft_buf)	sc_free_sbuf;
    123 
    124 	u_int32_t			table1_base;
    125 	u_int32_t			table2_base;
    126 
    127 	u_int32_t			txcur;
    128 	u_int32_t			txfree;
    129 	u_int32_t			txold;
    130 	u_int32_t			rxcur;
    131 
    132 #if NBPFILTER > 0
    133 	struct bpf_if			*sc_drvbpf;
    134 
    135 	union {
    136 		struct ipw_rx_radiotap_header th;
    137 		u_int8_t	pad[64];
    138 	} sc_rxtapu;
    139 #define sc_rxtap	sc_rxtapu.th
    140 	int				sc_rxtap_len;
    141 
    142 	union {
    143 		struct ipw_tx_radiotap_header th;
    144 		u_int8_t	pad[64];
    145 	} sc_txtapu;
    146 #define sc_txtap	sc_txtapu.th
    147 	int				sc_txtap_len;
    148 #endif
    149 };
    150 
    151 #define	sc_if	sc_ec.ec_if
    152 
    153 #define SIOCSLOADFW	 _IOW('i', 137, struct ifreq)
    154 #define SIOCSKILLFW	 _IOW('i', 138, struct ifreq)
    155 #define SIOCGRADIO	_IOWR('i', 139, struct ifreq)
    156 #define SIOCGTABLE1	_IOWR('i', 140, struct ifreq)
    157