drivers/scsi/atp870u.c
Source file repositories/reference/linux-study-clean/drivers/scsi/atp870u.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/atp870u.c- Extension
.c- Size
- 60284 bytes
- Lines
- 2383
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/types.hlinux/string.hlinux/ioport.hlinux/delay.hlinux/proc_fs.hlinux/spinlock.hlinux/pci.hlinux/blkdev.hlinux/dma-mapping.hlinux/slab.hasm/io.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_host.hatp870u.h
Detected Declarations
function atp_writeb_basefunction atp_writew_basefunction atp_writeb_iofunction atp_writew_iofunction atp_writeb_pcifunction atp_writel_pcifunction atp_readb_basefunction atp_readw_basefunction atp_readl_basefunction atp_readb_iofunction atp_readw_iofunction atp_readb_pcifunction is880function is885function atp870u_intr_handlefunction atp870u_queuecommand_lckfunction DEF_SCSI_QCMDfunction atp_readb_iofunction scsi_for_each_sgfunction fun_scamfunction tscamfunction atp870u_free_tablesfunction atp870u_init_tablesfunction atp_set_host_idfunction atp870_initfunction atp880_initfunction atp885_initfunction atp870u_probefunction atp870u_abortfunction atp870u_show_infofunction atp870u_biosparamfunction atp870u_removefunction atp_is
Annotated Snippet
static struct pci_driver atp870u_driver = {
.id_table = atp870u_id_table,
.name = "atp870u",
.probe = atp870u_probe,
.remove = atp870u_remove,
};
module_pci_driver(atp870u_driver);
static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip,
unsigned char lvdmode)
{
unsigned char i, j, k, rmb, n;
unsigned short int m;
static unsigned char mbuf[512];
static unsigned char satn[9] = { 0, 0, 0, 0, 0, 0, 0, 6, 6 };
static unsigned char inqd[9] = { 0x12, 0, 0, 0, 0x24, 0, 0, 0x24, 6 };
static unsigned char synn[6] = { 0x80, 1, 3, 1, 0x19, 0x0e };
unsigned char synu[6] = { 0x80, 1, 3, 1, 0x0a, 0x0e };
static unsigned char synw[6] = { 0x80, 1, 3, 1, 0x19, 0x0e };
static unsigned char synw_870[6] = { 0x80, 1, 3, 1, 0x0c, 0x07 };
unsigned char synuw[6] = { 0x80, 1, 3, 1, 0x0a, 0x0e };
static unsigned char wide[6] = { 0x80, 1, 2, 3, 1, 0 };
static unsigned char u3[9] = { 0x80, 1, 6, 4, 0x09, 00, 0x0e, 0x01, 0x02 };
for (i = 0; i < 16; i++) {
if (!wide_chip && (i > 7))
break;
m = 1;
m = m << i;
if ((m & dev->active_id[c]) != 0) {
continue;
}
if (i == dev->host_id[c]) {
printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[c]);
continue;
}
atp_writeb_io(dev, c, 0x1b, wide_chip ? 0x01 : 0x00);
atp_writeb_io(dev, c, 1, 0x08);
atp_writeb_io(dev, c, 2, 0x7f);
atp_writeb_io(dev, c, 3, satn[0]);
atp_writeb_io(dev, c, 4, satn[1]);
atp_writeb_io(dev, c, 5, satn[2]);
atp_writeb_io(dev, c, 6, satn[3]);
atp_writeb_io(dev, c, 7, satn[4]);
atp_writeb_io(dev, c, 8, satn[5]);
atp_writeb_io(dev, c, 0x0f, 0);
atp_writeb_io(dev, c, 0x11, dev->id[c][i].devsp);
atp_writeb_io(dev, c, 0x12, 0);
atp_writeb_io(dev, c, 0x13, satn[6]);
atp_writeb_io(dev, c, 0x14, satn[7]);
j = i;
if ((j & 0x08) != 0) {
j = (j & 0x07) | 0x40;
}
atp_writeb_io(dev, c, 0x15, j);
atp_writeb_io(dev, c, 0x18, satn[8]);
while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00)
cpu_relax();
if (atp_readb_io(dev, c, 0x17) != 0x11 && atp_readb_io(dev, c, 0x17) != 0x8e)
continue;
while (atp_readb_io(dev, c, 0x17) != 0x8e)
cpu_relax();
dev->active_id[c] |= m;
atp_writeb_io(dev, c, 0x10, 0x30);
if (is885(dev) || is880(dev))
atp_writeb_io(dev, c, 0x14, 0x00);
else /* result of is870() merge - is this a bug? */
atp_writeb_io(dev, c, 0x04, 0x00);
phase_cmd:
atp_writeb_io(dev, c, 0x18, 0x08);
while ((atp_readb_io(dev, c, 0x1f) & 0x80) == 0x00)
cpu_relax();
j = atp_readb_io(dev, c, 0x17);
if (j != 0x16) {
atp_writeb_io(dev, c, 0x10, 0x41);
goto phase_cmd;
}
sel_ok:
atp_writeb_io(dev, c, 3, inqd[0]);
atp_writeb_io(dev, c, 4, inqd[1]);
atp_writeb_io(dev, c, 5, inqd[2]);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/types.h`, `linux/string.h`, `linux/ioport.h`, `linux/delay.h`.
- Detected declarations: `function atp_writeb_base`, `function atp_writew_base`, `function atp_writeb_io`, `function atp_writew_io`, `function atp_writeb_pci`, `function atp_writel_pci`, `function atp_readb_base`, `function atp_readw_base`, `function atp_readl_base`, `function atp_readb_io`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern 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.