drivers/acpi/acpica/dsobject.c

Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/dsobject.c

File Facts

System
Linux kernel
Corpus path
drivers/acpi/acpica/dsobject.c
Extension
.c
Size
14605 bytes
Lines
546
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 (!op->common.node) {

			/* Check if we are resolving a named reference within a package */

			if ((op->common.parent->common.aml_opcode ==
			     AML_PACKAGE_OP)
			    || (op->common.parent->common.aml_opcode ==
				AML_VARIABLE_PACKAGE_OP)) {
				/*
				 * We won't resolve package elements here, we will do this
				 * after all ACPI tables are loaded into the namespace. This
				 * behavior supports both forward references to named objects
				 * and external references to objects in other tables.
				 */
				goto create_new_object;
			} else {
				status = acpi_ns_lookup(walk_state->scope_info,
							op->common.value.string,
							ACPI_TYPE_ANY,
							ACPI_IMODE_EXECUTE,
							ACPI_NS_SEARCH_PARENT |
							ACPI_NS_DONT_OPEN_SCOPE,
							NULL,
							ACPI_CAST_INDIRECT_PTR
							(struct
							 acpi_namespace_node,
							 &(op->common.node)));
				if (ACPI_FAILURE(status)) {
					ACPI_ERROR_NAMESPACE(walk_state->
							     scope_info,
							     op->common.value.
							     string, status);
					return_ACPI_STATUS(status);
				}
			}
		}
	}

create_new_object:

	/* Create and init a new internal ACPI object */

	obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
						   (op->common.aml_opcode))->
						  object_type);
	if (!obj_desc) {
		return_ACPI_STATUS(AE_NO_MEMORY);
	}

	status =
	    acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
					&obj_desc);
	if (ACPI_FAILURE(status)) {
		acpi_ut_remove_reference(obj_desc);
		return_ACPI_STATUS(status);
	}

	/*
	 * Handling for unresolved package reference elements.
	 * These are elements that are namepaths.
	 */
	if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
	    (op->common.parent->common.aml_opcode == AML_VARIABLE_PACKAGE_OP)) {
		obj_desc->reference.resolved = TRUE;

		if ((op->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
		    !obj_desc->reference.node) {
			/*
			 * Name was unresolved above.
			 * Get the prefix node for later lookup
			 */
			obj_desc->reference.node =
			    walk_state->scope_info->scope.node;
			obj_desc->reference.aml = op->common.aml;
			obj_desc->reference.resolved = FALSE;
		}
	}

	*obj_desc_ptr = obj_desc;
	return_ACPI_STATUS(status);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_ds_build_internal_buffer_obj
 *
 * PARAMETERS:  walk_state      - Current walk state
 *              op              - Parser object to be translated
 *              buffer_length   - Length of the buffer
 *              obj_desc_ptr    - Where the ACPI internal object is returned

Annotation

Implementation Notes