]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iwlwifi: enable sending/setting debug host event
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Wed, 9 Dec 2020 21:16:17 +0000 (23:16 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Dec 2020 22:14:10 +0000 (00:14 +0200)
This is used for BT node and for any user that wants to
control what events would be send from FW to the driver.

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.20201209231352.a9dba2daca59.I2b18bccf0d409f1517c3e2841b667014f9dafc24@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c

index 94b1a126847604383244e68029ada7c0ed92b63a..48d7c8485e3fd094943951cd42662e7cacc5443f 100644 (file)
@@ -78,6 +78,12 @@ enum iwl_debug_cmds {
         * &struct iwl_dbg_mem_access_rsp
         */
        UMAC_RD_WR = 0x1,
+       /**
+        * @HOST_EVENT_CFG:
+        * updates the enabled event severities
+        * &struct iwl_dbg_host_event_cfg_cmd
+        */
+       HOST_EVENT_CFG = 0x3,
        /**
         * @DBGC_SUSPEND_RESUME:
         * DBGC suspend/resume commad. Uses a single dword as data:
@@ -395,4 +401,12 @@ struct iwl_buf_alloc_cmd {
        struct iwl_buf_alloc_frag frags[BUF_ALLOC_MAX_NUM_FRAGS];
 } __packed; /* BUFFER_ALLOCATION_CMD_API_S_VER_2 */
 
+/**
+ * struct iwl_dbg_host_event_cfg_cmd
+ * @enabled_severities: enabled severities
+ */
+struct iwl_dbg_host_event_cfg_cmd {
+       __le32 enabled_severities;
+} __packed; /* DEBUG_HOST_EVENT_CFG_CMD_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_debug_h__ */
index 267ad4eddb5c06380316ea1896163c876e9ac857..ce1186068f2db2117f9de473dc19c07107625f83 100644 (file)
@@ -200,6 +200,34 @@ static int iwl_fw_send_timestamp_marker_cmd(struct iwl_fw_runtime *fwrt)
        return iwl_trans_send_cmd(fwrt->trans, &hcmd);
 }
 
+static int iwl_dbgfs_enabled_severities_write(struct iwl_fw_runtime *fwrt,
+                                             char *buf, size_t count)
+{
+       struct iwl_dbg_host_event_cfg_cmd event_cfg;
+       struct iwl_host_cmd hcmd = {
+               .id = iwl_cmd_id(HOST_EVENT_CFG, DEBUG_GROUP, 0),
+               .flags = CMD_ASYNC,
+               .data[0] = &event_cfg,
+               .len[0] = sizeof(event_cfg),
+       };
+       u32 enabled_severities;
+       int ret = kstrtou32(buf, 10, &enabled_severities);
+
+       if (ret < 0)
+               return ret;
+
+       event_cfg.enabled_severities = cpu_to_le32(enabled_severities);
+
+       ret = iwl_trans_send_cmd(fwrt->trans, &hcmd);
+       IWL_INFO(fwrt,
+                "sent host event cfg with enabled_severities: %u, ret: %d\n",
+                enabled_severities, ret);
+
+       return ret ?: count;
+}
+
+FWRT_DEBUGFS_WRITE_FILE_OPS(enabled_severities, 16);
+
 static void iwl_fw_timestamp_marker_wk(struct work_struct *work)
 {
        int ret;
@@ -431,5 +459,6 @@ void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
        FWRT_DEBUGFS_ADD_FILE(timestamp_marker, dbgfs_dir, 0200);
        FWRT_DEBUGFS_ADD_FILE(fw_info, dbgfs_dir, 0200);
        FWRT_DEBUGFS_ADD_FILE(send_hcmd, dbgfs_dir, 0200);
+       FWRT_DEBUGFS_ADD_FILE(enabled_severities, dbgfs_dir, 0200);
        FWRT_DEBUGFS_ADD_FILE(fw_dbg_domain, dbgfs_dir, 0400);
 }