if_ipwvar.h revision 1.18 1 1.18 nonaka /* $NetBSD: if_ipwvar.h,v 1.18 2017/02/02 10:05:35 nonaka Exp $ */
2 1.1 lukem
3 1.1 lukem /*-
4 1.1 lukem * Copyright (c) 2004
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.17 dholland #include <sys/ioccom.h>
31 1.17 dholland
32 1.8 skrll struct ipw_firmware {
33 1.8 skrll void *main;
34 1.8 skrll int main_size;
35 1.8 skrll void *ucode;
36 1.8 skrll int ucode_size;
37 1.8 skrll };
38 1.8 skrll
39 1.8 skrll #define IPW_MAX_NSEG 1
40 1.8 skrll
41 1.1 lukem struct ipw_soft_bd {
42 1.1 lukem struct ipw_bd *bd;
43 1.1 lukem int type;
44 1.1 lukem #define IPW_SBD_TYPE_NOASSOC 0
45 1.1 lukem #define IPW_SBD_TYPE_COMMAND 1
46 1.1 lukem #define IPW_SBD_TYPE_HEADER 2
47 1.1 lukem #define IPW_SBD_TYPE_DATA 3
48 1.1 lukem void *priv;
49 1.1 lukem };
50 1.1 lukem
51 1.1 lukem struct ipw_soft_hdr {
52 1.8 skrll struct ipw_hdr *hdr;
53 1.8 skrll bus_addr_t addr;
54 1.8 skrll bus_addr_t offset;
55 1.1 lukem TAILQ_ENTRY(ipw_soft_hdr) next;
56 1.1 lukem };
57 1.1 lukem
58 1.1 lukem struct ipw_soft_buf {
59 1.1 lukem struct mbuf *m;
60 1.1 lukem struct ieee80211_node *ni;
61 1.1 lukem bus_dmamap_t map;
62 1.1 lukem TAILQ_ENTRY(ipw_soft_buf) next;
63 1.1 lukem };
64 1.1 lukem
65 1.4 lukem struct ipw_rx_radiotap_header {
66 1.4 lukem struct ieee80211_radiotap_header wr_ihdr;
67 1.8 skrll uint16_t wr_chan_freq;
68 1.8 skrll uint16_t wr_chan_flags;
69 1.8 skrll uint8_t wr_antsignal;
70 1.13 dyoung } __packed;
71 1.4 lukem
72 1.4 lukem #define IPW_RX_RADIOTAP_PRESENT \
73 1.13 dyoung ((1 << IEEE80211_RADIOTAP_CHANNEL) | \
74 1.4 lukem (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
75 1.4 lukem
76 1.4 lukem struct ipw_tx_radiotap_header {
77 1.4 lukem struct ieee80211_radiotap_header wt_ihdr;
78 1.8 skrll uint16_t wt_chan_freq;
79 1.8 skrll uint16_t wt_chan_flags;
80 1.13 dyoung } __packed;
81 1.4 lukem
82 1.4 lukem #define IPW_TX_RADIOTAP_PRESENT \
83 1.13 dyoung ((1 << IEEE80211_RADIOTAP_CHANNEL))
84 1.4 lukem
85 1.1 lukem struct ipw_softc {
86 1.16 chs device_t sc_dev;
87 1.1 lukem
88 1.6 dyoung struct ethercom sc_ec;
89 1.3 lukem struct ieee80211com sc_ic;
90 1.1 lukem int (*sc_newstate)(struct ieee80211com *,
91 1.1 lukem enum ieee80211_state, int);
92 1.1 lukem
93 1.8 skrll struct ipw_firmware fw;
94 1.14 joerg const char *sc_fwname;
95 1.8 skrll uint32_t flags;
96 1.8 skrll #define IPW_FLAG_FW_CACHED (1 << 0)
97 1.8 skrll #define IPW_FLAG_FW_INITED (1 << 1)
98 1.8 skrll #define IPW_FLAG_HAS_RADIO_SWITCH (1 << 2)
99 1.8 skrll #define IPW_FLAG_FW_WARNED (1 << 3)
100 1.1 lukem
101 1.1 lukem struct resource *irq;
102 1.1 lukem struct resource *mem;
103 1.1 lukem bus_space_tag_t sc_st;
104 1.1 lukem bus_space_handle_t sc_sh;
105 1.3 lukem void *sc_ih;
106 1.18 nonaka void *sc_soft_ih;
107 1.1 lukem pci_chipset_tag_t sc_pct;
108 1.8 skrll pcitag_t sc_pcitag;
109 1.1 lukem bus_size_t sc_sz;
110 1.1 lukem
111 1.1 lukem int sc_tx_timer;
112 1.1 lukem
113 1.1 lukem bus_dma_tag_t sc_dmat;
114 1.1 lukem
115 1.1 lukem bus_dmamap_t tbd_map;
116 1.1 lukem bus_dmamap_t rbd_map;
117 1.1 lukem bus_dmamap_t status_map;
118 1.1 lukem bus_dmamap_t cmd_map;
119 1.8 skrll bus_dmamap_t hdr_map;
120 1.1 lukem
121 1.1 lukem bus_dma_segment_t tbd_seg;
122 1.1 lukem bus_dma_segment_t rbd_seg;
123 1.1 lukem bus_dma_segment_t status_seg;
124 1.1 lukem bus_dma_segment_t cmd_seg;
125 1.8 skrll bus_dma_segment_t hdr_seg;
126 1.1 lukem
127 1.1 lukem struct ipw_bd *tbd_list;
128 1.1 lukem struct ipw_bd *rbd_list;
129 1.1 lukem struct ipw_status *status_list;
130 1.8 skrll struct ipw_hdr *hdr_list;
131 1.1 lukem
132 1.8 skrll struct ipw_cmd cmd;
133 1.8 skrll struct ipw_soft_bd stbd_list[IPW_NTBD];
134 1.8 skrll struct ipw_soft_buf tx_sbuf_list[IPW_NDATA];
135 1.8 skrll struct ipw_soft_bd srbd_list[IPW_NRBD];
136 1.8 skrll struct ipw_soft_buf rx_sbuf_list[IPW_NRBD];
137 1.8 skrll struct ipw_soft_hdr shdr_list[IPW_NDATA];
138 1.1 lukem
139 1.1 lukem TAILQ_HEAD(, ipw_soft_hdr) sc_free_shdr;
140 1.1 lukem TAILQ_HEAD(, ipw_soft_buf) sc_free_sbuf;
141 1.1 lukem
142 1.8 skrll uint32_t table1_base;
143 1.8 skrll uint32_t table2_base;
144 1.8 skrll
145 1.8 skrll uint32_t txcur;
146 1.8 skrll uint32_t txold;
147 1.8 skrll uint32_t rxcur;
148 1.8 skrll int txfree;
149 1.1 lukem
150 1.8 skrll int dwelltime;
151 1.4 lukem
152 1.4 lukem struct bpf_if *sc_drvbpf;
153 1.4 lukem
154 1.4 lukem union {
155 1.4 lukem struct ipw_rx_radiotap_header th;
156 1.8 skrll uint8_t pad[64];
157 1.4 lukem } sc_rxtapu;
158 1.4 lukem #define sc_rxtap sc_rxtapu.th
159 1.4 lukem int sc_rxtap_len;
160 1.4 lukem
161 1.4 lukem union {
162 1.4 lukem struct ipw_tx_radiotap_header th;
163 1.8 skrll uint8_t pad[64];
164 1.4 lukem } sc_txtapu;
165 1.4 lukem #define sc_txtap sc_txtapu.th
166 1.4 lukem int sc_txtap_len;
167 1.1 lukem };
168 1.1 lukem
169 1.6 dyoung #define sc_if sc_ec.ec_if
170 1.6 dyoung
171 1.1 lukem #define SIOCGRADIO _IOWR('i', 139, struct ifreq)
172 1.1 lukem #define SIOCGTABLE1 _IOWR('i', 140, struct ifreq)
173