drivers/acpi/acpica/exregion.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/exregion.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/exregion.c- Extension
.c- Size
- 13843 bytes
- Lines
- 526
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
acpi/acpi.haccommon.hacinterp.h
Detected Declarations
function Copyrightfunction smallerfunction acpi_ex_system_io_space_handlerfunction acpi_ex_pci_config_space_handlerfunction acpi_ex_cmos_space_handlerfunction acpi_ex_pci_bar_space_handlerfunction acpi_ex_data_table_space_handler
Annotated Snippet
if (!mm) {
ACPI_ERROR((AE_INFO,
"Unable to save memory mapping at 0x%8.8X%8.8X, size %u",
ACPI_FORMAT_UINT64(address), length));
return_ACPI_STATUS(AE_NO_MEMORY);
}
/*
* October 2009: Attempt to map from the requested address to the
* end of the region. However, we will never map more than one
* page, nor will we cross a page boundary.
*/
map_length = (acpi_size)
((mem_info->address + mem_info->length) - address);
if (map_length > ACPI_DEFAULT_PAGE_SIZE)
map_length = ACPI_DEFAULT_PAGE_SIZE;
/* Create a new mapping starting at the address given */
logical_addr_ptr = acpi_os_map_memory(address, map_length);
if (!logical_addr_ptr) {
ACPI_ERROR((AE_INFO,
"Could not map memory at 0x%8.8X%8.8X, size %u",
ACPI_FORMAT_UINT64(address),
(u32)map_length));
ACPI_FREE(mm);
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Save the physical address and mapping size */
mm->logical_address = logical_addr_ptr;
mm->physical_address = address;
mm->length = map_length;
/*
* Add the new entry to the mappigs list and save it as the
* current mapping.
*/
mm->next_mm = mem_info->first_mm;
mem_info->first_mm = mm;
mem_info->cur_mm = mm;
}
access:
/*
* Generate a logical pointer corresponding to the address we want to
* access
*/
logical_addr_ptr = mm->logical_address +
((u64) address - (u64) mm->physical_address);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
bit_width, function, ACPI_FORMAT_UINT64(address)));
/*
* Perform the memory read or write
*
* Note: For machines that do not support non-aligned transfers, the target
* address was checked for alignment above. We do not attempt to break the
* transfer up into smaller (byte-size) chunks because the AML specifically
* asked for a transfer width that the hardware may require.
*/
switch (function) {
case ACPI_READ:
*value = 0;
switch (bit_width) {
case 8:
*value = (u64)ACPI_GET8(logical_addr_ptr);
break;
case 16:
*value = (u64)ACPI_GET16(logical_addr_ptr);
break;
case 32:
*value = (u64)ACPI_GET32(logical_addr_ptr);
break;
case 64:
*value = (u64)ACPI_GET64(logical_addr_ptr);
break;
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`, `acinterp.h`.
- Detected declarations: `function Copyright`, `function smaller`, `function acpi_ex_system_io_space_handler`, `function acpi_ex_pci_config_space_handler`, `function acpi_ex_cmos_space_handler`, `function acpi_ex_pci_bar_space_handler`, `function acpi_ex_data_table_space_handler`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: source 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.