Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src iwm(4): 3165 works fine with iwlwifi-7265D-17.ucode firmware.



details:   https://anonhg.NetBSD.org/src/rev/ca1b9776dcc8
branches:  trunk
changeset: 350530:ca1b9776dcc8
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Jan 13 11:21:47 2017 +0000

description:
iwm(4): 3165 works fine with iwlwifi-7265D-17.ucode firmware.

firmware from http://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/tree/?id=be8a6fcba2e48e00674d1f35e6def56e2268039c

diffstat:

 distrib/sets/lists/base/mi                                   |    5 +-
 external/intel-fw-public/iwl7265/Makefile                    |    4 +-
 external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-16.ucode |  Bin 
 external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-17.ucode |  Bin 
 sys/dev/pci/if_iwm.c                                         |  482 ++++++----
 sys/dev/pci/if_iwmreg.h                                      |   62 +-
 sys/dev/pci/if_iwmvar.h                                      |    3 +-
 7 files changed, 346 insertions(+), 210 deletions(-)

diffs (truncated from 1237 to 300 lines):

diff -r 75cbcc79bb4d -r ca1b9776dcc8 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Fri Jan 13 10:44:27 2017 +0000
+++ b/distrib/sets/lists/base/mi        Fri Jan 13 11:21:47 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1149 2017/01/11 12:02:24 joerg Exp $
+# $NetBSD: mi,v 1.1150 2017/01/13 11:21:47 nonaka Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -163,7 +163,8 @@
 ./libdata/firmware/if_iwm/iwlwifi-7260-9.ucode base-obsolete   obsolete
 ./libdata/firmware/if_iwm/iwlwifi-7265-16.ucode        base-firmware-root
 ./libdata/firmware/if_iwm/iwlwifi-7265-9.ucode base-obsolete   obsolete
-./libdata/firmware/if_iwm/iwlwifi-7265D-16.ucode       base-firmware-root
+./libdata/firmware/if_iwm/iwlwifi-7265D-16.ucode       base-obsolete   obsolete
+./libdata/firmware/if_iwm/iwlwifi-7265D-17.ucode       base-firmware-root
 ./libdata/firmware/if_iwm/iwlwifi-8000C-16.ucode       base-firmware-root
 ./libdata/firmware/if_iwn                      base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-100-ucode    base-firmware-root
diff -r 75cbcc79bb4d -r ca1b9776dcc8 external/intel-fw-public/iwl7265/Makefile
--- a/external/intel-fw-public/iwl7265/Makefile Fri Jan 13 10:44:27 2017 +0000
+++ b/external/intel-fw-public/iwl7265/Makefile Fri Jan 13 11:21:47 2017 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.3 2016/12/18 17:57:38 christos Exp $
+# $NetBSD: Makefile,v 1.4 2017/01/13 11:21:47 nonaka Exp $
 
 NOMAN= # define
 
 FILES= dist/LICENSE.iwlwifi-7265-ucode dist/README.iwlwifi-7265-ucode \
-       dist/iwlwifi-7265-16.ucode dist/iwlwifi-7265D-16.ucode
+       dist/iwlwifi-7265-16.ucode dist/iwlwifi-7265D-17.ucode
 
 FILESDIR=      /libdata/firmware/if_iwm
 
diff -r 75cbcc79bb4d -r ca1b9776dcc8 external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-16.ucode
Binary file external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-16.ucode has changed
diff -r 75cbcc79bb4d -r ca1b9776dcc8 external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-17.ucode
Binary file external/intel-fw-public/iwl7265/dist/iwlwifi-7265D-17.ucode has changed
diff -r 75cbcc79bb4d -r ca1b9776dcc8 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Fri Jan 13 10:44:27 2017 +0000
+++ b/sys/dev/pci/if_iwm.c      Fri Jan 13 11:21:47 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwm.c,v 1.60 2017/01/10 08:40:27 nonaka Exp $       */
+/*     $NetBSD: if_iwm.c,v 1.61 2017/01/13 11:21:47 nonaka Exp $       */
 /*     OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp  */
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.60 2017/01/10 08:40:27 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.61 2017/01/13 11:21:47 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -239,7 +239,7 @@
 static int     iwm_firmware_store_section(struct iwm_softc *,
                    enum iwm_ucode_type, uint8_t *, size_t);
 static int     iwm_set_default_calib(struct iwm_softc *, const void *);
-static int     iwm_read_firmware(struct iwm_softc *);
+static int     iwm_read_firmware(struct iwm_softc *, enum iwm_ucode_type);
 static uint32_t iwm_read_prph(struct iwm_softc *, uint32_t);
 static void    iwm_write_prph(struct iwm_softc *, uint32_t, uint32_t);
 #ifdef IWM_DEBUG
