Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2d20201 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach
Browse files

iwlwifi: pcie: add firmware monitor capabilities



This allows to use the firmware monitor. This capability
uses a lot of contiguous memory (up to 64MB), so make its
usage module parameter dependent.

The driver will try to allocate as much contiguous memory
as possible downgrading its requirements until the
allocation succeeds.

Dump this data into the fw-error dump file when an error
happens.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 1fa16056
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1405,3 +1405,7 @@ module_param_named(power_level, iwlwifi_mod_params.power_level,
		int, S_IRUGO);
		int, S_IRUGO);
MODULE_PARM_DESC(power_level,
MODULE_PARM_DESC(power_level,
		 "default power save level (range from 1 - 5, default: 1)");
		 "default power save level (range from 1 - 5, default: 1)");

module_param_named(fw_monitor, iwlwifi_mod_params.fw_monitor, bool, S_IRUGO);
MODULE_PARM_DESC(dbgm,
		 "firmware monitor - to debug FW (default: false - needs lots of memory)");
+18 −0
Original line number Original line Diff line number Diff line
@@ -76,6 +76,7 @@
 *	&struct iwl_fw_error_dump_txcmd packets
 *	&struct iwl_fw_error_dump_txcmd packets
 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO:  struct %iwl_fw_error_dump_info
 * @IWL_FW_ERROR_DUMP_DEV_FW_INFO:  struct %iwl_fw_error_dump_info
 *	info on the device / firmware.
 *	info on the device / firmware.
 * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor
 */
 */
enum iwl_fw_error_dump_type {
enum iwl_fw_error_dump_type {
	IWL_FW_ERROR_DUMP_SRAM = 0,
	IWL_FW_ERROR_DUMP_SRAM = 0,
@@ -83,6 +84,7 @@ enum iwl_fw_error_dump_type {
	IWL_FW_ERROR_DUMP_RXF = 2,
	IWL_FW_ERROR_DUMP_RXF = 2,
	IWL_FW_ERROR_DUMP_TXCMD = 3,
	IWL_FW_ERROR_DUMP_TXCMD = 3,
	IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
	IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4,
	IWL_FW_ERROR_DUMP_FW_MONITOR = 5,


	IWL_FW_ERROR_DUMP_MAX,
	IWL_FW_ERROR_DUMP_MAX,
};
};
@@ -144,6 +146,22 @@ struct iwl_fw_error_dump_info {
	u8 bus_human_readable[8];
	u8 bus_human_readable[8];
} __packed;
} __packed;


/**
 * struct iwl_fw_error_fw_mon - FW monitor data
 * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer
 * @fw_mon_base_ptr: base pointer of the data
 * @fw_mon_cycle_cnt: number of wrap arounds
 * @reserved: for future use
 * @data: captured data
 */
struct iwl_fw_error_fw_mon {
	__le32 fw_mon_wr_ptr;
	__le32 fw_mon_base_ptr;
	__le32 fw_mon_cycle_cnt;
	__le32 reserved[3];
	u8 data[];
} __packed;

/**
/**
 * iwl_fw_error_next_data - advance fw error dump data pointer
 * iwl_fw_error_next_data - advance fw error dump data pointer
 * @data: previous data block
 * @data: previous data block
+2 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,7 @@ enum iwl_disable_11n {
 * @power_level: power level, default = 1
 * @power_level: power level, default = 1
 * @debug_level: levels are IWL_DL_*
 * @debug_level: levels are IWL_DL_*
 * @ant_coupling: antenna coupling in dB, default = 0
 * @ant_coupling: antenna coupling in dB, default = 0
 * @fw_monitor: allow to use firmware monitor
 */
 */
struct iwl_mod_params {
struct iwl_mod_params {
	int sw_crypto;
	int sw_crypto;
@@ -120,6 +121,7 @@ struct iwl_mod_params {
	int ant_coupling;
	int ant_coupling;
	char *nvm_file;
	char *nvm_file;
	bool uapsd_disable;
	bool uapsd_disable;
	bool fw_monitor;
};
};


#endif /* #__iwl_modparams_h__ */
#endif /* #__iwl_modparams_h__ */
+6 −0
Original line number Original line Diff line number Diff line
@@ -359,4 +359,10 @@ enum secure_load_status_reg {
#define RXF_LD_FENCE_OFFSET_ADDR	(0xa00c10)
#define RXF_LD_FENCE_OFFSET_ADDR	(0xa00c10)
#define RXF_FIFO_RD_FENCE_ADDR		(0xa00c0c)
#define RXF_FIFO_RD_FENCE_ADDR		(0xa00c0c)


/* FW monitor */
#define MON_BUFF_BASE_ADDR		(0xa03c3c)
#define MON_BUFF_END_ADDR		(0xa03c40)
#define MON_BUFF_WRPTR			(0xa03c44)
#define MON_BUFF_CYCLE_CNT		(0xa03c48)

#endif				/* __iwl_prph_h__ */
#endif				/* __iwl_prph_h__ */
+7 −0
Original line number Original line Diff line number Diff line
@@ -260,6 +260,9 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
 * @wd_timeout: queue watchdog timeout (jiffies)
 * @wd_timeout: queue watchdog timeout (jiffies)
 * @reg_lock: protect hw register access
 * @reg_lock: protect hw register access
 * @cmd_in_flight: true when we have a host command in flight
 * @cmd_in_flight: true when we have a host command in flight
 * @fw_mon_phys: physical address of the buffer for the firmware monitor
 * @fw_mon_page: points to the first page of the buffer for the firmware monitor
 * @fw_mon_size: size of the buffer for the firmware monitor
 */
 */
struct iwl_trans_pcie {
struct iwl_trans_pcie {
	struct iwl_rxq rxq;
	struct iwl_rxq rxq;
@@ -312,6 +315,10 @@ struct iwl_trans_pcie {
	/*protect hw register */
	/*protect hw register */
	spinlock_t reg_lock;
	spinlock_t reg_lock;
	bool cmd_in_flight;
	bool cmd_in_flight;

	dma_addr_t fw_mon_phys;
	struct page *fw_mon_page;
	u32 fw_mon_size;
};
};


#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
Loading