# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1331 -> 1.1332 # drivers/acpi/executer/exfldio.c 1.22 -> 1.23 # drivers/acpi/Kconfig 1.21 -> 1.22 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/29 len.brown@intel.com 1.1332 # [ACPI] CONFIG_ACPI_RELAXED_AML from 2.4 # http://bugzilla.kernel.org/show_bug.cgi?id=1248 # -------------------------------------------- # diff -Nru a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig Mon Sep 29 12:32:16 2003 +++ b/drivers/acpi/Kconfig Mon Sep 29 12:32:16 2003 @@ -281,5 +281,17 @@ depends on IA64 default y +config ACPI_RELAXED_AML + bool + depends on ACPI_INTERPRETER + depends on !IA64_SGI_SN + default n + help + If you say `Y' here, the ACPI interpreter will relax its checking + for valid AML and will ignore some AML mistakes, such as off-by-one + errors in region sizes. Some laptops may require this option. In + particular, many Toshiba laptops require this for correct operation + of the AC module. + endmenu diff -Nru a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c --- a/drivers/acpi/executer/exfldio.c Mon Sep 29 12:32:16 2003 +++ b/drivers/acpi/executer/exfldio.c Mon Sep 29 12:32:16 2003 @@ -139,7 +139,41 @@ field_datum_byte_offset, obj_desc->common_field.access_byte_width, rgn_desc->region.node->name.ascii, rgn_desc->region.length)); - return_ACPI_STATUS (AE_AML_REGION_LIMIT); + #ifdef CONFIG_ACPI_RELAXED_AML + { + /* + * Allow access to the field if it is within the region size + * rounded up to a multiple of the access byte width. This + * overcomes "off-by-one" programming errors in the AML often + * found in Toshiba laptops. These errors were allowed by + * the Microsoft ASL compiler. + */ + u32 rounded_length = ACPI_ROUND_UP(rgn_desc->region.length, + obj_desc->common_field.access_byte_width); + + if (rounded_length < (obj_desc->common_field.base_byte_offset + + field_datum_byte_offset + + obj_desc->common_field.access_byte_width)) { + return_ACPI_STATUS (AE_AML_REGION_LIMIT); + } else { + static int warn_once = 1; + if (warn_once) { + // Could also associate a flag with each field, and + // warn once for each field. + ACPI_REPORT_WARNING(( + "The ACPI AML in your computer contains errors, " + "please nag the manufacturer to correct it.\n")); + ACPI_REPORT_WARNING(( + "Allowing relaxed access to fields; " + "turn on CONFIG_ACPI_DEBUG for details.\n")); + warn_once = 0; + } + return_ACPI_STATUS (AE_OK); + } + } + #else + return_ACPI_STATUS (AE_AML_REGION_LIMIT); + #endif } return_ACPI_STATUS (AE_OK);