From a18ecf413ca9846becb760f7f990c2c62c15965e Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Mon, 15 Aug 2005 03:42:00 -0800 Subject: [ACPI] ACPICA 20050815 Implemented a full bytewise compare to determine if a table load request is attempting to load a duplicate table. The compare is performed if the table signatures and table lengths match. This will allow different tables with the same OEM Table ID and revision to be loaded. Although the BIOS is technically violating the ACPI spec when this happens -- it does happen -- so Linux must handle it. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/tables/tbutils.c | 24 +++++++++++++++++------- drivers/acpi/utilities/utdebug.c | 4 ++-- drivers/acpi/utilities/utmisc.c | 6 +++++- 3 files changed, 24 insertions(+), 10 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 5bcafebb9dd..4b2fbb592f4 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -80,14 +80,24 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) /* Examine all installed tables of this type */ while (table_desc) { - /* Compare Revision and oem_table_id */ - + /* + * If the table lengths match, perform a full bytewise compare. This + * means that we will allow tables with duplicate oem_table_id(s), as + * long as the tables are different in some way. + * + * Checking if the table has been loaded into the namespace means that + * we don't check for duplicate tables during the initial installation + * of tables within the RSDT/XSDT. + */ if ((table_desc->loaded_into_namespace) && - (table_desc->pointer->revision == - new_table_desc->pointer->revision) && - (!ACPI_MEMCMP(table_desc->pointer->oem_table_id, - new_table_desc->pointer->oem_table_id, 8))) { - /* This table is already installed */ + (table_desc->pointer->length == + new_table_desc->pointer->length) + && + (!ACPI_MEMCMP + ((const char *)table_desc->pointer, + (const char *)new_table_desc->pointer, + (acpi_size) new_table_desc->pointer->length))) { + /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 081a778aba8..d80e9263993 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -122,13 +122,13 @@ static const char *acpi_ut_trim_function_name(const char *function_name) /* All Function names are longer than 4 chars, check is safe */ - if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX1) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { /* This is the case where the original source has not been modified */ return (function_name + 4); } - if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_FUNCTION_PREFIX2) { + if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { /* This is the case where the source has been 'linuxized' */ return (function_name + 5); diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 474fe7cb6c0..f0275025b71 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -78,6 +78,10 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) for (i = 0; i < 32; i++) { if (!(acpi_gbl_owner_id_mask & (1 << i))) { + ACPI_DEBUG_PRINT((ACPI_DB_VALUES, + "Current owner_id mask: %8.8X New ID: %2.2X\n", + acpi_gbl_owner_id_mask, (i + 1))); + acpi_gbl_owner_id_mask |= (1 << i); *owner_id = (acpi_owner_id) (i + 1); goto exit; @@ -119,7 +123,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) acpi_owner_id owner_id = *owner_id_ptr; acpi_status status; - ACPI_FUNCTION_TRACE("ut_release_owner_id"); + ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); /* Always clear the input owner_id (zero is an invalid ID) */ -- cgit v1.2.3