Home | History | Annotate | Line # | Download | only in pci
if_ipwvar.h revision 1.1.1.2
      1  1.1.1.2  skrll /*      $FreeBSD: src/sys/dev/ipw/if_ipwvar.h,v 1.3 2005/06/10 16:49:11 brooks Exp $	*/
      2      1.1  lukem 
      3      1.1  lukem /*-
      4  1.1.1.2  skrll  * Copyright (c) 2004, 2005
      5      1.1  lukem  *      Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
      6      1.1  lukem  *
      7      1.1  lukem  * Redistribution and use in source and binary forms, with or without
      8      1.1  lukem  * modification, are permitted provided that the following conditions
      9      1.1  lukem  * are met:
     10      1.1  lukem  * 1. Redistributions of source code must retain the above copyright
     11      1.1  lukem  *    notice unmodified, this list of conditions, and the following
     12      1.1  lukem  *    disclaimer.
     13      1.1  lukem  * 2. Redistributions in binary form must reproduce the above copyright
     14      1.1  lukem  *    notice, this list of conditions and the following disclaimer in the
     15      1.1  lukem  *    documentation and/or other materials provided with the distribution.
     16      1.1  lukem  *
     17      1.1  lukem  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     18      1.1  lukem  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19      1.1  lukem  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20      1.1  lukem  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     21      1.1  lukem  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22      1.1  lukem  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23      1.1  lukem  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24      1.1  lukem  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25      1.1  lukem  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26      1.1  lukem  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27      1.1  lukem  * SUCH DAMAGE.
     28      1.1  lukem  */
     29      1.1  lukem 
     30  1.1.1.2  skrll struct ipw_firmware {
     31  1.1.1.2  skrll 	void	*main;
     32  1.1.1.2  skrll 	int	main_size;
     33  1.1.1.2  skrll 	void	*ucode;
     34  1.1.1.2  skrll 	int	ucode_size;
     35  1.1.1.2  skrll };
     36  1.1.1.2  skrll 
     37  1.1.1.2  skrll #define IPW_MAX_NSEG	1
     38  1.1.1.2  skrll 
     39      1.1  lukem struct ipw_soft_bd {
     40      1.1  lukem 	struct ipw_bd	*bd;
     41      1.1  lukem 	int		type;
     42      1.1  lukem #define IPW_SBD_TYPE_NOASSOC	0
     43      1.1  lukem #define IPW_SBD_TYPE_COMMAND	1
     44      1.1  lukem #define IPW_SBD_TYPE_HEADER	2
     45      1.1  lukem #define IPW_SBD_TYPE_DATA	3
     46      1.1  lukem 	void		*priv;
     47      1.1  lukem };
     48      1.1  lukem 
     49      1.1  lukem struct ipw_soft_hdr {
     50      1.1  lukem 	struct ipw_hdr			hdr;
     51      1.1  lukem 	bus_dmamap_t			map;
     52  1.1.1.2  skrll 	SLIST_ENTRY(ipw_soft_hdr)	next;
     53      1.1  lukem };
     54      1.1  lukem 
     55      1.1  lukem struct ipw_soft_buf {
     56      1.1  lukem 	struct mbuf			*m;
     57      1.1  lukem 	struct ieee80211_node		*ni;
     58      1.1  lukem 	bus_dmamap_t			map;
     59  1.1.1.2  skrll 	SLIST_ENTRY(ipw_soft_buf)	next;
     60      1.1  lukem };
     61      1.1  lukem 
     62  1.1.1.2  skrll struct ipw_rx_radiotap_header {
     63  1.1.1.2  skrll 	struct ieee80211_radiotap_header wr_ihdr;
     64  1.1.1.2  skrll 	uint8_t		wr_flags;
     65  1.1.1.2  skrll 	uint16_t	wr_chan_freq;
     66  1.1.1.2  skrll 	uint16_t	wr_chan_flags;
     67  1.1.1.2  skrll 	uint8_t		wr_antsignal;
     68  1.1.1.2  skrll };
     69      1.1  lukem 
     70  1.1.1.2  skrll #define IPW_RX_RADIOTAP_PRESENT						\
     71  1.1.1.2  skrll 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     72  1.1.1.2  skrll 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     73  1.1.1.2  skrll 	 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
     74  1.1.1.2  skrll 
     75  1.1.1.2  skrll struct ipw_tx_radiotap_header {
     76  1.1.1.2  skrll 	struct ieee80211_radiotap_header wt_ihdr;
     77  1.1.1.2  skrll 	uint8_t		wt_flags;
     78  1.1.1.2  skrll 	uint16_t	wt_chan_freq;
     79  1.1.1.2  skrll 	uint16_t	wt_chan_flags;
     80  1.1.1.2  skrll };
     81  1.1.1.2  skrll 
     82  1.1.1.2  skrll #define IPW_TX_RADIOTAP_PRESENT						\
     83  1.1.1.2  skrll 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     84  1.1.1.2  skrll 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
     85  1.1.1.2  skrll 
     86  1.1.1.2  skrll struct ipw_softc {
     87  1.1.1.2  skrll 	struct ifnet			*sc_ifp;
     88  1.1.1.2  skrll 	struct ieee80211com		sc_ic;
     89      1.1  lukem 	int				(*sc_newstate)(struct ieee80211com *,
     90      1.1  lukem 					    enum ieee80211_state, int);
     91  1.1.1.2  skrll 	device_t			sc_dev;
     92      1.1  lukem 
     93  1.1.1.2  skrll 	struct mtx			sc_mtx;
     94      1.1  lukem 
     95  1.1.1.2  skrll 	struct ipw_firmware		fw;
     96  1.1.1.2  skrll 	uint32_t			flags;
     97  1.1.1.2  skrll #define IPW_FLAG_FW_CACHED		(1 << 0)
     98  1.1.1.2  skrll #define IPW_FLAG_FW_INITED		(1 << 1)
     99  1.1.1.2  skrll #define IPW_FLAG_HAS_RADIO_SWITCH	(1 << 2)
    100  1.1.1.2  skrll #define	IPW_FLAG_FW_WARNED		(1 << 3)
    101  1.1.1.2  skrll 
    102  1.1.1.2  skrll 	int				irq_rid;
    103  1.1.1.2  skrll 	int				mem_rid;
    104      1.1  lukem 	struct resource			*irq;
    105      1.1  lukem 	struct resource			*mem;
    106      1.1  lukem 	bus_space_tag_t			sc_st;
    107      1.1  lukem 	bus_space_handle_t		sc_sh;
    108      1.1  lukem 	void 				*sc_ih;
    109      1.1  lukem 
    110      1.1  lukem 	int				sc_tx_timer;
    111      1.1  lukem 
    112  1.1.1.2  skrll 	bus_dma_tag_t			tbd_dmat;
    113  1.1.1.2  skrll 	bus_dma_tag_t			rbd_dmat;
    114  1.1.1.2  skrll 	bus_dma_tag_t			status_dmat;
    115  1.1.1.2  skrll 	bus_dma_tag_t			cmd_dmat;
    116  1.1.1.2  skrll 	bus_dma_tag_t			hdr_dmat;
    117  1.1.1.2  skrll 	bus_dma_tag_t			txbuf_dmat;
    118  1.1.1.2  skrll 	bus_dma_tag_t			rxbuf_dmat;
    119      1.1  lukem 
    120      1.1  lukem 	bus_dmamap_t			tbd_map;
    121      1.1  lukem 	bus_dmamap_t			rbd_map;
    122      1.1  lukem 	bus_dmamap_t			status_map;
    123      1.1  lukem 	bus_dmamap_t			cmd_map;
    124      1.1  lukem 
    125  1.1.1.2  skrll 	bus_addr_t			tbd_phys;
    126  1.1.1.2  skrll 	bus_addr_t			rbd_phys;
    127  1.1.1.2  skrll 	bus_addr_t			status_phys;
    128      1.1  lukem 
    129      1.1  lukem 	struct ipw_bd			*tbd_list;
    130      1.1  lukem 	struct ipw_bd			*rbd_list;
    131      1.1  lukem 	struct ipw_status		*status_list;
    132      1.1  lukem 
    133  1.1.1.2  skrll 	struct ipw_cmd			cmd;
    134  1.1.1.2  skrll 	struct ipw_soft_bd		stbd_list[IPW_NTBD];
    135  1.1.1.2  skrll 	struct ipw_soft_buf		tx_sbuf_list[IPW_NDATA];
    136  1.1.1.2  skrll 	struct ipw_soft_hdr		shdr_list[IPW_NDATA];
    137  1.1.1.2  skrll 	struct ipw_soft_bd		srbd_list[IPW_NRBD];
    138  1.1.1.2  skrll 	struct ipw_soft_buf		rx_sbuf_list[IPW_NRBD];
    139  1.1.1.2  skrll 
    140  1.1.1.2  skrll 	SLIST_HEAD(, ipw_soft_hdr)	free_shdr;
    141  1.1.1.2  skrll 	SLIST_HEAD(, ipw_soft_buf)	free_sbuf;
    142  1.1.1.2  skrll 
    143  1.1.1.2  skrll 	uint32_t			table1_base;
    144  1.1.1.2  skrll 	uint32_t			table2_base;
    145  1.1.1.2  skrll 
    146  1.1.1.2  skrll 	uint32_t			txcur;
    147  1.1.1.2  skrll 	uint32_t			txold;
    148  1.1.1.2  skrll 	uint32_t			rxcur;
    149  1.1.1.2  skrll 	int				txfree;
    150  1.1.1.2  skrll 
    151  1.1.1.2  skrll 	int				dwelltime;
    152  1.1.1.2  skrll 
    153  1.1.1.2  skrll 	struct bpf_if			*sc_drvbpf;
    154  1.1.1.2  skrll 
    155  1.1.1.2  skrll 	union {
    156  1.1.1.2  skrll 		struct ipw_rx_radiotap_header th;
    157  1.1.1.2  skrll 		uint8_t	pad[64];
    158  1.1.1.2  skrll 	} sc_rxtapu;
    159  1.1.1.2  skrll #define sc_rxtap	sc_rxtapu.th
    160  1.1.1.2  skrll 	int				sc_rxtap_len;
    161  1.1.1.2  skrll 
    162  1.1.1.2  skrll 	union {
    163  1.1.1.2  skrll 		struct ipw_tx_radiotap_header th;
    164  1.1.1.2  skrll 		uint8_t	pad[64];
    165  1.1.1.2  skrll 	} sc_txtapu;
    166  1.1.1.2  skrll #define sc_txtap	sc_txtapu.th
    167  1.1.1.2  skrll 	int				sc_txtap_len;
    168      1.1  lukem };
    169      1.1  lukem 
    170      1.1  lukem #define SIOCSLOADFW	 _IOW('i', 137, struct ifreq)
    171      1.1  lukem #define SIOCSKILLFW	 _IOW('i', 138, struct ifreq)
    172  1.1.1.2  skrll 
    173  1.1.1.2  skrll #define IPW_LOCK(sc)	mtx_lock(&(sc)->sc_mtx)
    174  1.1.1.2  skrll #define IPW_UNLOCK(sc)	mtx_unlock(&(sc)->sc_mtx)
    175