drivers/net/wireless/realtek/rtw89/fw.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/fw.c- Extension
.c- Size
- 336376 bytes
- Lines
- 11839
- 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_arp.hcam.hchan.hcoex.hdebug.hfw.hmac.hphy.hps.hreg.hutil.hwow.h
Detected Declarations
struct rtw89_eapol_2_of_2struct rtw89_sa_querystruct rtw89_arp_rspstruct rtw89_fw_element_handlerstruct __fw_feat_cfgstruct rtw89_hw_scan_complete_cb_datafunction rtw89_fw_check_rdyfunction rtw89_fw_hdr_parser_v0function __get_mssc_key_idxfunction __parse_formatted_msscfunction __check_secure_blacklistfunction __parse_security_sectionfunction rtw89_fw_hdr_parser_v1function rtw89_fw_hdr_parserfunction rtw89_mfw_validate_hdrfunction rtw89_mfw_recognizefunction rtw89_mfw_get_sizefunction rtw89_fw_update_ver_v0function rtw89_fw_update_ver_v1function rtw89_fw_update_verfunction __rtw89_fw_recognizefunction __rtw89_fw_recognize_from_elmfunction rtw89_fw_iterate_feature_cfgfunction rtw89_fw_recognize_featuresfunction rtw89_early_fw_feature_recognizefunction rtw89_fw_validate_ver_requiredfunction rtw89_fw_recognizefunction rtw89_build_phy_tbl_from_elmfunction rtw89_fw_recognize_txpwr_from_elmfunction rtw89_build_txpwr_trk_tbl_from_elmfunction rtw89_build_rfk_log_fmt_from_elmfunction rtw89_regd_entcpyfunction rtw89_build_afe_pwr_seq_from_elmfunction rtw89_recognize_diag_mac_from_elmfunction rtw89_build_tx_comp_from_elmfunction rtw89_fw_recognize_elementsfunction rtw89_h2c_pkt_set_hdrfunction rtw89_h2c_pkt_set_hdr_fwdlfunction __rtw89_fw_download_tweak_hdr_v0function __rtw89_fw_download_tweak_hdr_v1function __rtw89_fw_download_hdrfunction rtw89_fw_download_hdrfunction __rtw89_fw_download_mainfunction rtw89_fw_get_fwdl_chk_type_from_suitfunction rtw89_fw_download_mainfunction rtw89_fw_prog_cnt_dumpfunction rtw89_fw_dl_fail_dumpfunction rtw89_fw_download_suit
Annotated Snippet
struct rtw89_eapol_2_of_2 {
u8 gtkbody[14];
u8 key_des_ver;
u8 rsvd[92];
} __packed;
struct rtw89_sa_query {
u8 category;
u8 action;
} __packed;
struct rtw89_arp_rsp {
u8 llc_hdr[sizeof(rfc1042_header)];
__be16 llc_type;
struct arphdr arp_hdr;
u8 sender_hw[ETH_ALEN];
__be32 sender_ip;
u8 target_hw[ETH_ALEN];
__be32 target_ip;
} __packed;
static const u8 mss_signature[] = {0x4D, 0x53, 0x53, 0x4B, 0x50, 0x4F, 0x4F, 0x4C};
const struct rtw89_fw_blacklist rtw89_fw_blacklist_default = {
.ver = 0x00,
.list = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
},
};
EXPORT_SYMBOL(rtw89_fw_blacklist_default);
union rtw89_fw_element_arg {
size_t offset;
enum rtw89_rf_path rf_path;
enum rtw89_fw_type fw_type;
};
struct rtw89_fw_element_handler {
int (*fn)(struct rtw89_dev *rtwdev,
const struct rtw89_fw_element_hdr *elm,
const union rtw89_fw_element_arg arg);
const union rtw89_fw_element_arg arg;
const char *name;
};
static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
struct sk_buff *skb);
static int rtw89_h2c_tx_and_wait(struct rtw89_dev *rtwdev, struct sk_buff *skb,
struct rtw89_wait_info *wait, unsigned int cond);
static int __parse_security_section(struct rtw89_dev *rtwdev,
struct rtw89_fw_bin_info *info,
struct rtw89_fw_hdr_section_info *section_info,
const void *content,
u32 *mssc_len);
static struct sk_buff *rtw89_fw_h2c_alloc_skb(struct rtw89_dev *rtwdev, u32 len,
bool header)
{
struct sk_buff *skb;
u32 header_len = 0;
u32 h2c_desc_size = rtwdev->chip->h2c_desc_size;
if (header)
header_len = H2C_HEADER_LEN;
skb = dev_alloc_skb(len + header_len + h2c_desc_size);
if (!skb)
return NULL;
skb_reserve(skb, header_len + h2c_desc_size);
memset(skb->data, 0, len);
return skb;
}
struct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr(struct rtw89_dev *rtwdev, u32 len)
{
return rtw89_fw_h2c_alloc_skb(rtwdev, len, true);
}
struct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr(struct rtw89_dev *rtwdev, u32 len)
{
return rtw89_fw_h2c_alloc_skb(rtwdev, len, false);
}
int rtw89_fw_check_rdy(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type)
{
const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
u8 val;
Annotation
- Immediate include surface: `linux/if_arp.h`, `cam.h`, `chan.h`, `coex.h`, `debug.h`, `fw.h`, `mac.h`, `phy.h`.
- Detected declarations: `struct rtw89_eapol_2_of_2`, `struct rtw89_sa_query`, `struct rtw89_arp_rsp`, `struct rtw89_fw_element_handler`, `struct __fw_feat_cfg`, `struct rtw89_hw_scan_complete_cb_data`, `function rtw89_fw_check_rdy`, `function rtw89_fw_hdr_parser_v0`, `function __get_mssc_key_idx`, `function __parse_formatted_mssc`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.