drivers/acpi/acpica/rscreate.c

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

File Facts

System
Linux kernel
Corpus path
drivers/acpi/acpica/rscreate.c
Extension
.c
Size
13493 bytes
Lines
449
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

if ((*top_object_list)->package.count != 4) {
			ACPI_ERROR((AE_INFO,
				    "(PRT[%u]) Need package of length 4, found length %u",
				    index, (*top_object_list)->package.count));
			return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT);
		}

		/*
		 * Dereference the subpackage.
		 * The sub_object_list will now point to an array of the four IRQ
		 * elements: [Address, Pin, Source, source_index]
		 */
		sub_object_list = (*top_object_list)->package.elements;

		/* 1) First subobject: Dereference the PRT.Address */

		obj_desc = sub_object_list[0];
		if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) {
			ACPI_ERROR((AE_INFO,
				    "(PRT[%u].Address) Need Integer, found %s",
				    index,
				    acpi_ut_get_object_type_name(obj_desc)));
			return_ACPI_STATUS(AE_BAD_DATA);
		}

		user_prt->address = obj_desc->integer.value;

		/* 2) Second subobject: Dereference the PRT.Pin */

		obj_desc = sub_object_list[1];
		if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) {
			ACPI_ERROR((AE_INFO,
				    "(PRT[%u].Pin) Need Integer, found %s",
				    index,
				    acpi_ut_get_object_type_name(obj_desc)));
			return_ACPI_STATUS(AE_BAD_DATA);
		}

		user_prt->pin = (u32) obj_desc->integer.value;

		/*
		 * 3) Third subobject: Dereference the PRT.source_name
		 * The name may be unresolved (slack mode), so allow a null object
		 */
		obj_desc = sub_object_list[2];
		if (obj_desc) {
			switch (obj_desc->common.type) {
			case ACPI_TYPE_LOCAL_REFERENCE:

				if (obj_desc->reference.class !=
				    ACPI_REFCLASS_NAME) {
					ACPI_ERROR((AE_INFO,
						    "(PRT[%u].Source) Need name, found Reference Class 0x%X",
						    index,
						    obj_desc->reference.class));
					return_ACPI_STATUS(AE_BAD_DATA);
				}

				node = obj_desc->reference.node;

				/* Use *remaining* length of the buffer as max for pathname */

				path_buffer.length = output_buffer->length -
				    (u32) ((u8 *) user_prt->source -
					   (u8 *) output_buffer->pointer);
				path_buffer.pointer = user_prt->source;

				status = acpi_ns_handle_to_pathname((acpi_handle)node, &path_buffer, FALSE);
				if (ACPI_FAILURE(status)) {
					return_ACPI_STATUS(status);
				}

				/* +1 to include null terminator */

				user_prt->length +=
				    (u32)strlen(user_prt->source) + 1;
				break;

			case ACPI_TYPE_STRING:

				strcpy(user_prt->source,
				       obj_desc->string.pointer);

				/*
				 * Add to the Length field the length of the string
				 * (add 1 for terminator)
				 */
				user_prt->length += obj_desc->string.length + 1;
				break;

Annotation

Implementation Notes