summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-07-06 20:57:28 +0000
committerjkim <jkim@FreeBSD.org>2010-07-06 20:57:28 +0000
commitee32cc37846fecf2cb4ccc3dbb6b5b016d146813 (patch)
treea1a1e6ac1daa6cd0de9bf90f7809c15a3f9bc326 /sys/contrib/dev/acpica/compiler
parenta3fd34d6553f34a17c1ec61d3694f885e251cf65 (diff)
parent9ef1b91c0f59a1a15565c354b3e372ab265c7b5a (diff)
downloadFreeBSD-src-ee32cc37846fecf2cb4ccc3dbb6b5b016d146813.zip
FreeBSD-src-ee32cc37846fecf2cb4ccc3dbb6b5b016d146813.tar.gz
Merge ACPICA 20100702.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslanalyze.c2
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompile.c76
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h35
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.l2
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.y2
-rw-r--r--sys/contrib/dev/acpica/compiler/asldefine.h8
-rw-r--r--sys/contrib/dev/acpica/compiler/aslerror.c9
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfiles.c101
-rw-r--r--sys/contrib/dev/acpica/compiler/aslglobal.h10
-rw-r--r--sys/contrib/dev/acpica/compiler/asllookup.c4
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c34
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopt.c2
-rw-r--r--sys/contrib/dev/acpica/compiler/aslpredef.c6
-rw-r--r--sys/contrib/dev/acpica/compiler/aslstartup.c186
-rw-r--r--sys/contrib/dev/acpica/compiler/asltransform.c2
-rw-r--r--sys/contrib/dev/acpica/compiler/asltree.c12
-rw-r--r--sys/contrib/dev/acpica/compiler/asltypes.h35
-rw-r--r--sys/contrib/dev/acpica/compiler/aslutils.c101
-rw-r--r--sys/contrib/dev/acpica/compiler/dtcompile.c623
-rw-r--r--sys/contrib/dev/acpica/compiler/dtcompiler.h487
-rw-r--r--sys/contrib/dev/acpica/compiler/dtfield.c538
-rw-r--r--sys/contrib/dev/acpica/compiler/dtio.c698
-rw-r--r--sys/contrib/dev/acpica/compiler/dtsubtable.c400
-rw-r--r--sys/contrib/dev/acpica/compiler/dttable.c1409
-rw-r--r--sys/contrib/dev/acpica/compiler/dttemplate.c445
-rw-r--r--sys/contrib/dev/acpica/compiler/dttemplate.h757
-rw-r--r--sys/contrib/dev/acpica/compiler/dtutils.c902
27 files changed, 6730 insertions, 156 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c
index 608f6e5..1929b86 100644
--- a/sys/contrib/dev/acpica/compiler/aslanalyze.c
+++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -531,7 +531,7 @@ AnGetBtype (
if (!Node)
{
DbgPrint (ASL_DEBUG_OUTPUT,
- "No attached Nsnode: [%s] at line %d name [%s], ignoring typecheck\n",
+ "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return ACPI_UINT32_MAX;
diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c
index 439c21a..00fa31d 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompile.c
+++ b/sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -127,10 +127,6 @@ static void
CmFlushSourceCode (
void);
-static ACPI_STATUS
-FlCheckForAscii (
- ASL_FILE_INFO *FileInfo);
-
void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
@@ -433,7 +429,7 @@ FlConsumeNewComment (
*
******************************************************************************/
-static ACPI_STATUS
+ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo)
{
@@ -543,31 +539,6 @@ CmDoCompile (
FullCompile = UtBeginEvent ("*** Total Compile time ***");
Event = UtBeginEvent ("Open input and output files");
-
- /* Open the required input and output files */
-
- Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
- if (ACPI_FAILURE (Status))
- {
- AePrintErrorLog (ASL_FILE_STDERR);
- return -1;
- }
-
- /* Check for 100% ASCII source file (comments are ignored) */
-
- Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
- if (ACPI_FAILURE (Status))
- {
- AePrintErrorLog (ASL_FILE_STDERR);
- return -1;
- }
-
- Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
- if (ACPI_FAILURE (Status))
- {
- AePrintErrorLog (ASL_FILE_STDERR);
- return -1;
- }
UtEndEvent (Event);
/* Build the parse tree */
@@ -888,19 +859,24 @@ CmCleanupAndExit (
if (Gbl_NsLookupCount)
{
- DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n");
- DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches",
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "\n\nMiscellaneous compile statistics\n\n");
+
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "%32s : %u\n", "Total Namespace searches",
Gbl_NsLookupCount);
- DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d usec\n", "Time per search",
- ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
- AslGbl_Events[AslGbl_NamespaceEvent].StartTime) /
- 10) / Gbl_NsLookupCount);
- }
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "%32s : %u usec\n", "Time per search", ((UINT32)
+ (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
+ AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
+ Gbl_NsLookupCount);
+ }
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%u) exceeded\n",
+ ASL_MAX_ERROR_COUNT);
}
UtDisplaySummary (ASL_FILE_STDOUT);
@@ -914,22 +890,38 @@ CmCleanupAndExit (
/* Delete AML file if there are errors */
- if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) &&
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
{
- remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename))
+ {
+ printf ("%s: ",
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ perror ("Could not delete AML file");
+ }
}
/*
* Delete intermediate ("combined") source file (if -ls flag not set)
+ * This file is created during normal ASL/AML compiles. It is not
+ * created by the data table compiler.
+ *
+ * If the -ls flag is set, then the .SRC file should not be deleted.
+ * In this case, Gbl_SourceOutputFlag is set to TRUE.
+ *
+ * Note: Handles are cleared by FlCloseFile above, so we look at the
+ * filename instead, to determine if the .SRC file was actually
+ * created.
*
* TBD: SourceOutput should be .TMP, then rename if we want to keep it?
*/
- if (!Gbl_SourceOutputFlag)
+ if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)
{
if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
{
- printf ("Could not remove SRC file, %s\n",
+ printf ("%s: ",
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ perror ("Could not delete SRC file");
}
}
}
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
index a277c67..1d0667a 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -189,8 +189,12 @@ AslPushInputFileStack (
char *Filename);
/*
- * aslstartup - called from main
+ * aslstartup - entered from main()
*/
+void
+AslInitializeGlobals (
+ void);
+
ACPI_STATUS
AslDoOnePathname (
char *Pathname);
@@ -222,6 +226,10 @@ void
CmCleanupAndExit (
void);
+ACPI_STATUS
+FlCheckForAscii (
+ ASL_FILE_INFO *FileInfo);
+
/*
* aslanalyze - semantic analysis
@@ -426,6 +434,16 @@ CgGenerateAmlOutput (
/*
+ * aslfile
+ */
+void
+FlOpenFile (
+ UINT32 FileId,
+ char *Filename,
+ char *Mode);
+
+
+/*
* asllength - calculate/adjust AML package lengths
*/
ACPI_STATUS
@@ -680,6 +698,10 @@ DbgPrint (
#define ASL_TREE_OUTPUT 2
void
+UtDisplaySupportedTables (
+ void);
+
+void
UtDisplayConstantOpcodes (
void);
@@ -1003,5 +1025,16 @@ RsDoWordBusNumberDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
+/*
+ * Entry to data table compiler subsystem
+ */
+ACPI_STATUS
+DtDoCompile(
+ void);
+
+ACPI_STATUS
+DtCreateTemplates (
+ char *Signature);
+
#endif /* __ASLCOMPILER_H */
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l
index bf9077f..62dd93c 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.l
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l
@@ -725,7 +725,7 @@ InsertLineBuffer (
* Warning if we have split a long source line.
* <Probably overkill>
*/
- sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE);
+ sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE);
AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
Gbl_CurrentLineOffset, Gbl_CurrentColumn,
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y
index d5120de..42d02a6 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.y
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -3164,7 +3164,7 @@ AslLocalAllocate (unsigned int Size)
void *Mem;
- DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size);
+ DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
Mem = ACPI_ALLOCATE_ZEROED (Size);
if (!Mem)
diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h
index cff4ecf..4cd8130 100644
--- a/sys/contrib/dev/acpica/compiler/asldefine.h
+++ b/sys/contrib/dev/acpica/compiler/asldefine.h
@@ -182,6 +182,14 @@
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_ASM_INCLUDE "inc"
#define FILE_SUFFIX_C_INCLUDE "h"
+#define FILE_SUFFIX_ASL_CODE "asl"
+
+
+/* Types for input files */
+
+#define ASL_INPUT_TYPE_BINARY 0
+#define ASL_INPUT_TYPE_ASCII_ASL 1
+#define ASL_INPUT_TYPE_ASCII_DATA 2
/* Misc */
diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c
index 1fa78a5..262dd20 100644
--- a/sys/contrib/dev/acpica/compiler/aslerror.c
+++ b/sys/contrib/dev/acpica/compiler/aslerror.c
@@ -280,7 +280,14 @@ AePrintException (
/* Get the file handles */
OutputFile = Gbl_Files[FileId].Handle;
+
+ /* Use the merged header/source file if present, otherwise use input file */
+
SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
+ if (!SourceFile)
+ {
+ SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
+ }
if (Header)
{
@@ -525,7 +532,7 @@ AslCommonError (
Gbl_ExceptionCount[Level]++;
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c
index ca23834..3557b1f 100644
--- a/sys/contrib/dev/acpica/compiler/aslfiles.c
+++ b/sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -122,12 +122,6 @@
/* Local prototypes */
-static void
-FlOpenFile (
- UINT32 FileId,
- char *Filename,
- char *Mode);
-
FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
@@ -212,7 +206,7 @@ FlFileError (
*
******************************************************************************/
-static void
+void
FlOpenFile (
UINT32 FileId,
char *Filename,
@@ -774,6 +768,55 @@ FlOpenMiscOutputFiles (
char *Filename;
+ /* Create/Open a hex output file if asked */
+
+ if (Gbl_HexOutputFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the hex file, text mode */
+
+ FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
+
+ AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
+ }
+
+ /* Create/Open a debug output file if asked */
+
+ if (Gbl_DebugFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the debug file as STDERR, text mode */
+
+ /* TBD: hide this behind a FlReopenFile function */
+
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
+ freopen (Filename, "w+t", stderr);
+
+ AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
+ }
+
+ if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
+ {
+ return (AE_OK);
+ }
+
/* Create/Open a combined source output file */
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
@@ -893,26 +936,6 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT);
}
- /* Create/Open a hex output file if asked */
-
- if (Gbl_HexOutputFlag)
- {
- Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
- if (!Filename)
- {
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
- 0, 0, 0, 0, NULL, NULL);
- return (AE_ERROR);
- }
-
- /* Open the hex file, text mode */
-
- FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
-
- AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
- AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
- }
-
/* Create a namespace output file if asked */
if (Gbl_NsOutputFlag)
@@ -933,30 +956,6 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
}
- /* Create/Open a debug output file if asked */
-
- if (Gbl_DebugFlag)
- {
- Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
- if (!Filename)
- {
- AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
- 0, 0, 0, 0, NULL, NULL);
- return (AE_ERROR);
- }
-
- /* Open the debug file as STDERR, text mode */
-
- /* TBD: hide this behind a FlReopenFile function */
-
- Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
- Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
- freopen (Filename, "w+t", stderr);
-
- AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
- AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
- }
-
return (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h
index 85bb3e2..3f600d8 100644
--- a/sys/contrib/dev/acpica/compiler/aslglobal.h
+++ b/sys/contrib/dev/acpica/compiler/aslglobal.h
@@ -145,7 +145,7 @@ extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
extern char HexLookup[];
-#define ASL_LINE_BUFFER_SIZE 512
+#define ASL_LINE_BUFFER_SIZE 1024
#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 8
@@ -196,6 +196,9 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFl
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
#define HEX_OUTPUT_NONE 0
@@ -223,6 +226,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE)
/* Statistics */
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0);
+ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0);
@@ -247,7 +251,9 @@ ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
-
+ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
+ASL_EXTERN char *Gbl_TemplateSignature;
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);
diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c
index 1f9fb4c..9dd6bf3 100644
--- a/sys/contrib/dev/acpica/compiler/asllookup.c
+++ b/sys/contrib/dev/acpica/compiler/asllookup.c
@@ -216,7 +216,7 @@ LsDoOneNamespaceObject (
Gbl_NumNamespaceObjects++;
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name,
AcpiUtGetTypeName (Node->Type));
@@ -1245,7 +1245,7 @@ LkNamespaceLocateBegin (
*/
if (PassedArgs != Node->Value)
{
- sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
+ sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
Node->Value);
if (PassedArgs < Node->Value)
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index 76be1af..4584574 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -167,7 +167,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
+#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:v:w:x:z"
/*******************************************************************************
@@ -218,6 +218,10 @@ Options (
printf (" -ln Create namespace file (*.nsp)\n");
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
+ printf ("\nACPI Data Tables:\n");
+ printf (" -T <Sig> Create table template file for <Sig> (or \"ALL\")\n");
+ printf (" -vt Create verbose templates (full disassembly)\n");
+
printf ("\nAML Disassembler:\n");
printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
@@ -230,6 +234,7 @@ Options (
printf (" -h Additional help and compiler debug options\n");
printf (" -hc Display operators allowed in constant expressions\n");
printf (" -hr Display ACPI reserved method names\n");
+ printf (" -ht Display currently supported ACPI table names\n");
}
@@ -268,6 +273,7 @@ HelpMessage (
printf (" -n Parse only, no output generation\n");
printf (" -ot Display compile times\n");
printf (" -x<level> Set debug level for trace output\n");
+ printf (" -z Do not insert new compiler ID for DataTables\n");
}
@@ -580,6 +586,10 @@ AslDoOptions (
ApDisplayReservedNames ();
exit (0);
+ case 't':
+ UtDisplaySupportedTables ();
+ exit (0);
+
default:
printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
return (-1);
@@ -767,6 +777,12 @@ AslDoOptions (
break;
+ case 'T':
+ Gbl_DoTemplates = TRUE;
+ Gbl_TemplateSignature = AcpiGbl_Optarg;
+ break;
+
+
case 'v':
switch (AcpiGbl_Optarg[0])
@@ -795,6 +811,10 @@ AslDoOptions (
Gbl_DoSignon = FALSE;
break;
+ case 't':
+ Gbl_VerboseTemplates = TRUE;
+ break;
+
default:
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
return (-1);
@@ -831,6 +851,12 @@ AslDoOptions (
break;
+ case 'z':
+
+ Gbl_UseOriginalCompilerId = TRUE;
+ break;
+
+
default:
return (-1);
@@ -873,6 +899,12 @@ AslCommandLine (
BadCommandLine = AslDoOptions (argc, argv, FALSE);
+ if (Gbl_DoTemplates)
+ {
+ DtCreateTemplates (Gbl_TemplateSignature);
+ exit (1);
+ }
+
/* Next parameter must be the input filename */
if (!argv[AcpiGbl_Optind] &&
diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c
index 89c7baa..d52d41d 100644
--- a/sys/contrib/dev/acpica/compiler/aslopt.c
+++ b/sys/contrib/dev/acpica/compiler/aslopt.c
@@ -339,7 +339,7 @@ OptBuildShortestPath (
}
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %u",
NumCommonSegments));
/* There must be at least 1 common NameSeg in order to optimize */
diff --git a/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c
index c3e49cd..f50138d 100644
--- a/sys/contrib/dev/acpica/compiler/aslpredef.c
+++ b/sys/contrib/dev/acpica/compiler/aslpredef.c
@@ -251,7 +251,7 @@ ApCheckForPredefinedMethod (
if (MethodInfo->NumArguments != 0)
{
- sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0);
+ sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
MsgBuffer);
@@ -274,7 +274,7 @@ ApCheckForPredefinedMethod (
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
(MethodInfo->NumArguments != RequiredArgsOld))
{
- sprintf (MsgBuffer, "%4.4s requires %d",
+ sprintf (MsgBuffer, "%4.4s requires %u",
PredefinedNames[Index].Info.Name, RequiredArgsCurrent);
if (MethodInfo->NumArguments > RequiredArgsCurrent)
@@ -731,7 +731,7 @@ ApDisplayReservedNames (
ThisName = PredefinedNames;
while (ThisName->Info.Name[0])
{
- printf ("%4.4s Requires %d arguments, ",
+ printf ("%4.4s Requires %u arguments, ",
ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F);
if (ThisName->Info.ExpectedBtypes)
diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c
index bbaa608..746878c 100644
--- a/sys/contrib/dev/acpica/compiler/aslstartup.c
+++ b/sys/contrib/dev/acpica/compiler/aslstartup.c
@@ -131,15 +131,15 @@ BOOLEAN AslToFile = TRUE;
/* Local prototypes */
-static void
-AslInitializeGlobals (
- void);
-
static char **
AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
+UINT8
+AslDetectSourceFileType (
+ ASL_FILE_INFO *Info);
+
/*******************************************************************************
*
@@ -154,7 +154,7 @@ AsDoWildcard (
*
******************************************************************************/
-static void
+void
AslInitializeGlobals (
void)
{
@@ -167,10 +167,13 @@ AslInitializeGlobals (
Gbl_CurrentLineNumber = 1;
Gbl_LogicalLineNumber = 1;
Gbl_CurrentLineOffset = 0;
+ Gbl_InputFieldCount = 0;
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
Gbl_ErrorLog = NULL;
Gbl_NextError = NULL;
+ Gbl_Signature = NULL;
+ Gbl_FileType = 0;
AslGbl_NextEvent = 0;
for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++)
@@ -179,6 +182,10 @@ AslInitializeGlobals (
}
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle = NULL;
+
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename = NULL;
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL;
}
@@ -259,6 +266,77 @@ AsDoWildcard (
/*******************************************************************************
*
+ * FUNCTION: AslDetectSourceFileType
+ *
+ * PARAMETERS: Info - Name/Handle for the file (must be open)
+ *
+ * RETURN: File Type
+ *
+ * DESCRIPTION: Determine the type of the input file. Either binary (contains
+ * non-ASCII characters), ASL file, or an ACPI Data Table file.
+ *
+ ******************************************************************************/
+
+UINT8
+AslDetectSourceFileType (
+ ASL_FILE_INFO *Info)
+{
+ char *FileChar;
+ UINT8 Type;
+ ACPI_STATUS Status;
+
+
+ /* Check for 100% ASCII source file (comments are ignored) */
+
+ Status = FlCheckForAscii (Info);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("Non-ascii input file - %s\n", Info->Filename);
+ Type = ASL_INPUT_TYPE_BINARY;
+ goto Cleanup;
+ }
+
+ /*
+ * File is ASCII. Determine if this is an ASL file or an ACPI data
+ * table file.
+ */
+ while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle))
+ {
+ /* Uppercase the buffer for caseless compare */
+
+ FileChar = Gbl_CurrentLineBuffer;
+ while (*FileChar)
+ {
+ *FileChar = (char) toupper ((int) *FileChar);
+ FileChar++;
+ }
+
+ /* Presence of "DefinitionBlock" indicates actual ASL code */
+
+ if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK"))
+ {
+ /* Appears to be an ASL file */
+
+ Type = ASL_INPUT_TYPE_ASCII_ASL;
+ goto Cleanup;
+ }
+ }
+
+ /* Not an ASL source file, default to a data table source file */
+
+ Type = ASL_INPUT_TYPE_ASCII_DATA;
+
+Cleanup:
+
+ /* Must seek back to the start of the file */
+
+ fseek (Info->Handle, 0, SEEK_SET);
+ return (Type);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AslDoOneFile
*
* PARAMETERS: Filename - Name of the file
@@ -287,7 +365,7 @@ AslDoOneFile (
*/
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
- /* ACPI CA subsystem initialization */
+ /* ACPICA subsystem initialization */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
@@ -330,23 +408,77 @@ AslDoOneFile (
AcpiOsPrintf ("\nCompiling \"%s\"\n",
Gbl_Files[ASL_FILE_INPUT].Filename);
}
+ else
+ {
+ Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
+ return (AE_OK);
+ }
}
/*
- * ASL Compilation (Optional)
+ * Open the input file. Here, this should be an ASCII source file,
+ * either an ASL file or a Data Table file
*/
- if (Gbl_DoCompile)
+ Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
+ if (ACPI_FAILURE (Status))
{
- /*
- * If -p not specified, we will use the input filename as the
- * output filename prefix
- */
- if (Gbl_UseDefaultAmlFilename)
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return (AE_ERROR);
+ }
+
+ /* Determine input file type */
+
+ Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]);
+ if (Gbl_FileType == ASL_INPUT_TYPE_BINARY)
+ {
+ return (AE_ERROR);
+ }
+
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
+ }
+
+ /* Open the optional output files (listings, etc.) */
+
+ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+ if (ACPI_FAILURE (Status))
+ {
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return (AE_ERROR);
+ }
+
+ /*
+ * Compilation of ASL source versus DataTable source uses different
+ * compiler subsystems
+ */
+ switch (Gbl_FileType)
+ {
+ /*
+ * Data Table Compilation
+ */
+ case ASL_INPUT_TYPE_ASCII_DATA:
+
+ Status = DtDoCompile ();
+
+ if (Gbl_Signature)
{
- Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
+ ACPI_FREE (Gbl_Signature);
+ Gbl_Signature = NULL;
}
+ AeClearErrorLog ();
+ return (Status);
+
+ /*
+ * ASL Compilation (Optional)
+ */
+ case ASL_INPUT_TYPE_ASCII_ASL:
- /* ACPI CA subsystem initialization (Must be re-initialized) */
+ /* ACPICA subsystem initialization */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
@@ -367,9 +499,17 @@ AslDoOneFile (
}
AeClearErrorLog ();
- }
+ return (AE_OK);
+
+ case ASL_INPUT_TYPE_BINARY:
- return (AE_OK);
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return (AE_ERROR);
+
+ default:
+ printf ("Unknown file type %X\n", Gbl_FileType);
+ return (AE_ERROR);
+ }
}
@@ -391,7 +531,7 @@ ACPI_STATUS
AslDoOnePathname (
char *Pathname)
{
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
char **FileList;
char *Filename;
char *FullPathname;
@@ -427,11 +567,9 @@ AslDoOnePathname (
Gbl_OutputFilenamePrefix = FullPathname;
}
- Status = AslDoOneFile (FullPathname);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Save status from all compiles */
+
+ Status |= AslDoOneFile (FullPathname);
ACPI_FREE (FullPathname);
ACPI_FREE (*FileList);
@@ -441,6 +579,6 @@ AslDoOnePathname (
ACPI_FREE (Gbl_DirectoryPath);
ACPI_FREE (Filename);
- return (AE_OK);
+ return (Status);
}
diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c
index f03f1fe..a18e396 100644
--- a/sys/contrib/dev/acpica/compiler/asltransform.c
+++ b/sys/contrib/dev/acpica/compiler/asltransform.c
@@ -674,7 +674,7 @@ TrDoSwitch (
{
/* Unknown peer opcode */
- AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n",
+ AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%u)\n",
Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
}
}
diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c
index 438a235..abf1353 100644
--- a/sys/contrib/dev/acpica/compiler/asltree.c
+++ b/sys/contrib/dev/acpica/compiler/asltree.c
@@ -466,7 +466,7 @@ TrCreateLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateLeafNode Ln/Col %d/%d NewNode %p Op %s\n\n",
+ "\nCreateLeafNode Ln/Col %u/%u NewNode %p Op %s\n\n",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));
return Op;
@@ -498,7 +498,7 @@ TrCreateValuedLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateValuedLeafNode Ln/Col %d/%d NewNode %p Op %s Value %8.8X%8.8X ",
+ "\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
ACPI_FORMAT_UINT64 (Value));
Op->Asl.Value.Integer = Value;
@@ -575,7 +575,7 @@ TrCreateNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateNode Ln/Col %d/%d NewParent %p Child %d Op %s ",
+ "\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ",
Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
/* Some extra debug output based on the parse opcode */
@@ -694,7 +694,7 @@ TrLinkChildren (
TrSetEndLineNumber (Op);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ",
+ "\nLinkChildren Line [%u to %u] NewParent %p Child %u Op %s ",
Op->Asl.LineNumber, Op->Asl.EndLine,
Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode));
@@ -882,7 +882,7 @@ TrLinkPeerNodes (
DbgPrint (ASL_PARSE_OUTPUT,
- "\nLinkPeerNodes: (%d) ", NumPeers);
+ "\nLinkPeerNodes: (%u) ", NumPeers);
va_start (ap, NumPeers);
This = va_arg (ap, ACPI_PARSE_OBJECT *);
@@ -893,7 +893,7 @@ TrLinkPeerNodes (
*/
for (i = 0; i < (NumPeers -1); i++)
{
- DbgPrint (ASL_PARSE_OUTPUT, "%d=%p ", (i+1), This);
+ DbgPrint (ASL_PARSE_OUTPUT, "%u=%p ", (i+1), This);
while (This->Asl.Next)
{
diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h
index 8157634..f4e5f46 100644
--- a/sys/contrib/dev/acpica/compiler/asltypes.h
+++ b/sys/contrib/dev/acpica/compiler/asltypes.h
@@ -279,11 +279,17 @@ typedef struct asl_listing_node
/* Callback interface for a parse tree walk */
+/*
+ * TBD - another copy of this is in adisasm.h, fix
+ */
+#ifndef ASL_WALK_CALLBACK_DEFINED
typedef
ACPI_STATUS (*ASL_WALK_CALLBACK) (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
+#define ASL_WALK_CALLBACK_DEFINED
+#endif
typedef struct asl_event_info
@@ -429,14 +435,24 @@ typedef enum
ASL_MSG_INVALID_GRANULARITY,
ASL_MSG_INVALID_GRAN_FIXED,
ASL_MSG_INVALID_ACCESS_SIZE,
- ASL_MSG_INVALID_ADDR_FLAGS
+ ASL_MSG_INVALID_ADDR_FLAGS,
+ ASL_MSG_INVALID_FIELD_NAME,
+ ASL_MSG_INTEGER_SIZE,
+ ASL_MSG_INVALID_HEX_INTEGER,
+ ASL_MSG_BUFFER_ELEMENT,
+ ASL_MSG_RESERVED_VALUE,
+ ASL_MSG_FLAG_VALUE,
+ ASL_MSG_ZERO_VALUE,
+ ASL_MSG_UNKNOWN_TABLE,
+ ASL_MSG_UNKNOWN_SUBTABLE,
+ ASL_MSG_OEM_TABLE
} ASL_MESSAGE_IDS;
#ifdef ASL_EXCEPTIONS
char *AslMessages [] = {
-/* The zeroth message is resesrved */ "",
+/* The zeroth message is reserved */ "",
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
@@ -558,7 +574,20 @@ char *AslMessages [] = {
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
-/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
+/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
+
+/* These messages are used by the data table compiler only */
+
+/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
+/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
+/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
+/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
+/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
+/* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
+/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
+/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
+/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
+/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
};
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c
index bc315cc..3fbcc5b 100644
--- a/sys/contrib/dev/acpica/compiler/aslutils.c
+++ b/sys/contrib/dev/acpica/compiler/aslutils.c
@@ -117,6 +117,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
+#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/amlcode.h>
@@ -157,6 +158,50 @@ UtAttachNameseg (
/*******************************************************************************
*
+ * FUNCTION: UtDisplaySupportedTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print all supported ACPI table names.
+ *
+ ******************************************************************************/
+
+void
+UtDisplaySupportedTables (
+ void)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ UINT32 i = 6;
+
+
+ printf ("\nACPI tables supported by iASL subsystems in "
+ "version %8.8X:\n"
+ " ASL and Data Table compilers\n"
+ " AML and Data Table disassemblers\n"
+ " ACPI table template generator\n\n", ACPI_CA_VERSION);
+
+ /* Special tables */
+
+ printf ("%8u) %s %s\n", 1, ACPI_SIG_DSDT, "Differentiated System Description Table");
+ printf ("%8u) %s %s\n", 2, ACPI_SIG_SSDT, "Secondary System Description Table");
+ printf ("%8u) %s %s\n", 3, ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)");
+ printf ("%8u) %s %s\n", 4, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
+ printf ("%8u) %s %s\n", 5, ACPI_RSDP_NAME, "Root System Description Pointer");
+
+ /* All data tables with common table header */
+
+ for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ {
+ printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Name);
+ i++;
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiPsDisplayConstantOpcodes
*
* PARAMETERS: None
@@ -214,6 +259,8 @@ UtLocalCalloc (
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
Gbl_InputByteCount, Gbl_CurrentColumn,
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+
+ CmCleanupAndExit ();
exit (1);
}
@@ -523,33 +570,57 @@ UtDisplaySummary (
CompilerId, (UINT32) ACPI_CA_VERSION);
}
- /* Input/Output summary */
-
- FlPrintFile (FileId,
- "ASL Input: %s - %d lines, %d bytes, %d keywords\n",
- Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
- Gbl_InputByteCount, TotalKeywords);
-
- /* AML summary */
+ if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
+ {
+ FlPrintFile (FileId,
+ "Table Input: %s - %u lines, %u bytes, %u fields\n",
+ Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
+ Gbl_InputByteCount, Gbl_InputFieldCount);
- if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
+ if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
+ {
+ FlPrintFile (FileId,
+ "Binary Output: %s - %u bytes\n\n",
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength);
+ }
+ }
+ else
{
+ /* Input/Output summary */
+
FlPrintFile (FileId,
- "AML Output: %s - %d bytes, %d named objects, %d executable opcodes\n\n",
- Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
- TotalNamedObjects, TotalExecutableOpcodes);
+ "ASL Input: %s - %u lines, %u bytes, %u keywords\n",
+ Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
+ Gbl_InputByteCount, TotalKeywords);
+
+ /* AML summary */
+
+ if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
+ {
+ FlPrintFile (FileId,
+ "AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n",
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
+ TotalNamedObjects, TotalExecutableOpcodes);
+ }
}
/* Error summary */
FlPrintFile (FileId,
- "Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n",
+ "Compilation complete. %u Errors, %u Warnings, %u Remarks",
Gbl_ExceptionCount[ASL_ERROR],
Gbl_ExceptionCount[ASL_WARNING] +
Gbl_ExceptionCount[ASL_WARNING2] +
Gbl_ExceptionCount[ASL_WARNING3],
- Gbl_ExceptionCount[ASL_REMARK],
- Gbl_ExceptionCount[ASL_OPTIMIZATION]);
+ Gbl_ExceptionCount[ASL_REMARK]);
+
+ if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA)
+ {
+ FlPrintFile (FileId,
+ ", %u Optimizations", Gbl_ExceptionCount[ASL_OPTIMIZATION]);
+ }
+
+ FlPrintFile (FileId, "\n");
}
diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c
new file mode 100644
index 0000000..5bdc6b2
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtcompile.c
@@ -0,0 +1,623 @@
+/******************************************************************************
+ *
+ * Module Name: dtcompile.c - Front-end for data table compiler
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTCOMPILE_C__
+#define _DECLARE_DT_GLOBALS
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtcompile")
+
+static char VersionString[9];
+
+
+/* Local prototypes */
+
+static void
+DtInitialize (
+ void);
+
+static ACPI_STATUS
+DtCompileDataTable (
+ DT_FIELD **Field);
+
+static void
+DtInsertCompilerIds (
+ DT_FIELD *FieldList);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtDoCompile
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Main entry point for the data table compiler.
+ *
+ * Note: Assumes Gbl_Files[ASL_FILE_INPUT] is initialized and the file is
+ * open at seek offset zero.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtDoCompile (
+ void)
+{
+ ACPI_STATUS Status;
+ UINT8 Event;
+ DT_FIELD *FieldList;
+
+
+ /* Initialize globals */
+
+ DtInitialize ();
+
+ /*
+ * Scan the input file (file is already open) and
+ * build the parse tree
+ */
+ Event = UtBeginEvent ("Scan and parse input file");
+ FieldList = DtScanFile (Gbl_Files[ASL_FILE_INPUT].Handle);
+ UtEndEvent (Event);
+
+ /* Did the parse tree get successfully constructed? */
+
+ if (!FieldList)
+ {
+ /* TBD: temporary error message. Msgs should come from function above */
+
+ DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
+ "Input file does not appear to be an ASL or data table source file");
+
+ Status = AE_ERROR;
+ goto CleanupAndExit;
+ }
+
+ Event = UtBeginEvent ("Compile parse tree");
+
+ /*
+ * Compile the parse tree
+ */
+ Status = DtCompileDataTable (&FieldList);
+ UtEndEvent (Event);
+
+ DtFreeFieldList ();
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* TBD: temporary error message. Msgs should come from function above */
+
+ DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
+ "Could not compile input file");
+
+ goto CleanupAndExit;
+ }
+
+ /* Create/open the binary output file */
+
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
+ Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CleanupAndExit;
+ }
+
+ /* Write the binary, then the optional hex file */
+
+ DtOutputBinary (Gbl_RootTable);
+ LsDoHexOutput ();
+
+CleanupAndExit:
+
+ CmCleanupAndExit ();
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize data table compiler globals. Enables multiple
+ * compiles per invocation.
+ *
+ *****************************************************************************/
+
+static void
+DtInitialize (
+ void)
+{
+
+ AcpiOsInitialize ();
+ AcpiUtInitGlobals ();
+
+ Gbl_FieldList = NULL;
+ Gbl_RootTable = NULL;
+ Gbl_SubtableStack = NULL;
+
+ sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtInsertCompilerIds
+ *
+ * PARAMETERS: FieldList - Current field list pointer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
+ * the original ACPI table header.
+ *
+ *****************************************************************************/
+
+static void
+DtInsertCompilerIds (
+ DT_FIELD *FieldList)
+{
+ DT_FIELD *Next;
+ UINT32 i;
+
+
+ /*
+ * Don't insert current compiler ID if requested. Used for compiler
+ * debug/validation only.
+ */
+ if (Gbl_UseOriginalCompilerId)
+ {
+ return;
+ }
+
+ /* Walk to the Compiler fields at the end of the header */
+
+ Next = FieldList;
+ for (i = 0; i < 7; i++)
+ {
+ Next = Next->Next;
+ }
+
+ Next->Value = CompilerCreatorId;
+ Next->Flags = DT_FIELD_NOT_ALLOCATED;
+
+ Next = Next->Next;
+ Next->Value = VersionString;
+ Next->Flags = DT_FIELD_NOT_ALLOCATED;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileDataTable
+ *
+ * PARAMETERS: FieldList - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Entry point to compile one data table
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+DtCompileDataTable (
+ DT_FIELD **FieldList)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ DT_SUBTABLE *Subtable;
+ char *Signature;
+ ACPI_TABLE_HEADER *AcpiTableHeader;
+ ACPI_STATUS Status;
+
+
+ /* Verify that we at least have a table signature and save it */
+
+ Signature = DtGetFieldValue (*FieldList, "Signature");
+ if (!Signature)
+ {
+ sprintf (MsgBuffer, "Expected \"%s\"", "Signature");
+ DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
+ *FieldList, MsgBuffer);
+ return (AE_ERROR);
+ }
+
+ Gbl_Signature = UtLocalCalloc (ACPI_STRLEN (Signature) + 1);
+ strcpy (Gbl_Signature, Signature);
+
+ /*
+ * Handle tables that don't use the common ACPI table header structure.
+ * Currently, these are the FACS and RSDP. Also check for an OEMx table,
+ * these tables have user-defined contents.
+ */
+ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
+ {
+ Status = DtCompileFacs (FieldList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtSetTableLength ();
+ return (Status);
+ }
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
+ {
+ Status = DtCompileRsdp (FieldList);
+ return (Status);
+ }
+ else if (!ACPI_STRNCMP (Signature, "OEM", 3))
+ {
+ DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature);
+ return (AE_ERROR);
+ }
+
+ /* Validate the signature via the ACPI table list */
+
+ TableData = AcpiDmGetTableData (Signature);
+ if (!TableData)
+ {
+ DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature);
+ return (AE_ERROR);
+ }
+
+ /*
+ * All other tables must use the common ACPI table header. Insert the
+ * current iASL IDs (name, version), and compile the header now.
+ */
+ DtInsertCompilerIds (*FieldList);
+
+ Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
+ &Gbl_RootTable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtPushSubtable (Gbl_RootTable);
+
+ /* Dispatch to per-table compile */
+
+ if (TableData->CmTableHandler)
+ {
+ /* Complex table, has a handler */
+
+ Status = TableData->CmTableHandler ((void **) FieldList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ else if (TableData->TableInfo)
+ {
+ /* Simple table, just walk the info table */
+
+ Subtable = NULL;
+ Status = DtCompileTable (FieldList, TableData->TableInfo,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (Gbl_RootTable, Subtable);
+ DtPopSubtable ();
+ }
+ else
+ {
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
+ "Missing table dispatch info");
+ return (AE_ERROR);
+ }
+
+ /* Set the final table length and then the checksum */
+
+ DtSetTableLength ();
+ AcpiTableHeader = ACPI_CAST_PTR (
+ ACPI_TABLE_HEADER, Gbl_RootTable->Buffer);
+ DtSetTableChecksum (&AcpiTableHeader->Checksum);
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileTable
+ *
+ * PARAMETERS: Field - Current field list pointer
+ * Info - Info table for this ACPI table
+ * RetSubtable - Compile result of table
+ * Required - If this subtable must exist
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile a subtable
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileTable (
+ DT_FIELD **Field,
+ ACPI_DMTABLE_INFO *Info,
+ DT_SUBTABLE **RetSubtable,
+ BOOLEAN Required)
+{
+ DT_FIELD *LocalField;
+ UINT32 Length;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *InlineSubtable;
+ UINT32 FieldLength = 0;
+ UINT8 FieldType;
+ UINT8 *Buffer;
+ UINT8 *FlagBuffer = NULL;
+ ACPI_STATUS Status;
+
+
+ if (!Field || !*Field)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ Length = DtGetSubtableLength (*Field, Info);
+ Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
+
+ Subtable->Buffer = UtLocalCalloc (Length);
+ Subtable->Length = Length;
+ Subtable->TotalLength = Length;
+ Buffer = Subtable->Buffer;
+
+ LocalField = *Field;
+
+ /*
+ * Main loop walks the info table for this ACPI table or subtable
+ */
+ for (; Info->Name; Info++)
+ {
+ if (!LocalField)
+ {
+ sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
+ Info->Name);
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
+ Status = AE_BAD_DATA;
+ goto Error;
+ }
+
+ /* Does input field name match what is expected? */
+
+ if (ACPI_STRCMP (LocalField->Name, Info->Name))
+ {
+ /*
+ * If Required = TRUE, the subtable must exist.
+ * If Required = FALSE, the subtable is optional
+ * (For example, AcpiDmTableInfoDmarScope in DMAR table is
+ * optional)
+ */
+ if (Required)
+ {
+ sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
+ DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
+ LocalField, MsgBuffer);
+ }
+ else
+ {
+ Status = AE_NOT_FOUND;
+ goto Error;
+ }
+ }
+
+ FieldLength = DtGetFieldLength (LocalField, Info);
+ FieldType = DtGetFieldType (Info);
+ Gbl_InputFieldCount++;
+
+ switch (FieldType)
+ {
+ case DT_FIELD_TYPE_FLAGS_INTEGER:
+ /*
+ * Start of the definition of a flags field.
+ * This master flags integer starts at value zero, in preparation
+ * to compile and insert the flag fields from the individual bits
+ */
+ LocalField = LocalField->Next;
+ *Field = LocalField;
+
+ FlagBuffer = Buffer;
+ break;
+
+ case DT_FIELD_TYPE_FLAG:
+
+ /* Individual Flag field, can be multiple bits */
+
+ if (FlagBuffer)
+ {
+ DtCompileFlag (FlagBuffer, LocalField, Info);
+ }
+ else
+ {
+ /* TBD - this is an internal error */
+ }
+
+ LocalField = LocalField->Next;
+ *Field = LocalField;
+ break;
+
+ case DT_FIELD_TYPE_INLINE_SUBTABLE:
+ /*
+ * Recursion (one level max): compile GAS (Generic Address)
+ * or Notify in-line subtable
+ */
+ LocalField = LocalField->Next;
+ *Field = LocalField;
+
+ if (Info->Opcode == ACPI_DMT_GAS)
+ {
+ Status = DtCompileTable (Field, AcpiDmTableInfoGas,
+ &InlineSubtable, TRUE);
+ }
+ else
+ {
+ Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
+ &InlineSubtable, TRUE);
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto Error;
+ }
+
+ DtSetSubtableLength (InlineSubtable);
+
+ ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
+ ACPI_FREE (InlineSubtable->Buffer);
+ ACPI_FREE (InlineSubtable);
+ LocalField = *Field;
+ break;
+
+ default:
+
+ /* Normal case for most field types (Integer, String, etc.) */
+
+ DtCompileOneField (Buffer, LocalField,
+ FieldLength, FieldType, Info->Flags);
+ LocalField = LocalField->Next;
+
+ if (Info->Flags & DT_LENGTH)
+ {
+ /* Field is an Integer that will contain a subtable length */
+
+ Subtable->LengthField = Buffer;
+ Subtable->SizeOfLengthField = FieldLength;
+ }
+ break;
+ }
+
+ Buffer += FieldLength;
+ }
+
+ *Field = LocalField;
+ *RetSubtable = Subtable;
+ return (AE_OK);
+
+Error:
+ ACPI_FREE (Subtable->Buffer);
+ ACPI_FREE (Subtable);
+ return (Status);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h
new file mode 100644
index 0000000..6596bb3
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h
@@ -0,0 +1,487 @@
+/******************************************************************************
+ *
+ * Module Name: dtcompiler.h - header for data table compiler
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTCOMPILER_H__
+
+#ifndef _DTCOMPILER
+#define _DTCOMPILER
+
+#include <stdio.h>
+#include <contrib/dev/acpica/include/acdisasm.h>
+
+
+#undef DT_EXTERN
+
+#ifdef _DECLARE_DT_GLOBALS
+#define DT_EXTERN
+#define DT_INIT_GLOBAL(a,b) (a)=(b)
+#else
+#define DT_EXTERN extern
+#define DT_INIT_GLOBAL(a,b) (a)
+#endif
+
+
+/* Types for individual fields (one per input line) */
+
+#define DT_FIELD_TYPE_STRING 0
+#define DT_FIELD_TYPE_INTEGER 1
+#define DT_FIELD_TYPE_BUFFER 2
+#define DT_FIELD_TYPE_PCI_PATH 3
+#define DT_FIELD_TYPE_FLAG 4
+#define DT_FIELD_TYPE_FLAGS_INTEGER 5
+#define DT_FIELD_TYPE_INLINE_SUBTABLE 6
+
+
+/*
+ * Structure used for each individual field within an ACPI table
+ */
+typedef struct dt_field
+{
+ char *Name;
+ char *Value;
+ struct dt_field *Next;
+ UINT32 Line; /* Line number for this field */
+ UINT32 ByteOffset; /* Offset in source file for field */
+ UINT32 NameColumn; /* Start column for field name */
+ UINT32 Column; /* Start column for field value */
+ UINT8 Flags;
+
+} DT_FIELD;
+
+/* Flags for above */
+
+#define DT_FIELD_NOT_ALLOCATED 1
+
+
+/*
+ * Structure used for individual subtables within an ACPI table
+ */
+typedef struct dt_subtable
+{
+ struct dt_subtable *Parent;
+ struct dt_subtable *Child;
+ struct dt_subtable *Peer;
+ struct dt_subtable *StackTop;
+ UINT8 *Buffer;
+ UINT8 *LengthField;
+ UINT32 Length;
+ UINT32 TotalLength;
+ UINT32 SizeOfLengthField;
+ UINT8 Flags;
+
+} DT_SUBTABLE;
+
+
+/*
+ * Globals
+ */
+
+/* List of all field names and values from the input source */
+
+DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_FieldList, NULL);
+
+/* List of all compiled tables and subtables */
+
+DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL);
+
+/* Stack for subtables */
+
+DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL);
+
+
+/* dtcompiler - main module */
+
+ACPI_STATUS
+DtCompileTable (
+ DT_FIELD **Field,
+ ACPI_DMTABLE_INFO *Info,
+ DT_SUBTABLE **RetSubtable,
+ BOOLEAN Required);
+
+
+/* dtio - binary and text input/output */
+
+DT_FIELD *
+DtScanFile (
+ FILE *Handle);
+
+void
+DtOutputBinary (
+ DT_SUBTABLE *RootTable);
+
+
+/* dtsubtable - compile subtables */
+
+void
+DtCreateSubtable (
+ UINT8 *Buffer,
+ UINT32 Length,
+ DT_SUBTABLE **RetSubtable);
+
+UINT32
+DtGetSubtableLength (
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info);
+
+void
+DtSetSubtableLength (
+ DT_SUBTABLE *Subtable);
+
+void
+DtPushSubtable (
+ DT_SUBTABLE *Subtable);
+
+void
+DtPopSubtable (
+ void);
+
+DT_SUBTABLE *
+DtPeekSubtable (
+ void);
+
+void
+DtInsertSubtable (
+ DT_SUBTABLE *ParentTable,
+ DT_SUBTABLE *Subtable);
+
+DT_SUBTABLE *
+DtGetNextSubtable (
+ DT_SUBTABLE *ParentTable,
+ DT_SUBTABLE *ChildTable);
+
+DT_SUBTABLE *
+DtGetParentSubtable (
+ DT_SUBTABLE *Subtable);
+
+
+/* dtfield - Compile individual fields within a table */
+
+void
+DtCompileOneField (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength,
+ UINT8 Type,
+ UINT8 Flags);
+
+void
+DtCompileInteger (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength,
+ UINT8 Flags);
+
+UINT32
+DtCompileBuffer (
+ UINT8 *Buffer,
+ char *Value,
+ DT_FIELD *Field,
+ UINT32 ByteLength);
+
+void
+DtCompileFlag (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info);
+
+
+/* dtutils - Miscellaneous utilities */
+
+typedef
+void (*DT_WALK_CALLBACK) (
+ DT_SUBTABLE *Subtable,
+ void *Context,
+ void *ReturnValue);
+
+void
+DtWalkTableTree (
+ DT_SUBTABLE *StartTable,
+ DT_WALK_CALLBACK UserFunction,
+ void *Context,
+ void *ReturnValue);
+
+void
+DtError (
+ UINT8 Level,
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage);
+
+void
+DtNameError (
+ UINT8 Level,
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage);
+
+void
+DtFatal (
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage);
+
+ACPI_STATUS
+DtStrtoul64 (
+ char *String,
+ UINT64 *ReturnInteger);
+
+UINT32
+DtGetFileSize (
+ FILE *Handle);
+
+char*
+DtGetFieldValue (
+ DT_FIELD *Field,
+ char *Name);
+
+UINT8
+DtGetFieldType (
+ ACPI_DMTABLE_INFO *Info);
+
+UINT32
+DtGetBufferLength (
+ char *Buffer);
+
+UINT32
+DtGetFieldLength (
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info);
+
+void
+DtSetTableChecksum (
+ UINT8 *ChecksumPointer);
+
+void
+DtSetTableLength(
+ void);
+
+void
+DtFreeFieldList (
+ void);
+
+
+/* dttable - individual table compilation */
+
+ACPI_STATUS
+DtCompileFacs (
+ DT_FIELD **PFieldList);
+
+ACPI_STATUS
+DtCompileRsdp (
+ DT_FIELD **PFieldList);
+
+ACPI_STATUS
+DtCompileAsf (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileCpep (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileDmar (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileEinj (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileErst (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileFadt (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileHest (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileIvrs (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileMadt (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileMcfg (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileMsct (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileRsdt (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileSlit (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileSrat (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileWdat (
+ void **PFieldList);
+
+ACPI_STATUS
+DtCompileXsdt (
+ void **PFieldList);
+
+/* ACPI Table templates */
+
+extern const unsigned char TemplateAsf[];
+extern const unsigned char TemplateBoot[];
+extern const unsigned char TemplateBert[];
+extern const unsigned char TemplateCpep[];
+extern const unsigned char TemplateDbgp[];
+extern const unsigned char TemplateDmar[];
+extern const unsigned char TemplateEcdt[];
+extern const unsigned char TemplateEinj[];
+extern const unsigned char TemplateErst[];
+extern const unsigned char TemplateFadt[];
+extern const unsigned char TemplateHest[];
+extern const unsigned char TemplateHpet[];
+extern const unsigned char TemplateIvrs[];
+extern const unsigned char TemplateMadt[];
+extern const unsigned char TemplateMcfg[];
+extern const unsigned char TemplateMchi[];
+extern const unsigned char TemplateMsct[];
+extern const unsigned char TemplateRsdt[];
+extern const unsigned char TemplateSbst[];
+extern const unsigned char TemplateSlic[];
+extern const unsigned char TemplateSlit[];
+extern const unsigned char TemplateSpcr[];
+extern const unsigned char TemplateSpmi[];
+extern const unsigned char TemplateSrat[];
+extern const unsigned char TemplateTcpa[];
+extern const unsigned char TemplateUefi[];
+extern const unsigned char TemplateWaet[];
+extern const unsigned char TemplateWdat[];
+extern const unsigned char TemplateWddt[];
+extern const unsigned char TemplateWdrt[];
+extern const unsigned char TemplateXsdt[];
+
+/* Debug */
+
+#define MYDEBUG printf
+
+#endif
diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c
new file mode 100644
index 0000000..3c5a993
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtfield.c
@@ -0,0 +1,538 @@
+/******************************************************************************
+ *
+ * Module Name: dtfield.c - Code generation for individual source fields
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTFIELD_C__
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtfield")
+
+
+/* Local prototypes */
+
+static void
+DtCompileString (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength);
+
+static char *
+DtNormalizeBuffer (
+ char *Buffer,
+ UINT32 *Count);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileOneField
+ *
+ * PARAMETERS: Buffer - Output buffer
+ * Field - Field to be compiled
+ * ByteLength - Byte length of the field
+ * Type - Field type
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Compile a field value to binary
+ *
+ *****************************************************************************/
+
+void
+DtCompileOneField (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength,
+ UINT8 Type,
+ UINT8 Flags)
+{
+
+ switch (Type)
+ {
+ case DT_FIELD_TYPE_INTEGER:
+ DtCompileInteger (Buffer, Field, ByteLength, Flags);
+ break;
+
+ case DT_FIELD_TYPE_STRING:
+ DtCompileString (Buffer, Field, ByteLength);
+ break;
+
+ case DT_FIELD_TYPE_BUFFER:
+ DtCompileBuffer (Buffer, Field->Value, Field, ByteLength);
+ break;
+
+ default:
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid field type");
+ break;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileString
+ *
+ * PARAMETERS: Buffer - Output buffer
+ * Field - String to be copied to buffer
+ * ByteLength - Maximum length of string
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Copy string to the buffer
+ *
+ *****************************************************************************/
+
+static void
+DtCompileString (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength)
+{
+ UINT32 Length;
+
+
+ Length = ACPI_STRLEN (Field->Value);
+
+ /* Check if the string is too long for the field */
+
+ if (Length > ByteLength)
+ {
+ sprintf (MsgBuffer, "Maximum %u characters", ByteLength);
+ DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, MsgBuffer);
+ Length = ByteLength;
+ }
+
+ ACPI_MEMCPY (Buffer, Field->Value, Length);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileInteger
+ *
+ * PARAMETERS: Buffer - Output buffer
+ * Field - Field obj with Integer to be compiled
+ * ByteLength - Byte length of the integer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Compile an integer
+ *
+ *****************************************************************************/
+
+void
+DtCompileInteger (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ UINT32 ByteLength,
+ UINT8 Flags)
+{
+ UINT64 Value = 0;
+ UINT64 MaxValue;
+ UINT8 *Hex;
+ char *Message = NULL;
+ ACPI_STATUS Status;
+ int i;
+
+
+ /* Byte length must be in range 1-8 */
+
+ if ((ByteLength > 8) || (ByteLength == 0))
+ {
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, Field,
+ "Invalid internal Byte length");
+ return;
+ }
+
+ /* Convert string to an actual integer */
+
+ Status = DtStrtoul64 (Field->Value, &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_LIMIT)
+ {
+ Message = "Constant larger than 64 bits";
+ }
+ else if (Status == AE_BAD_CHARACTER)
+ {
+ Message = "Invalid character in constant";
+ }
+
+ DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
+ goto Exit;
+ }
+
+ /* Ensure that reserved fields are set to zero */
+ /* TBD: should we set to zero, or just make this an ERROR? */
+ /* TBD: Probably better to use a flag */
+
+ if (!ACPI_STRCMP (Field->Name, "Reserved") &&
+ (Value != 0))
+ {
+ DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field,
+ "Setting to zero");
+ Value = 0;
+ }
+
+ /* Check if the value must be non-zero */
+
+ if ((Value == 0) && (Flags & DT_NON_ZERO))
+ {
+ DtError (ASL_ERROR, ASL_MSG_ZERO_VALUE, Field, NULL);
+ }
+
+ /*
+ * Generate the maximum value for the data type (ByteLength)
+ * Note: construct chosen for maximum portability
+ */
+ MaxValue = ((UINT64) (-1)) >> (64 - (ByteLength * 8));
+
+ /* Validate that the input value is within range of the target */
+
+ if (Value > MaxValue)
+ {
+ sprintf (MsgBuffer, "Maximum %u bytes", ByteLength);
+ DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
+ }
+
+ /*
+ * TBD: hard code for ASF! Capabilites field.
+ *
+ * This field is actually a buffer, not a 56-bit integer --
+ * so, the ordering is reversed. Something should be fixed
+ * so we don't need this code.
+ */
+ if (ByteLength == 7)
+ {
+ Hex = ACPI_CAST_PTR (UINT8, &Value);
+ for (i = 6; i >= 0; i--)
+ {
+ Buffer[i] = *Hex;
+ Hex++;
+ }
+ return;
+ }
+
+Exit:
+ ACPI_MEMCPY (Buffer, &Value, ByteLength);
+ return;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtNormalizeBuffer
+ *
+ * PARAMETERS: Buffer - Input buffer
+ * Count - Output the count of hex number in
+ * the Buffer
+ *
+ * RETURN: The normalized buffer, freed by caller
+ *
+ * DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
+ * to 1A 2B 3C 4D
+ *
+ *****************************************************************************/
+
+static char *
+DtNormalizeBuffer (
+ char *Buffer,
+ UINT32 *Count)
+{
+ char *NewBuffer;
+ char *TmpBuffer;
+ UINT32 BufferCount = 0;
+ BOOLEAN Separator = TRUE;
+ char c;
+
+
+ NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
+ TmpBuffer = NewBuffer;
+
+ while ((c = *Buffer++))
+ {
+ switch (c)
+ {
+ /* Valid separators */
+
+ case '[':
+ case ']':
+ case ' ':
+ case ',':
+ Separator = TRUE;
+ break;
+
+ default:
+ if (Separator)
+ {
+ /* Insert blank as the standard separator */
+
+ if (NewBuffer[0])
+ {
+ *TmpBuffer++ = ' ';
+ BufferCount++;
+ }
+
+ Separator = FALSE;
+ }
+
+ *TmpBuffer++ = c;
+ break;
+ }
+ }
+
+ *Count = BufferCount + 1;
+ return (NewBuffer);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileBuffer
+ *
+ * PARAMETERS: Buffer - Output buffer
+ * StringValue - Integer list to be compiled
+ * Field - Current field object
+ * ByteLength - Byte length of the integer list
+ *
+ * RETURN: Count of remaining data in the input list
+ *
+ * DESCRIPTION: Compile and pack an integer list, for example
+ * "AA 1F 20 3B" ==> Buffer[] = {0xAA,0x1F,0x20,0x3B}
+ *
+ *****************************************************************************/
+
+UINT32
+DtCompileBuffer (
+ UINT8 *Buffer,
+ char *StringValue,
+ DT_FIELD *Field,
+ UINT32 ByteLength)
+{
+ ACPI_STATUS Status;
+ char Hex[3];
+ UINT64 Value;
+ UINT32 i;
+ UINT32 Count;
+
+
+ /* Allow several different types of value separators */
+
+ StringValue = DtNormalizeBuffer (StringValue, &Count);
+
+ Hex[2] = 0;
+ for (i = 0; i < Count; i++)
+ {
+ /* Each element of StringValue is three chars */
+
+ Hex[0] = StringValue[(3 * i)];
+ Hex[1] = StringValue[(3 * i) + 1];
+
+ /* Convert one hex byte */
+
+ Value = 0;
+ Status = DtStrtoul64 (Hex, &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
+ return (ByteLength - Count);
+ }
+
+ Buffer[i] = (UINT8) Value;
+ }
+
+ ACPI_FREE (StringValue);
+ return (ByteLength - Count);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileFlag
+ *
+ * PARAMETERS: Buffer - Output buffer
+ * Field - Field to be compiled
+ * Info - Flag info
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Compile a flag
+ *
+ *****************************************************************************/
+
+void
+DtCompileFlag (
+ UINT8 *Buffer,
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT64 Value = 0;
+ UINT32 BitLength = 1;
+ UINT8 BitPosition = 0;
+ ACPI_STATUS Status;
+
+
+ Status = DtStrtoul64 (Field->Value, &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL);
+ }
+
+ switch (Info->Opcode)
+ {
+ 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:
+
+ BitPosition = Info->Opcode;
+ BitLength = 1;
+ break;
+
+ case ACPI_DMT_FLAGS0:
+
+ BitPosition = 0;
+ BitLength = 2;
+ break;
+
+
+ case ACPI_DMT_FLAGS2:
+
+ BitPosition = 2;
+ BitLength = 2;
+ break;
+
+ default:
+
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode");
+ break;
+ }
+
+ /* Check range of the input flag value */
+
+ if (Value >= ((UINT64) 1 << BitLength))
+ {
+ sprintf (MsgBuffer, "Maximum %u bit", BitLength);
+ DtError (ASL_ERROR, ASL_MSG_FLAG_VALUE, Field, MsgBuffer);
+ Value = 0;
+ }
+
+ *Buffer |= (UINT8) (Value << BitPosition);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c
new file mode 100644
index 0000000..a2fc713
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtio.c
@@ -0,0 +1,698 @@
+/******************************************************************************
+ *
+ * Module Name: dtio.c - File I/O support for data table compiler
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTIO_C__
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtio")
+
+
+/* Local prototypes */
+
+static char *
+DtTrim (
+ char *String);
+
+static void
+DtLinkField (
+ DT_FIELD *Field);
+
+static void
+DtParseLine (
+ char *LineBuffer,
+ UINT32 Line,
+ UINT32 Offset);
+
+static UINT32
+DtGetNextLine (
+ FILE *Handle);
+
+static void
+DtWriteBinary (
+ DT_SUBTABLE *Subtable,
+ void *Context,
+ void *ReturnValue);
+
+
+/* States for DtGetNextLine */
+
+#define DT_NORMAL_TEXT 0
+#define DT_START_QUOTED_STRING 1
+#define DT_START_COMMENT 2
+#define DT_SLASH_ASTERISK_COMMENT 3
+#define DT_SLASH_SLASH_COMMENT 4
+#define DT_END_COMMENT 5
+
+UINT32 Gbl_NextLineOffset;
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtTrim
+ *
+ * PARAMETERS: String - Current source code line to trim
+ *
+ * RETURN: Trimmed line. Must be freed by caller.
+ *
+ * DESCRIPTION: Trim left and right spaces
+ *
+ *****************************************************************************/
+
+static char *
+DtTrim (
+ char *String)
+{
+ char *Start;
+ char *End;
+ char *ReturnString;
+ ACPI_SIZE Length;
+
+
+ /* Skip lines that start with a space */
+
+ if (!ACPI_STRCMP (String, " "))
+ {
+ ReturnString = UtLocalCalloc (1);
+ return (ReturnString);
+ }
+
+ /* Setup pointers to start and end of input string */
+
+ Start = String;
+ End = String + ACPI_STRLEN (String) - 1;
+
+ /* Find first non-whitespace character */
+
+ while ((Start <= End) && ((*Start == ' ') || (*Start == '\t')))
+ {
+ Start++;
+ }
+
+ /* Find last non-space character */
+
+ while (End >= Start)
+ {
+ if (*End == '\r' || *End == '\n')
+ {
+ End--;
+ continue;
+ }
+
+ if (*End != ' ')
+ {
+ break;
+ }
+
+ End--;
+ }
+
+ /* Remove any quotes around the string */
+
+ if (*Start == '\"')
+ {
+ Start++;
+ }
+ if (*End == '\"')
+ {
+ End--;
+ }
+
+ /* Create the trimmed return string */
+
+ Length = ACPI_PTR_DIFF (End, Start) + 1;
+ ReturnString = UtLocalCalloc (Length + 1);
+ if (ACPI_STRLEN (Start))
+ {
+ ACPI_STRNCPY (ReturnString, Start, Length);
+ }
+
+ ReturnString[Length] = 0;
+ return (ReturnString);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtLinkField
+ *
+ * PARAMETERS: Field - New field object to link
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Link one field name and value to the list
+ *
+ *****************************************************************************/
+
+static void
+DtLinkField (
+ DT_FIELD *Field)
+{
+ DT_FIELD *Prev;
+ DT_FIELD *Next;
+
+
+ Prev = Next = Gbl_FieldList;
+
+ while (Next)
+ {
+ Prev = Next;
+ Next = Next->Next;
+ }
+
+ if (Prev)
+ {
+ Prev->Next = Field;
+ }
+ else
+ {
+ Gbl_FieldList = Field;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtParseLine
+ *
+ * PARAMETERS: LineBuffer - Current source code line
+ * Line - Current line number in the source
+ * Offset - Current byte offset of the line
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse one source line
+ *
+ *****************************************************************************/
+
+static void
+DtParseLine (
+ char *LineBuffer,
+ UINT32 Line,
+ UINT32 Offset)
+{
+ char *Start;
+ char *End;
+ char *TmpName;
+ char *TmpValue;
+ char *Name;
+ char *Value;
+ char *Colon;
+ UINT32 Length;
+ DT_FIELD *Field;
+ UINT32 Column;
+ UINT32 NameColumn;
+
+
+ if (!LineBuffer)
+ {
+ return;
+ }
+
+ Colon = strchr (LineBuffer, ':');
+ if (!Colon || *(Colon - 1) != ' ')
+ {
+ return;
+ }
+
+ Start = LineBuffer;
+ End = Colon;
+
+ while (Start < Colon)
+ {
+ if (*Start == ' ')
+ {
+ Start++;
+ continue;
+ }
+
+ /* Found left bracket, go to the right bracket */
+
+ if (*Start == '[')
+ {
+ while (Start < Colon && *Start != ']')
+ {
+ Start++;
+ }
+
+ if (Start == Colon)
+ {
+ MYDEBUG ("ERROR: right bracket reaches colon position\n");
+ break;
+ }
+
+ Start++;
+ continue;
+ }
+
+ break;
+ }
+
+ /*
+ * There are two column values. One for the field name,
+ * and one for the field value.
+ */
+ Column = ACPI_PTR_DIFF (Colon, LineBuffer) + 3;
+ NameColumn = ACPI_PTR_DIFF (Start, LineBuffer) + 1;
+
+ Length = ACPI_PTR_DIFF (End, Start);
+
+ TmpName = UtLocalCalloc (Length + 1);
+ ACPI_STRNCPY (TmpName, Start, Length);
+ Name = DtTrim (TmpName);
+ ACPI_FREE (TmpName);
+
+ Start = End = (Colon + 1);
+
+ while (*End)
+ {
+ /* Found left quotation, go to the right quotation and break */
+
+ if (*End == '"')
+ {
+ End++;
+ while (*End && *End != '"')
+ {
+ End++;
+ }
+
+ End++;
+ break;
+ }
+
+ if (*End == '(' ||
+ *End == '<' ||
+ *End == '/')
+ {
+ break;
+ }
+
+ End++;
+ }
+
+ Length = ACPI_PTR_DIFF (End, Start);
+ TmpValue = UtLocalCalloc (Length + 1);
+ ACPI_STRNCPY (TmpValue, Start, Length);
+ Value = DtTrim (TmpValue);
+ ACPI_FREE (TmpValue);
+
+ if (Name && Value)
+ {
+ Field = UtLocalCalloc (sizeof (DT_FIELD));
+ Field->Name = Name;
+ Field->Value = Value;
+ Field->Line = Line;
+ Field->ByteOffset = Offset;
+ Field->NameColumn = NameColumn;
+ Field->Column = Column;
+
+ DtLinkField (Field);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetNextLine
+ *
+ * PARAMETERS: Handle - Open file handle for the source file
+ *
+ * RETURN: Filled line buffer and offset of start-of-line (zero on EOF)
+ *
+ * DESCRIPTION: Get the next valid source line. Removes all comments.
+ * Ignores empty lines.
+ *
+ * Handles both slash-asterisk and slash-slash comments.
+ * Also, quoted strings, but no escapes within.
+ *
+ * Line is returned in Gbl_CurrentLineBuffer.
+ * Line number in original file is returned in Gbl_CurrentLineNumber.
+ *
+ *****************************************************************************/
+
+static UINT32
+DtGetNextLine (
+ FILE *Handle)
+{
+ UINT32 State = DT_NORMAL_TEXT;
+ UINT32 CurrentLineOffset;
+ UINT32 i;
+ char c;
+
+
+ for (i = 0; i < ASL_LINE_BUFFER_SIZE;)
+ {
+ c = (char) getc (Handle);
+ if (c == EOF)
+ {
+ return (0);
+ }
+
+ switch (State)
+ {
+ case DT_NORMAL_TEXT:
+
+ /* Normal text, insert char into line buffer */
+
+ Gbl_CurrentLineBuffer[i] = c;
+ switch (c)
+ {
+ case '/':
+ State = DT_START_COMMENT;
+ break;
+
+ case '"':
+ State = DT_START_QUOTED_STRING;
+ i++;
+ break;
+
+ case '\n':
+ CurrentLineOffset = Gbl_NextLineOffset;
+ Gbl_NextLineOffset = (UINT32) ftell (Handle);
+ Gbl_CurrentLineNumber++;
+
+ /* Exit if line is complete. Ignore blank lines */
+
+ if (i != 0)
+ {
+ Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate line */
+ return (CurrentLineOffset);
+ }
+ break;
+
+ default:
+ i++;
+ break;
+ }
+ break;
+
+ case DT_START_QUOTED_STRING:
+
+ /* Insert raw chars until end of quoted string */
+
+ Gbl_CurrentLineBuffer[i] = c;
+ i++;
+
+ if (c == '"')
+ {
+ State = DT_NORMAL_TEXT;
+ }
+ break;
+
+ case DT_START_COMMENT:
+
+ /* Open comment if this character is an asterisk or slash */
+
+ switch (c)
+ {
+ case '*':
+ State = DT_SLASH_ASTERISK_COMMENT;
+ break;
+
+ case '/':
+ State = DT_SLASH_SLASH_COMMENT;
+ break;
+
+ default: /* Not a comment */
+ i++; /* Save the preceeding slash */
+ Gbl_CurrentLineBuffer[i] = c;
+ i++;
+ State = DT_NORMAL_TEXT;
+ break;
+ }
+ break;
+
+ case DT_SLASH_ASTERISK_COMMENT:
+
+ /* Ignore chars until an asterisk-slash is found */
+
+ switch (c)
+ {
+ case '\n':
+ Gbl_NextLineOffset = (UINT32) ftell (Handle);
+ Gbl_CurrentLineNumber++;
+ break;
+
+ case '*':
+ State = DT_END_COMMENT;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case DT_SLASH_SLASH_COMMENT:
+
+ /* Ignore chars until end-of-line */
+
+ if (c == '\n')
+ {
+ /* We will exit via the NORMAL_TEXT path */
+
+ ungetc (c, Handle);
+ State = DT_NORMAL_TEXT;
+ }
+ break;
+
+ case DT_END_COMMENT:
+
+ /* End comment if this char is a slash */
+
+ switch (c)
+ {
+ case '/':
+ State = DT_NORMAL_TEXT;
+ break;
+
+ default:
+ State = DT_SLASH_ASTERISK_COMMENT;
+ break;
+ }
+ break;
+
+ default:
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state");
+ return (0);
+ }
+ }
+
+ printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE);
+ return (0);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtScanFile
+ *
+ * PARAMETERS: Handle - Open file handle for the source file
+ *
+ * RETURN: Pointer to start of the constructed parse tree.
+ *
+ * DESCRIPTION: Scan source file, link all field names and values
+ * to the global parse tree: Gbl_FieldList
+ *
+ *****************************************************************************/
+
+DT_FIELD *
+DtScanFile (
+ FILE *Handle)
+{
+ UINT32 Offset;
+
+
+ ACPI_FUNCTION_NAME (DtScanFile);
+
+
+ /* Get the file size */
+
+ Gbl_InputByteCount = DtGetFileSize (Handle);
+
+ Gbl_CurrentLineNumber = 0;
+ Gbl_CurrentLineOffset = 0;
+ Gbl_NextLineOffset = 0;
+
+ /* Scan line-by-line */
+
+ while ((Offset = DtGetNextLine (Handle)))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s",
+ Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer));
+
+ DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset);
+ }
+
+ return (Gbl_FieldList);
+}
+
+
+/*
+ * Output functions
+ */
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtWriteBinary
+ *
+ * PARAMETERS: DT_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Write one subtable of a binary ACPI table
+ *
+ *****************************************************************************/
+
+static void
+DtWriteBinary (
+ DT_SUBTABLE *Subtable,
+ void *Context,
+ void *ReturnValue)
+{
+
+ FlWriteFile (ASL_FILE_AML_OUTPUT, Subtable->Buffer, Subtable->Length);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtOutputBinary
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Write entire binary ACPI table (result of compilation)
+ *
+ *****************************************************************************/
+
+void
+DtOutputBinary (
+ DT_SUBTABLE *RootTable)
+{
+
+ if (!RootTable)
+ {
+ return;
+ }
+
+ /* Walk the entire parse tree, emitting the binary data */
+
+ DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL);
+ Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dtsubtable.c b/sys/contrib/dev/acpica/compiler/dtsubtable.c
new file mode 100644
index 0000000..8555003
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtsubtable.c
@@ -0,0 +1,400 @@
+/******************************************************************************
+ *
+ * Module Name: dtsubtable.c - handling of subtables within ACPI tables
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTSUBTABLE_C__
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtsubtable")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCreateSubtable
+ *
+ * PARAMETERS: Buffer - Input buffer
+ * Length - Buffer length
+ * RetSubtable - Returned newly created subtable
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a subtable that is not listed with ACPI_DMTABLE_INFO
+ * For example, FACS has 24 bytes reserved at the end
+ * and it's not listed at AcpiDmTableInfoFacs
+ *
+ *****************************************************************************/
+
+void
+DtCreateSubtable (
+ UINT8 *Buffer,
+ UINT32 Length,
+ DT_SUBTABLE **RetSubtable)
+{
+ DT_SUBTABLE *Subtable;
+
+
+ Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
+
+ /* Create a new buffer for the subtable data */
+
+ Subtable->Buffer = UtLocalCalloc (Length);
+ ACPI_MEMCPY (Subtable->Buffer, Buffer, Length);
+
+ Subtable->Length = Length;
+ Subtable->TotalLength = Length;
+
+ *RetSubtable = Subtable;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtInsertSubtable
+ *
+ * PARAMETERS: ParentTable - The Parent of the new subtable
+ * Subtable - The new subtable to insert
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert the new subtable to the parent table
+ *
+ *****************************************************************************/
+
+void
+DtInsertSubtable (
+ DT_SUBTABLE *ParentTable,
+ DT_SUBTABLE *Subtable)
+{
+ DT_SUBTABLE *ChildTable;
+
+
+ Subtable->Peer = NULL;
+ Subtable->Parent = ParentTable;
+
+ /* Link the new entry into the child list */
+
+ if (!ParentTable->Child)
+ {
+ ParentTable->Child = Subtable;
+ }
+ else
+ {
+ /* Walk to the end of the child list */
+
+ ChildTable = ParentTable->Child;
+ while (ChildTable->Peer)
+ {
+ ChildTable = ChildTable->Peer;
+ }
+
+ /* Add new subtable at the end of the child list */
+
+ ChildTable->Peer = Subtable;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtPushSubtable
+ *
+ * PARAMETERS: Subtable - Subtable to push
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push a subtable onto a subtable stack
+ *
+ *****************************************************************************/
+
+void
+DtPushSubtable (
+ DT_SUBTABLE *Subtable)
+{
+
+ Subtable->StackTop = Gbl_SubtableStack;
+ Gbl_SubtableStack = Subtable;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtPopSubtable
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Pop a subtable from a subtable stack. Uses global SubtableStack
+ *
+ *****************************************************************************/
+
+void
+DtPopSubtable (
+ void)
+{
+ DT_SUBTABLE *Subtable;
+
+
+ Subtable = Gbl_SubtableStack;
+
+ if (Subtable)
+ {
+ Gbl_SubtableStack = Subtable->StackTop;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtPeekSubtable
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: The subtable on top of stack
+ *
+ * DESCRIPTION: Get the subtable on top of stack
+ *
+ *****************************************************************************/
+
+DT_SUBTABLE *
+DtPeekSubtable (
+ void)
+{
+
+ return (Gbl_SubtableStack);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetNextSubtable
+ *
+ * PARAMETERS: ParentTable - Parent table whose children we are
+ * getting
+ * ChildTable - Previous child that was found.
+ * The NEXT child will be returned
+ *
+ * RETURN: Pointer to the NEXT child or NULL if none is found.
+ *
+ * DESCRIPTION: Return the next peer subtable within the tree.
+ *
+ *****************************************************************************/
+
+DT_SUBTABLE *
+DtGetNextSubtable (
+ DT_SUBTABLE *ParentTable,
+ DT_SUBTABLE *ChildTable)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!ChildTable)
+ {
+ /* It's really the parent's _scope_ that we want */
+
+ return (ParentTable->Child);
+ }
+
+ /* Otherwise just return the next peer (NULL if at end-of-list) */
+
+ return (ChildTable->Peer);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetParentSubtable
+ *
+ * PARAMETERS: Subtable - Current subtable
+ *
+ * RETURN: Parent of the given subtable
+ *
+ * DESCRIPTION: Get the parent of the given subtable in the tree
+ *
+ *****************************************************************************/
+
+DT_SUBTABLE *
+DtGetParentSubtable (
+ DT_SUBTABLE *Subtable)
+{
+
+ if (!Subtable)
+ {
+ return (NULL);
+ }
+
+ return (Subtable->Parent);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetSubtableLength
+ *
+ * PARAMETERS: Field - Current field list pointer
+ * Info - Data table info
+ *
+ * RETURN: Subtable length
+ *
+ * DESCRIPTION: Get length of bytes needed to compile the subtable
+ *
+ *****************************************************************************/
+
+UINT32
+DtGetSubtableLength (
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT32 ByteLength = 0;
+
+
+ /* Walk entire Info table; Null name terminates */
+
+ for (; Info->Name; Info++)
+ {
+ ByteLength += DtGetFieldLength (Field, Info);
+ }
+
+ return (ByteLength);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtSetSubtableLength
+ *
+ * PARAMETERS: Subtable - Subtable
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set length of the subtable into its length field
+ *
+ *****************************************************************************/
+
+void
+DtSetSubtableLength (
+ DT_SUBTABLE *Subtable)
+{
+
+ if (!Subtable->LengthField)
+ {
+ return;
+ }
+
+ ACPI_MEMCPY (Subtable->LengthField, &Subtable->TotalLength,
+ Subtable->SizeOfLengthField);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c
new file mode 100644
index 0000000..8cf36ae9
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dttable.c
@@ -0,0 +1,1409 @@
+/******************************************************************************
+ *
+ * Module Name: dttable.c - handling for specific ACPI tables
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTTABLE_C__
+
+/* Compile all complex data tables */
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dttable")
+
+
+/* TBD: merge these into dmtbinfo.c? */
+
+static ACPI_DMTABLE_INFO TableInfoAsfAddress[] =
+{
+ {ACPI_DMT_BUFFER, 0, "Addresses", 0},
+ {ACPI_DMT_EXIT, 0, NULL, 0}
+};
+
+static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] =
+{
+ {ACPI_DMT_PCI_PATH, 0, "PCI Path", 0},
+ {ACPI_DMT_EXIT, 0, NULL, 0}
+};
+
+
+/* TBD: move to acmacros.h */
+
+#define ACPI_SUB_PTR(t, a, b) \
+ ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+DtCompileTwoSubtables (
+ void **List,
+ ACPI_DMTABLE_INFO *TableInfo1,
+ ACPI_DMTABLE_INFO *TableInfo2);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileTwoSubtables
+ *
+ * PARAMETERS: List - Current field list pointer
+ * TableInfo1 - Info table 1
+ * TableInfo1 - Info table 2
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile tables with a header and one or more same subtables.
+ * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+DtCompileTwoSubtables (
+ void **List,
+ ACPI_DMTABLE_INFO *TableInfo1,
+ ACPI_DMTABLE_INFO *TableInfo2)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+
+
+ Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileFacs
+ *
+ * PARAMETERS: PFieldList - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile FACS.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileFacs (
+ DT_FIELD **PFieldList)
+{
+ DT_SUBTABLE *Subtable;
+ UINT8 *ReservedBuffer;
+ ACPI_STATUS Status;
+ UINT32 ReservedSize;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoFacs,
+ &Gbl_RootTable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Large FACS reserved area at the end of the table */
+
+ ReservedSize = (UINT32) sizeof (((ACPI_TABLE_FACS *) NULL)->Reserved1);
+ ReservedBuffer = UtLocalCalloc (ReservedSize);
+
+ DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
+
+ ACPI_FREE (ReservedBuffer);
+ DtInsertSubtable (Gbl_RootTable, Subtable);
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileRsdp
+ *
+ * PARAMETERS: PFieldList - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile RSDP.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileRsdp (
+ DT_FIELD **PFieldList)
+{
+ DT_SUBTABLE *Subtable;
+ ACPI_TABLE_RSDP *Rsdp;
+ ACPI_RSDP_EXTENSION *RsdpExtension;
+ ACPI_STATUS Status;
+
+
+ /* Compile the "common" RSDP (ACPI 1.0) */
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1,
+ &Gbl_RootTable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
+ DtSetTableChecksum (&Rsdp->Checksum);
+
+ if (Rsdp->Revision > 0)
+ {
+ /* Compile the "extended" part of the RSDP as a subtable */
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (Gbl_RootTable, Subtable);
+
+ /* Set length and extended checksum for entire RSDP */
+
+ RsdpExtension = ACPI_CAST_PTR (ACPI_RSDP_EXTENSION, Subtable->Buffer);
+ RsdpExtension->Length = Gbl_RootTable->Length + Subtable->Length;
+ DtSetTableChecksum (&RsdpExtension->ExtendedChecksum);
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileAsf
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile ASF!.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileAsf (
+ void **List)
+{
+ ACPI_ASF_INFO *AsfTable;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMTABLE_INFO *DataInfoTable = NULL;
+ UINT32 DataCount = 0;
+ ACPI_STATUS Status;
+ UINT32 i;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+
+
+ while (*PFieldList)
+ {
+ SubtableStart = *PFieldList;
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoAsfHdr,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ AsfTable = ACPI_CAST_PTR (ACPI_ASF_INFO, Subtable->Buffer);
+
+ switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_INFO:
+ InfoTable = AcpiDmTableInfoAsf0;
+ break;
+
+ case ACPI_ASF_TYPE_ALERT:
+ InfoTable = AcpiDmTableInfoAsf1;
+ break;
+
+ case ACPI_ASF_TYPE_CONTROL:
+ InfoTable = AcpiDmTableInfoAsf2;
+ break;
+
+ case ACPI_ASF_TYPE_BOOT:
+ InfoTable = AcpiDmTableInfoAsf3;
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+ InfoTable = AcpiDmTableInfoAsf4;
+ break;
+
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ switch (AsfTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_INFO:
+ DataInfoTable = NULL;
+ break;
+
+ case ACPI_ASF_TYPE_ALERT:
+ DataInfoTable = AcpiDmTableInfoAsf1a;
+ DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT,
+ ACPI_SUB_PTR (UINT8, Subtable->Buffer,
+ sizeof (ACPI_ASF_HEADER)))->Alerts;
+ break;
+
+ case ACPI_ASF_TYPE_CONTROL:
+ DataInfoTable = AcpiDmTableInfoAsf2a;
+ DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE,
+ ACPI_SUB_PTR (UINT8, Subtable->Buffer,
+ sizeof (ACPI_ASF_HEADER)))->Controls;
+ break;
+
+ case ACPI_ASF_TYPE_BOOT:
+ DataInfoTable = NULL;
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+ DataInfoTable = TableInfoAsfAddress;
+ DataCount = ACPI_CAST_PTR (ACPI_ASF_ADDRESS,
+ ACPI_SUB_PTR (UINT8, Subtable->Buffer,
+ sizeof (ACPI_ASF_HEADER)))->Devices;
+ break;
+
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "ASF!");
+ return (AE_ERROR);
+ }
+
+ if (DataInfoTable)
+ {
+ switch (AsfTable->Header.Type & 0x7F)
+ {
+ case ACPI_ASF_TYPE_ADDRESS:
+
+ while (DataCount > 0)
+ {
+ Status = DtCompileTable (PFieldList, DataInfoTable,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ DataCount = DataCount - Subtable->Length;
+ }
+ break;
+
+ default:
+
+ for (i = 0; i < DataCount; i++)
+ {
+ Status = DtCompileTable (PFieldList, DataInfoTable,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+ break;
+ }
+ }
+
+ DtPopSubtable ();
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileCpep
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile CPEP.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileCpep (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoCpep, AcpiDmTableInfoCpep0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileDmar
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile DMAR.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileDmar (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMAR_HEADER *DmarHeader;
+ UINT8 *ReservedBuffer;
+ UINT32 ReservedSize;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ /* DMAR Reserved area */
+
+ ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved);
+ ReservedBuffer = UtLocalCalloc (ReservedSize);
+
+ DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
+
+ ACPI_FREE (ReservedBuffer);
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ /* DMAR Header */
+
+ SubtableStart = *PFieldList;
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarHdr,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
+
+ switch (DmarHeader->Type)
+ {
+ case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ InfoTable = AcpiDmTableInfoDmar0;
+ break;
+ case ACPI_DMAR_TYPE_RESERVED_MEMORY:
+ InfoTable = AcpiDmTableInfoDmar1;
+ break;
+ case ACPI_DMAR_TYPE_ATSR:
+ InfoTable = AcpiDmTableInfoDmar2;
+ break;
+ case ACPI_DMAR_HARDWARE_AFFINITY:
+ InfoTable = AcpiDmTableInfoDmar3;
+ break;
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "DMAR");
+ return (AE_ERROR);
+ }
+
+ /* DMAR Subtable */
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ /* Optional Device Scope subtables */
+
+ while (*PFieldList)
+ {
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
+ &Subtable, FALSE);
+ if (Status == AE_NOT_FOUND)
+ {
+ break;
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ /* Optional PCI Paths */
+
+ while (*PFieldList)
+ {
+ Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
+ &Subtable, FALSE);
+ if (Status == AE_NOT_FOUND)
+ {
+ DtPopSubtable ();
+ break;
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+ }
+
+ DtPopSubtable ();
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileEinj
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile EINJ.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileEinj (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoEinj, AcpiDmTableInfoEinj0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileErst
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile ERST.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileErst (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoErst, AcpiDmTableInfoEinj0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileFadt
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile FADT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileFadt (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ ACPI_TABLE_HEADER *Table;
+ UINT8 Revision;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
+ Revision = Table->Revision;
+
+ if (Revision == 2)
+ {
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+ else if (Revision >= 2)
+ {
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileHest
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile HEST.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileHest (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+ ACPI_DMTABLE_INFO *InfoTable;
+ UINT16 Type;
+ UINT32 BankCount;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ /* Get subtable type */
+
+ SubtableStart = *PFieldList;
+ DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
+
+ switch (Type)
+ {
+ case ACPI_HEST_TYPE_IA32_CHECK:
+ InfoTable = AcpiDmTableInfoHest0;
+ break;
+
+ case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
+ InfoTable = AcpiDmTableInfoHest1;
+ break;
+
+ case ACPI_HEST_TYPE_IA32_NMI:
+ InfoTable = AcpiDmTableInfoHest2;
+ break;
+
+ case ACPI_HEST_TYPE_AER_ROOT_PORT:
+ InfoTable = AcpiDmTableInfoHest6;
+ break;
+
+ case ACPI_HEST_TYPE_AER_ENDPOINT:
+ InfoTable = AcpiDmTableInfoHest7;
+ break;
+
+ case ACPI_HEST_TYPE_AER_BRIDGE:
+ InfoTable = AcpiDmTableInfoHest8;
+ break;
+
+ case ACPI_HEST_TYPE_GENERIC_ERROR:
+ InfoTable = AcpiDmTableInfoHest9;
+ break;
+
+ default:
+ /* Cannot continue on unknown type */
+
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HEST");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+
+ /*
+ * Additional subtable data - IA32 Error Bank(s)
+ */
+ BankCount = 0;
+ switch (Type)
+ {
+ case ACPI_HEST_TYPE_IA32_CHECK:
+ BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
+ Subtable->Buffer))->NumHardwareBanks;
+ break;
+
+ case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
+ BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
+ Subtable->Buffer))->NumHardwareBanks;
+ break;
+
+ default:
+ break;
+ }
+
+ while (BankCount)
+ {
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoHestBank,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ BankCount--;
+ }
+ }
+
+ return AE_OK;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileIvrs
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile IVRS.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileIvrs (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_IVRS_HEADER *IvrsHeader;
+ UINT8 EntryType;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ SubtableStart = *PFieldList;
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer);
+
+ switch (IvrsHeader->Type)
+ {
+ case ACPI_IVRS_TYPE_HARDWARE:
+ InfoTable = AcpiDmTableInfoIvrs0;
+ break;
+
+ case ACPI_IVRS_TYPE_MEMORY1:
+ case ACPI_IVRS_TYPE_MEMORY2:
+ case ACPI_IVRS_TYPE_MEMORY3:
+ InfoTable = AcpiDmTableInfoIvrs1;
+ break;
+
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
+ {
+ while (*PFieldList &&
+ !ACPI_STRCMP ((*PFieldList)->Name, "Entry Type"))
+ {
+ SubtableStart = *PFieldList;
+ DtCompileInteger (&EntryType, *PFieldList, 1, 0);
+
+ switch (EntryType)
+ {
+ /* 4-byte device entries */
+
+ case ACPI_IVRS_TYPE_PAD4:
+ case ACPI_IVRS_TYPE_ALL:
+ case ACPI_IVRS_TYPE_SELECT:
+ case ACPI_IVRS_TYPE_START:
+ case ACPI_IVRS_TYPE_END:
+
+ InfoTable = AcpiDmTableInfoIvrs4;
+ break;
+
+ /* 8-byte entries, type A */
+
+ case ACPI_IVRS_TYPE_ALIAS_SELECT:
+ case ACPI_IVRS_TYPE_ALIAS_START:
+
+ InfoTable = AcpiDmTableInfoIvrs8a;
+ break;
+
+ /* 8-byte entries, type B */
+
+ case ACPI_IVRS_TYPE_PAD8:
+ case ACPI_IVRS_TYPE_EXT_SELECT:
+ case ACPI_IVRS_TYPE_EXT_START:
+
+ InfoTable = AcpiDmTableInfoIvrs8b;
+ break;
+
+ /* 8-byte entries, type C */
+
+ case ACPI_IVRS_TYPE_SPECIAL:
+
+ InfoTable = AcpiDmTableInfoIvrs8c;
+ break;
+
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart,
+ "IVRS Device Entry");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+ }
+
+ DtPopSubtable ();
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileMadt
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile MADT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileMadt (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+ ACPI_SUBTABLE_HEADER *MadtHeader;
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadt,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ SubtableStart = *PFieldList;
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoMadtHdr,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ MadtHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
+
+ switch (MadtHeader->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;
+ case ACPI_MADT_TYPE_LOCAL_X2APIC:
+ InfoTable = AcpiDmTableInfoMadt9;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
+ InfoTable = AcpiDmTableInfoMadt10;
+ break;
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPopSubtable ();
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileMcfg
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile MCFG.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileMcfg (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoMcfg, AcpiDmTableInfoMcfg0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileMsct
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile MSCT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileMsct (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoMsct, AcpiDmTableInfoMsct0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileRsdt
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile RSDT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileRsdt (
+ void **List)
+{
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD *FieldList = *(DT_FIELD **) List;
+ UINT32 Address;
+
+
+ ParentTable = DtPeekSubtable ();
+
+ while (FieldList)
+ {
+ DtCompileInteger ((UINT8 *) &Address, FieldList, 4, DT_NON_ZERO);
+
+ DtCreateSubtable ((UINT8 *) &Address, 4, &Subtable);
+ DtInsertSubtable (ParentTable, Subtable);
+ FieldList = FieldList->Next;
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileSlit
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile SLIT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileSlit (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *FieldList;
+ UINT32 Localities;
+ UINT8 *LocalityBuffer;
+ UINT32 RemainingData;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
+ LocalityBuffer = UtLocalCalloc (Localities);
+
+ FieldList = *PFieldList;
+ while (FieldList)
+ {
+ /* Handle multiple-line buffer */
+
+ RemainingData = Localities;
+ while (RemainingData && FieldList)
+ {
+ RemainingData = DtCompileBuffer (
+ LocalityBuffer + (Localities - RemainingData),
+ FieldList->Value, FieldList, RemainingData);
+ FieldList = FieldList->Next;
+ }
+
+ DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+
+ ACPI_FREE (LocalityBuffer);
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileSrat
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile SRAT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileSrat (
+ void **List)
+{
+ ACPI_STATUS Status;
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_FIELD *SubtableStart;
+ ACPI_SUBTABLE_HEADER *SratHeader;
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoSrat,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+
+ while (*PFieldList)
+ {
+ SubtableStart = *PFieldList;
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoSratHdr,
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPushSubtable (Subtable);
+
+ SratHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer);
+
+ switch (SratHeader->Type)
+ {
+ case ACPI_SRAT_TYPE_CPU_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat0;
+ break;
+ case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat1;
+ break;
+ case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat2;
+ break;
+ default:
+ DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
+ return (AE_ERROR);
+ }
+
+ Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ DtPopSubtable ();
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileWdat
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile WDAT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileWdat (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoWdat, AcpiDmTableInfoWdat0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtCompileXsdt
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile XSDT.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileXsdt (
+ void **List)
+{
+ DT_SUBTABLE *Subtable;
+ DT_SUBTABLE *ParentTable;
+ DT_FIELD *FieldList = *(DT_FIELD **) List;
+ UINT64 Address;
+
+ ParentTable = DtPeekSubtable ();
+
+ while (FieldList)
+ {
+ DtCompileInteger ((UINT8 *) &Address, FieldList, 8, DT_NON_ZERO);
+
+ DtCreateSubtable ((UINT8 *) &Address, 8, &Subtable);
+ DtInsertSubtable (ParentTable, Subtable);
+ FieldList = FieldList->Next;
+ }
+
+ return (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c
new file mode 100644
index 0000000..6bbb548
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dttemplate.c
@@ -0,0 +1,445 @@
+/******************************************************************************
+ *
+ * Module Name: dttemplate - ACPI table template generation
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/include/acapps.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+#include <contrib/dev/acpica/compiler/dttemplate.h> /* Contains the hex ACPI table templates */
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dttemplate")
+
+
+/* Local prototypes */
+
+static BOOLEAN
+AcpiUtIsSpecialTable (
+ char *Signature);
+
+static ACPI_STATUS
+DtCreateOneTemplate (
+ char *Signature,
+ ACPI_DMTABLE_DATA *TableData);
+
+static ACPI_STATUS
+DtCreateAllTemplates (
+ void);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtIsSpecialTable
+ *
+ * PARAMETERS: Signature - ACPI table signature
+ *
+ * RETURN: TRUE if signature is a special ACPI table
+ *
+ * DESCRIPTION: Check for valid ACPI tables that are not in the main ACPI
+ * table data structure (AcpiDmTableData).
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiUtIsSpecialTable (
+ char *Signature)
+{
+
+ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: DtCreateTemplates
+ *
+ * PARAMETERS: Signature - ACPI table signature
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create one or more template files.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+DtCreateTemplates (
+ char *Signature)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ ACPI_STATUS Status;
+
+
+ AslInitializeGlobals ();
+ AcpiUtStrupr (Signature);
+
+ /* Create all known templates if requested */
+
+ if (!ACPI_STRNCMP (Signature, "ALL", 3))
+ {
+ Status = DtCreateAllTemplates ();
+ return (Status);
+ }
+
+ /*
+ * Validate signature and get the template data:
+ * 1) Signature must be 4 characters
+ * 2) Signature must be a recognized ACPI table
+ * 3) There must be a template associated with the signature
+ */
+ if (strlen (Signature) != ACPI_NAME_SIZE)
+ {
+ fprintf (stderr, "%s, Invalid ACPI table signature\n", Signature);
+ return (AE_ERROR);
+ }
+
+ /*
+ * Some slack for the two strange tables whose name is different than
+ * their signatures: MADT->APIC and FADT->FACP.
+ */
+ if (!strcmp (Signature, "MADT"))
+ {
+ Signature = "APIC";
+ }
+ else if (!strcmp (Signature, "FADT"))
+ {
+ Signature = "FACP";
+ }
+
+ TableData = AcpiDmGetTableData (Signature);
+ if (TableData)
+ {
+ if (!TableData->Template)
+ {
+ fprintf (stderr, "%4.4s, No template available\n", Signature);
+ return (AE_ERROR);
+ }
+ }
+ else if (!AcpiUtIsSpecialTable (Signature))
+ {
+ fprintf (stderr,
+ "%4.4s, Unrecognized ACPI table signature\n", Signature);
+ return (AE_ERROR);
+ }
+
+ Status = AdInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = DtCreateOneTemplate (Signature, TableData);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: DtCreateAllTemplates
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create all currently defined template files
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+DtCreateAllTemplates (
+ void)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ ACPI_STATUS Status;
+
+
+ Status = AdInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ fprintf (stderr, "Creating all supported Template files\n");
+
+ /* Walk entire ACPI table data structure */
+
+ for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ {
+ /* If table has a template, create the template file */
+
+ if (TableData->Template)
+ {
+ Status = DtCreateOneTemplate (TableData->Signature,
+ TableData);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ /*
+ * Create the "special ACPI tables:
+ * 1) DSDT/SSDT are AML tables, not data tables
+ * 2) FACS and RSDP have non-standard headers
+ */
+ Status = DtCreateOneTemplate (ACPI_SIG_DSDT, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = DtCreateOneTemplate (ACPI_SIG_SSDT, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = DtCreateOneTemplate (ACPI_SIG_FACS, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = DtCreateOneTemplate (ACPI_RSDP_NAME, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: DtCreateOneTemplate
+ *
+ * PARAMETERS: Signature - ACPI signature, NULL terminated.
+ * TableData - Entry in ACPI table data structure.
+ * NULL if a special ACPI table.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create one template source file for the requested ACPI table.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+DtCreateOneTemplate (
+ char *Signature,
+ ACPI_DMTABLE_DATA *TableData)
+{
+ char *DisasmFilename;
+ FILE *File;
+ ACPI_STATUS Status = AE_OK;
+
+
+ /* New file will have a .asl suffix */
+
+ DisasmFilename = FlGenerateFilename (
+ Signature, FILE_SUFFIX_ASL_CODE);
+ if (!DisasmFilename)
+ {
+ fprintf (stderr, "Could not generate output filename\n");
+ return (AE_ERROR);
+ }
+
+ /* Probably should prompt to overwrite the file */
+
+ AcpiUtStrlwr (DisasmFilename);
+ File = fopen (DisasmFilename, "w+");
+ if (!File)
+ {
+ fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
+ return (AE_ERROR);
+ }
+
+ /* Emit the common file header */
+
+ AcpiOsRedirectOutput (File);
+
+ AcpiOsPrintf ("/*\n * %s\n", IntelAcpiCA);
+ AcpiOsPrintf (" * iASL Compiler/Disassembler version %8.8X\n *\n",
+ ACPI_CA_VERSION);
+ AcpiOsPrintf (" * Template for [%4.4s] ACPI Table\n",
+ Signature);
+
+ /* Dump the actual ACPI table */
+
+ if (TableData)
+ {
+ /* Normal case, tables that appear in AcpiDmTableData */
+
+ if (Gbl_VerboseTemplates)
+ {
+ AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]"
+ " FieldName : HexFieldValue\n */\n\n");
+ }
+ else
+ {
+ AcpiOsPrintf (" * Format: [ByteLength]"
+ " FieldName : HexFieldValue\n */\n\n");
+ }
+
+ AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ TableData->Template));
+ }
+ else
+ {
+ /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */
+
+ AcpiOsPrintf (" */\n\n");
+ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
+ {
+ fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File);
+ }
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
+ {
+ fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File);
+ }
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
+ {
+ AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ TemplateFacs));
+ }
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
+ {
+ AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ TemplateRsdp));
+ }
+ else
+ {
+ fprintf (stderr,
+ "%4.4s, Unrecognized ACPI table signature\n", Signature);
+ return (AE_ERROR);
+ }
+ }
+
+ fprintf (stderr,
+ "Created ACPI table template for [%4.4s], written to \"%s\"\n",
+ Signature, DisasmFilename);
+
+ fclose (File);
+ AcpiOsRedirectOutput (stdout);
+ ACPI_FREE (DisasmFilename);
+ return (Status);
+}
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h
new file mode 100644
index 0000000..5379b6e
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dttemplate.h
@@ -0,0 +1,757 @@
+/******************************************************************************
+ *
+ * Module Name: dttemplate.h - ACPI table template definitions
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#ifndef __DTTEMPLATE_H
+#define __DTTEMPLATE_H
+
+
+/* Special templates for DSDT and SSDT (AML byte-code tables) */
+
+const char TemplateDsdt[] =
+ "DefinitionBlock (\"dsdt.aml\", \"DSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
+ "{\n"
+ " Method (MAIN, 0, NotSerialized)\n"
+ " {\n"
+ " Return (Zero)\n"
+ " }\n"
+ "}\n\n";
+
+const char TemplateSsdt[] =
+ "DefinitionBlock (\"ssdt.aml\", \"SSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
+ "{\n"
+ " Method (MAIN, 0, NotSerialized)\n"
+ " {\n"
+ " Return (Zero)\n"
+ " }\n"
+ "}\n\n";
+
+
+/* Templates for ACPI data tables */
+
+const unsigned char TemplateAsf[] =
+{
+ 0x41,0x53,0x46,0x21,0x72,0x00,0x00,0x00, /* 00000000 "ASF!r..." */
+ 0x10,0x0B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x10,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x14,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x01,0x0C,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x02,0x00,0x0C,0x00,0x01,0x04,0x00,0x00, /* 00000048 "........" */
+ 0x00,0x00,0x00,0x00,0x03,0x00,0x17,0x00, /* 00000050 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x00,0x00,0x84,0x00,0x07,0x00,0x00, /* 00000068 "........" */
+ 0x01,0x00 /* 00000070 ".." */
+};
+
+const unsigned char TemplateBert[] =
+{
+ 0x42,0x45,0x52,0x54,0x30,0x00,0x00,0x00, /* 00000000 "BERT0..." */
+ 0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */
+};
+
+const unsigned char TemplateBoot[] =
+{
+ 0x42,0x4F,0x4F,0x54,0x28,0x00,0x00,0x00, /* 00000000 "BOOT(..." */
+ 0x01,0x0D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x04,0x06,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00 /* 00000020 "(.. ...." */
+};
+
+const unsigned char TemplateCpep[] =
+{
+ 0x43,0x50,0x45,0x50,0x34,0x00,0x00,0x00, /* 00000000 "CPEP4..." */
+ 0x01,0x0F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000030 "...." */
+};
+
+const unsigned char TemplateDbgp[] =
+{
+ 0x44,0x42,0x47,0x50,0x34,0x00,0x00,0x00, /* 00000000 "DBGP4..." */
+ 0x01,0x1A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000030 "...." */
+};
+
+const unsigned char TemplateDmar[] =
+{
+ 0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00, /* 00000000 "DMAR...." */
+ 0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "(.. /..." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07, /* 00000040 "........" */
+ 0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00, /* 00000048 ".. ....." */
+ 0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000050 "...x...." */
+ 0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000058 ".?.x...." */
+ 0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00, /* 00000060 "........" */
+ 0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000070 "........" */
+ 0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000088 "...." */
+};
+
+const unsigned char TemplateEcdt[] =
+{
+ 0x45,0x43,0x44,0x54,0x42,0x00,0x00,0x00, /* 00000000 "ECDTB..." */
+ 0x01,0x2D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".-INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x01,0x08,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "f......." */
+ 0x01,0x08,0x00,0x00,0x62,0x00,0x00,0x00, /* 00000030 "....b..." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x09,0x00 /* 00000040 ".." */
+};
+
+const unsigned char TemplateEinj[] =
+{
+ 0x45,0x49,0x4E,0x4A,0x30,0x01,0x00,0x00, /* 00000000 "EINJ0..." */
+ 0x01,0x09,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x30,0x00,0x00,0x00, /* 00000020 "(.. 0..." */
+ 0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000030 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000048 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000050 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000068 "........" */
+ 0x02,0x02,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000070 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000088 "........" */
+ 0x03,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000090 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000A8 "........" */
+ 0x04,0x03,0x01,0x00,0x00,0x40,0x00,0x04, /* 000000B0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000C8 "........" */
+ 0x05,0x03,0x01,0x00,0x01,0x10,0x00,0x02, /* 000000D0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000E8 "........" */
+ 0x06,0x01,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000F0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000108 "........" */
+ 0x07,0x00,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000110 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF /* 00000128 "........" */
+};
+
+const unsigned char TemplateErst[] =
+{
+ 0x45,0x52,0x53,0x54,0x30,0x02,0x00,0x00, /* 00000000 "ERST0..." */
+ 0x01,0xAB,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x30,0x00,0x00,0x00, /* 00000020 "(.. 0..." */
+ 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000030 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000048 "........" */
+ 0x01,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000050 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000068 "........" */
+ 0x02,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000070 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000088 "........" */
+ 0x03,0x04,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000090 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000A8 "........" */
+ 0x04,0x02,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000B0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000C8 "........" */
+ 0x05,0x03,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000D0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000E8 "........" */
+ 0x06,0x01,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000F0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000108 "........" */
+ 0x07,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000110 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000128 "........" */
+ 0x08,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000130 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000148 "........" */
+ 0x09,0x02,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000150 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000168 "........" */
+ 0x0A,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000170 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000188 "........" */
+ 0x0B,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000190 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000198 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001A0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001A8 "........" */
+ 0x0C,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001B0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001C8 "........" */
+ 0x0D,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001D0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001D8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001E0 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001E8 "........" */
+ 0x0E,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001F0 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001F8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000208 "........" */
+ 0x0F,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000210 ".....@.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000218 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000220 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF /* 00000228 "........" */
+};
+
+const unsigned char TemplateFacs[] =
+{
+ 0x46,0x41,0x43,0x53,0x40,0x00,0x00,0x00, /* 00000000 "FACS@..." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000008 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000010 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000020 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
+};
+
+const unsigned char TemplateFadt[] =
+{
+ 0x46,0x41,0x43,0x50,0xF4,0x00,0x00,0x00, /* 00000000 "FACP...." */
+ 0x04,0x4E,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".NINTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000048 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x04,0x02,0x01,0x04,0x08,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000070 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000080 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x02, /* 00000090 "..... .." */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 000000A8 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00, /* 000000C0 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
+ 0x01,0x20,0x00,0x03,0x01,0x00,0x00,0x00, /* 000000D0 ". ......" */
+ 0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x01, /* 000000D8 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
+ 0x00,0x00,0x00,0x00 /* 000000F0 "...." */
+};
+
+const unsigned char TemplateHest[] =
+{
+ 0x48,0x45,0x53,0x54,0xD4,0x01,0x00,0x00, /* 00000000 "HEST...." */
+ 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 00000028 "........" */
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000088 "........" */
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000090 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 000000B0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
+ 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 000000F0 "........" */
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000F8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
+ 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00, /* 00000118 "........" */
+ 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000120 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */
+ 0x00,0x00,0x00,0x00,0x09,0x00,0x02,0x00, /* 00000150 "........" */
+ 0xFF,0xFF,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000158 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 00000160 "........" */
+ 0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 00000168 ".@......" */
+ 0x00,0x00,0x00,0x00,0x03,0x1C,0x00,0x00, /* 00000170 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000188 "........" */
+ 0x00,0x10,0x00,0x00,0x09,0x00,0x03,0x00, /* 00000190 "........" */
+ 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000198 "........" */
+ 0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 000001A0 "........" */
+ 0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 000001A8 ".@......" */
+ 0x00,0x00,0x00,0x00,0x04,0x1C,0x00,0x00, /* 000001B0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C8 "........" */
+ 0x00,0x10,0x00,0x00 /* 000001D0 "...." */
+};
+
+const unsigned char TemplateHpet[] =
+{
+ 0x48,0x50,0x45,0x54,0x38,0x00,0x00,0x00, /* 00000000 "HPET8..." */
+ 0x01,0x09,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */
+};
+
+const unsigned char TemplateIvrs[] =
+{
+ 0x49,0x56,0x52,0x53,0xBC,0x00,0x00,0x00, /* 00000000 "IVRS...." */
+ 0x01,0x87,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x10,0x14,0x34,0x00,0x00,0x00,0x00,0x00, /* 00000030 "..4....." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, /* 00000048 "....@..." */
+ 0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, /* 00000050 "....B..." */
+ 0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, /* 00000058 "....H..." */
+ 0x00,0x00,0x00,0x00,0x20,0x08,0x20,0x00, /* 00000060 ".... . ." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x21,0x04,0x20,0x00, /* 00000080 "....!. ." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x00,0x00,0x00,0x00,0x10,0x14,0x18,0x00, /* 000000A0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
+ 0x00,0x00,0x00,0x00 /* 000000B8 "...." */
+};
+
+const unsigned char TemplateMadt[] =
+{
+ 0x41,0x50,0x49,0x43,0xB6,0x00,0x00,0x00, /* 00000000 "APIC...." */
+ 0x01,0x45,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".EINTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */
+ 0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x03,0x08,0x0D,0x00,0x01,0x00, /* 00000048 "........" */
+ 0x00,0x00,0x04,0x06,0x00,0x05,0x00,0x01, /* 00000050 "........" */
+ 0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x07,0x16,0x00,0x00, /* 00000070 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x5C,0x43,0x50,0x55, /* 00000080 "....\CPU" */
+ 0x30,0x00,0x08,0x10,0x05,0x00,0x00,0x00, /* 00000088 "0......." */
+ 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00, /* 00000090 "........" */
+ 0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */
+ 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
+ 0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00 /* 000000B0 "......" */
+};
+
+const unsigned char TemplateMcfg[] =
+{
+ 0x4D,0x43,0x46,0x47,0x3C,0x00,0x00,0x00, /* 00000000 "MCFG<..." */
+ 0x01,0x19,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000038 "...." */
+};
+
+const unsigned char TemplateMchi[] =
+{
+ 0x4D,0x43,0x48,0x49,0x45,0x00,0x00,0x00, /* 00000000 "MCHIE..." */
+ 0x01,0xE4,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x15,0x07,0x00,0x02,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x02,0x08,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00 /* 00000040 "....." */
+};
+
+const unsigned char TemplateMsct[] =
+{
+ 0x4D,0x53,0x43,0x54,0x90,0x00,0x00,0x00, /* 00000000 "MSCT...." */
+ 0x01,0xB7,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x38,0x00,0x00,0x00, /* 00000020 "(.. 8..." */
+ 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00, /* 00000030 "........" */
+ 0x01,0x16,0x00,0x00,0x00,0x00,0x03,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x40,0x00,0x00,0x00,0x01,0x16, /* 00000048 "..@....." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x16,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
+ 0x00,0x00,0x01,0x16,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */
+};
+
+const unsigned char TemplateRsdp[] =
+{
+ 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */
+ 0x43,0x49,0x4E,0x54,0x45,0x4C,0x20,0x02, /* 00000008 "CINTEL ." */
+ 0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00, /* 00000010 "....$..." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
+ 0xDC,0x00,0x00,0x00 /* 00000020 "...." */
+};
+
+const unsigned char TemplateRsdt[] =
+{
+ 0x52,0x53,0x44,0x54,0x44,0x00,0x00,0x00, /* 00000000 "RSDTD..." */
+ 0x01,0xB1,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x10,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x20,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000028 " ...0..." */
+ 0x40,0x00,0x00,0x00,0x50,0x00,0x00,0x00, /* 00000030 "@...P..." */
+ 0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00, /* 00000038 "`...p..." */
+ 0x80,0x00,0x00,0x00 /* 00000040 "...." */
+};
+
+const unsigned char TemplateSbst[] =
+{
+ 0x53,0x42,0x53,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SBST0..." */
+ 0x01,0x06,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */
+};
+
+const unsigned char TemplateSlit[] =
+{
+ 0x53,0x4C,0x49,0x54,0x3C,0x00,0x00,0x00, /* 00000000 "SLIT<..." */
+ 0x01,0x1B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x0A,0x0F,0x0F,0x0F, /* 00000028 "........" */
+ 0x0F,0x0A,0x0F,0x0F,0x0F,0x0F,0x0A,0x0F, /* 00000030 "........" */
+ 0x0F,0x0F,0x0F,0x0A /* 00000038 "...." */
+};
+
+const unsigned char TemplateSpcr[] =
+{
+ 0x53,0x50,0x43,0x52,0x50,0x00,0x00,0x00, /* 00000000 "SPCRP..." */
+ 0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000048 "........" */
+};
+
+const unsigned char TemplateSpmi[] =
+{
+ 0x53,0x50,0x4D,0x49,0x41,0x00,0x00,0x00, /* 00000000 "SPMIA..." */
+ 0x04,0xED,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00 /* 00000040 "." */
+};
+
+const unsigned char TemplateSrat[] =
+{
+ 0x53,0x52,0x41,0x54,0x80,0x00,0x00,0x00, /* 00000000 "SRAT...." */
+ 0x03,0x5A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".ZINTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x01,0x28,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 ".(......" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
+ 0x00,0xFC,0x09,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0x02,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000078 "........" */
+};
+
+const unsigned char TemplateTcpa[] =
+{
+ 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */
+ 0x01,0x67,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".gINTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x80,0x31,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 ".1..INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00 /* 00000030 ".." */
+};
+
+const unsigned char TemplateUefi[] =
+{
+ 0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
+ 0x01,0x9B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x01,0x02,0x03, /* 00000020 "(.. ...." */
+ 0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
+ 0x0C,0x0D,0x0E,0x0F,0x00,0x00 /* 00000030 "......" */
+};
+
+const unsigned char TemplateWaet[] =
+{
+ 0x57,0x41,0x45,0x54,0x28,0x00,0x00,0x00, /* 00000000 "WAET(..." */
+ 0x01,0x19,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00 /* 00000020 "(.. ...." */
+};
+
+const unsigned char TemplateWdat[] =
+{
+ 0x57,0x44,0x41,0x54,0x5C,0x00,0x00,0x00, /* 00000000 "WDAT\..." */
+ 0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x20,0x00,0x00,0x00, /* 00000020 "(.. ..." */
+ 0xFF,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x58,0x02,0x00,0x00,0xFF,0x03,0x00,0x00, /* 00000030 "X......." */
+ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x0E,0x00,0x00,0x00,0x01,0x02,0x00,0x00, /* 00000040 "........" */
+ 0x01,0x10,0x00,0x02,0x60,0x04,0x00,0x00, /* 00000048 "....`..." */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x01,0x00,0x00,0x00 /* 00000058 "...." */
+};
+
+const unsigned char TemplateWddt[] =
+{
+ 0x57,0x44,0x44,0x54,0x40,0x00,0x00,0x00, /* 00000000 "WDDT@..." */
+ 0x01,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x01,0xFF,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
+};
+
+const unsigned char TemplateWdrt[] =
+{
+ 0x57,0x44,0x52,0x54,0x47,0x00,0x00,0x00, /* 00000000 "WDRTG..." */
+ 0x01,0xB0,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x00,0x20,0x00,0x00, /* 00000020 "(.. . .." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ". ......" */
+ 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0xFF,0xFF,0x00 /* 00000040 "......." */
+};
+
+const unsigned char TemplateXsdt[] =
+{
+ 0x58,0x53,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "XSDTd..." */
+ 0x01,0x8B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x28,0x05,0x10,0x20,0x10,0x00,0x00,0x00, /* 00000020 "(.. ...." */
+ 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000028 ".... ..." */
+ 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000030 "....0..." */
+ 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, /* 00000038 "....@..." */
+ 0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, /* 00000040 "....P..." */
+ 0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00, /* 00000048 "....`..." */
+ 0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00, /* 00000050 "....p..." */
+ 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* 00000058 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000060 "...." */
+};
+
+#endif
diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c
new file mode 100644
index 0000000..56ef05b
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/dtutils.c
@@ -0,0 +1,902 @@
+/******************************************************************************
+ *
+ * Module Name: dtutils.c - Utility routines for the data table compiler
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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.
+ *
+ *****************************************************************************/
+
+#define __DTUTILS_C__
+
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
+#include <contrib/dev/acpica/include/actables.h>
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtutils")
+
+/* Local prototypes */
+
+static void
+DtSum (
+ DT_SUBTABLE *Subtable,
+ void *Context,
+ void *ReturnValue);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * Op - Parse node where error happened
+ * ExtraMessage - additional error message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Common error interface for data table compiler
+ *
+ *****************************************************************************/
+
+void
+DtError (
+ UINT8 Level,
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage)
+{
+
+ switch (Level)
+ {
+ case ASL_WARNING2:
+ case ASL_WARNING3:
+ if (Gbl_WarningLevel < Level)
+ {
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (FieldObject)
+ {
+ AslCommonError (Level, MessageId,
+ FieldObject->Line,
+ FieldObject->Line,
+ FieldObject->ByteOffset,
+ FieldObject->Column,
+ Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage);
+ }
+ else
+ {
+ AslCommonError (Level, MessageId, 0,
+ 0, 0, 0, 0, ExtraMessage);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtNameError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * Op - Parse node where error happened
+ * ExtraMessage - additional error message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Error interface for named objects
+ *
+ *****************************************************************************/
+
+void
+DtNameError (
+ UINT8 Level,
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage)
+{
+
+ switch (Level)
+ {
+ case ASL_WARNING2:
+ case ASL_WARNING3:
+ if (Gbl_WarningLevel < Level)
+ {
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (FieldObject)
+ {
+ AslCommonError (Level, MessageId,
+ FieldObject->Line,
+ FieldObject->Line,
+ FieldObject->ByteOffset,
+ FieldObject->NameColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, ExtraMessage);
+ }
+ else
+ {
+ AslCommonError (Level, MessageId, 0,
+ 0, 0, 0, 0, ExtraMessage);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: DtFatal
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
+ * compile or I/O errors
+ *
+ ******************************************************************************/
+
+void
+DtFatal (
+ UINT8 MessageId,
+ DT_FIELD *FieldObject,
+ char *ExtraMessage)
+{
+
+ DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage);
+
+ CmCleanupAndExit ();
+ exit (1);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtStrtoul64
+ *
+ * PARAMETERS: String - Null terminated string
+ * ReturnInteger - Where the converted integer is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Simple conversion of a string hex integer constant to unsigned
+ * value. Assumes no leading "0x" for the constant.
+ *
+ * Portability note: The reason this function exists is because a 64-bit
+ * sscanf is not available in all environments.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtStrtoul64 (
+ char *String,
+ UINT64 *ReturnInteger)
+{
+ char *ThisChar = String;
+ UINT32 ThisDigit;
+ UINT64 ReturnValue = 0;
+ int DigitCount = 0;
+
+
+ /* Skip over any white space in the buffer */
+
+ while ((*ThisChar == ' ') || (*ThisChar == '\t'))
+ {
+ ThisChar++;
+ }
+
+ /* Skip leading zeros */
+
+ while ((*ThisChar) == '0')
+ {
+ ThisChar++;
+ }
+
+ /* Convert character-by-character */
+
+ while (*ThisChar)
+ {
+ if (ACPI_IS_DIGIT (*ThisChar))
+ {
+ /* Convert ASCII 0-9 to Decimal value */
+
+ ThisDigit = ((UINT8) *ThisChar) - '0';
+ }
+ else /* Letter */
+ {
+ ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar);
+ if (!ACPI_IS_XDIGIT ((char) ThisDigit))
+ {
+ /* Not A-F */
+
+ return (AE_BAD_CHARACTER);
+ }
+
+ /* Convert ASCII Hex char (A-F) to value */
+
+ ThisDigit = (ThisDigit - 'A') + 10;
+ }
+
+ /* Insert the 4-bit hex digit */
+
+ ReturnValue <<= 4;
+ ReturnValue += ThisDigit;
+
+ ThisChar++;
+ DigitCount++;
+ if (DigitCount > 16)
+ {
+ /* Value is too large (> 64 bits/8 bytes/16 hex digits) */
+
+ return (AE_LIMIT);
+ }
+ }
+
+ *ReturnInteger = ReturnValue;
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetFileSize
+ *
+ * PARAMETERS: Handle - Open file handler
+ *
+ * RETURN: Current file size
+ *
+ * DESCRIPTION: Get the current size of a file. Seek to the EOF and get the
+ * offset. Seek back to the original location.
+ *
+ *****************************************************************************/
+
+UINT32
+DtGetFileSize (
+ FILE *Handle)
+{
+ int CurrentOffset;
+ int LastOffset;
+
+
+ CurrentOffset = ftell (Handle);
+ fseek (Handle, 0, SEEK_END);
+ LastOffset = ftell (Handle);
+ fseek (Handle, CurrentOffset, SEEK_SET);
+
+ return ((UINT32) LastOffset);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetFieldValue
+ *
+ * PARAMETERS: Field - Current field list pointer
+ * Name - Field name
+ *
+ * RETURN: Field value
+ *
+ * DESCRIPTION: Get field value
+ *
+ *****************************************************************************/
+
+char *
+DtGetFieldValue (
+ DT_FIELD *Field,
+ char *Name)
+{
+
+ /* Search the field list for the name */
+
+ while (Field)
+ {
+ if (!ACPI_STRCMP (Name, Field->Name))
+ {
+ return (Field->Value);
+ }
+
+ Field = Field->Next;
+ }
+
+ return (NULL);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetFieldType
+ *
+ * PARAMETERS: Info - Data table info
+ *
+ * RETURN: Field type
+ *
+ * DESCRIPTION: Get field type
+ *
+ *****************************************************************************/
+
+UINT8
+DtGetFieldType (
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT8 Type;
+
+
+ /* DT_FLAG means that this is the start of a block of flag bits */
+ /* TBD - we can make these a separate opcode later */
+
+ if (Info->Flags & DT_FLAG)
+ {
+ return (DT_FIELD_TYPE_FLAGS_INTEGER);
+ }
+
+ /* Type is based upon the opcode for this field in the info table */
+
+ switch (Info->Opcode)
+ {
+ 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:
+ case ACPI_DMT_FLAGS0:
+ case ACPI_DMT_FLAGS2:
+ Type = DT_FIELD_TYPE_FLAG;
+ break;
+
+ case ACPI_DMT_NAME4:
+ case ACPI_DMT_SIG:
+ case ACPI_DMT_NAME6:
+ case ACPI_DMT_NAME8:
+ case ACPI_DMT_STRING:
+ Type = DT_FIELD_TYPE_STRING;
+ break;
+
+ case ACPI_DMT_BUFFER:
+ case ACPI_DMT_BUF16:
+ case ACPI_DMT_PCI_PATH:
+ Type = DT_FIELD_TYPE_BUFFER;
+ break;
+
+ case ACPI_DMT_GAS:
+ case ACPI_DMT_HESTNTFY:
+ Type = DT_FIELD_TYPE_INLINE_SUBTABLE;
+ break;
+
+ default:
+ Type = DT_FIELD_TYPE_INTEGER;
+ break;
+ }
+
+ return (Type);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetBufferLength
+ *
+ * PARAMETERS: Buffer - List of integers,
+ * for example "10 3A 4F 2E"
+ *
+ * RETURN: Count of integer
+ *
+ * DESCRIPTION: Get length of bytes needed to store the integers
+ *
+ *****************************************************************************/
+
+UINT32
+DtGetBufferLength (
+ char *Buffer)
+{
+ UINT32 ByteLength = 0;
+
+
+ while (*Buffer)
+ {
+ if (*Buffer == ' ')
+ {
+ ByteLength++;
+
+ while (*Buffer == ' ')
+ {
+ Buffer++;
+ }
+ }
+
+ Buffer++;
+ }
+
+ return (++ByteLength);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtGetFieldLength
+ *
+ * PARAMETERS: Field - Current field list pointer
+ * Info - Data table info
+ *
+ * RETURN: Field length
+ *
+ * DESCRIPTION: Get length of bytes needed to compile the field
+ *
+ * Note: This function must remain in sync with AcpiDmDumpTable.
+ *
+ *****************************************************************************/
+
+UINT32
+DtGetFieldLength (
+ DT_FIELD *Field,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT32 ByteLength = 0;
+ char *Value;
+
+
+ /* Length is based upon the opcode for this field in the info table */
+
+ switch (Info->Opcode)
+ {
+ 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:
+ case ACPI_DMT_FLAGS0:
+ case ACPI_DMT_FLAGS2:
+ ByteLength = 0;
+ break;
+
+ case ACPI_DMT_UINT8:
+ case ACPI_DMT_CHKSUM:
+ case ACPI_DMT_SPACEID:
+ case ACPI_DMT_IVRS:
+ case ACPI_DMT_MADT:
+ case ACPI_DMT_SRAT:
+ case ACPI_DMT_ASF:
+ case ACPI_DMT_HESTNTYP:
+ case ACPI_DMT_FADTPM:
+ case ACPI_DMT_EINJACT:
+ case ACPI_DMT_EINJINST:
+ case ACPI_DMT_ERSTACT:
+ case ACPI_DMT_ERSTINST:
+ ByteLength = 1;
+ break;
+
+ case ACPI_DMT_UINT16:
+ case ACPI_DMT_DMAR:
+ case ACPI_DMT_HEST:
+ case ACPI_DMT_PCI_PATH:
+ 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:
+ Value = DtGetFieldValue (Field, Info->Name);
+
+ /* TBD: error if Value is NULL? (as below?) */
+
+ ByteLength = ACPI_STRLEN (Value) + 1;
+ break;
+
+ case ACPI_DMT_GAS:
+ ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
+ break;
+
+ case ACPI_DMT_HESTNTFY:
+ ByteLength = sizeof (ACPI_HEST_NOTIFY);
+ break;
+
+ case ACPI_DMT_BUFFER:
+ Value = DtGetFieldValue (Field, Info->Name);
+ if (Value)
+ {
+ ByteLength = DtGetBufferLength (Value);
+ }
+ else
+ { /* At this point, this is a fatal error */
+
+ sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
+ }
+ break;
+
+ case ACPI_DMT_BUF16:
+ ByteLength = 16;
+ break;
+
+ default:
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode");
+ break;
+ }
+
+ return (ByteLength);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtSum
+ *
+ * PARAMETERS: DT_WALK_CALLBACK:
+ * Subtable - Subtable
+ * Context - Unused
+ * ReturnValue - Store the checksum of subtable
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the checksum of subtable
+ *
+ *****************************************************************************/
+
+static void
+DtSum (
+ DT_SUBTABLE *Subtable,
+ void *Context,
+ void *ReturnValue)
+{
+ UINT8 Checksum;
+ UINT8 *Sum = ReturnValue;
+
+
+ Checksum = AcpiTbChecksum (Subtable->Buffer, Subtable->Length);
+ *Sum = (UINT8) (*Sum + Checksum);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtSetTableChecksum
+ *
+ * PARAMETERS: ChecksumPointer - Where to return the checksum
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set checksum of the whole data table into the checksum field
+ *
+ *****************************************************************************/
+
+void
+DtSetTableChecksum (
+ UINT8 *ChecksumPointer)
+{
+ UINT8 Checksum = 0;
+ UINT8 OldSum;
+
+
+ DtWalkTableTree (Gbl_RootTable, DtSum, NULL, &Checksum);
+
+ OldSum = *ChecksumPointer;
+ Checksum = (UINT8) (Checksum - OldSum);
+
+ /* Compute the final checksum */
+
+ Checksum = (UINT8) (0 - Checksum);
+ *ChecksumPointer = Checksum;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtSetTableLength
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Walk the subtables and set all the length fields
+ *
+ *****************************************************************************/
+
+void
+DtSetTableLength (
+ void)
+{
+ DT_SUBTABLE *ParentTable;
+ DT_SUBTABLE *ChildTable;
+
+
+ ParentTable = Gbl_RootTable;
+ ChildTable = NULL;
+
+ if (!ParentTable)
+ {
+ return;
+ }
+
+ DtSetSubtableLength (ParentTable);
+
+ while (1)
+ {
+ ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
+ if (ChildTable)
+ {
+ if (ChildTable->LengthField)
+ {
+ DtSetSubtableLength (ChildTable);
+ }
+
+ if (ChildTable->Child)
+ {
+ ParentTable = ChildTable;
+ ChildTable = NULL;
+ }
+ else
+ {
+ ParentTable->TotalLength += ChildTable->TotalLength;
+ if (ParentTable->LengthField)
+ {
+ DtSetSubtableLength (ParentTable);
+ }
+ }
+ }
+ else
+ {
+ ChildTable = ParentTable;
+
+ if (ChildTable == Gbl_RootTable)
+ {
+ break;
+ }
+
+ ParentTable = DtGetParentSubtable (ParentTable);
+
+ ParentTable->TotalLength += ChildTable->TotalLength;
+ if (ParentTable->LengthField)
+ {
+ DtSetSubtableLength (ParentTable);
+ }
+ }
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtWalkTableTree
+ *
+ * PARAMETERS: StartTable - Subtable in the tree where walking begins
+ * UserFunction - Called during the walk
+ * Context - Passed to user function
+ * ReturnValue - The return value of UserFunction
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Performs a depth-first walk of the subtable tree
+ *
+ *****************************************************************************/
+
+void
+DtWalkTableTree (
+ DT_SUBTABLE *StartTable,
+ DT_WALK_CALLBACK UserFunction,
+ void *Context,
+ void *ReturnValue)
+{
+ DT_SUBTABLE *ParentTable;
+ DT_SUBTABLE *ChildTable;
+
+
+ ParentTable = StartTable;
+ ChildTable = NULL;
+
+ if (!ParentTable)
+ {
+ return;
+ }
+
+ UserFunction (ParentTable, Context, ReturnValue);
+
+ while (1)
+ {
+ ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
+ if (ChildTable)
+ {
+ UserFunction (ChildTable, Context, ReturnValue);
+
+ if (ChildTable->Child)
+ {
+ ParentTable = ChildTable;
+ ChildTable = NULL;
+ }
+ }
+ else
+ {
+ ChildTable = ParentTable;
+ if (ChildTable == Gbl_RootTable)
+ {
+ break;
+ }
+
+ ParentTable = DtGetParentSubtable (ParentTable);
+
+ if (ChildTable->Peer == StartTable)
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtFreeFieldList
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Free the field list
+ *
+ *****************************************************************************/
+
+void
+DtFreeFieldList (
+ void)
+{
+ DT_FIELD *Field = Gbl_FieldList;
+ DT_FIELD *NextField;
+
+
+ /* Walk and free entire field list */
+
+ while (Field)
+ {
+ NextField = Field->Next; /* Save link */
+
+ if (!(Field->Flags & DT_FIELD_NOT_ALLOCATED))
+ {
+ ACPI_FREE (Field->Name);
+ ACPI_FREE (Field->Value);
+ }
+
+ ACPI_FREE (Field);
+ Field = NextField;
+ }
+}
OpenPOWER on IntegriCloud