Commit 45dcd315 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki

Cleanup of invalid ACPI name handling and repair

 Implemented a change/cleanup for the handling of invalid ACPI names.
 Names are now validated and repaired only when
 1) entering a new name into the namespace and
 2) disassembling a named AML opcode. A warning is only displayed in
    debug mode or when the interpreter is in "strict" mode, since some
    working machines do in fact contain invalid ACPI names.
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 77b67063
......@@ -483,7 +483,7 @@ void acpi_ut_print_string(char *string, u8 max_length);
u8 acpi_ut_valid_acpi_name(u32 name);
acpi_name acpi_ut_repair_name(char *name);
void acpi_ut_repair_name(char *name);
u8 acpi_ut_valid_acpi_char(char character, u32 position);
......
......@@ -209,14 +209,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
"Invalid ACPI Object Type 0x%08X", type));
}
if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
this_node->name.integer =
acpi_ut_repair_name(this_node->name.ascii);
ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
this_node->name.integer));
}
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
}
......
......@@ -314,22 +314,7 @@ acpi_ns_search_and_enter(u32 target_name,
* this problem, and we want to be able to enable ACPI support for them,
* even though there are a few bad names.
*/
if (!acpi_ut_valid_acpi_name(target_name)) {
target_name =
acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
/* Report warning only if in strict mode or debug mode */
if (!acpi_gbl_enable_interpreter_slack) {
ACPI_WARNING((AE_INFO,
"Found bad character(s) in name, repaired: [%4.4s]\n",
ACPI_CAST_PTR(char, &target_name)));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Found bad character(s) in name, repaired: [%4.4s]\n",
ACPI_CAST_PTR(char, &target_name)));
}
}
acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
/* Try to find the name in the namespace level specified by the caller */
......
......@@ -642,25 +642,43 @@ u8 acpi_ut_valid_acpi_name(u32 name)
*
******************************************************************************/
acpi_name acpi_ut_repair_name(char *name)
void acpi_ut_repair_name(char *name)
{
u32 i;
char new_name[ACPI_NAME_SIZE];
u32 i;
u8 found_bad_char = FALSE;
ACPI_FUNCTION_NAME(ut_repair_name);
/* Check each character in the name */
for (i = 0; i < ACPI_NAME_SIZE; i++) {
new_name[i] = name[i];
if (acpi_ut_valid_acpi_char(name[i], i)) {
continue;
}
/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* names in the namespace.
*/
if (!acpi_ut_valid_acpi_char(name[i], i)) {
new_name[i] = '*';
}
name[i] = '*';
found_bad_char = TRUE;
}
return (*(u32 *) new_name);
if (found_bad_char) {
/* Report warning only if in strict mode or debug mode */
if (!acpi_gbl_enable_interpreter_slack) {
ACPI_WARNING((AE_INFO,
"Found bad character(s) in name, repaired: [%4.4s]\n",
name));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Found bad character(s) in name, repaired: [%4.4s]\n",
name));
}
}
}
/*******************************************************************************
......
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