Commit 4b813ac8 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] Enable ACPICA workarounds for 'RELAXED_AML' and 'implicit return'

These workarounds are disabled if "acpi=strict"
parent 676ee8a7
...@@ -598,6 +598,10 @@ acpi_early_init (void) ...@@ -598,6 +598,10 @@ acpi_early_init (void)
ACPI_FUNCTION_TRACE("acpi_bus_init"); ACPI_FUNCTION_TRACE("acpi_bus_init");
/* enable workarounds, unless strict ACPI spec. compliance */
if (!acpi_strict)
acpi_gbl_enable_interpreter_slack = TRUE;
status = acpi_initialize_subsystem(); status = acpi_initialize_subsystem();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n"); printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
......
...@@ -102,7 +102,7 @@ acpi_ds_is_result_used ( ...@@ -102,7 +102,7 @@ acpi_ds_is_result_used (
* NOTE: this is optional because the ASL language does not actually * NOTE: this is optional because the ASL language does not actually
* support this behavior. * support this behavior.
*/ */
if ((acpi_gbl_enable_interpeter_slack) && if ((acpi_gbl_enable_interpreter_slack) &&
(walk_state->parser_state.aml >= walk_state->parser_state.aml_end)) { (walk_state->parser_state.aml >= walk_state->parser_state.aml_end)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result of [%s] will be implicitly returned\n", "Result of [%s] will be implicitly returned\n",
......
...@@ -130,7 +130,7 @@ acpi_ex_setup_region ( ...@@ -130,7 +130,7 @@ acpi_ex_setup_region (
if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset
+ field_datum_byte_offset + field_datum_byte_offset
+ obj_desc->common_field.access_byte_width)) { + obj_desc->common_field.access_byte_width)) {
if (acpi_gbl_enable_interpeter_slack) { if (acpi_gbl_enable_interpreter_slack) {
/* /*
* Slack mode only: We will go ahead and allow access to this * Slack mode only: We will go ahead and allow access to this
* field if it is within the region length rounded up to the next * field if it is within the region length rounded up to the next
...@@ -169,40 +169,7 @@ acpi_ex_setup_region ( ...@@ -169,40 +169,7 @@ acpi_ex_setup_region (
field_datum_byte_offset, obj_desc->common_field.access_byte_width, field_datum_byte_offset, obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length));
if (!acpi_strict) { return_ACPI_STATUS (AE_AML_REGION_LIMIT);
/*
* 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);
}
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
......
...@@ -94,7 +94,7 @@ extern u32 acpi_gbl_nesting_level; ...@@ -94,7 +94,7 @@ extern u32 acpi_gbl_nesting_level;
* interpreter strictly follows the ACPI specification. Setting to TRUE * interpreter strictly follows the ACPI specification. Setting to TRUE
* allows the interpreter to forgive certain bad AML constructs. * allows the interpreter to forgive certain bad AML constructs.
*/ */
ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpeter_slack, FALSE); ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE);
/* /*
* Automatically serialize ALL control methods? Default is FALSE, meaning * Automatically serialize ALL control methods? Default is FALSE, meaning
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment