drivers/parport/parport_sunbpp.c
Source file repositories/reference/linux-study-clean/drivers/parport/parport_sunbpp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/parport/parport_sunbpp.c- Extension
.c- Size
- 9518 bytes
- Lines
- 380
- Domain
- Driver Families
- Bucket
- drivers/parport
- 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/string.hlinux/module.hlinux/delay.hlinux/errno.hlinux/ioport.hlinux/kernel.hlinux/slab.hlinux/init.hlinux/of.hlinux/platform_device.hlinux/parport.hasm/ptrace.hlinux/interrupt.hasm/io.hasm/oplib.hasm/dma.hasm/irq.hasm/sunbpp.h
Detected Declarations
function Williamsfunction parport_sunbpp_enable_irqfunction parport_sunbpp_write_datafunction parport_sunbpp_read_datafunction status_sunbpp_to_pcfunction control_sunbpp_to_pcfunction parport_sunbpp_read_controlfunction parport_sunbpp_frob_controlfunction parport_sunbpp_write_controlfunction parport_sunbpp_read_statusfunction parport_sunbpp_data_forwardfunction parport_sunbpp_data_reversefunction parport_sunbpp_init_statefunction parport_sunbpp_save_statefunction parport_sunbpp_restore_statefunction bpp_probefunction bpp_remove
Annotated Snippet
if (val & PARPORT_CONTROL_STROBE) {
value_tcr &= ~P_TCR_DS;
} else {
value_tcr |= P_TCR_DS;
}
}
if (mask & PARPORT_CONTROL_AUTOFD) {
if (val & PARPORT_CONTROL_AUTOFD) {
value_or &= ~P_OR_AFXN;
} else {
value_or |= P_OR_AFXN;
}
}
if (mask & PARPORT_CONTROL_INIT) {
if (val & PARPORT_CONTROL_INIT) {
value_or &= ~P_OR_INIT;
} else {
value_or |= P_OR_INIT;
}
}
if (mask & PARPORT_CONTROL_SELECT) {
if (val & PARPORT_CONTROL_SELECT) {
value_or |= P_OR_SLCT_IN;
} else {
value_or &= ~P_OR_SLCT_IN;
}
}
sbus_writeb(value_or, ®s->p_or);
sbus_writeb(value_tcr, ®s->p_tcr);
dprintk((KERN_DEBUG "frob2: tcr 0x%x or 0x%x\n",
value_tcr, value_or));
return parport_sunbpp_read_control(p);
}
static void parport_sunbpp_write_control(struct parport *p, unsigned char d)
{
const unsigned char wm = (PARPORT_CONTROL_STROBE |
PARPORT_CONTROL_AUTOFD |
PARPORT_CONTROL_INIT |
PARPORT_CONTROL_SELECT);
parport_sunbpp_frob_control (p, wm, d & wm);
}
static unsigned char parport_sunbpp_read_status(struct parport *p)
{
return status_sunbpp_to_pc(p);
}
static void parport_sunbpp_data_forward (struct parport *p)
{
struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
unsigned char value_tcr = sbus_readb(®s->p_tcr);
dprintk((KERN_DEBUG "forward\n"));
value_tcr &= ~P_TCR_DIR;
sbus_writeb(value_tcr, ®s->p_tcr);
}
static void parport_sunbpp_data_reverse (struct parport *p)
{
struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
u8 val = sbus_readb(®s->p_tcr);
dprintk((KERN_DEBUG "reverse\n"));
val |= P_TCR_DIR;
sbus_writeb(val, ®s->p_tcr);
}
static void parport_sunbpp_init_state(struct pardevice *dev, struct parport_state *s)
{
s->u.pc.ctr = 0xc;
s->u.pc.ecr = 0x0;
}
static void parport_sunbpp_save_state(struct parport *p, struct parport_state *s)
{
s->u.pc.ctr = parport_sunbpp_read_control(p);
}
static void parport_sunbpp_restore_state(struct parport *p, struct parport_state *s)
{
parport_sunbpp_write_control(p, s->u.pc.ctr);
}
static struct parport_operations parport_sunbpp_ops =
{
.write_data = parport_sunbpp_write_data,
.read_data = parport_sunbpp_read_data,
Annotation
- Immediate include surface: `linux/string.h`, `linux/module.h`, `linux/delay.h`, `linux/errno.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/slab.h`, `linux/init.h`.
- Detected declarations: `function Williams`, `function parport_sunbpp_enable_irq`, `function parport_sunbpp_write_data`, `function parport_sunbpp_read_data`, `function status_sunbpp_to_pc`, `function control_sunbpp_to_pc`, `function parport_sunbpp_read_control`, `function parport_sunbpp_frob_control`, `function parport_sunbpp_write_control`, `function parport_sunbpp_read_status`.
- Atlas domain: Driver Families / drivers/parport.
- 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.