summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcodegen.c101
-rw-r--r--source/compiler/aslcompile.c31
-rw-r--r--source/compiler/aslcompiler.h16
-rw-r--r--source/compiler/aslcompiler.l5
-rw-r--r--source/compiler/asldebug.c34
-rw-r--r--source/compiler/asldefine.h8
-rw-r--r--source/compiler/aslfiles.c32
-rw-r--r--source/compiler/aslglobal.h22
-rw-r--r--source/compiler/aslhelp.c8
-rw-r--r--source/compiler/asllength.c5
-rw-r--r--source/compiler/aslmap.c36
-rw-r--r--source/compiler/asloffset.c2
-rw-r--r--source/compiler/asloperands.c7
-rw-r--r--source/compiler/asloptions.c63
-rw-r--r--source/compiler/aslprimaries.y23
-rw-r--r--source/compiler/aslprintf.c2
-rw-r--r--source/compiler/aslresources.y9
-rw-r--r--source/compiler/aslrules.y10
-rw-r--r--source/compiler/aslstartup.c32
-rw-r--r--source/compiler/aslsupport.l114
-rw-r--r--source/compiler/asltree.c175
-rw-r--r--source/compiler/asltypes.h23
-rw-r--r--source/compiler/aslwalks.c2
-rw-r--r--source/compiler/cvcompiler.c890
-rw-r--r--source/compiler/cvdisasm.c423
-rw-r--r--source/compiler/cvparser.c887
-rw-r--r--source/compiler/dttable1.c4
-rw-r--r--source/compiler/dttemplate.h72
28 files changed, 2904 insertions, 132 deletions
diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c
index 941525392e80..f970238bb1b5 100644
--- a/source/compiler/aslcodegen.c
+++ b/source/compiler/aslcodegen.c
@@ -44,6 +44,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcodegen")
@@ -57,12 +58,6 @@ CgAmlWriteWalk (
void *Context);
static void
-CgLocalWriteAmlData (
- ACPI_PARSE_OBJECT *Op,
- void *Buffer,
- UINT32 Length);
-
-static void
CgWriteAmlOpcode (
ACPI_PARSE_OBJECT *Op);
@@ -206,7 +201,7 @@ CgAmlWriteWalk (
*
******************************************************************************/
-static void
+void
CgLocalWriteAmlData (
ACPI_PARSE_OBJECT *Op,
void *Buffer,
@@ -261,6 +256,15 @@ CgWriteAmlOpcode (
return;
}
+ /*
+ * Before printing the bytecode, generate comment byte codes
+ * associated with this node.
+ */
+ if (Gbl_CaptureComments)
+ {
+ CgWriteAmlComment(Op);
+ }
+
switch (Op->Asl.AmlOpcode)
{
case AML_UNASSIGNED_OPCODE:
@@ -416,6 +420,8 @@ CgWriteTableHeader (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *Child;
+ UINT32 CommentLength;
+ ACPI_COMMENT_NODE *Current;
/* AML filename */
@@ -425,6 +431,21 @@ CgWriteTableHeader (
/* Signature */
Child = Child->Asl.Next;
+
+ /*
+ * For ASL-/ASL+ converter: replace the table signature with
+ * "XXXX" and save the original table signature. This results in an AML
+ * file with the signature "XXXX". The converter should remove this AML
+ * file. In the event where this AML file does not get deleted, the
+ * "XXXX" table signature prevents this AML file from running on the AML
+ * interpreter.
+ */
+ if (Gbl_CaptureComments)
+ {
+ strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, 4);
+ Child->Asl.Value.String = ACPI_SIG_XXXX;
+ }
+
strncpy (TableHeader.Signature, Child->Asl.Value.String, 4);
/* Revision */
@@ -466,6 +487,50 @@ CgWriteTableHeader (
TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
Op->Asl.AmlSubtreeLength;
+
+ /* Calculate the comment lengths for this definition block parseOp */
+
+ if (Gbl_CaptureComments)
+ {
+ CvDbgPrint ("Calculating comment lengths for %s in write header\n",
+ Op->Asl.ParseOpName);
+
+ /*
+ * Take the filename without extensions, add 3 for the new extension
+ * and another 3 for the a908 bytecode and null terminator.
+ */
+ TableHeader.Length += strrchr (Gbl_ParseTreeRoot->Asl.Filename, '.')
+ - Gbl_ParseTreeRoot->Asl.Filename + 1 + 3 + 3;
+ Op->Asl.AmlSubtreeLength +=
+ strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3;
+ CvDbgPrint (" Length: %lu\n",
+ strlen (Gbl_ParseTreeRoot->Asl.Filename) + 3);
+
+ if (Op->Asl.CommentList)
+ {
+ Current = Op->Asl.CommentList;
+ while (Current)
+ {
+ CommentLength = strlen (Current->Comment)+3;
+ CvDbgPrint ("Length of standard comment): %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Current->Comment);
+ TableHeader.Length += CommentLength;
+ Op->Asl.AmlSubtreeLength += CommentLength;
+ Current = Current->Next;
+ CvDbgPrint (" Length: %u\n", CommentLength);
+ }
+ }
+ if (Op->Asl.CloseBraceComment)
+ {
+ CommentLength = strlen (Op->Asl.CloseBraceComment)+3;
+ CvDbgPrint ("Length of inline comment +3: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Op->Asl.CloseBraceComment);
+ TableHeader.Length += CommentLength;
+ Op->Asl.AmlSubtreeLength += CommentLength;
+ CvDbgPrint (" Length: %u\n", CommentLength);
+ }
+ }
+
TableHeader.Checksum = 0;
Op->Asl.FinalAmlOffset = ftell (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
@@ -492,13 +557,13 @@ CgWriteTableHeader (
static void
CgUpdateHeader (
- ACPI_PARSE_OBJECT *Op)
+ ACPI_PARSE_OBJECT *Op)
{
- signed char Sum;
- UINT32 i;
- UINT32 Length;
- UINT8 FileByte;
- UINT8 Checksum;
+ signed char Sum;
+ UINT32 i;
+ UINT32 Length;
+ UINT8 FileByte;
+ UINT8 Checksum;
/* Calculate the checksum over the entire definition block */
@@ -580,6 +645,12 @@ CgWriteNode (
ASL_RESOURCE_NODE *Rnode;
+ /* Write all comments here. */
+ if (Gbl_CaptureComments)
+ {
+ CgWriteAmlComment(Op);
+ }
+
/* Always check for DEFAULT_ARG and other "Noop" nodes */
/* TBD: this may not be the best place for this check */
@@ -641,6 +712,10 @@ CgWriteNode (
case PARSEOP_DEFINITION_BLOCK:
CgWriteTableHeader (Op);
+ if (Gbl_CaptureComments)
+ {
+ CgWriteAmlDefBlockComment (Op);
+ }
break;
case PARSEOP_NAMESEG:
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 281be341426b..5da664f57c23 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -285,8 +285,17 @@ CmDoCompile (
{
Event = UtBeginEvent ("Resolve all Externals");
DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
- ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL);
+
+ if (Gbl_DoExternalsInPlace)
+ {
+ TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
+ ExAmlExternalWalkBegin, NULL, NULL);
+ }
+ else
+ {
+ TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+ ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL);
+ }
UtEndEvent (Event);
}
@@ -347,6 +356,18 @@ CmDoCompile (
NULL, &AnalysisWalkInfo);
UtEndEvent (Event);
+ /*
+ * ASL-/ASL+ converter: Gbl_ParseTreeRoot->CommentList contains the
+ * very last comment of a given ASL file because it's the last constructed
+ * node during compilation. We take the very last comment and save it in a
+ * global for it to be used by the disassembler.
+ */
+ if (Gbl_CaptureComments)
+ {
+ AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList;
+ Gbl_ParseTreeRoot->Asl.CommentList = NULL;
+ }
+
/* Calculate all AML package lengths */
Event = UtBeginEvent ("Finish AML package length generation");
@@ -800,7 +821,11 @@ CmCleanupAndExit (
/* Final cleanup after compiling one file */
- CmDeleteCaches ();
+ if (!Gbl_DoAslConversion)
+ {
+ CmDeleteCaches ();
+ }
+
}
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index f9fe2a31436f..0b7403f7a808 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -576,6 +576,12 @@ void
CgGenerateAmlOutput (
void);
+void
+CgLocalWriteAmlData (
+ ACPI_PARSE_OBJECT *Op,
+ void *Buffer,
+ UINT32 Length);
+
/*
* aslfile
@@ -1359,4 +1365,14 @@ ACPI_STATUS
DtCreateTemplates (
char **argv);
+
+/*
+ * ASL/ASL+ converter debug
+ */
+void
+CvDbgPrint (
+ char *Fmt,
+ ...);
+
+
#endif /* __ASLCOMPILER_H */
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 5e0d4c12ca14..b609291e19e7 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -44,6 +44,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "acconvert.h"
#include <stdlib.h>
#include <string.h>
@@ -66,10 +67,10 @@ YYSTYPE AslCompilerlval;
static void
AslDoLineDirective (void);
-static char
+static BOOLEAN
AslDoComment (void);
-static char
+static BOOLEAN
AslDoCommentType2 (void);
static char
diff --git a/source/compiler/asldebug.c b/source/compiler/asldebug.c
index 0178e05ce432..12f3c3475699 100644
--- a/source/compiler/asldebug.c
+++ b/source/compiler/asldebug.c
@@ -60,6 +60,40 @@ UtDumpParseOpName (
/*******************************************************************************
*
+ * FUNCTION: CvDbgPrint
+ *
+ * PARAMETERS: Type - Type of output
+ * Fmt - Printf format string
+ * ... - variable printf list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print statement for debug messages within the converter.
+ *
+ ******************************************************************************/
+
+void
+CvDbgPrint (
+ char *Fmt,
+ ...)
+{
+ va_list Args;
+
+
+ if (!Gbl_CaptureComments || !AcpiGbl_DebugAslConversion)
+ {
+ return;
+ }
+
+ va_start (Args, Fmt);
+ (void) vfprintf (AcpiGbl_ConvDebugFile, Fmt, Args);
+ va_end (Args);
+ return;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: UtDumpIntegerOp
*
* PARAMETERS: Op - Current parse op
diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h
index 94ee7c88f819..85ecfc95e08a 100644
--- a/source/compiler/asldefine.h
+++ b/source/compiler/asldefine.h
@@ -159,7 +159,6 @@
/*
* Macros for debug output
*/
-
#define DEBUG_MAX_LINE_LENGTH 61
#define DEBUG_SPACES_PER_INDENT 3
#define DEBUG_FULL_LINE_LENGTH 71
@@ -185,4 +184,11 @@
" %08X %04X %04X %01X %04X %04X %05X %05X "\
"%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d\n"
+/*
+ * Macros for ASL/ASL+ converter
+ */
+#define COMMENT_CAPTURE_ON Gbl_CommentState.CaptureComments = TRUE;
+#define COMMENT_CAPTURE_OFF Gbl_CommentState.CaptureComments = FALSE;
+
+
#endif /* ASLDEFINE.H */
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index ed067f0f0985..809090cf61a2 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -511,8 +511,14 @@ FlOpenAmlOutputFile (
if (!Filename)
{
/* Create the output AML filename */
-
- Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE);
+ if (!Gbl_CaptureComments)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE);
+ }
+ else
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_CONVERT_AML);
+ }
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME,
@@ -854,6 +860,28 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
}
+ /* Create a debug file for the converter */
+
+ if (AcpiGbl_DebugAslConversion)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_CONVERT_DEBUG);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the converter debug file, text mode */
+
+ FlOpenFile (ASL_FILE_CONV_DEBUG_OUTPUT, Filename, "w+t");
+
+ AslCompilerSignon (ASL_FILE_CONV_DEBUG_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_CONV_DEBUG_OUTPUT);
+
+ AcpiGbl_ConvDebugFile = Gbl_Files[ASL_FILE_CONV_DEBUG_OUTPUT].Handle;
+ }
+
return (AE_OK);
}
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index c2f4d61bc798..23d1a140b0b3 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -84,7 +84,8 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] =
{NULL, NULL, "C Include: ", "C Header Output"},
{NULL, NULL, "Offset Table: ", "C Offset Table Output"},
{NULL, NULL, "Device Map: ", "Device Map Output"},
- {NULL, NULL, "Cross Ref: ", "Cross-reference Output"}
+ {NULL, NULL, "Cross Ref: ", "Cross-reference Output"},
+ {NULL, NULL, "Converter db :", "Converter debug Output"}
};
#else
@@ -113,7 +114,7 @@ extern int AslCompilerdebug;
#define ASL_DEFAULT_LINE_BUFFER_SIZE (1024 * 32) /* 32K */
-#define ASL_MSG_BUFFER_SIZE 4096
+#define ASL_MSG_BUFFER_SIZE (1024 * 32) /* 32k */
#define ASL_MAX_DISABLED_MESSAGES 32
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 8
@@ -182,6 +183,9 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternals, TRUE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternalsInPlace, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoAslConversion, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_OptimizeTrivialParseNodes, TRUE);
#define HEX_OUTPUT_NONE 0
@@ -265,6 +269,20 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID");
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_PruneDepth, 0);
ASL_EXTERN UINT16 ASL_INIT_GLOBAL (Gbl_PruneType, 0);
+ASL_EXTERN ASL_FILE_NODE ASL_INIT_GLOBAL (*Gbl_IncludeFileStack, NULL);
+
+/* Specific to the -q option */
+
+ASL_EXTERN ASL_COMMENT_STATE Gbl_CommentState;
+
+
+/*
+ * Determines if an inline comment should be saved in the InlineComment or NodeEndComment
+ * field of ACPI_PARSE_OBJECT.
+ */
+ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*Gbl_Comment_List_Head, NULL);
+ASL_EXTERN ACPI_COMMENT_NODE ASL_INIT_GLOBAL (*Gbl_Comment_List_Tail, NULL);
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Inline_Comment_Buffer, NULL);
/* Static structures */
diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c
index 0a76162d1685..982aa561964b 100644
--- a/source/compiler/aslhelp.c
+++ b/source/compiler/aslhelp.c
@@ -69,9 +69,10 @@ Usage (
ACPI_USAGE_HEADER ("iasl [Options] [Files]");
printf ("\nGeneral:\n");
- ACPI_OPTION ("-@ <file>", "Specify command file");
- ACPI_OPTION ("-I <dir>", "Specify additional include directory");
- ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
+ ACPI_OPTION ("-@ <file>", "Specify command file");
+ ACPI_OPTION ("-I <dir>", "Specify additional include directory");
+ ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
+ ACPI_OPTION ("-ca <file>", "convert a given ASL file to ASL+ (retains comments)");
ACPI_OPTION ("-v", "Display compiler version");
ACPI_OPTION ("-vd", "Display compiler build date and time");
ACPI_OPTION ("-vo", "Enable optimization comments");
@@ -153,6 +154,7 @@ Usage (
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
printf ("\nDebug Options:\n");
+ ACPI_OPTION ("-bc", "Create converter debug file (*.cdb)");
ACPI_OPTION ("-bf", "Create debug file (full output) (*.txt)");
ACPI_OPTION ("-bs", "Create debug file (parse tree only) (*.txt)");
ACPI_OPTION ("-bp <depth>", "Prune ASL parse tree");
diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c
index 73c53910de6c..3f28ea1d7686 100644
--- a/source/compiler/asllength.c
+++ b/source/compiler/asllength.c
@@ -44,6 +44,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_COMPILER
@@ -136,7 +137,9 @@ LnPackageLengthWalk (
Op->Asl.AmlLength +
Op->Asl.AmlOpcodeLength +
Op->Asl.AmlPkgLenBytes +
- Op->Asl.AmlSubtreeLength);
+ Op->Asl.AmlSubtreeLength +
+ CvCalculateCommentLengths (Op)
+ );
}
return (AE_OK);
}
diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c
index eaa0a7ea3be3..72a0ba9e8e6d 100644
--- a/source/compiler/aslmap.c
+++ b/source/compiler/aslmap.c
@@ -166,7 +166,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* BITSPERBYTE_SEVEN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* BITSPERBYTE_SIX */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0),
-/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0),
+/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAKPOINT_OP, 0, 0, 0),
/* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER),
/* BUSMASTERTYPE_MASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
@@ -176,12 +176,12 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* CLOCKPHASE_SECOND */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* CLOCKPOLARITY_HIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* CLOCKPOLARITY_LOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
-/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA),
-/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER),
-/* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCATENATE_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA),
+/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCATENATE_TEMPLATE_OP,0, 0, ACPI_BTYPE_BUFFER),
+/* CONDREFOF */ OP_TABLE_ENTRY (AML_CONDITIONAL_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* CONNECTION */ OP_TABLE_ENTRY (AML_INT_CONNECTION_OP, 0, 0, 0),
/* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0),
-/* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
+/* COPYOBJECT */ OP_TABLE_ENTRY (AML_COPY_OBJECT_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
/* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0),
/* CREATEBYTEFIELD */ OP_TABLE_ENTRY (AML_CREATE_BYTE_FIELD_OP, 0, 0, 0),
/* CREATEDWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_DWORD_FIELD_OP, 0, 0, 0),
@@ -261,14 +261,14 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* IORESTRICT_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
-/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LNOTEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LAND */ OP_TABLE_ENTRY (AML_LOGICAL_AND_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LEQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_EQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LGREATER */ OP_TABLE_ENTRY (AML_LOGICAL_GREATER_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_GREATER_EQUAL_OP,0, 0, ACPI_BTYPE_INTEGER),
+/* LLESS */ OP_TABLE_ENTRY (AML_LOGICAL_LESS_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_LESS_EQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LNOT */ OP_TABLE_ENTRY (AML_LOGICAL_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_NOT_EQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0),
/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE),
/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
@@ -281,7 +281,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* LOCAL7 */ OP_TABLE_ENTRY (AML_LOCAL7, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
/* LOCKRULE_LOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_ALWAYS, 0, 0),
/* LOCKRULE_NOLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_NEVER, 0, 0),
-/* LOR */ OP_TABLE_ENTRY (AML_LOR_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* LOR */ OP_TABLE_ENTRY (AML_LOGICAL_OR_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* MATCH */ OP_TABLE_ENTRY (AML_MATCH_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* MATCHTYPE_MEQ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MEQ, 0, ACPI_BTYPE_INTEGER),
/* MATCHTYPE_MGE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGE, 0, ACPI_BTYPE_INTEGER),
@@ -347,7 +347,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* PIN_PULLDEFAULT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* PIN_PULLDOWN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* PIN_PULLUP */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
-/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0),
+/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RESOURCE_OP, 0, NODE_AML_PACKAGE, 0),
/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0),
/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER),
/* QWORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
@@ -412,8 +412,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* TIMER */ OP_TABLE_ENTRY (AML_TIMER_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER),
-/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
-/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECIMAL_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
+/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEX_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* TOSTRING */ OP_TABLE_ENTRY (AML_TO_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
/* TOUUID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_INTEGER),
@@ -428,7 +428,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0),
/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0),
/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ZEROS,0, 0),
-/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE),
+/* VARIABLE_PACKAGE */ OP_TABLE_ENTRY (AML_VARIABLE_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE),
/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
diff --git a/source/compiler/asloffset.c b/source/compiler/asloffset.c
index c508f08778d2..3aaab339d33f 100644
--- a/source/compiler/asloffset.c
+++ b/source/compiler/asloffset.c
@@ -185,7 +185,7 @@ LsAmlOffsetWalk (
break;
case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
+ case AML_VARIABLE_PACKAGE_OP:
/* Get the package element count */
diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c
index ce4b2a239fe5..59900a787b4f 100644
--- a/source/compiler/asloperands.c
+++ b/source/compiler/asloperands.c
@@ -321,7 +321,7 @@ OpnDoFieldCommon (
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
- else if (NewBitOffset == CurrentBitOffset)
+ else if ((NewBitOffset == CurrentBitOffset) && Gbl_OptimizeTrivialParseNodes)
{
/*
* Offset is redundant; we don't need to output an
@@ -352,7 +352,8 @@ OpnDoFieldCommon (
CurrentBitOffset += NewBitOffset;
if ((NewBitOffset == 0) &&
- (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES))
+ (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES) &&
+ Gbl_OptimizeTrivialParseNodes)
{
/*
* Unnamed field with a bit length of zero. We can
@@ -1072,7 +1073,7 @@ OpnAttachNameToNode (
case AML_METHOD_OP:
case AML_MUTEX_OP:
case AML_REGION_OP:
- case AML_POWER_RES_OP:
+ case AML_POWER_RESOURCE_OP:
case AML_PROCESSOR_OP:
case AML_THERMAL_ZONE_OP:
case AML_NAME_OP:
diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c
index bc167df8eb99..a982143f9f42 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -68,7 +68,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
+#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|t|T+G^v^w|x:z"
static char ASL_BUILD_DATE[] = __DATE__;
static char ASL_BUILD_TIME[] = __TIME__;
@@ -209,6 +209,24 @@ AslDoOptions (
switch (AcpiGbl_Optarg[0])
{
+
+ case 'c':
+
+ printf ("Debug ASL to ASL+ conversion\n");
+
+ Gbl_DoAslConversion = TRUE;
+ Gbl_FoldConstants = FALSE;
+ Gbl_IntegerOptimizationFlag = FALSE;
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ Gbl_OptimizeTrivialParseNodes = FALSE;
+ Gbl_CaptureComments = TRUE;
+ AcpiGbl_DoDisassemblerOptimizations = FALSE;
+ AcpiGbl_DebugAslConversion = TRUE;
+ AcpiGbl_DmEmitExternalOpcodes = TRUE;
+ Gbl_DoExternalsInPlace = TRUE;
+
+ return (0);
+
case 'f':
AslCompilerdebug = 1; /* same as yydebug */
@@ -260,6 +278,22 @@ AslDoOptions (
switch (AcpiGbl_Optarg[0])
{
+
+ case 'a':
+
+ printf ("Convert ASL to ASL+ with comments\n");
+ Gbl_DoAslConversion = TRUE;
+ Gbl_FoldConstants = FALSE;
+ Gbl_IntegerOptimizationFlag = FALSE;
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ Gbl_OptimizeTrivialParseNodes = FALSE;
+ Gbl_CaptureComments = TRUE;
+ AcpiGbl_DoDisassemblerOptimizations = FALSE;
+ AcpiGbl_DmEmitExternalOpcodes = TRUE;
+ Gbl_DoExternalsInPlace = TRUE;
+
+ return (0);
+
case 'r':
Gbl_NoResourceChecking = TRUE;
@@ -552,6 +586,8 @@ AslDoOptions (
Gbl_FoldConstants = FALSE;
Gbl_IntegerOptimizationFlag = FALSE;
Gbl_ReferenceOptimizationFlag = FALSE;
+ Gbl_OptimizeTrivialParseNodes = FALSE;
+
break;
case 'c':
@@ -570,15 +606,21 @@ AslDoOptions (
case 'e':
- /* iASL: Disable External opcode generation */
-
- Gbl_DoExternals = FALSE;
-
/* Disassembler: Emit embedded external operators */
AcpiGbl_DmEmitExternalOpcodes = TRUE;
break;
+ case 'E':
+
+ /*
+ * iASL: keep External opcodes in place.
+ * No affect if Gbl_DoExternals is false.
+ */
+
+ Gbl_DoExternalsInPlace = TRUE;
+ break;
+
case 'f':
/* Disable folding on "normal" expressions */
@@ -643,6 +685,17 @@ AslDoOptions (
Gbl_UseDefaultAmlFilename = FALSE;
break;
+ case 'q': /* ASL/ASl+ converter: compile only and leave badaml. */
+
+ printf ("Convert ASL to ASL+ with comments\n");
+ Gbl_FoldConstants = FALSE;
+ Gbl_IntegerOptimizationFlag = FALSE;
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ Gbl_OptimizeTrivialParseNodes = FALSE;
+ Gbl_CaptureComments = TRUE;
+ Gbl_DoExternalsInPlace = TRUE;
+ return (0);
+
case 'r': /* Override revision found in table header */
Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
diff --git a/source/compiler/aslprimaries.y b/source/compiler/aslprimaries.y
index eca3dfd71be0..b2c6ca4354bf 100644
--- a/source/compiler/aslprimaries.y
+++ b/source/compiler/aslprimaries.y
@@ -2,6 +2,8 @@ NoEcho('
/******************************************************************************
*
* Module Name: aslprimaries.y - Rules for primary ASL operators
+ * - Keep this file synched with the
+ * CvParseOpBlockType function in cvcompiler.c
*
*****************************************************************************/
@@ -146,9 +148,9 @@ BreakPointTerm
;
BufferTerm
- : PARSEOP_BUFFER {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);}
+ : PARSEOP_BUFFER {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER); COMMENT_CAPTURE_OFF; }
OptionalDataCount
- '{' BufferTermData '}' {$$ = TrLinkChildren ($<n>2,2,$3,$5);}
+ '{' BufferTermData '}' {$$ = TrLinkChildren ($<n>2,2,$3,$5); COMMENT_CAPTURE_ON;}
;
BufferTermData
@@ -403,8 +405,9 @@ ElseIfTerm
ElseTerm
: {$$ = NULL;}
- | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
- TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
+ | PARSEOP_ELSE '{'
+ TermList {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
+ '}' {$$ = TrLinkChildren ($<n>4,1,$3);}
| PARSEOP_ELSE '{'
error '}' {$$ = AslDoError(); yyclearin;}
@@ -545,16 +548,16 @@ FromBCDTerm
FunctionTerm
: PARSEOP_FUNCTION
- PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ PARSEOP_OPEN_PAREN {COMMENT_CAPTURE_OFF; $<n>$ = TrCreateLeafNode (PARSEOP_METHOD); }
NameString
OptionalParameterTypePackage
OptionalParameterTypesPackage
- PARSEOP_CLOSE_PAREN '{'
+ PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON; }
TermList '}' {$$ = TrLinkChildren ($<n>3,7,
TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
- TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);}
+ TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$10);}
| PARSEOP_FUNCTION
PARSEOP_OPEN_PAREN
error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;}
@@ -778,17 +781,17 @@ MatchTerm
MethodTerm
: PARSEOP_METHOD
- PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
+ PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD); COMMENT_CAPTURE_OFF;}
NameString
OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);}
OptionalSerializeRuleKeyword
OptionalByteConstExpr
OptionalParameterTypePackage
OptionalParameterTypesPackage
- PARSEOP_CLOSE_PAREN '{'
+ PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON;}
TermList '}' {$$ = TrLinkChildren ($<n>3,7,
TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
- $5,$7,$8,$9,$10,$13);}
+ $5,$7,$8,$9,$10,$14);}
| PARSEOP_METHOD
PARSEOP_OPEN_PAREN
error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;}
diff --git a/source/compiler/aslprintf.c b/source/compiler/aslprintf.c
index 854e958f2df2..55b40ff55331 100644
--- a/source/compiler/aslprintf.c
+++ b/source/compiler/aslprintf.c
@@ -354,7 +354,7 @@ OpcCreateConcatenateNode (
}
NewConcatOp = TrAllocateNode (PARSEOP_CONCATENATE);
- NewConcatOp->Asl.AmlOpcode = AML_CONCAT_OP;
+ NewConcatOp->Asl.AmlOpcode = AML_CONCATENATE_OP;
NewConcatOp->Asl.AcpiBtype = 0x7;
NewConcatOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
diff --git a/source/compiler/aslresources.y b/source/compiler/aslresources.y
index 3425bc0cb617..928319223db5 100644
--- a/source/compiler/aslresources.y
+++ b/source/compiler/aslresources.y
@@ -2,6 +2,8 @@ NoEcho('
/******************************************************************************
*
* Module Name: aslresources.y - Bison/Yacc production rules for resources
+ * - Keep this file synched with the
+ * CvParseOpBlockType function in cvcompiler.c
*
*****************************************************************************/
@@ -56,14 +58,15 @@ NoEcho('
* Also, insert the EndTag at the end of the template.
*/
ResourceTemplateTerm
- : PARSEOP_RESOURCETEMPLATE
+ : PARSEOP_RESOURCETEMPLATE {COMMENT_CAPTURE_OFF;}
OptionalParentheses
'{'
ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4,
TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
- $4,
- TrCreateLeafNode (PARSEOP_ENDTAG));}
+ $5,
+ TrCreateLeafNode (PARSEOP_ENDTAG));
+ COMMENT_CAPTURE_ON;}
;
OptionalParentheses
diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y
index 6ef61e2673ee..fa6dbf830609 100644
--- a/source/compiler/aslrules.y
+++ b/source/compiler/aslrules.y
@@ -2,6 +2,8 @@ NoEcho('
/******************************************************************************
*
* Module Name: aslrules.y - Main Bison/Yacc production rules
+ * - Keep this file synched with the
+ * CvParseOpBlockType function in cvcompiler.c
*
*****************************************************************************/
@@ -82,14 +84,14 @@ AslCode
*/
DefinitionBlockTerm
: PARSEOP_DEFINITION_BLOCK
- PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITION_BLOCK);}
+ PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITION_BLOCK); COMMENT_CAPTURE_OFF;}
String ','
String ','
ByteConst ','
String ','
String ','
DWordConst
- PARSEOP_CLOSE_PAREN {TrSetEndLineNumber ($<n>3);}
+ PARSEOP_CLOSE_PAREN {TrSetEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;}
'{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,
$4,$6,$8,$10,$12,$14,$18);}
;
@@ -177,9 +179,9 @@ TermArg
MethodInvocationTerm
: NameString
- PARSEOP_OPEN_PAREN {TrUpdateNode (PARSEOP_METHODCALL, $1);}
+ PARSEOP_OPEN_PAREN {TrUpdateNode (PARSEOP_METHODCALL, $1); COMMENT_CAPTURE_OFF;}
ArgList
- PARSEOP_CLOSE_PAREN {$$ = TrLinkChildNode ($1,$4);}
+ PARSEOP_CLOSE_PAREN {$$ = TrLinkChildNode ($1,$4); COMMENT_CAPTURE_ON;}
;
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 99c57c513b66..ff0f2e5eea9f 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -45,6 +45,7 @@
#include "actables.h"
#include "acdisasm.h"
#include "acapps.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstartup")
@@ -123,6 +124,15 @@ AslInitializeGlobals (
Gbl_Files[i].Handle = NULL;
Gbl_Files[i].Filename = NULL;
}
+
+ if (Gbl_CaptureComments)
+ {
+ Gbl_CommentState.SpacesBefore = 0;
+ Gbl_CommentState.CommentType = 1;
+ Gbl_CommentState.Latest_Parse_Node = NULL;
+ Gbl_CommentState.ParsingParenBraceNode = NULL;
+ Gbl_CommentState.CaptureComments = TRUE;
+ }
}
@@ -450,6 +460,28 @@ AslDoOneFile (
AeClearErrorLog ();
PrTerminatePreprocessor ();
+
+ /* ASL-to-ASL+ conversion - Perform immediate disassembly */
+
+ if (Gbl_DoAslConversion)
+ {
+ /*
+ * New input file is the output AML file from above.
+ * New output is from the input ASL file from above.
+ */
+ Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
+ CvDbgPrint ("OUTPUTFILENAME: %s\n", Gbl_OutputFilenamePrefix);
+ Gbl_Files[ASL_FILE_INPUT].Filename =
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Filename;
+
+ fprintf (stderr, "\n");
+ AslDoDisassembly ();
+
+ /* delete the AML file. This AML file should never be utilized by AML interpreters. */
+
+ FlDeleteFile (ASL_FILE_AML_OUTPUT);
+ }
+
return (AE_OK);
/*
diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l
index 01b3e0c0b87d..81d739deae3f 100644
--- a/source/compiler/aslsupport.l
+++ b/source/compiler/aslsupport.l
@@ -52,21 +52,12 @@
#define ASL_HEX_CONSTANT 3
-/* File node - used for "Include" operator file stack */
-
-typedef struct asl_file_node
+void
+yyerror (char const *s)
{
- FILE *File;
- UINT32 CurrentLineNumber;
- YY_BUFFER_STATE State;
- char *Filename;
- struct asl_file_node *Next;
-} ASL_FILE_NODE;
-
-/* File stack for the "Include" operator (NOT #include operator) */
-
-ASL_FILE_NODE *Gbl_IncludeFileStack = NULL;
+ AcpiOsPrintf ("YYERROR: %s\n", s);
+}
/*******************************************************************************
@@ -289,6 +280,10 @@ AslPushInputFileStack (
Gbl_CurrentLineNumber = 1;
yyin = InputFile;
+
+ /* converter: reset the comment state to STANDARD_COMMENT */
+
+ Gbl_CommentState.CommentType = STANDARD_COMMENT;
}
@@ -392,6 +387,11 @@ AslInsertLineBuffer (
AslResetCurrentLineBuffer ();
}
+
+ if (Gbl_CaptureComments)
+ {
+ CvProcessCommentState (SourceChar);
+ }
}
}
@@ -459,16 +459,26 @@ count (
*
******************************************************************************/
-static char
+static BOOLEAN
AslDoComment (
void)
{
- int c;
- int c1 = 0;
+ int c;
+ int c1 = 0;
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
+ ASL_COMMENT_STATE CurrentState = Gbl_CommentState; /* to reference later on */
AslInsertLineBuffer ('/');
AslInsertLineBuffer ('*');
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = '/';
+ ++StringBuffer;
+ *StringBuffer = '*';
+ ++StringBuffer;
+ }
loop:
@@ -477,6 +487,11 @@ loop:
while (((c = input ()) != '*') && (c != EOF))
{
AslInsertLineBuffer (c);
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = c;
+ ++StringBuffer;
+ }
c1 = c;
}
@@ -500,10 +515,15 @@ loop:
/* Comment is closed only if the NEXT character is a slash */
AslInsertLineBuffer (c);
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = c;
+ ++StringBuffer;
+ }
if (((c1 = input ()) != '/') && (c1 != EOF))
{
- unput(c1);
+ unput (c1);
goto loop;
}
@@ -511,8 +531,13 @@ loop:
{
goto EarlyEOF;
}
+ if (StringBuffer > EndBuffer)
+ {
+ goto BufferOverflow;
+ }
AslInsertLineBuffer (c1);
+ CvProcessComment (CurrentState, StringBuffer, c1);
return (TRUE);
@@ -525,6 +550,18 @@ EarlyEOF:
Gbl_CurrentLineOffset, Gbl_CurrentColumn,
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
return (FALSE);
+
+
+BufferOverflow:
+
+ /* Comment was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
+
}
@@ -536,23 +573,40 @@ EarlyEOF:
*
* RETURN: none
*
- * DESCRIPTION: Process a new "//" comment.
+ * DESCRIPTION: Process a new "//" comment. Inline comments will be converted
+ * to "/ *" standard comments.
*
******************************************************************************/
-static char
+static BOOLEAN
AslDoCommentType2 (
void)
{
- int c;
+ int c;
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
+ ASL_COMMENT_STATE CurrentState = Gbl_CommentState;
AslInsertLineBuffer ('/');
- AslInsertLineBuffer ('/');
+ AslInsertLineBuffer ('*');
+
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = '/';
+ ++StringBuffer;
+ *StringBuffer = '*';
+ ++StringBuffer;
+ }
while (((c = input ()) != '\n') && (c != EOF))
{
AslInsertLineBuffer (c);
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = c;
+ ++StringBuffer;
+ }
}
if (c == EOF)
@@ -562,8 +616,26 @@ AslDoCommentType2 (
c = '\n';
}
+ if (StringBuffer > EndBuffer)
+ {
+ goto BufferOverflow;
+ }
AslInsertLineBuffer (c);
+
+ CvProcessCommentType2 (CurrentState, StringBuffer);
return (TRUE);
+
+
+BufferOverflow:
+
+ /* Comment was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
+
}
diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c
index 0d59071cf157..c29c404092e4 100644
--- a/source/compiler/asltree.c
+++ b/source/compiler/asltree.c
@@ -44,6 +44,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "acapps.h"
+#include "acconvert.h"
#include <time.h>
#define _COMPONENT ACPI_COMPILER
@@ -140,6 +141,7 @@ TrAllocateNode (
UINT32 ParseOpcode)
{
ACPI_PARSE_OBJECT *Op;
+ ACPI_PARSE_OBJECT *LatestNode;
Op = TrGetNextNode ();
@@ -152,6 +154,82 @@ TrAllocateNode (
Op->Asl.Column = Gbl_CurrentColumn;
UtSetParseOpName (Op);
+
+ /* The following is for capturing comments */
+
+ if(Gbl_CaptureComments)
+ {
+ LatestNode = Gbl_CommentState.Latest_Parse_Node;
+ Op->Asl.InlineComment = NULL;
+ Op->Asl.EndNodeComment = NULL;
+ Op->Asl.CommentList = NULL;
+ Op->Asl.FileChanged = FALSE;
+
+ /*
+ * Check to see if the file name has changed before resetting the
+ * latest parse node.
+ */
+ if (LatestNode &&
+ (ParseOpcode != PARSEOP_INCLUDE) &&
+ (ParseOpcode != PARSEOP_INCLUDE_END) &&
+ strcmp (LatestNode->Asl.Filename, Op->Asl.Filename))
+ {
+ CvDbgPrint ("latest node: %s\n", LatestNode->Asl.ParseOpName);
+ Op->Asl.FileChanged = TRUE;
+ if (Gbl_IncludeFileStack)
+ {
+ Op->Asl.ParentFilename = Gbl_IncludeFileStack->Filename;
+ }
+ else
+ {
+ Op->Asl.ParentFilename = NULL;
+ }
+ }
+
+ Gbl_CommentState.Latest_Parse_Node = Op;
+ if (Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName)
+ {
+ CvDbgPrint ("trallocatenode=Set latest parse node to this node.\n");
+ CvDbgPrint (" Op->Asl.ParseOpName = %s\n",
+ Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName);
+ CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode);
+
+ if (Op->Asl.FileChanged)
+ {
+ CvDbgPrint(" file has been changed!\n");
+ }
+ }
+
+ /*
+ * if this parse op's syntax uses () and {} (i.e. Package(1){0x00}) then
+ * set a flag in the comment state. This facilitates paring comments for
+ * these types of opcodes.
+ */
+ if ((CvParseOpBlockType(Op) == (BLOCK_PAREN | BLOCK_BRACE)) &&
+ (ParseOpcode != PARSEOP_DEFINITION_BLOCK))
+ {
+ CvDbgPrint ("Parsing paren/Brace node now!\n");
+ Gbl_CommentState.ParsingParenBraceNode = Op;
+ }
+
+ if (Gbl_Comment_List_Head)
+ {
+ CvDbgPrint ("Transferring...\n");
+ Op->Asl.CommentList = Gbl_Comment_List_Head;
+ Gbl_Comment_List_Head = NULL;
+ Gbl_Comment_List_Tail = NULL;
+ CvDbgPrint (" Transferred current comment list to this node.\n");
+ CvDbgPrint (" %s\n", Op->Asl.CommentList->Comment);
+ }
+ if (Gbl_Inline_Comment_Buffer)
+ {
+ Op->Asl.InlineComment = Gbl_Inline_Comment_Buffer;
+ Gbl_Inline_Comment_Buffer = NULL;
+ CvDbgPrint ("Transferred current inline comment list to this node.\n");
+ }
+
+ }
+
return (Op);
}
@@ -294,6 +372,13 @@ TrUpdateNode (
break;
}
+ /* Converter: if this is a method invocation, turn off capture comments. */
+ if (Gbl_CaptureComments &&
+ (ParseOpcode == PARSEOP_METHODCALL))
+ {
+ Gbl_CommentState.CaptureComments = FALSE;
+ }
+
return (Op);
}
@@ -1060,6 +1145,39 @@ TrCreateNode (
{
FirstChild = FALSE;
Op->Asl.Child = Child;
+
+ /*
+ * For the ASL-/ASL+ converter: if the ParseOp is a connection,
+ * external, offset or accessAs, it means that the comments in the
+ * FirstChild belongs to their parent due to the parsing order in
+ * the .y files. To correct this, take the comments in the
+ * FirstChild place it in the parent. This also means that
+ * legitimate comments for the child gets put to the parent.
+ */
+ if (Gbl_CaptureComments &&
+ ((ParseOpcode == PARSEOP_CONNECTION) ||
+ (ParseOpcode == PARSEOP_EXTERNAL) ||
+ (ParseOpcode == PARSEOP_OFFSET) ||
+ (ParseOpcode == PARSEOP_ACCESSAS)))
+ {
+ Op->Asl.CommentList = Child->Asl.CommentList;
+ Op->Asl.EndBlkComment = Child->Asl.EndBlkComment;
+ Op->Asl.InlineComment = Child->Asl.InlineComment;
+ Op->Asl.FileChanged = Child->Asl.FileChanged;
+
+ Child->Asl.CommentList = NULL;
+ Child->Asl.EndBlkComment = NULL;
+ Child->Asl.InlineComment = NULL;
+ Child->Asl.FileChanged = FALSE;
+
+ /*
+ * These do not need to be "passed off". They can be copied
+ * because the code for these opcodes should be printed in the
+ * same file.
+ */
+ Op->Asl.Filename = Child->Asl.Filename;
+ Op->Asl.ParentFilename = Child->Asl.ParentFilename;
+ }
}
/* Point all children to parent */
@@ -1073,6 +1191,18 @@ TrCreateNode (
PrevChild->Asl.Next = Child;
};
+ /* Get the comment from last child in the resource template call */
+
+ if (Gbl_CaptureComments &&
+ (Op->Asl.ParseOpcode == PARSEOP_RESOURCETEMPLATE))
+ {
+ CvDbgPrint ("Transferred current comment list to this node.\n");
+ Op->Asl.CommentList = Child->Asl.CommentList;
+ Child->Asl.CommentList = NULL;
+ Op->Asl.InlineComment = Child->Asl.InlineComment;
+ Child->Asl.InlineComment = NULL;
+ }
+
/*
* This child might be a list, point all nodes in the list
* to the same parent
@@ -1097,9 +1227,9 @@ TrCreateNode (
* FUNCTION: TrLinkChildren
*
* PARAMETERS: Op - An existing parse node
- * NumChildren - Number of children to follow
- * ... - A list of child nodes to link to the new
- * node. NumChildren long.
+ * NumChildren - Number of children to follow
+ * ... - A list of child nodes to link to the new
+ * node. NumChildren long.
*
* RETURN: The updated (linked) node
*
@@ -1161,6 +1291,25 @@ TrLinkChildren (
break;
}
+ /* The following is for capturing comments */
+
+ if(Gbl_CaptureComments)
+ {
+ /*
+ * If there are "regular comments" detected at this point,
+ * then is an endBlk comment. Categorize it as so and distribute
+ * all regular comments to this parse node.
+ */
+ if (Gbl_Comment_List_Head)
+ {
+ Op->Asl.EndBlkComment = Gbl_Comment_List_Head;
+ CvDbgPrint ("EndBlk Comment for %s: %s",
+ Op->Asl.ParseOpName, Gbl_Comment_List_Head->Comment);
+ Gbl_Comment_List_Head = NULL;
+ Gbl_Comment_List_Tail = NULL;
+ }
+ }
+
/* Link the new node to it's children */
PrevChild = NULL;
@@ -1224,6 +1373,13 @@ TrLinkChildren (
va_end(ap);
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
+
+
+ if(Gbl_CaptureComments)
+ {
+ Gbl_CommentState.Latest_Parse_Node = Op;
+ CvDbgPrint ("trlinkchildren=====Set latest parse node to this node.\n");
+ }
return (Op);
}
@@ -1391,6 +1547,19 @@ TrLinkChildNode (
Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL,
Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL);
+ /*
+ * Converter: if TrLinkChildNode is called to link a method call,
+ * turn on capture comments as it signifies that we are done parsing
+ * a method call.
+ */
+ if (Gbl_CaptureComments)
+ {
+ if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ Gbl_CommentState.CaptureComments = TRUE;
+ }
+ Gbl_CommentState.Latest_Parse_Node = Op1;
+ }
if (!Op1 || !Op2)
{
return (Op1);
diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h
index bd8376760ca0..e39355ac156a 100644
--- a/source/compiler/asltypes.h
+++ b/source/compiler/asltypes.h
@@ -153,6 +153,10 @@ typedef struct asl_file_status
* Corresponding filename suffixes are in comments
*
* NOTE: Don't move the first 4 file types
+ *
+ * .xxx file extension: this is used as a temporary .aml file for
+ * the ASL/ASL+ converter and is deleted after conversion. This file
+ * should never be used in the interpreter.
*/
typedef enum
{
@@ -173,12 +177,14 @@ typedef enum
ASL_FILE_C_INCLUDE_OUTPUT, /* .h */
ASL_FILE_C_OFFSET_OUTPUT, /* .offset.h */
ASL_FILE_MAP_OUTPUT, /* .map */
- ASL_FILE_XREF_OUTPUT /* .xrf */
+ ASL_FILE_XREF_OUTPUT, /* .xrf */
+ ASL_FILE_CONV_DEBUG_OUTPUT, /* .cdb */
+ ASL_FILE_CONV_OUTPUT /* .xxx */
} ASL_FILE_TYPES;
-#define ASL_MAX_FILE_TYPE 17
+#define ASL_MAX_FILE_TYPE 18
#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1)
/* Name suffixes used to create filenames for output files */
@@ -199,6 +205,8 @@ typedef enum
#define FILE_SUFFIX_C_OFFSET "offset.h"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_XREF "xrf"
+#define FILE_SUFFIX_CONVERT_AML "xxx"
+#define FILE_SUFFIX_CONVERT_DEBUG "cdb"
/* Cache block structure for ParseOps and Strings */
@@ -336,4 +344,15 @@ typedef struct asl_xref_info
} ASL_XREF_INFO;
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+typedef struct asl_file_node
+{
+ FILE *File;
+ UINT32 CurrentLineNumber;
+ YY_BUFFER_STATE State;
+ char *Filename;
+ struct asl_file_node *Next;
+
+} ASL_FILE_NODE;
+
#endif /* __ASLTYPES_H */
diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c
index c32041ceaa4c..bb83d167828d 100644
--- a/source/compiler/aslwalks.c
+++ b/source/compiler/aslwalks.c
@@ -317,7 +317,7 @@ AnOperandTypecheckWalkEnd (
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
+ case AML_VARIABLE_PACKAGE_OP:
/* If length is a constant, we are done */
diff --git a/source/compiler/cvcompiler.c b/source/compiler/cvcompiler.c
new file mode 100644
index 000000000000..07fecc37872c
--- /dev/null
+++ b/source/compiler/cvcompiler.c
@@ -0,0 +1,890 @@
+/******************************************************************************
+ *
+ * Module Name: cvcompiler - ASL-/ASL+ converter functions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+#include "acapps.h"
+#include "acconvert.h"
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvProcessComment
+ *
+ * PARAMETERS: CurrentState Current comment parse state
+ * StringBuffer Buffer containing the comment being processed
+ * c1 Current input
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a single line comment of a c Style comment. This
+ * function captures a line of a c style comment in a char* and
+ * places the comment in the approperiate global buffer.
+ *
+ ******************************************************************************/
+
+void
+CvProcessComment (
+ ASL_COMMENT_STATE CurrentState,
+ char *StringBuffer,
+ int c1)
+{
+ UINT64 i;
+ char *LineToken;
+ char *FinalLineToken;
+ BOOLEAN CharStart;
+ char *CommentString;
+ char *FinalCommentString;
+
+
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = (char) c1;
+ ++StringBuffer;
+ *StringBuffer = 0;
+ CvDbgPrint ("Multi-line comment\n");
+ CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
+ strcpy (CommentString, MsgBuffer);
+
+ CvDbgPrint ("CommentString: %s\n", CommentString);
+
+ /*
+ * Determine whether if this comment spans multiple lines.
+ * If so, break apart the comment by line so that it can be
+ * properly indented.
+ */
+ if (strchr (CommentString, '\n') != NULL)
+ {
+ /*
+ * Get the first token. The for loop pads subsequent lines
+ * for comments similar to the style of this comment.
+ */
+ LineToken = strtok (CommentString, "\n");
+ FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
+ strcpy (FinalLineToken, LineToken);
+
+ /* Get rid of any carriage returns */
+
+ if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D)
+ {
+ FinalLineToken[strlen(FinalLineToken)-1] = 0;
+ }
+ CvAddToCommentList (FinalLineToken);
+ LineToken = strtok (NULL, "\n");
+ while (LineToken != NULL)
+ {
+ /*
+ * It is assumed that each line has some sort of indentation.
+ * This means that we need to find the first character that is not
+ * a white space within each line.
+ */
+ CharStart = FALSE;
+ for (i = 0; (i < (strlen (LineToken) + 1)) && !CharStart; i++)
+ {
+ if (LineToken[i] != ' ' && LineToken[i] != '\t')
+ {
+ CharStart = TRUE;
+ LineToken += i-1;
+ LineToken [0] = ' '; /* Pad for Formatting */
+ }
+ }
+ FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
+ strcat (FinalLineToken, LineToken);
+
+ /* Get rid of any carriage returns */
+
+ if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D)
+ {
+ FinalLineToken[strlen(FinalLineToken) - 1] = 0;
+ }
+ CvAddToCommentList (FinalLineToken);
+ LineToken = strtok (NULL,"\n");
+ }
+ }
+
+ /*
+ * If this only spans a single line, check to see whether if this comment
+ * appears on the same line as a line of code. If does, retain it's
+ * position for stylistic reasons. If it doesn't, add it to the comment
+ * List so that it can be associated with the next node that's created.
+ */
+ else
+ {
+ /*
+ * if this is not a regular comment, pad with extra spaces that appeared
+ * in the original source input to retain the original spacing.
+ */
+ FinalCommentString = UtStringCacheCalloc (strlen (CommentString) + CurrentState.SpacesBefore + 1);
+ for (i=0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) &&
+ (i < CurrentState.SpacesBefore); ++i)
+ {
+ FinalCommentString[i] = ' ';
+ }
+ strcat (FinalCommentString, CommentString);
+ CvPlaceComment (CurrentState.CommentType, FinalCommentString);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvProcessCommentType2
+ *
+ * PARAMETERS: CurrentState Current comment parse state
+ * StringBuffer Buffer containing the comment being processed
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Process a single line comment. This function captures a comment
+ * in a char* and places the comment in the approperiate global
+ * buffer through CvPlaceComment
+ *
+ ******************************************************************************/
+
+void
+CvProcessCommentType2 (
+ ASL_COMMENT_STATE CurrentState,
+ char *StringBuffer)
+{
+ UINT32 i;
+ char *CommentString;
+ char *FinalCommentString;
+
+
+ if (Gbl_CaptureComments && CurrentState.CaptureComments)
+ {
+ *StringBuffer = 0; /* null terminate */
+ CvDbgPrint ("Single-line comment\n");
+ CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
+ strcpy (CommentString, MsgBuffer);
+
+ /* If this comment lies on the same line as the latest parse node,
+ * assign it to that node's CommentAfter field. Saving in this field
+ * will allow us to support comments that come after code on the same
+ * line as the code itself. For example,
+ * Name(A,"") //comment
+ *
+ * will be retained rather than transformed into
+ *
+ * Name(A,"")
+ * //comment
+ *
+ * For this case, we only need to add one comment since
+ *
+ * Name(A,"") //comment1 //comment2 ... more comments here.
+ *
+ * would be lexically analyzed as a single comment.
+ *
+ * Create a new string with the approperiate spaces. Since we need
+ * to account for the proper spacing, the actual comment,
+ * extra 2 spaces so that this comment can be converted to the "/ *"
+ * style and the null terminator, the string would look something like
+ *
+ * [ (spaces) (comment) ( * /) ('\0') ]
+ *
+ */
+ FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + strlen (CommentString) + 3 + 1);
+ for (i=0; (CurrentState.CommentType!=1) && (i<CurrentState.SpacesBefore); ++i)
+ {
+ FinalCommentString[i] = ' ';
+ }
+ strcat (FinalCommentString, CommentString);
+
+ /* convert to a "/ *" style comment */
+
+ strcat (FinalCommentString, " */");
+ FinalCommentString [CurrentState.SpacesBefore + strlen (CommentString) + 3] = 0;
+
+ /* get rid of the carriage return */
+
+ if (FinalCommentString[strlen (FinalCommentString) - 1] == 0x0D)
+ {
+ FinalCommentString[strlen(FinalCommentString)-1] = 0;
+ }
+ CvPlaceComment (CurrentState.CommentType, FinalCommentString);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgCalculateCommentLengths
+ *
+ * PARAMETERS: Op - Calculate all comments of this Op
+ *
+ * RETURN: TotalCommentLength - Length of all comments within this node.
+ *
+ * DESCRIPTION: calculate the length that the each comment takes up within Op.
+ * Comments look like the follwoing: [0xA9 OptionBtye comment 0x00]
+ * therefore, we add 1 + 1 + strlen (comment) + 1 to get the actual
+ * length of this comment.
+ *
+ ******************************************************************************/
+
+UINT32
+CvCalculateCommentLengths(
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 CommentLength = 0;
+ UINT32 TotalCommentLength = 0;
+ ACPI_COMMENT_NODE *Current = NULL;
+
+
+ if (!Gbl_CaptureComments)
+ {
+ return (0);
+ }
+
+ CvDbgPrint ("==Calculating comment lengths for %s\n", Op->Asl.ParseOpName);
+ if (Op->Asl.FileChanged)
+ {
+ TotalCommentLength += strlen (Op->Asl.Filename) + 3;
+
+ if (Op->Asl.ParentFilename &&
+ AcpiUtStricmp (Op->Asl.Filename, Op->Asl.ParentFilename))
+ {
+ TotalCommentLength += strlen (Op->Asl.ParentFilename) + 3;
+ }
+ }
+ if (Op->Asl.CommentList)
+ {
+ Current = Op->Asl.CommentList;
+ while (Current)
+ {
+ CommentLength = strlen (Current->Comment)+3;
+ CvDbgPrint ("Length of standard comment: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Current->Comment);
+ TotalCommentLength += CommentLength;
+ Current = Current->Next;
+ }
+ }
+ if (Op->Asl.EndBlkComment)
+ {
+ Current = Op->Asl.EndBlkComment;
+ while (Current)
+ {
+ CommentLength = strlen (Current->Comment)+3;
+ CvDbgPrint ("Length of endblkcomment: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Current->Comment);
+ TotalCommentLength += CommentLength;
+ Current = Current->Next;
+ }
+ }
+ if (Op->Asl.InlineComment)
+ {
+ CommentLength = strlen (Op->Asl.InlineComment)+3;
+ CvDbgPrint ("Length of inline comment: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Op->Asl.InlineComment);
+ TotalCommentLength += CommentLength;
+ }
+ if (Op->Asl.EndNodeComment)
+ {
+ CommentLength = strlen(Op->Asl.EndNodeComment)+3;
+ CvDbgPrint ("Length of end node comment +3: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Op->Asl.EndNodeComment);
+ TotalCommentLength += CommentLength;
+ }
+
+ if (Op->Asl.CloseBraceComment)
+ {
+ CommentLength = strlen (Op->Asl.CloseBraceComment)+3;
+ CvDbgPrint ("Length of close brace comment: %d\n", CommentLength);
+ CvDbgPrint (" Comment string: %s\n\n", Op->Asl.CloseBraceComment);
+ TotalCommentLength += CommentLength;
+ }
+
+ CvDbgPrint("\n\n");
+
+ return TotalCommentLength;
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteAmlDefBlockComment
+ *
+ * PARAMETERS: Op - Current parse op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write all comments for a particular definition block.
+ * For definition blocks, the comments need to come after the
+ * definition block header. The regular comments above the
+ * definition block would be categorized as
+ * STD_DEFBLK_COMMENT and comments after the closing brace
+ * is categorized as END_DEFBLK_COMMENT.
+ *
+ ******************************************************************************/
+
+void
+CgWriteAmlDefBlockComment(
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT8 CommentOption;
+ ACPI_COMMENT_NODE *Current;
+ char *NewFilename;
+ char *Position;
+ char *DirectoryPosition;
+
+
+ if (!Gbl_CaptureComments ||
+ (Op->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK))
+ {
+ return;
+ }
+
+ CvDbgPrint ("Printing comments for a definition block..\n");
+
+ /* first, print the file name comment after changing .asl to .dsl */
+
+ NewFilename = UtStringCacheCalloc (strlen (Op->Asl.Filename));
+ strcpy (NewFilename, Op->Asl.Filename);
+ DirectoryPosition = strrchr (NewFilename, '/');
+ Position = strrchr (NewFilename, '.');
+
+ if (Position && (Position > DirectoryPosition))
+ {
+ /* Tack on the new suffix */
+
+ Position++;
+ *Position = 0;
+ strcat (Position, FILE_SUFFIX_DISASSEMBLY);
+ }
+ else
+ {
+ /* No dot, add one and then the suffix */
+
+ strcat (NewFilename, ".");
+ strcat (NewFilename, FILE_SUFFIX_DISASSEMBLY);
+ }
+
+ CommentOption = FILENAME_COMMENT;
+ CgWriteOneAmlComment(Op, NewFilename, CommentOption);
+
+ Current = Op->Asl.CommentList;
+ CommentOption = STD_DEFBLK_COMMENT;
+ while (Current)
+ {
+ CgWriteOneAmlComment(Op, Current->Comment, CommentOption);
+ CvDbgPrint ("Printing comment: %s\n", Current->Comment);
+ Current = Current->Next;
+ }
+ Op->Asl.CommentList = NULL;
+
+ /* print any Inline comments associated with this node */
+
+ if (Op->Asl.CloseBraceComment)
+ {
+ CommentOption = END_DEFBLK_COMMENT;
+ CgWriteOneAmlComment(Op, Op->Asl.CloseBraceComment, CommentOption);
+ Op->Asl.CloseBraceComment = NULL;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteOneAmlComment
+ *
+ * PARAMETERS: Op - Current parse op
+ * CommentToPrint - Comment that's printed
+ * InputOption - Denotes the comment option.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: write a single comment.
+ *
+ ******************************************************************************/
+
+void
+CgWriteOneAmlComment(
+ ACPI_PARSE_OBJECT *Op,
+ char* CommentToPrint,
+ UINT8 InputOption)
+{
+ UINT8 CommentOption = InputOption;
+ UINT8 CommentOpcode = (UINT8)AML_COMMENT_OP;
+
+ CgLocalWriteAmlData (Op, &CommentOpcode, 1);
+ CgLocalWriteAmlData (Op, &CommentOption, 1);
+
+ /* The strlen (..) + 1 is to include the null terminator */
+
+ CgLocalWriteAmlData (Op, CommentToPrint, strlen (CommentToPrint) + 1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CgWriteAmlComment
+ *
+ * PARAMETERS: Op - Current parse op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: write all comments pertaining to the
+ * current parse op
+ *
+ ******************************************************************************/
+
+void
+CgWriteAmlComment(
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_COMMENT_NODE *Current;
+ UINT8 CommentOption;
+ char *NewFilename;
+ char *ParentFilename;
+
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) ||
+ !Gbl_CaptureComments)
+ {
+ return;
+ }
+
+ /* Print out the filename comment if needed */
+
+ if (Op->Asl.FileChanged)
+ {
+
+ /* first, print the file name comment after changing .asl to .dsl */
+
+ NewFilename =
+ FlGenerateFilename (Op->Asl.Filename, FILE_SUFFIX_DISASSEMBLY);
+ CvDbgPrint ("Writing file comment, \"%s\" for %s\n",
+ NewFilename, Op->Asl.ParseOpName);
+ CgWriteOneAmlComment(Op, NewFilename, FILENAME_COMMENT);
+
+ if (Op->Asl.ParentFilename &&
+ AcpiUtStricmp (Op->Asl.ParentFilename, Op->Asl.Filename))
+ {
+ ParentFilename = FlGenerateFilename (Op->Asl.ParentFilename,
+ FILE_SUFFIX_DISASSEMBLY);
+ CgWriteOneAmlComment(Op, ParentFilename, PARENTFILENAME_COMMENT);
+ }
+
+ /* prevent multiple writes of the same comment */
+
+ Op->Asl.FileChanged = FALSE;
+ }
+
+ /*
+ * Regular comments are stored in a list of comments within an Op.
+ * If there is a such list in this node, print out the comment
+ * as byte code.
+ */
+ Current = Op->Asl.CommentList;
+ if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE)
+ {
+ CommentOption = INCLUDE_COMMENT;
+ }
+ else
+ {
+ CommentOption = STANDARD_COMMENT;
+ }
+
+ while (Current)
+ {
+ CgWriteOneAmlComment(Op, Current->Comment, CommentOption);
+ Current = Current->Next;
+ }
+ Op->Asl.CommentList = NULL;
+
+ Current = Op->Asl.EndBlkComment;
+ CommentOption = ENDBLK_COMMENT;
+ while (Current)
+ {
+ CgWriteOneAmlComment(Op, Current->Comment, CommentOption);
+ Current = Current->Next;
+ }
+ Op->Asl.EndBlkComment = NULL;
+
+ /* print any Inline comments associated with this node */
+
+ if (Op->Asl.InlineComment)
+ {
+ CommentOption = INLINE_COMMENT;
+ CgWriteOneAmlComment(Op, Op->Asl.InlineComment, CommentOption);
+ Op->Asl.InlineComment = NULL;
+ }
+
+ if (Op->Asl.EndNodeComment)
+ {
+ CommentOption = ENDNODE_COMMENT;
+ CgWriteOneAmlComment(Op, Op->Asl.EndNodeComment, CommentOption);
+ Op->Asl.EndNodeComment = NULL;
+ }
+
+ if (Op->Asl.CloseBraceComment)
+ {
+ CommentOption = CLOSE_BRACE_COMMENT;
+ CgWriteOneAmlComment(Op, Op->Asl.CloseBraceComment, CommentOption);
+ Op->Asl.CloseBraceComment = NULL;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCommentNodeCalloc
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: Pointer to the comment node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate a string node buffer.
+ *
+ ******************************************************************************/
+
+ACPI_COMMENT_NODE*
+CvCommentNodeCalloc (
+ void)
+{
+ ACPI_COMMENT_NODE *NewCommentNode;
+
+
+ NewCommentNode =
+ (ACPI_COMMENT_NODE*) UtLocalCalloc (sizeof(ACPI_COMMENT_NODE));
+ NewCommentNode->Next = NULL;
+ return NewCommentNode;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvParseOpBlockType
+ *
+ * PARAMETERS: Op - Object to be examined
+ *
+ * RETURN: BlockType - not a block, parens, braces, or even both.
+ *
+ * DESCRIPTION: Type of block for this ASL parseop (parens or braces)
+ * keep this in sync with aslprimaries.y, aslresources.y and
+ * aslrules.y
+ *
+ ******************************************************************************/
+
+UINT32
+CvParseOpBlockType (
+ ACPI_PARSE_OBJECT *Op)
+{
+ if (!Op)
+ {
+ return (BLOCK_NONE);
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+
+ /* from aslprimaries.y */
+
+ case PARSEOP_VAR_PACKAGE:
+ case PARSEOP_BANKFIELD:
+ case PARSEOP_BUFFER:
+ case PARSEOP_CASE:
+ case PARSEOP_DEVICE:
+ case PARSEOP_FIELD:
+ case PARSEOP_FOR:
+ case PARSEOP_FUNCTION:
+ case PARSEOP_IF:
+ case PARSEOP_ELSEIF:
+ case PARSEOP_INDEXFIELD:
+ case PARSEOP_METHOD:
+ case PARSEOP_POWERRESOURCE:
+ case PARSEOP_PROCESSOR:
+ case PARSEOP_DATABUFFER:
+ case PARSEOP_SCOPE:
+ case PARSEOP_SWITCH:
+ case PARSEOP_THERMALZONE:
+ case PARSEOP_WHILE:
+
+ /* from aslresources.y */
+
+ case PARSEOP_RESOURCETEMPLATE: /* optional parens */
+ case PARSEOP_VENDORLONG:
+ case PARSEOP_VENDORSHORT:
+ case PARSEOP_INTERRUPT:
+ case PARSEOP_IRQNOFLAGS:
+ case PARSEOP_IRQ:
+ case PARSEOP_GPIO_INT:
+ case PARSEOP_GPIO_IO:
+ case PARSEOP_DMA:
+
+ /*from aslrules.y */
+
+ case PARSEOP_DEFINITION_BLOCK:
+ return (BLOCK_PAREN | BLOCK_BRACE);
+
+ default:
+
+ return (BLOCK_NONE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvProcessCommentState
+ *
+ * PARAMETERS: char
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Take the given input. If this character is
+ * defined as a comment table entry, then update the state
+ * accordingly.
+ *
+ ******************************************************************************/
+
+void
+CvProcessCommentState (
+ char input)
+{
+
+ if (input != ' ')
+ {
+ Gbl_CommentState.SpacesBefore = 0;
+ }
+
+ switch (input)
+ {
+ case '\n':
+
+ Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
+ break;
+
+ case ' ':
+
+ /* Keep the CommentType the same */
+
+ Gbl_CommentState.SpacesBefore++;
+ break;
+
+ case '(':
+
+ Gbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN;
+ break;
+
+ case ')':
+
+ Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN;
+ break;
+
+ case '{':
+
+ Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
+ Gbl_CommentState.ParsingParenBraceNode = NULL;
+ CvDbgPrint ("End Parsing paren/Brace node!\n");
+ break;
+
+ case '}':
+
+ Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE;
+ break;
+
+ case ',':
+
+ Gbl_CommentState.CommentType = ASLCOMMENT_INLINE;
+ break;
+
+ default:
+
+ Gbl_CommentState.CommentType = ASLCOMMENT_INLINE;
+ break;
+
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvAddToCommentList
+ *
+ * PARAMETERS: toAdd - Contains the comment to be inserted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add the given char* to a list of comments in the global list
+ * of comments.
+ *
+ ******************************************************************************/
+
+void
+CvAddToCommentList (
+ char* ToAdd)
+{
+ if (Gbl_Comment_List_Head)
+ {
+ Gbl_Comment_List_Tail->Next = CvCommentNodeCalloc ();
+ Gbl_Comment_List_Tail = Gbl_Comment_List_Tail->Next;
+ }
+ else
+ {
+ Gbl_Comment_List_Head = CvCommentNodeCalloc ();
+ Gbl_Comment_List_Tail = Gbl_Comment_List_Head;
+ }
+
+ Gbl_Comment_List_Tail->Comment = ToAdd;
+
+ return;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvAppendInlineComment
+ *
+ * PARAMETERS: InlineComment - Append to the end of this string.
+ * toAdd - Contains the comment to be inserted
+ *
+ * RETURN: Str - toAdd appended to InlineComment
+ *
+ * DESCRIPTION: Concatenate ToAdd to InlineComment
+ *
+ ******************************************************************************/
+
+char*
+CvAppendInlineComment (
+ char *InlineComment,
+ char *ToAdd)
+{
+ char* Str;
+ UINT32 Size = 0;
+
+
+ if (!InlineComment)
+ {
+ return ToAdd;
+ }
+ if (ToAdd)
+ {
+ Size = strlen (ToAdd);
+ }
+ Size += strlen (InlineComment);
+ Str = UtStringCacheCalloc (Size+1);
+ strcpy (Str, InlineComment);
+ strcat (Str, ToAdd);
+ Str[Size+1] = 0;
+
+ return Str;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvPlaceComment
+ *
+ * PARAMETERS: Int - Type
+ * char* - CommentString
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Given type and CommentString, this function places the
+ * CommentString in the approperiate global comment list or char*
+ *
+ ******************************************************************************/
+
+void
+CvPlaceComment(
+ UINT8 Type,
+ char *CommentString)
+{
+ ACPI_PARSE_OBJECT *LatestParseNode;
+ ACPI_PARSE_OBJECT *ParenBraceNode;
+
+
+ LatestParseNode = Gbl_CommentState.Latest_Parse_Node;
+ ParenBraceNode = Gbl_CommentState.ParsingParenBraceNode;
+ CvDbgPrint ("Placing comment %s for type %d\n", CommentString, Type);
+
+ switch (Type)
+ {
+ case ASL_COMMENT_STANDARD:
+
+ CvAddToCommentList (CommentString);
+ break;
+
+ case ASLCOMMENT_INLINE:
+
+ LatestParseNode->Asl.InlineComment =
+ CvAppendInlineComment (LatestParseNode->Asl.InlineComment,
+ CommentString);
+ break;
+
+ case ASL_COMMENT_OPEN_PAREN:
+
+ Gbl_Inline_Comment_Buffer =
+ CvAppendInlineComment(Gbl_Inline_Comment_Buffer,
+ CommentString);
+ break;
+
+ case ASL_COMMENT_CLOSE_PAREN:
+
+ if (ParenBraceNode)
+ {
+ ParenBraceNode->Asl.EndNodeComment =
+ CvAppendInlineComment (ParenBraceNode->Asl.EndNodeComment,
+ CommentString);
+ }
+ else
+ {
+ LatestParseNode->Asl.EndNodeComment =
+ CvAppendInlineComment (LatestParseNode->Asl.EndNodeComment,
+ CommentString);
+ }
+ break;
+
+ case ASL_COMMENT_CLOSE_BRACE:
+
+ LatestParseNode->Asl.CloseBraceComment = CommentString;
+ break;
+
+ default:
+
+ break;
+
+ }
+}
diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c
new file mode 100644
index 000000000000..e688e85ffedc
--- /dev/null
+++ b/source/compiler/cvdisasm.c
@@ -0,0 +1,423 @@
+/******************************************************************************
+ *
+ * Module Name: cvcompiler - ASL-/ASL+ converter functions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdebug.h"
+#include "acconvert.h"
+
+
+static void
+CvPrintInclude(
+ ACPI_FILE_NODE *FNode,
+ UINT32 Level);
+
+static BOOLEAN
+CvListIsSingleton (
+ ACPI_COMMENT_NODE *CommentList);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvPrintOneCommentList
+ *
+ * PARAMETERS: CommentList
+ * Level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints all comments within the given list.
+ * This is referred as ASL_CV_PRINT_ONE_COMMENT_LIST.
+ *
+ ******************************************************************************/
+
+void
+CvPrintOneCommentList (
+ ACPI_COMMENT_NODE *CommentList,
+ UINT32 Level)
+{
+ ACPI_COMMENT_NODE *Current = CommentList;
+ ACPI_COMMENT_NODE *Previous;
+
+
+ while (Current)
+ {
+ Previous = Current;
+ if (Current->Comment)
+ {
+ AcpiDmIndent(Level);
+ AcpiOsPrintf("%s\n", Current->Comment);
+ Current->Comment = NULL;
+ }
+ Current = Current->Next;
+ AcpiOsReleaseObject(AcpiGbl_RegCommentCache, Previous);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvListIsSingleton
+ *
+ * PARAMETERS: CommentList -- check to see if this is a single item list.
+ *
+ * RETURN: BOOLEAN
+ *
+ * DESCRIPTION: Returns TRUE if CommentList only contains 1 node.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+CvListIsSingleton (
+ ACPI_COMMENT_NODE *CommentList)
+
+{
+ if (!CommentList)
+ {
+ return FALSE;
+ }
+ else if (CommentList->Next)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvPrintOneCommentType
+ *
+ * PARAMETERS: Op
+ * CommentType
+ * EndStr - String to print after printing the comment
+ * Level - indentation level for comment lists.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Prints all comments of CommentType within the given Op and
+ * clears the printed comment from the Op.
+ * This is referred as ASL_CV_PRINT_ONE_COMMENT.
+ *
+ ******************************************************************************/
+
+void
+CvPrintOneCommentType (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 CommentType,
+ char* EndStr,
+ UINT32 Level)
+{
+ BOOLEAN CommentExists = FALSE;
+ char **CommentToPrint = NULL;
+
+
+ switch (CommentType)
+ {
+ case AML_COMMENT_STANDARD:
+
+ if (CvListIsSingleton (Op->Common.CommentList))
+ {
+ CvPrintOneCommentList (Op->Common.CommentList, Level);
+ AcpiOsPrintf ("\n");
+ }
+ else
+ {
+ CvPrintOneCommentList (Op->Common.CommentList, Level);
+ }
+ Op->Common.CommentList = NULL;
+ return;
+
+ case AML_COMMENT_ENDBLK:
+
+ if (Op->Common.EndBlkComment)
+ {
+ CvPrintOneCommentList (Op->Common.EndBlkComment, Level);
+ Op->Common.EndBlkComment = NULL;
+ AcpiDmIndent(Level);
+ }
+ return;
+
+ case AMLCOMMENT_INLINE:
+
+ CommentToPrint = &Op->Common.InlineComment;
+ break;
+
+ case AML_COMMENT_END_NODE:
+
+ CommentToPrint = &Op->Common.EndNodeComment;
+ break;
+
+ case AML_NAMECOMMENT:
+
+ CommentToPrint = &Op->Common.NameComment;
+ break;
+
+ case AML_COMMENT_CLOSE_BRACE:
+
+ CommentToPrint = &Op->Common.CloseBraceComment;
+ break;
+
+ default:
+ return;
+ }
+
+ if (*CommentToPrint)
+ {
+ AcpiOsPrintf ("%s", *CommentToPrint);
+ *CommentToPrint = NULL;
+ }
+
+ if (CommentExists && EndStr)
+ {
+ AcpiOsPrintf ("%s", EndStr);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCloseBraceWriteComment
+ *
+ * PARAMETERS: Op
+ * Level
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Print a close brace } and any open brace comments associated
+ * with this parse object.
+ * This is referred as ASL_CV_CLOSE_BRACE.
+ *
+ ******************************************************************************/
+
+void
+CvCloseBraceWriteComment(
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level)
+{
+ if (!Gbl_CaptureComments)
+ {
+ AcpiOsPrintf ("}");
+ return;
+ }
+
+ CvPrintOneCommentType (Op, AML_COMMENT_ENDBLK, NULL, Level);
+ AcpiOsPrintf ("}");
+ CvPrintOneCommentType (Op, AML_COMMENT_CLOSE_BRACE, NULL, Level);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCloseParenWriteComment
+ *
+ * PARAMETERS: Op
+ * Level
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Print a closing paren ) and any end node comments associated
+ * with this parse object.
+ * This is referred as ASL_CV_CLOSE_PAREN.
+ *
+ ******************************************************************************/
+
+void
+CvCloseParenWriteComment(
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level)
+{
+ if (!Gbl_CaptureComments)
+ {
+ AcpiOsPrintf (")");
+ return;
+ }
+
+ /*
+ * If this op has a BLOCK_BRACE, then output the comment when the
+ * disassembler calls CvCloseBraceWriteComment
+ */
+ if (AcpiDmBlockType (Op) == BLOCK_PAREN)
+ {
+ CvPrintOneCommentType (Op, AML_COMMENT_ENDBLK, NULL, Level);
+ }
+
+ AcpiOsPrintf (")");
+
+ if (Op->Common.EndNodeComment)
+ {
+ CvPrintOneCommentType (Op, AML_COMMENT_END_NODE, NULL, Level);
+ }
+ else if ((Op->Common.Parent->Common.AmlOpcode == AML_IF_OP) &&
+ Op->Common.Parent->Common.EndNodeComment)
+ {
+ CvPrintOneCommentType (Op->Common.Parent,
+ AML_COMMENT_END_NODE, NULL, Level);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvFileHasSwitched
+ *
+ * PARAMETERS: Op
+ *
+ * RETURN: BOOLEAN
+ *
+ * DESCRIPTION: Determine whether if a file has switched.
+ * TRUE - file has switched.
+ * FALSE - file has not switched.
+ * This is referred as ASL_CV_FILE_HAS_SWITCHED.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+CvFileHasSwitched(
+ ACPI_PARSE_OBJECT *Op)
+{
+ if (Op->Common.CvFilename &&
+ AcpiGbl_CurrentFilename &&
+ AcpiUtStricmp(Op->Common.CvFilename, AcpiGbl_CurrentFilename))
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvPrintInclude
+ *
+ * PARAMETERS: FNode - Write an Include statement for the file that is pointed
+ * by FNode->File.
+ * Level - indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Write the ASL Include statement for FNode->File in the file
+ * indicated by FNode->Parent->File. Note this function emits
+ * actual ASL code rather than comments. This switches the output
+ * file to FNode->Parent->File.
+ *
+ ******************************************************************************/
+
+static void
+CvPrintInclude(
+ ACPI_FILE_NODE *FNode,
+ UINT32 Level)
+{
+ if (!FNode || FNode->IncludeWritten)
+ {
+ return;
+ }
+
+ CvDbgPrint ("Writing include for %s within %s\n", FNode->Filename, FNode->Parent->Filename);
+ AcpiOsRedirectOutput (FNode->Parent->File);
+ CvPrintOneCommentList (FNode->IncludeComment, Level);
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("Include (\"%s\")\n", FNode->Filename);
+ CvDbgPrint ("emitted the following: Include (\"%s\")\n", FNode->Filename);
+ FNode->IncludeWritten = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvSwitchFiles
+ *
+ * PARAMETERS: Level - indentation level
+ * Op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Switch the outputfile and write ASL Include statement. Note,
+ * this function emits actual ASL code rather than comments.
+ * This is referred as ASL_CV_SWITCH_FILES.
+ *
+ ******************************************************************************/
+
+void
+CvSwitchFiles(
+ UINT32 Level,
+ ACPI_PARSE_OBJECT *Op)
+{
+ char *Filename = Op->Common.CvFilename;
+ ACPI_FILE_NODE *FNode;
+
+ CvDbgPrint ("Switching from %s to %s\n", AcpiGbl_CurrentFilename, Filename);
+ FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot);
+ if (!FNode)
+ {
+ /*
+ * At this point, each Filename should exist in AcpiGbl_FileTreeRoot
+ * if it does not exist, then abort.
+ */
+ FlDeleteFile (ASL_FILE_AML_OUTPUT);
+ sprintf (MsgBuffer, "\"Cannot find %s\" - %s", Filename, strerror (errno));
+ AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer);
+ AslAbort ();
+ }
+
+ /*
+ * If the previous file is a descendent of the current file,
+ * make sure that Include statements from the current file
+ * to the previous have been emitted.
+ */
+ while (FNode &&
+ FNode->Parent &&
+ AcpiUtStricmp (FNode->Filename, AcpiGbl_CurrentFilename))
+ {
+ CvPrintInclude (FNode, Level);
+ FNode = FNode->Parent;
+ }
+
+ /* Redirect output to the Op->Common.CvFilename */
+
+ FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot);
+ AcpiOsRedirectOutput (FNode->File);
+ AcpiGbl_CurrentFilename = FNode->Filename;
+}
diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c
new file mode 100644
index 000000000000..5eeccabb665b
--- /dev/null
+++ b/source/compiler/cvparser.c
@@ -0,0 +1,887 @@
+/******************************************************************************
+ *
+ * Module Name: cvparser - Converter functions that are called from the AML
+ * parser.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acinterp.h"
+#include "acdisasm.h"
+#include "acconvert.h"
+
+
+/* local prototypes */
+
+static BOOLEAN
+CvCommentExists (
+ UINT8 *Address);
+
+static BOOLEAN
+CvIsFilename (
+ char *Filename);
+
+static ACPI_FILE_NODE*
+CvFileAddressLookup(
+ char *Address,
+ ACPI_FILE_NODE *Head);
+
+static void
+CvAddToFileTree (
+ char *Filename,
+ char *PreviousFilename);
+
+static void
+CvSetFileParent (
+ char *ChildFile,
+ char *ParentFile);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvIsFilename
+ *
+ * PARAMETERS: filename - input filename
+ *
+ * RETURN: BOOLEAN - TRUE if all characters are between 0x20 and 0x7f
+ *
+ * DESCRIPTION: Take a given char * and see if it contains all printable
+ * characters. If all characters have hexvalues 20-7f and ends with
+ * .dsl, we will assume that it is a proper filename.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+CvIsFilename (
+ char *Filename)
+{
+ UINT64 Length = strlen(Filename);
+ UINT64 i;
+ char *FileExt = Filename + Length - 4;
+
+
+ if ((Length > 4) && AcpiUtStricmp (FileExt, ".dsl"))
+ {
+ return FALSE;
+ }
+
+ for(i = 0; i<Length; ++i)
+ {
+ if (!isprint (Filename[i]))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvInitFileTree
+ *
+ * PARAMETERS: Table - input table
+ * AmlStart - Address of the starting point of the AML.
+ * AmlLength - Length of the AML file.
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Initialize the file dependency tree by scanning the AML.
+ * This is referred as ASL_CV_INIT_FILETREE.
+ *
+ ******************************************************************************/
+
+void
+CvInitFileTree (
+ ACPI_TABLE_HEADER *Table,
+ UINT8 *AmlStart,
+ UINT32 AmlLength)
+{
+ UINT8 *TreeAml;
+ UINT8 *FileEnd;
+ char *Filename = NULL;
+ char *PreviousFilename = NULL;
+ char *ParentFilename = NULL;
+ char *ChildFilename = NULL;
+
+
+ if (!Gbl_CaptureComments)
+ {
+ return;
+ }
+
+ CvDbgPrint ("AmlLength: %x\n", AmlLength);
+ CvDbgPrint ("AmlStart: %p\n", AmlStart);
+ CvDbgPrint ("AmlEnd?: %p\n", AmlStart+AmlLength);
+
+ AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache);
+ AcpiGbl_FileTreeRoot->FileStart = (char *)(AmlStart);
+ AcpiGbl_FileTreeRoot->FileEnd = (char *)(AmlStart + Table->Length);
+ AcpiGbl_FileTreeRoot->Next = NULL;
+ AcpiGbl_FileTreeRoot->Parent = NULL;
+ AcpiGbl_FileTreeRoot->Filename = (char *)(AmlStart+2);
+
+ /* Set the root file to the current open file */
+
+ AcpiGbl_FileTreeRoot->File = AcpiGbl_OutputFile;
+
+ /*
+ * Set this to true because we dont need to output
+ * an include statement for the topmost file
+ */
+ AcpiGbl_FileTreeRoot->IncludeWritten = TRUE;
+ Filename = NULL;
+ AcpiGbl_CurrentFilename = (char *)(AmlStart+2);
+ AcpiGbl_RootFilename = (char *)(AmlStart+2);
+
+ TreeAml = AmlStart;
+ FileEnd = AmlStart + AmlLength;
+
+ while (TreeAml <= FileEnd)
+ {
+ /*
+ * Make sure that this filename contains all printable characters
+ * and a .dsl extension at the end. If not, then it must be some
+ * raw data that doesn't outline a filename.
+ */
+ if ((*TreeAml == AML_COMMENT_OP) &&
+ (*(TreeAml+1) == FILENAME_COMMENT) &&
+ (CvIsFilename ((char *)(TreeAml+2))))
+ {
+ CvDbgPrint ("A9 and a 08 file\n");
+ PreviousFilename = Filename;
+ Filename = (char *) (TreeAml+2);
+ CvAddToFileTree (Filename, PreviousFilename);
+ ChildFilename = Filename;
+ CvDbgPrint ("%s\n", Filename);
+ }
+ else if ((*TreeAml == AML_COMMENT_OP) &&
+ (*(TreeAml+1) == PARENTFILENAME_COMMENT) &&
+ (CvIsFilename ((char *)(TreeAml+2))))
+ {
+ CvDbgPrint ("A9 and a 09 file\n");
+ ParentFilename = (char *)(TreeAml+2);
+ CvSetFileParent (ChildFilename, ParentFilename);
+ CvDbgPrint ("%s\n", ParentFilename);
+ }
+ ++TreeAml;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvClearOpComments
+ *
+ * PARAMETERS: Op -- clear all comments within this Op
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Clear all converter-related fields of the given Op.
+ * This is referred as ASL_CV_CLEAR_OP_COMMENTS.
+ *
+ ******************************************************************************/
+
+void
+CvClearOpComments (
+ ACPI_PARSE_OBJECT *Op)
+{
+ Op->Common.InlineComment = NULL;
+ Op->Common.EndNodeComment = NULL;
+ Op->Common.NameComment = NULL;
+ Op->Common.CommentList = NULL;
+ Op->Common.EndBlkComment = NULL;
+ Op->Common.CloseBraceComment = NULL;
+ Op->Common.CvFilename = NULL;
+ Op->Common.CvParentFilename = NULL;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCommentExists
+ *
+ * PARAMETERS: address - check if this address appears in the list
+ *
+ * RETURN: BOOLEAN - TRUE if the address exists.
+ *
+ * DESCRIPTION: look at the pointer address and check if this appears in the
+ * list of all addresses. If it exitsts in the list, return TRUE
+ * if it exists. Otherwise add to the list and return FALSE.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+CvCommentExists (
+ UINT8 *Address)
+{
+ ACPI_COMMENT_ADDR_NODE *Current = AcpiGbl_CommentAddrListHead;
+ UINT8 Option;
+
+
+ if (!Address)
+ {
+ return (FALSE);
+ }
+ Option = *(Address + 1);
+
+ /*
+ * FILENAME_COMMENT and PARENTFILENAME_COMMENT are not treated as comments.
+ * They serve as markers for where the file starts and ends.
+ */
+ if ((Option == FILENAME_COMMENT) || (Option == PARENTFILENAME_COMMENT))
+ {
+ return (FALSE);
+ }
+
+ if (!Current)
+ {
+ AcpiGbl_CommentAddrListHead =
+ AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ AcpiGbl_CommentAddrListHead->Addr = Address;
+ AcpiGbl_CommentAddrListHead->Next = NULL;
+ return (FALSE);
+ }
+ else
+ {
+ while (Current)
+ {
+ if (Current->Addr != Address)
+ {
+ Current = Current->Next;
+ }
+ else
+ {
+ return (TRUE);
+ }
+ }
+
+ /*
+ * If the execution gets to this point, it means that this address
+ * does not exists in the list. Add this address to the
+ * beginning of the list.
+ */
+ Current = AcpiGbl_CommentAddrListHead;
+ AcpiGbl_CommentAddrListHead =
+ AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ AcpiGbl_CommentAddrListHead->Addr = Address;
+ AcpiGbl_CommentAddrListHead->Next = Current;
+ return (FALSE);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvFilenameExists
+ *
+ * PARAMETERS: Filename - filename to search
+ *
+ * RETURN: ACPI_FILE_NODE - a pointer to a file node
+ *
+ * DESCRIPTION: Look for the given filename in the file dependency tree.
+ * Returns the file node if it exists, returns NULL if it does not.
+ *
+ ******************************************************************************/
+
+ACPI_FILE_NODE*
+CvFilenameExists(
+ char *Filename,
+ ACPI_FILE_NODE *Head)
+{
+ ACPI_FILE_NODE *Current = Head;
+
+
+ while (Current)
+ {
+ if (!AcpiUtStricmp (Current->Filename, Filename))
+ {
+ return (Current);
+ }
+ Current = Current->Next;
+ }
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvFileAddressLookup
+ *
+ * PARAMETERS: Address - address to look up
+ * Head - file dependency tree
+ *
+ * RETURN: ACPI_FLE_NODE - pointer to a file node containing the address
+ *
+ * DESCRIPTION: Look for the given address in the file dependency tree.
+ * Returns the first file node where the given address is within
+ * the file node's starting and ending address.
+ *
+ ******************************************************************************/
+
+static ACPI_FILE_NODE*
+CvFileAddressLookup(
+ char *Address,
+ ACPI_FILE_NODE *Head)
+{
+ ACPI_FILE_NODE *Current = Head;
+
+
+ while (Current)
+ {
+ if ((Address >= Current->FileStart) &&
+ (Address < Current->FileEnd ||
+ !Current->FileEnd))
+ {
+ return (Current);
+ }
+ Current = Current->Next;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvLabelFileNode
+ *
+ * PARAMETERS: Op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Takes a given parse op, looks up its Op->Common.Aml field
+ * within the file tree and fills in approperiate file information
+ * from a matching node within the tree.
+ * This is referred as ASL_CV_LABEL_FILENODE.
+ *
+ ******************************************************************************/
+
+void
+CvLabelFileNode(
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_FILE_NODE *Node;
+
+
+ if (!Op)
+ {
+ return;
+ }
+
+ Node = CvFileAddressLookup ((char *)Op->Common.Aml, AcpiGbl_FileTreeRoot);
+ if (!Node)
+ {
+ return;
+ }
+
+ Op->Common.CvFilename = Node->Filename;
+ if (Node->Parent)
+ {
+ Op->Common.CvParentFilename = Node->Parent->Filename;
+ }
+ else
+ {
+ Op->Common.CvParentFilename = Node->Filename;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvAddToFileTree
+ *
+ * PARAMETERS: Filename - Address containing the name of the current
+ * filename
+ * PreviousFilename - Address containing the name of the previous
+ * filename
+ *
+ * RETURN: void
+ *
+ * DESCRIPTION: Add this filename to the AcpiGbl_FileTree if it does not exist.
+ *
+ ******************************************************************************/
+
+static void
+CvAddToFileTree (
+ char *Filename,
+ char *PreviousFilename)
+{
+ ACPI_FILE_NODE *Node;
+
+
+ if (!AcpiUtStricmp(Filename, AcpiGbl_RootFilename) &&
+ PreviousFilename)
+ {
+ Node = CvFilenameExists (PreviousFilename, AcpiGbl_FileTreeRoot);
+ if (Node)
+ {
+ /*
+ * Set the end point of the PreviousFilename to the address
+ * of Filename.
+ */
+ Node->FileEnd = Filename;
+ }
+ }
+ else if (!AcpiUtStricmp(Filename, AcpiGbl_RootFilename) &&
+ !PreviousFilename)
+ {
+ return;
+ }
+
+ Node = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot);
+ if (Node && PreviousFilename)
+ {
+ /*
+ * Update the end of the previous file and all of their parents' ending
+ * Addresses. This is done to ensure that parent file ranges extend to
+ * the end of their childrens' files.
+ */
+ Node = CvFilenameExists (PreviousFilename, AcpiGbl_FileTreeRoot);
+ if (Node && (Node->FileEnd < Filename))
+ {
+ Node->FileEnd = Filename;
+ Node = Node->Parent;
+ while (Node)
+ {
+ if (Node->FileEnd < Filename)
+ {
+ Node->FileEnd = Filename;
+ }
+ Node = Node->Parent;
+ }
+ }
+ }
+ else
+ {
+ Node = AcpiGbl_FileTreeRoot;
+ AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache);
+ AcpiGbl_FileTreeRoot->Next = Node;
+ AcpiGbl_FileTreeRoot->Parent = NULL;
+ AcpiGbl_FileTreeRoot->Filename = Filename;
+ AcpiGbl_FileTreeRoot->FileStart = Filename;
+ AcpiGbl_FileTreeRoot->IncludeWritten = FALSE;
+ AcpiGbl_FileTreeRoot->File = fopen(Filename, "w+");
+
+ /*
+ * If we can't open the file, we need to abort here before we
+ * accidentally write to a NULL file.
+ */
+ if (!AcpiGbl_FileTreeRoot->File)
+ {
+ /* delete the .xxx file */
+
+ FlDeleteFile (ASL_FILE_AML_OUTPUT);
+ sprintf (MsgBuffer, "\"%s\" - %s", Filename, strerror (errno));
+ AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer);
+ AslAbort ();
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvSetFileParent
+ *
+ * PARAMETERS: ChildFile - contains the filename of the child file
+ * ParentFile - contains the filename of the parent file.
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: point the parent pointer of the Child to the node that
+ * corresponds with the parent file node.
+ *
+ ******************************************************************************/
+
+static void
+CvSetFileParent (
+ char *ChildFile,
+ char *ParentFile)
+{
+ ACPI_FILE_NODE *Child;
+ ACPI_FILE_NODE *Parent;
+
+
+ Child = CvFilenameExists (ChildFile, AcpiGbl_FileTreeRoot);
+ Parent = CvFilenameExists (ParentFile, AcpiGbl_FileTreeRoot);
+ if (Child && Parent)
+ {
+ Child->Parent = Parent;
+
+ while (Child->Parent)
+ {
+ if (Child->Parent->FileEnd < Child->FileStart)
+ {
+ Child->Parent->FileEnd = Child->FileStart;
+ }
+ Child = Child->Parent;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCaptureCommentsOnly
+ *
+ * PARAMETERS: ParserState - A parser state object
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: look at the aml that the parser state is pointing to,
+ * capture any AML_COMMENT_OP and it's arguments and increment the
+ * aml pointer past the comment. Comments are transferred to parse
+ * nodes through CvTransferComments() as well as
+ * AcpiPsBuildNamedOp().
+ * This is referred as ASL_CV_CAPTURE_COMMENTS_ONLY.
+ *
+ ******************************************************************************/
+
+void
+CvCaptureCommentsOnly (
+ ACPI_PARSE_STATE *ParserState)
+{
+ UINT8 *Aml = ParserState->Aml;
+ UINT16 Opcode = (UINT16) ACPI_GET8 (Aml);
+ UINT32 Length = 0;
+ UINT8 CommentOption = (UINT16) ACPI_GET8 (Aml+1);
+ BOOLEAN StdDefBlockFlag = FALSE;
+ ACPI_COMMENT_NODE *CommentNode;
+ ACPI_FILE_NODE *FileNode;
+
+
+ if (!Gbl_CaptureComments ||
+ Opcode != AML_COMMENT_OP)
+ {
+ return;
+ }
+
+ while (Opcode == AML_COMMENT_OP)
+ {
+ CvDbgPrint ("comment aml address: %p\n", Aml);
+
+ if (CvCommentExists(ParserState->Aml))
+ {
+ CvDbgPrint ("Avoiding capturing an existing comment.\n");
+ }
+ else
+ {
+ CommentOption = *(Aml+1);
+
+ /* Increment past the comment option and point the approperiate char pointers.*/
+
+ Aml += 2;
+
+ /* found a comment. Now, set pointers to these comments. */
+
+ switch (CommentOption)
+ {
+ case STD_DEFBLK_COMMENT:
+
+ StdDefBlockFlag = TRUE;
+
+ /* add to a linked list of nodes. This list will be taken by the parse node created next. */
+
+ CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
+ CommentNode->Next = NULL;
+
+ if (!AcpiGbl_DefBlkCommentListHead)
+ {
+ AcpiGbl_DefBlkCommentListHead = CommentNode;
+ AcpiGbl_DefBlkCommentListTail = CommentNode;
+ }
+ else
+ {
+ AcpiGbl_DefBlkCommentListTail->Next = CommentNode;
+ AcpiGbl_DefBlkCommentListTail = AcpiGbl_DefBlkCommentListTail->Next;
+ }
+ break;
+
+ case STANDARD_COMMENT:
+
+ CvDbgPrint ("found regular comment.\n");
+
+ /* add to a linked list of nodes. This list will be taken by the parse node created next. */
+
+ CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
+ CommentNode->Next = NULL;
+
+ if (!AcpiGbl_RegCommentListHead)
+ {
+ AcpiGbl_RegCommentListHead = CommentNode;
+ AcpiGbl_RegCommentListTail = CommentNode;
+ }
+ else
+ {
+ AcpiGbl_RegCommentListTail->Next = CommentNode;
+ AcpiGbl_RegCommentListTail = AcpiGbl_RegCommentListTail->Next;
+ }
+ break;
+
+ case ENDBLK_COMMENT:
+
+ CvDbgPrint ("found endblk comment.\n");
+
+ /* add to a linked list of nodes. This will be taken by the next created parse node. */
+
+ CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
+ CommentNode->Next = NULL;
+
+ if (!AcpiGbl_EndBlkCommentListHead)
+ {
+ AcpiGbl_EndBlkCommentListHead = CommentNode;
+ AcpiGbl_EndBlkCommentListTail = CommentNode;
+ }
+ else
+ {
+ AcpiGbl_EndBlkCommentListTail->Next = CommentNode;
+ AcpiGbl_EndBlkCommentListTail = AcpiGbl_EndBlkCommentListTail->Next;
+ }
+ break;
+
+ case INLINE_COMMENT:
+
+ CvDbgPrint ("found inline comment.\n");
+ AcpiGbl_CurrentInlineComment = ACPI_CAST_PTR (char, Aml);
+ break;
+
+ case ENDNODE_COMMENT:
+
+ CvDbgPrint ("found EndNode comment.\n");
+ AcpiGbl_CurrentEndNodeComment = ACPI_CAST_PTR (char, Aml);
+ break;
+
+ case CLOSE_BRACE_COMMENT:
+
+ CvDbgPrint ("found close brace comment.\n");
+ AcpiGbl_CurrentCloseBraceComment = ACPI_CAST_PTR (char, Aml);
+ break;
+
+ case END_DEFBLK_COMMENT:
+
+ CvDbgPrint ("Found comment that belongs after the } for a definition block.\n");
+ AcpiGbl_CurrentScope->Common.CloseBraceComment = ACPI_CAST_PTR (char, Aml);
+ break;
+
+ case FILENAME_COMMENT:
+
+ CvDbgPrint ("Found a filename: %s\n", ACPI_CAST_PTR (char, Aml));
+ FileNode = CvFilenameExists (ACPI_CAST_PTR (char, Aml), AcpiGbl_FileTreeRoot);
+
+ /*
+ * If there is an INCLUDE_COMMENT followed by a
+ * FILENAME_COMMENT, then the INCLUDE_COMMENT is a comment
+ * that is emitted before the #include for the file.
+ * We will save the IncludeComment within the FileNode
+ * associated with this FILENAME_COMMENT.
+ */
+ if (FileNode && AcpiGbl_IncCommentListHead)
+ {
+ FileNode->IncludeComment = AcpiGbl_IncCommentListHead;
+ AcpiGbl_IncCommentListHead = NULL;
+ AcpiGbl_IncCommentListTail = NULL;
+ }
+ break;
+
+ case PARENTFILENAME_COMMENT:
+ CvDbgPrint (" Found a parent filename.\n");
+ break;
+
+ case INCLUDE_COMMENT:
+
+ /*
+ * Add to a linked list. This list will be taken by the
+ * parse node created next. See the FILENAME_COMMENT case
+ * for more details
+ */
+ CommentNode = AcpiOsAcquireObject (AcpiGbl_RegCommentCache);
+ CommentNode->Comment = ACPI_CAST_PTR (char, Aml);
+ CommentNode->Next = NULL;
+
+ if (!AcpiGbl_IncCommentListHead)
+ {
+ AcpiGbl_IncCommentListHead = CommentNode;
+ AcpiGbl_IncCommentListTail = CommentNode;
+ }
+ else
+ {
+ AcpiGbl_IncCommentListTail->Next = CommentNode;
+ AcpiGbl_IncCommentListTail = AcpiGbl_IncCommentListTail->Next;
+ }
+
+ CvDbgPrint ("Found a include comment: %s\n", CommentNode->Comment);
+ break;
+
+ default:
+
+ /* Not a valid comment option. Revert the AML */
+
+ Aml -= 2;
+ goto DefBlock;
+ break;
+
+ } /* end switch statement */
+
+ } /* end else */
+
+ /* determine the length and move forward that amount */
+
+ Length = 0;
+ while (ParserState->Aml[Length])
+ {
+ Length++;
+ }
+
+ ParserState->Aml += Length + 1;
+
+
+ /* Peek at the next Opcode. */
+
+ Aml = ParserState->Aml;
+ Opcode = (UINT16) ACPI_GET8 (Aml);
+
+ }
+
+DefBlock:
+ if (StdDefBlockFlag)
+ {
+ /*
+ * Give all of its comments to the current scope, which is known as
+ * the definition block, since STD_DEFBLK_COMMENT only appears after
+ * definition block headers.
+ */
+ AcpiGbl_CurrentScope->Common.CommentList
+ = AcpiGbl_DefBlkCommentListHead;
+ AcpiGbl_DefBlkCommentListHead = NULL;
+ AcpiGbl_DefBlkCommentListTail = NULL;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvCaptureComments
+ *
+ * PARAMETERS: ParserState - A parser state object
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Wrapper function for CvCaptureCommentsOnly
+ * This is referred as ASL_CV_CAPTURE_COMMENTS.
+ *
+ ******************************************************************************/
+
+void
+CvCaptureComments (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT8 *Aml;
+ UINT16 Opcode;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ if (!Gbl_CaptureComments)
+ {
+ return;
+ }
+
+ /*
+ * Before parsing, check to see that comments that come directly after
+ * deferred opcodes aren't being processed.
+ */
+ Aml = WalkState->ParserState.Aml;
+ Opcode = (UINT16) ACPI_GET8 (Aml);
+ OpInfo = AcpiPsGetOpcodeInfo (Opcode);
+
+ if (!(OpInfo->Flags & AML_DEFER) ||
+ ((OpInfo->Flags & AML_DEFER) &&
+ (WalkState->PassNumber != ACPI_IMODE_LOAD_PASS1)))
+ {
+ CvCaptureCommentsOnly (&WalkState->ParserState);
+ WalkState->Aml = WalkState->ParserState.Aml;
+ }
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CvTransferComments
+ *
+ * PARAMETERS: Op - Transfer comments to this Op
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Transfer all of the commments stored in global containers to the
+ * given Op. This will be invoked shortly after the parser creates
+ * a ParseOp.
+ * This is referred as ASL_CV_TRANSFER_COMMENTS.
+ *
+ ******************************************************************************/
+
+void
+CvTransferComments (
+ ACPI_PARSE_OBJECT *Op)
+{
+ Op->Common.InlineComment = AcpiGbl_CurrentInlineComment;
+ AcpiGbl_CurrentInlineComment = NULL;
+
+ Op->Common.EndNodeComment = AcpiGbl_CurrentEndNodeComment;
+ AcpiGbl_CurrentEndNodeComment = NULL;
+
+ Op->Common.CloseBraceComment = AcpiGbl_CurrentCloseBraceComment;
+ AcpiGbl_CurrentCloseBraceComment = NULL;
+
+ Op->Common.CommentList = AcpiGbl_RegCommentListHead;
+ AcpiGbl_RegCommentListHead = NULL;
+ AcpiGbl_RegCommentListTail = NULL;
+
+ Op->Common.EndBlkComment = AcpiGbl_EndBlkCommentListHead;
+ AcpiGbl_EndBlkCommentListHead = NULL;
+ AcpiGbl_EndBlkCommentListTail = NULL;
+
+}
diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c
index 4de4a584f560..c8fb71b2b03f 100644
--- a/source/compiler/dttable1.c
+++ b/source/compiler/dttable1.c
@@ -1518,6 +1518,10 @@ DtCompileIort (
}
IortNode->MappingCount = IdMappingNumber;
+ if (!IdMappingNumber)
+ {
+ IortNode->MappingOffset = 0;
+ }
/*
* Node length can be determined by DT_LENGTH option
diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h
index 8b05713f5060..e1c705600c31 100644
--- a/source/compiler/dttemplate.h
+++ b/source/compiler/dttemplate.h
@@ -543,47 +543,53 @@ const unsigned char TemplateHpet[] =
const unsigned char TemplateIort[] =
{
- 0x49,0x4F,0x52,0x54,0x48,0x01,0x00,0x00, /* 00000000 "IORTH..." */
- 0x00,0x02,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x49,0x4F,0x52,0x54,0x74,0x01,0x00,0x00, /* 00000000 "IORTt..." */
+ 0x00,0xD2,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" */
- 0x12,0x02,0x16,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */
+ 0x19,0x01,0x17,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */
0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */
- 0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */
- 0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */
- 0x00,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 "........" */
- 0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 ".0......" */
- 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000068 "....0..." */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
- 0x00,0x00,0x00,0x00,0x00,0x5C,0x5F,0x53, /* 00000078 ".....\_S" */
- 0x42,0x2E,0x50,0x43,0x49,0x30,0x2E,0x44, /* 00000080 "B.PCI0.D" */
- 0x45,0x56,0x30,0x00,0x00,0x00,0x00,0x00, /* 00000088 "EV0....." */
- 0x02,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ". ......" */
- 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */
+ 0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x00,0x00,0x01,0x44,0x00,0x00, /* 00000048 ".....D.." */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000050 "........" */
+ 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "0......." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
+ 0x00,0x5C,0x5F,0x53,0x42,0x2E,0x50,0x43, /* 00000068 ".\_SB.PC" */
+ 0x49,0x30,0x2E,0x44,0x45,0x56,0x30,0x00, /* 00000070 "I0.DEV0." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
+ 0x02,0x34,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ".4......" */
+ 0x01,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
- 0x03,0x5C,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 ".\......" */
- 0x00,0x00,0x00,0x00,0x5C,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,0x00,0x00,0x00,0x00, /* 000000D0 "........" */
- 0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D8 "<......." */
- 0x4C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000E0 "L......." */
- 0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "T......." */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
+ 0x00,0x00,0x00,0x00,0x03,0x60,0x00,0x00, /* 000000C0 ".....`.." */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000C8 "........" */
+ 0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "L......." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
+ 0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00, /* 000000E8 "....<..." */
+ 0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F0 "....L..." */
+ 0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F8 "....L..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
- 0x00,0x00,0x00,0x00,0x04,0x3C,0x00,0x00, /* 00000108 ".....<.." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
- 0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "<......." */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
- 0x00,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, /* 00000118 "........" */
+ 0x00,0x00,0x00,0x00,0x04,0x50,0x00,0x00, /* 00000120 ".....P.." */
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000128 "........" */
+ 0x3C,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, /* 00000140 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000168 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000170 "...." */
};
const unsigned char TemplateIvrs[] =