Home | History | Annotate | Line # | Download | only in pci
if_iwivar.h revision 1.7
      1 /*	$NetBSD: if_iwivar.h,v 1.7 2005/09/17 12:40:28 skrll Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2004, 2005
      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 iwi_firmware {
     31 	void	*boot;
     32 	int	boot_size;
     33 	void	*ucode;
     34 	int	ucode_size;
     35 	void	*main;
     36 	int	main_size;
     37 };
     38 
     39 struct iwi_rx_radiotap_header {
     40 	struct ieee80211_radiotap_header wr_ihdr;
     41 	uint8_t		wr_flags;
     42 	uint8_t		wr_rate;
     43 	uint16_t	wr_chan_freq;
     44 	uint16_t	wr_chan_flags;
     45 	uint8_t		wr_antsignal;
     46 	uint8_t		wr_antenna;
     47 };
     48 
     49 #define IWI_RX_RADIOTAP_PRESENT						\
     50 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     51 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     52 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     53 	 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |			\
     54 	 (1 << IEEE80211_RADIOTAP_ANTENNA))
     55 
     56 struct iwi_tx_radiotap_header {
     57 	struct ieee80211_radiotap_header wt_ihdr;
     58 	uint8_t		wt_flags;
     59 	uint16_t	wt_chan_freq;
     60 	uint16_t	wt_chan_flags;
     61 };
     62 
     63 #define IWI_TX_RADIOTAP_PRESENT						\
     64 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     65 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     66 
     67 struct iwi_cmd_ring {
     68 	bus_dmamap_t		desc_map;
     69 	bus_dma_segment_t	desc_seg;
     70 	struct iwi_cmd_desc	*desc;
     71 	int			count;
     72 	int			queued;
     73 	int			cur;
     74 	int			next;
     75 };
     76 
     77 struct iwi_tx_data {
     78 	bus_dmamap_t		map;
     79 	struct mbuf		*m;
     80 	struct ieee80211_node	*ni;
     81 };
     82 
     83 struct iwi_tx_ring {
     84 	bus_dmamap_t		desc_map;
     85 	bus_dma_segment_t	desc_seg;
     86 	struct iwi_tx_desc	*desc;
     87 	struct iwi_tx_data	*data;
     88 	int			count;
     89 	int			queued;
     90 	int			cur;
     91 	int			next;
     92 };
     93 
     94 struct iwi_rx_data {
     95 	bus_dmamap_t	map;
     96 	struct mbuf	*m;
     97 };
     98 
     99 struct iwi_rx_ring {
    100 	struct iwi_rx_data	*data;
    101 	int			count;
    102 	int			cur;
    103 };
    104 
    105 struct iwi_softc {
    106 	struct device		sc_dev;
    107 	struct ethercom		sc_ec;
    108 	struct ieee80211com	sc_ic;
    109 	int			(*sc_newstate)(struct ieee80211com *,
    110 				    enum ieee80211_state, int);
    111 
    112 	struct iwi_firmware	fw;
    113 	uint32_t		flags;
    114 #define IWI_FLAG_FW_CACHED	(1 << 0)
    115 #define IWI_FLAG_FW_INITED	(1 << 1)
    116 #define IWI_FLAG_FW_WARNED	(1 << 2)
    117 #define IWI_FLAG_SCANNING	(1 << 3)
    118 
    119 	bus_dma_tag_t		sc_dmat;
    120 
    121 	struct iwi_cmd_ring	cmdq;
    122 	struct iwi_tx_ring	txq;
    123 	struct iwi_rx_ring	rxq;
    124 
    125 	struct resource		*irq;
    126 	struct resource		*mem;
    127 	bus_space_tag_t		sc_st;
    128 	bus_space_handle_t	sc_sh;
    129 	void 			*sc_ih;
    130 	pci_chipset_tag_t	sc_pct;
    131 	pcitag_t		sc_pcitag;
    132 	bus_size_t		sc_sz;
    133 
    134 	void			*sc_sdhook;	/* shutdown hook */
    135 	void			*sc_powerhook;	/* power management hook */
    136 
    137 	int			antenna;
    138 	int			dwelltime;
    139 	int			bluetooth;
    140 
    141 	int			sc_tx_timer;
    142 
    143 #if NBPFILTER > 0
    144 	struct bpf_if		*sc_drvbpf;
    145 
    146 	union {
    147 		struct iwi_rx_radiotap_header th;
    148 		uint8_t	pad[64];
    149 	} sc_rxtapu;
    150 #define sc_rxtap	sc_rxtapu.th
    151 	int			sc_rxtap_len;
    152 
    153 	union {
    154 		struct iwi_tx_radiotap_header th;
    155 		uint8_t	pad[64];
    156 	} sc_txtapu;
    157 #define sc_txtap	sc_txtapu.th
    158 	int			sc_txtap_len;
    159 #endif
    160 };
    161 
    162 #define	sc_if	sc_ec.ec_if
    163 
    164 #define SIOCSLOADFW	 _IOW('i', 137, struct ifreq)
    165 #define SIOCSKILLFW	 _IOW('i', 138, struct ifreq)
    166 #define SIOCGRADIO	_IOWR('i', 139, struct ifreq)
    167 #define SIOCGTABLE0	_IOWR('i', 140, struct ifreq)
    168