ACPICA: Add override for dynamic tables
authorBob Moore <robert.moore@intel.com>
Tue, 3 Feb 2009 06:43:04 +0000 (14:43 +0800)
committerLen Brown <len.brown@intel.com>
Thu, 26 Mar 2009 20:38:20 +0000 (16:38 -0400)
Add a call to acpi_os_table_override during the installation of a
dynamic table (loaded via the Load or LoadTable AML operators).

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/acpica/tbinstal.c

index 37374b21969d4574c298945a869e3a714795529f..ef269a297b57d6d7b267d408a0006a1422f02f35 100644 (file)
@@ -103,7 +103,9 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to add the ACPI table
+ * DESCRIPTION: This function is called to add an ACPI table. It is used to
+ *              dynamically load tables via the Load and load_table AML
+ *              operators.
  *
  ******************************************************************************/
 
@@ -112,6 +114,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
 {
        u32 i;
        acpi_status status = AE_OK;
+       struct acpi_table_header *override_table = NULL;
 
        ACPI_FUNCTION_TRACE(tb_add_table);
 
@@ -201,6 +204,29 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
                }
        }
 
+       /*
+        * ACPI Table Override:
+        * Allow the host to override dynamically loaded tables.
+        */
+       status = acpi_os_table_override(table_desc->pointer, &override_table);
+       if (ACPI_SUCCESS(status) && override_table) {
+               ACPI_INFO((AE_INFO,
+                          "%4.4s @ 0x%p Table override, replaced with:",
+                          table_desc->pointer->signature,
+                          ACPI_CAST_PTR(void, table_desc->address)));
+
+               /* We can delete the table that was passed as a parameter */
+
+               acpi_tb_delete_table(table_desc);
+
+               /* Setup descriptor for the new table */
+
+               table_desc->address = ACPI_PTR_TO_PHYSADDR(override_table);
+               table_desc->pointer = override_table;
+               table_desc->length = override_table->length;
+               table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE;
+       }
+
        /* Add the table to the global root table list */
 
        status = acpi_tb_store_table(table_desc->address, table_desc->pointer,