From 27d11320e707d2c41424efc1983762f6799941d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Imre=20Vad=C3=A1sz?= Date: Sun, 25 Sep 2016 21:21:20 +0200 Subject: [PATCH] if_iwm - Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c * This is more similar to how code/definitions are distributed in Linux's iwlwifi. * This should make recognizing new chipset variants, and adding additional flags from the Linux iwlwifi code easier, without blowing up if_iwm.c Taken-From: Linux iwlwifi --- sys/conf/files | 2 + sys/dev/netif/iwm/Makefile | 2 +- sys/dev/netif/iwm/if_iwm.c | 96 ++++--------------------- sys/dev/netif/iwm/if_iwm_7000.c | 125 ++++++++++++++++++++++++++++++++ sys/dev/netif/iwm/if_iwm_8000.c | 89 +++++++++++++++++++++++ sys/dev/netif/iwm/if_iwm_config.h | 130 ++++++++++++++++++++++++++++++++++ sys/dev/netif/iwm/if_iwm_pcie_trans.c | 1 + sys/dev/netif/iwm/if_iwmvar.h | 24 +------ 8 files changed, 361 insertions(+), 108 deletions(-) create mode 100644 sys/dev/netif/iwm/if_iwm_7000.c create mode 100644 sys/dev/netif/iwm/if_iwm_8000.c create mode 100644 sys/dev/netif/iwm/if_iwm_config.h diff --git a/sys/conf/files b/sys/conf/files index 94d1a51062..1c53293dac 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -510,6 +510,8 @@ dev/netif/iwm/if_iwm_power.c optional iwm dev/netif/iwm/if_iwm_scan.c optional iwm dev/netif/iwm/if_iwm_time_event.c optional iwm dev/netif/iwm/if_iwm_util.c optional iwm +dev/netif/iwm/if_iwm_7000.c optional iwm +dev/netif/iwm/if_iwm_8000.c optional iwm iwm3160fw.c optional iwmfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwm3160.fw:iwm3160fw -miwm3160fw -c${.TARGET}" \ no-implicit-rule before-depend local \ diff --git a/sys/dev/netif/iwm/Makefile b/sys/dev/netif/iwm/Makefile index b99aa42065..21017fc7c9 100644 --- a/sys/dev/netif/iwm/Makefile +++ b/sys/dev/netif/iwm/Makefile @@ -4,7 +4,7 @@ KMOD = if_iwm SRCS = if_iwm.c if_iwm_pcie_trans.c if_iwm_power.c if_iwm_util.c SRCS += if_iwm_binding.c if_iwm_phy_ctxt.c if_iwm_scan.c if_iwm_led.c SRCS += if_iwm_mac_ctxt.c if_iwm_phy_db.c if_iwm_time_event.c -SRCS += if_iwm_notif_wait.c +SRCS += if_iwm_notif_wait.c if_iwm_7000.c if_iwm_8000.c SRCS += device_if.h bus_if.h pci_if.h opt_wlan.h SUBDIR = fw diff --git a/sys/dev/netif/iwm/if_iwm.c b/sys/dev/netif/iwm/if_iwm.c index f54b48965d..63c24df57f 100644 --- a/sys/dev/netif/iwm/if_iwm.c +++ b/sys/dev/netif/iwm/if_iwm.c @@ -174,6 +174,7 @@ __FBSDID("$FreeBSD$"); #include "if_iwmreg.h" #include "if_iwmvar.h" +#include "if_iwm_config.h" #include "if_iwm_debug.h" #include "if_iwm_notif_wait.h" #include "if_iwm_util.h" @@ -187,68 +188,6 @@ __FBSDID("$FreeBSD$"); #include "if_iwm_pcie_trans.h" #include "if_iwm_led.h" -#define IWM_NVM_HW_SECTION_NUM_FAMILY_7000 0 -#define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10 - -/* lower blocks contain EEPROM image and calibration data */ -#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(uint16_t)) /* 16 KB */ -#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(uint16_t)) /* 32 KB */ - -#define IWM7260_FW "iwm7260fw" -#define IWM3160_FW "iwm3160fw" -#define IWM7265_FW "iwm7265fw" -#define IWM7265D_FW "iwm7265Dfw" -#define IWM8000_FW "iwm8000Cfw" - -#define IWM_DEVICE_7000_COMMON \ - .device_family = IWM_DEVICE_FAMILY_7000, \ - .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000, \ - .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_7000, \ - .apmg_wake_up_wa = 1 - -const struct iwm_cfg iwm7260_cfg = { - .fw_name = IWM7260_FW, - IWM_DEVICE_7000_COMMON, - .host_interrupt_operation_mode = 1, -}; - -const struct iwm_cfg iwm3160_cfg = { - .fw_name = IWM3160_FW, - IWM_DEVICE_7000_COMMON, - .host_interrupt_operation_mode = 1, -}; - -const struct iwm_cfg iwm3165_cfg = { - /* XXX IWM7265D_FW doesn't seem to work properly yet */ - .fw_name = IWM7265_FW, - IWM_DEVICE_7000_COMMON, - .host_interrupt_operation_mode = 0, -}; - -const struct iwm_cfg iwm7265_cfg = { - .fw_name = IWM7265_FW, - IWM_DEVICE_7000_COMMON, - .host_interrupt_operation_mode = 0, -}; - -const struct iwm_cfg iwm7265d_cfg = { - /* XXX IWM7265D_FW doesn't seem to work properly yet */ - .fw_name = IWM7265_FW, - IWM_DEVICE_7000_COMMON, - .host_interrupt_operation_mode = 0, -}; - -#define IWM_DEVICE_8000_COMMON \ - .device_family = IWM_DEVICE_FAMILY_8000, \ - .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000, \ - .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_8000 - -const struct iwm_cfg iwm8260_cfg = { - .fw_name = IWM8000_FW, - IWM_DEVICE_8000_COMMON, - .host_interrupt_operation_mode = 0, -}; - const uint8_t iwm_nvm_channels[] = { /* 2.4 GHz */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -5967,29 +5906,18 @@ iwm_intr(void *arg) static const struct iwm_devices { uint16_t device; - const char *name; const struct iwm_cfg *cfg; } iwm_devices[] = { - { PCI_PRODUCT_INTEL_WL_3160_1, "Intel Dual Band Wireless AC 3160", - &iwm3160_cfg }, - { PCI_PRODUCT_INTEL_WL_3160_2, "Intel Dual Band Wireless AC 3160", - &iwm3160_cfg }, - { PCI_PRODUCT_INTEL_WL_3165_1, "Intel Dual Band Wireless AC 3165", - &iwm3165_cfg }, - { PCI_PRODUCT_INTEL_WL_3165_2, "Intel Dual Band Wireless AC 3165", - &iwm3165_cfg }, - { PCI_PRODUCT_INTEL_WL_7260_1, "Intel Dual Band Wireless AC 7260", - &iwm7260_cfg }, - { PCI_PRODUCT_INTEL_WL_7260_2, "Intel Dual Band Wireless AC 7260", - &iwm7260_cfg }, - { PCI_PRODUCT_INTEL_WL_7265_1, "Intel Dual Band Wireless AC 7265", - &iwm7265_cfg }, - { PCI_PRODUCT_INTEL_WL_7265_2, "Intel Dual Band Wireless AC 7265", - &iwm7265_cfg }, - { PCI_PRODUCT_INTEL_WL_8260_1, "Intel Dual Band Wireless AC 8260", - &iwm8260_cfg }, - { PCI_PRODUCT_INTEL_WL_8260_2, "Intel Dual Band Wireless AC 8260", - &iwm8260_cfg }, + { PCI_PRODUCT_INTEL_WL_3160_1, &iwm3160_cfg }, + { PCI_PRODUCT_INTEL_WL_3160_2, &iwm3160_cfg }, + { PCI_PRODUCT_INTEL_WL_3165_1, &iwm3165_cfg }, + { PCI_PRODUCT_INTEL_WL_3165_2, &iwm3165_cfg }, + { PCI_PRODUCT_INTEL_WL_7260_1, &iwm7260_cfg }, + { PCI_PRODUCT_INTEL_WL_7260_2, &iwm7260_cfg }, + { PCI_PRODUCT_INTEL_WL_7265_1, &iwm7265_cfg }, + { PCI_PRODUCT_INTEL_WL_7265_2, &iwm7265_cfg }, + { PCI_PRODUCT_INTEL_WL_8260_1, &iwm8260_cfg }, + { PCI_PRODUCT_INTEL_WL_8260_2, &iwm8260_cfg }, }; static int @@ -6000,7 +5928,7 @@ iwm_probe(device_t dev) for (i = 0; i < nitems(iwm_devices); i++) { if (pci_get_vendor(dev) == PCI_VENDOR_INTEL && pci_get_device(dev) == iwm_devices[i].device) { - device_set_desc(dev, iwm_devices[i].name); + device_set_desc(dev, iwm_devices[i].cfg->name); return (BUS_PROBE_DEFAULT); } } diff --git a/sys/dev/netif/iwm/if_iwm_7000.c b/sys/dev/netif/iwm/if_iwm_7000.c new file mode 100644 index 0000000000..47a0bd6711 --- /dev/null +++ b/sys/dev/netif/iwm/if_iwm_7000.c @@ -0,0 +1,125 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH + * Copyright(c) 2015 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH + * Copyright(c) 2015 Intel Deutschland GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include + +#include "if_iwm_config.h" + +#define IWM7260_FW "iwm7260fw" +#define IWM3160_FW "iwm3160fw" +#define IWM7265_FW "iwm7265fw" +#define IWM7265D_FW "iwm7265Dfw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_7000 0 + +#define IWM_DEVICE_7000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_7000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_7000, \ + .apmg_wake_up_wa = 1 + +const struct iwm_cfg iwm7260_cfg = { + .name = "Intel(R) Dual Band Wireless AC 7260", + .fw_name = IWM7260_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 1, +}; + +const struct iwm_cfg iwm3160_cfg = { + .name = "Intel(R) Dual Band Wireless AC 3160", + .fw_name = IWM3160_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 1, +}; + +const struct iwm_cfg iwm3165_cfg = { + .name = "Intel(R) Dual Band Wireless AC 3165", + /* XXX IWM7265D_FW doesn't seem to work properly yet */ + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + +const struct iwm_cfg iwm7265_cfg = { + .name = "Intel(R) Dual Band Wireless AC 7265", + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + +const struct iwm_cfg iwm7265d_cfg = { + .name = "Intel(R) Dual Band Wireless AC 7265", + /* XXX IWM7265D_FW doesn't seem to work properly yet */ + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + diff --git a/sys/dev/netif/iwm/if_iwm_8000.c b/sys/dev/netif/iwm/if_iwm_8000.c new file mode 100644 index 0000000000..0340f08e6c --- /dev/null +++ b/sys/dev/netif/iwm/if_iwm_8000.c @@ -0,0 +1,89 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include + +#include "if_iwm_config.h" + +#define IWM8000_FW "iwm8000Cfw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10 + +#define IWM_DEVICE_8000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_8000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_8000 + +const struct iwm_cfg iwm8260_cfg = { + .name = "Intel(R) Dual Band Wireless AC 8260", + .fw_name = IWM8000_FW, + IWM_DEVICE_8000_COMMON, + .host_interrupt_operation_mode = 0, +}; diff --git a/sys/dev/netif/iwm/if_iwm_config.h b/sys/dev/netif/iwm/if_iwm_config.h new file mode 100644 index 0000000000..94f58e2fe6 --- /dev/null +++ b/sys/dev/netif/iwm/if_iwm_config.h @@ -0,0 +1,130 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. + * Copyright (C) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. + * Copyright (C) 2016 Intel Deutschland GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ +#ifndef __IWM_CONFIG_H__ +#define __IWM_CONFIG_H__ + +enum iwm_device_family { + IWM_DEVICE_FAMILY_UNDEFINED, + IWM_DEVICE_FAMILY_7000, + IWM_DEVICE_FAMILY_8000, +}; + +/* Antenna presence definitions */ +#define IWM_ANT_NONE 0x0 +#define IWM_ANT_A (1 << 0) +#define IWM_ANT_B (1 << 1) +#define IWM_ANT_C (1 << 2) +#define IWM_ANT_AB (IWM_ANT_A | IWM_ANT_B) +#define IWM_ANT_AC (IWM_ANT_A | IWM_ANT_C) +#define IWM_ANT_BC (IWM_ANT_B | IWM_ANT_C) +#define IWM_ANT_ABC (IWM_ANT_A | IWM_ANT_B | IWM_ANT_C) + +static inline uint8_t num_of_ant(uint8_t mask) +{ + return !!((mask) & IWM_ANT_A) + + !!((mask) & IWM_ANT_B) + + !!((mask) & IWM_ANT_C); +} + +/* lower blocks contain EEPROM image and calibration data */ +#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(uint16_t)) /* 16 KB */ +#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(uint16_t)) /* 32 KB */ +#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000 IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 + +/** + * struct iwm_cfg + * @name: Official name of the device + * @fw_name: Firmware filename. + * @host_interrupt_operation_mode: device needs host interrupt operation + * mode set + * @nvm_hw_section_num: the ID of the HW NVM section + * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command + * is in flight. This is due to a HW bug in 7260, 3160 and 7265. + */ +struct iwm_cfg { + const char *name; + const char *fw_name; + uint16_t eeprom_size; + enum iwm_device_family device_family; + int host_interrupt_operation_mode; + uint8_t nvm_hw_section_num; + int apmg_wake_up_wa; +}; + +/* + * This list declares the config structures for all devices. + */ +extern const struct iwm_cfg iwm7260_cfg; +extern const struct iwm_cfg iwm3160_cfg; +extern const struct iwm_cfg iwm3165_cfg; +extern const struct iwm_cfg iwm7265_cfg; +extern const struct iwm_cfg iwm7265d_cfg; +extern const struct iwm_cfg iwm8260_cfg; + +#endif /* __IWM_CONFIG_H__ */ diff --git a/sys/dev/netif/iwm/if_iwm_pcie_trans.c b/sys/dev/netif/iwm/if_iwm_pcie_trans.c index 2a8059e29f..7fc8d2f8e3 100644 --- a/sys/dev/netif/iwm/if_iwm_pcie_trans.c +++ b/sys/dev/netif/iwm/if_iwm_pcie_trans.c @@ -142,6 +142,7 @@ __FBSDID("$FreeBSD$"); #include "if_iwmreg.h" #include "if_iwmvar.h" +#include "if_iwm_config.h" #include "if_iwm_debug.h" #include "if_iwm_pcie_trans.h" diff --git a/sys/dev/netif/iwm/if_iwmvar.h b/sys/dev/netif/iwm/if_iwmvar.h index 00af72fe66..d6f3091a2f 100644 --- a/sys/dev/netif/iwm/if_iwmvar.h +++ b/sys/dev/netif/iwm/if_iwmvar.h @@ -368,29 +368,7 @@ struct iwm_node { #define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t)) #define IWM_ICT_PADDR_SHIFT 12 -enum iwm_device_family { - IWM_DEVICE_FAMILY_UNDEFINED, - IWM_DEVICE_FAMILY_7000, - IWM_DEVICE_FAMILY_8000, -}; - -/** - * struct iwm_cfg - * @fw_name: Firmware filename. - * @host_interrupt_operation_mode: device needs host interrupt operation - * mode set - * @nvm_hw_section_num: the ID of the HW NVM section - * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command - * is in flight. This is due to a HW bug in 7260, 3160 and 7265. - */ -struct iwm_cfg { - const char *fw_name; - uint16_t eeprom_size; - enum iwm_device_family device_family; - int host_interrupt_operation_mode; - uint8_t nvm_hw_section_num; - int apmg_wake_up_wa; -}; +struct iwm_cfg; struct iwm_softc { device_t sc_dev; -- 2.11.4.GIT