drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c- Extension
.c- Size
- 21174 bytes
- Lines
- 869
- 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.
- 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.
- 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/efi.hlinux/kernel.hlinux/slab.hlinux/device.hlinux/firmware.hlinux/module.hlinux/bcm47xx_nvram.hdebug.hfirmware.hcore.hcommon.hchip.h
Detected Declarations
struct nvram_parserstruct brcmf_fwenum nvram_parser_statefunction is_nvram_charfunction is_whitespacefunction brcmf_nvram_handle_idlefunction brcmf_nvram_handle_keyfunction brcmf_nvram_handle_valuefunction brcmf_nvram_handle_commentfunction brcmf_nvram_handle_endfunction brcmf_init_nvram_parserfunction brcmf_fw_strip_multi_v1function brcmf_fw_strip_multi_v2function brcmf_fw_add_defaultsfunction brcmf_fw_add_macaddrfunction brcmf_fw_nvram_freefunction brcmf_fw_fix_efi_nvram_ccodefunction brcmf_fw_free_requestfunction brcmf_fw_request_nvram_donefunction brcmf_fw_complete_requestfunction brcmf_fw_request_firmwarefunction brcmf_fw_request_donefunction brcmf_fw_request_done_alt_pathfunction brcmf_fw_request_is_validfunction brcmf_fw_get_firmwaresfunction brcmf_fw_alloc_request
Annotated Snippet
struct nvram_parser {
enum nvram_parser_state state;
const u8 *data;
u8 *nvram;
u32 nvram_len;
u32 line;
u32 column;
u32 pos;
u32 entry;
bool multi_dev_v1;
bool multi_dev_v2;
bool boardrev_found;
bool strip_mac;
};
/*
* is_nvram_char() - check if char is a valid one for NVRAM entry
*
* It accepts all printable ASCII chars except for '#' which opens a comment.
* Please note that ' ' (space) while accepted is not a valid key name char.
*/
static bool is_nvram_char(char c)
{
/* comment marker excluded */
if (c == '#')
return false;
/* key and value may have any other readable character */
return (c >= 0x20 && c < 0x7f);
}
static bool is_whitespace(char c)
{
return (c == ' ' || c == '\r' || c == '\n' || c == '\t');
}
static enum nvram_parser_state brcmf_nvram_handle_idle(struct nvram_parser *nvp)
{
char c;
c = nvp->data[nvp->pos];
if (c == '\n')
return COMMENT;
if (is_whitespace(c) || c == '\0')
goto proceed;
if (c == '#')
return COMMENT;
if (is_nvram_char(c)) {
nvp->entry = nvp->pos;
return KEY;
}
brcmf_dbg(INFO, "warning: ln=%d:col=%d: ignoring invalid character\n",
nvp->line, nvp->column);
proceed:
nvp->column++;
nvp->pos++;
return IDLE;
}
static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp)
{
enum nvram_parser_state st = nvp->state;
char c;
c = nvp->data[nvp->pos];
if (c == '=') {
/* ignore RAW1 by treating as comment */
if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
st = COMMENT;
else
st = VALUE;
if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
nvp->multi_dev_v1 = true;
if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
nvp->multi_dev_v2 = true;
if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
nvp->boardrev_found = true;
/* strip macaddr if platform MAC overrides */
if (nvp->strip_mac &&
strncmp(&nvp->data[nvp->entry], "macaddr", 7) == 0)
st = COMMENT;
} else if (!is_nvram_char(c) || c == ' ') {
brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
nvp->line, nvp->column);
return COMMENT;
}
nvp->column++;
nvp->pos++;
return st;
Annotation
- Immediate include surface: `linux/efi.h`, `linux/kernel.h`, `linux/slab.h`, `linux/device.h`, `linux/firmware.h`, `linux/module.h`, `linux/bcm47xx_nvram.h`, `debug.h`.
- Detected declarations: `struct nvram_parser`, `struct brcmf_fw`, `enum nvram_parser_state`, `function is_nvram_char`, `function is_whitespace`, `function brcmf_nvram_handle_idle`, `function brcmf_nvram_handle_key`, `function brcmf_nvram_handle_value`, `function brcmf_nvram_handle_comment`, `function brcmf_nvram_handle_end`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.