summaryrefslogtreecommitdiffstats
path: root/source/common
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2013-02-15 19:12:35 +0000
committerjkim <jkim@FreeBSD.org>2013-02-15 19:12:35 +0000
commitbd5edd68a8fda8df18c688919e100f7f1df5ad6b (patch)
tree60bd49061ad572a9f0cd0955d91e302983ee6939 /source/common
parent713ce6817a3fbfd4bf492408e97d9b7468853c17 (diff)
downloadFreeBSD-src-bd5edd68a8fda8df18c688919e100f7f1df5ad6b.zip
FreeBSD-src-bd5edd68a8fda8df18c688919e100f7f1df5ad6b.tar.gz
Import ACPICA 20130215.
Diffstat (limited to 'source/common')
-rw-r--r--source/common/adisasm.c9
-rw-r--r--source/common/adwalk.c2
-rw-r--r--source/common/dmextern.c218
-rw-r--r--source/common/dmtable.c4
-rw-r--r--source/common/dmtbdump.c104
-rw-r--r--source/common/dmtbinfo.c45
6 files changed, 372 insertions, 10 deletions
diff --git a/source/common/adisasm.c b/source/common/adisasm.c
index c5fcf81..511366f 100644
--- a/source/common/adisasm.c
+++ b/source/common/adisasm.c
@@ -372,7 +372,7 @@ AdAmlDisassemble (
}
/*
- * Output: ASL code. Redirect to a file if requested
+ * Output: ASL code. Redirect to a file if requested
*/
if (OutToFile)
{
@@ -540,11 +540,6 @@ Cleanup:
ACPI_FREE (Table);
}
- if (DisasmFilename)
- {
- ACPI_FREE (DisasmFilename);
- }
-
if (OutToFile && File)
{
if (AslCompilerdebug) /* Display final namespace, with transforms */
@@ -667,7 +662,7 @@ AdCreateTableHeader (
AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId);
AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
- AcpiOsPrintf (" */\n\n");
+ AcpiOsPrintf (" */\n");
/* Create AML output filename based on input filename */
diff --git a/source/common/adwalk.c b/source/common/adwalk.c
index d1c6d74..0a3a848 100644
--- a/source/common/adwalk.c
+++ b/source/common/adwalk.c
@@ -837,7 +837,7 @@ AcpiDmXrefDescendingOp (
}
}
- AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount);
+ AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount | 0x80);
Op->Common.Node = Node;
}
else
diff --git a/source/common/dmextern.c b/source/common/dmextern.c
index 501a9ee..7825ab1 100644
--- a/source/common/dmextern.c
+++ b/source/common/dmextern.c
@@ -46,6 +46,7 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
+#include <stdio.h>
/*
@@ -373,6 +374,7 @@ AcpiDmAddToExternalList (
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
+ BOOLEAN Resolved = FALSE;
if (!Path)
@@ -380,6 +382,15 @@ AcpiDmAddToExternalList (
return;
}
+ if (Type == ACPI_TYPE_METHOD)
+ {
+ if (Value & 0x80)
+ {
+ Resolved = TRUE;
+ }
+ Value &= 0x07;
+ }
+
/*
* We don't want External() statements to contain a leading '\'.
* This prevents duplicate external statements of the form:
@@ -464,6 +475,7 @@ AcpiDmAddToExternalList (
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Value = Value;
+ NewExternal->Resolved = Resolved;
NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
/* Was the external path with parent prefix normalized to a fullpath? */
@@ -684,6 +696,29 @@ AcpiDmEmitExternals (
}
/*
+ * Determine the number of control methods in the external list, and
+ * also how many of those externals were resolved via the namespace.
+ */
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (NextExternal->Type == ACPI_TYPE_METHOD)
+ {
+ AcpiGbl_NumExternalMethods++;
+ if (NextExternal->Resolved)
+ {
+ AcpiGbl_ResolvedExternalMethods++;
+ }
+ }
+
+ NextExternal = NextExternal->Next;
+ }
+
+ /* Check if any control methods were unresolved */
+
+ AcpiDmUnresolvedWarning (1);
+
+ /*
* Walk the list of externals (unresolved references)
* found during the AML parsing
*/
@@ -695,8 +730,17 @@ AcpiDmEmitExternals (
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
- AcpiOsPrintf (") // %u Arguments\n",
- AcpiGbl_ExternalList->Value);
+ if (AcpiGbl_ExternalList->Resolved)
+ {
+ AcpiOsPrintf (") // %u Arguments\n",
+ AcpiGbl_ExternalList->Value);
+ }
+ else
+ {
+ AcpiOsPrintf (") // Warning: unresolved Method, "
+ "assuming %u arguments (may be incorrect, see warning above)\n",
+ AcpiGbl_ExternalList->Value);
+ }
}
else
{
@@ -718,3 +762,173 @@ AcpiDmEmitExternals (
AcpiOsPrintf ("\n");
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUnresolvedWarning
+ *
+ * PARAMETERS: Type - Where to output the warning.
+ * 0 means write to stderr
+ * 1 means write to AcpiOsPrintf
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Issue warning message if there are unresolved external control
+ * methods within the disassembly.
+ *
+ ******************************************************************************/
+
+#if 0
+Summary of the external control method problem:
+
+When the -e option is used with disassembly, the various SSDTs are simply
+loaded into a global namespace for the disassembler to use in order to
+resolve control method references (invocations).
+
+The disassembler tracks any such references, and will emit an External()
+statement for these types of methods, with the proper number of arguments .
+
+Without the SSDTs, the AML does not contain enough information to properly
+disassemble the control method invocation -- because the disassembler does
+not know how many arguments to parse.
+
+An example: Assume we have two control methods. ABCD has one argument, and
+EFGH has zero arguments. Further, we have two additional control methods
+that invoke ABCD and EFGH, named T1 and T2:
+
+ Method (ABCD, 1)
+ {
+ }
+ Method (EFGH, 0)
+ {
+ }
+ Method (T1)
+ {
+ ABCD (Add (2, 7, Local0))
+ }
+ Method (T2)
+ {
+ EFGH ()
+ Add (2, 7, Local0)
+ }
+
+Here is the AML code that is generated for T1 and T2:
+
+ 185: Method (T1)
+
+0000034C: 14 10 54 31 5F 5F 00 ... "..T1__."
+
+ 186: {
+ 187: ABCD (Add (2, 7, Local0))
+
+00000353: 41 42 43 44 ............ "ABCD"
+00000357: 72 0A 02 0A 07 60 ...... "r....`"
+
+ 188: }
+
+ 190: Method (T2)
+
+0000035D: 14 10 54 32 5F 5F 00 ... "..T2__."
+
+ 191: {
+ 192: EFGH ()
+
+00000364: 45 46 47 48 ............ "EFGH"
+
+ 193: Add (2, 7, Local0)
+
+00000368: 72 0A 02 0A 07 60 ...... "r....`"
+ 194: }
+
+Note that the AML code for T1 and T2 is essentially identical. When
+disassembling this code, the methods ABCD and EFGH must be known to the
+disassembler, otherwise it does not know how to handle the method invocations.
+
+In other words, if ABCD and EFGH are actually external control methods
+appearing in an SSDT, the disassembler does not know what to do unless
+the owning SSDT has been loaded via the -e option.
+#endif
+
+void
+AcpiDmUnresolvedWarning (
+ UINT8 Type)
+{
+
+ if (!AcpiGbl_NumExternalMethods)
+ {
+ return;
+ }
+
+ if (Type)
+ {
+ if (!AcpiGbl_ExternalFileList)
+ {
+ /* The -e option was not specified */
+
+ AcpiOsPrintf (" /*\n"
+ " * iASL Warning: There were %u external control methods found during\n"
+ " * disassembly, but additional ACPI tables to resolve these externals\n"
+ " * were not specified. This resulting disassembler output file may not\n"
+ " * compile because the disassembler did not know how many arguments\n"
+ " * to assign to these methods. To specify the tables needed to resolve\n"
+ " * external control method references, use the one of the following\n"
+ " * example iASL invocations:\n"
+ " * iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n"
+ " * iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n"
+ " */\n",
+ AcpiGbl_NumExternalMethods);
+ }
+ else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
+ {
+ /* The -e option was specified, but there are still some unresolved externals */
+
+ AcpiOsPrintf (" /*\n"
+ " * iASL Warning: There were %u external control methods found during\n"
+ " * disassembly, but only %u %s resolved (%u unresolved). Additional\n"
+ " * ACPI tables are required to properly disassemble the code. This\n"
+ " * resulting disassembler output file may not compile because the\n"
+ " * disassembler did not know how many arguments to assign to the\n"
+ " * unresolved methods.\n"
+ " */\n",
+ AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
+ (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
+ (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
+ }
+ }
+ else
+ {
+ if (!AcpiGbl_ExternalFileList)
+ {
+ /* The -e option was not specified */
+
+ fprintf (stderr, "\n"
+ "iASL Warning: There were %u external control methods found during\n"
+ "disassembly, but additional ACPI tables to resolve these externals\n"
+ "were not specified. The resulting disassembler output file may not\n"
+ "compile because the disassembler did not know how many arguments\n"
+ "to assign to these methods. To specify the tables needed to resolve\n"
+ "external control method references, use the one of the following\n"
+ "example iASL invocations:\n"
+ " iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n"
+ " iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n",
+ AcpiGbl_NumExternalMethods);
+ }
+ else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
+ {
+ /* The -e option was specified, but there are still some unresolved externals */
+
+ fprintf (stderr, "\n"
+ "iASL Warning: There were %u external control methods found during\n"
+ "disassembly, but only %u %s resolved (%u unresolved). Additional\n"
+ "ACPI tables are required to properly disassemble the code. The\n"
+ "resulting disassembler output file may not compile because the\n"
+ "disassembler did not know how many arguments to assign to the\n"
+ "unresolved methods.\n",
+ AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
+ (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
+ (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
+ }
+ }
+
+}
diff --git a/source/common/dmtable.c b/source/common/dmtable.c
index cde1664..0c1c39b 100644
--- a/source/common/dmtable.c
+++ b/source/common/dmtable.c
@@ -299,6 +299,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
{ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
+ {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"},
{ACPI_SIG_PCCT, NULL, AcpiDmDumpPcct, NULL, NULL, "Platform Communications Channel Table"},
{ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
@@ -312,6 +313,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
+ {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"},
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
{ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
@@ -475,6 +477,8 @@ AcpiDmDumpDataTable (
{
AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
Table->Signature);
+ fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
+ Table->Signature);
}
}
else if (TableData->TableHandler)
diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c
index c5a5cef..b5e052e 100644
--- a/source/common/dmtbdump.c
+++ b/source/common/dmtbdump.c
@@ -1796,6 +1796,58 @@ AcpiDmDumpMsct (
/*******************************************************************************
*
+ * FUNCTION: AcpiDmDumpMtmr
+ *
+ * PARAMETERS: Table - A MTMR table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MTMR
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMtmr (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_STATUS Status;
+ UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
+ ACPI_MTMR_ENTRY *SubTable;
+
+
+ /* Main table */
+
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+ sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Point to next sub-table */
+
+ Offset += sizeof (ACPI_MTMR_ENTRY);
+ SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmDumpPcct
*
* PARAMETERS: Table - A PCCT table
@@ -2378,6 +2430,58 @@ NextSubTable:
/*******************************************************************************
*
+ * FUNCTION: AcpiDmDumpVrtc
+ *
+ * PARAMETERS: Table - A VRTC table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a VRTC
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpVrtc (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_STATUS Status;
+ UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
+ ACPI_VRTC_ENTRY *SubTable;
+
+
+ /* Main table */
+
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+ sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Point to next sub-table */
+
+ Offset += sizeof (ACPI_VRTC_ENTRY);
+ SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmDumpWdat
*
* PARAMETERS: Table - A WDAT table
diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c
index 5b8321d..033f7ef 100644
--- a/source/common/dmtbinfo.c
+++ b/source/common/dmtbinfo.c
@@ -179,6 +179,7 @@
#define ACPI_MPST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f)
#define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f)
#define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f)
+#define ACPI_MTMR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f)
#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)
#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f)
#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f)
@@ -195,6 +196,7 @@
#define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
#define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
#define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
+#define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)
#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)
/*
@@ -1644,6 +1646,28 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] =
/*******************************************************************************
*
+ * MTMR - MID Timer Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr[] =
+{
+ ACPI_DMT_TERMINATOR
+};
+
+/* MTMR Subtables - MTMR Entry */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[] =
+{
+ {ACPI_DMT_GAS, ACPI_MTMR0_OFFSET (PhysicalAddress), "PhysicalAddress", 0},
+ {ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Frequency), "Frequency", 0},
+ {ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Irq), "IRQ", 0},
+ ACPI_DMT_TERMINATOR
+};
+
+
+/*******************************************************************************
+ *
* PCCT - Platform Communications Channel Table (ACPI 5.0)
*
******************************************************************************/
@@ -2035,6 +2059,27 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] =
/*******************************************************************************
*
+ * VRTC - Virtual Real Time Clock Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[] =
+{
+ ACPI_DMT_TERMINATOR
+};
+
+/* VRTC Subtables - VRTC Entry */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc0[] =
+{
+ {ACPI_DMT_GAS, ACPI_VRTC0_OFFSET (PhysicalAddress), "PhysicalAddress", 0},
+ {ACPI_DMT_UINT32, ACPI_VRTC0_OFFSET (Irq), "IRQ", 0},
+ ACPI_DMT_TERMINATOR
+};
+
+
+/*******************************************************************************
+ *
* WAET - Windows ACPI Emulated devices Table
*
******************************************************************************/
OpenPOWER on IntegriCloud