1 /* $OpenBSD: if_ipwvar.h,v 1.28 2016/09/05 10:17:30 tedu 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 size_t size; 23 u_char *main; 24 size_t main_size; 25 u_char *ucode; 26 size_t ucode_size; 27 }; 28 29 struct ipw_soft_bd { 30 struct ipw_bd *bd; 31 int type; 32 #define IPW_SBD_TYPE_NOASSOC 0 33 #define IPW_SBD_TYPE_COMMAND 1 34 #define IPW_SBD_TYPE_HEADER 2 35 #define IPW_SBD_TYPE_DATA 3 36 void *priv; 37 }; 38 39 struct ipw_soft_hdr { 40 struct ipw_hdr hdr; 41 bus_dmamap_t map; 42 SLIST_ENTRY(ipw_soft_hdr) next; 43 }; 44 45 struct ipw_soft_buf { 46 struct mbuf *m; 47 struct ieee80211_node *ni; 48 bus_dmamap_t map; 49 SLIST_ENTRY(ipw_soft_buf) next; 50 }; 51 52 struct ipw_rx_radiotap_header { 53 struct ieee80211_radiotap_header wr_ihdr; 54 uint8_t wr_flags; 55 uint16_t wr_chan_freq; 56 uint16_t wr_chan_flags; 57 uint8_t wr_antsignal; 58 } __packed; 59 60 #define IPW_RX_RADIOTAP_PRESENT \ 61 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 62 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 63 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 64 65 struct ipw_tx_radiotap_header { 66 struct ieee80211_radiotap_header wt_ihdr; 67 uint8_t wt_flags; 68 uint16_t wt_chan_freq; 69 uint16_t wt_chan_flags; 70 } __packed; 71 72 #define IPW_TX_RADIOTAP_PRESENT \ 73 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 74 (1 << IEEE80211_RADIOTAP_CHANNEL)) 75 76 #define IPW_MAX_NSEG 1 77 78 struct ipw_softc { 79 struct device sc_dev; 80 81 struct ieee80211com sc_ic; 82 int (*sc_newstate)(struct ieee80211com *, 83 enum ieee80211_state, int); 84 85 struct rwlock sc_rwlock; 86 87 bus_space_tag_t sc_st; 88 bus_space_handle_t sc_sh; 89 void *sc_ih; 90 pci_chipset_tag_t sc_pct; 91 pcitag_t sc_pcitag; 92 bus_size_t sc_sz; 93 94 int sc_tx_timer; 95 96 bus_dma_tag_t sc_dmat; 97 98 bus_dmamap_t tbd_map; 99 bus_dmamap_t rbd_map; 100 bus_dmamap_t status_map; 101 bus_dmamap_t cmd_map; 102 103 bus_dma_segment_t tbd_seg; 104 bus_dma_segment_t rbd_seg; 105 bus_dma_segment_t status_seg; 106 bus_dma_segment_t cmd_seg; 107 108 struct ipw_bd *tbd_list; 109 struct ipw_bd *rbd_list; 110 struct ipw_status *status_list; 111 112 struct ipw_cmd cmd; 113 struct ipw_soft_bd stbd_list[IPW_NTBD]; 114 struct ipw_soft_buf tx_sbuf_list[IPW_NDATA]; 115 struct ipw_soft_hdr shdr_list[IPW_NDATA]; 116 struct ipw_soft_bd srbd_list[IPW_NRBD]; 117 struct ipw_soft_buf rx_sbuf_list[IPW_NRBD]; 118 119 struct task sc_scantask; 120 struct task sc_authandassoctask; 121 122 SLIST_HEAD(, ipw_soft_hdr) free_shdr; 123 SLIST_HEAD(, ipw_soft_buf) free_sbuf; 124 125 uint32_t table1_base; 126 uint32_t table2_base; 127 128 uint32_t txcur; 129 uint32_t txold; 130 uint32_t rxcur; 131 int txfree; 132 133 #if NBPFILTER > 0 134 caddr_t sc_drvbpf; 135 136 union { 137 struct ipw_rx_radiotap_header th; 138 uint8_t pad[64]; 139 } sc_rxtapu; 140 #define sc_rxtap sc_rxtapu.th 141 int sc_rxtap_len; 142 143 union { 144 struct ipw_tx_radiotap_header th; 145 uint8_t pad[64]; 146 } sc_txtapu; 147 #define sc_txtap sc_txtapu.th 148 int sc_txtap_len; 149 #endif 150 }; 151