iwlwifi: dbg_ini: implement monitor sram memory dump
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Sun, 16 Dec 2018 12:02:29 +0000 (14:02 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 14 Feb 2019 09:29:43 +0000 (11:29 +0200)
Implement monitor sram memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/iwl-csr.h

index 390401300fcf2ccedecba2f12079eeb14cf9da81..de6db880d5cef828bac0b1b8cbfab790b0af4e4d 100644 (file)
@@ -1284,6 +1284,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
                case IWL_FW_INI_REGION_PERIPHERY_MAC:
                case IWL_FW_INI_REGION_PERIPHERY_PHY:
                case IWL_FW_INI_REGION_PERIPHERY_AUX:
+               case IWL_FW_INI_REGION_INTERNAL_BUFFER:
                case IWL_FW_INI_REGION_CSR:
                        size += hdr_len + dump_header_len + range_header_len *
                                iwl_dump_ini_mem_ranges(fwrt, reg) +
@@ -1312,7 +1313,6 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
                }
                case IWL_FW_INI_REGION_DRAM_BUFFER:
                        /* Transport takes care of DRAM dumping */
-               case IWL_FW_INI_REGION_INTERNAL_BUFFER:
                case IWL_FW_INI_REGION_DRAM_IMR:
                        /* Undefined yet */
                default:
@@ -1346,6 +1346,7 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
                type = le32_to_cpu(reg->region_type);
                switch (type) {
                case IWL_FW_INI_REGION_DEVICE_MEMORY:
+               case IWL_FW_INI_REGION_INTERNAL_BUFFER:
                        ops.get_num_of_ranges = iwl_dump_ini_mem_ranges;
                        ops.get_size = iwl_dump_ini_mem_get_size;
                        ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header;
@@ -1396,7 +1397,6 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
                        iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
                        break;
                case IWL_FW_INI_REGION_DRAM_IMR:
-               case IWL_FW_INI_REGION_INTERNAL_BUFFER:
                        /* This is undefined yet */
                default:
                        break;
@@ -1853,7 +1853,8 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size)
 }
 
 static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
-                                   struct iwl_fw_ini_allocation_data *alloc)
+                                   struct iwl_fw_ini_allocation_data *alloc,
+                                   enum iwl_fw_ini_apply_point pnt)
 {
        struct iwl_trans *trans = fwrt->trans;
        struct iwl_ldbg_config_cmd ldbg_cmd = {
@@ -1867,9 +1868,19 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
                .len[0] = sizeof(ldbg_cmd),
        };
        int block_idx = trans->num_blocks;
+       u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location);
+
+       if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) {
+               if (!WARN(pnt != IWL_FW_INI_APPLY_EARLY,
+                         "Invalid apply point %d for SMEM buffer allocation",
+                         pnt))
+                       /* set sram monitor by enabling bit 7 */
+                       iwl_set_bit(fwrt->trans, CSR_HW_IF_CONFIG_REG,
+                                   CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM);
+               return;
+       }
 
-       if (le32_to_cpu(alloc->tlv.buffer_location) !=
-           IWL_FW_INI_LOCATION_DRAM_PATH)
+       if (buf_location != IWL_FW_INI_LOCATION_DRAM_PATH)
                return;
 
        if (!alloc->is_alloc) {
@@ -2017,7 +2028,7 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
                case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: {
                        struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv;
 
-                       iwl_fw_dbg_buffer_apply(fwrt, ini_tlv);
+                       iwl_fw_dbg_buffer_apply(fwrt, ini_tlv, pnt);
                        iter += sizeof(buf_alloc->is_alloc);
                        break;
                }
index 42af421bbc3c71eb5077589d9f29875082401fc8..d0ce3a79c3871f0dc2bf36babf0437fbc90deaba 100644 (file)
 /* Bits for CSR_HW_IF_CONFIG_REG */
 #define CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH      (0x00000003)
 #define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP      (0x0000000C)
+#define CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM  (0x00000080)
 #define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER     (0x000000C0)
 #define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI                (0x00000100)
 #define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI      (0x00000200)