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.

Dependency Surface

Detected Declarations

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

Implementation Notes