drivers/net/wireless/intel/iwlwifi/mld/fw.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mld/fw.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mld/fw.c
Extension
.c
Size
12978 bytes
Lines
549
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct iwl_mld_alive_data {
	__le32 sku_id[3];
	bool valid;
};

static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
			 struct iwl_rx_packet *pkt, void *data)
{
	unsigned int pkt_len = iwl_rx_packet_payload_len(pkt);
	unsigned int expected_sz;
	struct iwl_mld *mld =
		container_of(notif_wait, struct iwl_mld, notif_wait);
	struct iwl_trans *trans = mld->trans;
	u32 version = iwl_fw_lookup_notif_ver(mld->fw, LEGACY_GROUP,
					      UCODE_ALIVE_NTFY, 0);
	struct iwl_mld_alive_data *alive_data = data;
	struct iwl_alive_ntf *palive;
	struct iwl_umac_alive *umac;
	struct iwl_lmac_alive *lmac1;
	struct iwl_lmac_alive *lmac2 = NULL;
	u32 lmac_error_event_table;
	u32 umac_error_table;
	u16 status;

	switch (version) {
	case 7:
		expected_sz = sizeof(struct iwl_alive_ntf_v7);
		break;
	case 8:
		expected_sz = sizeof(struct iwl_alive_ntf);
		break;
	default:
		return false;
	}

	if (pkt_len != expected_sz)
		return false;

	palive = (void *)pkt->data;

	iwl_mld_alive_imr_data(trans, &palive->imr);

	umac = &palive->umac_data;
	lmac1 = &palive->lmac_data[0];
	lmac2 = &palive->lmac_data[1];
	status = le16_to_cpu(palive->status);

	BUILD_BUG_ON(sizeof(alive_data->sku_id) !=
		     sizeof(palive->sku_id.data));
	memcpy(alive_data->sku_id, palive->sku_id.data,
	       sizeof(palive->sku_id.data));

	IWL_DEBUG_FW(mld, "Got sku_id: 0x0%x 0x0%x 0x0%x\n",
		     le32_to_cpu(alive_data->sku_id[0]),
		     le32_to_cpu(alive_data->sku_id[1]),
		     le32_to_cpu(alive_data->sku_id[2]));

	lmac_error_event_table =
		le32_to_cpu(lmac1->dbg_ptrs.error_event_table_ptr);
	iwl_fw_lmac1_set_alive_err_table(trans, lmac_error_event_table);

	if (lmac2)
		trans->dbg.lmac_error_event_table[1] =
			le32_to_cpu(lmac2->dbg_ptrs.error_event_table_ptr);

	umac_error_table = le32_to_cpu(umac->dbg_ptrs.error_info_addr) &
		~FW_ADDR_CACHE_CONTROL;

	iwl_fw_umac_set_alive_err_table(trans, umac_error_table);

	alive_data->valid = status == IWL_ALIVE_STATUS_OK;

	IWL_DEBUG_FW(mld,
		     "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n",
		     status, lmac1->ver_type, lmac1->ver_subtype);

	if (lmac2)
		IWL_DEBUG_FW(mld, "Alive ucode CDB\n");

	IWL_DEBUG_FW(mld,
		     "UMAC version: Major - 0x%x, Minor - 0x%x\n",
		     le32_to_cpu(umac->umac_major),
		     le32_to_cpu(umac->umac_minor));

	IWL_DEBUG_FW(mld, "FW alive flags 0x%x\n",
		     le16_to_cpu(palive->flags));

	if (version >= 8)
		IWL_DEBUG_FW(mld, "platform_id 0x%llx\n",
			     le64_to_cpu(palive->platform_id));

Annotation

Implementation Notes