iwlwifi: yoyo: add support for parsing SHARED_MEM_ALLOC version 4
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Fri, 24 Apr 2020 15:48:08 +0000 (18:48 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 8 May 2020 06:50:34 +0000 (09:50 +0300)
The new version adds the information for RX2C FIFO addresses.

Use the new addresses to parse the FIFO info when dumping.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200424182643.97cc25d96b53.I65fd0400d80f505bd6d7eed442f12db24b25bbe3@changeid
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
drivers/net/wireless/intel/iwlwifi/fw/smem.c
drivers/net/wireless/intel/iwlwifi/iwl-prph.h

index 98e957ecbeed12bbffe49c0e41b5bb9aa7942777..94b1a126847604383244e68029ada7c0ed92b63a 100644 (file)
@@ -5,10 +5,9 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright (C) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2007 - 2014, 2018 - 2020 Intel Corporation
  *
  * 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
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright (C) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2005 - 2014, 2018 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -218,6 +216,8 @@ struct iwl_shared_mem_lmac_cfg {
  * @page_buff_size: size of %page_buff_addr
  * @lmac_num: number of LMACs (1 or 2)
  * @lmac_smem: per - LMAC smem data
+ * @rxfifo2_control_addr: start addr of RXF2C
+ * @rxfifo2_control_size: size of RXF2C
  */
 struct iwl_shared_mem_cfg {
        __le32 shared_mem_addr;
@@ -229,8 +229,10 @@ struct iwl_shared_mem_cfg {
        __le32 page_buff_addr;
        __le32 page_buff_size;
        __le32 lmac_num;
-       struct iwl_shared_mem_lmac_cfg lmac_smem[2];
-} __packed; /* SHARED_MEM_ALLOC_API_S_VER_3 */
+       struct iwl_shared_mem_lmac_cfg lmac_smem[3];
+       __le32 rxfifo2_control_addr;
+       __le32 rxfifo2_control_size;
+} __packed; /* SHARED_MEM_ALLOC_API_S_VER_4 */
 
 /**
  * struct iwl_mfuart_load_notif - mfuart image version & status
index 39c8332be3acd6566f5feb6d2ba44f4b620ffec8..914f0eb07d52e5af0d8903bcdcb974e3520311ce 100644 (file)
@@ -1386,13 +1386,36 @@ static void iwl_ini_get_rxf_data(struct iwl_fw_runtime *fwrt,
        }
 
        fifo_idx = ffs(fid2) - 1;
-       if (fid2 && !WARN_ON_ONCE(fifo_idx != 0)) {
-               data->size = fwrt->smem_cfg.rxfifo2_size;
-               data->offset = RXF_DIFF_FROM_PREV;
+       if (fid2 && !WARN_ON_ONCE(~BIT(fifo_idx) & fid2)) {
+               u8 max_idx;
+
+               if (iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
+                                           SHARED_MEM_CFG_CMD, 0) <= 3)
+                       max_idx = 0;
+               else
+                       max_idx = 1;
+
+               if (WARN_ONCE(fifo_idx > max_idx,
+                             "invalid umac fifo idx %d", fifo_idx))
+                       return;
+
                /* use bit 31 to distinguish between umac and lmac rxf while
                 * parsing the dump
                 */
                data->fifo_num = fifo_idx | IWL_RXF_UMAC_BIT;
+
+               switch (fifo_idx) {
+               case 0:
+                       data->size = fwrt->smem_cfg.rxfifo2_size;
+                       data->offset = iwl_umac_prph(fwrt->trans,
+                                                    RXF_DIFF_FROM_PREV);
+                       break;
+               case 1:
+                       data->size = fwrt->smem_cfg.rxfifo2_control_size;
+                       data->offset = iwl_umac_prph(fwrt->trans,
+                                                    RXF2C_DIFF_FROM_PREV);
+                       break;
+               }
                return;
        }
 }
index 9906d9b9bdd5c02f62423e827b4d4c90c4e02e4c..9629ef94b2142bfdb86048bbf82972c16d43121e 100644 (file)
@@ -6,7 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2019 Intel Corporation
+ * Copyright (C) 2018-2020 Intel Corporation
  *
  * 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
@@ -27,7 +27,7 @@
  * BSD LICENSE
  *
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2019 Intel Corporation
+ * Copyright (C) 2018-2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -86,6 +86,7 @@ struct iwl_fwrt_shared_mem_cfg {
                u32 rxfifo1_size;
        } lmac[MAX_NUM_LMAC];
        u32 rxfifo2_size;
+       u32 rxfifo2_control_size;
        u32 internal_txfifo_addr;
        u32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
 };
index 409b2dd854acf612e87198d5ad052ba611d8e4c5..700fdab142091356b128555f6945d17f0cfdd1e2 100644 (file)
@@ -5,10 +5,9 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
  *
  * 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
  *
  * BSD LICENSE
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -71,6 +69,8 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt,
        struct iwl_shared_mem_cfg *mem_cfg = (void *)pkt->data;
        int i, lmac;
        int lmac_num = le32_to_cpu(mem_cfg->lmac_num);
+       u8 api_ver = iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
+                                            SHARED_MEM_CFG_CMD, 0);
 
        if (WARN_ON(lmac_num > ARRAY_SIZE(mem_cfg->lmac_smem)))
                return;
@@ -80,6 +80,12 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt,
                ARRAY_SIZE(mem_cfg->lmac_smem[0].txfifo_size);
        fwrt->smem_cfg.rxfifo2_size = le32_to_cpu(mem_cfg->rxfifo2_size);
 
+       if (api_ver >= 4 &&
+           !WARN_ON_ONCE(iwl_rx_packet_payload_len(pkt) < sizeof(*mem_cfg))) {
+               fwrt->smem_cfg.rxfifo2_control_size =
+                       le32_to_cpu(mem_cfg->rxfifo2_control_size);
+       }
+
        for (lmac = 0; lmac < lmac_num; lmac++) {
                struct iwl_shared_mem_lmac_cfg *lmac_cfg =
                        &mem_cfg->lmac_smem[lmac];
index 1136d9784f9d0b9800abfb68d066c3fe1773e86c..8e254c0eda130aa5637a282c4e0a4f60786403a3 100644 (file)
@@ -5,10 +5,9 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016        Intel Deutschland GmbH
- * Copyright (C) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2005 - 2014, 2018 - 2020 Intel Corporation
  *
  * 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
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016        Intel Deutschland GmbH
- * Copyright (C) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2005 - 2014, 2018 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #define RXF_SIZE_BYTE_CND_POS          (7)
 #define RXF_SIZE_BYTE_CNT_MSK          (0x3ff << RXF_SIZE_BYTE_CND_POS)
 #define RXF_DIFF_FROM_PREV             (0x200)
+#define RXF2C_DIFF_FROM_PREV           (0x4e00)
 
 #define RXF_LD_FENCE_OFFSET_ADDR       (0xa00c10)
 #define RXF_FIFO_RD_FENCE_ADDR         (0xa00c0c)