@@ -474,8 +474,8 @@
 static void    iwm_nic_umac_error(struct iwm_softc *);
 #endif
 static void    iwm_notif_intr(struct iwm_softc *);
+static int     iwm_intr(void *);
 static void    iwm_softintr(void *);
-static int     iwm_intr(void *);
 static int     iwm_preinit(struct iwm_softc *);
 static void    iwm_attach_hook(device_t);
 static void    iwm_attach(device_t, device_t, void *);
@@ -490,6 +490,11 @@
 static int iwm_sysctl_root_num;
 static int iwm_lar_disable;
 
+#ifndef        IWM_DEFAULT_MCC
+#define        IWM_DEFAULT_MCC "ZZ"
+#endif
+static char iwm_default_mcc[3] = IWM_DEFAULT_MCC;
+
 static int
 iwm_firmload(struct iwm_softc *sc)
 {
@@ -648,7 +653,7 @@
 }
 
 static int
-iwm_read_firmware(struct iwm_softc *sc)
+iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type)
 {
        struct iwm_fw_info *fw = &sc->sc_fw;
        struct iwm_tlv_ucode_header *uhdr;
@@ -658,6 +663,10 @@
        int err, status;
        size_t len;
 
+       if (ucode_type != IWM_UCODE_TYPE_INIT &&
+           fw->fw_status == IWM_FW_STATUS_DONE)
+               return 0;
+
        if (fw->fw_status == IWM_FW_STATUS_NONE) {
                fw->fw_status = IWM_FW_STATUS_INPROGRESS;
        } else {
@@ -819,6 +828,7 @@
                        api = (struct iwm_ucode_api *)tlv_data;
                        /* Flags may exceed 32 bits in future firmware. */
                        if (le32toh(api->api_index) > 0) {
+                               err = EINVAL;
                                goto parse_out;
                        }
                        sc->sc_ucode_api = le32toh(api->api_flags);
@@ -835,6 +845,7 @@
                        capa = (struct iwm_ucode_capa *)tlv_data;
                        idx = le32toh(capa->api_index);
                        if (idx >= howmany(IWM_NUM_UCODE_TLV_CAPA, 32)) {
+                               err = EINVAL;
                                goto parse_out;
                        }
                        for (i = 0; i < 32; i++) {
@@ -1019,7 +1030,7 @@
             | IWM_CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP, 15000)) {
                rv = 1;
        } else {
-               aprint_error_dev(sc->sc_dev, "device timeout\n");
+               aprint_error_dev(sc->sc_dev, "resetting device via NMI\n");
                IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_FORCE_NMI);
        }
 
@@ -1228,7 +1239,7 @@
 {
        bus_addr_t paddr;
        bus_size_t size;
-       int i, err;
+       int i, err, nsegs;
 
        ring->qid = qid;
        ring->queued = 0;
@@ -1271,13 +1282,15 @@
                paddr += sizeof(struct iwm_device_cmd);
 
                /* FW commands may require more mapped space than packets. */
-               if (qid == IWM_CMD_QUEUE)
-                       mapsize = (sizeof(struct iwm_cmd_header) +
-                           IWM_MAX_CMD_PAYLOAD_SIZE);
-               else
+               if (qid == IWM_CMD_QUEUE) {
+                       mapsize = IWM_RBUF_SIZE;
+                       nsegs = 1;
+               } else {
                        mapsize = MCLBYTES;
-               err = bus_dmamap_create(sc->sc_dmat, mapsize,
-                   IWM_NUM_OF_TBS - 2, mapsize, 0, BUS_DMA_NOWAIT, &data->map);
+                       nsegs = IWM_NUM_OF_TBS - 2;
+               }
+               err = bus_dmamap_create(sc->sc_dmat, mapsize, nsegs, mapsize,
+                   0, BUS_DMA_NOWAIT, &data->map);
                if (err) {
                        aprint_error_dev(sc->sc_dev,
                            "could not create TX buf DMA map\n");
@@ -1555,9 +1568,10 @@
        int err = 0;
 
        /* Disable L0S exit timer (platform NMI workaround) */
-       if (sc->sc_device_family != IWM_DEVICE_FAMILY_8000)
+       if (sc->sc_device_family != IWM_DEVICE_FAMILY_8000) {
                IWM_SETBITS(sc, IWM_CSR_GIO_CHICKEN_BITS,
                    IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
+       }
 
        /*
         * Disable L0s without affecting L1;
@@ -1725,11 +1739,15 @@
        for (qid = 0; qid < __arraycount(sc->txq); qid++)
                iwm_reset_tx_ring(sc, &sc->txq[qid]);
 
-       /*
-        * Power-down device's busmaster DMA clocks
-        */
-       iwm_write_prph(sc, IWM_APMG_CLK_DIS_REG, IWM_APMG_CLK_VAL_DMA_CLK_RQT);
-       DELAY(5);
+       if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000) {
+               /* Power-down device's busmaster DMA clocks */
+               if (iwm_nic_lock(sc)) {
+                       iwm_write_prph(sc, IWM_APMG_CLK_DIS_REG,
+                           IWM_APMG_CLK_VAL_DMA_CLK_RQT);
+                       DELAY(5);
+                       iwm_nic_unlock(sc);
+               }
+       }
 
        /* Make sure (redundant) we've released our request to stay awake */
        IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
@@ -1785,10 +1803,11 @@
         * (PCIe power is lost before PERST# is asserted), causing ME FW
         * to lose ownership and not being able to obtain it back.
         */
-       if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000)
+       if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000) {
                iwm_set_bits_mask_prph(sc, IWM_APMG_PS_CTRL_REG,
                    IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
                    ~IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
+       }
 }
 
 static int
@@ -1822,8 +1841,8 @@
            IWM_FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY               |  /* HW bug */
            IWM_FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL   |
            IWM_FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK        |
+           IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K            |
            (IWM_RX_RB_TIMEOUT << IWM_FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS) |
-           IWM_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K            |
            IWM_RX_QUEUE_SIZE_LOG << IWM_FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS);
 
        IWM_WRITE_1(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_TIMEOUT_DEF);
