drivers/acpi/property.c

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

File Facts

System
Linux kernel
Corpus path
drivers/acpi/property.c
Extension
.c
Size
47834 bytes
Lines
1783
Domain
Driver Families
Bucket
drivers/acpi
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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

switch (link->package.elements[1].type) {
		case ACPI_TYPE_STRING:
			/*
			 * The string is expected to be a full pathname or a
			 * pathname segment relative to the given scope.  That
			 * pathname is expected to point to an object returning
			 * a package that contains _DSD-equivalent information.
			 */
			result = acpi_nondev_subnode_ok(scope, link, list,
							 parent);
			break;
		case ACPI_TYPE_PACKAGE:
			/*
			 * This happens when a reference is used in AML to
			 * point to the target.  Since the target is expected
			 * to be a named object, a reference to it will cause it
			 * to be avaluated in place and its return package will
			 * be embedded in the links package at the location of
			 * the reference.
			 *
			 * The target package is expected to contain _DSD-
			 * equivalent information, but the scope in which it
			 * is located in the original AML is unknown.  Thus
			 * it cannot contain pathname segments represented as
			 * strings because there is no way to build full
			 * pathnames out of them.
			 */
			acpi_handle_debug(scope, "subnode %s: Unknown scope\n",
					  link->package.elements[0].string.pointer);
			desc = &link->package.elements[1];
			result = acpi_nondev_subnode_extract(desc, NULL, link,
							     list, parent);
			break;
		case ACPI_TYPE_LOCAL_REFERENCE:
			/*
			 * It is not expected to see any local references in
			 * the links package because referencing a named object
			 * should cause it to be evaluated in place.
			 */
			acpi_handle_info(scope, "subnode %s: Unexpected reference\n",
					 link->package.elements[0].string.pointer);
			fallthrough;
		default:
			result = false;
			break;
		}
		ret = ret || result;
	}

	return ret;
}

static bool acpi_enumerate_nondev_subnodes(acpi_handle scope,
					   union acpi_object *desc,
					   struct acpi_device_data *data,
					   struct fwnode_handle *parent)
{
	int i;

	/* Look for the ACPI data subnodes GUID. */
	for (i = 0; i < desc->package.count; i += 2) {
		const union acpi_object *guid;
		union acpi_object *links;

		guid = &desc->package.elements[i];
		links = &desc->package.elements[i + 1];

		/*
		 * The first element must be a GUID and the second one must be
		 * a package.
		 */
		if (guid->type != ACPI_TYPE_BUFFER ||
		    guid->buffer.length != 16 ||
		    links->type != ACPI_TYPE_PACKAGE)
			break;

		if (!guid_equal((guid_t *)guid->buffer.pointer, &ads_guid))
			continue;

		return acpi_add_nondev_subnodes(scope, links, &data->subnodes,
						parent);
	}

	return false;
}

static bool acpi_property_value_ok(const union acpi_object *value)
{
	int j;

Annotation

Implementation Notes