Commit 068893b7 authored by Shahar S Matityahu's avatar Shahar S Matityahu Committed by Luca Coelho
Browse files

iwlwifi: dbg_ini: support domain changing via debugfs



Allow to change or read the debug domain bitmap at runtime via
fw_dbg_domain debugfs.

Signed-off-by: default avatarShahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 60e8abd9
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -320,10 +320,45 @@ out:

FWRT_DEBUGFS_WRITE_FILE_OPS(send_hcmd, 512);

static ssize_t iwl_dbgfs_fw_dbg_domain_write(struct iwl_fw_runtime *fwrt,
					     char *buf, size_t count)
{
	u32 new_domain;
	int ret;

	if (!iwl_trans_fw_running(fwrt->trans))
		return -EIO;

	ret = kstrtou32(buf, 0, &new_domain);
	if (ret)
		return ret;

	if (new_domain != fwrt->trans->dbg.domains_bitmap) {
		ret = iwl_dbg_tlv_gen_active_trigs(fwrt, new_domain);
		if (ret)
			return ret;

		iwl_dbg_tlv_time_point(fwrt, IWL_FW_INI_TIME_POINT_PERIODIC,
				       NULL);
	}

	return count;
}

static ssize_t iwl_dbgfs_fw_dbg_domain_read(struct iwl_fw_runtime *fwrt,
					    size_t size, char *buf)
{
	return scnprintf(buf, size, "0x%08x\n",
			 fwrt->trans->dbg.domains_bitmap);
}

FWRT_DEBUGFS_READ_WRITE_FILE_OPS(fw_dbg_domain, 20);

void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
			    struct dentry *dbgfs_dir)
{
	INIT_DELAYED_WORK(&fwrt->timestamp.wk, iwl_fw_timestamp_marker_wk);
	FWRT_DEBUGFS_ADD_FILE(timestamp_marker, dbgfs_dir, 0200);
	FWRT_DEBUGFS_ADD_FILE(send_hcmd, dbgfs_dir, 0200);
	FWRT_DEBUGFS_ADD_FILE(fw_dbg_domain, dbgfs_dir, 0600);
}
+5 −0
Original line number Diff line number Diff line
@@ -1249,6 +1249,11 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans)
		iwl_op_mode_nic_error(trans->op_mode);
}

static inline bool iwl_trans_fw_running(struct iwl_trans *trans)
{
	return trans->state == IWL_TRANS_FW_ALIVE;
}

static inline void iwl_trans_sync_nmi(struct iwl_trans *trans)
{
	if (trans->ops->sync_nmi)