arch/loongarch/kernel/acpi.c
Source file repositories/reference/linux-study-clean/arch/loongarch/kernel/acpi.c
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/kernel/acpi.c- Extension
.c- Size
- 8625 bytes
- Lines
- 397
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- 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/init.hlinux/acpi.hlinux/efi-bgrt.hlinux/export.hlinux/irq.hlinux/irqdomain.hlinux/memblock.hlinux/of_fdt.hlinux/serial_core.hasm/io.hasm/numa.hasm/loongson.hacpi/processor.h
Detected Declarations
function __acpi_map_tablefunction __acpi_unmap_tablefunction set_processor_maskfunction acpi_parse_p1_processorfunction acpi_parse_p2_processorfunction acpi_parse_eio_masterfunction acpi_process_madtfunction parse_acpi_topologyfunction for_each_possible_cpufunction acpi_boot_table_initfunction acpi_numa_processor_affinity_initfunction acpi_numa_x2apic_affinity_initfunction arch_reserve_mem_areafunction acpi_map_cpu2nodefunction acpi_map_cpufunction acpi_unmap_cpufunction acpi_get_cpu_uidexport acpi_disabledexport acpi_pci_disabledexport acpi_map_cpuexport acpi_unmap_cpuexport acpi_get_cpu_uid
Annotated Snippet
if (topology_id < 0) {
pr_warn("Invalid BIOS PPTT\n");
return -ENOENT;
}
if (acpi_pptt_cpu_is_thread(cpu) <= 0)
cpu_data[cpu].core = topology_id;
else {
topology_id = find_acpi_cpu_topology(cpu, 1);
if (topology_id < 0)
return -ENOENT;
cpu_data[cpu].core = topology_id;
}
}
pptt_enabled = 1;
return 0;
}
#ifndef CONFIG_SUSPEND
int (*acpi_suspend_lowlevel)(void);
#else
int (*acpi_suspend_lowlevel)(void) = loongarch_acpi_suspend;
#endif
void __init acpi_boot_table_init(void)
{
/*
* If acpi_disabled, bail out
*/
if (acpi_disabled)
goto fdt_earlycon;
/*
* Initialize the ACPI boot-time table parser.
*/
if (acpi_table_init()) {
disable_acpi();
goto fdt_earlycon;
}
loongson_sysconf.boot_cpu_id = read_csr_cpuid();
/*
* Process the Multiple APIC Description Table (MADT), if present
*/
acpi_process_madt();
/* Do not enable ACPI SPCR console by default */
acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
if (IS_ENABLED(CONFIG_ACPI_BGRT))
acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
return;
fdt_earlycon:
if (earlycon_acpi_spcr_enable)
early_init_dt_scan_chosen_stdout();
}
#ifdef CONFIG_ACPI_NUMA
/* Callback for Proximity Domain -> CPUID mapping */
void __init
acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
{
int pxm, node;
if (srat_disabled())
return;
if (pa->header.length != sizeof(struct acpi_srat_cpu_affinity)) {
bad_srat();
return;
}
if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
return;
pxm = pa->proximity_domain_lo;
if (acpi_srat_revision >= 2) {
pxm |= (pa->proximity_domain_hi[0] << 8);
pxm |= (pa->proximity_domain_hi[1] << 16);
pxm |= (pa->proximity_domain_hi[2] << 24);
}
node = acpi_map_pxm_to_node(pxm);
if (node < 0) {
pr_err("SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
Annotation
- Immediate include surface: `linux/init.h`, `linux/acpi.h`, `linux/efi-bgrt.h`, `linux/export.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/memblock.h`, `linux/of_fdt.h`.
- Detected declarations: `function __acpi_map_table`, `function __acpi_unmap_table`, `function set_processor_mask`, `function acpi_parse_p1_processor`, `function acpi_parse_p2_processor`, `function acpi_parse_eio_master`, `function acpi_process_madt`, `function parse_acpi_topology`, `function for_each_possible_cpu`, `function acpi_boot_table_init`.
- Atlas domain: Architecture Layer / arch/loongarch.
- 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.