drivers/acpi/acpica/psparse.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/psparse.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/psparse.c- Extension
.c- Size
- 18275 bytes
- Lines
- 702
- 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.hacparser.hacdispat.hamlcode.hacinterp.hacnamesp.h
Detected Declarations
function Copyrightfunction acpi_ps_peek_opcodefunction acpi_ps_complete_this_opfunction acpi_ps_next_parse_statefunction acpi_ps_parse_amlfunction value
Annotated Snippet
if (aml >= parser_state->aml_end) {
return (0xFFFF);
}
opcode = (u16) ((opcode << 8) | ACPI_GET8(aml));
}
return (opcode);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_complete_this_op
*
* PARAMETERS: walk_state - Current State
* op - Op to complete
*
* RETURN: Status
*
* DESCRIPTION: Perform any cleanup at the completion of an Op.
*
******************************************************************************/
acpi_status
acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op)
{
union acpi_parse_object *prev;
union acpi_parse_object *next;
const struct acpi_opcode_info *parent_info;
union acpi_parse_object *replacement_op = NULL;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
/* Check for null Op, can happen if AML code is corrupt */
if (!op) {
return_ACPI_STATUS(AE_OK); /* OK for now */
}
acpi_ex_stop_trace_opcode(op, walk_state);
/* Delete this op and the subtree below it if asked to */
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
ACPI_PARSE_DELETE_TREE)
|| (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
return_ACPI_STATUS(AE_OK);
}
/* Make sure that we only delete this subtree */
if (op->common.parent) {
prev = op->common.parent->common.value.arg;
if (!prev) {
/* Nothing more to do */
goto cleanup;
}
/*
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
*/
parent_info =
acpi_ps_get_opcode_info(op->common.parent->common.
aml_opcode);
switch (parent_info->class) {
case AML_CLASS_CONTROL:
break;
case AML_CLASS_CREATE:
/*
* These opcodes contain term_arg operands. The current
* op must be replaced by a placeholder return op
*/
replacement_op =
acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP,
op->common.aml);
if (!replacement_op) {
status = AE_NO_MEMORY;
}
break;
case AML_CLASS_NAMED_OBJECT:
/*
* These opcodes contain term_arg operands. The current
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`, `acparser.h`, `acdispat.h`, `amlcode.h`, `acinterp.h`, `acnamesp.h`.
- Detected declarations: `function Copyright`, `function acpi_ps_peek_opcode`, `function acpi_ps_complete_this_op`, `function acpi_ps_next_parse_state`, `function acpi_ps_parse_aml`, `function value`.
- 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.