]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
iwlwifi: fw: add support for splitting region type bits
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Sat, 4 Dec 2021 11:10:52 +0000 (13:10 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 7 Dec 2021 18:06:43 +0000 (20:06 +0200)
In next region tlv (3) region type is going to be split into bit mask
without affecting the ops for handling region type, so we just mask
the type independent of the version due to all versions having the
same bits usage.

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.20211204130722.083e4b47055e.If7483d854e3d07f81236d314b8155cd5996f306c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c

index b37392719398e1367a165a82a6f2f614369556ad..1c302cdbde5a9301690cdfd9786058a3f2a90b12 100644 (file)
@@ -124,6 +124,9 @@ struct iwl_fw_ini_region_internal_buffer {
  * @hdr: debug header
  * @id: region id. Max id is &IWL_FW_INI_MAX_REGION_ID
  * @type: region type. One of &enum iwl_fw_ini_region_type
+ * @sub_type: region sub type
+ * @sub_type_ver: region sub type
+ * @reserved: not in use
  * @name: region name
  * @dev_addr: device address configuration. Used by
  *     &IWL_FW_INI_REGION_DEVICE_MEMORY, &IWL_FW_INI_REGION_PERIPHERY_MAC,
@@ -146,7 +149,10 @@ struct iwl_fw_ini_region_internal_buffer {
 struct iwl_fw_ini_region_tlv {
        struct iwl_fw_ini_header hdr;
        __le32 id;
-       __le32 type;
+       u8 type;
+       u8 sub_type;
+       u8 sub_type_ver;
+       u8 reserved;
        u8 name[IWL_FW_INI_MAX_NAME];
        union {
                struct iwl_fw_ini_region_dev_addr dev_addr;
index c8a08bdfefa4d310759cf5869c63613f2e254666..fa3a7a3c3a6147e7bfa47db3f7823f26e1928f2d 100644 (file)
@@ -1988,17 +1988,18 @@ static u32 iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, struct list_head *list,
 {
        struct iwl_fw_ini_region_tlv *reg = (void *)reg_data->reg_tlv->data;
        struct iwl_fw_ini_dump_entry *entry;
-       struct iwl_fw_error_dump_data *tlv;
+       struct iwl_fw_ini_error_dump_data *tlv;
        struct iwl_fw_ini_error_dump_header *header;
-       u32 type = le32_to_cpu(reg->type), id = le32_to_cpu(reg->id);
+       u32 type = reg->type;
+       u32 id = le32_to_cpu(reg->id);
        u32 num_of_ranges, i, size;
        void *range;
 
        /*
-        * The higher part of the ID in version 2 is irrelevant for
+        * The higher part of the ID from 2 is irrelevant for
         * us, so mask it out.
         */
-       if (le32_to_cpu(reg->hdr.version) == 2)
+       if (le32_to_cpu(reg->hdr.version) >= 2)
                id &= IWL_FW_INI_REGION_V2_MASK;
 
        if (!ops->get_num_of_ranges || !ops->get_size || !ops->fill_mem_hdr ||
@@ -2017,6 +2018,9 @@ static u32 iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, struct list_head *list,
 
        tlv = (void *)entry->data;
        tlv->type = reg->type;
+       tlv->sub_type = reg->sub_type;
+       tlv->sub_type_ver = reg->sub_type_ver;
+       tlv->reserved = reg->reserved;
        tlv->len = cpu_to_le32(size);
 
        IWL_DEBUG_FW(fwrt, "WRT: Collecting region: id=%d, type=%d\n", id,
@@ -2291,7 +2295,7 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt,
                }
 
                reg = (void *)reg_data.reg_tlv->data;
-               reg_type = le32_to_cpu(reg->type);
+               reg_type = reg->type;
                if (reg_type >= ARRAY_SIZE(iwl_dump_ini_region_ops))
                        continue;
 
index 9036b32ec765d4650f0a564c4095dd7f4f992e05..079fa0023bd8e61a8f3786ab492bde3b950c5498 100644 (file)
@@ -231,6 +231,24 @@ struct iwl_fw_error_dump_mem {
 /* Use bit 31 as dump info type to avoid colliding with region types */
 #define IWL_INI_DUMP_INFO_TYPE BIT(31)
 
+/**
+ * struct iwl_fw_error_dump_data - data for one type
+ * @type: &enum iwl_fw_ini_region_type
+ * @sub_type: sub type id
+ * @sub_type_ver: sub type version
+ * @reserved: not in use
+ * @len: the length starting from %data
+ * @data: the data itself
+ */
+struct iwl_fw_ini_error_dump_data {
+       u8 type;
+       u8 sub_type;
+       u8 sub_type_ver;
+       u8 reserved;
+       __le32 len;
+       __u8 data[];
+} __packed;
+
 /**
  * struct iwl_fw_ini_dump_entry
  * @list: list of dump entries
index 7ab98b419cc1f8ececffbb5c8ffef708571d0ef8..49526fdcf9d2d304225e5159ec0b0249c6f6f0a0 100644 (file)
@@ -59,7 +59,7 @@ dbg_ver_table[IWL_DBG_TLV_TYPE_NUM] = {
        [IWL_DBG_TLV_TYPE_DEBUG_INFO]   = {.min_ver = 1, .max_ver = 1,},
        [IWL_DBG_TLV_TYPE_BUF_ALLOC]    = {.min_ver = 1, .max_ver = 1,},
        [IWL_DBG_TLV_TYPE_HCMD]         = {.min_ver = 1, .max_ver = 1,},
-       [IWL_DBG_TLV_TYPE_REGION]       = {.min_ver = 1, .max_ver = 2,},
+       [IWL_DBG_TLV_TYPE_REGION]       = {.min_ver = 1, .max_ver = 3,},
        [IWL_DBG_TLV_TYPE_TRIGGER]      = {.min_ver = 1, .max_ver = 1,},
        [IWL_DBG_TLV_TYPE_CONF_SET]     = {.min_ver = 1, .max_ver = 1,},
 };
@@ -177,14 +177,14 @@ static int iwl_dbg_tlv_alloc_region(struct iwl_trans *trans,
        const struct iwl_fw_ini_region_tlv *reg = (const void *)tlv->data;
        struct iwl_ucode_tlv **active_reg;
        u32 id = le32_to_cpu(reg->id);
-       u32 type = le32_to_cpu(reg->type);
+       u8 type = reg->type;
        u32 tlv_len = sizeof(*tlv) + le32_to_cpu(tlv->length);
 
        /*
-        * The higher part of the ID in version 2 is irrelevant for
+        * The higher part of the ID in from version 2 is irrelevant for
         * us, so mask it out.
         */
-       if (le32_to_cpu(reg->hdr.version) == 2)
+       if (le32_to_cpu(reg->hdr.version) >= 2)
                id &= IWL_FW_INI_REGION_V2_MASK;
 
        if (le32_to_cpu(tlv->length) < sizeof(*reg))
@@ -1244,7 +1244,7 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)
                }
 
                reg = (void *)(*active_reg)->data;
-               reg_type = le32_to_cpu(reg->type);
+               reg_type = reg->type;
 
                if (reg_type != IWL_FW_INI_REGION_DRAM_BUFFER ||
                    !(BIT(le32_to_cpu(reg->dram_alloc_id)) & failed_alloc))