summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2013-02-15 20:36:28 +0000
committerjkim <jkim@FreeBSD.org>2013-02-15 20:36:28 +0000
commit3e2051769bf7ff6071ba65f29a272ac51f6f7ec3 (patch)
tree518d96aa56fe85815f40b82cf2a20eb5ba5c08ff /sys/contrib/dev/acpica/compiler
parentd8ccba8d3228b8712e386a5fa02e20a2962500ed (diff)
parentbd5edd68a8fda8df18c688919e100f7f1df5ad6b (diff)
downloadFreeBSD-src-3e2051769bf7ff6071ba65f29a272ac51f6f7ec3.zip
FreeBSD-src-3e2051769bf7ff6071ba65f29a272ac51f6f7ec3.tar.gz
Merge ACPICA 20130214.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompile.c84
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h20
-rw-r--r--sys/contrib/dev/acpica/compiler/asldefine.h5
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfiles.c7
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c37
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmessages.h2
-rw-r--r--sys/contrib/dev/acpica/compiler/aslpredef.c138
-rw-r--r--sys/contrib/dev/acpica/compiler/aslprepkg.c661
-rw-r--r--sys/contrib/dev/acpica/compiler/aslstartup.c163
-rw-r--r--sys/contrib/dev/acpica/compiler/aslsupport.l10
-rw-r--r--sys/contrib/dev/acpica/compiler/dtcompiler.h10
-rw-r--r--sys/contrib/dev/acpica/compiler/dttable.c50
-rw-r--r--sys/contrib/dev/acpica/compiler/dttemplate.h27
13 files changed, 1096 insertions, 118 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c
index 6d4c466..23579dc 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompile.c
+++ b/sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -42,6 +42,7 @@
*/
#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
#include <stdio.h>
#include <time.h>
@@ -343,6 +344,89 @@ FlConsumeNewComment (
/*******************************************************************************
*
+ * FUNCTION: FlCheckForAcpiTable
+ *
+ * PARAMETERS: Handle - Open input file
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the
+ * following checks on what would be the table header:
+ * 0) File must be at least as long as an ACPI_TABLE_HEADER
+ * 1) The header length field must match the file size
+ * 2) Signature, OemId, OemTableId, AslCompilerId must be ASCII
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlCheckForAcpiTable (
+ FILE *Handle)
+{
+ ACPI_TABLE_HEADER Table;
+ UINT32 FileSize;
+ size_t Actual;
+ UINT32 i;
+
+
+ /* Read a potential table header */
+
+ Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle);
+ fseek (Handle, 0, SEEK_SET);
+
+ if (Actual < sizeof (ACPI_TABLE_HEADER))
+ {
+ return (AE_ERROR);
+ }
+
+ /* Header length field must match the file size */
+
+ FileSize = DtGetFileSize (Handle);
+ if (Table.Length != FileSize)
+ {
+ return (AE_ERROR);
+ }
+
+ /*
+ * These fields must be ASCII:
+ * Signature, OemId, OemTableId, AslCompilerId.
+ * We allow a NULL terminator in OemId and OemTableId.
+ */
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i]))
+ {
+ return (AE_ERROR);
+ }
+
+ if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i]))
+ {
+ return (AE_ERROR);
+ }
+ }
+
+ for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++)
+ {
+ if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i]))
+ {
+ return (AE_ERROR);
+ }
+ }
+
+ for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++)
+ {
+ if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i]))
+ {
+ return (AE_ERROR);
+ }
+ }
+
+ printf ("Binary file appears to be a valid ACPI table, disassembling\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlCheckForAscii
*
* PARAMETERS: Handle - Open input file
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
index d772e8f..92ee1ca 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -160,6 +160,10 @@ CmCleanupAndExit (
void);
ACPI_STATUS
+FlCheckForAcpiTable (
+ FILE *Handle);
+
+ACPI_STATUS
FlCheckForAscii (
FILE *Handle,
char *Filename,
@@ -509,12 +513,28 @@ ApCheckForPredefinedObject (
ACPI_PARSE_OBJECT *Op,
char *Name);
+ACPI_STATUS
+ApCheckObjectType (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 ExpectedBtypes,
+ UINT32 PackageIndex);
+
void
ApDisplayReservedNames (
void);
/*
+ * aslprepkg - ACPI predefined names support for packages
+ */
+void
+ApCheckPackage (
+ ACPI_PARSE_OBJECT *ParentOp,
+ const ACPI_PREDEFINED_INFO *Predefined);
+
+
+/*
* asltransform - parse tree transformations
*/
ACPI_STATUS
diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h
index 7c8bd66..75c8fad 100644
--- a/sys/contrib/dev/acpica/compiler/asldefine.h
+++ b/sys/contrib/dev/acpica/compiler/asldefine.h
@@ -125,8 +125,9 @@
/* Types for input files */
#define ASL_INPUT_TYPE_BINARY 0
-#define ASL_INPUT_TYPE_ASCII_ASL 1
-#define ASL_INPUT_TYPE_ASCII_DATA 2
+#define ASL_INPUT_TYPE_ACPI_TABLE 1
+#define ASL_INPUT_TYPE_ASCII_ASL 2
+#define ASL_INPUT_TYPE_ASCII_DATA 3
/* Misc */
diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c
index a525fc2..443b56c 100644
--- a/sys/contrib/dev/acpica/compiler/aslfiles.c
+++ b/sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -513,6 +513,13 @@ FlOpenMiscOutputFiles (
char *Filename;
+ /* All done for disassembler */
+
+ if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE)
+ {
+ return (AE_OK);
+ }
+
/* Create/Open a hex output file if asked */
if (Gbl_HexOutputFlag)
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index 1a05b9f..af89faa 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -111,7 +111,8 @@ AslDoResponseFile (
*
* RETURN: None
*
- * DESCRIPTION: Display option help message
+ * DESCRIPTION: Display option help message.
+ * Optional items in square brackets.
*
******************************************************************************/
@@ -132,7 +133,7 @@ Options (
ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
ACPI_OPTION ("-Pn", "Disable preprocessor");
- printf ("\nGeneral Output:\n");
+ printf ("\nGeneral Processing:\n");
ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
ACPI_OPTION ("-va", "Disable all errors and warnings (summary only)");
ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs");
@@ -142,12 +143,7 @@ Options (
ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level");
ACPI_OPTION ("-we", "Report warnings as errors");
- printf ("\nAML and Data Output Files:\n");
- ACPI_OPTION ("-sa -sc", "Create assembler or C source file (*.asm or *.c)");
- ACPI_OPTION ("-ia -ic", "Create assembler or C include file (*.inc or *.h)");
- ACPI_OPTION ("-ta -tc -ts", "Create assembler, C, or ASL hex table (*.hex)");
-
- printf ("\nAML Code Generation:\n");
+ printf ("\nAML Code Generation (*.aml):\n");
ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)");
ACPI_OPTION ("-of", "Disable constant folding");
ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones");
@@ -156,22 +152,28 @@ Options (
ACPI_OPTION ("-in", "Ignore NoOp operators");
ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
- printf ("\nASL Listing Files:\n");
+ printf ("\nOptional Source Code Output Files:\n");
+ ACPI_OPTION ("-sc -sa", "Create source file in C or assembler (*.c or *.asm)");
+ ACPI_OPTION ("-ic -ia", "Create include file in C or assembler (*.h or *.inc)");
+ ACPI_OPTION ("-tc -ta -ts", "Create hex AML table in C, assembler, or ASL (*.hex)");
+
+ printf ("\nOptional Listing Files:\n");
ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)");
ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
- printf ("\nACPI Data Tables:\n");
- ACPI_OPTION ("-G", "Compile custom table containing generic operators");
- ACPI_OPTION ("-vt", "Create verbose templates (full disassembly)");
+ printf ("\nData Table Compiler:\n");
+ ACPI_OPTION ("-G", "Compile custom table that contains generic operators");
+ ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
printf ("\nAML Disassembler:\n");
- ACPI_OPTION ("-d [file]", "Disassemble or decode binary ACPI table to file (*.dsl)");
- ACPI_OPTION ("-da [f1,f2]", "Disassemble multiple tables from single namespace");
+ ACPI_OPTION ("-d <f1,f2>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
+ ACPI_OPTION ("", " (Optional, file type is automatically detected)");
+ ACPI_OPTION ("-da <f1,f2>", "Disassemble multiple tables from single namespace");
ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates");
- ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it");
- ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it");
+ ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
+ ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
@@ -186,6 +188,7 @@ Options (
printf ("\nDebug Options:\n");
ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)");
ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)");
+ ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)");
ACPI_OPTION ("-n", "Parse only, no output generation");
ACPI_OPTION ("-ot", "Display compile times and statistics");
ACPI_OPTION ("-x <level>", "Set debug level for trace output");
diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h
index be7a3f9..102148d 100644
--- a/sys/contrib/dev/acpica/compiler/aslmessages.h
+++ b/sys/contrib/dev/acpica/compiler/aslmessages.h
@@ -166,6 +166,7 @@ typedef enum
ASL_MSG_RESERVED_METHOD,
ASL_MSG_RESERVED_NO_RETURN_VAL,
ASL_MSG_RESERVED_OPERAND_TYPE,
+ ASL_MSG_RESERVED_PACKAGE_LENGTH,
ASL_MSG_RESERVED_RETURN_VALUE,
ASL_MSG_RESERVED_USE,
ASL_MSG_RESERVED_WORD,
@@ -343,6 +344,7 @@ char *AslMessages [] = {
/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name",
+/* ASL_MSG_RESERVED_PACKAGE_LENGTH */ "Invalid package length for reserved name",
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
diff --git a/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c
index dea0c83..4cc2312 100644
--- a/sys/contrib/dev/acpica/compiler/aslpredef.c
+++ b/sys/contrib/dev/acpica/compiler/aslpredef.c
@@ -46,6 +46,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#include <contrib/dev/acpica/include/acpredef.h>
+#include <contrib/dev/acpica/include/acnamesp.h>
#define _COMPONENT ACPI_COMPILER
@@ -65,12 +66,6 @@ ApCheckForSpecialName (
char *Name);
static void
-ApCheckObjectType (
- const char *PredefinedName,
- ACPI_PARSE_OBJECT *Op,
- UINT32 ExpectedBtypes);
-
-static void
ApGetExpectedTypes (
char *Buffer,
UINT32 ExpectedBtypes);
@@ -386,7 +381,15 @@ ApCheckPredefinedReturnValue (
ApCheckObjectType (PredefinedNames[Index].Info.Name,
ReturnValueOp,
- PredefinedNames[Index].Info.ExpectedBtypes);
+ PredefinedNames[Index].Info.ExpectedBtypes,
+ ACPI_NOT_PACKAGE_ELEMENT);
+
+ /* For packages, check the individual package elements */
+
+ if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_PACKAGE)
+ {
+ ApCheckPackage (ReturnValueOp, &PredefinedNames[Index]);
+ }
break;
default:
@@ -428,6 +431,7 @@ ApCheckForPredefinedObject (
char *Name)
{
UINT32 Index;
+ ACPI_PARSE_OBJECT *ObjectOp;
/*
@@ -456,39 +460,50 @@ ApCheckForPredefinedObject (
"with zero arguments");
return;
- default: /* A standard predefined ACPI name */
-
- /*
- * If this predefined name requires input arguments, then
- * it must be implemented as a control method
- */
- if (PredefinedNames[Index].Info.ParamCount > 0)
- {
- AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
- "with arguments");
- return;
- }
+ default:
+ break;
+ }
- /*
- * If no return value is expected from this predefined name, then
- * it follows that it must be implemented as a control method
- * (with zero args, because the args > 0 case was handled above)
- * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
- */
- if (!PredefinedNames[Index].Info.ExpectedBtypes)
- {
- AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
- "with zero arguments");
- return;
- }
+ /* A standard predefined ACPI name */
- /* Typecheck the actual object, it is the next argument */
+ /*
+ * If this predefined name requires input arguments, then
+ * it must be implemented as a control method
+ */
+ if (PredefinedNames[Index].Info.ParamCount > 0)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
+ "with arguments");
+ return;
+ }
- ApCheckObjectType (PredefinedNames[Index].Info.Name,
- Op->Asl.Child->Asl.Next,
- PredefinedNames[Index].Info.ExpectedBtypes);
+ /*
+ * If no return value is expected from this predefined name, then
+ * it follows that it must be implemented as a control method
+ * (with zero args, because the args > 0 case was handled above)
+ * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
+ */
+ if (!PredefinedNames[Index].Info.ExpectedBtypes)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
+ "with zero arguments");
return;
}
+
+ /* Typecheck the actual object, it is the next argument */
+
+ ObjectOp = Op->Asl.Child->Asl.Next;
+ ApCheckObjectType (PredefinedNames[Index].Info.Name,
+ Op->Asl.Child->Asl.Next,
+ PredefinedNames[Index].Info.ExpectedBtypes,
+ ACPI_NOT_PACKAGE_ELEMENT);
+
+ /* For packages, check the individual package elements */
+
+ if (ObjectOp->Asl.ParseOpcode == PARSEOP_PACKAGE)
+ {
+ ApCheckPackage (ObjectOp, &PredefinedNames[Index]);
+ }
}
@@ -646,6 +661,9 @@ ApCheckForSpecialName (
* PARAMETERS: PredefinedName - Name of the predefined object we are checking
* Op - Current parse node
* ExpectedBtypes - Bitmap of expected return type(s)
+ * PackageIndex - Index of object within parent package (if
+ * applicable - ACPI_NOT_PACKAGE_ELEMENT
+ * otherwise)
*
* RETURN: None
*
@@ -655,14 +673,23 @@ ApCheckForSpecialName (
*
******************************************************************************/
-static void
+ACPI_STATUS
ApCheckObjectType (
const char *PredefinedName,
ACPI_PARSE_OBJECT *Op,
- UINT32 ExpectedBtypes)
+ UINT32 ExpectedBtypes,
+ UINT32 PackageIndex)
{
UINT32 ReturnBtype;
+ char *TypeName;
+
+
+ if (!Op)
+ {
+ return (AE_TYPE);
+ }
+ /* Map the parse opcode to a bitmapped return type (RTYPE) */
switch (Op->Asl.ParseOpcode)
{
@@ -671,24 +698,35 @@ ApCheckObjectType (
case PARSEOP_ONES:
case PARSEOP_INTEGER:
ReturnBtype = ACPI_RTYPE_INTEGER;
- break;
-
- case PARSEOP_BUFFER:
- ReturnBtype = ACPI_RTYPE_BUFFER;
+ TypeName = "Integer";
break;
case PARSEOP_STRING_LITERAL:
ReturnBtype = ACPI_RTYPE_STRING;
+ TypeName = "String";
+ break;
+
+ case PARSEOP_BUFFER:
+ ReturnBtype = ACPI_RTYPE_BUFFER;
+ TypeName = "Buffer";
break;
case PARSEOP_PACKAGE:
case PARSEOP_VAR_PACKAGE:
ReturnBtype = ACPI_RTYPE_PACKAGE;
+ TypeName = "Package";
+ break;
+
+ case PARSEOP_NAMESEG:
+ case PARSEOP_NAMESTRING:
+ ReturnBtype = ACPI_RTYPE_REFERENCE;
+ TypeName = "Reference";
break;
default:
/* Not one of the supported object types */
+ TypeName = UtGetOpName (Op->Asl.ParseOpcode);
goto TypeErrorExit;
}
@@ -696,7 +734,7 @@ ApCheckObjectType (
if (ReturnBtype & ExpectedBtypes)
{
- return;
+ return (AE_OK);
}
@@ -706,11 +744,19 @@ TypeErrorExit:
ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
- sprintf (MsgBuffer, "%s: found %s, requires %s",
- PredefinedName, UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
+ if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
+ {
+ sprintf (MsgBuffer, "%s: found %s, %s required",
+ PredefinedName, TypeName, StringBuffer);
+ }
+ else
+ {
+ sprintf (MsgBuffer, "%s: found %s at index %u, %s required",
+ PredefinedName, TypeName, PackageIndex, StringBuffer);
+ }
- AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
- MsgBuffer);
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer);
+ return (AE_TYPE);
}
diff --git a/sys/contrib/dev/acpica/compiler/aslprepkg.c b/sys/contrib/dev/acpica/compiler/aslprepkg.c
new file mode 100644
index 0000000..ab52f44
--- /dev/null
+++ b/sys/contrib/dev/acpica/compiler/aslprepkg.c
@@ -0,0 +1,661 @@
+/******************************************************************************
+ *
+ * Module Name: aslprepkg - support for ACPI predefined name package objects
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
+#include "aslcompiler.y.h"
+#include <contrib/dev/acpica/include/acpredef.h>
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslprepkg")
+
+
+/* Local prototypes */
+
+static void
+ApCheckPackageElements (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 Type1,
+ UINT32 Count1,
+ UINT8 Type2,
+ UINT32 Count2);
+
+static void
+ApCheckPackageList (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *ParentOp,
+ const ACPI_PREDEFINED_INFO *Package,
+ UINT32 StartIndex,
+ UINT32 Count);
+
+static void
+ApPackageTooSmall (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Count,
+ UINT32 ExpectedCount);
+
+static void
+ApZeroLengthPackage (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+ApPackageTooLarge (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Count,
+ UINT32 ExpectedCount);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApCheckPackage
+ *
+ * PARAMETERS: ParentOp - Parser op for the package
+ * Predefined - Pointer to package-specific info for method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Top-level validation for predefined name return package
+ * objects.
+ *
+ ******************************************************************************/
+
+void
+ApCheckPackage (
+ ACPI_PARSE_OBJECT *ParentOp,
+ const ACPI_PREDEFINED_INFO *Predefined)
+{
+ ACPI_PARSE_OBJECT *Op;
+ const ACPI_PREDEFINED_INFO *Package;
+ ACPI_STATUS Status;
+ UINT32 ExpectedCount;
+ UINT32 Count;
+ UINT32 i;
+
+
+ /* The package info for this name is in the next table entry */
+
+ Package = Predefined + 1;
+
+ /* First child is the package length */
+
+ Op = ParentOp->Asl.Child;
+ Count = (UINT32) Op->Asl.Value.Integer;
+
+ /*
+ * Most packages must have at least one element. The only exception
+ * is the variable-length package (ACPI_PTYPE1_VAR).
+ */
+ if (!Count)
+ {
+ if (Package->RetInfo.Type != ACPI_PTYPE1_VAR)
+ {
+ ApZeroLengthPackage (Predefined->Info.Name, ParentOp);
+ }
+ return;
+ }
+
+ /* Get the first element of the package */
+
+ Op = Op->Asl.Next;
+
+ /* Decode the package type */
+
+ switch (Package->RetInfo.Type)
+ {
+ case ACPI_PTYPE1_FIXED:
+ /*
+ * The package count is fixed and there are no sub-packages
+ *
+ * If package is too small, exit.
+ * If package is larger than expected, issue warning but continue
+ */
+ ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
+ if (Count < ExpectedCount)
+ {
+ goto PackageTooSmall;
+ }
+ else if (Count > ExpectedCount)
+ {
+ ApPackageTooLarge (Predefined->Info.Name, ParentOp,
+ Count, ExpectedCount);
+ }
+
+ /* Validate all elements of the package */
+
+ ApCheckPackageElements (Predefined->Info.Name, Op,
+ Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
+ Package->RetInfo.ObjectType2, Package->RetInfo.Count2);
+ break;
+
+ case ACPI_PTYPE1_VAR:
+ /*
+ * The package count is variable, there are no sub-packages, and all
+ * elements must be of the same type
+ */
+ for (i = 0; i < Count; i++)
+ {
+ ApCheckObjectType (Predefined->Info.Name, Op,
+ Package->RetInfo.ObjectType1, i);
+ Op = Op->Asl.Next;
+ }
+ break;
+
+ case ACPI_PTYPE1_OPTION:
+ /*
+ * The package count is variable, there are no sub-packages. There are
+ * a fixed number of required elements, and a variable number of
+ * optional elements.
+ *
+ * Check if package is at least as large as the minimum required
+ */
+ ExpectedCount = Package->RetInfo3.Count;
+ if (Count < ExpectedCount)
+ {
+ goto PackageTooSmall;
+ }
+
+ /* Variable number of sub-objects */
+
+ for (i = 0; i < Count; i++)
+ {
+ if (i < Package->RetInfo3.Count)
+ {
+ /* These are the required package elements (0, 1, or 2) */
+
+ ApCheckObjectType (Predefined->Info.Name, Op,
+ Package->RetInfo3.ObjectType[i], i);
+ }
+ else
+ {
+ /* These are the optional package elements */
+
+ ApCheckObjectType (Predefined->Info.Name, Op,
+ Package->RetInfo3.TailObjectType, i);
+ }
+ Op = Op->Asl.Next;
+ }
+ break;
+
+ case ACPI_PTYPE2_REV_FIXED:
+
+ /* First element is the (Integer) revision */
+
+ ApCheckObjectType (Predefined->Info.Name, Op,
+ ACPI_RTYPE_INTEGER, 0);
+
+ Op = Op->Asl.Next;
+ Count--;
+
+ /* Examine the sub-packages */
+
+ ApCheckPackageList (Predefined->Info.Name, Op,
+ Package, 1, Count);
+ break;
+
+ case ACPI_PTYPE2_PKG_COUNT:
+
+ /* First element is the (Integer) count of sub-packages to follow */
+
+ Status = ApCheckObjectType (Predefined->Info.Name, Op,
+ ACPI_RTYPE_INTEGER, 0);
+
+ /* We must have an integer count from above (otherwise, use Count) */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Count cannot be larger than the parent package length, but allow it
+ * to be smaller. The >= accounts for the Integer above.
+ */
+ ExpectedCount = (UINT32) Op->Asl.Value.Integer;
+ if (ExpectedCount >= Count)
+ {
+ goto PackageTooSmall;
+ }
+
+ Count = ExpectedCount;
+ }
+
+ Op = Op->Asl.Next;
+
+ /* Examine the sub-packages */
+
+ ApCheckPackageList (Predefined->Info.Name, Op,
+ Package, 1, Count);
+ break;
+
+ case ACPI_PTYPE2:
+ case ACPI_PTYPE2_FIXED:
+ case ACPI_PTYPE2_MIN:
+ case ACPI_PTYPE2_COUNT:
+ case ACPI_PTYPE2_FIX_VAR:
+ /*
+ * These types all return a single Package that consists of a
+ * variable number of sub-Packages.
+ */
+
+ /* Examine the sub-packages */
+
+ ApCheckPackageList (Predefined->Info.Name, Op,
+ Package, 0, Count);
+ break;
+
+ default:
+ return;
+ }
+
+ return;
+
+PackageTooSmall:
+ ApPackageTooSmall (Predefined->Info.Name, ParentOp,
+ Count, ExpectedCount);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApCheckPackageElements
+ *
+ * PARAMETERS: PredefinedName - Pointer to validation data structure
+ * Op - Parser op for the package
+ * Type1 - Object type for first group
+ * Count1 - Count for first group
+ * Type2 - Object type for second group
+ * Count2 - Count for second group
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Validate all elements of a package. Works with packages that
+ * are defined to contain up to two groups of different object
+ * types.
+ *
+ ******************************************************************************/
+
+static void
+ApCheckPackageElements (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 Type1,
+ UINT32 Count1,
+ UINT8 Type2,
+ UINT32 Count2)
+{
+ UINT32 i;
+
+
+ /*
+ * Up to two groups of package elements are supported by the data
+ * structure. All elements in each group must be of the same type.
+ * The second group can have a count of zero.
+ *
+ * Aborts check upon a NULL package element, as this means (at compile
+ * time) that the remainder of the package elements are also NULL
+ * (This is the only way to create NULL package elements.)
+ */
+ for (i = 0; (i < Count1) && Op; i++)
+ {
+ ApCheckObjectType (PredefinedName, Op, Type1, i);
+ Op = Op->Asl.Next;
+ }
+
+ for (i = 0; (i < Count2) && Op; i++)
+ {
+ ApCheckObjectType (PredefinedName, Op, Type2, (i + Count1));
+ Op = Op->Asl.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApCheckPackageList
+ *
+ * PARAMETERS: PredefinedName - Name of the predefined object
+ * ParentOp - Parser op of the parent package
+ * Package - Package info for this predefined name
+ * StartIndex - Index in parent package where list begins
+ * ParentCount - Element count of parent package
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Validate the individual package elements for a predefined name.
+ * Handles the cases where the predefined name is defined as a
+ * Package of Packages (subpackages). These are the types:
+ *
+ * ACPI_PTYPE2
+ * ACPI_PTYPE2_FIXED
+ * ACPI_PTYPE2_MIN
+ * ACPI_PTYPE2_COUNT
+ * ACPI_PTYPE2_FIX_VAR
+ *
+ ******************************************************************************/
+
+static void
+ApCheckPackageList (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *ParentOp,
+ const ACPI_PREDEFINED_INFO *Package,
+ UINT32 StartIndex,
+ UINT32 ParentCount)
+{
+ ACPI_PARSE_OBJECT *SubPackageOp = ParentOp;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_STATUS Status;
+ UINT32 Count;
+ UINT32 ExpectedCount;
+ UINT32 i;
+ UINT32 j;
+
+
+ /*
+ * Validate each subpackage in the parent Package
+ *
+ * Note: We ignore NULL package elements on the assumption that
+ * they will be initialized by the BIOS or other ASL code.
+ */
+ for (i = 0; (i < ParentCount) && SubPackageOp; i++)
+ {
+ /* Each object in the list must be of type Package */
+
+ Status = ApCheckObjectType (PredefinedName, SubPackageOp,
+ ACPI_RTYPE_PACKAGE, i + StartIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ goto NextSubpackage;
+ }
+
+ /* Examine the different types of expected subpackages */
+
+ Op = SubPackageOp->Asl.Child;
+
+ /* First child is the package length */
+
+ Count = (UINT32) Op->Asl.Value.Integer;
+ Op = Op->Asl.Next;
+
+ /* The subpackage must have at least one element */
+
+ if (!Count)
+ {
+ ApZeroLengthPackage (PredefinedName, SubPackageOp);
+ goto NextSubpackage;
+ }
+
+ /*
+ * Decode the package type.
+ * PTYPE2 indicates that a "package of packages" is expected for
+ * this name. The various flavors of PTYPE2 indicate the number
+ * and format of the subpackages.
+ */
+ switch (Package->RetInfo.Type)
+ {
+ case ACPI_PTYPE2:
+ case ACPI_PTYPE2_PKG_COUNT:
+ case ACPI_PTYPE2_REV_FIXED:
+
+ /* Each subpackage has a fixed number of elements */
+
+ ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
+ if (Count < ExpectedCount)
+ {
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+
+ ApCheckPackageElements (PredefinedName, Op,
+ Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
+ Package->RetInfo.ObjectType2, Package->RetInfo.Count2);
+ break;
+
+ case ACPI_PTYPE2_FIX_VAR:
+ /*
+ * Each subpackage has a fixed number of elements and an
+ * optional element
+ */
+ ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
+ if (Count < ExpectedCount)
+ {
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+
+ ApCheckPackageElements (PredefinedName, Op,
+ Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
+ Package->RetInfo.ObjectType2,
+ Count - Package->RetInfo.Count1);
+ break;
+
+ case ACPI_PTYPE2_FIXED:
+
+ /* Each sub-package has a fixed length */
+
+ ExpectedCount = Package->RetInfo2.Count;
+ if (Count < ExpectedCount)
+ {
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+
+ /* Check each object/type combination */
+
+ for (j = 0; j < ExpectedCount; j++)
+ {
+ ApCheckObjectType (PredefinedName, Op,
+ Package->RetInfo2.ObjectType[j], j);
+
+ Op = Op->Asl.Next;
+ }
+ break;
+
+ case ACPI_PTYPE2_MIN:
+
+ /* Each sub-package has a variable but minimum length */
+
+ ExpectedCount = Package->RetInfo.Count1;
+ if (Count < ExpectedCount)
+ {
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+
+ /* Check the type of each sub-package element */
+
+ ApCheckPackageElements (PredefinedName, Op,
+ Package->RetInfo.ObjectType1, Count, 0, 0);
+ break;
+
+ case ACPI_PTYPE2_COUNT:
+ /*
+ * First element is the (Integer) count of elements, including
+ * the count field (the ACPI name is NumElements)
+ */
+ Status = ApCheckObjectType (PredefinedName, Op,
+ ACPI_RTYPE_INTEGER, 0);
+
+ /* We must have an integer count from above (otherwise, use Count) */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Make sure package is large enough for the Count and is
+ * is as large as the minimum size
+ */
+ ExpectedCount = (UINT32) Op->Asl.Value.Integer;
+
+ if (Count < ExpectedCount)
+ {
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+ else if (Count > ExpectedCount)
+ {
+ ApPackageTooLarge (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ }
+
+ /* Some names of this type have a minimum length */
+
+ if (Count < Package->RetInfo.Count1)
+ {
+ ExpectedCount = Package->RetInfo.Count1;
+ ApPackageTooSmall (PredefinedName, SubPackageOp,
+ Count, ExpectedCount);
+ break;
+ }
+
+ Count = ExpectedCount;
+ }
+
+ /* Check the type of each sub-package element */
+
+ Op = Op->Asl.Next;
+ ApCheckPackageElements (PredefinedName, Op,
+ Package->RetInfo.ObjectType1, (Count - 1), 0, 0);
+ break;
+
+ default:
+ break;
+ }
+
+NextSubpackage:
+ SubPackageOp = SubPackageOp->Asl.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApPackageTooSmall
+ *
+ * PARAMETERS: PredefinedName - Name of the predefined object
+ * Op - Current parser op
+ * Count - Actual package element count
+ * ExpectedCount - Expected package element count
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Issue error message for a package that is smaller than
+ * required.
+ *
+ ******************************************************************************/
+
+static void
+ApPackageTooSmall (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Count,
+ UINT32 ExpectedCount)
+{
+
+ sprintf (MsgBuffer, "%s: length %u, required minimum is %u",
+ PredefinedName, Count, ExpectedCount);
+
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApZeroLengthPackage
+ *
+ * PARAMETERS: PredefinedName - Name of the predefined object
+ * Op - Current parser op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Issue error message for a zero-length package (a package that
+ * is required to have a non-zero length). Variable length
+ * packages seem to be allowed to have zero length, however.
+ * Even if not allowed, BIOS code does it.
+ *
+ ******************************************************************************/
+
+static void
+ApZeroLengthPackage (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ sprintf (MsgBuffer, "%s: length is zero", PredefinedName);
+
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: ApPackageTooLarge
+ *
+ * PARAMETERS: PredefinedName - Name of the predefined object
+ * Op - Current parser op
+ * Count - Actual package element count
+ * ExpectedCount - Expected package element count
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Issue a remark for a package that is larger than expected.
+ *
+ ******************************************************************************/
+
+static void
+ApPackageTooLarge (
+ const char *PredefinedName,
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Count,
+ UINT32 ExpectedCount)
+{
+
+ sprintf (MsgBuffer, "%s: length is %u, only %u required",
+ PredefinedName, Count, ExpectedCount);
+
+ AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer);
+}
diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c
index 8deb894..41a663d 100644
--- a/sys/contrib/dev/acpica/compiler/aslstartup.c
+++ b/sys/contrib/dev/acpica/compiler/aslstartup.c
@@ -44,6 +44,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/include/actables.h>
+#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acapps.h>
#define _COMPONENT ACPI_COMPILER
@@ -66,6 +67,10 @@ static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
+static ACPI_STATUS
+AslDoDisassembly (
+ void);
+
/*******************************************************************************
*
@@ -224,6 +229,15 @@ AslDetectSourceFileType (
ACPI_STATUS Status;
+ /* Check for a valid binary ACPI table */
+
+ Status = FlCheckForAcpiTable (Info->Handle);
+ if (ACPI_SUCCESS (Status))
+ {
+ Type = ASL_INPUT_TYPE_ACPI_TABLE;
+ goto Cleanup;
+ }
+
/* Check for 100% ASCII source file (comments are ignored) */
Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE);
@@ -279,6 +293,86 @@ Cleanup:
/*******************************************************************************
*
+ * FUNCTION: AslDoDisassembly
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initiate AML file disassembly. Uses ACPICA subsystem to build
+ * namespace.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AslDoDisassembly (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ /* ACPICA subsystem initialization */
+
+ Status = AdInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiAllocateRootTable (4);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
+ AcpiFormatException (Status));
+ return (Status);
+ }
+
+ /* This is where the disassembly happens */
+
+ AcpiGbl_DbOpt_disasm = TRUE;
+ Status = AdAmlDisassemble (AslToFile,
+ Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix,
+ &Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_GetAllTables);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Check if any control methods were unresolved */
+
+ AcpiDmUnresolvedWarning (0);
+
+#if 0
+ /* TBD: Handle additional output files for disassembler */
+
+ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+ NsDisplayNamespace ();
+#endif
+
+ /* Shutdown compiler and ACPICA subsystem */
+
+ AeClearErrorLog ();
+ (void) AcpiTerminate ();
+
+ /*
+ * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
+ * .DSL disassembly file, which can now be compiled if requested
+ */
+ if (Gbl_DoCompile)
+ {
+ AcpiOsPrintf ("\nCompiling \"%s\"\n",
+ Gbl_Files[ASL_FILE_INPUT].Filename);
+ return (AE_CTRL_CONTINUE);
+ }
+
+ ACPI_FREE (Gbl_Files[ASL_FILE_INPUT].Filename);
+ Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AslDoOneFile
*
* PARAMETERS: Filename - Name of the file
@@ -308,61 +402,11 @@ AslDoOneFile (
*/
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
- /* ACPICA subsystem initialization */
-
- Status = AdInitialize ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- Status = AcpiAllocateRootTable (4);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
- AcpiFormatException (Status));
- return (Status);
- }
-
- /* This is where the disassembly happens */
-
- AcpiGbl_DbOpt_disasm = TRUE;
- Status = AdAmlDisassemble (AslToFile,
- Gbl_Files[ASL_FILE_INPUT].Filename,
- Gbl_OutputFilenamePrefix,
- &Gbl_Files[ASL_FILE_INPUT].Filename,
- Gbl_GetAllTables);
- if (ACPI_FAILURE (Status))
+ Status = AslDoDisassembly ();
+ if (Status != AE_CTRL_CONTINUE)
{
return (Status);
}
-
-#if 0
- /* TBD: Handle additional output files for disassembler */
-
- Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
- NsDisplayNamespace ();
-#endif
-
- /* Shutdown compiler and ACPICA subsystem */
-
- AeClearErrorLog ();
- (void) AcpiTerminate ();
-
- /*
- * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
- * .DSL disassembly file, which can now be compiled if requested
- */
- if (Gbl_DoCompile)
- {
- AcpiOsPrintf ("\nCompiling \"%s\"\n",
- Gbl_Files[ASL_FILE_INPUT].Filename);
- }
- else
- {
- Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
- return (AE_OK);
- }
}
/*
@@ -469,6 +513,21 @@ AslDoOneFile (
PrTerminatePreprocessor ();
return (AE_OK);
+ /*
+ * Binary ACPI table was auto-detected, disassemble it
+ */
+ case ASL_INPUT_TYPE_ACPI_TABLE:
+
+ /* We have what appears to be an ACPI table, disassemble it */
+
+ FlCloseFile (ASL_FILE_INPUT);
+ Gbl_DoCompile = FALSE;
+ Gbl_DisasmFlag = TRUE;
+ Status = AslDoDisassembly ();
+ return (Status);
+
+ /* Unknown binary table */
+
case ASL_INPUT_TYPE_BINARY:
AePrintErrorLog (ASL_FILE_STDERR);
diff --git a/sys/contrib/dev/acpica/compiler/aslsupport.l b/sys/contrib/dev/acpica/compiler/aslsupport.l
index 90af049..52389ee 100644
--- a/sys/contrib/dev/acpica/compiler/aslsupport.l
+++ b/sys/contrib/dev/acpica/compiler/aslsupport.l
@@ -403,6 +403,9 @@ count (
TotalKeywords++;
TotalExecutableOpcodes++;
break;
+
+ default:
+ break;
}
for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
@@ -570,7 +573,6 @@ AslDoStringLiteral (
AslInsertLineBuffer (StringChar);
DoCharacter:
-
switch (State)
{
case ASL_NORMAL_CHAR:
@@ -590,6 +592,9 @@ DoCharacter:
/* String terminator */
goto CompletedString;
+
+ default:
+ break;
}
break;
@@ -748,6 +753,9 @@ DoCharacter:
ConvertBuffer[i] = StringChar;
i++;
continue;
+
+ default:
+ break;
}
/* Save the finished character */
diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h
index e9bdf05..51fec6d 100644
--- a/sys/contrib/dev/acpica/compiler/dtcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h
@@ -444,6 +444,10 @@ DtCompileMsct (
void **PFieldList);
ACPI_STATUS
+DtCompileMtmr (
+ void **PFieldList);
+
+ACPI_STATUS
DtCompilePmtt (
void **PFieldList);
@@ -472,6 +476,10 @@ DtCompileUefi (
void **PFieldList);
ACPI_STATUS
+DtCompileVrtc (
+ void **PFieldList);
+
+ACPI_STATUS
DtCompileWdat (
void **PFieldList);
@@ -511,6 +519,7 @@ extern const unsigned char TemplateMcfg[];
extern const unsigned char TemplateMchi[];
extern const unsigned char TemplateMpst[];
extern const unsigned char TemplateMsct[];
+extern const unsigned char TemplateMtmr[];
extern const unsigned char TemplatePmtt[];
extern const unsigned char TemplateRsdt[];
extern const unsigned char TemplateS3pt[];
@@ -523,6 +532,7 @@ extern const unsigned char TemplateSrat[];
extern const unsigned char TemplateTcpa[];
extern const unsigned char TemplateTpm2[];
extern const unsigned char TemplateUefi[];
+extern const unsigned char TemplateVrtc[];
extern const unsigned char TemplateWaet[];
extern const unsigned char TemplateWdat[];
extern const unsigned char TemplateWddt[];
diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c
index 1a8fd81..cd6a35f 100644
--- a/sys/contrib/dev/acpica/compiler/dttable.c
+++ b/sys/contrib/dev/acpica/compiler/dttable.c
@@ -1412,6 +1412,31 @@ DtCompileMsct (
/******************************************************************************
*
+ * FUNCTION: DtCompileMtmr
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile MTMR.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileMtmr (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: DtCompilePmtt
*
* PARAMETERS: List - Current field list pointer
@@ -1974,6 +1999,31 @@ DtCompileUefi (
/******************************************************************************
*
+ * FUNCTION: DtCompileVrtc
+ *
+ * PARAMETERS: List - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile VRTC.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+DtCompileVrtc (
+ void **List)
+{
+ ACPI_STATUS Status;
+
+
+ Status = DtCompileTwoSubtables (List,
+ AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: DtCompileWdat
*
* PARAMETERS: List - Current field list pointer
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h
index 07d1f91..d3fadf5 100644
--- a/sys/contrib/dev/acpica/compiler/dttemplate.h
+++ b/sys/contrib/dev/acpica/compiler/dttemplate.h
@@ -632,6 +632,20 @@ const unsigned char TemplateMsct[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */
};
+const unsigned char TemplateMtmr[] =
+{
+ 0x4D,0x54,0x4D,0x52,0x4C,0x00,0x00,0x00, /* 00000000 "MTMRL..." */
+ 0x01,0xB0,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x03,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x17,0x01,0x13,0x20,0x00,0x20,0x00,0x03, /* 00000020 "... . .." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x20,0x00,0x03,0x00,0x00,0x00,0x00, /* 00000038 ". ......" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000048 "...." */
+};
+
const unsigned char TemplatePmtt[] =
{
0x50,0x4D,0x54,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "PMTT...." */
@@ -893,6 +907,19 @@ const unsigned char TemplateUefi[] =
0x0C,0x0D,0x0E,0x0F,0x00,0x00 /* 00000030 "......" */
};
+const unsigned char TemplateVrtc[] =
+{
+ 0x56,0x52,0x54,0x43,0x44,0x00,0x00,0x00, /* 00000000 "VRTCD..." */
+ 0x01,0xEF,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
+ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
+ 0x03,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
+ 0x17,0x01,0x13,0x20,0x00,0x08,0x00,0x00, /* 00000020 "... ...." */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000030 "........" */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
+ 0x00,0x00,0x00,0x00 /* 00000040 "...." */
+};
+
const unsigned char TemplateWaet[] =
{
0x57,0x41,0x45,0x54,0x28,0x00,0x00,0x00, /* 00000000 "WAET(..." */
OpenPOWER on IntegriCloud