summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-08-31 21:40:51 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-08-31 21:40:51 +0000
commitbe99e84498e91a5930864ef7b92b1a7ceb815e44 (patch)
tree7f5a2883a75b1713bdfe7d36ffa6217bac9187e2 /source/compiler
parent8bc6ab62dbdb3e8b0d2253e0440f6f58ac9afd3d (diff)
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompiler.h6
-rw-r--r--source/compiler/aslhelp.c220
-rw-r--r--source/compiler/aslmain.c320
-rw-r--r--source/compiler/aslopt.c2
-rw-r--r--source/compiler/asloptions.c14
-rw-r--r--source/compiler/aslstubs.c15
-rw-r--r--source/compiler/aslutils.c67
-rw-r--r--source/compiler/dtcompiler.h5
-rw-r--r--source/compiler/dtfield.c47
-rw-r--r--source/compiler/dtparser.y6
-rw-r--r--source/compiler/dtutils.c87
-rw-r--r--source/compiler/prparser.y4
12 files changed, 376 insertions, 417 deletions
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 5e9a46b6c918..d3cbcbafa166 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -911,7 +911,7 @@ LkFindUnreferencedObjects (
void);
/*
- * aslmain - startup
+ * aslhelp - help screens
*/
void
Usage (
@@ -921,6 +921,10 @@ void
AslFilenameHelp (
void);
+void
+AslDisassemblyHelp (
+ void);
+
/*
* aslnamesp - namespace output file generation
diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c
new file mode 100644
index 000000000000..a0bd61f205dc
--- /dev/null
+++ b/source/compiler/aslhelp.c
@@ -0,0 +1,220 @@
+/******************************************************************************
+ *
+ * Module Name: aslhelp - iASL help screens
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, 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 "acapps.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslhelp")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Usage
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display option help message.
+ * Optional items in square brackets.
+ *
+ ******************************************************************************/
+
+void
+Usage (
+ void)
+{
+ printf ("%s\n\n", ASL_COMPLIANCE);
+ 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 ("-v", "Display compiler version");
+ ACPI_OPTION ("-vd", "Display compiler build date and time");
+ ACPI_OPTION ("-vo", "Enable optimization comments");
+ ACPI_OPTION ("-vs", "Disable signon");
+
+ printf ("\nHelp:\n");
+ ACPI_OPTION ("-h", "This message");
+ ACPI_OPTION ("-hc", "Display operators allowed in constant expressions");
+ ACPI_OPTION ("-hd", "Info for obtaining and disassembling binary ACPI tables");
+ ACPI_OPTION ("-hf", "Display help for output filename generation");
+ ACPI_OPTION ("-hr", "Display ACPI reserved method names");
+ ACPI_OPTION ("-ht", "Display currently supported ACPI table names");
+
+ printf ("\nPreprocessor:\n");
+ ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
+ ACPI_OPTION ("-li", "Create preprocessed output file (*.i)");
+ ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
+ ACPI_OPTION ("-Pn", "Disable preprocessor");
+
+ printf ("\nErrors, Warnings, and Remarks:\n");
+ ACPI_OPTION ("-va", "Disable all errors/warnings/remarks");
+ ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)");
+ ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs");
+ ACPI_OPTION ("-vr", "Disable remarks");
+ ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
+ ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level");
+ ACPI_OPTION ("-we", "Report warnings as errors");
+
+ 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");
+ ACPI_OPTION ("-on", "Disable named reference string optimization");
+ ACPI_OPTION ("-ot", "Disable typechecking");
+ ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
+ ACPI_OPTION ("-in", "Ignore NoOp operators");
+ ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
+
+ printf ("\nListings:\n");
+ ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)");
+ ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)");
+ ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
+ ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
+ ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)");
+
+ printf ("\nFirmware Support - C Output:\n");
+ ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)");
+ ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)");
+ ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)");
+ ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)");
+
+ printf ("\nFirmware Support - Assembler Output:\n");
+ ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)");
+ ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)");
+ ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)");
+
+ printf ("\nFirmware Support - ASL Output:\n");
+ ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)");
+
+ printf ("\nData Table Compiler:\n");
+ ACPI_OPTION ("-G", "Compile custom table that contains generic operators");
+ ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files");
+ ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file");
+ ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
+
+ printf ("\nAML Disassembler:\n");
+ 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 <f1 f2 ...>", "Disassemble AML and immediately compile it");
+ ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
+ ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML");
+ ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)");
+ ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
+ ACPI_OPTION ("-in", "Ignore NoOp opcodes");
+ ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code");
+ ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
+
+ printf ("\nDebug Options:\n");
+ 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");
+ ACPI_OPTION ("-bt <type>", "Object type to be pruned from the parse tree");
+ 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 ("-oc", "Display compile times and statistics");
+ ACPI_OPTION ("-x <level>", "Set debug level for trace output");
+ ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FilenameHelp
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display help message for output filename generation
+ *
+ ******************************************************************************/
+
+void
+AslFilenameHelp (
+ void)
+{
+
+ printf ("\nAML output filename generation:\n");
+ printf (" Output filenames are generated by appending an extension to a common\n");
+ printf (" filename prefix. The filename prefix is obtained via one of the\n");
+ printf (" following methods (in priority order):\n");
+ printf (" 1) The -p option specifies the prefix\n");
+ printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n");
+ printf (" 3) The prefix of the input filename\n");
+ printf ("\n");
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslDisassemblyHelp
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL
+ * files.
+ *
+ ******************************************************************************/
+
+void
+AslDisassemblyHelp (
+ void)
+{
+
+ printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n");
+ printf ("Use the following ACPICA toolchain:\n");
+ printf (" AcpiDump: Dump all ACPI tables to a hex ascii file\n");
+ printf (" AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n");
+ printf (" iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n");
+ printf ("\n");
+}
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 423fb59b38ce..6041658c1c23 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -76,242 +76,15 @@ AslInitialize (
/*******************************************************************************
*
- * FUNCTION: Usage
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display option help message.
- * Optional items in square brackets.
- *
- ******************************************************************************/
-
-void
-Usage (
- void)
-{
- printf ("%s\n\n", ASL_COMPLIANCE);
- 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 ("-v", "Display compiler version");
- ACPI_OPTION ("-vo", "Enable optimization comments");
- ACPI_OPTION ("-vs", "Disable signon");
-
- printf ("\nHelp:\n");
- ACPI_OPTION ("-h", "This message");
- ACPI_OPTION ("-hc", "Display operators allowed in constant expressions");
- ACPI_OPTION ("-hf", "Display help for output filename generation");
- ACPI_OPTION ("-hr", "Display ACPI reserved method names");
- ACPI_OPTION ("-ht", "Display currently supported ACPI table names");
-
- printf ("\nPreprocessor:\n");
- ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
- ACPI_OPTION ("-li", "Create preprocessed output file (*.i)");
- ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
- ACPI_OPTION ("-Pn", "Disable preprocessor");
-
- printf ("\nErrors, Warnings, and Remarks:\n");
- ACPI_OPTION ("-va", "Disable all errors/warnings/remarks");
- ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)");
- ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs");
- ACPI_OPTION ("-vr", "Disable remarks");
- ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
- ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level");
- ACPI_OPTION ("-we", "Report warnings as errors");
-
- 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");
- ACPI_OPTION ("-on", "Disable named reference string optimization");
- ACPI_OPTION ("-ot", "Disable typechecking");
- ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
- ACPI_OPTION ("-in", "Ignore NoOp operators");
- ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
-
- printf ("\nListings:\n");
- ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)");
- ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)");
- ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
- ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
- ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)");
-
- printf ("\nFirmware Support - C Output:\n");
- ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)");
- ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)");
- ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)");
- ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)");
-
- printf ("\nFirmware Support - Assembler Output:\n");
- ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)");
- ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)");
- ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)");
-
- printf ("\nFirmware Support - ASL Output:\n");
- ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)");
-
- printf ("\nData Table Compiler:\n");
- ACPI_OPTION ("-G", "Compile custom table that contains generic operators");
- ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files");
- ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file");
- ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
-
- printf ("\nAML Disassembler:\n");
- 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 <f1 f2 ...>", "Disassemble AML and immediately compile it");
- ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML");
- ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)");
- ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
- ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
- ACPI_OPTION ("-in", "Ignore NoOp opcodes");
- ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code");
- ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
-
- printf ("\nDebug Options:\n");
- 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");
- ACPI_OPTION ("-bt <type>", "Object type to be pruned from the parse tree");
- 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 ("-oc", "Display compile times and statistics");
- ACPI_OPTION ("-x <level>", "Set debug level for trace output");
- ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: FilenameHelp
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display help message for output filename generation
- *
- ******************************************************************************/
-
-void
-AslFilenameHelp (
- void)
-{
-
- printf ("\nAML output filename generation:\n");
- printf (" Output filenames are generated by appending an extension to a common\n");
- printf (" filename prefix. The filename prefix is obtained via one of the\n");
- printf (" following methods (in priority order):\n");
- printf (" 1) The -p option specifies the prefix\n");
- printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n");
- printf (" 3) The prefix of the input filename\n");
- printf ("\n");
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AslSignalHandler
- *
- * PARAMETERS: Sig - Signal that invoked this handler
- *
- * RETURN: None
- *
- * DESCRIPTION: Control-C handler. Delete any intermediate files and any
- * output files that may be left in an indeterminate state.
- *
- *****************************************************************************/
-
-static void ACPI_SYSTEM_XFACE
-AslSignalHandler (
- int Sig)
-{
- UINT32 i;
-
-
- signal (Sig, SIG_IGN);
- printf ("Aborting\n\n");
-
- /* Close all open files */
-
- Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
-
- for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
- {
- FlCloseFile (i);
- }
-
- /* Delete any output files */
-
- for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
- {
- FlDeleteFile (i);
- }
-
- exit (0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Initialize compiler globals
- *
- ******************************************************************************/
-
-static void
-AslInitialize (
- void)
-{
- UINT32 i;
-
-
- AcpiGbl_DmOpt_Verbose = FALSE;
-
- /* Default integer width is 64 bits */
-
- AcpiGbl_IntegerBitWidth = 64;
- AcpiGbl_IntegerNybbleWidth = 16;
- AcpiGbl_IntegerByteWidth = 8;
-
- for (i = 0; i < ASL_NUM_FILES; i++)
- {
- Gbl_Files[i].Handle = NULL;
- Gbl_Files[i].Filename = NULL;
- }
-
- Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
- Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
-
- Gbl_Files[ASL_FILE_STDERR].Handle = stderr;
- Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: main
*
* PARAMETERS: Standard argc/argv
*
* RETURN: Program termination code
*
- * DESCRIPTION: C main routine for the Asl Compiler. Handle command line
- * options and begin the compile for each file on the command line
+ * DESCRIPTION: C main routine for the iASL Compiler/Disassembler. Process
+ * command line options and begin the compile/disassembly for each file on
+ * the command line (wildcards supported).
*
******************************************************************************/
@@ -349,7 +122,8 @@ main (
PrInitializePreprocessor ();
AslInitialize ();
- Index1 = Index2 = AslCommandLine (argc, argv);
+ Index1 = Index2 =
+ AslCommandLine (argc, argv);
/* Allocate the line buffer(s), must be after command line */
@@ -409,3 +183,87 @@ CleanupAndExit:
return (ReturnStatus);
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AslSignalHandler
+ *
+ * PARAMETERS: Sig - Signal that invoked this handler
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Control-C handler. Delete any intermediate files and any
+ * output files that may be left in an indeterminate state.
+ *
+ *****************************************************************************/
+
+static void ACPI_SYSTEM_XFACE
+AslSignalHandler (
+ int Sig)
+{
+ UINT32 i;
+
+
+ signal (Sig, SIG_IGN);
+ printf ("Aborting\n\n");
+
+ /* Close all open files */
+
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
+
+ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
+ {
+ FlCloseFile (i);
+ }
+
+ /* Delete any output files */
+
+ for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
+ {
+ FlDeleteFile (i);
+ }
+
+ exit (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize compiler globals
+ *
+ ******************************************************************************/
+
+static void
+AslInitialize (
+ void)
+{
+ UINT32 i;
+
+
+ AcpiGbl_DmOpt_Verbose = FALSE;
+
+ /* Default integer width is 64 bits */
+
+ AcpiGbl_IntegerBitWidth = 64;
+ AcpiGbl_IntegerNybbleWidth = 16;
+ AcpiGbl_IntegerByteWidth = 8;
+
+ for (i = 0; i < ASL_NUM_FILES; i++)
+ {
+ Gbl_Files[i].Handle = NULL;
+ Gbl_Files[i].Filename = NULL;
+ }
+
+ Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
+ Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+
+ Gbl_Files[ASL_FILE_STDERR].Handle = stderr;
+ Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
+}
diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c
index a07f10c1814b..ce923bcb914d 100644
--- a/source/compiler/aslopt.c
+++ b/source/compiler/aslopt.c
@@ -133,7 +133,7 @@ OptSearchToRoot (
* not match, and we cannot use this optimization.
*/
Path = &(((char *) TargetPath->Pointer)[
- TargetPath->Length - ACPI_NAME_SIZE]),
+ TargetPath->Length - ACPI_NAME_SIZE]);
ScopeInfo.Scope.Node = CurrentNode;
/* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c
index 85f5aef8dfc1..b9d4e3c40702 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -70,6 +70,9 @@ 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"
+static char ASL_BUILD_DATE[] = __DATE__;
+static char ASL_BUILD_TIME[] = __TIME__;
+
/*******************************************************************************
*
@@ -404,6 +407,11 @@ AslDoOptions (
UtDisplayConstantOpcodes ();
exit (0);
+ case 'd':
+
+ AslDisassemblyHelp ();
+ exit (0);
+
case 'f':
AslFilenameHelp ();
@@ -712,6 +720,12 @@ AslDoOptions (
Gbl_NoErrors = TRUE;
break;
+ case 'd':
+
+ printf ("%s Build date/time: %s %s\n",
+ ASL_COMPILER_NAME, ASL_BUILD_DATE, ASL_BUILD_TIME);
+ exit (0);
+
case 'e':
/* Disable all warning/remark messages (errors only) */
diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c
index f0fbe035b586..b88513ffb524 100644
--- a/source/compiler/aslstubs.c
+++ b/source/compiler/aslstubs.c
@@ -47,6 +47,7 @@
#include "acevents.h"
#include "acinterp.h"
#include "acnamesp.h"
+#include "acparser.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstubs")
@@ -71,6 +72,13 @@ AcpiNsInitializeObjects (
}
ACPI_STATUS
+AcpiPsExecuteTable (
+ ACPI_EVALUATE_INFO *Info)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
AcpiHwReadPort (
ACPI_IO_ADDRESS Address,
UINT32 *Value,
@@ -156,6 +164,13 @@ AcpiEvDeleteGpeBlock (
return (AE_OK);
}
+void
+AcpiEvUpdateGpes (
+ ACPI_OWNER_ID TableOwnerId)
+{
+ return;
+}
+
ACPI_STATUS
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index f5ca7b7e861f..990e72f02379 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -889,7 +889,7 @@ UtAttachNamepathToOwner (
*
* FUNCTION: UtDoConstant
*
- * PARAMETERS: String - Hex, Octal, or Decimal string
+ * PARAMETERS: String - Hexadecimal or decimal string
*
* RETURN: Converted Integer
*
@@ -906,9 +906,7 @@ UtDoConstant (
char ErrBuf[64];
- Status = AcpiUtStrtoul64 (String, ACPI_ANY_BASE,
- ACPI_MAX64_BYTE_WIDTH, &Converted);
-
+ Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted);
if (ACPI_FAILURE (Status))
{
sprintf (ErrBuf, "%s %s\n", "Conversion error:",
@@ -918,64 +916,3 @@ UtDoConstant (
return (Converted);
}
-
-
-#ifdef _OBSOLETE_FUNCTIONS
-/* Removed 01/2016 */
-
-/*******************************************************************************
- *
- * FUNCTION: UtConvertByteToHex
- *
- * PARAMETERS: RawByte - Binary data
- * Buffer - Pointer to where the hex bytes will be
- * stored
- *
- * RETURN: Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- * with "0x"
- *
- ******************************************************************************/
-
-void
-UtConvertByteToHex (
- UINT8 RawByte,
- UINT8 *Buffer)
-{
-
- Buffer[0] = '0';
- Buffer[1] = 'x';
-
- Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
- Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: UtConvertByteToAsmHex
- *
- * PARAMETERS: RawByte - Binary data
- * Buffer - Pointer to where the hex bytes will be
- * stored
- *
- * RETURN: Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- * with '0', and a trailing 'h' is added.
- *
- ******************************************************************************/
-
-void
-UtConvertByteToAsmHex (
- UINT8 RawByte,
- UINT8 *Buffer)
-{
-
- Buffer[0] = '0';
- Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
- Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
- Buffer[3] = 'h';
-}
-#endif /* OBSOLETE_FUNCTIONS */
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h
index 87ebd9d547de..af7beadb8880 100644
--- a/source/compiler/dtcompiler.h
+++ b/source/compiler/dtcompiler.h
@@ -373,11 +373,6 @@ DtFatal (
DT_FIELD *FieldObject,
char *ExtraMessage);
-ACPI_STATUS
-DtStrtoul64 (
- char *String,
- UINT64 *ReturnInteger);
-
char*
DtGetFieldValue (
DT_FIELD *Field);
diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c
index a34b8e16a0f1..49bae7221266 100644
--- a/source/compiler/dtfield.c
+++ b/source/compiler/dtfield.c
@@ -370,10 +370,10 @@ DtCompileInteger (
* FUNCTION: DtNormalizeBuffer
*
* PARAMETERS: Buffer - Input buffer
- * Count - Output the count of hex number in
+ * Count - Output the count of hex numbers in
* the Buffer
*
- * RETURN: The normalized buffer, freed by caller
+ * RETURN: The normalized buffer, must be freed by caller
*
* DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
* to 1A 2B 3C 4D
@@ -457,36 +457,38 @@ DtCompileBuffer (
DT_FIELD *Field,
UINT32 ByteLength)
{
+ char *Substring;
ACPI_STATUS Status;
- char Hex[3];
- UINT64 Value;
- UINT32 i;
UINT32 Count;
+ UINT32 i;
/* Allow several different types of value separators */
StringValue = DtNormalizeBuffer (StringValue, &Count);
+ Substring = StringValue;
- Hex[2] = 0;
- for (i = 0; i < Count; i++)
+ /* Each element of StringValue is now three chars (2 hex + 1 space) */
+
+ for (i = 0; i < Count; i++, Substring += 3)
{
- /* Each element of StringValue is three chars */
+ /* Check for byte value too long */
- Hex[0] = StringValue[(3 * i)];
- Hex[1] = StringValue[(3 * i) + 1];
+ if (*(&Substring[2]) &&
+ (*(&Substring[2]) != ' '))
+ {
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
+ goto Exit;
+ }
- /* Convert one hex byte */
+ /* Convert two ASCII characters to one hex byte */
- Value = 0;
- Status = DtStrtoul64 (Hex, &Value);
+ Status = AcpiUtAsciiToHexByte (Substring, &Buffer[i]);
if (ACPI_FAILURE (Status))
{
- DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
goto Exit;
}
-
- Buffer[i] = (UINT8) Value;
}
Exit:
@@ -499,13 +501,13 @@ Exit:
*
* FUNCTION: DtCompileFlag
*
- * PARAMETERS: Buffer - Output buffer
- * Field - Field to be compiled
- * Info - Flag info
+ * PARAMETERS: Buffer - Output buffer
+ * Field - Field to be compiled
+ * Info - Flag info
*
- * RETURN:
+ * RETURN: None
*
- * DESCRIPTION: Compile a flag
+ * DESCRIPTION: Compile a flag field. Handles flags up to 64 bits.
*
*****************************************************************************/
@@ -521,7 +523,8 @@ DtCompileFlag (
ACPI_STATUS Status;
- Status = DtStrtoul64 (Field->Value, &Value);
+ Status = AcpiUtStrtoul64 (Field->Value,
+ (ACPI_STRTOUL_64BIT | ACPI_STRTOUL_BASE16), &Value);
if (ACPI_FAILURE (Status))
{
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL);
diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y
index 233aa9614bb5..01f25ffff1db 100644
--- a/source/compiler/dtparser.y
+++ b/source/compiler/dtparser.y
@@ -169,15 +169,15 @@ Expression
/* Default base for a non-prefixed integer is 16 */
- | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
/* Standard hex number (0x1234) */
- | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
/* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */
- | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, ACPI_STRTOUL_64BIT, &$$);}
;
%%
diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c
index 4a280a80971f..fcc0ce74a95c 100644
--- a/source/compiler/dtutils.c
+++ b/source/compiler/dtutils.c
@@ -197,93 +197,6 @@ DtFatal (
/******************************************************************************
*
- * FUNCTION: DtStrtoul64
- *
- * PARAMETERS: String - Null terminated string
- * ReturnInteger - Where the converted integer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Simple conversion of a string hex integer constant to unsigned
- * value. Assumes no leading "0x" for the constant.
- *
- * Portability note: The reason this function exists is because a 64-bit
- * sscanf is not available in all environments.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-DtStrtoul64 (
- char *String,
- UINT64 *ReturnInteger)
-{
- char *ThisChar = String;
- UINT32 ThisDigit;
- UINT64 ReturnValue = 0;
- int DigitCount = 0;
-
-
- /* Skip over any white space in the buffer */
-
- while ((*ThisChar == ' ') || (*ThisChar == '\t'))
- {
- ThisChar++;
- }
-
- /* Skip leading zeros */
-
- while ((*ThisChar) == '0')
- {
- ThisChar++;
- }
-
- /* Convert character-by-character */
-
- while (*ThisChar)
- {
- if (isdigit ((int) *ThisChar))
- {
- /* Convert ASCII 0-9 to Decimal value */
-
- ThisDigit = ((UINT8) *ThisChar) - '0';
- }
- else /* Letter */
- {
- ThisDigit = (UINT32) toupper ((int) *ThisChar);
- if (!isxdigit ((int) ThisDigit))
- {
- /* Not A-F */
-
- return (AE_BAD_CHARACTER);
- }
-
- /* Convert ASCII Hex char (A-F) to value */
-
- ThisDigit = (ThisDigit - 'A') + 10;
- }
-
- /* Insert the 4-bit hex digit */
-
- ReturnValue <<= 4;
- ReturnValue += ThisDigit;
-
- ThisChar++;
- DigitCount++;
- if (DigitCount > 16)
- {
- /* Value is too large (> 64 bits/8 bytes/16 hex digits) */
-
- return (AE_LIMIT);
- }
- }
-
- *ReturnInteger = ReturnValue;
- return (AE_OK);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y
index d2f84059bebe..db9490d48d37 100644
--- a/source/compiler/prparser.y
+++ b/source/compiler/prparser.y
@@ -182,11 +182,11 @@ Expression
/* Default base for a non-prefixed integer is 10 */
- | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, ACPI_STRTOUL_64BIT, &$$);}
/* Standard hex number (0x1234) */
- | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
;
%%