Home | History | Annotate | Line # | Download | only in pci
if_iwmvar.h revision 1.13
      1  1.13  nonaka /*	$NetBSD: if_iwmvar.h,v 1.13 2017/01/10 07:34:04 nonaka Exp $	*/
      2  1.10  nonaka /*	OpenBSD: if_iwmvar.h,v 1.24 2016/09/21 13:53:18 stsp 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.10  nonaka #define IWM_UCODE_SECT_MAX 16
    141   1.1   pooka #define IWM_FWDMASEGSZ (192*1024)
    142  1.10  nonaka #define IWM_FWDMASEGSZ_8000 (320*1024)
    143   1.1   pooka 
    144   1.1   pooka /*
    145   1.1   pooka  * fw_status is used to determine if we've already parsed the firmware file
    146   1.1   pooka  *
    147   1.1   pooka  * In addition to the following, status < 0 ==> -error
    148   1.1   pooka  */
    149   1.1   pooka #define IWM_FW_STATUS_NONE		0
    150   1.1   pooka #define IWM_FW_STATUS_INPROGRESS	1
    151   1.1   pooka #define IWM_FW_STATUS_DONE		2
    152   1.1   pooka 
    153   1.1   pooka enum iwm_ucode_type {
    154  1.10  nonaka 	IWM_UCODE_TYPE_REGULAR,
    155   1.1   pooka 	IWM_UCODE_TYPE_INIT,
    156   1.1   pooka 	IWM_UCODE_TYPE_WOW,
    157  1.10  nonaka 	IWM_UCODE_TYPE_REGULAR_USNIFFER,
    158   1.1   pooka 	IWM_UCODE_TYPE_MAX
    159   1.1   pooka };
    160   1.1   pooka 
    161   1.1   pooka struct iwm_fw_info {
    162   1.1   pooka 	void *fw_rawdata;
    163   1.1   pooka 	size_t fw_rawsize;
    164   1.1   pooka 	int fw_status;
    165   1.1   pooka 
    166   1.1   pooka 	struct iwm_fw_sects {
    167   1.1   pooka 		struct iwm_fw_onesect {
    168   1.1   pooka 			void *fws_data;
    169   1.1   pooka 			uint32_t fws_len;
    170   1.4  nonaka 			uint32_t fws_devoff;
    171   1.1   pooka 
    172   1.1   pooka 			void *fws_alloc;
    173   1.1   pooka 			size_t fws_allocsize;
    174   1.1   pooka 		} fw_sect[IWM_UCODE_SECT_MAX];
    175   1.1   pooka 		size_t fw_totlen;
    176   1.1   pooka 		int fw_count;
    177   1.1   pooka 	} fw_sects[IWM_UCODE_TYPE_MAX];
    178   1.1   pooka };
    179   1.1   pooka 
    180   1.1   pooka struct iwm_nvm_data {
    181   1.1   pooka 	int n_hw_addrs;
    182   1.1   pooka 	uint8_t hw_addr[ETHER_ADDR_LEN];
    183   1.1   pooka 
    184   1.1   pooka 	uint8_t calib_version;
    185   1.1   pooka 	uint16_t calib_voltage;
    186   1.1   pooka 
    187   1.1   pooka 	uint16_t raw_temperature;
    188   1.1   pooka 	uint16_t kelvin_temperature;
    189   1.1   pooka 	uint16_t kelvin_voltage;
    190   1.1   pooka 	uint16_t xtal_calib[2];
    191   1.1   pooka 
    192   1.1   pooka 	int sku_cap_band_24GHz_enable;
    193   1.1   pooka 	int sku_cap_band_52GHz_enable;
    194   1.1   pooka 	int sku_cap_11n_enable;
    195   1.1   pooka 	int sku_cap_amt_enable;
    196   1.1   pooka 	int sku_cap_ipan_enable;
    197  1.10  nonaka 	int sku_cap_mimo_disable;
    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.10  nonaka 	uint32_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_rx_data {
    269   1.1   pooka 	struct mbuf	*m;
    270   1.1   pooka 	bus_dmamap_t	map;
    271   1.1   pooka };
    272   1.1   pooka 
    273   1.1   pooka struct iwm_rx_ring {
    274   1.1   pooka 	struct iwm_dma_info	desc_dma;
    275   1.1   pooka 	struct iwm_dma_info	stat_dma;
    276   1.1   pooka 	struct iwm_dma_info	buf_dma;
    277   1.1   pooka 	uint32_t		*desc;
    278   1.1   pooka 	struct iwm_rb_status	*stat;
    279   1.1   pooka 	struct iwm_rx_data	data[IWM_RX_RING_COUNT];
    280   1.1   pooka 	int			cur;
    281   1.1   pooka };
    282   1.1   pooka 
    283   1.8  nonaka #define IWM_FLAG_USE_ICT	__BIT(0)
    284   1.8  nonaka #define IWM_FLAG_HW_INITED	__BIT(1)
    285   1.8  nonaka #define IWM_FLAG_STOPPED	__BIT(2)
    286   1.8  nonaka #define IWM_FLAG_RFKILL		__BIT(3)
    287  1.10  nonaka #define IWM_FLAG_SCANNING	__BIT(4)
    288   1.8  nonaka #define IWM_FLAG_ATTACHED	__BIT(5)
    289   1.8  nonaka #define IWM_FLAG_FW_LOADED	__BIT(6)
    290   1.1   pooka 
    291   1.1   pooka struct iwm_ucode_status {
    292   1.1   pooka 	uint32_t uc_error_event_table;
    293  1.10  nonaka 	uint32_t uc_umac_error_event_table;
    294   1.1   pooka 	uint32_t uc_log_event_table;
    295   1.4  nonaka 
    296   1.1   pooka 	int uc_ok;
    297   1.1   pooka 	int uc_intr;
    298   1.1   pooka };
    299   1.1   pooka 
    300  1.10  nonaka /* sc_wantresp */
    301  1.10  nonaka #define IWM_CMD_RESP_IDLE	-1
    302  1.10  nonaka 
    303   1.1   pooka #define IWM_CMD_RESP_MAX PAGE_SIZE
    304   1.1   pooka 
    305  1.10  nonaka /* lower blocks contain EEPROM image and calibration data */
    306  1.10  nonaka #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 	16384
    307  1.10  nonaka #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000	32768
    308   1.1   pooka 
    309  1.10  nonaka #define IWM_TE_SESSION_PROTECTION_MAX_TIME_MS 1000
    310  1.10  nonaka #define IWM_TE_SESSION_PROTECTION_MIN_TIME_MS 400
    311   1.1   pooka 
    312   1.1   pooka enum IWM_CMD_MODE {
    313   1.1   pooka 	IWM_CMD_ASYNC		= (1 << 0),
    314   1.1   pooka 	IWM_CMD_WANT_SKB	= (1 << 1),
    315   1.1   pooka 	IWM_CMD_SEND_IN_RFKILL	= (1 << 2),
    316   1.1   pooka };
    317   1.1   pooka enum iwm_hcmd_dataflag {
    318   1.4  nonaka 	IWM_HCMD_DFL_NOCOPY     = (1 << 0),
    319   1.4  nonaka 	IWM_HCMD_DFL_DUP        = (1 << 1),
    320   1.1   pooka };
    321   1.1   pooka 
    322  1.10  nonaka #define IWM_NUM_PAPD_CH_GROUPS	9
    323   1.1   pooka #define IWM_NUM_TXP_CH_GROUPS	9
    324   1.1   pooka 
    325   1.1   pooka struct iwm_phy_db_entry {
    326   1.1   pooka 	uint16_t size;
    327   1.1   pooka 	uint8_t *data;
    328   1.1   pooka };
    329   1.1   pooka 
    330   1.1   pooka struct iwm_phy_db {
    331   1.1   pooka 	struct iwm_phy_db_entry	cfg;
    332   1.1   pooka 	struct iwm_phy_db_entry	calib_nch;
    333   1.1   pooka 	struct iwm_phy_db_entry	calib_ch_group_papd[IWM_NUM_PAPD_CH_GROUPS];
    334   1.1   pooka 	struct iwm_phy_db_entry	calib_ch_group_txp[IWM_NUM_TXP_CH_GROUPS];
    335   1.1   pooka };
    336   1.1   pooka 
    337  1.10  nonaka struct iwm_phy_ctxt {
    338   1.1   pooka 	uint16_t id;
    339   1.1   pooka 	uint16_t color;
    340   1.1   pooka 	uint32_t ref;
    341   1.1   pooka 	struct ieee80211_channel *channel;
    342   1.1   pooka };
    343   1.1   pooka 
    344   1.1   pooka struct iwm_bf_data {
    345   1.1   pooka 	int bf_enabled;		/* filtering	*/
    346   1.1   pooka 	int ba_enabled;		/* abort	*/
    347   1.1   pooka 	int ave_beacon_signal;
    348   1.1   pooka 	int last_cqm_event;
    349   1.1   pooka };
    350   1.1   pooka 
    351   1.1   pooka struct iwm_softc {
    352   1.3  nonaka 	device_t sc_dev;
    353   1.1   pooka 	struct ethercom sc_ec;
    354   1.1   pooka 	struct ieee80211com sc_ic;
    355   1.1   pooka 
    356   1.1   pooka 	int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
    357   1.1   pooka 	int sc_newstate_pending;
    358   1.1   pooka 
    359   1.1   pooka 	struct ieee80211_amrr sc_amrr;
    360   1.1   pooka 	struct callout sc_calib_to;
    361  1.10  nonaka 	struct callout sc_led_blink_to;
    362   1.1   pooka 
    363   1.1   pooka 	bus_space_tag_t sc_st;
    364   1.1   pooka 	bus_space_handle_t sc_sh;
    365   1.6  nonaka 	pci_intr_handle_t *sc_pihp;
    366   1.1   pooka 
    367   1.1   pooka 	bus_size_t sc_sz;
    368   1.1   pooka 	bus_dma_tag_t sc_dmat;
    369   1.1   pooka 	pci_chipset_tag_t sc_pct;
    370   1.1   pooka 	pcitag_t sc_pcitag;
    371   1.3  nonaka 	pcireg_t sc_pciid;
    372   1.1   pooka 	const void *sc_ih;
    373  1.11  nonaka 	void *sc_soft_ih;
    374  1.11  nonaka 	uint32_t sc_soft_flags;
    375   1.1   pooka 
    376   1.1   pooka 	/* TX scheduler rings. */
    377   1.1   pooka 	struct iwm_dma_info		sched_dma;
    378   1.1   pooka 	uint32_t			sched_base;
    379   1.1   pooka 
    380   1.4  nonaka 	/* TX/RX rings. */
    381  1.10  nonaka 	struct iwm_tx_ring txq[IWM_MAX_QUEUES];
    382   1.1   pooka 	struct iwm_rx_ring rxq;
    383   1.1   pooka 	int qfullmsk;
    384   1.1   pooka 
    385   1.1   pooka 	int sc_sf_state;
    386   1.1   pooka 
    387   1.4  nonaka 	/* ICT table. */
    388   1.1   pooka 	struct iwm_dma_info	ict_dma;
    389   1.1   pooka 	int			ict_cur;
    390   1.1   pooka 
    391   1.1   pooka 	int sc_hw_rev;
    392  1.10  nonaka #define IWM_SILICON_A_STEP	0
    393  1.10  nonaka #define IWM_SILICON_B_STEP	1
    394  1.10  nonaka #define IWM_SILICON_C_STEP	2
    395  1.10  nonaka #define IWM_SILICON_D_STEP	3
    396   1.1   pooka 	int sc_hw_id;
    397  1.10  nonaka 	int sc_device_family;
    398  1.10  nonaka #define IWM_DEVICE_FAMILY_7000	1
    399  1.10  nonaka #define IWM_DEVICE_FAMILY_8000	2
    400   1.1   pooka 
    401   1.1   pooka 	struct iwm_dma_info kw_dma;
    402   1.1   pooka 	struct iwm_dma_info fw_dma;
    403   1.1   pooka 
    404   1.1   pooka 	int sc_fw_chunk_done;
    405   1.1   pooka 	int sc_init_complete;
    406   1.1   pooka 
    407   1.1   pooka 	struct iwm_ucode_status sc_uc;
    408   1.1   pooka 	enum iwm_ucode_type sc_uc_current;
    409  1.10  nonaka 	char sc_fwver[32];
    410   1.1   pooka 
    411   1.1   pooka 	int sc_capaflags;
    412   1.1   pooka 	int sc_capa_max_probe_len;
    413  1.10  nonaka 	int sc_capa_n_scan_channels;
    414  1.10  nonaka 	uint32_t sc_ucode_api;
    415  1.10  nonaka 	uint8_t sc_enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)];
    416  1.10  nonaka 	char sc_fw_mcc[3];
    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.10  nonaka 	int sc_rx_ba_sessions;
    447   1.1   pooka 
    448   1.1   pooka 	int sc_scan_last_antenna;
    449   1.1   pooka 
    450   1.1   pooka 	int sc_fixed_ridx;
    451   1.1   pooka 
    452   1.1   pooka 	int sc_staid;
    453   1.1   pooka 	int sc_nodecolor;
    454   1.1   pooka 
    455   1.1   pooka 	uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX];
    456   1.1   pooka 	int sc_wantresp;
    457   1.1   pooka 
    458  1.11  nonaka 	struct workqueue *sc_nswq;
    459   1.1   pooka 
    460   1.1   pooka 	struct iwm_rx_phy_info sc_last_phy_info;
    461   1.1   pooka 	int sc_ampdu_ref;
    462   1.1   pooka 
    463   1.1   pooka 	/* phy contexts.  we only use the first one */
    464  1.10  nonaka 	struct iwm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
    465   1.1   pooka 
    466   1.1   pooka 	struct iwm_notif_statistics sc_stats;
    467   1.1   pooka 	int sc_noise;
    468   1.1   pooka 
    469  1.13  nonaka 	int sc_cmd_hold_nic_awake;
    470  1.13  nonaka 
    471  1.13  nonaka 	/* device needs host interrupt operation mode set */
    472   1.5  nonaka 	int host_interrupt_operation_mode;
    473  1.13  nonaka 	/* should the MAC access REQ be asserted when a command is in flight.
    474  1.13  nonaka 	 * This is due to a HW bug in 7260, 3160 and 7265. */
    475  1.13  nonaka 	int apmg_wake_up_wa;
    476   1.5  nonaka 
    477   1.8  nonaka 	struct sysctllog *sc_clog;
    478   1.8  nonaka 
    479  1.11  nonaka 	struct bpf_if *sc_drvbpf;
    480   1.1   pooka 
    481   1.1   pooka 	union {
    482   1.1   pooka 		struct iwm_rx_radiotap_header th;
    483   1.1   pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    484   1.1   pooka 	} sc_rxtapu;
    485   1.1   pooka #define sc_rxtap	sc_rxtapu.th
    486   1.1   pooka 	int			sc_rxtap_len;
    487   1.1   pooka 
    488   1.1   pooka 	union {
    489   1.1   pooka 		struct iwm_tx_radiotap_header th;
    490   1.1   pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    491   1.1   pooka 	} sc_txtapu;
    492   1.1   pooka #define sc_txtap	sc_txtapu.th
    493   1.1   pooka 	int			sc_txtap_len;
    494   1.1   pooka };
    495   1.1   pooka 
    496   1.1   pooka struct iwm_node {
    497   1.1   pooka 	struct ieee80211_node in_ni;
    498  1.10  nonaka 	struct iwm_phy_ctxt *in_phyctxt;
    499   1.1   pooka 
    500   1.1   pooka 	uint16_t in_id;
    501   1.1   pooka 	uint16_t in_color;
    502   1.1   pooka 
    503   1.1   pooka 	struct iwm_lq_cmd in_lq;
    504   1.1   pooka 	struct ieee80211_amrr_node in_amn;
    505   1.1   pooka };
    506   1.1   pooka #define IWM_STATION_ID 0
    507  1.10  nonaka #define IWM_AUX_STA_ID 1
    508   1.1   pooka 
    509   1.1   pooka #define IWM_ICT_SIZE		4096
    510   1.1   pooka #define IWM_ICT_COUNT		(IWM_ICT_SIZE / sizeof (uint32_t))
    511   1.1   pooka #define IWM_ICT_PADDR_SHIFT	12
    512