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

Commit f79c8e41 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: Namespace: simplify creation of the initial/default namespace

ACPICA commit 76658f55d8cc498a763bdb92f8e0d934822a129c

For the objects that are created by default (_GPE, _SB_, etc)
there is no need to use the heavyweight ns_lookup function.
Instead, simply create each object and link it in as the namespace
is built.

Link: https://github.com/acpica/acpica/commit/76658f55


Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarErik Schmauss <erik.schmauss@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d4ca763e
Loading
Loading
Loading
Loading
+43 −11
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ acpi_status acpi_ns_root_initialize(void)
	acpi_status status;
	const struct acpi_predefined_names *init_val = NULL;
	struct acpi_namespace_node *new_node;
	struct acpi_namespace_node *prev_node = NULL;
	union acpi_operand_object *obj_desc;
	acpi_string val = NULL;

@@ -61,12 +62,28 @@ acpi_status acpi_ns_root_initialize(void)
	 */
	acpi_gbl_root_node = &acpi_gbl_root_node_struct;

	/* Enter the pre-defined names in the name table */
	/* Enter the predefined names in the name table */

	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
			  "Entering predefined entries into namespace\n"));

	/*
	 * Create the initial (default) namespace.
	 * This namespace looks like something similar to this:
	 *
	 *   ACPI Namespace (from Namespace Root):
	 *    0  _GPE Scope        00203160 00
	 *    0  _PR_ Scope        002031D0 00
	 *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
	 *    0  _SI_ Scope        002032B0 00
	 *    0  _TZ_ Device       00203320 00
	 *    0  _REV Integer      00203390 00 = 0000000000000002
	 *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
	 *    0  _GL_ Mutex        00203580 00 Object 002035F0
	 *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
	 */
	for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
		status = AE_OK;

		/* _OSI is optional for now, will be permanent later */

@@ -75,17 +92,32 @@ acpi_status acpi_ns_root_initialize(void)
			continue;
		}

		status =
		    acpi_ns_lookup(NULL, ACPI_CAST_PTR(char, init_val->name),
				   init_val->type, ACPI_IMODE_LOAD_PASS2,
				   ACPI_NS_NO_UPSEARCH, NULL, &new_node);
		if (ACPI_FAILURE(status)) {
			ACPI_EXCEPTION((AE_INFO, status,
					"Could not create predefined name %s",
					init_val->name));
			continue;
		/*
		 * Create, init, and link the new predefined name
		 * Note: No need to use acpi_ns_lookup here because all the
		 * predefined names are at the root level. It is much easier to
		 * just create and link the new node(s) here.
		 */
		new_node =
		    ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node));
		if (!new_node) {
			status = AE_NO_MEMORY;
			goto unlock_and_exit;
		}

		ACPI_COPY_NAMESEG(new_node->name.ascii, init_val->name);
		new_node->descriptor_type = ACPI_DESC_TYPE_NAMED;
		new_node->type = init_val->type;

		if (!prev_node) {
			acpi_gbl_root_node_struct.child = new_node;
		} else {
			prev_node->peer = new_node;
		}

		new_node->parent = &acpi_gbl_root_node_struct;
		prev_node = new_node;

		/*
		 * Name entered successfully. If entry in pre_defined_names[] specifies
		 * an initial value, create the initial value.
@@ -131,7 +163,7 @@ acpi_status acpi_ns_root_initialize(void)

				new_node->value = obj_desc->method.param_count;
#else
				/* Mark this as a very SPECIAL method */
				/* Mark this as a very SPECIAL method (_OSI) */

				obj_desc->method.info_flags =
				    ACPI_METHOD_INTERNAL_ONLY;