drivers/net/wireless/broadcom/b43legacy/dma.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/b43legacy/dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/b43legacy/dma.c- Extension
.c- Size
- 35095 bytes
- Lines
- 1370
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
b43legacy.hdma.hmain.hdebugfs.hxmit.hlinux/dma-mapping.hlinux/pci.hlinux/delay.hlinux/skbuff.hlinux/slab.hnet/dst.h
Detected Declarations
function Copyrightfunction op32_fill_descriptorfunction op32_poke_txfunction op32_tx_suspendfunction op32_tx_resumefunction op32_get_current_rxslotfunction op32_set_current_rxslotfunction free_slotsfunction next_slotfunction update_max_used_slotsfunction update_max_used_slotsfunction b43legacy_dmacontroller_basefunction map_descbufferfunction unmap_descbufferfunction sync_descbuffer_for_cpufunction sync_descbuffer_for_devicefunction free_descriptor_bufferfunction alloc_ringmemoryfunction free_ringmemoryfunction b43legacy_dmacontroller_rx_resetfunction b43legacy_dmacontroller_tx_resetfunction b43legacy_dma_mapping_errorfunction setup_rx_descbufferfunction alloc_initial_descbuffersfunction dmacontroller_setupfunction dmacontroller_cleanupfunction free_all_descbuffersfunction b43legacy_engine_typefunction b43legacy_destroy_dmaringfunction b43legacy_dma_freefunction b43legacy_dma_initfunction generate_cookiefunction dma_tx_fragmentfunction should_inject_overflowfunction b43legacy_dma_txfunction should_inject_overflowfunction b43legacy_dma_handle_txstatusfunction dma_rxfunction b43legacy_dma_rxfunction b43legacy_dma_tx_suspend_ringfunction b43legacy_dma_tx_resume_ringfunction b43legacy_dma_tx_suspendfunction b43legacy_dma_tx_resume
Annotated Snippet
if (value == B43legacy_DMA32_RXSTAT_DISABLED) {
i = -1;
break;
}
msleep(1);
}
if (i != -1) {
b43legacyerr(dev->wl, "DMA RX reset timed out\n");
return -ENODEV;
}
return 0;
}
/* Reset the RX DMA channel */
static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
u16 mmio_base,
enum b43legacy_dmatype type)
{
int i;
u32 value;
u16 offset;
might_sleep();
for (i = 0; i < 10; i++) {
offset = B43legacy_DMA32_TXSTATUS;
value = b43legacy_read32(dev, mmio_base + offset);
value &= B43legacy_DMA32_TXSTATE;
if (value == B43legacy_DMA32_TXSTAT_DISABLED ||
value == B43legacy_DMA32_TXSTAT_IDLEWAIT ||
value == B43legacy_DMA32_TXSTAT_STOPPED)
break;
msleep(1);
}
offset = B43legacy_DMA32_TXCTL;
b43legacy_write32(dev, mmio_base + offset, 0);
for (i = 0; i < 10; i++) {
offset = B43legacy_DMA32_TXSTATUS;
value = b43legacy_read32(dev, mmio_base + offset);
value &= B43legacy_DMA32_TXSTATE;
if (value == B43legacy_DMA32_TXSTAT_DISABLED) {
i = -1;
break;
}
msleep(1);
}
if (i != -1) {
b43legacyerr(dev->wl, "DMA TX reset timed out\n");
return -ENODEV;
}
/* ensure the reset is completed. */
msleep(1);
return 0;
}
/* Check if a DMA mapping address is invalid. */
static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
dma_addr_t addr,
size_t buffersize,
bool dma_to_device)
{
if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr)))
return true;
switch (ring->type) {
case B43legacy_DMA_30BIT:
if ((u64)addr + buffersize > (1ULL << 30))
goto address_error;
break;
case B43legacy_DMA_32BIT:
if ((u64)addr + buffersize > (1ULL << 32))
goto address_error;
break;
}
/* The address is OK. */
return false;
address_error:
/* We can't support this address. Unmap it again. */
unmap_descbuffer(ring, addr, buffersize, dma_to_device);
return true;
}
static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
struct b43legacy_dmadesc32 *desc,
struct b43legacy_dmadesc_meta *meta,
Annotation
- Immediate include surface: `b43legacy.h`, `dma.h`, `main.h`, `debugfs.h`, `xmit.h`, `linux/dma-mapping.h`, `linux/pci.h`, `linux/delay.h`.
- Detected declarations: `function Copyright`, `function op32_fill_descriptor`, `function op32_poke_tx`, `function op32_tx_suspend`, `function op32_tx_resume`, `function op32_get_current_rxslot`, `function op32_set_current_rxslot`, `function free_slots`, `function next_slot`, `function update_max_used_slots`.
- Atlas domain: Driver Families / drivers/net.
- 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.