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