Commit a94d0189 authored by Johannes Berg's avatar Johannes Berg Committed by Miri Korenblit
Browse files

wifi: iwlwifi: pass full FW info to transport



The code currently passes only the specific image that should
be loaded, but then has to pass the IML (image loader) out of
band, which is confusing. Pass the full FW data together with
desired image type, and use the IML from that.

This also cleans up the code in the various sub-drivers a bit
as they no longer have to look up and check for the image.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250503224231.eac4006e81c5.Iebadc56bb2762e5f4d71f66bb2609d74b33daf11@changeid
parent 9babfb5f
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
 *
 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2015 Intel Deutschland GmbH
 * Copyright (C) 2025 Intel Corporation
 *****************************************************************************/

#include <linux/kernel.h>
@@ -293,15 +294,10 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
{
	struct iwl_notification_wait alive_wait;
	struct iwl_alive_data alive_data;
	const struct fw_img *fw;
	int ret;
	enum iwl_ucode_type old_type;
	static const u16 alive_cmd[] = { REPLY_ALIVE };

	fw = iwl_get_ucode_image(priv->fw, ucode_type);
	if (WARN_ON(!fw))
		return -EINVAL;

	old_type = priv->cur_ucode;
	priv->cur_ucode = ucode_type;
	priv->ucode_loaded = false;
@@ -310,7 +306,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
				   alive_cmd, ARRAY_SIZE(alive_cmd),
				   iwl_alive_fn, &alive_data);

	ret = iwl_trans_start_fw(priv->trans, fw, false);
	ret = iwl_trans_start_fw(priv->trans, priv->fw, ucode_type, false);
	if (ret) {
		priv->cur_ucode = old_type;
		iwl_remove_notification(&priv->notif_wait, &alive_wait);
+2 −1
Original line number Diff line number Diff line
@@ -324,7 +324,8 @@ struct iwl_context_info_gen3 {
} __packed; /* IPC_CONTEXT_INFO_S */

int iwl_pcie_ctxt_info_gen3_alloc(struct iwl_trans *trans,
				  const struct fw_img *fw);
				  const struct iwl_fw *fw,
				  const struct fw_img *img);
void iwl_pcie_ctxt_info_gen3_kick(struct iwl_trans *trans);
void iwl_pcie_ctxt_info_gen3_free(struct iwl_trans *trans, bool alive);

+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ struct iwl_context_info {
	__le32 reserved3[16];
} __packed;

int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, const struct fw_img *fw);
int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, const struct fw_img *img);
void iwl_pcie_ctxt_info_free(struct iwl_trans *trans);
void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans);
int iwl_pcie_init_fw_sec(struct iwl_trans *trans,
+11 −4
Original line number Diff line number Diff line
@@ -590,21 +590,28 @@ void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr)
}
IWL_EXPORT_SYMBOL(iwl_trans_fw_alive);

int iwl_trans_start_fw(struct iwl_trans *trans, const struct fw_img *fw,
		       bool run_in_rfkill)
int iwl_trans_start_fw(struct iwl_trans *trans, const struct iwl_fw *fw,
		       enum iwl_ucode_type ucode_type, bool run_in_rfkill)
{
	const struct fw_img *img;
	int ret;

	might_sleep();

	WARN_ON_ONCE(!trans->rx_mpdu_cmd);

	img = iwl_get_ucode_image(fw, ucode_type);
	if (!img)
		return -EINVAL;

	clear_bit(STATUS_FW_ERROR, &trans->status);

	if (trans->trans_cfg->gen2)
		ret = iwl_trans_pcie_gen2_start_fw(trans, fw, run_in_rfkill);
		ret = iwl_trans_pcie_gen2_start_fw(trans, fw, img,
						   run_in_rfkill);
	else
		ret = iwl_trans_pcie_start_fw(trans, fw, run_in_rfkill);
		ret = iwl_trans_pcie_start_fw(trans, fw, img,
					      run_in_rfkill);

	if (ret == 0)
		trans->state = IWL_TRANS_FW_STARTED;
+2 −7
Original line number Diff line number Diff line
@@ -838,8 +838,6 @@ struct iwl_txq {
 * @wide_cmd_header: true when ucode supports wide command header format
 * @num_rx_queues: number of RX queues allocated by the transport;
 *	the transport must set this before calling iwl_drv_start()
 * @iml_len: the length of the image loader
 * @iml: a pointer to the image loader itself
 * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
 *	The user should use iwl_trans_{alloc,free}_tx_cmd.
 * @dev_cmd_pool_name: name for the TX command allocation pool
@@ -914,9 +912,6 @@ struct iwl_trans {

	u8 num_rx_queues;

	size_t iml_len;
	u8 *iml;

	/* The following fields are internal only */
	struct kmem_cache *dev_cmd_pool;
	char dev_cmd_pool_name[50];
@@ -961,8 +956,8 @@ void iwl_trans_op_mode_leave(struct iwl_trans *trans);

void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr);

int iwl_trans_start_fw(struct iwl_trans *trans, const struct fw_img *fw,
		       bool run_in_rfkill);
int iwl_trans_start_fw(struct iwl_trans *trans, const struct iwl_fw *fw,
		       enum iwl_ucode_type ucode_type, bool run_in_rfkill);

void iwl_trans_stop_device(struct iwl_trans *trans);

Loading