Home | History | Annotate | Line # | Download | only in pci
      1  1.20  thorpej /*	$NetBSD: if_iwmvar.h,v 1.20 2020/05/22 20:27:16 thorpej 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.19      mrg };
    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.19      mrg };
    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.18   nonaka 		int is_dual_cpus;
    178  1.18   nonaka 		uint32_t paging_mem_size;
    179   1.1    pooka 	} fw_sects[IWM_UCODE_TYPE_MAX];
    180   1.1    pooka };
    181   1.1    pooka 
    182   1.1    pooka struct iwm_nvm_data {
    183   1.1    pooka 	int n_hw_addrs;
    184   1.1    pooka 	uint8_t hw_addr[ETHER_ADDR_LEN];
    185   1.1    pooka 
    186   1.1    pooka 	uint8_t calib_version;
    187   1.1    pooka 	uint16_t calib_voltage;
    188   1.1    pooka 
    189   1.1    pooka 	uint16_t raw_temperature;
    190   1.1    pooka 	uint16_t kelvin_temperature;
    191   1.1    pooka 	uint16_t kelvin_voltage;
    192   1.1    pooka 	uint16_t xtal_calib[2];
    193   1.1    pooka 
    194   1.1    pooka 	int sku_cap_band_24GHz_enable;
    195   1.1    pooka 	int sku_cap_band_52GHz_enable;
    196   1.1    pooka 	int sku_cap_11n_enable;
    197   1.1    pooka 	int sku_cap_amt_enable;
    198   1.1    pooka 	int sku_cap_ipan_enable;
    199  1.10   nonaka 	int sku_cap_mimo_disable;
    200   1.1    pooka 
    201   1.1    pooka 	uint8_t radio_cfg_type;
    202   1.1    pooka 	uint8_t radio_cfg_step;
    203   1.1    pooka 	uint8_t radio_cfg_dash;
    204   1.1    pooka 	uint8_t radio_cfg_pnum;
    205   1.1    pooka 	uint8_t valid_tx_ant, valid_rx_ant;
    206   1.1    pooka 
    207   1.1    pooka 	uint16_t nvm_version;
    208   1.1    pooka 	uint8_t max_tx_pwr_half_dbm;
    209  1.14   nonaka 
    210  1.14   nonaka 	bool lar_enabled;
    211   1.1    pooka };
    212   1.1    pooka 
    213   1.1    pooka /* max bufs per tfd the driver will use */
    214   1.1    pooka #define IWM_MAX_CMD_TBS_PER_TFD 2
    215   1.1    pooka 
    216   1.1    pooka struct iwm_rx_packet;
    217   1.1    pooka struct iwm_host_cmd {
    218   1.1    pooka 	const void *data[IWM_MAX_CMD_TBS_PER_TFD];
    219   1.1    pooka 	struct iwm_rx_packet *resp_pkt;
    220   1.1    pooka 	unsigned long _rx_page_addr;
    221   1.1    pooka 	uint32_t _rx_page_order;
    222   1.1    pooka 	int handler_status;
    223   1.1    pooka 
    224   1.1    pooka 	uint32_t flags;
    225   1.1    pooka 	uint16_t len[IWM_MAX_CMD_TBS_PER_TFD];
    226   1.1    pooka 	uint8_t dataflags[IWM_MAX_CMD_TBS_PER_TFD];
    227  1.10   nonaka 	uint32_t id;
    228   1.1    pooka };
    229   1.1    pooka 
    230   1.1    pooka /*
    231   1.1    pooka  * DMA glue is from iwn
    232   1.1    pooka  */
    233   1.1    pooka 
    234   1.1    pooka struct iwm_dma_info {
    235   1.1    pooka 	bus_dma_tag_t		tag;
    236   1.1    pooka 	bus_dmamap_t		map;
    237   1.1    pooka 	bus_dma_segment_t	seg;
    238   1.1    pooka 	bus_addr_t		paddr;
    239   1.1    pooka 	void 			*vaddr;
    240   1.1    pooka 	bus_size_t		size;
    241   1.1    pooka };
    242   1.1    pooka 
    243  1.18   nonaka /**
    244  1.18   nonaka  * struct iwm_fw_paging
    245  1.18   nonaka  * @fw_paging_block: dma memory info
    246  1.18   nonaka  * @fw_paging_size: page size
    247  1.18   nonaka  */
    248  1.18   nonaka struct iwm_fw_paging {
    249  1.18   nonaka 	struct iwm_dma_info fw_paging_block;
    250  1.18   nonaka 	uint32_t fw_paging_size;
    251  1.18   nonaka };
    252  1.18   nonaka 
    253   1.1    pooka #define IWM_TX_RING_COUNT	256
    254   1.1    pooka #define IWM_TX_RING_LOMARK	192
    255   1.1    pooka #define IWM_TX_RING_HIMARK	224
    256   1.1    pooka 
    257   1.1    pooka struct iwm_tx_data {
    258   1.1    pooka 	bus_dmamap_t	map;
    259   1.1    pooka 	bus_addr_t	cmd_paddr;
    260   1.1    pooka 	bus_addr_t	scratch_paddr;
    261   1.1    pooka 	struct mbuf	*m;
    262   1.1    pooka 	struct iwm_node *in;
    263   1.1    pooka 	int done;
    264   1.1    pooka };
    265   1.1    pooka 
    266   1.1    pooka struct iwm_tx_ring {
    267   1.1    pooka 	struct iwm_dma_info	desc_dma;
    268   1.1    pooka 	struct iwm_dma_info	cmd_dma;
    269   1.1    pooka 	struct iwm_tfd		*desc;
    270   1.1    pooka 	struct iwm_device_cmd	*cmd;
    271   1.1    pooka 	struct iwm_tx_data	data[IWM_TX_RING_COUNT];
    272   1.1    pooka 	int			qid;
    273   1.1    pooka 	int			queued;
    274   1.1    pooka 	int			cur;
    275   1.1    pooka };
    276   1.1    pooka 
    277   1.1    pooka #define IWM_RX_RING_COUNT	256
    278   1.1    pooka #define IWM_RBUF_COUNT		(IWM_RX_RING_COUNT + 32)
    279   1.1    pooka /* Linux driver optionally uses 8k buffer */
    280   1.1    pooka #define IWM_RBUF_SIZE		4096
    281   1.1    pooka 
    282   1.1    pooka struct iwm_rx_data {
    283   1.1    pooka 	struct mbuf	*m;
    284   1.1    pooka 	bus_dmamap_t	map;
    285   1.1    pooka };
    286   1.1    pooka 
    287   1.1    pooka struct iwm_rx_ring {
    288   1.1    pooka 	struct iwm_dma_info	desc_dma;
    289   1.1    pooka 	struct iwm_dma_info	stat_dma;
    290   1.1    pooka 	struct iwm_dma_info	buf_dma;
    291   1.1    pooka 	uint32_t		*desc;
    292   1.1    pooka 	struct iwm_rb_status	*stat;
    293   1.1    pooka 	struct iwm_rx_data	data[IWM_RX_RING_COUNT];
    294   1.1    pooka 	int			cur;
    295   1.1    pooka };
    296   1.1    pooka 
    297   1.8   nonaka #define IWM_FLAG_USE_ICT	__BIT(0)
    298   1.8   nonaka #define IWM_FLAG_HW_INITED	__BIT(1)
    299   1.8   nonaka #define IWM_FLAG_STOPPED	__BIT(2)
    300   1.8   nonaka #define IWM_FLAG_RFKILL		__BIT(3)
    301  1.10   nonaka #define IWM_FLAG_SCANNING	__BIT(4)
    302   1.8   nonaka #define IWM_FLAG_ATTACHED	__BIT(5)
    303   1.8   nonaka #define IWM_FLAG_FW_LOADED	__BIT(6)
    304   1.1    pooka 
    305   1.1    pooka struct iwm_ucode_status {
    306   1.1    pooka 	uint32_t uc_error_event_table;
    307  1.10   nonaka 	uint32_t uc_umac_error_event_table;
    308   1.1    pooka 	uint32_t uc_log_event_table;
    309   1.4   nonaka 
    310   1.1    pooka 	int uc_ok;
    311   1.1    pooka 	int uc_intr;
    312   1.1    pooka };
    313   1.1    pooka 
    314  1.10   nonaka /* sc_wantresp */
    315  1.10   nonaka #define IWM_CMD_RESP_IDLE	-1
    316  1.10   nonaka 
    317   1.1    pooka #define IWM_CMD_RESP_MAX PAGE_SIZE
    318   1.1    pooka 
    319  1.10   nonaka /* lower blocks contain EEPROM image and calibration data */
    320  1.10   nonaka #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 	16384
    321  1.10   nonaka #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000	32768
    322   1.1    pooka 
    323  1.10   nonaka #define IWM_TE_SESSION_PROTECTION_MAX_TIME_MS 1000
    324  1.10   nonaka #define IWM_TE_SESSION_PROTECTION_MIN_TIME_MS 400
    325   1.1    pooka 
    326   1.1    pooka enum IWM_CMD_MODE {
    327   1.1    pooka 	IWM_CMD_ASYNC		= (1 << 0),
    328   1.1    pooka 	IWM_CMD_WANT_SKB	= (1 << 1),
    329   1.1    pooka 	IWM_CMD_SEND_IN_RFKILL	= (1 << 2),
    330   1.1    pooka };
    331   1.1    pooka enum iwm_hcmd_dataflag {
    332   1.4   nonaka 	IWM_HCMD_DFL_NOCOPY     = (1 << 0),
    333   1.4   nonaka 	IWM_HCMD_DFL_DUP        = (1 << 1),
    334   1.1    pooka };
    335   1.1    pooka 
    336  1.10   nonaka #define IWM_NUM_PAPD_CH_GROUPS	9
    337   1.1    pooka #define IWM_NUM_TXP_CH_GROUPS	9
    338   1.1    pooka 
    339   1.1    pooka struct iwm_phy_db_entry {
    340   1.1    pooka 	uint16_t size;
    341   1.1    pooka 	uint8_t *data;
    342   1.1    pooka };
    343   1.1    pooka 
    344   1.1    pooka struct iwm_phy_db {
    345   1.1    pooka 	struct iwm_phy_db_entry	cfg;
    346   1.1    pooka 	struct iwm_phy_db_entry	calib_nch;
    347   1.1    pooka 	struct iwm_phy_db_entry	calib_ch_group_papd[IWM_NUM_PAPD_CH_GROUPS];
    348   1.1    pooka 	struct iwm_phy_db_entry	calib_ch_group_txp[IWM_NUM_TXP_CH_GROUPS];
    349   1.1    pooka };
    350   1.1    pooka 
    351  1.10   nonaka struct iwm_phy_ctxt {
    352   1.1    pooka 	uint16_t id;
    353   1.1    pooka 	uint16_t color;
    354   1.1    pooka 	uint32_t ref;
    355   1.1    pooka 	struct ieee80211_channel *channel;
    356   1.1    pooka };
    357   1.1    pooka 
    358   1.1    pooka struct iwm_bf_data {
    359   1.1    pooka 	int bf_enabled;		/* filtering	*/
    360   1.1    pooka 	int ba_enabled;		/* abort	*/
    361   1.1    pooka 	int ave_beacon_signal;
    362   1.1    pooka 	int last_cqm_event;
    363   1.1    pooka };
    364   1.1    pooka 
    365   1.1    pooka struct iwm_softc {
    366   1.3   nonaka 	device_t sc_dev;
    367   1.1    pooka 	struct ethercom sc_ec;
    368   1.1    pooka 	struct ieee80211com sc_ic;
    369   1.1    pooka 
    370   1.1    pooka 	int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
    371   1.1    pooka 
    372   1.1    pooka 	struct ieee80211_amrr sc_amrr;
    373   1.1    pooka 	struct callout sc_calib_to;
    374  1.10   nonaka 	struct callout sc_led_blink_to;
    375   1.1    pooka 
    376   1.1    pooka 	bus_space_tag_t sc_st;
    377   1.1    pooka 	bus_space_handle_t sc_sh;
    378   1.6   nonaka 	pci_intr_handle_t *sc_pihp;
    379   1.1    pooka 
    380   1.1    pooka 	bus_size_t sc_sz;
    381   1.1    pooka 	bus_dma_tag_t sc_dmat;
    382   1.1    pooka 	pci_chipset_tag_t sc_pct;
    383   1.1    pooka 	pcitag_t sc_pcitag;
    384   1.3   nonaka 	pcireg_t sc_pciid;
    385   1.1    pooka 	const void *sc_ih;
    386  1.11   nonaka 	void *sc_soft_ih;
    387   1.1    pooka 
    388   1.1    pooka 	/* TX scheduler rings. */
    389   1.1    pooka 	struct iwm_dma_info		sched_dma;
    390   1.1    pooka 	uint32_t			sched_base;
    391   1.1    pooka 
    392   1.4   nonaka 	/* TX/RX rings. */
    393  1.10   nonaka 	struct iwm_tx_ring txq[IWM_MAX_QUEUES];
    394   1.1    pooka 	struct iwm_rx_ring rxq;
    395   1.1    pooka 	int qfullmsk;
    396   1.1    pooka 
    397   1.1    pooka 	int sc_sf_state;
    398   1.1    pooka 
    399   1.4   nonaka 	/* ICT table. */
    400   1.1    pooka 	struct iwm_dma_info	ict_dma;
    401   1.1    pooka 	int			ict_cur;
    402   1.1    pooka 
    403   1.1    pooka 	int sc_hw_rev;
    404  1.10   nonaka #define IWM_SILICON_A_STEP	0
    405  1.10   nonaka #define IWM_SILICON_B_STEP	1
    406  1.10   nonaka #define IWM_SILICON_C_STEP	2
    407  1.10   nonaka #define IWM_SILICON_D_STEP	3
    408   1.1    pooka 	int sc_hw_id;
    409  1.10   nonaka 	int sc_device_family;
    410  1.10   nonaka #define IWM_DEVICE_FAMILY_7000	1
    411  1.10   nonaka #define IWM_DEVICE_FAMILY_8000	2
    412   1.1    pooka 
    413   1.1    pooka 	struct iwm_dma_info kw_dma;
    414   1.1    pooka 	struct iwm_dma_info fw_dma;
    415   1.1    pooka 
    416   1.1    pooka 	int sc_fw_chunk_done;
    417   1.1    pooka 	int sc_init_complete;
    418   1.1    pooka 
    419   1.1    pooka 	struct iwm_ucode_status sc_uc;
    420   1.1    pooka 	enum iwm_ucode_type sc_uc_current;
    421  1.10   nonaka 	char sc_fwver[32];
    422   1.1    pooka 
    423   1.1    pooka 	int sc_capaflags;
    424   1.1    pooka 	int sc_capa_max_probe_len;
    425  1.10   nonaka 	int sc_capa_n_scan_channels;
    426  1.18   nonaka 	uint8_t sc_ucode_api[howmany(IWM_NUM_UCODE_TLV_API, NBBY)];
    427  1.10   nonaka 	uint8_t sc_enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)];
    428  1.10   nonaka 	char sc_fw_mcc[3];
    429   1.1    pooka 
    430   1.1    pooka 	int sc_intmask;
    431   1.1    pooka 	int sc_flags;
    432   1.1    pooka 
    433   1.1    pooka 	/*
    434   1.1    pooka 	 * So why do we need a separate stopped flag and a generation?
    435   1.1    pooka 	 * the former protects the device from issueing commands when it's
    436   1.1    pooka 	 * stopped (duh).  The latter protects against race from a very
    437   1.1    pooka 	 * fast stop/unstop cycle where threads waiting for responses do
    438   1.1    pooka 	 * not have a chance to run in between.  Notably: we want to stop
    439   1.1    pooka 	 * the device from interrupt context when it craps out, so we
    440   1.1    pooka 	 * don't have the luxury of waiting for quiescense.
    441   1.1    pooka 	 */
    442   1.1    pooka 	int sc_generation;
    443   1.1    pooka 
    444   1.1    pooka 	int sc_cap_off; /* PCIe caps */
    445   1.1    pooka 
    446   1.1    pooka 	const char *sc_fwname;
    447   1.1    pooka 	bus_size_t sc_fwdmasegsz;
    448   1.1    pooka 	struct iwm_fw_info sc_fw;
    449   1.1    pooka 	int sc_fw_phy_config;
    450   1.1    pooka 	struct iwm_tlv_calib_ctrl sc_default_calib[IWM_UCODE_TYPE_MAX];
    451   1.1    pooka 
    452   1.1    pooka 	struct iwm_nvm_data sc_nvm;
    453   1.1    pooka 	struct iwm_phy_db sc_phy_db;
    454   1.1    pooka 
    455   1.1    pooka 	struct iwm_bf_data sc_bf;
    456   1.1    pooka 
    457   1.1    pooka 	int sc_tx_timer;
    458  1.10   nonaka 	int sc_rx_ba_sessions;
    459   1.1    pooka 
    460   1.1    pooka 	int sc_scan_last_antenna;
    461  1.15   nonaka 	int sc_mgmt_last_antenna;
    462   1.1    pooka 
    463   1.1    pooka 	int sc_fixed_ridx;
    464   1.1    pooka 
    465   1.1    pooka 	int sc_staid;
    466   1.1    pooka 	int sc_nodecolor;
    467   1.1    pooka 
    468   1.1    pooka 	uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX];
    469   1.1    pooka 	int sc_wantresp;
    470   1.1    pooka 
    471  1.11   nonaka 	struct workqueue *sc_nswq;
    472   1.1    pooka 
    473   1.1    pooka 	struct iwm_rx_phy_info sc_last_phy_info;
    474   1.1    pooka 	int sc_ampdu_ref;
    475   1.1    pooka 
    476   1.1    pooka 	/* phy contexts.  we only use the first one */
    477  1.10   nonaka 	struct iwm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
    478   1.1    pooka 
    479   1.1    pooka 	struct iwm_notif_statistics sc_stats;
    480   1.1    pooka 	int sc_noise;
    481   1.1    pooka 
    482  1.13   nonaka 	int sc_cmd_hold_nic_awake;
    483  1.13   nonaka 
    484  1.13   nonaka 	/* device needs host interrupt operation mode set */
    485   1.5   nonaka 	int host_interrupt_operation_mode;
    486  1.13   nonaka 	/* should the MAC access REQ be asserted when a command is in flight.
    487  1.13   nonaka 	 * This is due to a HW bug in 7260, 3160 and 7265. */
    488  1.13   nonaka 	int apmg_wake_up_wa;
    489   1.5   nonaka 
    490  1.18   nonaka 	/*
    491  1.18   nonaka 	 * Paging parameters - All of the parameters should be set by the
    492  1.18   nonaka 	 * opmode when paging is enabled
    493  1.18   nonaka 	 */
    494  1.18   nonaka 	struct iwm_fw_paging fw_paging_db[IWM_NUM_OF_FW_PAGING_BLOCKS];
    495  1.18   nonaka 	uint16_t num_of_paging_blk;
    496  1.18   nonaka 	uint16_t num_of_pages_in_last_blk;
    497  1.18   nonaka 
    498   1.8   nonaka 	struct sysctllog *sc_clog;
    499   1.8   nonaka 
    500  1.11   nonaka 	struct bpf_if *sc_drvbpf;
    501   1.1    pooka 
    502  1.20  thorpej 	kmutex_t	sc_media_mtx;	/* XXX */
    503  1.20  thorpej 
    504   1.1    pooka 	union {
    505   1.1    pooka 		struct iwm_rx_radiotap_header th;
    506   1.1    pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    507   1.1    pooka 	} sc_rxtapu;
    508   1.1    pooka #define sc_rxtap	sc_rxtapu.th
    509   1.1    pooka 	int			sc_rxtap_len;
    510   1.1    pooka 
    511   1.1    pooka 	union {
    512   1.1    pooka 		struct iwm_tx_radiotap_header th;
    513   1.1    pooka 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];
    514   1.1    pooka 	} sc_txtapu;
    515   1.1    pooka #define sc_txtap	sc_txtapu.th
    516   1.1    pooka 	int			sc_txtap_len;
    517   1.1    pooka };
    518   1.1    pooka 
    519   1.1    pooka struct iwm_node {
    520   1.1    pooka 	struct ieee80211_node in_ni;
    521  1.10   nonaka 	struct iwm_phy_ctxt *in_phyctxt;
    522   1.1    pooka 
    523   1.1    pooka 	uint16_t in_id;
    524   1.1    pooka 	uint16_t in_color;
    525   1.1    pooka 
    526   1.1    pooka 	struct iwm_lq_cmd in_lq;
    527   1.1    pooka 	struct ieee80211_amrr_node in_amn;
    528   1.1    pooka };
    529   1.1    pooka #define IWM_STATION_ID 0
    530  1.10   nonaka #define IWM_AUX_STA_ID 1
    531   1.1    pooka 
    532   1.1    pooka #define IWM_ICT_SIZE		4096
    533   1.1    pooka #define IWM_ICT_COUNT		(IWM_ICT_SIZE / sizeof (uint32_t))
    534   1.1    pooka #define IWM_ICT_PADDR_SHIFT	12
    535