ACPICA Release 20091013 linuxized patches
Subsystems (2)
Hi, Len
ACPICA Release 20091013 linuxized patches attached. Applied cleanly to linux-acpi-2.6/test branch.
[PATCH 1/4] ACPICA: Add repair for bad _BIF/_BIX packages [PATCH 2/4] ACPICA: Add repair for bad _MAT buffers
[PATCH 3/4] ACPICA: Remove possibility of executing _REG methods twice [PATCH 4/4] ACPICA: Fix possible memory leak for Scope ASL operator
Lin Ming
Quoted 1 line
From
dfdef8feb985a917248d7a2557253e989d895735Mon Sep 17 00:00:00 2001
From: Bob Moore <[email protected]>
Date: Tue, 13 Oct 2009 10:20:33 +0800
Subject: [PATCH 1/4] ACPICA: Add repair for bad _BIF/_BIX packages
Add a repair for the "Oem Information" field which is often mistakenly returned as an integer. It should always be a string. ACPICA BZ 807.
http://www.acpica.org/bugzilla/show_bug.cgi?id=807
--- drivers/acpi/acpica/nsrepair.c | 91 ++++++++++++++++++++++++++++----------- 1 files changed, 65 insertions(+), 26 deletions(-)
drivers/acpi/acpica/nsrepair.c +65 -26
@@ -77,6 +77,11 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,union acpi_operand_object *new_object;acpi_size length; +/* +* At this point, we know that the type of the returned object was not +* one of the expected types for this predefined name. Attempt to +* repair the object. Only a limited number of repairs are possible. +*/ switch (return_object->common.type) {case ACPI_TYPE_BUFFER :
@@ -111,43 +116,77 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,*/ ACPI_MEMCPY (new_object->string.pointer, return_object->buffer.pointer, length); +break ; -/* -* If the original object is a package element, we need to: -* 1. Set the reference count of the new object to match the -* reference count of the old object. -* 2. Decrement the reference count of the original object. -*/ -if (package_index !=ACPI_NOT_PACKAGE_ELEMENT ) { - new_object->common.reference_count = - return_object->common.reference_count; +case ACPI_TYPE_INTEGER : + +/* Does the method/object legally return a string? */ -if (return_object->common.reference_count >1 ) { - return_object->common.reference_count--; +if (expected_btypes &ACPI_RTYPE_STRING ) { +/* +* The only supported Integer-to-String conversion is to convert +* an integer of value 0 to a NULL string. The last element of +* _BIF and _BIX packages occasionally need this fix. +*/ +if (return_object->integer.value !=0 ) { +return (AE_AML_OPERAND_TYPE ); } -ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, - data->node_flags, -"Converted Buffer to expected String at index %u" , - package_index)); +/* Allocate a new NULL string object */ + + new_object =acpi_ut_create_string_object (0 ); +if (!new_object) { +return (AE_NO_MEMORY ); + } }else { -ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, - data->node_flags, -"Converted Buffer to expected String" )); +return (AE_AML_OPERAND_TYPE ); } +break ; -/* Delete old object, install the new return object */ +default : -acpi_ut_remove_reference (return_object); - *return_object_ptr = new_object; - data->flags |=ACPI_OBJECT_REPAIRED ; -return (AE_OK ); +/* We cannot repair this object */ -default : -break ; +return (AE_AML_OPERAND_TYPE ); + } + +/* Object was successfully repaired */ + +/* +* If the original object is a package element, we need to: +* 1. Set the reference count of the new object to match the +* reference count of the old object. +* 2. Decrement the reference count of the original object. +*/ +if (package_index !=ACPI_NOT_PACKAGE_ELEMENT ) { + new_object->common.reference_count = + return_object->common.reference_count; + +if (return_object->common.reference_count >1 ) { + return_object->common.reference_count--; + } + +ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, data->node_flags, +"Converted %s to expected %s at index %u" , +acpi_ut_get_object_type_name + (return_object), +acpi_ut_get_object_type_name (new_object), + package_index)); + }else { +ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, data->node_flags, +"Converted %s to expected %s" , +acpi_ut_get_object_type_name + (return_object), +acpi_ut_get_object_type_name + (new_object))); } -return (AE_AML_OPERAND_TYPE ); +/* Delete old object, install the new return object */ + +acpi_ut_remove_reference (return_object); + *return_object_ptr = new_object; + data->flags |=ACPI_OBJECT_REPAIRED ; +return (AE_OK ); }/*******************************************************************************
Quoted 1 line
From
953b94cee310120af1db235b272f2fa03b00a3c2Mon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:23:20 +0800
Subject: [PATCH 2/4] ACPICA: Add repair for bad _MAT buffers
_MAT can inadvertently return an Integer instead of a Buffer if the return value has been read from a Field whose width is less than or equal to the global integer width (32 or 64 bits). ACPICA BZ 810.
http://www.acpica.org/bugzilla/show_bug.cgi?id=810
--- drivers/acpi/acpica/nsrepair.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
drivers/acpi/acpica/nsrepair.c +21 -2
@@ -44,6 +44,7 @@#include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" +#include "acinterp.h" #include "acpredef.h" #define _COMPONENT ACPI_NAMESPACE
@@ -76,6 +77,7 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,union acpi_operand_object *return_object = *return_object_ptr;union acpi_operand_object *new_object;acpi_size length; +acpi_status status;/* * At this point, we know that the type of the returned object was not
@@ -120,9 +122,26 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,case ACPI_TYPE_INTEGER : -/* Does the method/object legally return a string? */ +/* 1) Does the method/object legally return a buffer? */ + +if (expected_btypes &ACPI_RTYPE_BUFFER ) { +/* +* Convert the Integer to a packed-byte buffer. _MAT needs +* this sometimes, if a read has been performed on a Field +* object that is less than or equal to the global integer +* size (32 or 64 bits). +*/ + status = +acpi_ex_convert_to_buffer (return_object, + &new_object); +if (ACPI_FAILURE (status)) { +return (status); + } + } + +/* 2) Does the method/object legally return a string? */ -if (expected_btypes &ACPI_RTYPE_STRING ) { +else if (expected_btypes &ACPI_RTYPE_STRING ) {/* * The only supported Integer-to-String conversion is to convert * an integer of value 0 to a NULL string. The last element of
Quoted 1 line
From
7084f212b1c51eb4e43267abce678c9a89b3c5afMon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:29:30 +0800
Subject: [PATCH 3/4] ACPICA: Remove possibility of executing _REG methods twice
If a custom address space handler is installed by the host before the "initialize operation regions" phase of the ACPICA initialization, any _REG methods for that address space could be executed twice. This change fixes the problem. ACPICA BZ 427.
http://www.acpica.org/bugzilla/show_bug.cgi?id=427
--- drivers/acpi/acpica/evregion.c | 64 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 5 deletions(-)
drivers/acpi/acpica/evregion.c +59 -5
83 lines not on this page · raw message
Quoted 1 line
From
2d3b7803e3f82fc35dacc4267f0b24e190b60504Mon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:34:56 +0800
Subject: [PATCH 4/4] ACPICA: Fix possible memory leak for Scope ASL operator
Using Scope(\) to change the scope to the root could cause a single object memory leak.
--- drivers/acpi/acpica/dswload.c | 50 +++++++++++++++++++++++++++-------------- 1 files changed, 33 insertions(+), 17 deletions(-)
drivers/acpi/acpica/dswload.c +33 -17
59 lines not on this page · raw message
Missed the release number patch.
Please use this one instead.
[PATCH 1/5] ACPICA: Add repair for bad _BIF/_BIX packages [PATCH 2/5] ACPICA: Add repair for bad _MAT buffers
[PATCH 3/5] ACPICA: Remove possibility of executing _REG methods twice [PATCH 4/5] ACPICA: Fix possible memory leak for Scope ASL operator [PATCH 5/5] ACPICA: Update version to 20091013
Thanks,
Lin Ming
Quoted 5 lines · Lin Ming
Hi, Len
ACPICA Release 20091013 linuxized patches attached. Applied cleanly to linux-acpi-2.6/test branch.
Quoted 7 lines
[PATCH 1/4] ACPICA: Add repair for bad _BIF/_BIX packages [PATCH 2/4] ACPICA: Add repair for bad
_MATbuffers
[PATCH 3/4] ACPICA: Remove possibility of executing_REGmethods twice [PATCH 4/4] ACPICA: Fix possible memory leak for Scope ASL operatorLin Ming
Fromd46aca2cf70bb17e9edb661b3d59b57c11322c48Mon Sep 17 00:00:00 2001
From: Bob Moore <[email protected]>
Date: Tue, 13 Oct 2009 10:20:33 +0800
Subject: [PATCH 1/5] ACPICA: Add repair for bad _BIF/_BIX packages
Add a repair for the "Oem Information" field which is often mistakenly returned as an integer. It should always be a string. ACPICA BZ 807.
http://www.acpica.org/bugzilla/show_bug.cgi?id=807
--- drivers/acpi/acpica/nsrepair.c | 91 ++++++++++++++++++++++++++++----------- 1 files changed, 65 insertions(+), 26 deletions(-)
drivers/acpi/acpica/nsrepair.c +65 -26
@@ -77,6 +77,11 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,union acpi_operand_object *new_object;acpi_size length; +/* +* At this point, we know that the type of the returned object was not +* one of the expected types for this predefined name. Attempt to +* repair the object. Only a limited number of repairs are possible. +*/ switch (return_object->common.type) {case ACPI_TYPE_BUFFER :
@@ -111,43 +116,77 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,*/ ACPI_MEMCPY (new_object->string.pointer, return_object->buffer.pointer, length); +break ; -/* -* If the original object is a package element, we need to: -* 1. Set the reference count of the new object to match the -* reference count of the old object. -* 2. Decrement the reference count of the original object. -*/ -if (package_index !=ACPI_NOT_PACKAGE_ELEMENT ) { - new_object->common.reference_count = - return_object->common.reference_count; +case ACPI_TYPE_INTEGER : + +/* Does the method/object legally return a string? */ -if (return_object->common.reference_count >1 ) { - return_object->common.reference_count--; +if (expected_btypes &ACPI_RTYPE_STRING ) { +/* +* The only supported Integer-to-String conversion is to convert +* an integer of value 0 to a NULL string. The last element of +* _BIF and _BIX packages occasionally need this fix. +*/ +if (return_object->integer.value !=0 ) { +return (AE_AML_OPERAND_TYPE ); } -ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, - data->node_flags, -"Converted Buffer to expected String at index %u" , - package_index)); +/* Allocate a new NULL string object */ + + new_object =acpi_ut_create_string_object (0 ); +if (!new_object) { +return (AE_NO_MEMORY ); + } }else { -ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, - data->node_flags, -"Converted Buffer to expected String" )); +return (AE_AML_OPERAND_TYPE ); } +break ; -/* Delete old object, install the new return object */ +default : -acpi_ut_remove_reference (return_object); - *return_object_ptr = new_object; - data->flags |=ACPI_OBJECT_REPAIRED ; -return (AE_OK ); +/* We cannot repair this object */ -default : -break ; +return (AE_AML_OPERAND_TYPE ); + } + +/* Object was successfully repaired */ + +/* +* If the original object is a package element, we need to: +* 1. Set the reference count of the new object to match the +* reference count of the old object. +* 2. Decrement the reference count of the original object. +*/ +if (package_index !=ACPI_NOT_PACKAGE_ELEMENT ) { + new_object->common.reference_count = + return_object->common.reference_count; + +if (return_object->common.reference_count >1 ) { + return_object->common.reference_count--; + } + +ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, data->node_flags, +"Converted %s to expected %s at index %u" , +acpi_ut_get_object_type_name + (return_object), +acpi_ut_get_object_type_name (new_object), + package_index)); + }else { +ACPI_WARN_PREDEFINED ((AE_INFO , data->pathname, data->node_flags, +"Converted %s to expected %s" , +acpi_ut_get_object_type_name + (return_object), +acpi_ut_get_object_type_name + (new_object))); } -return (AE_AML_OPERAND_TYPE ); +/* Delete old object, install the new return object */ + +acpi_ut_remove_reference (return_object); + *return_object_ptr = new_object; + data->flags |=ACPI_OBJECT_REPAIRED ; +return (AE_OK ); }/*******************************************************************************
Quoted 1 line
From
eec5343132b1d1dd3945d587e96df89723d5c6e5Mon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:23:20 +0800
Subject: [PATCH 2/5] ACPICA: Add repair for bad _MAT buffers
_MAT can inadvertently return an Integer instead of a Buffer if the return value has been read from a Field whose width is less than or equal to the global integer width (32 or 64 bits). ACPICA BZ 810.
http://www.acpica.org/bugzilla/show_bug.cgi?id=810
--- drivers/acpi/acpica/nsrepair.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
drivers/acpi/acpica/nsrepair.c +21 -2
@@ -44,6 +44,7 @@#include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" +#include "acinterp.h" #include "acpredef.h" #define _COMPONENT ACPI_NAMESPACE
@@ -76,6 +77,7 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,union acpi_operand_object *return_object = *return_object_ptr;union acpi_operand_object *new_object;acpi_size length; +acpi_status status;/* * At this point, we know that the type of the returned object was not
@@ -120,9 +122,26 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,case ACPI_TYPE_INTEGER : -/* Does the method/object legally return a string? */ +/* 1) Does the method/object legally return a buffer? */ + +if (expected_btypes &ACPI_RTYPE_BUFFER ) { +/* +* Convert the Integer to a packed-byte buffer. _MAT needs +* this sometimes, if a read has been performed on a Field +* object that is less than or equal to the global integer +* size (32 or 64 bits). +*/ + status = +acpi_ex_convert_to_buffer (return_object, + &new_object); +if (ACPI_FAILURE (status)) { +return (status); + } + } + +/* 2) Does the method/object legally return a string? */ -if (expected_btypes &ACPI_RTYPE_STRING ) { +else if (expected_btypes &ACPI_RTYPE_STRING ) {/* * The only supported Integer-to-String conversion is to convert * an integer of value 0 to a NULL string. The last element of
Quoted 1 line
From
04c9003fb758d264350e4537df8b71a9cf1edb6dMon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:29:30 +0800
Subject: [PATCH 3/5] ACPICA: Remove possibility of executing _REG methods twice
If a custom address space handler is installed by the host before the "initialize operation regions" phase of the ACPICA initialization, any _REG methods for that address space could be executed twice. This change fixes the problem. ACPICA BZ 427.
http://www.acpica.org/bugzilla/show_bug.cgi?id=427
--- drivers/acpi/acpica/evregion.c | 64 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 5 deletions(-)
drivers/acpi/acpica/evregion.c +59 -5
83 lines not on this page · raw message
Quoted 1 line
From
fa21833ad9b821d8f0c34229b385845591b719f2Mon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Tue, 13 Oct 2009 10:34:56 +0800
Subject: [PATCH 4/5] ACPICA: Fix possible memory leak for Scope ASL operator
Using Scope(\) to change the scope to the root could cause a single object memory leak.
--- drivers/acpi/acpica/dswload.c | 50 +++++++++++++++++++++++++++-------------- 1 files changed, 33 insertions(+), 17 deletions(-)
drivers/acpi/acpica/dswload.c +33 -17
59 lines not on this page · raw message
Quoted 1 line
From
28e7ed759b1f714908edea3aafe3991abbfb73abMon Sep 17 00:00:00 2001
From: Bob Moore <[email protected]>
Date: Wed, 14 Oct 2009 09:01:39 +0800
Subject: [PATCH 5/5] ACPICA: Update version to 20091013
Version 20091013.
--- include/acpi/acpixf.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpixf.h +1 -1
@@ -47,7 +47,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090903 +#define ACPI_CA_VERSION 0x20091013#include "actypes.h" #include "actbl.h"
Len Brown
reviewerapplied to acpi-test
thanks,
Len Brown, Intel Open Source Technology Center