Home | History | Annotate | Line # | Download | only in pci
if_wpivar.h revision 1.2.4.6
      1  1.2.4.6  yamt /*  $NetBSD: if_wpivar.h,v 1.2.4.6 2008/01/21 09:44:04 yamt Exp $    */
      2  1.2.4.2  yamt 
      3  1.2.4.2  yamt /*-
      4  1.2.4.2  yamt  * Copyright (c) 2006
      5  1.2.4.2  yamt  *	Damien Bergamini <damien.bergamini (at) free.fr>
      6  1.2.4.2  yamt  *
      7  1.2.4.2  yamt  * Permission to use, copy, modify, and distribute this software for any
      8  1.2.4.2  yamt  * purpose with or without fee is hereby granted, provided that the above
      9  1.2.4.2  yamt  * copyright notice and this permission notice appear in all copies.
     10  1.2.4.2  yamt  *
     11  1.2.4.2  yamt  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  1.2.4.2  yamt  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  1.2.4.2  yamt  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  1.2.4.2  yamt  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  1.2.4.2  yamt  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  1.2.4.2  yamt  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  1.2.4.2  yamt  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  1.2.4.2  yamt  */
     19  1.2.4.2  yamt 
     20  1.2.4.2  yamt struct wpi_rx_radiotap_header {
     21  1.2.4.2  yamt 	struct ieee80211_radiotap_header wr_ihdr;
     22  1.2.4.2  yamt 	uint64_t	wr_tsft;
     23  1.2.4.2  yamt 	uint8_t		wr_flags;
     24  1.2.4.2  yamt 	uint8_t		wr_rate;
     25  1.2.4.2  yamt 	uint16_t	wr_chan_freq;
     26  1.2.4.2  yamt 	uint16_t	wr_chan_flags;
     27  1.2.4.2  yamt 	int8_t		wr_dbm_antsignal;
     28  1.2.4.2  yamt 	int8_t		wr_dbm_antnoise;
     29  1.2.4.2  yamt 	uint8_t		wr_antenna;
     30  1.2.4.2  yamt };
     31  1.2.4.2  yamt 
     32  1.2.4.2  yamt #define WPI_RX_RADIOTAP_PRESENT						\
     33  1.2.4.2  yamt 	((1 << IEEE80211_RADIOTAP_TSFT) |				\
     34  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_FLAGS) |				\
     35  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     36  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     37  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |			\
     38  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |			\
     39  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_ANTENNA))
     40  1.2.4.2  yamt 
     41  1.2.4.2  yamt struct wpi_tx_radiotap_header {
     42  1.2.4.2  yamt 	struct ieee80211_radiotap_header wt_ihdr;
     43  1.2.4.2  yamt 	uint8_t		wt_flags;
     44  1.2.4.2  yamt 	uint8_t		wt_rate;
     45  1.2.4.2  yamt 	uint16_t	wt_chan_freq;
     46  1.2.4.2  yamt 	uint16_t	wt_chan_flags;
     47  1.2.4.2  yamt 	uint8_t		wt_hwqueue;
     48  1.2.4.2  yamt };
     49  1.2.4.2  yamt 
     50  1.2.4.2  yamt #define WPI_TX_RADIOTAP_PRESENT						\
     51  1.2.4.2  yamt 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     52  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     53  1.2.4.2  yamt 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     54  1.2.4.2  yamt 
     55  1.2.4.2  yamt struct wpi_dma_info {
     56  1.2.4.3  yamt 	bus_dma_tag_t		tag;
     57  1.2.4.2  yamt 	bus_dmamap_t		map;
     58  1.2.4.2  yamt 	bus_dma_segment_t	seg;
     59  1.2.4.2  yamt 	bus_addr_t		paddr;
     60  1.2.4.4  yamt 	void *			vaddr;
     61  1.2.4.2  yamt 	bus_size_t		size;
     62  1.2.4.2  yamt };
     63  1.2.4.2  yamt 
     64  1.2.4.2  yamt struct wpi_tx_data {
     65  1.2.4.2  yamt 	bus_dmamap_t		map;
     66  1.2.4.2  yamt 	struct mbuf		*m;
     67  1.2.4.2  yamt 	struct ieee80211_node	*ni;
     68  1.2.4.2  yamt };
     69  1.2.4.2  yamt 
     70  1.2.4.2  yamt struct wpi_tx_ring {
     71  1.2.4.2  yamt 	struct wpi_dma_info	desc_dma;
     72  1.2.4.2  yamt 	struct wpi_dma_info	cmd_dma;
     73  1.2.4.2  yamt 	struct wpi_tx_desc	*desc;
     74  1.2.4.2  yamt 	struct wpi_tx_cmd	*cmd;
     75  1.2.4.2  yamt 	struct wpi_tx_data	*data;
     76  1.2.4.2  yamt 	int			qid;
     77  1.2.4.2  yamt 	int			count;
     78  1.2.4.2  yamt 	int			queued;
     79  1.2.4.2  yamt 	int			cur;
     80  1.2.4.2  yamt };
     81  1.2.4.2  yamt 
     82  1.2.4.3  yamt #define WPI_RBUF_COUNT	(WPI_RX_RING_COUNT + 16)
     83  1.2.4.4  yamt #define WPI_RBUF_LOW_LIMIT	8
     84  1.2.4.3  yamt 
     85  1.2.4.3  yamt struct wpi_softc;
     86  1.2.4.3  yamt 
     87  1.2.4.3  yamt struct wpi_rbuf {
     88  1.2.4.3  yamt 	struct wpi_softc	*sc;
     89  1.2.4.4  yamt 	void *			vaddr;
     90  1.2.4.3  yamt 	bus_addr_t		paddr;
     91  1.2.4.3  yamt 	SLIST_ENTRY(wpi_rbuf)	next;
     92  1.2.4.3  yamt };
     93  1.2.4.3  yamt 
     94  1.2.4.2  yamt struct wpi_rx_data {
     95  1.2.4.2  yamt 	struct mbuf	*m;
     96  1.2.4.2  yamt };
     97  1.2.4.2  yamt 
     98  1.2.4.2  yamt struct wpi_rx_ring {
     99  1.2.4.2  yamt 	struct wpi_dma_info	desc_dma;
    100  1.2.4.3  yamt 	struct wpi_dma_info	buf_dma;
    101  1.2.4.2  yamt 	uint32_t		*desc;
    102  1.2.4.2  yamt 	struct wpi_rx_data	data[WPI_RX_RING_COUNT];
    103  1.2.4.3  yamt 	struct wpi_rbuf		rbuf[WPI_RBUF_COUNT];
    104  1.2.4.3  yamt 	SLIST_HEAD(, wpi_rbuf)	freelist;
    105  1.2.4.4  yamt 	int			nb_free_entries;
    106  1.2.4.2  yamt 	int			cur;
    107  1.2.4.2  yamt };
    108  1.2.4.2  yamt 
    109  1.2.4.2  yamt struct wpi_node {
    110  1.2.4.2  yamt 	struct	ieee80211_node ni;	/* must be the first */
    111  1.2.4.2  yamt 	struct	ieee80211_amrr_node	amn;
    112  1.2.4.2  yamt };
    113  1.2.4.2  yamt 
    114  1.2.4.4  yamt struct wpi_power_sample {
    115  1.2.4.4  yamt 	uint8_t	index;
    116  1.2.4.4  yamt 	int8_t	power;
    117  1.2.4.4  yamt };
    118  1.2.4.4  yamt 
    119  1.2.4.4  yamt struct wpi_power_group {
    120  1.2.4.4  yamt #define WPI_SAMPLES_COUNT	5
    121  1.2.4.4  yamt 	struct	wpi_power_sample samples[WPI_SAMPLES_COUNT];
    122  1.2.4.4  yamt 	uint8_t	chan;
    123  1.2.4.4  yamt 	int8_t	maxpwr;
    124  1.2.4.4  yamt 	int16_t	temp;
    125  1.2.4.4  yamt };
    126  1.2.4.4  yamt 
    127  1.2.4.2  yamt struct wpi_softc {
    128  1.2.4.5  yamt 	device_t			sc_dev;
    129  1.2.4.3  yamt 	struct ethercom	 	sc_ec;
    130  1.2.4.2  yamt 	struct ieee80211com	sc_ic;
    131  1.2.4.2  yamt 	int			(*sc_newstate)(struct ieee80211com *,
    132  1.2.4.2  yamt 					enum ieee80211_state, int);
    133  1.2.4.3  yamt 
    134  1.2.4.2  yamt 	struct ieee80211_amrr	amrr;
    135  1.2.4.2  yamt 
    136  1.2.4.2  yamt 	bus_dma_tag_t		sc_dmat;
    137  1.2.4.2  yamt 
    138  1.2.4.2  yamt 	/* shared area */
    139  1.2.4.2  yamt 	struct wpi_dma_info	shared_dma;
    140  1.2.4.2  yamt 	struct wpi_shared	*shared;
    141  1.2.4.2  yamt 
    142  1.2.4.4  yamt 	/* firmware DMA transfer */
    143  1.2.4.4  yamt 	struct wpi_dma_info	fw_dma;
    144  1.2.4.4  yamt 
    145  1.2.4.2  yamt 	struct wpi_tx_ring	txq[4];
    146  1.2.4.2  yamt 	struct wpi_tx_ring	cmdq;
    147  1.2.4.2  yamt 	struct wpi_rx_ring	rxq;
    148  1.2.4.2  yamt 
    149  1.2.4.2  yamt 	bus_space_tag_t		sc_st;
    150  1.2.4.2  yamt 	bus_space_handle_t	sc_sh;
    151  1.2.4.2  yamt 	void 			*sc_ih;
    152  1.2.4.2  yamt 	pci_chipset_tag_t	sc_pct;
    153  1.2.4.2  yamt 	pcitag_t		sc_pcitag;
    154  1.2.4.2  yamt 	bus_size_t		sc_sz;
    155  1.2.4.2  yamt 
    156  1.2.4.4  yamt 	struct callout		calib_to;
    157  1.2.4.4  yamt 	int			calib_cnt;
    158  1.2.4.2  yamt 
    159  1.2.4.2  yamt 	struct wpi_config	config;
    160  1.2.4.4  yamt 	int			temp;
    161  1.2.4.4  yamt 
    162  1.2.4.4  yamt 	uint8_t			cap;
    163  1.2.4.4  yamt 	uint16_t		rev;
    164  1.2.4.4  yamt 	uint8_t			type;
    165  1.2.4.4  yamt 	struct wpi_power_group	groups[WPI_POWER_GROUPS_COUNT];
    166  1.2.4.4  yamt 	int8_t			maxpwr[IEEE80211_CHAN_MAX];
    167  1.2.4.2  yamt 
    168  1.2.4.2  yamt 	int			sc_tx_timer;
    169  1.2.4.2  yamt 
    170  1.2.4.2  yamt #if NBPFILTER > 0
    171  1.2.4.4  yamt 	void *			sc_drvbpf;
    172  1.2.4.2  yamt 
    173  1.2.4.2  yamt 	union {
    174  1.2.4.2  yamt 		struct wpi_rx_radiotap_header th;
    175  1.2.4.2  yamt 		uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
    176  1.2.4.2  yamt 	} sc_rxtapu;
    177  1.2.4.2  yamt #define sc_rxtap	sc_rxtapu.th
    178  1.2.4.2  yamt 	int			sc_rxtap_len;
    179  1.2.4.2  yamt 
    180  1.2.4.2  yamt 	union {
    181  1.2.4.2  yamt 		struct wpi_tx_radiotap_header th;
    182  1.2.4.2  yamt 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    183  1.2.4.2  yamt 	} sc_txtapu;
    184  1.2.4.2  yamt #define sc_txtap	sc_txtapu.th
    185  1.2.4.2  yamt 	int			sc_txtap_len;
    186  1.2.4.2  yamt #endif
    187  1.2.4.4  yamt 
    188  1.2.4.4  yamt 	bool		is_scanning;
    189  1.2.4.6  yamt 
    190  1.2.4.6  yamt 	struct sysctllog	*sc_sysctllog;
    191  1.2.4.2  yamt };
    192