drivers/bcma/sprom.c
Source file repositories/reference/linux-study-clean/drivers/bcma/sprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bcma/sprom.c- Extension
.c- Size
- 21392 bytes
- Lines
- 649
- Domain
- Driver Families
- Bucket
- drivers/bcma
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bcma_private.hlinux/bcma/bcma.hlinux/bcma/bcma_regs.hlinux/pci.hlinux/io.hlinux/dma-mapping.hlinux/slab.h
Detected Declarations
function bcma_arch_register_fallback_spromfunction bcma_fill_sprom_with_fallbackfunction bcma_sprom_readfunction bcma_crc8function bcma_sprom_crcfunction bcma_sprom_check_crcfunction bcma_sprom_validfunction sprom_extract_antgainfunction bcma_sprom_extract_r8function bcma_sprom_ext_availablefunction bcma_sprom_onchip_availablefunction bcma_sprom_onchip_offsetfunction bcma_sprom_get
Annotated Snippet
if (sprom_onchip) {
/* determine offset */
offset = bcma_sprom_onchip_offset(bus);
}
if (!offset || !sprom_onchip) {
/*
* Maybe there is no SPROM on the device?
* Now we ask the arch code if there is some sprom
* available for this device in some other storage.
*/
err = bcma_fill_sprom_with_fallback(bus, &bus->sprom);
return err;
}
}
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);
bcma_debug(bus, "SPROM offset 0x%x\n", offset);
for (i = 0; i < ARRAY_SIZE(sprom_sizes); i++) {
size_t words = sprom_sizes[i];
sprom = kcalloc(words, sizeof(u16), GFP_KERNEL);
if (!sprom)
return -ENOMEM;
bcma_sprom_read(bus, offset, sprom, words);
err = bcma_sprom_valid(bus, sprom, words);
if (!err)
break;
kfree(sprom);
}
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
if (err) {
bcma_warn(bus, "Invalid SPROM read from the PCIe card, trying to use fallback SPROM\n");
err = bcma_fill_sprom_with_fallback(bus, &bus->sprom);
} else {
bcma_sprom_extract_r8(bus, sprom);
kfree(sprom);
}
return err;
}
Annotation
- Immediate include surface: `bcma_private.h`, `linux/bcma/bcma.h`, `linux/bcma/bcma_regs.h`, `linux/pci.h`, `linux/io.h`, `linux/dma-mapping.h`, `linux/slab.h`.
- Detected declarations: `function bcma_arch_register_fallback_sprom`, `function bcma_fill_sprom_with_fallback`, `function bcma_sprom_read`, `function bcma_crc8`, `function bcma_sprom_crc`, `function bcma_sprom_check_crc`, `function bcma_sprom_valid`, `function sprom_extract_antgain`, `function bcma_sprom_extract_r8`, `function bcma_sprom_ext_available`.
- Atlas domain: Driver Families / drivers/bcma.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.