1 /* $OpenBSD: if_ipwvar.h,v 1.24 2014/12/19 15:19:47 krw Exp $ */ 2 3 /*- 4 * Copyright (c) 2004-2006 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 struct ipw_firmware { 21 u_char *data; 22 u_char *main; 23 size_t main_size; 24 u_char *ucode; 25 size_t ucode_size; 26 }; 27 28 struct ipw_soft_bd { 29 struct ipw_bd *bd; 30 int type; 31 #define IPW_SBD_TYPE_NOASSOC 0 32 #define IPW_SBD_TYPE_COMMAND 1 33 #define IPW_SBD_TYPE_HEADER 2 34 #define IPW_SBD_TYPE_DATA 3 35 void *priv; 36 }; 37 38 struct ipw_soft_hdr { 39 struct ipw_hdr hdr; 40 bus_dmamap_t map; 41 SLIST_ENTRY(ipw_soft_hdr) next; 42 }; 43 44 struct ipw_soft_buf { 45 struct mbuf *m; 46 struct ieee80211_node *ni; 47 bus_dmamap_t map; 48 SLIST_ENTRY(ipw_soft_buf) next; 49 }; 50 51 struct ipw_rx_radiotap_header { 52 struct ieee80211_radiotap_header wr_ihdr; 53 uint8_t wr_flags; 54 uint16_t wr_chan_freq; 55 uint16_t wr_chan_flags; 56 uint8_t wr_antsignal; 57 } __packed; 58 59 #define IPW_RX_RADIOTAP_PRESENT \ 60 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 61 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 62 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 63 64 struct ipw_tx_radiotap_header { 65 struct ieee80211_radiotap_header wt_ihdr; 66 uint8_t wt_flags; 67 uint16_t wt_chan_freq; 68 uint16_t wt_chan_flags; 69 } __packed; 70 71 #define IPW_TX_RADIOTAP_PRESENT \ 72 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 73 (1 << IEEE80211_RADIOTAP_CHANNEL)) 74 75 #define IPW_MAX_NSEG 1 76 77 struct ipw_softc { 78 struct device sc_dev; 79 80 struct ieee80211com sc_ic; 81 int (*sc_newstate)(struct ieee80211com *, 82 enum ieee80211_state, int); 83 84 uint32_t sc_flags; 85 #define IPW_FLAG_FW_INITED (1 << 0) 86 #define IPW_FLAG_BUSY (1 << 1) 87 88 bus_space_tag_t sc_st; 89 bus_space_handle_t sc_sh; 90 void *sc_ih; 91 pci_chipset_tag_t sc_pct; 92 pcitag_t sc_pcitag; 93 bus_size_t sc_sz; 94 95 int sc_tx_timer; 96 97 bus_dma_tag_t sc_dmat; 98 99 bus_dmamap_t tbd_map; 100 bus_dmamap_t rbd_map; 101 bus_dmamap_t status_map; 102 bus_dmamap_t cmd_map; 103 104 bus_dma_segment_t tbd_seg; 105 bus_dma_segment_t rbd_seg; 106 bus_dma_segment_t status_seg; 107 bus_dma_segment_t cmd_seg; 108 109 struct ipw_bd *tbd_list; 110 struct ipw_bd *rbd_list; 111 struct ipw_status *status_list; 112 113 struct ipw_cmd cmd; 114 struct ipw_soft_bd stbd_list[IPW_NTBD]; 115 struct ipw_soft_buf tx_sbuf_list[IPW_NDATA]; 116 struct ipw_soft_hdr shdr_list[IPW_NDATA]; 117 struct ipw_soft_bd srbd_list[IPW_NRBD]; 118 struct ipw_soft_buf rx_sbuf_list[IPW_NRBD]; 119 120 struct task sc_scantask; 121 struct task sc_authandassoctask; 122 123 SLIST_HEAD(, ipw_soft_hdr) free_shdr; 124 SLIST_HEAD(, ipw_soft_buf) free_sbuf; 125 126 uint32_t table1_base; 127 uint32_t table2_base; 128 129 uint32_t txcur; 130 uint32_t txold; 131 uint32_t rxcur; 132 int txfree; 133 134 #if NBPFILTER > 0 135 caddr_t sc_drvbpf; 136 137 union { 138 struct ipw_rx_radiotap_header th; 139 uint8_t pad[64]; 140 } sc_rxtapu; 141 #define sc_rxtap sc_rxtapu.th 142 int sc_rxtap_len; 143 144 union { 145 struct ipw_tx_radiotap_header th; 146 uint8_t pad[64]; 147 } sc_txtapu; 148 #define sc_txtap sc_txtapu.th 149 int sc_txtap_len; 150 #endif 151 }; 152