@@ -1880,10 +1899,11 @@
        int err;
 
        iwm_apm_init(sc);
-       if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000)
+       if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000) {
                iwm_set_bits_mask_prph(sc, IWM_APMG_PS_CTRL_REG,
                    IWM_APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
                    ~IWM_APMG_PS_CTRL_MSK_PWR_SRC);
+       }
 
        iwm_nic_config(sc);
 
@@ -1923,9 +1943,14 @@
                    (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE)
                    | (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
 
+               iwm_nic_unlock(sc);
+
                iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, (1 << qid));
 
+               if (!iwm_nic_lock(sc))
+                       return EBUSY;
                iwm_write_prph(sc, IWM_SCD_QUEUE_RDPTR(qid), 0);
+               iwm_nic_unlock(sc);
 
                iwm_write_mem32(sc,
                    sc->sched_base + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0);
@@ -1940,6 +1965,8 @@
                        << IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
                    IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
 
+               if (!iwm_nic_lock(sc))
+                       return EBUSY;
                iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid),
                    (1 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
                    (fifo << IWM_SCD_QUEUE_STTS_REG_POS_TXF) |
@@ -1981,7 +2008,8 @@
 static int
 iwm_post_alive(struct iwm_softc *sc)
 {
-       int nwords;
+       int nwords = (IWM_SCD_TRANS_TBL_MEM_UPPER_BOUND -
+           IWM_SCD_CONTEXT_MEM_LOWER_BOUND) / sizeof(uint32_t);
        int err, chnl;
        uint32_t base;
 
@@ -1992,21 +2020,21 @@
        if (sc->sched_base != base) {
                DPRINTF(("%s: sched addr mismatch: 0x%08x != 0x%08x\n",
                    DEVNAME(sc), sc->sched_base, base));
-               err = EINVAL;
-               goto out;
-       }
+               sc->sched_base = base;
+       }
+
+       iwm_nic_unlock(sc);
 
        iwm_ict_reset(sc);
 
        /* Clear TX scheduler state in SRAM. */
-       nwords = (IWM_SCD_TRANS_TBL_MEM_UPPER_BOUND -
-           IWM_SCD_CONTEXT_MEM_LOWER_BOUND)
-           / sizeof(uint32_t);
        err = iwm_write_mem(sc,
-           sc->sched_base + IWM_SCD_CONTEXT_MEM_LOWER_BOUND,
-           NULL, nwords);
+           sc->sched_base + IWM_SCD_CONTEXT_MEM_LOWER_BOUND, NULL, nwords);
        if (err)
-               goto out;
+               return err;
+
+       if (!iwm_nic_lock(sc))
+               return EBUSY;
 
        /* Set physical address of TX scheduler rings (1KB aligned). */
        iwm_write_prph(sc, IWM_SCD_DRAM_BASE_ADDR, sc->sched_dma.paddr >> 10);
@@ -2037,13 +2065,14 @@
            IWM_FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
 



Home | Main Index | Thread Index | Old Index