drivers/net/wireless/broadcom/b43/dma.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/b43/dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/b43/dma.c- Extension
.c- Size
- 46924 bytes
- Lines
- 1769
- 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
b43.hdma.hmain.hdebugfs.hxmit.hlinux/dma-mapping.hlinux/pci.hlinux/delay.hlinux/skbuff.hlinux/etherdevice.hlinux/slab.hasm/div64.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 op64_fill_descriptorfunction op64_poke_txfunction op64_tx_suspendfunction op64_tx_resumefunction op64_get_current_rxslotfunction op64_set_current_rxslotfunction free_slotsfunction next_slotfunction prev_slotfunction update_max_used_slotsfunction update_max_used_slotsfunction b43_dmacontroller_basefunction map_descbufferfunction unmap_descbufferfunction sync_descbuffer_for_cpufunction sync_descbuffer_for_devicefunction free_descriptor_bufferfunction alloc_ringmemoryfunction free_ringmemoryfunction b43_dmacontroller_rx_resetfunction b43_dmacontroller_tx_resetfunction b43_dma_mapping_errorfunction b43_rx_buffer_is_poisonedfunction b43_poison_rx_bufferfunction setup_rx_descbufferfunction alloc_initial_descbuffersfunction dmacontroller_setupfunction dmacontroller_cleanupfunction free_all_descbuffersfunction b43_engine_typefunction b43_destroy_dmaringfunction b43_dma_freefunction b43_dma_translation_in_low_wordfunction b43_dma_initfunction generate_cookiefunction dma_tx_fragmentfunction should_inject_overflowfunction b43_dma_txfunction should_inject_overflowfunction b43_dma_handle_txstatusfunction dma_rx
Annotated Snippet
if (dma->translation_in_low) {
addr &= ~SSB_DMA_TRANSLATION_MASK;
addr |= dma->translation;
}
break;
case B43_DMA_ADDR_HIGH:
addr = upper_32_bits(dmaaddr);
if (!dma->translation_in_low) {
addr &= ~SSB_DMA_TRANSLATION_MASK;
addr |= dma->translation;
}
break;
case B43_DMA_ADDR_EXT:
if (dma->translation_in_low)
addr = lower_32_bits(dmaaddr);
else
addr = upper_32_bits(dmaaddr);
addr &= SSB_DMA_TRANSLATION_MASK;
addr >>= SSB_DMA_TRANSLATION_SHIFT;
break;
}
return addr;
}
/* 32bit DMA ops. */
static
struct b43_dmadesc_generic *op32_idx2desc(struct b43_dmaring *ring,
int slot,
struct b43_dmadesc_meta **meta)
{
struct b43_dmadesc32 *desc;
*meta = &(ring->meta[slot]);
desc = ring->descbase;
desc = &(desc[slot]);
return (struct b43_dmadesc_generic *)desc;
}
static void op32_fill_descriptor(struct b43_dmaring *ring,
struct b43_dmadesc_generic *desc,
dma_addr_t dmaaddr, u16 bufsize,
int start, int end, int irq)
{
struct b43_dmadesc32 *descbase = ring->descbase;
int slot;
u32 ctl;
u32 addr;
u32 addrext;
slot = (int)(&(desc->dma32) - descbase);
B43_WARN_ON(!(slot >= 0 && slot < ring->nr_slots));
addr = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_LOW);
addrext = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_EXT);
ctl = bufsize & B43_DMA32_DCTL_BYTECNT;
if (slot == ring->nr_slots - 1)
ctl |= B43_DMA32_DCTL_DTABLEEND;
if (start)
ctl |= B43_DMA32_DCTL_FRAMESTART;
if (end)
ctl |= B43_DMA32_DCTL_FRAMEEND;
if (irq)
ctl |= B43_DMA32_DCTL_IRQ;
ctl |= (addrext << B43_DMA32_DCTL_ADDREXT_SHIFT)
& B43_DMA32_DCTL_ADDREXT_MASK;
desc->dma32.control = cpu_to_le32(ctl);
desc->dma32.address = cpu_to_le32(addr);
}
static void op32_poke_tx(struct b43_dmaring *ring, int slot)
{
b43_dma_write(ring, B43_DMA32_TXINDEX,
(u32) (slot * sizeof(struct b43_dmadesc32)));
}
static void op32_tx_suspend(struct b43_dmaring *ring)
{
b43_dma_write(ring, B43_DMA32_TXCTL, b43_dma_read(ring, B43_DMA32_TXCTL)
| B43_DMA32_TXSUSPEND);
}
static void op32_tx_resume(struct b43_dmaring *ring)
{
b43_dma_write(ring, B43_DMA32_TXCTL, b43_dma_read(ring, B43_DMA32_TXCTL)
& ~B43_DMA32_TXSUSPEND);
}
Annotation
- Immediate include surface: `b43.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 op64_fill_descriptor`, `function op64_poke_tx`, `function op64_tx_suspend`.
- 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.