drivers/acpi/resource.c
Source file repositories/reference/linux-study-clean/drivers/acpi/resource.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/resource.c- Extension
.c- Size
- 32852 bytes
- Lines
- 1175
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/device.hlinux/export.hlinux/ioport.hlinux/slab.hlinux/irq.hlinux/dmi.hlinux/string_choices.h
Detected Declarations
struct irq_override_cmpstruct res_proc_contextfunction Copyrightfunction acpi_iospace_resource_validfunction is_gsifunction is_gsifunction acpi_dev_resource_len_validfunction acpi_dev_memresource_flagsfunction acpi_dev_get_memresourcefunction acpi_dev_resource_memoryfunction acpi_dev_ioresource_flagsfunction acpi_dev_get_ioresourcefunction acpi_dev_resource_iofunction acpi_decode_spacefunction acpi_dev_resource_address_spacefunction acpi_dev_resource_ext_address_spacefunction acpi_dev_irq_flagsfunction acpi_dev_get_irq_typefunction acpi_dev_irq_overridefunction acpi_dev_get_irqresourcefunction IRQfunction acpi_dev_resource_interruptfunction acpi_dev_free_resource_listfunction acpi_dev_new_resource_entryfunction acpi_dev_process_resourcefunction __acpi_dev_get_resourcesfunction andfunction is_memoryfunction acpi_dev_get_dma_resourcesfunction acpi_dev_get_resourcesfunction acpi_dev_get_resourcesfunction acpi_dev_consumes_resfunction list_for_each_entryfunction acpi_res_consumer_cbfunction settingsexport acpi_dev_resource_memoryexport acpi_dev_resource_ioexport acpi_dev_resource_address_spaceexport acpi_dev_resource_ext_address_spaceexport acpi_dev_irq_flagsexport acpi_dev_get_irq_typeexport acpi_dev_resource_interruptexport acpi_dev_free_resource_listexport acpi_dev_get_resourcesexport acpi_dev_get_dma_resourcesexport acpi_dev_get_memory_resourcesexport acpi_dev_filter_resource_type
Annotated Snippet
struct irq_override_cmp {
const struct dmi_system_id *system;
unsigned char irq;
unsigned char triggering;
unsigned char polarity;
unsigned char shareable;
bool override;
};
static const struct irq_override_cmp override_table[] = {
{ irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
{ irq1_level_low_skip_override, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 1, false },
{ irq1_level_low_skip_override, 11, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 1, false },
{ irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
};
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
u8 shareable)
{
int i;
for (i = 0; i < ARRAY_SIZE(override_table); i++) {
const struct irq_override_cmp *entry = &override_table[i];
if (entry->irq == gsi &&
entry->triggering == triggering &&
entry->polarity == polarity &&
entry->shareable == shareable &&
dmi_check_system(entry->system))
return entry->override;
}
#ifdef CONFIG_X86
/*
* Always use the MADT override info, except for the i8042 PS/2 ctrl
* IRQs (1 and 12). For these the DSDT IRQ settings should sometimes
* be used otherwise PS/2 keyboards / mice will not work.
*/
if (gsi != 1 && gsi != 12)
return true;
/* If the override comes from an INT_SRC_OVR MADT entry, honor it. */
if (acpi_int_src_ovr[gsi])
return true;
/*
* IRQ override isn't needed on modern AMD Zen systems and
* this override breaks active low IRQs on AMD Ryzen 6000 and
* newer systems. Skip it.
*/
if (boot_cpu_has(X86_FEATURE_ZEN))
return false;
#endif
return true;
}
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
u8 triggering, u8 polarity, u8 shareable,
u8 wake_capable, bool check_override)
{
int irq, p, t;
if (!valid_IRQ(gsi)) {
irqresource_disabled(res, gsi);
return;
}
/*
* In IO-APIC mode, use overridden attribute. Two reasons:
* 1. BIOS bug in DSDT
* 2. BIOS uses IO-APIC mode Interrupt Source Override
*
* We do this only if we are dealing with IRQ() or IRQNoFlags()
* resource (the legacy ISA resources). With modern ACPI 5 devices
* using extended IRQ descriptors we take the IRQ configuration
* from _CRS directly.
*/
if (check_override &&
acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
!acpi_get_override_irq(gsi, &t, &p)) {
u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
if (triggering != trig || polarity != pol) {
pr_warn("ACPI: IRQ %d override to %s%s, %s%s\n", gsi,
t ? "level" : "edge",
trig == triggering ? "" : "(!)",
str_low_high(p),
pol == polarity ? "" : "(!)");
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/export.h`, `linux/ioport.h`, `linux/slab.h`, `linux/irq.h`, `linux/dmi.h`, `linux/string_choices.h`.
- Detected declarations: `struct irq_override_cmp`, `struct res_proc_context`, `function Copyright`, `function acpi_iospace_resource_valid`, `function is_gsi`, `function is_gsi`, `function acpi_dev_resource_len_valid`, `function acpi_dev_memresource_flags`, `function acpi_dev_get_memresource`, `function acpi_dev_resource_memory`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration 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.