drivers/acpi/osl.c
Source file repositories/reference/linux-study-clean/drivers/acpi/osl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/osl.c- Extension
.c- Size
- 42937 bytes
- Lines
- 1815
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/panic.hlinux/reboot.hlinux/slab.hlinux/mm.hlinux/highmem.hlinux/lockdep.hlinux/pci.hlinux/interrupt.hlinux/kmod.hlinux/delay.hlinux/workqueue.hlinux/nmi.hlinux/acpi.hlinux/efi.hlinux/ioport.hlinux/list.hlinux/jiffies.hlinux/semaphore.hlinux/security.hasm/io.hlinux/uaccess.hlinux/io-64-nonatomic-lo-hi.hacpica/accommon.hinternal.hlinux/kdb.h
Detected Declarations
struct acpi_os_dpcstruct acpi_ioremapstruct acpi_hp_workfunction acpi_request_regionfunction acpi_reserve_resourcesfunction acpi_os_printffunction __printffunction setup_acpi_rsdpfunction acpi_os_get_root_pointerfunction locationfunction acpi_map_lookupfunction acpi_map_vaddr_lookupfunction acpi_map_lookup_virtfunction acpi_unmapfunction initfunction acpi_os_map_memoryfunction acpi_os_map_removefunction acpi_os_drop_map_reffunction initfunction acpi_os_unmap_memoryfunction acpi_os_unmap_generic_addressfunction acpi_os_get_physical_addressfunction acpi_rev_override_setupfunction acpi_os_predefined_overridefunction acpi_irqfunction acpi_os_install_interrupt_handlerfunction acpi_os_remove_interrupt_handlerfunction acpi_os_sleepfunction acpi_os_stallfunction ktime_getfunction acpi_os_read_portfunction acpi_os_write_portfunction acpi_os_read_iomemfunction acpi_os_read_memoryfunction acpi_os_write_memoryfunction acpi_os_read_pci_configurationfunction acpi_os_write_pci_configurationfunction acpi_os_execute_deferredfunction acpi_register_debuggerfunction acpi_unregister_debuggerfunction acpi_debugger_create_threadfunction acpi_debugger_write_logfunction acpi_debugger_read_cmdfunction acpi_debugger_wait_command_readyfunction acpi_debugger_notify_command_completefunction acpi_debugger_initfunction acpi_os_executefunction INIT_WORK
Annotated Snippet
struct acpi_os_dpc {
acpi_osd_exec_callback function;
void *context;
struct work_struct work;
};
#ifdef ENABLE_DEBUGGER
#include <linux/kdb.h>
/* stuff for debugger support */
int acpi_in_debugger;
EXPORT_SYMBOL(acpi_in_debugger);
#endif /*ENABLE_DEBUGGER */
static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
u32 pm1b_ctrl);
static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
u32 val_b);
static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context;
static struct workqueue_struct *kacpid_wq;
static struct workqueue_struct *kacpi_notify_wq;
static struct workqueue_struct *kacpi_hotplug_wq;
static bool acpi_os_initialized;
unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
bool acpi_permanent_mmap = false;
static bool poweroff_on_fatal = true;
module_param(poweroff_on_fatal, bool, 0);
MODULE_PARM_DESC(poweroff_on_fatal, "Poweroff when encountering a fatal ACPI error");
/*
* This list of permanent mappings is for memory that may be accessed from
* interrupt context, where we can't do the ioremap().
*/
struct acpi_ioremap {
struct list_head list;
void __iomem *virt;
acpi_physical_address phys;
acpi_size size;
union {
unsigned long refcount;
struct rcu_work rwork;
} track;
};
static LIST_HEAD(acpi_ioremaps);
static DEFINE_MUTEX(acpi_ioremap_lock);
#define acpi_ioremap_lock_held() lock_is_held(&acpi_ioremap_lock.dep_map)
static void __init acpi_request_region (struct acpi_generic_address *gas,
unsigned int length, char *desc)
{
u64 addr;
/* Handle possible alignment issues */
memcpy(&addr, &gas->address, sizeof(addr));
if (!addr || !length)
return;
/* Resources are never freed */
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
request_region(addr, length, desc);
else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
request_mem_region(addr, length, desc);
}
static int __init acpi_reserve_resources(void)
{
acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
"ACPI PM1a_EVT_BLK");
acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
"ACPI PM1b_EVT_BLK");
acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
"ACPI PM1a_CNT_BLK");
acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
"ACPI PM1b_CNT_BLK");
if (acpi_gbl_FADT.pm_timer_length == 4)
acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
"ACPI PM2_CNT_BLK");
/* Length of GPE blocks must be a non-negative multiple of 2 */
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/panic.h`, `linux/reboot.h`, `linux/slab.h`, `linux/mm.h`, `linux/highmem.h`, `linux/lockdep.h`.
- Detected declarations: `struct acpi_os_dpc`, `struct acpi_ioremap`, `struct acpi_hp_work`, `function acpi_request_region`, `function acpi_reserve_resources`, `function acpi_os_printf`, `function __printf`, `function setup_acpi_rsdp`, `function acpi_os_get_root_pointer`, `function location`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration 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.