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

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

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath11k/fw.c
Extension
.c
Size
3517 bytes
Lines
171
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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) {
			ath11k_err(ab, "Invalid length for FW IE %d (%zu < %zu)\n",
				   ie_id, len, ie_len);
			ret = -EINVAL;
			goto err;
		}

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

			timestamp = (__le32 *)data;

			ath11k_dbg(ab, ATH11K_DBG_BOOT, "found fw timestamp %d\n",
				   le32_to_cpup(timestamp));
			break;
		case ATH11K_FW_IE_FEATURES:
			ath11k_dbg(ab, ATH11K_DBG_BOOT,
				   "found firmware features ie (%zd B)\n",
				   ie_len);

			for (i = 0; i < ATH11K_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);
			}

			ath11k_dbg_dump(ab, ATH11K_DBG_BOOT, "features", "",
					ab->fw.fw_features,
					sizeof(ab->fw.fw_features));
			break;
		case ATH11K_FW_IE_AMSS_IMAGE:
			ath11k_dbg(ab, ATH11K_DBG_BOOT,
				   "found fw image ie (%zd B)\n",
				   ie_len);

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

			ab->fw.m3_data = data;
			ab->fw.m3_len = ie_len;
			break;
		default:
			ath11k_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);
	ab->fw.fw = NULL;
	return ret;
}

int ath11k_fw_pre_init(struct ath11k_base *ab)
{
	int ret;

	ret = ath11k_fw_request_firmware_api_n(ab, ATH11K_FW_API2_FILE);
	if (ret == 0) {
		ab->fw.api_version = 2;
		goto out;
	}

	ab->fw.api_version = 1;

out:

Annotation

Implementation Notes