drivers/net/wireless/ath/ath12k/fw.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/fw.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath12k/fw.c
Extension
.c
Size
4080 bytes
Lines
187
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

if (len < ie_len) {
			ath12k_err(ab, "Invalid length for FW IE %d (%zu < %zu)\n",
				   ie_id, len, ie_len);
			ret = -EINVAL;
			goto err;
		}

		switch (ie_id) {
		case ATH12K_FW_IE_TIMESTAMP:
			if (ie_len != sizeof(u32))
				break;

			timestamp = (__le32 *)data;

			ath12k_dbg(ab, ATH12K_DBG_BOOT, "found fw timestamp %d\n",
				   le32_to_cpup(timestamp));
			break;
		case ATH12K_FW_IE_FEATURES:
			ath12k_dbg(ab, ATH12K_DBG_BOOT,
				   "found firmware features ie (%zd B)\n",
				   ie_len);

			for (i = 0; i < ATH12K_FW_FEATURE_COUNT; i++) {
				index = i / 8;
				bit = i % 8;

				if (index == ie_len)
					break;

				if (data[index] & (1 << bit))
					__set_bit(i, ab->fw.fw_features);
			}

			ab->fw.fw_features_valid = true;

			ath12k_dbg_dump(ab, ATH12K_DBG_BOOT, "features", "",
					ab->fw.fw_features,
					sizeof(ab->fw.fw_features));
			break;
		case ATH12K_FW_IE_AMSS_IMAGE:
			ath12k_dbg(ab, ATH12K_DBG_BOOT,
				   "found fw image ie (%zd B)\n",
				   ie_len);

			ab->fw.amss_data = data;
			ab->fw.amss_len = ie_len;
			break;
		case ATH12K_FW_IE_M3_IMAGE:
			ath12k_dbg(ab, ATH12K_DBG_BOOT,
				   "found m3 image ie (%zd B)\n",
				   ie_len);

			ab->fw.m3_data = data;
			ab->fw.m3_len = ie_len;
			break;
		case ATH12K_FW_IE_AUX_UC_IMAGE:
			ath12k_dbg(ab, ATH12K_DBG_BOOT,
				   "found aux_uc image ie (%zd B)\n",
				   ie_len);

			ab->fw.aux_uc_data = data;
			ab->fw.aux_uc_len = ie_len;
			break;
		case ATH12K_FW_IE_AMSS_DUALMAC_IMAGE:
			ath12k_dbg(ab, ATH12K_DBG_BOOT,
				   "found dualmac fw image ie (%zd B)\n",
				   ie_len);
			ab->fw.amss_dualmac_data = data;
			ab->fw.amss_dualmac_len = ie_len;
			break;
		default:
			ath12k_warn(ab, "Unknown FW IE: %u\n", ie_id);
			break;
		}

		/* jump over the padding */
		ie_len = ALIGN(ie_len, 4);

		/* make sure there's space for padding */
		if (ie_len > len)
			break;

		len -= ie_len;
		data += ie_len;
	}

	return 0;

err:
	release_firmware(ab->fw.fw);

Annotation

Implementation Notes