From 61686124f47d7c4b78610346c5f8f9d8a6d46bb5 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 17 Mar 2006 16:44:00 -0500 Subject: [ACPI] ACPICA 20060317 Implemented the use of a cache object for all internal namespace nodes. Since there are about 1000 static nodes in a typical system, this will decrease memory use for cache implementations that minimize per-allocation overhead (such as a slab allocator.) Removed the reference count mechanism for internal namespace nodes, since it was deemed unnecessary. This reduces the size of each namespace node by about 5%-10% on all platforms. Nodes are now 20 bytes for the 32-bit case, and 32 bytes for the 64-bit case. Optimized several internal data structures to reduce object size on 64-bit platforms by packing data within the 64-bit alignment. This includes the frequently used ACPI_OPERAND_OBJECT, of which there can be ~1000 static instances corresponding to the namespace objects. Added two new strings for the predefined _OSI method: "Windows 2001.1 SP1" and "Windows 2006". Split the allocation tracking mechanism out to a separate file, from utalloc.c to uttrack.c. This mechanism appears to be only useful for application-level code. Kernels may wish to not include uttrack.c in distributions. Removed all remnants of the obsolete ACPI_REPORT_* macros and the associated code. (These macros have been replaced by the ACPI_ERROR and ACPI_WARNING macros.) Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/resources/rslist.c | 110 ++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 71 deletions(-) (limited to 'drivers/acpi/resources/rslist.c') diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 6f2d8de39523..50bbb19bf4ae 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -51,92 +51,60 @@ ACPI_MODULE_NAME("rslist") * * FUNCTION: acpi_rs_convert_aml_to_resources * - * PARAMETERS: Aml - Pointer to the resource byte stream - * aml_length - Length of Aml - * output_buffer - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: acpi_walk_aml_callback + * resource_ptr - Pointer to the buffer that will + * contain the output structures * * RETURN: Status * - * DESCRIPTION: Takes the resource byte stream and parses it, creating a - * linked list of resources in the caller's output buffer + * DESCRIPTION: Convert an AML resource to an internal representation of the + * resource that is aligned and easier to access. * ******************************************************************************/ acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) +acpi_rs_convert_aml_to_resources(u8 * aml, + u32 length, + u32 offset, + u8 resource_index, void **resource_ptr) { - struct acpi_resource *resource = (void *)output_buffer; + struct acpi_resource *resource = *resource_ptr; acpi_status status; - u8 resource_index; - u8 *end_aml; ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); - end_aml = aml + aml_length; - - /* Loop until end-of-buffer or an end_tag is found */ - - while (aml < end_aml) { - /* - * Check that the input buffer and all subsequent pointers into it - * are aligned on a native word boundary. Most important on IA64 - */ - if (ACPI_IS_MISALIGNED(resource)) { - ACPI_WARNING((AE_INFO, - "Misaligned resource pointer %p", - resource)); - } - - /* Validate the Resource Type and Resource Length */ - - status = acpi_ut_validate_resource(aml, &resource_index); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Convert the AML byte stream resource to a local resource struct */ - - status = - acpi_rs_convert_aml_to_resource(resource, - ACPI_CAST_PTR(union - aml_resource, - aml), - acpi_gbl_get_resource_dispatch - [resource_index]); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Could not convert AML resource (Type %X)", - *aml)); - return_ACPI_STATUS(status); - } - - ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, - "Type %.2X, Aml %.2X internal %.2X\n", - acpi_ut_get_resource_type(aml), - acpi_ut_get_descriptor_length(aml), - resource->length)); - - /* Normal exit on completion of an end_tag resource descriptor */ - - if (acpi_ut_get_resource_type(aml) == - ACPI_RESOURCE_NAME_END_TAG) { - return_ACPI_STATUS(AE_OK); - } - - /* Point to the next input AML resource */ - - aml += acpi_ut_get_descriptor_length(aml); - - /* Point to the next structure in the output buffer */ + /* + * Check that the input buffer and all subsequent pointers into it + * are aligned on a native word boundary. Most important on IA64 + */ + if (ACPI_IS_MISALIGNED(resource)) { + ACPI_WARNING((AE_INFO, + "Misaligned resource pointer %p", resource)); + } - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); + /* Convert the AML byte stream resource to a local resource struct */ + + status = + acpi_rs_convert_aml_to_resource(resource, + ACPI_CAST_PTR(union aml_resource, + aml), + acpi_gbl_get_resource_dispatch + [resource_index]); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert AML resource (Type %X)", + *aml)); + return_ACPI_STATUS(status); } - /* Did not find an end_tag resource descriptor */ + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "Type %.2X, aml_length %.2X internal_length %.2X\n", + acpi_ut_get_resource_type(aml), length, + resource->length)); - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + /* Point to the next structure in the output buffer */ + + *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* -- cgit v1.2.1