drivers/acpi/acpica/dspkginit.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/dspkginit.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/dspkginit.c- Extension
.c- Size
- 16258 bytes
- Lines
- 532
- 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.hamlcode.hacdispat.hacinterp.hacparser.h
Detected Declarations
function Packagefunction arrayfunction acpi_ds_init_package_elementfunction afunction acpi_ds_resolve_package_element
Annotated Snippet
if (!obj_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
obj_desc->package.node = parent->common.node;
}
if (obj_desc->package.flags & AOPOBJ_DATA_VALID) { /* Just in case */
return_ACPI_STATUS(AE_OK);
}
/*
* Allocate the element array (array of pointers to the individual
* objects) if necessary. the count is based on the num_elements
* parameter. Add an extra pointer slot so that the list is always
* null terminated.
*/
if (!obj_desc->package.elements) {
obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
element_count
+
1) *
sizeof(void
*));
if (!obj_desc->package.elements) {
acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(AE_NO_MEMORY);
}
obj_desc->package.count = element_count;
}
/* First arg is element count. Second arg begins the initializer list */
arg = op->common.value.arg;
arg = arg->common.next;
/*
* If we are executing module-level code, we will defer the
* full resolution of the package elements in order to support
* forward references from the elements. This provides
* compatibility with other ACPI implementations.
*/
if (module_level_code) {
obj_desc->package.aml_start = walk_state->aml;
obj_desc->package.aml_length = 0;
ACPI_DEBUG_PRINT_RAW((ACPI_DB_PARSE,
"%s: Deferring resolution of Package elements\n",
ACPI_GET_FUNCTION_NAME));
}
/*
* Initialize the elements of the package, up to the num_elements count.
* Package is automatically padded with uninitialized (NULL) elements
* if num_elements is greater than the package list length. Likewise,
* Package is truncated if num_elements is less than the list length.
*/
for (i = 0; arg && (i < element_count); i++) {
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
if (!arg->common.node) {
/*
* This is the case where an expression has returned a value.
* The use of expressions (term_args) within individual
* package elements is not supported by the AML interpreter,
* even though the ASL grammar supports it. Example:
*
* Name (INT1, 0x1234)
*
* Name (PKG3, Package () {
* Add (INT1, 0xAAAA0000)
* })
*
* 1) No known AML interpreter supports this type of construct
* 2) This fixes a fault if the construct is encountered
*/
ACPI_EXCEPTION((AE_INFO, AE_SUPPORT,
"Expressions within package elements are not supported"));
/* Cleanup the return object, it is not needed */
acpi_ut_remove_reference(walk_state->results->
results.obj_desc[0]);
return_ACPI_STATUS(AE_SUPPORT);
}
if (arg->common.node->type == ACPI_TYPE_METHOD) {
/*
* A method reference "looks" to the parser to be a method
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`, `acnamesp.h`, `amlcode.h`, `acdispat.h`, `acinterp.h`, `acparser.h`.
- Detected declarations: `function Package`, `function array`, `function acpi_ds_init_package_element`, `function a`, `function acpi_ds_resolve_package_element`.
- 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.