drivers/acpi/tables.c
Source file repositories/reference/linux-study-clean/drivers/acpi/tables.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/tables.c- Extension
.c- Size
- 21731 bytes
- Lines
- 800
- 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/init.hlinux/kernel.hlinux/smp.hlinux/string.hlinux/types.hlinux/irq.hlinux/errno.hlinux/acpi.hlinux/memblock.hlinux/earlycpio.hlinux/initrd.hlinux/security.hlinux/kmemleak.hinternal.h
Detected Declarations
function acpi_table_print_madt_entryfunction acpi_table_parse_entries_arrayfunction __acpi_table_parse_entriesfunction acpi_table_parse_cedtfunction acpi_table_parse_entriesfunction acpi_table_parse_madtfunction Tablefunction check_multiple_madtfunction acpi_table_taintfunction acpi_table_checksumfunction acpi_table_upgradefunction acpi_table_initrd_overridefunction acpi_table_initrd_scanfunction acpi_table_initrd_scanfunction acpi_table_initrd_overridefunction acpi_table_initrd_overridefunction acpi_table_initrd_scanfunction acpi_os_table_overridefunction acpi_locate_initial_tablesfunction acpi_reserve_initial_tablesfunction acpi_table_init_completefunction acpi_table_initfunction acpi_parse_apic_instancefunction acpi_force_table_verification_setupfunction acpi_force_32bit_fadt_addr
Annotated Snippet
if (file.size < sizeof(struct acpi_table_header)) {
pr_err("ACPI OVERRIDE: Table smaller than ACPI header [%s%s]\n",
cpio_path, file.name);
continue;
}
table = file.data;
for (sig = 0; sig < ARRAY_SIZE(table_sigs); sig++)
if (!memcmp(table->signature, table_sigs[sig], 4))
break;
if (sig >= ARRAY_SIZE(table_sigs)) {
pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n",
cpio_path, file.name);
continue;
}
if (file.size != table->length) {
pr_err("ACPI OVERRIDE: File length does not match table length [%s%s]\n",
cpio_path, file.name);
continue;
}
if (acpi_table_checksum(file.data, table->length)) {
pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n",
cpio_path, file.name);
continue;
}
pr_info("%4.4s ACPI table found in initrd [%s%s][0x%x]\n",
table->signature, cpio_path, file.name, table->length);
all_tables_size += table->length;
acpi_initrd_files[table_nr].data = file.data;
acpi_initrd_files[table_nr].size = file.size;
table_nr++;
}
if (table_nr == 0)
return;
if (security_locked_down(LOCKDOWN_ACPI_TABLES)) {
pr_notice("kernel is locked down, ignoring table override\n");
return;
}
acpi_tables_addr =
memblock_phys_alloc_range(all_tables_size, PAGE_SIZE,
0, ACPI_TABLE_UPGRADE_MAX_PHYS);
if (!acpi_tables_addr) {
WARN_ON(1);
return;
}
/*
* Only calling e820_add_reserve does not work and the
* tables are invalid (memory got used) later.
* memblock_reserve works as expected and the tables won't get modified.
* But it's not enough on X86 because ioremap will
* complain later (used by acpi_os_map_memory) that the pages
* that should get mapped are not marked "reserved".
* Both memblock_reserve and e820__range_add (via arch_reserve_mem_area)
* works fine.
*/
arch_reserve_mem_area(acpi_tables_addr, all_tables_size);
kmemleak_ignore_phys(acpi_tables_addr);
/*
* early_ioremap only can remap 256k one time. If we map all
* tables one time, we will hit the limit. Need to map chunks
* one by one during copying the same as that in relocate_initrd().
*/
for (no = 0; no < table_nr; no++) {
unsigned char *src_p = acpi_initrd_files[no].data;
phys_addr_t size = acpi_initrd_files[no].size;
phys_addr_t dest_addr = acpi_tables_addr + total_offset;
phys_addr_t slop, clen;
char *dest_p;
total_offset += size;
while (size) {
slop = dest_addr & ~PAGE_MASK;
clen = size;
if (clen > MAP_CHUNK_SIZE - slop)
clen = MAP_CHUNK_SIZE - slop;
dest_p = early_memremap(dest_addr & PAGE_MASK,
clen + slop);
memcpy(dest_p + slop, src_p, clen);
early_memunmap(dest_p, clen + slop);
src_p += clen;
dest_addr += clen;
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/smp.h`, `linux/string.h`, `linux/types.h`, `linux/irq.h`, `linux/errno.h`, `linux/acpi.h`.
- Detected declarations: `function acpi_table_print_madt_entry`, `function acpi_table_parse_entries_array`, `function __acpi_table_parse_entries`, `function acpi_table_parse_cedt`, `function acpi_table_parse_entries`, `function acpi_table_parse_madt`, `function Table`, `function check_multiple_madt`, `function acpi_table_taint`, `function acpi_table_checksum`.
- 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.