drivers/scsi/aacraid/rx.c
Source file repositories/reference/linux-study-clean/drivers/scsi/aacraid/rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/aacraid/rx.c- Extension
.c- Size
- 17546 bytes
- Lines
- 685
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- 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
linux/kernel.hlinux/hex.hlinux/init.hlinux/types.hlinux/pci.hlinux/spinlock.hlinux/blkdev.hlinux/delay.hlinux/completion.hlinux/time.hlinux/interrupt.hscsi/scsi_host.haacraid.h
Detected Declarations
struct POSTSTATUSfunction Copyrightfunction aac_rx_intr_messagefunction aac_rx_disable_interruptfunction aac_rx_enable_interrupt_producerfunction aac_rx_enable_interrupt_messagefunction rx_sync_cmdfunction aac_rx_interrupt_adapterfunction aac_rx_notify_adapterfunction aac_rx_start_adapterfunction aac_rx_check_healthfunction aac_rx_deliver_producerfunction aac_rx_deliver_messagefunction aac_rx_ioremapfunction aac_rx_restart_adapterfunction aac_rx_select_commfunction _aac_rx_initfunction aac_rx_init
Annotated Snippet
struct POSTSTATUS {
__le32 Post_Command;
__le32 Post_Address;
} * post;
dma_addr_t paddr, baddr;
int ret;
if (likely((status & 0xFF000000L) == 0xBC000000L))
return (status >> 16) & 0xFF;
buffer = dma_alloc_coherent(&dev->pdev->dev, 512, &baddr,
GFP_KERNEL);
ret = -2;
if (unlikely(buffer == NULL))
return ret;
post = dma_alloc_coherent(&dev->pdev->dev,
sizeof(struct POSTSTATUS), &paddr,
GFP_KERNEL);
if (unlikely(post == NULL)) {
dma_free_coherent(&dev->pdev->dev, 512, buffer, baddr);
return ret;
}
memset(buffer, 0, 512);
post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
post->Post_Address = cpu_to_le32(baddr);
rx_writel(dev, MUnit.IMRx[0], paddr);
rx_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, 0, 0, 0, 0, 0,
NULL, NULL, NULL, NULL, NULL);
dma_free_coherent(&dev->pdev->dev, sizeof(struct POSTSTATUS),
post, paddr);
if (likely((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X')))) {
ret = (hex_to_bin(buffer[2]) << 4) +
hex_to_bin(buffer[3]);
}
dma_free_coherent(&dev->pdev->dev, 512, buffer, baddr);
return ret;
}
/*
* Wait for the adapter to be up and running.
*/
if (unlikely(!(status & KERNEL_UP_AND_RUNNING)))
return -3;
/*
* Everything is OK
*/
return 0;
}
/**
* aac_rx_deliver_producer
* @fib: fib to issue
*
* Will send a fib, returning 0 if successful.
*/
int aac_rx_deliver_producer(struct fib * fib)
{
struct aac_dev *dev = fib->dev;
struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
u32 Index;
unsigned long nointr = 0;
aac_queue_get( dev, &Index, AdapNormCmdQueue, fib->hw_fib_va, 1, fib, &nointr);
atomic_inc(&q->numpending);
*(q->headers.producer) = cpu_to_le32(Index + 1);
if (!(nointr & aac_config.irq_mod))
aac_adapter_notify(dev, AdapNormCmdQueue);
return 0;
}
/**
* aac_rx_deliver_message
* @fib: fib to issue
*
* Will send a fib, returning 0 if successful.
*/
static int aac_rx_deliver_message(struct fib * fib)
{
struct aac_dev *dev = fib->dev;
struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
u32 Index;
u64 addr;
volatile void __iomem *device;
unsigned long count = 10000000L; /* 50 seconds */
atomic_inc(&q->numpending);
for(;;) {
Index = rx_readl(dev, MUnit.InboundQueue);
if (unlikely(Index == 0xFFFFFFFFL))
Index = rx_readl(dev, MUnit.InboundQueue);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/hex.h`, `linux/init.h`, `linux/types.h`, `linux/pci.h`, `linux/spinlock.h`, `linux/blkdev.h`, `linux/delay.h`.
- Detected declarations: `struct POSTSTATUS`, `function Copyright`, `function aac_rx_intr_message`, `function aac_rx_disable_interrupt`, `function aac_rx_enable_interrupt_producer`, `function aac_rx_enable_interrupt_message`, `function rx_sync_cmd`, `function aac_rx_interrupt_adapter`, `function aac_rx_notify_adapter`, `function aac_rx_start_adapter`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.