summaryrefslogtreecommitdiff
path: root/source/include
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2017-02-28 20:06:31 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2017-02-28 20:06:31 +0000
commit691d1929c1c1f25857086b168ef9973b2472de41 (patch)
tree04e90e804d87765833c7230981b2cca94e2ebf94 /source/include
parenta0b3a9cf1fc8fe1d9f95e69cdf8914bb6ebcee03 (diff)
Notes
Diffstat (limited to 'source/include')
-rw-r--r--source/include/acconfig.h1
-rw-r--r--source/include/acconvert.h204
-rw-r--r--source/include/acdisasm.h14
-rw-r--r--source/include/acglobal.h44
-rw-r--r--source/include/aclocal.h118
-rw-r--r--source/include/acmacros.h35
-rw-r--r--source/include/acopcode.h2
-rw-r--r--source/include/acpixf.h2
-rw-r--r--source/include/actbl2.h11
-rw-r--r--source/include/amlcode.h104
10 files changed, 459 insertions, 76 deletions
diff --git a/source/include/acconfig.h b/source/include/acconfig.h
index 5e1912ea5fb9..a0e22703a329 100644
--- a/source/include/acconfig.h
+++ b/source/include/acconfig.h
@@ -79,6 +79,7 @@
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
+#define ACPI_MAX_COMMENT_CACHE_DEPTH 96 /* Comments for the -ca option */
/*
* Should the subsystem abort the loading of an ACPI table if the
diff --git a/source/include/acconvert.h b/source/include/acconvert.h
new file mode 100644
index 000000000000..90a141a97b11
--- /dev/null
+++ b/source/include/acconvert.h
@@ -0,0 +1,204 @@
+/******************************************************************************
+ *
+ * Module Name: acapps - common include for ACPI applications/tools
+ *
+ *****************************************************************************/
+
+/*
+ * 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.
+ */
+
+#ifndef _ACCONVERT
+#define _ACCONVERT
+
+/* Definitions for comment state */
+
+#define ASL_COMMENT_STANDARD 1
+#define ASLCOMMENT_INLINE 2
+#define ASL_COMMENT_OPEN_PAREN 3
+#define ASL_COMMENT_CLOSE_PAREN 4
+#define ASL_COMMENT_CLOSE_BRACE 5
+
+/* Definitions for comment print function*/
+
+#define AML_COMMENT_STANDARD 1
+#define AMLCOMMENT_INLINE 2
+#define AML_COMMENT_END_NODE 3
+#define AML_NAMECOMMENT 4
+#define AML_COMMENT_CLOSE_BRACE 5
+#define AML_COMMENT_ENDBLK 6
+#define AML_COMMENT_INCLUDE 7
+
+
+#ifdef ACPI_ASL_COMPILER
+/*
+ * cvcompiler
+ */
+void
+CvProcessComment (
+ ASL_COMMENT_STATE CurrentState,
+ char *StringBuffer,
+ int c1);
+
+void
+CvProcessCommentType2 (
+ ASL_COMMENT_STATE CurrentState,
+ char *StringBuffer);
+
+UINT32
+CvCalculateCommentLengths(
+ ACPI_PARSE_OBJECT *Op);
+
+void
+CvProcessCommentState (
+ char input);
+
+char*
+CvAppendInlineComment (
+ char *InlineComment,
+ char *ToAdd);
+
+void
+CvAddToCommentList (
+ char* ToAdd);
+
+void
+CvPlaceComment (
+ UINT8 Type,
+ char *CommentString);
+
+UINT32
+CvParseOpBlockType (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_COMMENT_NODE*
+CvCommentNodeCalloc (
+ void);
+
+void
+CgWriteAmlDefBlockComment (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+CgWriteOneAmlComment (
+ ACPI_PARSE_OBJECT *Op,
+ char* CommentToPrint,
+ UINT8 InputOption);
+
+void
+CgWriteAmlComment (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * cvparser
+ */
+void
+CvInitFileTree (
+ ACPI_TABLE_HEADER *Table,
+ UINT8 *AmlStart,
+ UINT32 AmlLength);
+
+void
+CvClearOpComments (
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_FILE_NODE*
+CvFilenameExists (
+ char *Filename,
+ ACPI_FILE_NODE *Head);
+
+void
+CvLabelFileNode (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+CvCaptureListComments (
+ ACPI_PARSE_STATE *ParserState,
+ ACPI_COMMENT_NODE *ListHead,
+ ACPI_COMMENT_NODE *ListTail);
+
+void
+CvCaptureCommentsOnly (
+ ACPI_PARSE_STATE *ParserState);
+
+void
+CvCaptureComments (
+ ACPI_WALK_STATE *WalkState);
+
+void
+CvTransferComments (
+ ACPI_PARSE_OBJECT *Op);
+
+/*
+ * cvdisasm
+ */
+void
+CvSwitchFiles (
+ UINT32 level,
+ ACPI_PARSE_OBJECT *op);
+
+BOOLEAN
+CvFileHasSwitched (
+ ACPI_PARSE_OBJECT *Op);
+
+
+void
+CvCloseParenWriteComment (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level);
+
+void
+CvCloseBraceWriteComment (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level);
+
+void
+CvPrintOneCommentList (
+ ACPI_COMMENT_NODE *CommentList,
+ UINT32 Level);
+
+void
+CvPrintOneCommentType (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 CommentType,
+ char* EndStr,
+ UINT32 Level);
+
+
+#endif
+
+#endif /* _ACCONVERT */
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
index 3c5851fcb9c2..b9b03d31ef6a 100644
--- a/source/include/acdisasm.h
+++ b/source/include/acdisasm.h
@@ -803,6 +803,11 @@ AcpiDmEmitExternals (
void);
void
+AcpiDmEmitExternal (
+ ACPI_PARSE_OBJECT *NameOp,
+ ACPI_PARSE_OBJECT *TypeOp);
+
+void
AcpiDmUnresolvedWarning (
UINT8 Type);
@@ -1097,4 +1102,13 @@ ACPI_STATUS
AdDisplayStatistics (
void);
+
+/*
+ * dmwalk
+ */
+UINT32
+AcpiDmBlockType (
+ ACPI_PARSE_OBJECT *Op);
+
+
#endif /* __ACDISASM_H__ */
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index d83825f0fabb..3dfbe423e5b7 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -374,6 +374,50 @@ ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]);
#endif
+/*
+ * Meant for the -ca option.
+ */
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentInlineComment, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentEndNodeComment, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentOpenBraceComment, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentCloseBraceComment, NULL);
+
+ACPI_INIT_GLOBAL (char*, AcpiGbl_RootFilename, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentFilename, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentParentFilename, NULL);
+ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentIncludeFilename, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_FILE_NODE, *AcpiGbl_FileTreeRoot, NULL);
+
+ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_RegCommentCache);
+ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_CommentAddrCache);
+ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_FileCache);
+
+ACPI_INIT_GLOBAL (BOOLEAN, Gbl_CaptureComments, FALSE);
+
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE);
+ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL);
+
+ACPI_GLOBAL (char, AcpiGbl_TableSig[4]);
+
/*****************************************************************************
*
* Application globals
diff --git a/source/include/aclocal.h b/source/include/aclocal.h
index 3b5f779edc2f..77cf580a39be 100644
--- a/source/include/aclocal.h
+++ b/source/include/aclocal.h
@@ -54,7 +54,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE;
/* Total number of aml opcodes defined */
-#define AML_NUM_OPCODES 0x82
+#define AML_NUM_OPCODES 0x83
/* Forward declarations */
@@ -906,21 +906,55 @@ typedef union acpi_parse_value
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif
+#if defined(ACPI_ASL_COMPILER)
+#define ACPI_CONVERTER_ONLY_MEMBERS(a) a;
+#else
+#define ACPI_CONVERTER_ONLY_MEMBERS(a)
+#endif
+
#define ACPI_PARSE_COMMON \
- union acpi_parse_object *Parent; /* Parent op */\
- UINT8 DescriptorType; /* To differentiate various internal objs */\
- UINT8 Flags; /* Type of Op */\
- UINT16 AmlOpcode; /* AML opcode */\
- UINT8 *Aml; /* Address of declaration in AML */\
- union acpi_parse_object *Next; /* Next op */\
- ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
- ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
- UINT8 ArgListLength; /* Number of elements in the arg list */\
- ACPI_DISASM_ONLY_MEMBERS (\
- UINT16 DisasmFlags; /* Used during AML disassembly */\
- UINT8 DisasmOpcode; /* Subtype used for disassembly */\
- char *OperatorSymbol;/* Used for C-style operator name strings */\
- char AmlOpName[16]) /* Op name (debug only) */
+ union acpi_parse_object *Parent; /* Parent op */\
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
+ UINT8 Flags; /* Type of Op */\
+ UINT16 AmlOpcode; /* AML opcode */\
+ UINT8 *Aml; /* Address of declaration in AML */\
+ union acpi_parse_object *Next; /* Next op */\
+ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
+ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
+ UINT8 ArgListLength; /* Number of elements in the arg list */\
+ ACPI_DISASM_ONLY_MEMBERS (\
+ UINT16 DisasmFlags; /* Used during AML disassembly */\
+ UINT8 DisasmOpcode; /* Subtype used for disassembly */\
+ char *OperatorSymbol; /* Used for C-style operator name strings */\
+ char AmlOpName[16]) /* Op name (debug only) */\
+ ACPI_CONVERTER_ONLY_MEMBERS (\
+ char *InlineComment; /* Inline comment */\
+ char *EndNodeComment; /* End of node comment */\
+ char *NameComment; /* Comment associated with the first parameter of the name node */\
+ char *CloseBraceComment; /* Comments that come after } on the same as } */\
+ ACPI_COMMENT_NODE *CommentList; /* comments that appears before this node */\
+ ACPI_COMMENT_NODE *EndBlkComment; /* comments that at the end of a block but before ) or } */\
+ char *CvFilename; /* Filename associated with this node. Used for ASL/ASL+ converter */\
+ char *CvParentFilename) /* Parent filename associated with this node. Used for ASL/ASL+ converter */
+
+
+/* categories of comments */
+
+typedef enum
+{
+ STANDARD_COMMENT = 1,
+ INLINE_COMMENT,
+ ENDNODE_COMMENT,
+ OPENBRACE_COMMENT,
+ CLOSE_BRACE_COMMENT,
+ STD_DEFBLK_COMMENT,
+ END_DEFBLK_COMMENT,
+ FILENAME_COMMENT,
+ PARENTFILENAME_COMMENT,
+ ENDBLK_COMMENT,
+ INCLUDE_COMMENT
+
+} ASL_COMMENT_TYPES;
/* Internal opcodes for DisasmOpcode field above */
@@ -937,9 +971,46 @@ typedef union acpi_parse_value
#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */
#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
#define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */
-#define ACPI_DASM_SWITCH_PREDICATE 0x0C /* Object is a predicate for a Switch or Case block */
-#define ACPI_DASM_CASE 0x0D /* If/Else is a Case in a Switch/Case block */
-#define ACPI_DASM_DEFAULT 0x0E /* Else is a Default in a Switch/Case block */
+#define ACPI_DASM_SWITCH 0x0C /* While is a Switch */
+#define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */
+#define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */
+#define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */
+
+
+/*
+ * List struct used in the -ca option
+ */
+typedef struct acpi_comment_node
+{
+ char *Comment;
+ struct acpi_comment_node *Next;
+
+} ACPI_COMMENT_NODE;
+
+
+typedef struct acpi_comment_addr_node
+{
+ UINT8 *Addr;
+ struct acpi_comment_addr_node *Next;
+} ACPI_COMMENT_ADDR_NODE;
+
+/*
+ * File node - used for "Include" operator file stack and
+ * depdendency tree for the -ca option
+ */
+typedef struct acpi_file_node
+{
+ FILE *File;
+ char *Filename;
+ char *FileStart; /* Points to AML and indicates when the AML for this particular file starts. */
+ char *FileEnd; /* Points to AML and indicates when the AML for this particular file ends. */
+ struct acpi_file_node *Next;
+ struct acpi_file_node *Parent;
+ BOOLEAN IncludeWritten;
+ ACPI_COMMENT_NODE *IncludeComment;
+
+} ACPI_FILE_NODE;
+
/*
* Generic operation (for example: If, While, Store)
@@ -975,6 +1046,8 @@ typedef struct acpi_parse_obj_asl
union acpi_parse_object *Child;
union acpi_parse_object *ParentMethod;
char *Filename;
+ BOOLEAN FileChanged;
+ char *ParentFilename;
char *ExternalName;
char *Namepath;
char NameSeg[4];
@@ -1007,6 +1080,15 @@ typedef union acpi_parse_object
} ACPI_PARSE_OBJECT;
+typedef struct asl_comment_state
+{
+ UINT8 CommentType;
+ UINT32 SpacesBefore;
+ ACPI_PARSE_OBJECT *Latest_Parse_Node;
+ ACPI_PARSE_OBJECT *ParsingParenBraceNode;
+ BOOLEAN CaptureComments;
+} ASL_COMMENT_STATE;
+
/*
* Parse state - one state per parser invocation and each control
diff --git a/source/include/acmacros.h b/source/include/acmacros.h
index 0e6dee66ff71..f9d9dacf0234 100644
--- a/source/include/acmacros.h
+++ b/source/include/acmacros.h
@@ -499,4 +499,39 @@
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
+/*
+ * Macors used for the ASL-/ASL+ converter utility
+ */
+#ifdef ACPI_ASL_COMPILER
+
+#define ASL_CV_LABEL_FILENODE(a) CvLabelFileNode(a);
+#define ASL_CV_CAPTURE_COMMENTS_ONLY(a) CvCaptureCommentsOnly (a);
+#define ASL_CV_CAPTURE_COMMENTS(a) CvCaptureComments (a);
+#define ASL_CV_TRANSFER_COMMENTS(a) CvTransferComments (a);
+#define ASL_CV_CLOSE_PAREN(a,b) CvCloseParenWriteComment(a,b);
+#define ASL_CV_CLOSE_BRACE(a,b) CvCloseBraceWriteComment(a,b);
+#define ASL_CV_SWITCH_FILES(a,b) CvSwitchFiles(a,b);
+#define ASL_CV_CLEAR_OP_COMMENTS(a) CvClearOpComments(a);
+#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) CvPrintOneCommentType (a,b,c,d);
+#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b);
+#define ASL_CV_FILE_HAS_SWITCHED(a) CvFileHasSwitched(a)
+#define ASL_CV_INIT_FILETREE(a,b,c) CvInitFileTree(a,b,c);
+
+#else
+
+#define ASL_CV_LABEL_FILENODE(a)
+#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)
+#define ASL_CV_CAPTURE_COMMENTS(a)
+#define ASL_CV_TRANSFER_COMMENTS(a)
+#define ASL_CV_CLOSE_PAREN(a,b) AcpiOsPrintf (")");
+#define ASL_CV_CLOSE_BRACE(a,b) AcpiOsPrintf ("}");
+#define ASL_CV_SWITCH_FILES(a,b)
+#define ASL_CV_CLEAR_OP_COMMENTS(a)
+#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
+#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
+#define ASL_CV_FILE_HAS_SWITCHED(a) 0
+#define ASL_CV_INIT_FILETREE(a,b,c)
+
+#endif
+
#endif /* ACMACROS_H */
diff --git a/source/include/acopcode.h b/source/include/acopcode.h
index ce4e420bfa6a..336d146235d1 100644
--- a/source/include/acopcode.h
+++ b/source/include/acopcode.h
@@ -91,6 +91,7 @@
#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_COMMENT_OP ARGP_LIST2 (ARGP_BYTEDATA, ARGP_COMMENT)
#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SIMPLENAME, ARGP_TARGET)
@@ -225,6 +226,7 @@
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
+#define ARGI_COMMENT_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index 8b1ea4f0241c..bf71b1f01dcd 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20170119
+#define ACPI_CA_VERSION 0x20170224
#include "acconfig.h"
#include "actypes.h"
diff --git a/source/include/actbl2.h b/source/include/actbl2.h
index 86d3a43f96ba..51aafc082692 100644
--- a/source/include/actbl2.h
+++ b/source/include/actbl2.h
@@ -89,6 +89,7 @@
#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */
#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
+#define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */
#ifdef ACPI_UNDEFINED_TABLES
/*
@@ -909,6 +910,16 @@ typedef struct acpi_iort_smmu
#define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)
+/* Global interrupt format */
+
+typedef struct acpi_iort_smmu_gsi
+{
+ UINT32 NSgIrpt;
+ UINT32 NSgIrptFlags;
+ UINT32 NSgCfgIrpt;
+ UINT32 NSgCfgIrptFlags;
+} ACPI_IORT_SMMU_GSI;
+
typedef struct acpi_iort_smmu_v3
{
diff --git a/source/include/amlcode.h b/source/include/amlcode.h
index 401dfc3fb4de..ed70466b55c7 100644
--- a/source/include/amlcode.h
+++ b/source/include/amlcode.h
@@ -48,11 +48,8 @@
/* primary opcodes */
-#define AML_NULL_CHAR (UINT16) 0x00
-
#define AML_ZERO_OP (UINT16) 0x00
#define AML_ONE_OP (UINT16) 0x01
-#define AML_UNASSIGNED (UINT16) 0x02
#define AML_ALIAS_OP (UINT16) 0x06
#define AML_NAME_OP (UINT16) 0x08
#define AML_BYTE_OP (UINT16) 0x0a
@@ -63,17 +60,15 @@
#define AML_SCOPE_OP (UINT16) 0x10
#define AML_BUFFER_OP (UINT16) 0x11
#define AML_PACKAGE_OP (UINT16) 0x12
-#define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */
+#define AML_VARIABLE_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */
#define AML_METHOD_OP (UINT16) 0x14
#define AML_EXTERNAL_OP (UINT16) 0x15 /* ACPI 6.0 */
#define AML_DUAL_NAME_PREFIX (UINT16) 0x2e
-#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f
-#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30
-#define AML_NAME_CHAR_FIRST (UINT16) 0x41
-#define AML_EXTENDED_OP_PREFIX (UINT16) 0x5b
+#define AML_MULTI_NAME_PREFIX (UINT16) 0x2f
+#define AML_EXTENDED_PREFIX (UINT16) 0x5b
#define AML_ROOT_PREFIX (UINT16) 0x5c
#define AML_PARENT_PREFIX (UINT16) 0x5e
-#define AML_LOCAL_OP (UINT16) 0x60
+#define AML_FIRST_LOCAL_OP (UINT16) 0x60 /* Used for Local op # calculations */
#define AML_LOCAL0 (UINT16) 0x60
#define AML_LOCAL1 (UINT16) 0x61
#define AML_LOCAL2 (UINT16) 0x62
@@ -82,7 +77,7 @@
#define AML_LOCAL5 (UINT16) 0x65
#define AML_LOCAL6 (UINT16) 0x66
#define AML_LOCAL7 (UINT16) 0x67
-#define AML_ARG_OP (UINT16) 0x68
+#define AML_FIRST_ARG_OP (UINT16) 0x68 /* Used for Arg op # calculations */
#define AML_ARG0 (UINT16) 0x68
#define AML_ARG1 (UINT16) 0x69
#define AML_ARG2 (UINT16) 0x6a
@@ -93,7 +88,7 @@
#define AML_STORE_OP (UINT16) 0x70
#define AML_REF_OF_OP (UINT16) 0x71
#define AML_ADD_OP (UINT16) 0x72
-#define AML_CONCAT_OP (UINT16) 0x73
+#define AML_CONCATENATE_OP (UINT16) 0x73
#define AML_SUBTRACT_OP (UINT16) 0x74
#define AML_INCREMENT_OP (UINT16) 0x75
#define AML_DECREMENT_OP (UINT16) 0x76
@@ -110,7 +105,7 @@
#define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81
#define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82
#define AML_DEREF_OF_OP (UINT16) 0x83
-#define AML_CONCAT_RES_OP (UINT16) 0x84 /* ACPI 2.0 */
+#define AML_CONCATENATE_TEMPLATE_OP (UINT16) 0x84 /* ACPI 2.0 */
#define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */
#define AML_NOTIFY_OP (UINT16) 0x86
#define AML_SIZE_OF_OP (UINT16) 0x87
@@ -122,18 +117,18 @@
#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d
#define AML_OBJECT_TYPE_OP (UINT16) 0x8e
#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */
-#define AML_LAND_OP (UINT16) 0x90
-#define AML_LOR_OP (UINT16) 0x91
-#define AML_LNOT_OP (UINT16) 0x92
-#define AML_LEQUAL_OP (UINT16) 0x93
-#define AML_LGREATER_OP (UINT16) 0x94
-#define AML_LLESS_OP (UINT16) 0x95
+#define AML_LOGICAL_AND_OP (UINT16) 0x90
+#define AML_LOGICAL_OR_OP (UINT16) 0x91
+#define AML_LOGICAL_NOT_OP (UINT16) 0x92
+#define AML_LOGICAL_EQUAL_OP (UINT16) 0x93
+#define AML_LOGICAL_GREATER_OP (UINT16) 0x94
+#define AML_LOGICAL_LESS_OP (UINT16) 0x95
#define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */
-#define AML_TO_DECSTRING_OP (UINT16) 0x97 /* ACPI 2.0 */
-#define AML_TO_HEXSTRING_OP (UINT16) 0x98 /* ACPI 2.0 */
+#define AML_TO_DECIMAL_STRING_OP (UINT16) 0x97 /* ACPI 2.0 */
+#define AML_TO_HEX_STRING_OP (UINT16) 0x98 /* ACPI 2.0 */
#define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */
#define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */
-#define AML_COPY_OP (UINT16) 0x9d /* ACPI 2.0 */
+#define AML_COPY_OBJECT_OP (UINT16) 0x9d /* ACPI 2.0 */
#define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */
#define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */
#define AML_IF_OP (UINT16) 0xa0
@@ -142,18 +137,29 @@
#define AML_NOOP_OP (UINT16) 0xa3
#define AML_RETURN_OP (UINT16) 0xa4
#define AML_BREAK_OP (UINT16) 0xa5
-#define AML_BREAK_POINT_OP (UINT16) 0xcc
+#define AML_COMMENT_OP (UINT16) 0xa9
+#define AML_BREAKPOINT_OP (UINT16) 0xcc
#define AML_ONES_OP (UINT16) 0xff
-/* prefixed opcodes */
-#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* prefix for 2-byte opcodes */
+/*
+ * Combination opcodes (actually two one-byte opcodes)
+ * Used by the disassembler and iASL compiler
+ */
+#define AML_LOGICAL_GREATER_EQUAL_OP (UINT16) 0x9295 /* LNot (LLess) */
+#define AML_LOGICAL_LESS_EQUAL_OP (UINT16) 0x9294 /* LNot (LGreater) */
+#define AML_LOGICAL_NOT_EQUAL_OP (UINT16) 0x9293 /* LNot (LEqual) */
+
+
+/* Prefixed (2-byte) opcodes (with AML_EXTENDED_PREFIX) */
+
+#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* Prefix for 2-byte opcodes */
#define AML_MUTEX_OP (UINT16) 0x5b01
#define AML_EVENT_OP (UINT16) 0x5b02
-#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10
-#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11
-#define AML_COND_REF_OF_OP (UINT16) 0x5b12
+#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10 /* Obsolete, not in ACPI spec */
+#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11 /* Obsolete, not in ACPI spec */
+#define AML_CONDITIONAL_REF_OF_OP (UINT16) 0x5b12
#define AML_CREATE_FIELD_OP (UINT16) 0x5b13
#define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */
#define AML_LOAD_OP (UINT16) 0x5b20
@@ -175,7 +181,7 @@
#define AML_FIELD_OP (UINT16) 0x5b81
#define AML_DEVICE_OP (UINT16) 0x5b82
#define AML_PROCESSOR_OP (UINT16) 0x5b83
-#define AML_POWER_RES_OP (UINT16) 0x5b84
+#define AML_POWER_RESOURCE_OP (UINT16) 0x5b84
#define AML_THERMAL_ZONE_OP (UINT16) 0x5b85
#define AML_INDEX_FIELD_OP (UINT16) 0x5b86
#define AML_BANK_FIELD_OP (UINT16) 0x5b87
@@ -183,15 +189,6 @@
/*
- * Combination opcodes (actually two one-byte opcodes)
- * Used by the disassembler and iASL compiler
- */
-#define AML_LGREATEREQUAL_OP (UINT16) 0x9295
-#define AML_LLESSEQUAL_OP (UINT16) 0x9294
-#define AML_LNOTEQUAL_OP (UINT16) 0x9293
-
-
-/*
* Opcodes for "Field" operators
*/
#define AML_FIELD_OFFSET_OP (UINT8) 0x00
@@ -244,6 +241,7 @@
#define ARGP_SIMPLENAME 0x12 /* NameString | LocalTerm | ArgTerm */
#define ARGP_NAME_OR_REF 0x13 /* For ObjectType only */
#define ARGP_MAX 0x13
+#define ARGP_COMMENT 0x14
/*
* Resolved argument types for the AML Interpreter
@@ -313,26 +311,19 @@
/*
- * hash offsets
- */
-#define AML_EXTOP_HASH_OFFSET 22
-#define AML_LNOT_HASH_OFFSET 19
-
-
-/*
- * opcode groups and types
+ * Some of the flags and types below are of the form:
+ *
+ * AML_FLAGS_EXEC_#A_#T,#R, or
+ * AML_TYPE_EXEC_#A_#T,#R where:
+ *
+ * #A is the number of required arguments
+ * #T is the number of target operands
+ * #R indicates whether there is a return value
*/
-#define OPGRP_NAMED 0x01
-#define OPGRP_FIELD 0x02
-#define OPGRP_BYTELIST 0x04
-
/*
- * Opcode information
+ * Opcode information flags
*/
-
-/* Opcode flags */
-
#define AML_LOGICAL 0x0001
#define AML_LOGICAL_NUMERIC 0x0002
#define AML_MATH 0x0004
@@ -349,7 +340,7 @@
#define AML_CONSTANT 0x2000
#define AML_NO_OPERAND_RESOLVE 0x4000
-/* Convenient flag groupings */
+/* Convenient flag groupings of the flags above */
#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
@@ -367,7 +358,7 @@
/*
* The opcode Type is used in a dispatch table, do not change
- * without updating the table.
+ * or add anything new without updating the table.
*/
#define AML_TYPE_EXEC_0A_0T_1R 0x00
#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
@@ -393,7 +384,7 @@
#define AML_TYPE_METHOD_CALL 0x10
-/* Misc */
+/* Miscellaneous types */
#define AML_TYPE_CREATE_FIELD 0x11
#define AML_TYPE_CREATE_OBJECT 0x12
@@ -403,7 +394,6 @@
#define AML_TYPE_NAMED_SIMPLE 0x16
#define AML_TYPE_NAMED_COMPLEX 0x17
#define AML_TYPE_RETURN 0x18
-
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A