arch/riscv/kernel/acpi.c
Source file repositories/reference/linux-study-clean/arch/riscv/kernel/acpi.c
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/kernel/acpi.c- Extension
.c- Size
- 9593 bytes
- Lines
- 356
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- 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/acpi.hlinux/efi-bgrt.hlinux/efi.hlinux/io.hlinux/memblock.hlinux/of_fdt.hlinux/pci.hlinux/serial_core.h
Detected Declarations
function parse_acpifunction acpi_fadt_sanity_checkfunction acpi_boot_table_initfunction acpi_parse_madt_rintcfunction parsingfunction __acpi_map_tablefunction __acpi_unmap_tablefunction for_each_efi_memory_descfunction raw_pci_readfunction raw_pci_writefunction acpi_get_cpu_uidexport acpi_disabledexport acpi_pci_disabledexport acpi_get_cpu_uid
Annotated Snippet
if (phys + size > end) {
pr_warn(FW_BUG "requested region covers multiple EFI memory regions\n");
return NULL;
}
region = md;
break;
}
/*
* It is fine for AML to remap regions that are not represented in the
* EFI memory map at all, as it only describes normal memory, and MMIO
* regions that require a virtual mapping to make them accessible to
* the EFI runtime services.
*/
prot = PAGE_KERNEL_IO;
if (region) {
switch (region->type) {
case EFI_LOADER_CODE:
case EFI_LOADER_DATA:
case EFI_BOOT_SERVICES_CODE:
case EFI_BOOT_SERVICES_DATA:
case EFI_CONVENTIONAL_MEMORY:
case EFI_PERSISTENT_MEMORY:
if (memblock_is_map_memory(phys) ||
!memblock_is_region_memory(phys, size)) {
pr_warn(FW_BUG "requested region covers kernel memory\n");
return NULL;
}
/*
* Mapping kernel memory is permitted if the region in
* question is covered by a single memblock with the
* NOMAP attribute set: this enables the use of ACPI
* table overrides passed via initramfs.
* This particular use case only requires read access.
*/
fallthrough;
case EFI_RUNTIME_SERVICES_CODE:
/*
* This would be unusual, but not problematic per se,
* as long as we take care not to create a writable
* mapping for executable code.
*/
prot = PAGE_KERNEL_RO;
break;
case EFI_ACPI_RECLAIM_MEMORY:
/*
* ACPI reclaim memory is used to pass firmware tables
* and other data that is intended for consumption by
* the OS only, which may decide it wants to reclaim
* that memory and use it for something else. We never
* do that, but we usually add it to the linear map
* anyway, in which case we should use the existing
* mapping.
*/
if (memblock_is_map_memory(phys))
return (void __iomem *)__va(phys);
fallthrough;
default:
if (region->attribute & EFI_MEMORY_WB)
prot = PAGE_KERNEL;
else if ((region->attribute & EFI_MEMORY_WC) ||
(region->attribute & EFI_MEMORY_WT))
prot = pgprot_writecombine(PAGE_KERNEL);
}
}
return ioremap_prot(phys, size, prot);
}
#ifdef CONFIG_PCI
/*
* raw_pci_read/write - Platform-specific PCI config space access.
*/
int raw_pci_read(unsigned int domain, unsigned int bus,
unsigned int devfn, int reg, int len, u32 *val)
{
struct pci_bus *b = pci_find_bus(domain, bus);
if (!b)
return PCIBIOS_DEVICE_NOT_FOUND;
return b->ops->read(b, devfn, reg, len, val);
}
int raw_pci_write(unsigned int domain, unsigned int bus,
unsigned int devfn, int reg, int len, u32 val)
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/efi-bgrt.h`, `linux/efi.h`, `linux/io.h`, `linux/memblock.h`, `linux/of_fdt.h`, `linux/pci.h`, `linux/serial_core.h`.
- Detected declarations: `function parse_acpi`, `function acpi_fadt_sanity_check`, `function acpi_boot_table_init`, `function acpi_parse_madt_rintc`, `function parsing`, `function __acpi_map_table`, `function __acpi_unmap_table`, `function for_each_efi_memory_desc`, `function raw_pci_read`, `function raw_pci_write`.
- Atlas domain: Architecture Layer / arch/riscv.
- 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.