drivers/scsi/sun_esp.c
Source file repositories/reference/linux-study-clean/drivers/scsi/sun_esp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/sun_esp.c- Extension
.c- Size
- 13529 bytes
- Lines
- 614
- 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.
- 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/types.hlinux/delay.hlinux/module.hlinux/mm.hlinux/init.hlinux/dma-mapping.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/gfp.hasm/irq.hasm/io.hasm/dma.hscsi/scsi_host.hesp_scsi.h
Detected Declarations
enum dvma_revfunction esp_sbus_setup_dmafunction esp_sbus_map_regsfunction esp_sbus_map_command_blockfunction esp_sbus_register_irqfunction esp_get_scsi_idfunction esp_get_differentialfunction esp_get_clock_paramsfunction esp_get_burstsfunction esp_sbus_get_propsfunction sbus_esp_write8function sbus_esp_read8function sbus_esp_irq_pendingfunction sbus_esp_reset_dmafunction sbus_esp_dma_drainfunction sbus_esp_dma_invalidatefunction sbus_esp_send_dma_cmdfunction sbus_esp_dma_errorfunction esp_sbus_probe_onefunction esp_sbus_probefunction esp_sbus_remove
Annotated Snippet
if (can_do_sbus64) {
esp->prev_hme_dmacsr |= DMA_SCSI_SBUS64;
sbus_set_sbus64(&op->dev, esp->bursts);
}
lim = 1000;
while (dma_read32(DMA_CSR) & DMA_PEND_READ) {
if (--lim == 0) {
printk(KERN_ALERT PFX "esp%d: DMA_PEND_READ "
"will not clear!\n",
esp->host->unique_id);
break;
}
udelay(1);
}
dma_write32(0, DMA_CSR);
dma_write32(esp->prev_hme_dmacsr, DMA_CSR);
dma_write32(0, DMA_ADDR);
break;
case dvmarev2:
if (esp->rev != ESP100) {
val = dma_read32(DMA_CSR);
dma_write32(val | DMA_3CLKS, DMA_CSR);
}
break;
case dvmarev3:
val = dma_read32(DMA_CSR);
val &= ~DMA_3CLKS;
val |= DMA_2CLKS;
if (can_do_burst32) {
val &= ~DMA_BRST_SZ;
val |= DMA_BRST32;
}
dma_write32(val, DMA_CSR);
break;
case dvmaesc1:
val = dma_read32(DMA_CSR);
val |= DMA_ADD_ENABLE;
val &= ~DMA_BCNT_ENAB;
if (!can_do_burst32 && can_do_burst16) {
val |= DMA_ESC_BURST;
} else {
val &= ~(DMA_ESC_BURST);
}
dma_write32(val, DMA_CSR);
break;
default:
break;
}
/* Enable interrupts. */
val = dma_read32(DMA_CSR);
dma_write32(val | DMA_INT_ENAB, DMA_CSR);
}
static void sbus_esp_dma_drain(struct esp *esp)
{
u32 csr;
int lim;
if (esp->dmarev == dvmahme)
return;
csr = dma_read32(DMA_CSR);
if (!(csr & DMA_FIFO_ISDRAIN))
return;
if (esp->dmarev != dvmarev3 && esp->dmarev != dvmaesc1)
dma_write32(csr | DMA_FIFO_STDRAIN, DMA_CSR);
lim = 1000;
while (dma_read32(DMA_CSR) & DMA_FIFO_ISDRAIN) {
if (--lim == 0) {
printk(KERN_ALERT PFX "esp%d: DMA will not drain!\n",
esp->host->unique_id);
break;
}
udelay(1);
}
}
static void sbus_esp_dma_invalidate(struct esp *esp)
{
if (esp->dmarev == dvmahme) {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/delay.h`, `linux/module.h`, `linux/mm.h`, `linux/init.h`, `linux/dma-mapping.h`, `linux/of.h`.
- Detected declarations: `enum dvma_rev`, `function esp_sbus_setup_dma`, `function esp_sbus_map_regs`, `function esp_sbus_map_command_block`, `function esp_sbus_register_irq`, `function esp_get_scsi_id`, `function esp_get_differential`, `function esp_get_clock_params`, `function esp_get_bursts`, `function esp_sbus_get_props`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.