summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/common
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2007-03-22 17:24:05 +0000
committerjkim <jkim@FreeBSD.org>2007-03-22 17:24:05 +0000
commite031ab5da47b5f6c28c3cc5d576128b2d8d202e6 (patch)
tree69d0fa3b3760b0abcc0335ff748e39701a8bf064 /sys/contrib/dev/acpica/common
parentdbc8115981195155aec9304dd8f0ee570bd3d32c (diff)
downloadFreeBSD-src-e031ab5da47b5f6c28c3cc5d576128b2d8d202e6.zip
FreeBSD-src-e031ab5da47b5f6c28c3cc5d576128b2d8d202e6.tar.gz
Vendor import of Intel ACPI-CA 20070320
Diffstat (limited to 'sys/contrib/dev/acpica/common')
-rw-r--r--sys/contrib/dev/acpica/common/adfile.c398
-rw-r--r--sys/contrib/dev/acpica/common/adisasm.c643
-rw-r--r--sys/contrib/dev/acpica/common/adwalk.c1001
-rw-r--r--sys/contrib/dev/acpica/common/dmrestag.c990
-rw-r--r--sys/contrib/dev/acpica/common/dmtable.c734
-rw-r--r--sys/contrib/dev/acpica/common/dmtbdump.c798
-rw-r--r--sys/contrib/dev/acpica/common/dmtbinfo.c967
-rw-r--r--sys/contrib/dev/acpica/common/getopt.c4
8 files changed, 5235 insertions, 300 deletions
diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c
new file mode 100644
index 0000000..732b2bb
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/adfile.c
@@ -0,0 +1,398 @@
+/******************************************************************************
+ *
+ * Module Name: adfile - Application-level disassembler file support routines
+ * $Revision: 1.3 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acapps.h>
+
+#include <stdio.h>
+#include <string.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adfile")
+
+
+char FilenameBuf[20];
+
+/******************************************************************************
+ *
+ * FUNCTION: AfGenerateFilename
+ *
+ * PARAMETERS: Prefix - prefix string
+ * TableId - The table ID
+ *
+ * RETURN: Pointer to the completed string
+ *
+ * DESCRIPTION: Build an output filename from an ACPI table ID string
+ *
+ ******************************************************************************/
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ for (i = 0; Prefix[i]; i++)
+ {
+ FilenameBuf[i] = Prefix[i];
+ }
+
+ FilenameBuf[i] = '_';
+ i++;
+
+ for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
+ {
+ FilenameBuf[i] = TableId[j];
+ }
+
+ FilenameBuf[i] = 0;
+ strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
+ return FilenameBuf;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteBuffer
+ *
+ * PARAMETERS: Filename - name of file
+ * Buffer - data to write
+ * Length - length of data
+ *
+ * RETURN: Actual number of bytes written
+ *
+ * DESCRIPTION: Open a file and write out a single buffer
+ *
+ ******************************************************************************/
+
+ACPI_NATIVE_INT
+AdWriteBuffer (
+ char *Filename,
+ char *Buffer,
+ UINT32 Length)
+{
+ FILE *fp;
+ ACPI_SIZE Actual;
+
+
+ fp = fopen (Filename, "wb");
+ if (!fp)
+ {
+ printf ("Couldn't open %s\n", Filename);
+ return (-1);
+ }
+
+ Actual = fwrite (Buffer, (size_t) Length, 1, fp);
+ fclose (fp);
+ return ((ACPI_NATIVE_INT) Actual);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteTable
+ *
+ * PARAMETERS: Table - pointer to the ACPI table
+ * Length - length of the table
+ * TableName - the table signature
+ * OemTableID - from the table header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the loaded tables to a file (or files)
+ *
+ ******************************************************************************/
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId)
+{
+ char *Filename;
+
+
+ Filename = AdGenerateFilename (TableName, OemTableId);
+ AdWriteBuffer (Filename, (char *) Table, Length);
+
+ AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlGenerateFilename
+ *
+ * PARAMETERS: InputFilename - Original ASL source filename
+ * Suffix - New extension.
+ *
+ * RETURN: New filename containing the original base + the new suffix
+ *
+ * DESCRIPTION: Generate a new filename from the ASL source filename and a new
+ * extension. Used to create the *.LST, *.TXT, etc. files.
+ *
+ ******************************************************************************/
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix)
+{
+ char *Position;
+ char *NewFilename;
+
+
+ /*
+ * Copy the original filename to a new buffer. Leave room for the worst case
+ * where we append the suffix, an added dot and the null terminator.
+ */
+ NewFilename = ACPI_ALLOCATE_ZEROED (
+ strlen (InputFilename) + strlen (Suffix) + 2);
+ strcpy (NewFilename, InputFilename);
+
+ /* Try to find the last dot in the filename */
+
+ Position = strrchr (NewFilename, '.');
+ if (Position)
+ {
+ /* Tack on the new suffix */
+
+ Position++;
+ *Position = 0;
+ strcat (Position, Suffix);
+ }
+ else
+ {
+ /* No dot, add one and then the suffix */
+
+ strcat (NewFilename, ".");
+ strcat (NewFilename, Suffix);
+ }
+
+ return NewFilename;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlStrdup
+ *
+ * DESCRIPTION: Local strdup function
+ *
+ ******************************************************************************/
+
+static char *
+FlStrdup (
+ char *String)
+{
+ char *NewString;
+
+
+ NewString = ACPI_ALLOCATE (strlen (String) + 1);
+ if (!NewString)
+ {
+ return (NULL);
+ }
+
+ strcpy (NewString, String);
+ return (NewString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSplitInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ * OutDirectoryPath - Where the directory path prefix is
+ * returned
+ * OutFilename - Where the filename part is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename)
+{
+ char *Substring;
+ char *DirectoryPath;
+ char *Filename;
+
+
+ *OutDirectoryPath = NULL;
+ *OutFilename = NULL;
+
+ if (!InputPath)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ DirectoryPath = FlStrdup (InputPath);
+ if (!DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ DirectoryPath[0] = 0;
+ Filename = FlStrdup (InputPath);
+ }
+ else
+ {
+ Filename = FlStrdup (Substring + 1);
+ *(Substring+1) = 0;
+ }
+
+ if (!Filename)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ *OutDirectoryPath = DirectoryPath;
+ *OutFilename = Filename;
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c
index 472f1ba..843a9a8 100644
--- a/sys/contrib/dev/acpica/common/adisasm.c
+++ b/sys/contrib/dev/acpica/common/adisasm.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: adisasm - Application-level disassembler routines
- * $Revision: 1.77 $
+ * $Revision: 1.104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,20 +122,42 @@
#include <contrib/dev/acpica/acdisasm.h>
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
#include <contrib/dev/acpica/acapps.h>
#include <stdio.h>
-#include <string.h>
#include <time.h>
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adisasm")
+extern int AslCompilerdebug;
-ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+ACPI_STATUS
+LsDisplayNamespace (
+ void);
+
+void
+LsSetupNsList (void * Handle);
+
+
+/* Local prototypes */
+
+void
+AdCreateTableHeader (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table);
+
+void
+AdDisassemblerHeader (
+ char *Filename);
+
+ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
+/* Stubs for ASL compiler */
+
#ifndef ACPI_ASL_COMPILER
BOOLEAN
AcpiDsIsResultUsed (
@@ -144,9 +166,26 @@ AcpiDsIsResultUsed (
{
return TRUE;
}
+
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (Status);
+}
+
#endif
ACPI_STATUS
+AcpiNsLoadTable (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *Node)
+{
+ return (AE_NOT_IMPLEMENTED);
+}
+
+ACPI_STATUS
AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc)
@@ -156,6 +195,7 @@ AcpiDsRestartControlMethod (
void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
return;
@@ -180,118 +220,7 @@ AcpiDsMethodDataInitArgs (
}
-#define FILE_SUFFIX_DISASSEMBLY "dsl"
-#define ACPI_TABLE_FILE_SUFFIX ".dat"
-char FilenameBuf[20];
-
-/******************************************************************************
- *
- * FUNCTION: AfGenerateFilename
- *
- * PARAMETERS: Prefix - prefix string
- * TableId - The table ID
- *
- * RETURN: Pointer to the completed string
- *
- * DESCRIPTION: Build an output filename from an ACPI table ID string
- *
- ******************************************************************************/
-
-char *
-AdGenerateFilename (
- char *Prefix,
- char *TableId)
-{
- ACPI_NATIVE_UINT i;
- ACPI_NATIVE_UINT j;
-
-
- for (i = 0; Prefix[i]; i++)
- {
- FilenameBuf[i] = Prefix[i];
- }
-
- FilenameBuf[i] = '_';
- i++;
-
- for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
- {
- FilenameBuf[i] = TableId[j];
- }
-
- FilenameBuf[i] = 0;
- strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
- return FilenameBuf;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteBuffer
- *
- * PARAMETERS: Filename - name of file
- * Buffer - data to write
- * Length - length of data
- *
- * RETURN: Actual number of bytes written
- *
- * DESCRIPTION: Open a file and write out a single buffer
- *
- ******************************************************************************/
-
-ACPI_NATIVE_INT
-AdWriteBuffer (
- char *Filename,
- char *Buffer,
- UINT32 Length)
-{
- FILE *fp;
- ACPI_NATIVE_INT Actual;
-
-
- fp = fopen (Filename, "wb");
- if (!fp)
- {
- printf ("Couldn't open %s\n", Filename);
- return -1;
- }
-
- Actual = fwrite (Buffer, (size_t) Length, 1, fp);
- fclose (fp);
- return Actual;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteTable
- *
- * PARAMETERS: Table - pointer to the ACPI table
- * Length - length of the table
- * TableName - the table signature
- * OemTableID - from the table header
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the loaded tables to a file (or files)
- *
- ******************************************************************************/
-
-void
-AdWriteTable (
- ACPI_TABLE_HEADER *Table,
- UINT32 Length,
- char *TableName,
- char *OemTableId)
-{
- char *Filename;
-
-
- Filename = AdGenerateFilename (TableName, OemTableId);
- AdWriteBuffer (Filename, (char *) Table, Length);
-
- AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
-}
+ACPI_TABLE_DESC LocalTables[1];
/*******************************************************************************
@@ -315,7 +244,9 @@ AdInitialize (
/* ACPI CA subsystem initialization */
+ Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
+
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
@@ -323,136 +254,92 @@ AdInitialize (
}
Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
+ /* Setup the Table Manager (cheat - there is no RSDT) */
+
+ AcpiGbl_RootTableList.Size = 1;
+ AcpiGbl_RootTableList.Count = 0;
+ AcpiGbl_RootTableList.Tables = LocalTables;
+
return Status;
}
/*******************************************************************************
*
- * FUNCTION: FlGenerateFilename
+ * FUNCTION: AdAddExternalsToNamespace
*
- * PARAMETERS: InputFilename - Original ASL source filename
- * Suffix - New extension.
+ * PARAMETERS:
*
- * RETURN: New filename containing the original base + the new suffix
+ * RETURN: Status
*
- * DESCRIPTION: Generate a new filename from the ASL source filename and a new
- * extension. Used to create the *.LST, *.TXT, etc. files.
+ * DESCRIPTION:
*
******************************************************************************/
-char *
-FlGenerateFilename (
- char *InputFilename,
- char *Suffix)
+void
+AdAddExternalsToNamespace (
+ void)
{
- char *Position;
- char *NewFilename;
-
-
- /* Copy the original filename to a new buffer */
-
- NewFilename = ACPI_MEM_CALLOCATE (strlen (InputFilename) + strlen (Suffix));
- strcpy (NewFilename, InputFilename);
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ ACPI_OPERAND_OBJECT *MethodDesc;
- /* Try to find the last dot in the filename */
- Position = strrchr (NewFilename, '.');
- if (Position)
+ while (External)
{
- /* Tack on the new suffix */
+ Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+ NULL, &Node);
- Position++;
- *Position = 0;
- strcat (Position, Suffix);
- }
- else
- {
- /* No dot, add one and then the suffix */
+ if (External->Type == ACPI_TYPE_METHOD)
+ {
+ MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+ MethodDesc->Method.ParamCount = (UINT8) External->Value;
+ Node->Object = MethodDesc;
+ }
- strcat (NewFilename, ".");
- strcat (NewFilename, Suffix);
+ External = External->Next;
}
-
- return NewFilename;
}
/*******************************************************************************
*
- * FUNCTION: FlSplitInputPathname
+ * FUNCTION: AdMethodExternalCount
*
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
- * OutDirectoryPath - Where the directory path prefix is
- * returned
- * OutFilename - Where the filename part is returned
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
+ * DESCRIPTION: Return the number of externals that have been generated
*
******************************************************************************/
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename)
+UINT32
+AdMethodExternalCount (
+ void)
{
- char *Substring;
- char *DirectoryPath;
- char *Filename;
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ UINT32 Count = 0;
- *OutDirectoryPath = NULL;
- *OutFilename = NULL;
-
- if (!InputPath)
- {
- return (AE_OK);
- }
-
- /* Get the path to the input filename's directory */
-
- DirectoryPath = strdup (InputPath);
- if (!DirectoryPath)
+ while (External)
{
- return (AE_NO_MEMORY);
- }
-
- Substring = strrchr (DirectoryPath, '\\');
- if (!Substring)
- {
- Substring = strrchr (DirectoryPath, '/');
- if (!Substring)
+ if (External->Type == ACPI_TYPE_METHOD)
{
- Substring = strrchr (DirectoryPath, ':');
+ Count++;
}
- }
- if (!Substring)
- {
- DirectoryPath[0] = 0;
- Filename = strdup (InputPath);
- }
- else
- {
- Filename = strdup (Substring + 1);
- *(Substring+1) = 0;
+ External = External->Next;
}
- if (!Filename)
- {
- return (AE_NO_MEMORY);
- }
-
- *OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
-
- return (AE_OK);
+ return (Count);
}
@@ -472,6 +359,8 @@ FlSplitInputPathname (
*
*****************************************************************************/
+extern char *Gbl_ExternalFilename;
+
ACPI_STATUS
AdAmlDisassemble (
BOOLEAN OutToFile,
@@ -484,6 +373,7 @@ AdAmlDisassemble (
char *DisasmFilename = NULL;
FILE *File = NULL;
ACPI_TABLE_HEADER *Table;
+ ACPI_TABLE_HEADER *ExternalTable;
/*
@@ -497,6 +387,15 @@ AdAmlDisassemble (
{
return Status;
}
+
+ if (Gbl_ExternalFilename)
+ {
+ Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+ }
}
else
{
@@ -513,11 +412,18 @@ AdAmlDisassemble (
return AE_OK;
}
- /* Obtained the local tables, just disassmeble the DSDT */
+ /* Obtained the local tables, just disassemble the DSDT */
+
+ Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get DSDT, %s\n",
+ AcpiFormatException (Status));
+ return Status;
+ }
- Table = AcpiGbl_DSDT;
AcpiOsPrintf ("\nDisassembly of DSDT\n");
- Prefix = AdGenerateFilename ("dsdt", AcpiGbl_DSDT->OemTableId);
+ Prefix = AdGenerateFilename ("dsdt", Table->OemTableId);
}
/*
@@ -539,7 +445,7 @@ AdAmlDisassemble (
File = fopen (DisasmFilename, "w+");
if (!File)
{
- fprintf (stderr, "Could not open output file\n");
+ fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
@@ -549,50 +455,173 @@ AdAmlDisassemble (
*OutFilename = DisasmFilename;
- /* Always parse the tables, only option is what to display */
-
- Status = AdParseTable (Table);
- if (ACPI_FAILURE (Status))
+ if (!AcpiUtIsAmlTable (Table))
{
- AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto Cleanup;
+ AdDisassemblerHeader (Filename);
+ AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
+ Table->Signature);
+ AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue\n */\n\n");
+
+ AcpiDmDumpDataTable (Table);
+ fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n",
+ Table->Signature, DisasmFilename);
}
+ else
+ {
+ /* Always parse the tables, only option is what to display */
- /*
- * TBD: We want to cross reference the namespace here, in order to
- * generate External() statements. The problem is that the parse
- * tree is in run-time (interpreter) format, not compiler format,
- * so we cannot directly use the function below:
- *
- * Status = LkCrossReferenceNamespace ();
- *
- * We need to either convert the parse tree or create a new
- * cross ref function that can handle interpreter parse trees
- */
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
- /* Optional displays */
+ if (AslCompilerdebug)
+ {
+ AcpiOsPrintf ("/**** Before second load\n");
- if (AcpiGbl_DbOpt_disasm)
- {
- AdDisplayTables (Filename, Table);
- fprintf (stderr, "Disassembly completed, written to \"%s\"\n", DisasmFilename);
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+ AcpiOsPrintf ("*****/\n");
+ }
+
+ /*
+ * Load namespace from names created within control methods
+ */
+ AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ /*
+ * Cross reference the namespace here, in order to generate External() statements
+ */
+ AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+
+ /* Find possible calls to external control methods */
+
+ AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
+
+ /* Convert fixed-offset references to resource descriptors to symbolic references */
+
+ AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ if (AslCompilerdebug)
+ {
+ AcpiOsPrintf ("/**** After second load and resource conversion\n");
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+ AcpiOsPrintf ("*****/\n");
+ }
+
+ /*
+ * If we found any external control methods, we must reparse the entire
+ * tree with the new information (namely, the number of arguments per
+ * method)
+ */
+ if (AdMethodExternalCount ())
+ {
+ fprintf (stderr,
+ "\nFound %d external control methods, reparsing with new information\n",
+ AdMethodExternalCount());
+
+ /*
+ * Reparse, rebuild namespace. no need to xref namespace
+ */
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
+
+ AcpiGbl_RootNode = NULL;
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+ AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
+
+ Status = AcpiNsRootInitialize ();
+ AdAddExternalsToNamespace ();
+
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+ }
+
+ /* Optional displays */
+
+ if (AcpiGbl_DbOpt_disasm)
+ {
+ AdDisplayTables (Filename, Table);
+ fprintf (stderr,
+ "Disassembly completed, written to \"%s\"\n",
+ DisasmFilename);
+ }
}
Cleanup:
- if (OutToFile)
+ if (OutToFile && File)
{
+
+#ifdef ASL_DISASM_DEBUG
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+#endif
fclose (File);
AcpiOsRedirectOutput (stdout);
}
- AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
return Status;
}
/******************************************************************************
*
+ * FUNCTION: AdDisassemblerHeader
+ *
+ * PARAMETERS: Filename - Input file for the table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create the disassembler header, including ACPI CA signon with
+ * current time and date.
+ *
+ *****************************************************************************/
+
+void
+AdDisassemblerHeader (
+ char *Filename)
+{
+ time_t Timer;
+
+ time (&Timer);
+
+ /* Header and input table info */
+
+ AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
+ AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
+
+ AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer));
+ AcpiOsPrintf (" *\n");
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AdCreateTableHeader
*
* PARAMETERS: Filename - Input file for the table
@@ -610,18 +639,40 @@ AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table)
{
- time_t Timer;
+ char *NewFilename;
- time (&Timer);
+ AdDisassemblerHeader (Filename);
- AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
- AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
- AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer));
+ AcpiOsPrintf (" *\n * Original Table Header:\n");
+ AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature);
+ AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length);
+ AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision);
+ AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId);
+ AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId);
+ AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
+ AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId);
+ AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
+ AcpiOsPrintf (" */\n");
+
+ /* Create AML output filename based on input filename */
+
+ if (Filename)
+ {
+ NewFilename = FlGenerateFilename (Filename, "aml");
+ }
+ else
+ {
+ NewFilename = ACPI_ALLOCATE_ZEROED (9);
+ strncat (NewFilename, Table->Signature, 4);
+ strcat (NewFilename, ".aml");
+ }
+
+ /* Open the ASL definition block */
AcpiOsPrintf (
- "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
- Table->Signature, Table->Signature, Table->Revision,
+ "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+ NewFilename, Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
}
@@ -646,7 +697,7 @@ AdDisplayTables (
{
- if (!AcpiGbl_ParsedNamespaceRoot)
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NOT_EXIST;
}
@@ -656,7 +707,7 @@ AdDisplayTables (
AdCreateTableHeader (Filename, Table);
}
- AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX);
+ AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
if (AcpiGbl_DbOpt_verbose)
{
@@ -702,7 +753,7 @@ AdDeferredParse (
ACPI_PARSE_OBJECT *ExtraOp;
- ACPI_FUNCTION_TRACE ("AdDeferredParse");
+ ACPI_FUNCTION_TRACE (AdDeferredParse);
fprintf (stderr, ".");
@@ -722,7 +773,7 @@ AdDeferredParse (
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
- AmlLength, NULL, 1);
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -820,7 +871,7 @@ AdParseDeferredOps (
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_NAME ("AdParseDeferredOps");
+ ACPI_FUNCTION_NAME (AdParseDeferredOps);
fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
while (Op)
@@ -859,7 +910,7 @@ AdParseDeferredOps (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unhandled deferred opcode [%s]\n",
+ ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
Op->Common.AmlOpName));
break;
}
@@ -895,12 +946,12 @@ AdGetLocalTables (
ACPI_TABLE_HEADER *NewTable;
UINT32 NumTables;
UINT32 PointerSize;
- char *FacsSuffix = "";
+ ACPI_NATIVE_UINT TableIndex;
if (GetAllTables)
{
- ACPI_STRNCPY (TableHeader.Signature, RSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (!NewTable)
{
@@ -908,14 +959,11 @@ AdGetLocalTables (
return AE_NO_ACPI_TABLES;
}
-#if ACPI_MACHINE_WIDTH != 64
-
- if (!ACPI_STRNCMP (NewTable->Signature, RSDT_SIG, 4))
+ if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT))
{
PointerSize = sizeof (UINT32);
}
else
-#endif
{
PointerSize = sizeof (UINT64);
}
@@ -932,43 +980,31 @@ AdGetLocalTables (
/* Get the FADT */
- ACPI_STRNCPY (TableHeader.Signature, FADT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- AcpiGbl_FADT = (void *) NewTable;
AdWriteTable (NewTable, NewTable->Length,
- FADT_SIG, NewTable->OemTableId);
-
- /* Use the FADT tableID for the FACS, since FACS has no ID */
-
- FacsSuffix = AcpiGbl_FADT->OemTableId;
+ ACPI_SIG_FADT, NewTable->OemTableId);
}
AcpiOsPrintf ("\n");
- /* Get the FACS */
-
- ACPI_STRNCPY (TableHeader.Signature, FACS_SIG, 4);
- AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
- {
- AcpiGbl_FACS = (void *) NewTable;
- AdWriteTable (NewTable, AcpiGbl_FACS->Length,
- FACS_SIG, FacsSuffix);
- }
- AcpiOsPrintf ("\n");
+ /* Don't bother with FACS, it is usually all zeros */
}
/* Always get the DSDT */
- ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- Status = AE_OK;
- AcpiGbl_DSDT = NewTable;
- AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
- "DSDT", AcpiGbl_DSDT->OemTableId);
+ AdWriteTable (NewTable, NewTable->Length,
+ ACPI_SIG_DSDT, NewTable->OemTableId);
+
+ /* Store DSDT in the Table Manager */
+
+ Status = AcpiTbStoreTable (0, NewTable, NewTable->Length,
+ 0, &TableIndex);
}
else
{
@@ -976,23 +1012,26 @@ AdGetLocalTables (
return AE_NO_ACPI_TABLES;
}
+#if 0
+ /* TBD: Future implementation */
+
AcpiOsPrintf ("\n");
/* Get all SSDTs */
- ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4);
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT);
+ do
{
- while (NewTable)
- {
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- }
- }
+ NewTable = NULL;
+ Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+
+ } while (NewTable);
+#endif
return AE_OK;
}
+
/******************************************************************************
*
* FUNCTION: AdParseTable
@@ -1011,9 +1050,9 @@ AdParseTable (
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
- ACPI_TABLE_DESC TableDesc;
UINT8 *AmlStart;
UINT32 AmlLength;
+ ACPI_NATIVE_UINT TableIndex;
if (!Table)
@@ -1025,13 +1064,13 @@ AdParseTable (
fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
- AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
- AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
/* Create the root object */
- AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp ();
- if (!AcpiGbl_ParsedNamespaceRoot)
+ AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp ();
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NO_MEMORY;
}
@@ -1039,14 +1078,14 @@ AdParseTable (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0,
- AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
+ AcpiGbl_ParseOpRoot, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
- NULL, AmlStart, AmlLength, NULL, 1);
+ Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
+ NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1063,12 +1102,16 @@ AdParseTable (
/* Pass 2 */
- TableDesc.AmlStart = AmlStart;
- TableDesc.AmlLength = AmlLength;
+ Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table,
+ Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
- WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
- Status = AcpiNsOneCompleteParse (2, &TableDesc);
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1076,7 +1119,11 @@ AdParseTable (
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
- Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot);
+ Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
+
+ /* Process Resource Templates */
+
+ AcpiDmFindResources (AcpiGbl_ParseOpRoot);
fprintf (stderr, "Parsing completed\n");
return AE_OK;
diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c
new file mode 100644
index 0000000..108561c
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/adwalk.c
@@ -0,0 +1,1001 @@
+/******************************************************************************
+ *
+ * Module Name: adwalk - Application-level disassembler parse tree walk routines
+ * $Revision: 1.6 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acdebug.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acapps.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adwalk")
+
+/*
+ * aslmap - opcode mappings and reserved method names
+ */
+ACPI_OBJECT_TYPE
+AslMapNamedOpcodeToDataType (
+ UINT16 Opcode);
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op);
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTree
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to format and output the nodes
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTree (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
+ Info.Flags = 0;
+ Info.Count = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
+ AcpiOsPrintf ("*/\n\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanMethods
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
+ * that are not resolved in the namespace
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindOrphanMethods (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFinishNamespaceLoad
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Load all namespace items that are created within control
+ * methods. Used before namespace cross reference
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFinishNamespaceLoad (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCrossReferenceNamespace
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Cross reference the namespace to create externals
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCrossReferenceNamespace (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmConvertResourceIndexes
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert fixed-offset references to resource descriptors to
+ * symbolic references. Should only be called after namespace has
+ * been cross referenced.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmConvertResourceIndexes (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Format and print contents of one parse Op.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Path;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ Info->Count++;
+
+ /* Most of the information (count, level, name) here */
+
+ AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level);
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode));
+
+ /* Extra info is helpful */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP:
+ case AML_WORD_OP:
+ case AML_DWORD_OP:
+ AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+ if (Op->Common.Value.String)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
+ ACPI_FREE (Path);
+ }
+ else
+ {
+ AcpiOsPrintf ("[NULL]");
+ }
+ break;
+
+ case AML_NAME_OP:
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_INT_NAMEDFIELD_OP:
+ AcpiOsPrintf ("%4.4s", &Op->Named.Name);
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check namepath Ops for orphaned method invocations
+ *
+ * Note: Experimental.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *ChildOp;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *ParentOp;
+ UINT32 ArgCount;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ switch (Op->Common.AmlOpcode)
+ {
+#ifdef ACPI_UNDER_DEVELOPMENT
+ case AML_ADD_OP:
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path);
+ ACPI_FREE (Path);
+
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
+ AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount, AcpiDmCountChildren (Op));
+
+ if (ArgCount < 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+#endif
+
+ case AML_STORE_OP:
+
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (2, 1, NextOp);
+ if (ArgCount <= 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+
+ /* Must examine parent to see if this namepath is an argument */
+
+ ParentOp = Op->Common.Parent;
+ OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CREATE) &&
+ (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
+ !Op->Common.Node)
+ {
+ ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
+
+ /*
+ * Check if namepath is a predicate for if/while or lone parameter to
+ * a return.
+ */
+ if (ArgCount == 0)
+ {
+ if (((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_WHILE_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_RETURN_OP)) &&
+
+ /* And namepath is the first argument */
+ (ParentOp->Common.Value.Arg == Op))
+ {
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ break;
+ }
+ }
+
+ /*
+ * This is a standalone namestring (not a parameter to another
+ * operator) - it *must* be a method invocation, nothing else is
+ * grammatically possible.
+ */
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLoadDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace control method object load
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ /* Only interested in operators that create new names */
+
+ if (!(OpInfo->Flags & AML_NAMED) &&
+ !(OpInfo->Flags & AML_CREATE))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For all named operators, get the new name */
+
+ Path = (char *) Op->Named.Path;
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* New name is the last child */
+
+ NextOp = Op->Common.Value.Arg;
+
+ while (NextOp->Common.Next)
+ {
+ NextOp = NextOp->Common.Next;
+ }
+ Path = NextOp->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /* Insert the name into the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+
+ Op->Common.Node = Node;
+
+
+Exit:
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmXrefDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace cross reference
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if ((!(OpInfo->Flags & AML_NAMED)) &&
+ (!(OpInfo->Flags & AML_CREATE)) &&
+ (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ if ((Op->Common.AmlOpcode == AML_ALIAS_OP) ||
+ (Op->Common.AmlOpcode == AML_SCOPE_OP))
+ {
+ /*
+ * Only these two operators refer to an existing name,
+ * first argument
+ */
+ Path = (char *) Op->Named.Path;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Referenced Buffer Name is the first child */
+
+ NextOp = Op->Common.Value.Arg;
+ if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ Path = NextOp->Common.Value.String;
+ }
+ }
+ else
+ {
+ Path = Op->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /*
+ * Lookup the name in the namespace. Name must exist at this point, or it
+ * is an invalid reference.
+ *
+ * The namespace is also used as a lookup table for references to resource
+ * descriptors and the fields within them.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ AcpiDmAddToExternalList (Path, (UINT8) ObjectType, 0);
+
+ /*
+ * We could install this into the namespace, but we catch duplicate
+ * externals when they are added to the list.
+ */
+#if 0
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+#endif
+ }
+ }
+ else
+ {
+ Op->Common.Node = Node;
+ }
+
+
+Exit:
+ /* Open new scope if necessary */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmResourceDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Process one parse op during symbolic resource index conversion.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Open new scope if necessary */
+
+ ObjectType = OpInfo->ObjectType;
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ /*
+ * Check if this operator contains a reference to a resource descriptor.
+ * If so, convert the reference into a symbolic reference.
+ */
+ AcpiDmCheckResourceReference (Op, WalkState);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCommonAscendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
+ * scope if necessary.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_OBJECT_TYPE ObjectType;
+
+
+ /* Close scope if necessary */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ (void) AcpiDsScopeStackPop (Info->WalkState);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmInspectPossibleArgs
+ *
+ * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
+ * possible method invocation found
+ * TargetCount - Number of targets (0,1,2) for this op
+ * Op - Parse op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine following args and next ops for possible arguments
+ * for an unrecognized method invocation.
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 i;
+ UINT32 Last = 0;
+ UINT32 Lookahead;
+
+
+ Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
+
+ /* Lookahead for the maximum number of possible arguments */
+
+ for (i = 0; i < Lookahead; i++)
+ {
+ if (!Op)
+ {
+ break;
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /*
+ * Any one of these operators is "very probably" not a method arg
+ */
+ if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
+ (Op->Common.AmlOpcode == AML_NOTIFY_OP))
+ {
+ break;
+ }
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CONTROL))
+ {
+ Last = i+1;
+ }
+
+ Op = Op->Common.Next;
+ }
+
+ return (Last);
+}
+
+
diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c
new file mode 100644
index 0000000..ed8b36b
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmrestag.c
@@ -0,0 +1,990 @@
+/******************************************************************************
+ *
+ * Module Name: dmrestag - Add tags to resource descriptors (Application-level)
+ * $Revision: 1.11 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/amlcode.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmrestag")
+
+/* Local prototypes */
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode);
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList);
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex);
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex);
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex);
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/******************************************************************************
+ *
+ * Resource Tag tables
+ *
+ * These are the predefined tags that refer to elements of a resource
+ * descriptor. Each name and offset is defined in the ACPI specification.
+ *
+ * Each table entry contains the bit offset of the field and the associated
+ * name.
+ *
+ ******************************************************************************/
+
+static ACPI_RESOURCE_TAG AcpiDmIrqTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_INTERRUPT},
+ {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 4, ACPI_RESTAG_INTERRUPTSHARE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmDmaTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_DMA},
+ {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE},
+ {( 2 * 8) + 2, ACPI_RESTAG_BUSMASTER},
+ {( 2 * 8) + 5, ACPI_RESTAG_DMATYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoTags[] =
+{
+ {( 1 * 8) + 0, ACPI_RESTAG_DECODE},
+ {( 2 * 8), ACPI_RESTAG_MINADDR},
+ {( 4 * 8), ACPI_RESTAG_MAXADDR},
+ {( 6 * 8), ACPI_RESTAG_ALIGNMENT},
+ {( 7 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 3 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 6 * 8), ACPI_RESTAG_MAXADDR},
+ {( 8 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(10 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] =
+{
+ {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE},
+ {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH},
+ {( 5 * 8), ACPI_RESTAG_REGISTERBITOFFSET},
+ {( 6 * 8), ACPI_RESTAG_ACCESSSIZE},
+ {( 7 * 8), ACPI_RESTAG_ADDRESS},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 8 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(16 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 8 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] =
+{
+ {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
+ {( 5 * 8), ACPI_RESTAG_INTERRUPT},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {( 8 * 8), ACPI_RESTAG_MINADDR},
+ {(10 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_TRANSLATION},
+ {(14 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(10 * 8), ACPI_RESTAG_MINADDR},
+ {(14 * 8), ACPI_RESTAG_MAXADDR},
+ {(18 * 8), ACPI_RESTAG_TRANSLATION},
+ {(22 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(14 * 8), ACPI_RESTAG_MINADDR},
+ {(22 * 8), ACPI_RESTAG_MAXADDR},
+ {(30 * 8), ACPI_RESTAG_TRANSLATION},
+ {(38 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 8 * 8), ACPI_RESTAG_GRANULARITY},
+ {(16 * 8), ACPI_RESTAG_MINADDR},
+ {(24 * 8), ACPI_RESTAG_MAXADDR},
+ {(32 * 8), ACPI_RESTAG_TRANSLATION},
+ {(40 * 8), ACPI_RESTAG_LENGTH},
+ {(48 * 8), ACPI_RESTAG_TYPESPECIFICATTRIBUTES},
+ {0, NULL}
+};
+
+/* Special-case tables for the type-specific flags */
+
+static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE},
+ {( 5 * 8) + 3, ACPI_RESTAG_MEMATTRIBUTES},
+ {( 5 * 8) + 5, ACPI_RESTAG_TYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE},
+ {( 5 * 8) + 4, ACPI_RESTAG_TYPE},
+ {( 5 * 8) + 5, ACPI_RESTAG_TRANSTYPE},
+ {0, NULL}
+};
+
+
+/* Dispatch table used to obtain the correct tag table for a descriptor */
+
+static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] =
+{
+ /* Small descriptors */
+
+ NULL, /* 0x00, Reserved */
+ NULL, /* 0x01, Reserved */
+ NULL, /* 0x02, Reserved */
+ NULL, /* 0x03, Reserved */
+ AcpiDmIrqTags, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
+ AcpiDmDmaTags, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
+ NULL, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
+ NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
+ AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
+ AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
+ NULL, /* 0x0A, Reserved */
+ NULL, /* 0x0B, Reserved */
+ NULL, /* 0x0C, Reserved */
+ NULL, /* 0x0D, Reserved */
+ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
+ NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
+
+ /* Large descriptors */
+
+ NULL, /* 0x00, Reserved */
+ AcpiDmMemory24Tags, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
+ AcpiDmRegisterTags, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
+ NULL, /* 0x03, Reserved */
+ NULL, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
+ AcpiDmMemory32Tags, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
+ AcpiDmFixedMemory32Tags, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
+ AcpiDmAddress32Tags, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
+ AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
+ AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
+ AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
+ AcpiDmExtendedAddressTags /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+};
+
+
+/*
+ * Globals used to generate unique resource descriptor names. We use names that
+ * start with underscore and a prefix letter that is not used by other ACPI
+ * reserved names. To this, we append hex 0x00 through 0xFF. These 5 prefixes
+ * allow for 5*256 = 1280 unique names, probably sufficient for any single ASL
+ * file. If this becomes too small, we can use alpha+numerals for a total
+ * of 5*36*36 = 6480.
+ */
+#define ACPI_NUM_RES_PREFIX 5
+
+static UINT32 AcpiGbl_NextResourceId = 0;
+static UINT8 AcpiGbl_NextPrefix = 0;
+static UINT8 AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
+ {'Y','Z','J','K','X'};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckResourceReference
+ *
+ * PARAMETERS: Op - Parse Op for the AML opcode
+ * WalkState - Current walk state (with valid scope)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert a reference to a resource descriptor to a symbolic
+ * reference if possible
+ *
+ * NOTE: Bit index is used to transparently handle both resource bit
+ * fields and byte fields.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCheckResourceReference (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *BufferNameOp;
+ ACPI_PARSE_OBJECT *IndexOp;
+ ACPI_NAMESPACE_NODE *BufferNode;
+ ACPI_NAMESPACE_NODE *ResourceNode;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Pathname;
+ UINT32 BitIndex;
+
+
+ /* We are only interested in the CreateXxxxField opcodes */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Type != AML_TYPE_CREATE_FIELD)
+ {
+ return;
+ }
+
+ /* Get the buffer term operand */
+
+ BufferNameOp = AcpiPsGetDepthNext (NULL, Op);
+
+ /* Must be a named buffer, not an arg or local or method call */
+
+ if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
+ {
+ return;
+ }
+
+ /* Get the Index term, must be an integer constant to convert */
+
+ IndexOp = BufferNameOp->Common.Next;
+ OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode);
+ if (OpInfo->ObjectType != ACPI_TYPE_INTEGER)
+ {
+ return;
+ }
+
+ /* Get the bit offset of the descriptor within the buffer */
+
+ if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) ||
+ (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP))
+ {
+ /* Index operand is a bit offset */
+
+ BitIndex = (UINT32) IndexOp->Common.Value.Integer;
+ }
+ else
+ {
+ /* Index operand is a byte offset, convert to bits */
+
+ BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer);
+ }
+
+ /* Lookup the buffer in the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
+ &BufferNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Validate object type, we must have a buffer */
+
+ if (BufferNode->Type != ACPI_TYPE_BUFFER)
+ {
+ return;
+ }
+
+ /* Find the resource descriptor node corresponding to the index */
+
+ ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex);
+ if (!ResourceNode)
+ {
+ return;
+ }
+
+ /* Translate the Index to a resource tag pathname */
+
+ Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex);
+ if (Pathname)
+ {
+ /* Complete the conversion of the Index to a symbol */
+
+ IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP;
+ IndexOp->Common.Value.String = Pathname;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceNode
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Namespace node for the resource descriptor. NULL if not found
+ *
+ * DESCRIPTION: Find a resource descriptor that corresponds to the bit index
+ *
+ ******************************************************************************/
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ UINT32 ByteIndex = ACPI_DIV_8 (BitIndex);
+
+
+ /*
+ * Child list contains an entry for each resource descriptor. Find
+ * the descriptor that corresponds to the Index.
+ *
+ * If there are no children, this is not a resource template
+ */
+ Node = BufferNode->Child;
+ while (Node)
+ {
+ /*
+ * Check if the Index falls within this resource.
+ *
+ * Value contains the resource offset, Object contains the resource
+ * length (both in bytes)
+ */
+ if ((ByteIndex >= Node->Value) &&
+ (ByteIndex < (Node->Value + Node->Length)))
+ {
+ return (Node);
+ }
+
+ /* List is circular, this flag marks the end */
+
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ return (NULL);
+ }
+
+ Node = Node->Peer;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetTagPathname
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * ResourceNode - Node for a resource descriptor
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Full pathname for a resource tag. NULL if no match.
+ * Path is returned in AML (packed) format.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag (full pathname)
+ *
+ ******************************************************************************/
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex)
+{
+ ACPI_STATUS Status;
+ UINT32 ResourceBitIndex;
+ UINT8 ResourceTableIndex;
+ ACPI_SIZE RequiredSize;
+ char *Pathname;
+ AML_RESOURCE *Aml;
+ ACPI_PARSE_OBJECT *Op;
+ char *InternalPath;
+ char *Tag;
+
+
+ /* Get the Op that contains the actual buffer data */
+
+ Op = BufferNode->Op->Common.Value.Arg;
+ Op = Op->Common.Next;
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* Get the individual resource descriptor and validate it */
+
+ Aml = ACPI_CAST_PTR (AML_RESOURCE,
+ &Op->Named.Data[ResourceNode->Value]);
+
+ Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ /* Get offset into this descriptor (from offset into entire buffer) */
+
+ ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value);
+
+ /* Get the tag associated with this resource descriptor and offset */
+
+ Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex);
+ if (!Tag)
+ {
+ return (NULL);
+ }
+
+ /*
+ * Now that we know that we have a reference that can be converted to a
+ * symbol, change the name of the resource to a unique name.
+ */
+ AcpiDmUpdateResourceName (ResourceNode);
+
+ /* Get the full pathname to the parent buffer */
+
+ RequiredSize = AcpiNsGetPathnameLength (BufferNode);
+ Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
+ if (!Pathname)
+ {
+ return (NULL);
+ }
+
+ AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
+
+ /*
+ * Create the full path to the resource and tag by: remove the buffer name,
+ * append the resource descriptor name, append a dot, append the tag name.
+ *
+ * TBD: Always using the full path is a bit brute force, the path can be
+ * often be optimized with carats (if the original buffer namepath is a
+ * single nameseg). This doesn't really matter, because these paths do not
+ * end up in the final compiled AML, it's just an appearance issue for the
+ * disassembled code.
+ */
+ Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0;
+ ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+ ACPI_STRCAT (Pathname, ".");
+ ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE);
+
+ /* Internalize the namepath to AML format */
+
+ AcpiNsInternalizeName (Pathname, &InternalPath);
+ ACPI_FREE (Pathname);
+ return (InternalPath);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUpdateResourceName
+ *
+ * PARAMETERS: ResourceNode - Node for a resource descriptor
+ *
+ * RETURN: Stores new name in the ResourceNode
+ *
+ * DESCRIPTION: Create a new, unique name for a resource descriptor. Used by
+ * both the disassembly of the descriptor itself and any symbolic
+ * references to the descriptor. Ignored if a unique name has
+ * already been assigned to the resource.
+ *
+ * NOTE: Single threaded, suitable for applications only!
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode)
+{
+ char Name[ACPI_NAME_SIZE];
+
+
+ /* Ignore if a unique name has already been assigned */
+
+ if (ResourceNode->Name.Integer != ACPI_DEFAULT_RESNAME)
+ {
+ return;
+ }
+
+ /* Generate a new ACPI name for the descriptor */
+
+ Name[0] = '_';
+ Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
+ Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4);
+ Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0);
+
+ /* Update globals for next name */
+
+ AcpiGbl_NextResourceId++;
+ if (AcpiGbl_NextResourceId >= 256)
+ {
+ AcpiGbl_NextResourceId = 0;
+ AcpiGbl_NextPrefix++;
+ if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
+ {
+ AcpiGbl_NextPrefix = 0;
+ }
+ }
+
+ /* Change the resource descriptor name */
+
+ ResourceNode->Name.Integer = *(UINT32 *) Name;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceTag
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * Resource - Pointer to the raw resource data
+ * ResourceIndex - Index correspoinding to the resource type
+ *
+ * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex)
+{
+ ACPI_RESOURCE_TAG *TagList;
+ char *Tag = NULL;
+
+
+ /* Get the tag list for this resource descriptor type */
+
+ TagList = AcpiGbl_ResourceTags[ResourceIndex];
+ if (!TagList)
+ {
+ /* There are no tags for this resource type */
+
+ return (NULL);
+ }
+
+ /*
+ * Handle the type-specific flags field for the address descriptors.
+ * Kindof brute force, but just blindly search for an index match.
+ */
+ switch (Resource->DescriptorType)
+ {
+ case ACPI_RESOURCE_NAME_ADDRESS16:
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
+ case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
+
+ if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags);
+ }
+ else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags);
+ }
+
+ /* If we found a match, all done. Else, drop to normal search below */
+
+ if (Tag)
+ {
+ return (Tag);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Search the tag list for this descriptor type */
+
+ Tag = AcpiDmSearchTagList (BitIndex, TagList);
+ return (Tag);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSearchTagList
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * TagList - List to search
+ *
+ * RETURN: Pointer to a tag (ACPI_NAME). NULL if no match found.
+ *
+ * DESCRIPTION: Search a tag list for a match to the input BitIndex. Matches
+ * a fixed offset to a symbolic resource tag name.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList)
+{
+
+ /*
+ * Walk the null-terminated tag list to find a matching bit offset.
+ * We are looking for an exact match.
+ */
+ for ( ; TagList->Tag; TagList++)
+ {
+ if (BitIndex == TagList->BitIndex)
+ {
+ return (TagList->Tag);
+ }
+ }
+
+ /* A matching offset was not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindResources
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add all ResourceTemplate declarations to the namespace. Each
+ * resource descriptor in each template is given a node -- used
+ * for later conversion of resource references to symbolic refs.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindResources (
+ ACPI_PARSE_OBJECT *Root)
+{
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_PARSE_OBJECT *Parent;
+
+
+ /* Walk the entire parse tree */
+
+ while (Op)
+ {
+ /* We are interested in Buffer() declarations */
+
+ if (Op->Common.AmlOpcode == AML_BUFFER_OP)
+ {
+ /* And only declarations of the form Name (XXXX, Buffer()... ) */
+
+ Parent = Op->Common.Parent;
+ if (Parent->Common.AmlOpcode == AML_NAME_OP)
+ {
+ /*
+ * If the buffer is a resource template, add the individual
+ * resource descriptors to the namespace, as children of the
+ * buffer node.
+ */
+ if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
+ }
+ }
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourcesToNamespace
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * Op - Parse op for the buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add an entire resource template to the namespace. Each
+ * resource descriptor is added as a namespace node.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ /* Get to the ByteData list */
+
+ NextOp = Op->Common.Value.Arg;
+ NextOp = NextOp->Common.Next;
+ if (!NextOp)
+ {
+ return;
+ }
+
+ /* Set Node and Op to point to each other */
+
+ BufferNode->Op = Op;
+ Op->Common.Node = BufferNode;
+
+ /*
+ * Insert each resource into the namespace
+ * NextOp contains the Aml pointer and the Aml length
+ */
+ AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
+ (ACPI_SIZE) NextOp->Common.Value.Integer,
+ AcpiDmAddResourceToNamespace, BufferNode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourceToNamespace
+ *
+ * PARAMETERS: ACPI_WALK_AML_CALLBACK
+ * BufferNode - Node for the parent buffer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Add one resource descriptor to the namespace as a child of the
+ * parent buffer. The same name is used for each descriptor. This
+ * is changed later to a unique name if the resource is actually
+ * referenced by an AML operator.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ /* TBD: Don't need to add descriptors that have no tags defined? */
+
+ /* Add the resource to the namespace, as child of the buffer */
+
+ ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
+ Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
+ ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
+ NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Set the name to the default, changed later if resource is referenced */
+
+ Node->Name.Integer = ACPI_DEFAULT_RESNAME;
+
+ /* Save the offset of the descriptor (within the original buffer) */
+
+ Node->Value = Offset;
+ Node->Length = Length;
+ return (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c
new file mode 100644
index 0000000..ce4b5f9
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtable.c
@@ -0,0 +1,734 @@
+/******************************************************************************
+ *
+ * Module Name: dmtable - Support for ACPI tables that contain no AML code
+ * $Revision: 1.12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtable")
+
+/* Local Prototypes */
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature);
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Target,
+ UINT32 Count);
+
+
+/* These tables map a subtable type to a description string */
+
+static const char *AcpiDmDmarSubnames[] =
+{
+ "Hardware Unit Definition",
+ "Reserved Memory Region",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmMadtSubnames[] =
+{
+ "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
+ "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
+ "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
+ "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
+ "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
+ "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
+ "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
+ "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
+ "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmSratSubnames[] =
+{
+ "Processor Local APIC/SAPIC Affinity",
+ "Memory Affinity",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+
+/*******************************************************************************
+ *
+ * ACPI Table Data, indexed by signature.
+ *
+ * Simple tables have only a TableInfo structure, complex tables have a handler.
+ * This table must be NULL terminated. RSDP and FACS are special-cased
+ * elsewhere.
+ *
+ ******************************************************************************/
+
+static ACPI_DMTABLE_DATA AcpiDmTableData[] =
+{
+ {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
+ {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
+ {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
+ {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
+ {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
+ {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
+ {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
+ {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
+ {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
+ {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
+ {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
+ {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
+ {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
+ {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
+ {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
+ {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
+ {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
+ {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
+ {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
+ {NULL, NULL, NULL, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGenerateChecksum
+ *
+ * PARAMETERS: Table - Pointer to a valid ACPI table (with a
+ * standard ACPI header)
+ *
+ * RETURN: 8 bit checksum of buffer
+ *
+ * DESCRIPTION: Computes an 8 bit checksum of the table.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiTbGenerateChecksum (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT8 Checksum;
+
+
+ /* Sum the entire table as-is */
+
+ Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length);
+
+ /* Subtract off the existing checksum value in the table */
+
+ Checksum = (UINT8) (Checksum - Table->Checksum);
+
+ /* Compute the final checksum */
+
+ Checksum = (UINT8) (0 - Checksum);
+ return (Checksum);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetTableData
+ *
+ * PARAMETERS: Signature - ACPI signature (4 chars) to match
+ *
+ * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
+ *
+ * DESCRIPTION: Find a match in the global table of supported ACPI tables
+ *
+ ******************************************************************************/
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature)
+{
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ {
+ if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
+ {
+ return (TableData);
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDataTable
+ *
+ * PARAMETERS: Table - An ACPI table
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Format the contents of an ACPI data table (any table other
+ * than an SSDT or DSDT that does not contain executable AML code)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDataTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ UINT32 Length;
+
+
+ /* Ignore tables that contain AML */
+
+ if (AcpiUtIsAmlTable (Table))
+ {
+ return;
+ }
+
+ /*
+ * Handle tables that don't use the common ACPI table header structure.
+ * Currently, these are the FACS and RSDP.
+ */
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
+ {
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
+ }
+ else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
+ {
+ Length = AcpiDmDumpRsdp (Table);
+ }
+ else
+ {
+ /*
+ * All other tables must use the common ACPI table header, dump it now
+ */
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
+ AcpiOsPrintf ("\n");
+
+ /* Match signature and dispatch appropriately */
+
+ TableData = AcpiDmGetTableData (Table->Signature);
+ if (!TableData)
+ {
+ if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
+ {
+ AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
+ Table->Signature);
+ }
+ }
+ else if (TableData->TableHandler)
+ {
+ /* Complex table, has a handler */
+
+ TableData->TableHandler (Table);
+ }
+ else if (TableData->TableInfo)
+ {
+ /* Simple table, just walk the info table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
+ }
+ }
+
+ /* Always dump the raw table data */
+
+ AcpiOsPrintf ("\nRaw Table Data\n\n");
+ AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLineHeader
+ *
+ * PARAMETERS: Offset - Current byte offset, from table start
+ * ByteLength - Length of the field in bytes, 0 for flags
+ * Name - Name of this field
+ * Value - Optional value, displayed on left of ':'
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Utility routines for formatting output lines. Displays the
+ * current table offset in hex and decimal, the field length,
+ * and the field name.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmLineHeader (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ",
+ Offset, Offset, ByteLength, Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("%42s : ",
+ Name);
+ }
+}
+
+void
+AcpiDmLineHeader2 (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name,
+ UINT32 Value)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ",
+ Offset, Offset, ByteLength, Name, Value);
+ }
+ else
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ",
+ Offset, Offset, Name, Value);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTable
+ *
+ * PARAMETERS: TableLength - Length of the entire ACPI table
+ * TableOffset - Starting offset within the table for this
+ * sub-descriptor (0 if main table)
+ * Table - The ACPI table
+ * SubtableLength - Lenghth of this sub-descriptor
+ * Info - Info table for this ACPI table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display ACPI table contents by walking the Info table.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTable (
+ UINT32 TableLength,
+ UINT32 TableOffset,
+ void *Table,
+ UINT32 SubtableLength,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT8 *Target;
+ UINT32 CurrentOffset;
+ UINT32 ByteLength;
+ UINT8 Temp8;
+ UINT16 Temp16;
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ if (!Info)
+ {
+ AcpiOsPrintf ("Display not implemented\n");
+ return;
+ }
+
+ /* Walk entire Info table; Null name terminates */
+
+ for (; Info->Name; Info++)
+ {
+ /*
+ * Target points to the field within the ACPI Table. CurrentOffset is
+ * the offset of the field from the start of the main table.
+ */
+ Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
+ CurrentOffset = TableOffset + Info->Offset;
+
+ /* Check for beyond EOT or beyond subtable end */
+
+ if ((CurrentOffset >= TableLength) ||
+ (SubtableLength && (Info->Offset >= SubtableLength)))
+ {
+ return;
+ }
+
+ /* Generate the byte length for this field */
+
+ switch (Info->Opcode)
+ {
+ case ACPI_DMT_UINT8:
+ case ACPI_DMT_CHKSUM:
+ case ACPI_DMT_SPACEID:
+ case ACPI_DMT_MADT:
+ case ACPI_DMT_SRAT:
+ ByteLength = 1;
+ break;
+ case ACPI_DMT_UINT16:
+ case ACPI_DMT_DMAR:
+ ByteLength = 2;
+ break;
+ case ACPI_DMT_UINT24:
+ ByteLength = 3;
+ break;
+ case ACPI_DMT_UINT32:
+ case ACPI_DMT_NAME4:
+ case ACPI_DMT_SIG:
+ ByteLength = 4;
+ break;
+ case ACPI_DMT_NAME6:
+ ByteLength = 6;
+ break;
+ case ACPI_DMT_UINT56:
+ ByteLength = 7;
+ break;
+ case ACPI_DMT_UINT64:
+ case ACPI_DMT_NAME8:
+ ByteLength = 8;
+ break;
+ case ACPI_DMT_STRING:
+ ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
+ break;
+ case ACPI_DMT_GAS:
+ AcpiOsPrintf ("\n");
+ ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
+ break;
+ default:
+ ByteLength = 0;
+ break;
+ }
+
+ /* Start a new line and decode the opcode */
+
+ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
+
+ switch (Info->Opcode)
+ {
+ /* Single-bit Flag fields. Note: Opcode is the bit position */
+
+ case ACPI_DMT_FLAG0:
+ case ACPI_DMT_FLAG1:
+ case ACPI_DMT_FLAG2:
+ case ACPI_DMT_FLAG3:
+ case ACPI_DMT_FLAG4:
+ case ACPI_DMT_FLAG5:
+ case ACPI_DMT_FLAG6:
+ case ACPI_DMT_FLAG7:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
+ break;
+
+ /* 2-bit Flag fields */
+
+ case ACPI_DMT_FLAGS0:
+
+ AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
+ break;
+
+ case ACPI_DMT_FLAGS2:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
+ break;
+
+ /* Standard Data Types */
+
+ case ACPI_DMT_UINT8:
+
+ AcpiOsPrintf ("%2.2X\n", *Target);
+ break;
+
+ case ACPI_DMT_UINT16:
+
+ AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target));
+ break;
+
+ case ACPI_DMT_UINT24:
+
+ AcpiOsPrintf ("%2.2X%2.2X%2.2X\n",
+ *Target, *(Target + 1), *(Target + 2));
+ break;
+
+ case ACPI_DMT_UINT32:
+
+ AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target));
+ break;
+
+ case ACPI_DMT_UINT56:
+
+ AcpiOsPrintf ("%6.6X%8.8X\n",
+ ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF,
+ ACPI_LODWORD (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_UINT64:
+
+ AcpiOsPrintf ("%8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_STRING:
+
+ AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target));
+ break;
+
+ /* Fixed length ASCII name fields */
+
+ case ACPI_DMT_SIG:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\" ", Target);
+ TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
+ if (TableData)
+ {
+ AcpiOsPrintf ("/* %s */", TableData->Name);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_NAME4:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME6:
+
+ AcpiDmCheckAscii (Target, 6);
+ AcpiOsPrintf ("\"%6.6s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME8:
+
+ AcpiDmCheckAscii (Target, 8);
+ AcpiOsPrintf ("\"%8.8s\"\n", Target);
+ break;
+
+ /* Special Data Types */
+
+ case ACPI_DMT_CHKSUM:
+
+ /* Checksum, display and validate */
+
+ AcpiOsPrintf ("%2.2X", *Target);
+ Temp8 = AcpiTbGenerateChecksum (Table);
+ if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
+ {
+ AcpiOsPrintf (
+ " /* Incorrect checksum, should be %2.2X */", Temp8);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_SPACEID:
+
+ /* Address Space ID */
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target));
+ break;
+
+ case ACPI_DMT_GAS:
+
+ /* Generic Address Structure */
+
+ AcpiOsPrintf ("<Generic Address Structure>\n");
+ AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+ CurrentOffset, Target, 0, AcpiDmTableInfoGas);
+ break;
+
+ case ACPI_DMT_DMAR:
+
+ /* DMAR subtable types */
+
+ Temp16 = *Target;
+ if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
+ {
+ Temp16 = ACPI_DMAR_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]);
+ break;
+
+ case ACPI_DMT_MADT:
+
+ /* MADT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_MADT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_MADT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_SRAT:
+
+ /* SRAT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_SRAT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_EXIT:
+ return;
+
+ default:
+ ACPI_ERROR ((AE_INFO,
+ "**** Invalid table opcode [%X] ****\n", Info->Opcode));
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckAscii
+ *
+ * PARAMETERS: Name - Ascii string
+ * Count - Number of characters to check
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Ensure that the requested number of characters are printable
+ * Ascii characters. Sets non-printable and null chars to <space>.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Name,
+ UINT32 Count)
+{
+ UINT32 i;
+
+
+ for (i = 0; i < Count; i++)
+ {
+ if (!Name[i] || !isprint (Name[i]))
+ {
+ Name[i] = ' ';
+ }
+ }
+}
diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c
new file mode 100644
index 0000000..03ca323
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtbdump.c
@@ -0,0 +1,798 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
+ * $Revision: 1.15 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbdump")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdp
+ *
+ * PARAMETERS: Table - A RSDP
+ *
+ * RETURN: Length of the table (there is no length field, use revision)
+ *
+ * DESCRIPTION: Format the contents of a RSDP
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmDumpRsdp (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Length = ACPI_RSDP_REV0_SIZE;
+
+
+ /* Dump the common ACPI 1.0 portion */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
+
+ /* ACPI 2.0+ contains more data and has a Length field */
+
+ if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0)
+ {
+ Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdt
+ *
+ * PARAMETERS: Table - A RSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a RSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpRsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* RSDT uses 32-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X\n", Array[i]);
+ Offset += sizeof (UINT32);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpXsdt
+ *
+ * PARAMETERS: Table - A XSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a XSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpXsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT64 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* XSDT uses 64-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+ Offset += sizeof (UINT64);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpFadt
+ *
+ * PARAMETERS: Table - A FADT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a FADT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpFadt (
+ ACPI_TABLE_HEADER *Table)
+{
+
+ /* Common ACPI 1.0 portion of FADT */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+
+ /* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
+
+ if (Table->Length >= sizeof (ACPI_TABLE_FADT))
+ {
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+ }
+
+ /* Validate various fields in the FADT, including length */
+
+ AcpiTbCreateLocalFadt (Table, Table->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpAsf
+ *
+ * PARAMETERS: Table - A ASF table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a ASF table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpAsf (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
+ ACPI_ASF_INFO *SubTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMTABLE_INFO *DataInfoTable = NULL;
+ UINT8 *DataTable = NULL;
+ ACPI_NATIVE_UINT DataCount = 0;
+ ACPI_NATIVE_UINT DataLength = 0;
+ ACPI_NATIVE_UINT DataOffset = 0;
+ ACPI_NATIVE_UINT i;
+
+
+ /* No main table, only sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr);
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_INFO:
+ InfoTable = AcpiDmTableInfoAsf0;
+ break;
+
+ case ACPI_ASF_TYPE_ALERT:
+ InfoTable = AcpiDmTableInfoAsf1;
+ DataInfoTable = AcpiDmTableInfoAsf1a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
+ DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
+ DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
+ break;
+
+ case ACPI_ASF_TYPE_CONTROL:
+ InfoTable = AcpiDmTableInfoAsf2;
+ DataInfoTable = AcpiDmTableInfoAsf2a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
+ DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
+ DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
+ break;
+
+ case ACPI_ASF_TYPE_BOOT:
+ InfoTable = AcpiDmTableInfoAsf3;
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+ InfoTable = AcpiDmTableInfoAsf4;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
+ DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
+ DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
+ break;
+
+ default:
+ AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable);
+
+
+ /* Dump variable-length extra data */
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_ALERT:
+ case ACPI_ASF_TYPE_CONTROL:
+
+ for (i = 0; i < DataCount; i++)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable);
+
+ DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
+ DataOffset += DataLength;
+ }
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+
+ for (i = 0; i < DataLength; i++)
+ {
+ if (!(i % 16))
+ {
+ AcpiDmLineHeader (DataOffset, 1, "Addresses");
+ }
+
+ AcpiOsPrintf ("%2.2X ", *DataTable);
+ DataTable++;
+ DataOffset++;
+ }
+
+ AcpiOsPrintf ("\n");
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Header.Length;
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpCpep
+ *
+ * PARAMETERS: Table - A CPEP table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a CPEP. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpCpep (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_CPEP_POLLING *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDmar
+ *
+ * PARAMETERS: Table - A DMAR table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a DMAR. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDmar (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMAR_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
+ UINT32 ScopeOffset;
+ UINT8 *PciPath;
+ UINT32 PathOffset;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ InfoTable = AcpiDmTableInfoDmar0;
+ ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
+ break;
+ case ACPI_DMAR_TYPE_RESERVED_MEMORY:
+ InfoTable = AcpiDmTableInfoDmar1;
+ ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /*
+ * Currently, a common flag indicates whether there are any
+ * device scope entries present at the end of the subtable.
+ */
+ if ((SubTable->Flags & ACPI_DMAR_INCLUDE_ALL) == 0)
+ {
+ /* Dump the device scope entries */
+
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
+ while (ScopeOffset < SubTable->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
+ ScopeTable->Length, AcpiDmTableInfoDmarScope);
+
+ /* Dump the PCI Path entries for this device scope */
+
+ PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
+
+ PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
+ sizeof (ACPI_DMAR_DEVICE_SCOPE));
+
+ while (PathOffset < ScopeTable->Length)
+ {
+ AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
+ AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
+
+ /* Point to next PCI Path entry */
+
+ PathOffset += 2;
+ PciPath += 2;
+ }
+
+ /* Point to next device scope entry */
+
+ ScopeOffset += ScopeTable->Length;
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
+ ScopeTable, ScopeTable->Length);
+ }
+ }
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMadt
+ *
+ * PARAMETERS: Table - A MADT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MADT. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_SUBTABLE_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_MADT);
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_MADT_TYPE_LOCAL_APIC:
+ InfoTable = AcpiDmTableInfoMadt0;
+ break;
+ case ACPI_MADT_TYPE_IO_APIC:
+ InfoTable = AcpiDmTableInfoMadt1;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt2;
+ break;
+ case ACPI_MADT_TYPE_NMI_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt3;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+ InfoTable = AcpiDmTableInfoMadt4;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt5;
+ break;
+ case ACPI_MADT_TYPE_IO_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt6;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt7;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt8;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMcfg
+ *
+ * PARAMETERS: Table - A MCFG Table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MCFG table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMcfg (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
+ ACPI_MCFG_ALLOCATION *SubTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+ {
+ AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
+ sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
+
+ /* Point to next sub-table (each subtable is of fixed length) */
+
+ Offset += sizeof (ACPI_MCFG_ALLOCATION);
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
+ sizeof (ACPI_MCFG_ALLOCATION));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSlit
+ *
+ * PARAMETERS: Table - An SLIT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SLIT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSlit (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset;
+ UINT8 *Row;
+ UINT32 Localities;
+ UINT32 i;
+ UINT32 j;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+
+ /* Display the Locality NxN Matrix */
+
+ Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
+ Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
+
+ for (i = 0; i < Localities; i++)
+ {
+ /* Display one row of the matrix */
+
+ AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
+ for (j = 0; j < Localities; j++)
+ {
+ /* Check for beyond EOT */
+
+ if (Offset >= Table->Length)
+ {
+ AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
+ return;
+ }
+
+ AcpiOsPrintf ("%2.2X ", Row[j]);
+ Offset++;
+
+ /* Display up to 16 bytes per output row */
+
+ if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmLineHeader (Offset, 0, "");
+ }
+ }
+
+ /* Point to next row */
+
+ AcpiOsPrintf ("\n");
+ Row += Localities;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSrat
+ *
+ * PARAMETERS: Table - A SRAT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SRAT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSrat (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
+ ACPI_SUBTABLE_HEADER *SubTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ switch (SubTable->Type)
+ {
+ case ACPI_SRAT_TYPE_CPU_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat0;
+ break;
+ case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat1;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c
new file mode 100644
index 0000000..5454005
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtbinfo.c
@@ -0,0 +1,967 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbinfo - Table info for non-AML tables
+ * $Revision: 1.13 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbinfo")
+
+/*
+ * Macros used to generate offsets to specific table fields
+ */
+#define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f)
+#define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f)
+#define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f)
+#define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f)
+#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f)
+#define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f)
+#define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f)
+#define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f)
+#define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f)
+#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f)
+#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f)
+#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f)
+#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f)
+#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
+#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f)
+#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
+#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
+#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
+#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
+
+/* Sub-tables */
+
+#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f)
+#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f)
+#define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f)
+#define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f)
+#define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f)
+#define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f)
+#define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
+#define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
+#define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
+#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
+#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f)
+#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f)
+#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f)
+#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f)
+#define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f)
+#define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f)
+#define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f)
+#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f)
+#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f)
+#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f)
+#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
+#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f)
+#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
+#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
+
+/*
+ * Simplify access to flag fields by breaking them up into bytes
+ */
+#define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o)
+
+/* Flags */
+
+#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o)
+#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o)
+#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o)
+#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o)
+#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o)
+#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o)
+#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o)
+#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o)
+#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o)
+#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o)
+#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o)
+#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o)
+
+
+/*
+ * ACPI Table Information, used to dump formatted ACPI tables
+ *
+ * Each entry is of the form: <Field Type, Field Offset, Field Name>
+ */
+
+/*******************************************************************************
+ *
+ * Common ACPI table header
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] =
+{
+ {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length"},
+ {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision"},
+ {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * GAS - Generic Address Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] =
+{
+ {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width"},
+ {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] =
+{
+ {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] =
+{
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum"},
+ {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
+{
+ {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"},
+ {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"},
+ {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature is FACP)
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
+{
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Architecture Flags"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"},
+
+ /* Flags byte 0 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD is operational"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD does not invalidate"},
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system"},
+ {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Power button is generic"},
+ {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Sleep button is generic"},
+ {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup not fixed"},
+ {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup/S4 not possible"},
+
+ /* Flags byte 1 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
+{
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case"},
+ {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video"},
+ {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Native instr after SLP_TYP"},
+ {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Supported"},
+ {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer"},
+
+ /* Flags byte 2 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid after S4"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable"},
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Cluster Model"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Physical Dest Mode"},
+
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
+ {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address"},
+ {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*
+ * Remaining tables are not consumed directly by the ACPICA subsystem
+ */
+
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ ******************************************************************************/
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 0: ASF Information */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Polling Interval"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"},
+ {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (SystemId), "Manufacturer ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"},
+ {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: ASF Alerts */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1a: ASF Alert data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: ASF Remote Control */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length"},
+ {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2a: ASF Control data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: ASF RMCP Boot Options */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] =
+{
+ {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilites"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code"},
+ {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: ASF Address */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] =
+{
+ {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index"},
+ {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] =
+{
+ {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"},
+ {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DMAR - DMA Remapping table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] =
+{
+ {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Header.Flags), "Flags"},
+ {ACPI_DMT_UINT24, ACPI_DMAR0_OFFSET (Header.Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common device scope entry */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Segment), "PCI Segment Number"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* DMAR sub-tables */
+
+/* 0: Hardware Unit Definition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: Reserved Memory Defininition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] =
+{
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register"},
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register"},
+ {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID"},
+ {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number"},
+ {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] =
+{
+ {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID"},
+ {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"},
+ {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "Page Protect"},
+ {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"},
+ {ACPI_DMT_FLAG2, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table and subtables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] =
+{
+ {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* MADT sub-tables */
+
+/* 0: processor APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID"},
+ {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: IO APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: Interrupt Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus"},
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source"},
+ {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: NMI Sources */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: Local APIC NMI */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 5: Address Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 6: I/O Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base"},
+ {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 7: Local Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID"},
+ {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 8: Platform Interrupt Source */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number"},
+ {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Information Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] =
+{
+ {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag"},
+ {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table and sub-tables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision"},
+ {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
+{
+ {ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"},
+ {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)"},
+ {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] =
+{
+ {ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"},
+ {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (MemoryType), "Memory Type"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"},
+ {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"},
+ {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
+{
+ {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length"},
+ {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (HeaderLength), "Header Length"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (TimerPeriod), "Timer Period"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MaxCount), "Max Count"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MinCount), "Min Count"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_WDRT_OFFSET (Flags), "Enabled"},
+ {ACPI_DMT_FLAG7, ACPI_WDRT_OFFSET (Flags), "Stopped When Asleep"},
+ {ACPI_DMT_UINT24, ACPI_WDRT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (Entries), "Watchdog Entries"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c
index cdad6e1..2c61575 100644
--- a/sys/contrib/dev/acpica/common/getopt.c
+++ b/sys/contrib/dev/acpica/common/getopt.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: getopt
- * $Revision: 1.8 $
+ * $Revision: 1.10 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
OpenPOWER on IntegriCloud