Home | History | Annotate | Line # | Download | only in pci
if_iwmvar.h revision 1.2
      1  1.2  nonaka /*	$NetBSD: if_iwmvar.h,v 1.2 2015/02/13 17:14:06 nonaka Exp $	*/
      2  1.1   pooka /*	OpenBSD: if_iwmvar.h,v 1.3 2015/02/07 07:10:44 phessler Exp 	*/
      3  1.1   pooka 
      4  1.1   pooka /*
      5  1.1   pooka  * Copyright (c) 2014 genua mbh <info (at) genua.de>
      6  1.1   pooka  * Copyright (c) 2014 Fixup Software Ltd.
      7  1.1   pooka  *
      8  1.1   pooka  * Permission to use, copy, modify, and distribute this software for any
      9  1.1   pooka  * purpose with or without fee is hereby granted, provided that the above
     10  1.1   pooka  * copyright notice and this permission notice appear in all copies.
     11  1.1   pooka  *
     12  1.1   pooka  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     13  1.1   pooka  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     14  1.1   pooka  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     15  1.1   pooka  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     16  1.1   pooka  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     17  1.1   pooka  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     18  1.1   pooka  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     19  1.1   pooka  */
     20  1.1   pooka 
     21  1.1   pooka /*-
     22  1.1   pooka  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
     23  1.1   pooka  * which were used as the reference documentation for this implementation.
     24  1.1   pooka  *
     25  1.1   pooka  * Driver version we are currently based off of is
     26  1.1   pooka  * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
     27  1.1   pooka  *
     28  1.1   pooka  ***********************************************************************
     29  1.1   pooka  *
     30  1.1   pooka  * This file is provided under a dual BSD/GPLv2 license.  When using or
     31  1.1   pooka  * redistributing this file, you may do so under either license.
     32  1.1   pooka  *
     33  1.1   pooka  * GPL LICENSE SUMMARY
     34  1.1   pooka  *
     35  1.1   pooka  * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
     36  1.1   pooka  *
     37  1.1   pooka  * This program is free software; you can redistribute it and/or modify
     38  1.1   pooka  * it under the terms of version 2 of the GNU General Public License as
     39  1.1   pooka  * published by the Free Software Foundation.
     40  1.1   pooka  *
     41  1.1   pooka  * This program is distributed in the hope that it will be useful, but
     42  1.1   pooka  * WITHOUT ANY WARRANTY; without even the implied warranty of
     43  1.1   pooka  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     44  1.1   pooka  * General Public License for more details.
     45  1.1   pooka  *
     46  1.1   pooka  * You should have received a copy of the GNU General Public License
     47  1.1   pooka  * along with this program; if not, write to the Free Software
     48  1.1   pooka  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
     49  1.1   pooka  * USA
     50  1.1   pooka  *
     51  1.1   pooka  * The full GNU General Public License is included in this distribution
     52  1.1   pooka  * in the file called COPYING.
     53  1.1   pooka  *
     54  1.1   pooka  * Contact Information:
     55  1.1   pooka  *  Intel Linux Wireless <ilw (at) linux.intel.com>
     56  1.1   pooka  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
     57  1.1   pooka  *
     58  1.1   pooka  *
     59  1.1   pooka  * BSD LICENSE
     60  1.1   pooka  *
     61  1.1   pooka  * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved.
     62  1.1   pooka  * All rights reserved.
     63  1.1   pooka  *
     64  1.1   pooka  * Redistribution and use in source and binary forms, with or without
     65  1.1   pooka  * modification, are permitted provided that the following conditions
     66  1.1   pooka  * are met:
     67  1.1   pooka  *
     68  1.1   pooka  *  * Redistributions of source code must retain the above copyright
     69  1.1   pooka  *    notice, this list of conditions and the following disclaimer.
     70  1.1   pooka  *  * Redistributions in binary form must reproduce the above copyright
     71  1.1   pooka  *    notice, this list of conditions and the following disclaimer in
     72  1.1   pooka  *    the documentation and/or other materials provided with the
     73  1.1   pooka  *    distribution.
     74  1.1   pooka  *  * Neither the name Intel Corporation nor the names of its
     75  1.1   pooka  *    contributors may be used to endorse or promote products derived
     76  1.1   pooka  *    from this software without specific prior written permission.
     77  1.1   pooka  *
     78  1.1   pooka  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     79  1.1   pooka  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     80  1.1   pooka  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     81  1.1   pooka  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     82  1.1   pooka  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     83  1.1   pooka  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     84  1.1   pooka  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     85  1.1   pooka  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     86  1.1   pooka  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     87  1.1   pooka  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     88  1.1   pooka  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     89  1.1   pooka  */
     90  1.1   pooka 
     91  1.1   pooka /*-
     92  1.1   pooka  * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini (at) free.fr>
     93  1.1   pooka  *
     94  1.1   pooka  * Permission to use, copy, modify, and distribute this software for any
     95  1.1   pooka  * purpose with or without fee is hereby granted, provided that the above
     96  1.1   pooka  * copyright notice and this permission notice appear in all copies.
     97  1.1   pooka  *
     98  1.1   pooka  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     99  1.1   pooka  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    100  1.1   pooka  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    101  1.1   pooka  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    102  1.1   pooka  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    103  1.1   pooka  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    104  1.1   pooka  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    105  1.1   pooka  */
    106  1.1   pooka 
    107  1.1   pooka struct iwm_rx_radiotap_header {
    108  1.1   pooka 	struct ieee80211_radiotap_header wr_ihdr;
    109  1.1   pooka 	uint64_t	wr_tsft;
    110  1.1   pooka 	uint8_t		wr_flags;
    111  1.1   pooka 	uint8_t		wr_rate;
    112  1.1   pooka 	uint16_t	wr_chan_freq;
    113  1.1   pooka 	uint16_t	wr_chan_flags;
    114  1.1   pooka 	int8_t		wr_dbm_antsignal;
    115  1.1   pooka 	int8_t		wr_dbm_antnoise;
    116  1.1   pooka } __packed;
    117  1.1   pooka 
    118  1.1   pooka #define IWM_RX_RADIOTAP_PRESENT						\
    119  1.1   pooka 	((1 << IEEE80211_RADIOTAP_TSFT) |				\
    120  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_FLAGS) |				\
    121  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
    122  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
    123  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |			\
    124  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
    125  1.1   pooka 
    126  1.1   pooka struct iwm_tx_radiotap_header {
    127  1.1   pooka 	struct ieee80211_radiotap_header wt_ihdr;
    128  1.1   pooka 	uint8_t		wt_flags;
    129  1.1   pooka 	uint8_t		wt_rate;
    130  1.1   pooka 	uint16_t	wt_chan_freq;
    131  1.1   pooka 	uint16_t	wt_chan_flags;
    132  1.1   pooka 	uint8_t		wt_hwqueue;
    133  1.1   pooka } __packed;
    134  1.1   pooka 
    135  1.1   pooka #define IWM_TX_RADIOTAP_PRESENT						\
    136  1.1   pooka 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
    137  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
    138  1.1   pooka 	 (1 << IEEE80211_RADIOTAP_CHANNEL))
    139  1.1   pooka 
    140  1.1   pooka #define IWM_UCODE_SECT_MAX 6
    141  1.1   pooka #define IWM_FWNAME "iwm-7260-9"
    142  1.1   pooka #define IWM_FWDMASEGSZ (192*1024)
    143  1.1   pooka /* sanity check value */
    144  1.1   pooka #define IWM_FWMAXSIZE (2*1024*1024)
    145  1.1   pooka 
    146  1.1   pooka /*
    147  1.1   pooka  * fw_status is used to determine if we've already parsed the firmware file
    148  1.1   pooka  *
    149  1.1   pooka  * In addition to the following, status < 0 ==> -error
    150  1.1   pooka  */
    151  1.1   pooka #define IWM_FW_STATUS_NONE		0
    152  1.1   pooka #define IWM_FW_STATUS_INPROGRESS	1
    153  1.1   pooka #define IWM_FW_STATUS_DONE		2
    154  1.1   pooka 
    155  1.1   pooka enum iwm_ucode_type {
    156  1.1   pooka 	IWM_UCODE_TYPE_INIT,
    157  1.1   pooka 	IWM_UCODE_TYPE_REGULAR,
    158  1.1   pooka 	IWM_UCODE_TYPE_WOW,
    159  1.1   pooka 	IWM_UCODE_TYPE_MAX
    160  1.1   pooka };
    161  1.1   pooka 
    162  1.1   pooka struct iwm_fw_info {
    163  1.1   pooka 	void *fw_rawdata;
    164  1.1   pooka 	size_t fw_rawsize;
    165  1.1   pooka 	int fw_status;
    166  1.1   pooka 
    167  1.1   pooka 	struct iwm_fw_sects {
    168  1.1   pooka 		struct iwm_fw_onesect {
    169  1.1   pooka 			void *fws_data;
    170  1.1   pooka 			uint32_t fws_len;
    171  1.1   pooka 			uint32_t fws_devoff;
    172  1.1   pooka 
    173  1.1   pooka 			void *fws_alloc;
    174  1.1   pooka 			size_t fws_allocsize;
    175  1.1   pooka 		} fw_sect[IWM_UCODE_SECT_MAX];
    176  1.1   pooka 		size_t fw_totlen;
    177  1.1   pooka 		int fw_count;
    178  1.1   pooka 	} fw_sects[IWM_UCODE_TYPE_MAX];
    179  1.1   pooka };
    180  1.1   pooka 
    181  1.1   pooka struct iwm_nvm_data {
    182  1.1   pooka 	int n_hw_addrs;
    183  1.1   pooka 	uint8_t hw_addr[ETHER_ADDR_LEN];
    184  1.1   pooka 
    185  1.1   pooka 	uint8_t calib_version;
    186  1.1   pooka 	uint16_t calib_voltage;
    187  1.1   pooka 
    188  1.1   pooka 	uint16_t raw_temperature;
    189  1.1   pooka 	uint16_t kelvin_temperature;
    190  1.1   pooka 	uint16_t kelvin_voltage;
    191  1.1   pooka 	uint16_t xtal_calib[2];
    192  1.1   pooka 
    193  1.1   pooka 	int sku_cap_band_24GHz_enable;
    194  1.1   pooka 	int sku_cap_band_52GHz_enable;
    195  1.1   pooka 	int sku_cap_11n_enable;
    196  1.1   pooka 	int sku_cap_amt_enable;
    197  1.1   pooka 	int sku_cap_ipan_enable;
    198  1.1   pooka 
    199  1.1   pooka 	uint8_t radio_cfg_type;
    200  1.1   pooka 	uint8_t radio_cfg_step;
    201  1.1   pooka 	uint8_t radio_cfg_dash;
    202  1.1   pooka 	uint8_t radio_cfg_pnum;
    203  1.1   pooka 	uint8_t valid_tx_ant, valid_rx_ant;
    204  1.1   pooka 
    205  1.1   pooka 	uint16_t nvm_version;
    206  1.1   pooka 	uint8_t max_tx_pwr_half_dbm;
    207  1.1   pooka };
    208  1.1   pooka 
    209  1.1   pooka /* max bufs per tfd the driver will use */
    210  1.1   pooka #define IWM_MAX_CMD_TBS_PER_TFD 2
    211  1.1   pooka 
    212  1.1   pooka struct iwm_rx_packet;
    213  1.1   pooka struct iwm_host_cmd {
    214  1.1   pooka 	const void *data[IWM_MAX_CMD_TBS_PER_TFD];
    215  1.1   pooka 	struct iwm_rx_packet *resp_pkt;
    216  1.1   pooka 	unsigned long _rx_page_addr;
    217  1.1   pooka 	uint32_t _rx_page_order;
    218  1.1   pooka 	int handler_status;
    219  1.1   pooka 
    220  1.1   pooka 	uint32_t flags;
    221  1.1   pooka 	uint16_t len[IWM_MAX_CMD_TBS_PER_TFD];
    222  1.1   pooka 	uint8_t dataflags[IWM_MAX_CMD_TBS_PER_TFD];
    223  1.1   pooka 	uint8_t id;
    224  1.1   pooka };
    225  1.1   pooka 
    226  1.1   pooka /*
    227  1.1   pooka  * DMA glue is from iwn
    228  1.1   pooka  */
    229  1.1   pooka 
    230  1.1   pooka struct iwm_dma_info {
    231  1.1   pooka 	bus_dma_tag_t		tag;
    232  1.1   pooka 	bus_dmamap_t		map;
    233  1.1   pooka 	bus_dma_segment_t	seg;
    234  1.1   pooka 	bus_addr_t		paddr;
    235  1.1   pooka 	void 			*vaddr;
    236  1.1   pooka 	bus_size_t		size;
    237  1.1   pooka };
    238  1.1   pooka 
    239  1.1   pooka #define IWM_TX_RING_COUNT	256
    240  1.1   pooka #define IWM_TX_RING_LOMARK	192
    241  1.1   pooka #define IWM_TX_RING_HIMARK	224
    242  1.1   pooka 
    243  1.1   pooka struct iwm_tx_data {
    244  1.1   pooka 	bus_dmamap_t	map;
    245  1.1   pooka 	bus_addr_t	cmd_paddr;
    246  1.1   pooka 	bus_addr_t	scratch_paddr;
    247  1.1   pooka 	struct mbuf	*m;
    248  1.1   pooka 	struct iwm_node *in;
    249  1.1   pooka 	int done;
    250  1.1   pooka };
    251  1.1   pooka 
    252  1.1   pooka struct iwm_tx_ring {
    253  1.1   pooka 	struct iwm_dma_info	desc_dma;
    254  1.1   pooka 	struct iwm_dma_info	cmd_dma;
    255  1.1   pooka 	struct iwm_tfd		*desc;
    256  1.1   pooka 	struct iwm_device_cmd	*cmd;
    257  1.1   pooka 	struct iwm_tx_data	data[IWM_TX_RING_COUNT];
    258  1.1   pooka 	int			qid;
    259  1.1   pooka 	int			queued;
    260  1.1   pooka 	int			cur;
    261  1.1   pooka };
    262  1.1   pooka 
    263  1.1   pooka #define IWM_RX_RING_COUNT	256
    264  1.1   pooka #define IWM_RBUF_COUNT		(IWM_RX_RING_COUNT + 32)
    265  1.1   pooka /* Linux driver optionally uses 8k buffer */
    266  1.1   pooka #define IWM_RBUF_SIZE		4096
    267  1.1   pooka 
    268  1.1   pooka struct iwm_softc;
    269  1.1   pooka struct iwm_rbuf {
    270  1.1   pooka 	struct iwm_softc	*sc;
    271  1.1   pooka 	void			*vaddr;
    272  1.1   pooka 	bus_addr_t		paddr;
    273  1.1   pooka };
    274  1.1   pooka 
    275  1.1   pooka struct iwm_rx_data {
    276  1.1   pooka 	struct mbuf	*m;
    277  1.1   pooka 	bus_dmamap_t	map;
    278  1.1   pooka 	int		wantresp;
    279  1.1   pooka };
    280  1.1   pooka 
    281  1.1   pooka struct iwm_rx_ring {
    282  1.1   pooka 	struct iwm_dma_info	desc_dma;
    283  1.1   pooka 	struct iwm_dma_info	stat_dma;
    284  1.1   pooka 	struct iwm_dma_info	buf_dma;
    285  1.1   pooka 	uint32_t		*desc;
    286  1.1   pooka 	struct iwm_rb_status	*stat;
    287  1.1   pooka 	struct iwm_rx_data	data[IWM_RX_RING_COUNT];
    288  1.1   pooka 	int			cur;
    289  1.1   pooka };
    290  1.1   pooka 
    291  1.1   pooka #define IWM_FLAG_USE_ICT	0x01
    292  1.1   pooka #define IWM_FLAG_HW_INITED	0x02
    293  1.1   pooka #define IWM_FLAG_STOPPED	0x04
    294  1.1   pooka #define IWM_FLAG_RFKILL		0x08
    295  1.1   pooka #define IWM_FLAG_BUSY		0x10
    296  1.2  nonaka #define IWM_FLAG_ATTACHED	0x20
    297  1.1   pooka 
    298  1.1   pooka struct iwm_ucode_status {
    299  1.1   pooka 	uint32_t uc_error_event_table;
    300  1.1   pooka 	uint32_t uc_log_event_table;
    301  1.1   pooka 
    302  1.1   pooka 	int uc_ok;
    303  1.1   pooka 	int uc_intr;
    304  1.1   pooka };
    305  1.1   pooka 
    306  1.1   pooka #define IWM_CMD_RESP_MAX PAGE_SIZE
    307  1.1   pooka 
    308  1.1   pooka #define IWM_OTP_LOW_IMAGE_SIZE 2048
    309  1.1   pooka 
    310  1.1   pooka #define IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS 500
    311  1.1   pooka #define IWM_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS 400
    312  1.1   pooka 
    313  1.1   pooka /*
    314  1.1   pooka  * Command headers are in iwl-trans.h, which is full of all
    315  1.1   pooka  * kinds of other junk, so we just replicate the structures here.
    316  1.1   pooka  * First the software bits:
    317  1.1   pooka  */
    318  1.1   pooka enum IWM_CMD_MODE {
    319  1.1   pooka 	IWM_CMD_SYNC		= 0,
    320  1.1   pooka 	IWM_CMD_ASYNC		= (1 << 0),
    321  1.1   pooka 	IWM_CMD_WANT_SKB	= (1 << 1),
    322  1.1   pooka 	IWM_CMD_SEND_IN_RFKILL	= (1 << 2),
    323  1.1   pooka };
    324  1.1   pooka enum iwm_hcmd_dataflag {
    325  1.1   pooka         IWM_HCMD_DFL_NOCOPY     = (1 << 0),
    326  1.1   pooka         IWM_HCMD_DFL_DUP        = (1 << 1),
    327  1.1   pooka };
    328  1.1   pooka 
    329  1.1   pooka /*
    330  1.1   pooka  * iwlwifi/iwl-phy-db
    331  1.1   pooka  */
    332  1.1   pooka 
    333  1.1   pooka #define IWM_NUM_PAPD_CH_GROUPS	4
    334  1.1   pooka #define IWM_NUM_TXP_CH_GROUPS	9
    335  1.1   pooka 
    336  1.1   pooka struct iwm_phy_db_entry {
    337  1.1   pooka 	uint16_t size;
    338  1.1   pooka 	uint8_t *data;
    339  1.1   pooka };
    340  1.1   pooka 
    341  1.1   pooka struct iwm_phy_db {
    342  1.1   pooka 	struct iwm_phy_db_entry	cfg;
    343  1.1   pooka 	struct iwm_phy_db_entry	calib_nch;
    344  1.1   pooka 	struct iwm_phy_db_entry	calib_ch_group_papd[IWM_NUM_PAPD_CH_GROUPS];
    345  1.1   pooka 	struct iwm_phy_db_entry	calib_ch_group_txp[IWM_NUM_TXP_CH_GROUPS];
    346  1.1   pooka };
    347  1.1   pooka 
    348  1.1   pooka struct iwm_int_sta {
    349  1.1   pooka 	uint32_t sta_id;
    350  1.1   pooka 	uint32_t tfd_queue_msk;
    351  1.1   pooka };
    352  1.1   pooka 
    353  1.1   pooka struct iwm_mvm_phy_ctxt {
    354  1.1   pooka 	uint16_t id;
    355  1.1   pooka 	uint16_t color;
    356  1.1   pooka 	uint32_t ref;
    357  1.1   pooka 	struct ieee80211_channel *channel;
    358  1.1   pooka };
    359  1.1   pooka 
    360  1.1   pooka struct iwm_bf_data {
    361  1.1   pooka 	int bf_enabled;		/* filtering	*/
    362  1.1   pooka 	int ba_enabled;		/* abort	*/
    363  1.1   pooka 	int ave_beacon_signal;
    364  1.1   pooka 	int last_cqm_event;
    365  1.1   pooka };
    366  1.1   pooka 
    367  1.1   pooka struct iwm_softc {
    368  1.1   pooka 	struct device *sc_dev;
    369  1.1   pooka 	struct ethercom sc_ec;
    370  1.1   pooka 	struct ieee80211com sc_ic;
    371  1.1   pooka 
    372  1.1   pooka 	int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
    373  1.1   pooka 	int sc_newstate_pending;
    374  1.1   pooka 
    375  1.1   pooka 	struct ieee80211_amrr sc_amrr;
    376  1.1   pooka 	struct callout sc_calib_to;
    377  1.1   pooka 
    378  1.1   pooka 	bus_space_tag_t sc_st;
    379  1.1   pooka 	bus_space_handle_t sc_sh;
    380  1.1   pooka 
    381  1.1   pooka 	bus_size_t sc_sz;
    382  1.1   pooka 	bus_dma_tag_t sc_dmat;
    383  1.1   pooka 	pci_chipset_tag_t sc_pct;
    384  1.1   pooka 	pcitag_t sc_pcitag;
    385  1.1   pooka 	const void *sc_ih;
    386  1.1   pooka 
    387  1.1   pooka 	/* TX scheduler rings. */
    388  1.1   pooka 	struct iwm_dma_info		sched_dma;
    389  1.1   pooka 	uint32_t			sched_base;
    390  1.1   pooka 
    391  1.1   pooka         /* TX/RX rings. */
    392  1.1   pooka 	struct iwm_tx_ring txq[IWM_MVM_MAX_QUEUES];
    393  1.1   pooka 	struct iwm_rx_ring rxq;
    394  1.1   pooka 	int qfullmsk;
    395  1.1   pooka 
    396  1.1   pooka 	int sc_sf_state;
    397  1.1   pooka 
    398  1.1   pooka         /* ICT table. */
    399  1.1   pooka 	struct iwm_dma_info	ict_dma;
    400  1.1   pooka 	int			ict_cur;
    401  1.1   pooka 
    402  1.1   pooka 	int sc_hw_rev;
    403  1.1   pooka 	int sc_hw_id;
    404  1.1   pooka 
    405  1.1   pooka 	struct iwm_dma_info kw_dma;
    406  1.1   pooka 	struct iwm_dma_info fw_dma;
    407  1.1   pooka 
    408  1.1   pooka 	int sc_fw_chunk_done;
    409  1.1   pooka 	int sc_init_complete;
    410  1.1   pooka 
    411  1.1   pooka 	struct iwm_ucode_status sc_uc;
    412  1.1   pooka 	enum iwm_ucode_type sc_uc_current;
    413  1.1   pooka 	int sc_fwver;
    414  1.1   pooka 
    415  1.1   pooka 	int sc_capaflags;
    416  1.1   pooka 	int sc_capa_max_probe_len;
    417  1.1   pooka 
    418  1.1   pooka 	int sc_intmask;
    419  1.1   pooka 	int sc_flags;
    420  1.1   pooka 
    421  1.1   pooka 	/*
    422  1.1   pooka 	 * So why do we need a separate stopped flag and a generation?
    423  1.1   pooka 	 * the former protects the device from issueing commands when it's
    424  1.1   pooka 	 * stopped (duh).  The latter protects against race from a very
    425  1.1   pooka 	 * fast stop/unstop cycle where threads waiting for responses do
    426  1.1   pooka 	 * not have a chance to run in between.  Notably: we want to stop
    427  1.1   pooka 	 * the device from interrupt context when it craps out, so we
    428  1.1   pooka 	 * don't have the luxury of waiting for quiescense.
    429  1.1   pooka 	 */
    430  1.1   pooka 	int sc_generation;
    431  1.1   pooka 
    432  1.1   pooka 	int sc_cap_off; /* PCIe caps */
    433  1.1   pooka 
    434  1.1   pooka 	const char *sc_fwname;
    435  1.1   pooka 	bus_size_t sc_fwdmasegsz;
    436  1.1   pooka 	struct iwm_fw_info sc_fw;
    437  1.1   pooka 	int sc_fw_phy_config;
    438  1.1   pooka 	struct iwm_tlv_calib_ctrl sc_default_calib[IWM_UCODE_TYPE_MAX];
    439  1.1   pooka 
    440  1.1   pooka 	struct iwm_nvm_data sc_nvm;
    441  1.1   pooka 	struct iwm_phy_db sc_phy_db;
    442  1.1   pooka 
    443  1.1   pooka 	struct iwm_bf_data sc_bf;
    444  1.1   pooka 
    445  1.1   pooka 	int sc_tx_timer;
    446  1.1   pooka 
    447  1.1   pooka 	struct iwm_scan_cmd *sc_scan_cmd;
    448  1.1   pooka 	size_t sc_scan_cmd_len;
    449  1.1   pooka 	int sc_scan_last_antenna;
    450  1.1   pooka 	int sc_scanband;
    451  1.1   pooka 
    452  1.1   pooka 	int sc_auth_prot;
    453  1.1   pooka 
    454  1.1   pooka 	int sc_fixed_ridx;
    455  1.1   pooka 
    456  1.1   pooka 	int sc_staid;
    457  1.1   pooka 	int sc_nodecolor;
    458  1.1   pooka 
    459  1.1   pooka 	uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX];
    460  1.1   pooka 	int sc_wantresp;
    461  1.1   pooka 
    462  1.1   pooka 	struct workqueue *sc_nswq, *sc_eswq;
    463  1.1   pooka 	struct work sc_eswk;
    464  1.1   pooka 
    465  1.1   pooka 	struct iwm_rx_phy_info sc_last_phy_info;
    466  1.1   pooka 	int sc_ampdu_ref;
    467  1.1   pooka 
    468  1.1   pooka 	struct iwm_int_sta sc_aux_sta;
    469  1.1   pooka 
    470  1.1   pooka 	/* phy contexts.  we only use the first one */
    471  1.1   pooka 	struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
    472  1.1   pooka 
    473  1.1   pooka 	struct iwm_notif_statistics sc_stats;
    474  1.1   pooka 	int sc_noise;
    475  1.1   pooka 
    476  1.1   pooka 	struct bpf_if *		sc_drvbpf;
    477  1.1   pooka 
    478  1.1   pooka 	union {
    479  1.1   pooka 		struct iwm_rx_radiotap_header th;
    480  1.1   pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    481  1.1   pooka 	} sc_rxtapu;
    482  1.1   pooka #define sc_rxtap	sc_rxtapu.th
    483  1.1   pooka 	int			sc_rxtap_len;
    484  1.1   pooka 
    485  1.1   pooka 	union {
    486  1.1   pooka 		struct iwm_tx_radiotap_header th;
    487  1.1   pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    488  1.1   pooka 	} sc_txtapu;
    489  1.1   pooka #define sc_txtap	sc_txtapu.th
    490  1.1   pooka 	int			sc_txtap_len;
    491  1.1   pooka };
    492  1.1   pooka 
    493  1.1   pooka struct iwm_node {
    494  1.1   pooka 	struct ieee80211_node in_ni;
    495  1.1   pooka 	struct iwm_mvm_phy_ctxt *in_phyctxt;
    496  1.1   pooka 
    497  1.1   pooka 	uint16_t in_id;
    498  1.1   pooka 	uint16_t in_color;
    499  1.1   pooka 	int in_tsfid;
    500  1.1   pooka 
    501  1.1   pooka 	/* status "bits" */
    502  1.1   pooka 	int in_assoc;
    503  1.1   pooka 
    504  1.1   pooka 	struct iwm_lq_cmd in_lq;
    505  1.1   pooka 	struct ieee80211_amrr_node in_amn;
    506  1.1   pooka 
    507  1.1   pooka 	uint8_t in_ridx[IEEE80211_RATE_MAXSIZE];
    508  1.1   pooka };
    509  1.1   pooka #define IWM_STATION_ID 0
    510  1.1   pooka 
    511  1.1   pooka #define IWM_ICT_SIZE		4096
    512  1.1   pooka #define IWM_ICT_COUNT		(IWM_ICT_SIZE / sizeof (uint32_t))
    513  1.1   pooka #define IWM_ICT_PADDR_SHIFT	12
    514