arch/sparc/kernel/apc.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/apc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/apc.c- Extension
.c- Size
- 4192 bytes
- Lines
- 196
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/fs.hlinux/errno.hlinux/init.hlinux/miscdevice.hlinux/pm.hlinux/of.hlinux/platform_device.hlinux/module.hasm/io.hasm/oplib.hlinux/uaccess.hasm/auxio.hasm/apc.hasm/processor.h
Detected Declarations
function systemsfunction apc_swift_idlefunction apc_freefunction apc_openfunction apc_releasefunction apc_ioctlfunction apc_probefunction apc_init
Annotated Snippet
static const struct file_operations apc_fops = {
.unlocked_ioctl = apc_ioctl,
.open = apc_open,
.release = apc_release,
.llseek = noop_llseek,
};
static struct miscdevice apc_miscdev = { MISC_DYNAMIC_MINOR, APC_DEVNAME, &apc_fops };
static int apc_probe(struct platform_device *op)
{
int err;
regs = of_ioremap(&op->resource[0], 0,
resource_size(&op->resource[0]), APC_OBPNAME);
if (!regs) {
printk(KERN_ERR "%s: unable to map registers\n", APC_DEVNAME);
return -ENODEV;
}
err = misc_register(&apc_miscdev);
if (err) {
printk(KERN_ERR "%s: unable to register device\n", APC_DEVNAME);
apc_free(op);
return -ENODEV;
}
/* Assign power management IDLE handler */
if (!apc_no_idle)
sparc_idle = apc_swift_idle;
printk(KERN_INFO "%s: power management initialized%s\n",
APC_DEVNAME, apc_no_idle ? " (CPU idle disabled)" : "");
return 0;
}
static const struct of_device_id apc_match[] = {
{
.name = APC_OBPNAME,
},
{},
};
MODULE_DEVICE_TABLE(of, apc_match);
static struct platform_driver apc_driver = {
.driver = {
.name = "apc",
.of_match_table = apc_match,
},
.probe = apc_probe,
};
static int __init apc_init(void)
{
return platform_driver_register(&apc_driver);
}
/* This driver is not critical to the boot process
* and is easiest to ioremap when SBus is already
* initialized, so we install ourselves thusly:
*/
__initcall(apc_init);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/fs.h`, `linux/errno.h`, `linux/init.h`, `linux/miscdevice.h`, `linux/pm.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `function systems`, `function apc_swift_idle`, `function apc_free`, `function apc_open`, `function apc_release`, `function apc_ioctl`, `function apc_probe`, `function apc_init`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.