drivers/acpi/acpi_dbg.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpi_dbg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpi_dbg.c- Extension
.c- Size
- 18283 bytes
- Lines
- 786
- Domain
- Driver Families
- Bucket
- drivers/acpi
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/wait.hlinux/poll.hlinux/sched.hlinux/kthread.hlinux/proc_fs.hlinux/debugfs.hlinux/circ_buf.hlinux/acpi.hinternal.h
Detected Declarations
struct acpi_aml_iofunction __acpi_aml_runningfunction __acpi_aml_access_okfunction __acpi_aml_readablefunction __acpi_aml_writablefunction __acpi_aml_busyfunction __acpi_aml_usedfunction acpi_aml_runningfunction acpi_aml_busyfunction acpi_aml_usedfunction acpi_aml_kern_readablefunction acpi_aml_kern_writablefunction acpi_aml_user_readablefunction acpi_aml_user_writablefunction acpi_aml_lock_writefunction acpi_aml_lock_readfunction acpi_aml_unlock_fifofunction acpi_aml_write_kernfunction acpi_aml_readb_kernfunction acpi_aml_write_logfunction acpi_aml_read_cmdfunction acpi_aml_threadfunction acpi_aml_create_threadfunction acpi_aml_wait_command_readyfunction acpi_aml_notify_command_completefunction acpi_aml_openfunction acpi_aml_releasefunction acpi_aml_read_userfunction acpi_aml_readfunction acpi_aml_write_userfunction acpi_aml_writefunction acpi_aml_pollfunction acpi_aml_initfunction acpi_aml_exitmodule init acpi_aml_init
Annotated Snippet
static const struct file_operations acpi_aml_operations = {
.read = acpi_aml_read,
.write = acpi_aml_write,
.poll = acpi_aml_poll,
.open = acpi_aml_open,
.release = acpi_aml_release,
.llseek = generic_file_llseek,
};
static const struct acpi_debugger_ops acpi_aml_debugger = {
.create_thread = acpi_aml_create_thread,
.read_cmd = acpi_aml_read_cmd,
.write_log = acpi_aml_write_log,
.wait_command_ready = acpi_aml_wait_command_ready,
.notify_command_complete = acpi_aml_notify_command_complete,
};
static int __init acpi_aml_init(void)
{
int ret;
if (acpi_disabled)
return -ENODEV;
/* Initialize AML IO interface */
mutex_init(&acpi_aml_io.lock);
init_waitqueue_head(&acpi_aml_io.wait);
acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf;
acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf;
acpi_aml_dentry = debugfs_create_file("acpidbg",
S_IFREG | S_IRUGO | S_IWUSR,
acpi_debugfs_dir, NULL,
&acpi_aml_operations);
ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger);
if (ret) {
debugfs_remove(acpi_aml_dentry);
acpi_aml_dentry = NULL;
return ret;
}
acpi_aml_initialized = true;
return 0;
}
static void __exit acpi_aml_exit(void)
{
if (acpi_aml_initialized) {
acpi_unregister_debugger(&acpi_aml_debugger);
debugfs_remove(acpi_aml_dentry);
acpi_aml_dentry = NULL;
acpi_aml_initialized = false;
}
}
module_init(acpi_aml_init);
module_exit(acpi_aml_exit);
MODULE_AUTHOR("Lv Zheng");
MODULE_DESCRIPTION("ACPI debugger userspace IO driver");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/wait.h`, `linux/poll.h`, `linux/sched.h`, `linux/kthread.h`, `linux/proc_fs.h`, `linux/debugfs.h`.
- Detected declarations: `struct acpi_aml_io`, `function __acpi_aml_running`, `function __acpi_aml_access_ok`, `function __acpi_aml_readable`, `function __acpi_aml_writable`, `function __acpi_aml_busy`, `function __acpi_aml_used`, `function acpi_aml_running`, `function acpi_aml_busy`, `function acpi_aml_used`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.