From owner-svn-src-stable@freebsd.org Thu Mar 1 06:18:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83F40F2709D; Thu, 1 Mar 2018 06:18:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E8018717A; Thu, 1 Mar 2018 06:18:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 294AE24A82; Thu, 1 Mar 2018 06:18:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w216ISJS047307; Thu, 1 Mar 2018 06:18:28 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w216IROV047300; Thu, 1 Mar 2018 06:18:27 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803010618.w216IROV047300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 1 Mar 2018 06:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330188 - in stable/11/sys: conf dev/iwm X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys: conf dev/iwm X-SVN-Commit-Revision: 330188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 06:18:28 -0000 Author: eadler Date: Thu Mar 1 06:18:27 2018 New Revision: 330188 URL: https://svnweb.freebsd.org/changeset/base/330188 Log: MFC r314076: [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 Added: stable/11/sys/dev/iwm/if_iwm_7000.c - copied unchanged from r314076, head/sys/dev/iwm/if_iwm_7000.c stable/11/sys/dev/iwm/if_iwm_8000.c - copied unchanged from r314076, head/sys/dev/iwm/if_iwm_8000.c stable/11/sys/dev/iwm/if_iwm_config.h - copied unchanged from r314076, head/sys/dev/iwm/if_iwm_config.h Modified: stable/11/sys/conf/files stable/11/sys/dev/iwm/if_iwm.c stable/11/sys/dev/iwm/if_iwm_pcie_trans.c stable/11/sys/dev/iwm/if_iwmvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Mar 1 06:16:40 2018 (r330187) +++ stable/11/sys/conf/files Thu Mar 1 06:18:27 2018 (r330188) @@ -1869,6 +1869,8 @@ iwi_monitor.fw optional iwimonitorfw | iwifw \ no-obj no-implicit-rule \ clean "iwi_monitor.fw" dev/iwm/if_iwm.c optional iwm +dev/iwm/if_iwm_7000.c optional iwm +dev/iwm/if_iwm_8000.c optional iwm dev/iwm/if_iwm_binding.c optional iwm dev/iwm/if_iwm_led.c optional iwm dev/iwm/if_iwm_mac_ctxt.c optional iwm Modified: stable/11/sys/dev/iwm/if_iwm.c ============================================================================== --- stable/11/sys/dev/iwm/if_iwm.c Thu Mar 1 06:16:40 2018 (r330187) +++ stable/11/sys/dev/iwm/if_iwm.c Thu Mar 1 06:18:27 2018 (r330188) @@ -152,6 +152,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -166,68 +167,6 @@ __FBSDID("$FreeBSD$"); #include #include -#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, @@ -5930,29 +5869,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 @@ -5963,7 +5891,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); } } Copied: stable/11/sys/dev/iwm/if_iwm_7000.c (from r314076, head/sys/dev/iwm/if_iwm_7000.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iwm/if_iwm_7000.c Thu Mar 1 06:18:27 2018 (r330188, copy of r314076, head/sys/dev/iwm/if_iwm_7000.c) @@ -0,0 +1,128 @@ +/*- + * 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 +__FBSDID("$FreeBSD$"); + +#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, +}; + Copied: stable/11/sys/dev/iwm/if_iwm_8000.c (from r314076, head/sys/dev/iwm/if_iwm_8000.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iwm/if_iwm_8000.c Thu Mar 1 06:18:27 2018 (r330188, copy of r314076, head/sys/dev/iwm/if_iwm_8000.c) @@ -0,0 +1,92 @@ +/*- + * 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 +__FBSDID("$FreeBSD$"); + +#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, +}; Copied: stable/11/sys/dev/iwm/if_iwm_config.h (from r314076, head/sys/dev/iwm/if_iwm_config.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iwm/if_iwm_config.h Thu Mar 1 06:18:27 2018 (r330188, copy of r314076, head/sys/dev/iwm/if_iwm_config.h) @@ -0,0 +1,135 @@ +/*- + * 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. + * + *****************************************************************************/ + +/* + * $FreeBSD$ + */ + +#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__ */ Modified: stable/11/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- stable/11/sys/dev/iwm/if_iwm_pcie_trans.c Thu Mar 1 06:16:40 2018 (r330187) +++ stable/11/sys/dev/iwm/if_iwm_pcie_trans.c Thu Mar 1 06:18:27 2018 (r330188) @@ -152,6 +152,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: stable/11/sys/dev/iwm/if_iwmvar.h ============================================================================== --- stable/11/sys/dev/iwm/if_iwmvar.h Thu Mar 1 06:16:40 2018 (r330187) +++ stable/11/sys/dev/iwm/if_iwmvar.h Thu Mar 1 06:18:27 2018 (r330188) @@ -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;