]> git.hungrycats.org Git - linux/commitdiff
[ACPI] CONFIG_ACPI_RELAXED_AML from 2.4
authorLen Brown <len.brown@intel.com>
Mon, 29 Sep 2003 08:32:13 +0000 (04:32 -0400)
committerLen Brown <len.brown@intel.com>
Mon, 29 Sep 2003 08:32:13 +0000 (04:32 -0400)
http://bugzilla.kernel.org/show_bug.cgi?id=1248

drivers/acpi/Kconfig
drivers/acpi/executer/exfldio.c

index ccf141ce31d4f15e0cdd2393005ad563b2594a68..59710a1227fe1a8a121ef6ee0baecfec4adcf44a 100644 (file)
@@ -281,5 +281,17 @@ config ACPI_EFI
        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
 
index e3173033472e57920c8cc52039ca36e12fb7c11e..7370bb7c714555e8ca38841b6fd603a4d50ac7fa 100644 (file)
@@ -139,7 +139,41 @@ acpi_ex_setup_region (
                        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);