diff -u -r linux-2.4.20+acpi-20021205/Documentation/Configure.help linux-2.4.20+acpi-20021205+rick/Documentation/Configure.help --- linux-2.4.20+acpi-20021205/Documentation/Configure.help 2002-12-12 14:25:15.000000000 -0600 +++ linux-2.4.20+acpi-20021205+rick/Documentation/Configure.help 2002-12-12 13:42:40.000000000 -0600 @@ -18406,6 +18406,14 @@ of verbosity. Saying Y enables these statements. This will increase your kernel size by around 50K. +ACPI Relaxed AML Checking +CONFIG_ACPI_RELAXED_AML + 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 laptps may require this option. In + particular, many Toshiba laptops require this for correct operation + of the AC module. + ACPI Bus Manager CONFIG_ACPI_BUSMGR The ACPI Bus Manager enumerates devices in the ACPI namespace, and diff -u -r linux-2.4.20+acpi-20021205/drivers/acpi/Config.in linux-2.4.20+acpi-20021205+rick/drivers/acpi/Config.in --- linux-2.4.20+acpi-20021205/drivers/acpi/Config.in 2002-12-07 08:11:29.000000000 -0600 +++ linux-2.4.20+acpi-20021205+rick/drivers/acpi/Config.in 2002-12-12 13:31:23.000000000 -0600 @@ -36,6 +36,7 @@ fi tristate ' Toshiba Laptop Extras' CONFIG_ACPI_TOSHIBA bool ' Debug Statements' CONFIG_ACPI_DEBUG + bool ' Relaxed AML Checking' CONFIG_ACPI_RELAXED_AML fi fi diff -u -r linux-2.4.20+acpi-20021205/drivers/acpi/executer/exfldio.c linux-2.4.20+acpi-20021205+rick/drivers/acpi/executer/exfldio.c --- linux-2.4.20+acpi-20021205/drivers/acpi/executer/exfldio.c 2002-12-07 08:11:30.000000000 -0600 +++ linux-2.4.20+acpi-20021205+rick/drivers/acpi/executer/exfldio.c 2002-12-13 13:18:28.000000000 -0600 @@ -121,7 +121,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);