ia64/linux-2.6.18-xen.hg

changeset 677:28419b05401c

ACPI cpufreq fix 1/2

commit 24058054d781934df526be114c612cf2b29cf4e7
Author: Bob Moore <robert.moore@intel.com>
Date: Fri Feb 2 19:48:18 2007 +0300

ACPICA: Handle mis-matched package length

Implement support within the AML interpreter for
package objects that contain a mismatch between the AML
length and package element count. In this case, the lesser
of the two is used. Some BIOS code apparently modifies
the package length on the fly, and this change supports
this. Provides compatibility with the MS AML interpreter.

Signed-off-by: Alexey Starikovskiy
<alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Sep 25 13:06:12 2008 +0100 (2008-09-25)
parents 916aae9cc11a
children 3057b932abea
files drivers/acpi/dispatcher/dsobject.c
line diff
     1.1 --- a/drivers/acpi/dispatcher/dsobject.c	Mon Sep 22 16:08:10 2008 +0100
     1.2 +++ b/drivers/acpi/dispatcher/dsobject.c	Thu Sep 25 13:06:12 2008 +0100
     1.3 @@ -384,9 +384,7 @@ acpi_ds_build_internal_package_obj(struc
     1.4  		obj_desc->package.node = parent->common.node;
     1.5  	}
     1.6  
     1.7 -	obj_desc->package.count = package_length;
     1.8 -
     1.9 -	/* Count the number of items in the package list */
    1.10 +	/* Count the *actual* number of items in the package list */
    1.11  
    1.12  	arg = op->common.value.arg;
    1.13  	arg = arg->common.next;
    1.14 @@ -395,11 +393,24 @@ acpi_ds_build_internal_package_obj(struc
    1.15  	}
    1.16  
    1.17  	/*
    1.18 -	 * The package length (number of elements) will be the greater
    1.19 -	 * of the specified length and the length of the initializer list
    1.20 +	 * The number of elements in the package will be the lesser of the
    1.21 +	 * specified element count and the length of the initializer list.
    1.22 +	 *
    1.23 +	 * Even though the ASL compilers do not allow this to happen (for the
    1.24 +	 * fixed length package opcode), some BIOS code modifies the AML on the
    1.25 +	 * fly to adjust the package length, and this code compensates for that.
    1.26 +	 * This also provides compatibility with other AML interpreters.
    1.27  	 */
    1.28 -	if (package_list_length > package_length) {
    1.29 -		obj_desc->package.count = package_list_length;
    1.30 +	obj_desc->package.count = package_length;
    1.31 +
    1.32 +	if (package_list_length != package_length) {
    1.33 +		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
    1.34 +				  "Package length mismatch, using lesser of %X(Length Arg) and %X(AML Length)\n",
    1.35 +				  package_length, package_list_length));
    1.36 +
    1.37 +		if (package_list_length < package_length) {
    1.38 +			obj_desc->package.count = package_list_length;
    1.39 +		}
    1.40  	}
    1.41  
    1.42  	/*
    1.43 @@ -422,7 +433,7 @@ acpi_ds_build_internal_package_obj(struc
    1.44  	 */
    1.45  	arg = op->common.value.arg;
    1.46  	arg = arg->common.next;
    1.47 -	for (i = 0; arg; i++) {
    1.48 +	for (i = 0; i < obj_desc->package.count; i++) {
    1.49  		if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
    1.50  			if (arg->common.node->type == ACPI_TYPE_METHOD) {
    1.51  				/*