drivers/net/wireless/broadcom/b43legacy/pio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/b43legacy/pio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/b43legacy/pio.c- Extension
.c- Size
- 17252 bytes
- Lines
- 682
- 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.
- 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
b43legacy.hpio.hmain.hxmit.hlinux/delay.hlinux/slab.h
Detected Declarations
function Copyrightfunction tx_octetfunction tx_get_next_wordfunction tx_datafunction tx_completefunction generate_cookiefunction indexfunction pio_tx_write_fragmentfunction free_txpacketfunction pio_tx_packetfunction tx_taskletfunction list_for_each_entry_safefunction setup_txqueuesfunction cancel_transfersfunction b43legacy_destroy_pioqueuefunction b43legacy_pio_freefunction b43legacy_pio_initfunction b43legacy_pio_txfunction b43legacy_pio_handle_txstatusfunction pio_rx_errorfunction b43legacy_pio_rxfunction b43legacy_pio_tx_suspendfunction b43legacy_pio_tx_resumefunction b43legacy_pio_freeze_txqueuesfunction b43legacy_pio_thaw_txqueues
Annotated Snippet
if (status->frame_count > retry_limit) {
info->status.rates[0].count = retry_limit;
info->status.rates[1].count = status->frame_count -
retry_limit;
} else {
info->status.rates[0].count = status->frame_count;
info->status.rates[1].idx = -1;
}
}
ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb);
packet->skb = NULL;
free_txpacket(packet, 1);
/* If there are packets on the txqueue, poke the tasklet
* to transmit them.
*/
if (!list_empty(&queue->txqueue))
tasklet_schedule(&queue->txtask);
}
static void pio_rx_error(struct b43legacy_pioqueue *queue,
int clear_buffers,
const char *error)
{
int i;
b43legacyerr(queue->dev->wl, "PIO RX error: %s\n", error);
b43legacy_pio_write(queue, B43legacy_PIO_RXCTL,
B43legacy_PIO_RXCTL_READY);
if (clear_buffers) {
B43legacy_WARN_ON(queue->mmio_base != B43legacy_MMIO_PIO1_BASE);
for (i = 0; i < 15; i++) {
/* Dummy read. */
b43legacy_pio_read(queue, B43legacy_PIO_RXDATA);
}
}
}
void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)
{
__le16 preamble[21] = { 0 };
struct b43legacy_rxhdr_fw3 *rxhdr;
u16 tmp;
u16 len;
u16 macstat;
int i;
int preamble_readwords;
struct sk_buff *skb;
tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL);
if (!(tmp & B43legacy_PIO_RXCTL_DATAAVAILABLE))
return;
b43legacy_pio_write(queue, B43legacy_PIO_RXCTL,
B43legacy_PIO_RXCTL_DATAAVAILABLE);
for (i = 0; i < 10; i++) {
tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL);
if (tmp & B43legacy_PIO_RXCTL_READY)
goto data_ready;
udelay(10);
}
b43legacydbg(queue->dev->wl, "PIO RX timed out\n");
return;
data_ready:
len = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA);
if (unlikely(len > 0x700)) {
pio_rx_error(queue, 0, "len > 0x700");
return;
}
if (unlikely(len == 0 && queue->mmio_base !=
B43legacy_MMIO_PIO4_BASE)) {
pio_rx_error(queue, 0, "len == 0");
return;
}
preamble[0] = cpu_to_le16(len);
if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE)
preamble_readwords = 14 / sizeof(u16);
else
preamble_readwords = 18 / sizeof(u16);
for (i = 0; i < preamble_readwords; i++) {
tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA);
preamble[i + 1] = cpu_to_le16(tmp);
}
rxhdr = (struct b43legacy_rxhdr_fw3 *)preamble;
macstat = le16_to_cpu(rxhdr->mac_status);
if (macstat & B43legacy_RX_MAC_FCSERR) {
pio_rx_error(queue,
(queue->mmio_base == B43legacy_MMIO_PIO1_BASE),
Annotation
- Immediate include surface: `b43legacy.h`, `pio.h`, `main.h`, `xmit.h`, `linux/delay.h`, `linux/slab.h`.
- Detected declarations: `function Copyright`, `function tx_octet`, `function tx_get_next_word`, `function tx_data`, `function tx_complete`, `function generate_cookie`, `function index`, `function pio_tx_write_fragment`, `function free_txpacket`, `function pio_tx_packet`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.