summaryrefslogtreecommitdiff
path: root/source/components
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-01-06 15:42:23 +0800
committerLv Zheng <lv.zheng@intel.com>2014-03-19 10:37:19 +0800
commitb99d2b09e8e65bec9876b14d715ab8fcd4c3de03 (patch)
treeb4ffe316920f88bddbfac3684405394624ac00f2 /source/components
parent732732b3a8bcaf58c980e2dc0820b67a933cb216 (diff)
downloadacpica-b99d2b09e8e65bec9876b14d715ab8fcd4c3de03.tar.gz
Tables: Fix the issues in handling virtual addressed tables.
When table is overridden or reloaded, AcpiTbDeleteTable() is called where ACPI_TABLE_DESC.Pointer will be NULL. It thus is impossible for virtual addressed tables to obtain the .Pointer again in AcpiTbVerifyTable(). This patch stores virtual table addresses (ACPI_TABLE_ORIGIN_ALLOCATED, ACPI_TABLE_ORIGIN_UNKNOWN, ACPI_TABLE_ORIGIN_OVERRIDE) in the ACPI_TABLE_DESC.Address field and refills the ACPI_TABLE_DESC.Pointer using these addresses in AcpiTbVerifyTable(). Note that if a table with ACPI_TABLE_ORIGIN_ALLOCATED set is actually freed, the .Address field should be invalidated and thus must be replaced with NULL to avoid wrong future validations occuring in AcpiTbVerifyTable(). Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Diffstat (limited to 'source/components')
-rw-r--r--source/components/executer/exconfig.c4
-rw-r--r--source/components/tables/tbinstal.c19
-rw-r--r--source/components/tables/tbutils.c1
3 files changed, 20 insertions, 4 deletions
diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c
index 17ea6f372..b64c99835 100644
--- a/source/components/executer/exconfig.c
+++ b/source/components/executer/exconfig.c
@@ -553,7 +553,7 @@ AcpiExLoadOp (
return_ACPI_STATUS (Status);
}
- TableDesc.Address = ObjDesc->Region.Address;
+ TableDesc.Address = ACPI_PTR_TO_PHYSADDR (TableDesc.Pointer);
break;
case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
@@ -595,7 +595,7 @@ AcpiExLoadOp (
}
ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
- TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
+ TableDesc.Address = ACPI_PTR_TO_PHYSADDR (TableDesc.Pointer);
break;
default:
diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c
index c2d9ad9e7..90d1717d2 100644
--- a/source/components/tables/tbinstal.c
+++ b/source/components/tables/tbinstal.c
@@ -152,11 +152,25 @@ AcpiTbVerifyTable (
if (!TableDesc->Pointer)
{
- if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
- ACPI_TABLE_ORIGIN_MAPPED)
+ switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
{
+ case ACPI_TABLE_ORIGIN_MAPPED:
+
TableDesc->Pointer = AcpiOsMapMemory (
TableDesc->Address, TableDesc->Length);
+ break;
+
+ case ACPI_TABLE_ORIGIN_ALLOCATED:
+ case ACPI_TABLE_ORIGIN_UNKNOWN:
+ case ACPI_TABLE_ORIGIN_OVERRIDE:
+
+ TableDesc->Pointer = ACPI_CAST_PTR (
+ ACPI_TABLE_HEADER, TableDesc->Address);
+ break;
+
+ default:
+
+ break;
}
if (!TableDesc->Pointer)
@@ -589,6 +603,7 @@ AcpiTbDeleteTable (
case ACPI_TABLE_ORIGIN_ALLOCATED:
ACPI_FREE (TableDesc->Pointer);
+ TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL);
break;
/* Not mapped or allocated, there is nothing we can do */
diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c
index 0d9375e40..053fd1b19 100644
--- a/source/components/tables/tbutils.c
+++ b/source/components/tables/tbutils.c
@@ -270,6 +270,7 @@ AcpiTbCopyDsdt (
ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length);
AcpiTbDeleteTable (TableDesc);
+ TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NewTable);
TableDesc->Pointer = NewTable;
TableDesc->Flags = ACPI_TABLE_ORIGIN_ALLOCATED;