1 /* $OpenBSD: if_ipwvar.h,v 1.18 2008/08/28 15:08:38 damien 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 flags; 85 #define IPW_FLAG_FW_INITED (1 << 0) 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 SLIST_HEAD(, ipw_soft_hdr) free_shdr; 120 SLIST_HEAD(, ipw_soft_buf) free_sbuf; 121 122 uint32_t table1_base; 123 uint32_t table2_base; 124 125 uint32_t txcur; 126 uint32_t txold; 127 uint32_t rxcur; 128 int txfree; 129 130 void *powerhook; 131 132 #if NBPFILTER > 0 133 caddr_t sc_drvbpf; 134 135 union { 136 struct ipw_rx_radiotap_header th; 137 uint8_t pad[64]; 138 } sc_rxtapu; 139 #define sc_rxtap sc_rxtapu.th 140 int sc_rxtap_len; 141 142 union { 143 struct ipw_tx_radiotap_header th; 144 uint8_t pad[64]; 145 } sc_txtapu; 146 #define sc_txtap sc_txtapu.th 147 int sc_txtap_len; 148 #endif 149 }; 150