drivers/ata/pata_buddha.c
Source file repositories/reference/linux-study-clean/drivers/ata/pata_buddha.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ata/pata_buddha.c- Extension
.c- Size
- 7622 bytes
- Lines
- 299
- Domain
- Driver Families
- Bucket
- drivers/ata
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ata.hlinux/blkdev.hlinux/delay.hlinux/interrupt.hlinux/kernel.hlinux/libata.hlinux/mm.hlinux/mod_devicetable.hlinux/module.hlinux/types.hlinux/zorro.hscsi/scsi_cmnd.hscsi/scsi_host.hasm/amigahw.hasm/amigaints.hasm/setup.h
Detected Declarations
function pata_buddha_data_xferfunction set_modefunction ata_for_each_devfunction pata_buddha_irq_checkfunction pata_xsurf_irq_clearfunction pata_buddha_probefunction pata_buddha_removefunction pata_buddha_late_init
Annotated Snippet
if (rw == READ) {
raw_insw((u16 *)data_addr, (u16 *)pad, 1);
*buf = pad[0];
} else {
pad[0] = *buf;
raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
}
words++;
}
return words << 1;
}
/*
* Provide our own set_mode() as we don't want to change anything that has
* already been configured..
*/
static int pata_buddha_set_mode(struct ata_link *link,
struct ata_device **unused)
{
struct ata_device *dev;
ata_for_each_dev(dev, link, ENABLED) {
/* We don't really care */
dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO;
ata_dev_info(dev, "configured for PIO\n");
}
return 0;
}
static bool pata_buddha_irq_check(struct ata_port *ap)
{
u8 ch;
ch = z_readb((unsigned long)ap->private_data);
return !!(ch & 0x80);
}
static void pata_xsurf_irq_clear(struct ata_port *ap)
{
z_writeb(0, (unsigned long)ap->private_data);
}
static struct ata_port_operations pata_buddha_ops = {
.inherits = &ata_sff_port_ops,
.sff_data_xfer = pata_buddha_data_xfer,
.sff_irq_check = pata_buddha_irq_check,
.cable_detect = ata_cable_unknown,
.set_mode = pata_buddha_set_mode,
};
static struct ata_port_operations pata_xsurf_ops = {
.inherits = &ata_sff_port_ops,
.sff_data_xfer = pata_buddha_data_xfer,
.sff_irq_check = pata_buddha_irq_check,
.sff_irq_clear = pata_xsurf_irq_clear,
.cable_detect = ata_cable_unknown,
.set_mode = pata_buddha_set_mode,
};
static int pata_buddha_probe(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
static const char * const board_name[] = {
"Buddha", "Catweasel", "X-Surf"
};
struct ata_host *host;
void __iomem *buddha_board;
unsigned long board;
unsigned int type = ent->driver_data;
unsigned int nr_ports = (type == BOARD_CATWEASEL) ? 3 : 2;
void *old_drvdata;
int i;
dev_info(&z->dev, "%s IDE controller\n", board_name[type]);
board = z->resource.start;
if (type != BOARD_XSURF) {
if (!devm_request_mem_region(&z->dev,
board + BUDDHA_BASE1,
0x800, DRV_NAME))
return -ENXIO;
} else {
if (!devm_request_mem_region(&z->dev,
board + XSURF_BASE1,
0x1000, DRV_NAME))
Annotation
- Immediate include surface: `linux/ata.h`, `linux/blkdev.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/libata.h`, `linux/mm.h`, `linux/mod_devicetable.h`.
- Detected declarations: `function pata_buddha_data_xfer`, `function set_mode`, `function ata_for_each_dev`, `function pata_buddha_irq_check`, `function pata_xsurf_irq_clear`, `function pata_buddha_probe`, `function pata_buddha_remove`, `function pata_buddha_late_init`.
- Atlas domain: Driver Families / drivers/ata.
- Implementation status: source implementation candidate.
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.