Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8707b34 authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

ACPICA: New: Validation for predefined ACPI methods/objects



Validates predefined ACPI objects that appear in the namespace,
at the time they are evaluated. The argument count and the type of
the returned object are validated. The purpose of this validation
is to detect problems with the BIOS-exposed predefined ACPI objects
before the results are returned to the ACPI-related drivers.

Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent b9d1312a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
obj-y := nsaccess.o  nsload.o    nssearch.o  nsxfeval.o \
	 nsalloc.o   nseval.o    nsnames.o   nsutils.o   nsxfname.o \
	 nsdump.o    nsinit.o    nsobject.o  nswalk.o    nsxfobj.o  \
	 nsparse.o
	 nsparse.o   nspredef.o

obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o

+32 −3
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ ACPI_MODULE_NAME("nseval")
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
{
	acpi_status status;
	struct acpi_namespace_node *node;

	ACPI_FUNCTION_TRACE(ns_evaluate);

@@ -117,6 +118,8 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
			  info->resolved_node,
			  acpi_ns_get_attached_object(info->resolved_node)));

	node = info->resolved_node;

	/*
	 * Two major cases here:
	 *
@@ -261,9 +264,35 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
		}
	}

	/* Validation of return values for ACPI-predefined methods and objects */

	if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) {
		/*
		 * If this is the first evaluation, check the return value. This
		 * ensures that any warnings will only be emitted during the very
		 * first evaluation of the object.
		 */
		if (!(node->flags & ANOBJ_EVALUATED)) {
			/*
	 * Check if there is a return value that must be dealt with
			 * Check for a predefined ACPI name. If found, validate the
			 * returned object.
			 *
			 * Note: Ignore return status for now, emit warnings if there are
			 * problems with the returned object. May change later to abort
			 * the method on invalid return object.
			 */
			(void)acpi_ns_check_predefined_names(node,
							     info->
							     return_object);
		}

		/* Mark the node as having been evaluated */

		node->flags |= ANOBJ_EVALUATED;
	}

	/* Check if there is a return value that must be dealt with */

	if (status == AE_CTRL_RETURN_VALUE) {

		/* If caller does not want the return value, delete it */
+0 −2
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
	return (AE_OK);
}

#ifdef ACPI_DEBUG_OUTPUT
/*******************************************************************************
 *
 * FUNCTION:    acpi_ns_get_external_pathname
@@ -163,7 +162,6 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)

	return_PTR(name_buffer);
}
#endif

/*******************************************************************************
 *
+900 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -154,6 +154,10 @@ void
acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
				struct acpi_walk_state *walk_state);

void acpi_db_check_predefined_names(void);

void acpi_db_batch_execute(void);

/*
 * dbexec - debugger control method execution
 */
Loading