drivers/acpi/acpica/rsutils.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/rsutils.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/rsutils.c- Extension
.c- Size
- 22024 bytes
- Lines
- 756
- 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.hacnamesp.hacresrc.h
Detected Declarations
function acpi_rs_decode_bitmaskfunction acpi_rs_encode_bitmaskfunction acpi_rs_move_datafunction acpi_rs_set_resource_lengthfunction acpi_rs_set_resource_headerfunction acpi_rs_strcpyfunction acpi_rs_get_resource_sourcefunction acpi_rs_set_resource_sourcefunction acpi_rs_get_prt_method_datafunction acpi_rs_get_crs_method_datafunction acpi_rs_get_prs_method_datafunction acpi_rs_get_aei_method_datafunction acpi_rs_get_method_datafunction acpi_rs_set_srs_method_data
Annotated Snippet
if (mask & 0x0001) {
list[bit_count] = i;
bit_count++;
}
mask >>= 1;
}
return (bit_count);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_encode_bitmask
*
* PARAMETERS: list - List of values to encode
* count - Length of list
*
* RETURN: Encoded bitmask
*
* DESCRIPTION: Convert a list of values to an encoded bitmask
*
******************************************************************************/
u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
{
u32 i;
u16 mask;
ACPI_FUNCTION_ENTRY();
/* Encode the list into a single bitmask */
for (i = 0, mask = 0; i < count; i++) {
mask |= (0x1 << list[i]);
}
return (mask);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_move_data
*
* PARAMETERS: destination - Pointer to the destination descriptor
* source - Pointer to the source descriptor
* item_count - How many items to move
* move_type - Byte width
*
* RETURN: None
*
* DESCRIPTION: Move multiple data items from one descriptor to another. Handles
* alignment issues and endian issues if necessary, as configured
* via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
*
******************************************************************************/
void
acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
{
u32 i;
ACPI_FUNCTION_ENTRY();
/* One move per item */
for (i = 0; i < item_count; i++) {
switch (move_type) {
/*
* For the 8-bit case, we can perform the move all at once
* since there are no alignment or endian issues
*/
case ACPI_RSC_MOVE8:
case ACPI_RSC_MOVE_GPIO_RES:
case ACPI_RSC_MOVE_SERIAL_VEN:
case ACPI_RSC_MOVE_SERIAL_RES:
memcpy(destination, source, item_count);
return;
/*
* 16-, 32-, and 64-bit cases must use the move macros that perform
* endian conversion and/or accommodate hardware that cannot perform
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE_GPIO_PIN:
ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
&ACPI_CAST_PTR(u16, source)[i]);
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`, `acnamesp.h`, `acresrc.h`.
- Detected declarations: `function acpi_rs_decode_bitmask`, `function acpi_rs_encode_bitmask`, `function acpi_rs_move_data`, `function acpi_rs_set_resource_length`, `function acpi_rs_set_resource_header`, `function acpi_rs_strcpy`, `function acpi_rs_get_resource_source`, `function acpi_rs_set_resource_source`, `function acpi_rs_get_prt_method_data`, `function acpi_rs_get_crs_method_data`.
- 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.