diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2016-08-31 21:40:51 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2016-08-31 21:40:51 +0000 |
commit | be99e84498e91a5930864ef7b92b1a7ceb815e44 (patch) | |
tree | 7f5a2883a75b1713bdfe7d36ffa6217bac9187e2 | |
parent | 8bc6ab62dbdb3e8b0d2253e0440f6f58ac9afd3d (diff) |
Import ACPICA 20160831.vendor/acpica/20160831
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=305162
svn path=/vendor-sys/acpica/20160831/; revision=305163; tag=vendor/acpica/20160831
74 files changed, 2063 insertions, 1359 deletions
diff --git a/changes.txt b/changes.txt index 03c8d4f3688a..3e87f12c3b57 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,72 @@ ---------------------------------------- -29 July 2016. Summary of changes for version 20160729: +31 August 2016. Summary of changes for version 20160831: -This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +Improve support for the so-called "module-level code", which is defined +to be math, logical and control AML opcodes that appear outside of any +control method. This change improves the support by adding more opcodes +that can be executed in the manner. Some other issues have been solved, +and the ASL grammar changes to support such code under all scope +operators (Device, etc.) are complete. Lv Zheng. + +UEFI support: these OSL functions have been implemented. This is an +additional step toward supporting the AcpiExec utility natively (with +full hardware access) under UEFI. Marcelo Ferreira. + AcpiOsReadPciConfiguration + AcpiOsWritePciConfiguration + +Fixed a possible mutex error during control method auto-serialization. Lv +Zheng. + +Updated support for the Generic Address Structure by fully implementing +all GAS fields when a 32-bit address is expanded to a 64-bit GAS. Lv +Zheng. + +Updated the return value for the internal _OSI method. Instead of +0xFFFFFFFF, the "Ones" value is now returned, which is 0xFFFFFFFFFFFFFFFF +for 64-bit ACPI tables. This fixes an incompatibility with other ACPI +implementations, and will be reflected and clarified in the next version +of the ACPI specification. + +Implemented two new table events that can be passed to an ACPICA table +handler. These events are used to indicate a table installation or +uninstallation. These events are used in addition to existed table load +and unload events. Lv Zheng. + +Implemented a cleanup for all internal string-to-integer conversions. +Consolidate multiple versions of this functionality and limit possible +bases to either 10 or 16 to simplify the code. Adds a new file, +utstrtoul64. + +Cleanup the inclusion order of the various compiler-specific headers. +This simplifies build configuration management. The compiler-specific +headers are now split out from the host-specific headers. Lv Zheng. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 140.1K Code, 58.1K Data, 198.1K Total + Debug Version: 200.3K Code, 82.1K Data, 282.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL/AcpiExec: Added a command line option to display the build date/time +of the tool (-vd). This can be useful to verify that the correct version +of the tools are being used. + +AML Debugger: Implemented a new subcommand ("execute predef") to execute +all predefined control methods and names within the current namespace. +This can be useful for debugging problems with ACPI tables and the ACPI +namespace. + +---------------------------------------- +29 July 2016. Summary of changes for version 20160729: 1) ACPICA kernel-resident subsystem: @@ -34,7 +99,6 @@ help in the implementation of these functions would be appreciated: AcpiOsReadPciConfiguration AcpiOsWritePciConfiguration - Restructured and standardized the C library configuration for ACPICA, resulting in the various configuration options below. This includes a global restructuring of the compiler-dependent and platform-dependent @@ -102,8 +166,6 @@ through the registry on older versions. ---------------------------------------- 27 May 2016. Summary of changes for version 20160527: -This release is available at https://acpica.org/downloads - 1) ACPICA kernel-resident subsystem: diff --git a/generate/unix/acpidump/Makefile b/generate/unix/acpidump/Makefile index 4aa98a345e24..7e3723fea920 100644 --- a/generate/unix/acpidump/Makefile +++ b/generate/unix/acpidump/Makefile @@ -43,9 +43,11 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ + $(OBJDIR)/uthex.o\ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utstring.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/utxferror.o # diff --git a/generate/unix/acpiexamples/Makefile b/generate/unix/acpiexamples/Makefile index d1e5ac2136da..691b65b77d4a 100644 --- a/generate/unix/acpiexamples/Makefile +++ b/generate/unix/acpiexamples/Makefile @@ -156,6 +156,7 @@ OBJECTS = \ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/utxface.o\ $(OBJDIR)/utxferror.o\ $(OBJDIR)/utxfinit.o diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index ad53dbe7bfcd..62850ac274bd 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -226,6 +226,7 @@ OBJECTS = \ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/uttrack.o\ $(OBJDIR)/utuuid.o\ $(OBJDIR)/utxface.o\ diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile index 2a3282c8bc75..25ce59f9d174 100644 --- a/generate/unix/acpisrc/Makefile +++ b/generate/unix/acpisrc/Makefile @@ -42,6 +42,7 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ + $(OBJDIR)/uthex.o\ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utstring.o\ diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile index 609451fd1677..cb08fc0383cc 100644 --- a/generate/unix/acpixtract/Makefile +++ b/generate/unix/acpixtract/Makefile @@ -36,6 +36,7 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ + $(OBJDIR)/uthex.o\ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utxferror.o diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index a231bd6b919e..d06524da59b7 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -62,6 +62,7 @@ OBJECTS = \ $(OBJDIR)/aslfiles.o\ $(OBJDIR)/aslfileio.o\ $(OBJDIR)/aslfold.o\ + $(OBJDIR)/aslhelp.o\ $(OBJDIR)/aslhex.o\ $(OBJDIR)/asllength.o\ $(OBJDIR)/asllisting.o\ @@ -222,6 +223,7 @@ OBJECTS = \ $(OBJDIR)/utpredef.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/utstring.o\ $(OBJDIR)/utuuid.o\ $(OBJDIR)/utxface.o\ 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), &$$);} ; %% diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index 47d2889a6693..ee5a44371bcd 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -321,7 +321,8 @@ AcpiDbConvertToObject ( default: Object->Type = ACPI_TYPE_INTEGER; - Status = AcpiUtStrtoul64 (String, 16, AcpiGbl_IntegerByteWidth, + Status = AcpiUtStrtoul64 (String, + (AcpiGbl_IntegerByteWidth | ACPI_STRTOUL_BASE16), &Object->Integer.Value); break; } diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index b3c6cf9fab98..fcb9b8386329 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -444,44 +444,51 @@ AcpiDbExecute ( ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } - else + + NameString = ACPI_ALLOCATE (strlen (Name) + 1); + if (!NameString) { - NameString = ACPI_ALLOCATE (strlen (Name) + 1); - if (!NameString) - { - return; - } + return; + } - memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + strcpy (NameString, Name); + AcpiUtStrupr (NameString); - strcpy (NameString, Name); - AcpiUtStrupr (NameString); - AcpiGbl_DbMethodInfo.Name = NameString; - AcpiGbl_DbMethodInfo.Args = Args; - AcpiGbl_DbMethodInfo.Types = Types; - AcpiGbl_DbMethodInfo.Flags = Flags; + /* Subcommand to Execute all predefined names in the namespace */ - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + if (!strncmp (NameString, "PREDEF", 6)) + { + AcpiDbEvaluatePredefinedNames (); + ACPI_FREE (NameString); + return; + } - Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (NameString); - return; - } + AcpiGbl_DbMethodInfo.Name = NameString; + AcpiGbl_DbMethodInfo.Args = Args; + AcpiGbl_DbMethodInfo.Types = Types; + AcpiGbl_DbMethodInfo.Flags = Flags; - /* Get the NS node, determines existence also */ + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, - &AcpiGbl_DbMethodInfo.Method); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, - &ReturnObj); - } + Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { ACPI_FREE (NameString); + return; + } + + /* Get the NS node, determines existence also */ + + Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, + &AcpiGbl_DbMethodInfo.Method); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, + &ReturnObj); } + ACPI_FREE (NameString); /* * Allow any handlers in separate threads to complete. diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 9a71beb1f98f..e2fa43274d34 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -298,6 +298,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " \"Ascii String\"", "String method argument\n"}, {1, " (Hex Byte List)", "Buffer method argument\n"}, {1, " [Package Element List]", "Package method argument\n"}, + {5, " Execute predefined", "Execute all predefined (public) methods\n"}, {1, " Go", "Allow method to run to completion\n"}, {1, " Information", "Display info about the current method\n"}, {1, " Into", "Step into (not over) a method call\n"}, diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index 740dcf9a308b..5affd51f932b 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -53,6 +53,15 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbmethod") +/* Local prototypes */ + +static ACPI_STATUS +AcpiDbWalkForExecute ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + /******************************************************************************* * @@ -414,3 +423,139 @@ AcpiDbDisassembleMethod ( AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); return (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: AcpiDbWalkForExecute + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Batch execution module. Currently only executes predefined + * ACPI names. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForExecute ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; + char *Pathname; + UINT32 i; + ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT_LIST ParamObjects; + ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + const ACPI_PREDEFINED_INFO *Predefined; + + + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); + if (!Predefined) + { + return (AE_OK); + } + + if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) + { + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); + } + + /* Get the object info for number of method parameters */ + + Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParamObjects.Pointer = NULL; + ParamObjects.Count = 0; + + if (ObjInfo->Type == ACPI_TYPE_METHOD) + { + /* Setup default parameters */ + + for (i = 0; i < ObjInfo->ParamCount; i++) + { + Params[i].Type = ACPI_TYPE_INTEGER; + Params[i].Integer.Value = 1; + } + + ParamObjects.Pointer = Params; + ParamObjects.Count = ObjInfo->ParamCount; + } + + ACPI_FREE (ObjInfo); + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + + /* Do the actual method execution */ + + AcpiGbl_MethodExecuting = TRUE; + + Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); + + AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); + AcpiGbl_MethodExecuting = FALSE; + ACPI_FREE (Pathname); + + /* Ignore status from method execution */ + + Status = AE_OK; + + /* Update count, check if we have executed enough methods */ + + Info->Count++; + if (Info->Count >= Info->MaxCount) + { + Status = AE_CTRL_TERMINATE; + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbEvaluatePredefinedNames + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Namespace batch execution. Execute predefined names in the + * namespace, up to the max count, if specified. + * + ******************************************************************************/ + +void +AcpiDbEvaluatePredefinedNames ( + void) +{ + ACPI_DB_EXECUTE_WALK Info; + + + Info.Count = 0; + Info.MaxCount = ACPI_UINT32_MAX; + + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); + + AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); +} diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index c725becbb7cb..c00800f0bccf 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -514,7 +514,7 @@ AcpiDmI2cSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -597,7 +597,7 @@ AcpiDmSpiSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -683,7 +683,7 @@ AcpiDmUartSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 334dadcac664..4c4ff2270127 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -107,12 +107,15 @@ AcpiDsAutoSerializeMethod ( "Method auto-serialization parse [%4.4s] %p\n", AcpiUtGetNodeName (Node), Node)); + AcpiExEnterInterpreter (); + /* Create/Init a root op for the method parse tree */ Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart); if (!Op) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Unlock; } AcpiPsSetName (Op, Node->Name.Integer); @@ -124,7 +127,8 @@ AcpiDsAutoSerializeMethod ( if (!WalkState) { AcpiPsFreeOp (Op); - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Unlock; } Status = AcpiDsInitAmlWalk (WalkState, Op, Node, @@ -143,6 +147,8 @@ AcpiDsAutoSerializeMethod ( Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); +Unlock: + AcpiExExitInterpreter (); return_ACPI_STATUS (Status); } @@ -810,7 +816,9 @@ AcpiDsTerminateControlMethod ( { /* Delete any direct children of (created by) this method */ + (void) AcpiExExitInterpreter (); AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode); + (void) AcpiExEnterInterpreter (); /* * Delete any objects that were created by this method @@ -821,7 +829,9 @@ AcpiDsTerminateControlMethod ( */ if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) { + (void) AcpiExExitInterpreter (); AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + (void) AcpiExEnterInterpreter (); MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE; } diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 307af607a843..e284fca5d957 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -144,7 +144,8 @@ AcpiDsGetPredicateValue ( * Result of predicate evaluation must be an Integer * object. Implicitly convert the argument if necessary. */ - Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16); + Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, + ACPI_STRTOUL_BASE16); if (ACPI_FAILURE (Status)) { goto Cleanup; diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 2c099ef0f035..ae076e2587ca 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -624,16 +624,12 @@ AcpiDsLoad2EndOp ( { return_ACPI_STATUS (Status); } - - AcpiExExitInterpreter (); } + AcpiExExitInterpreter (); Status = AcpiEvInitializeRegion ( AcpiNsGetAttachedObject (Node), FALSE); - if (WalkState->MethodNode) - { - AcpiExEnterInterpreter (); - } + AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index d683bfdfaa8e..31228949a2aa 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -149,6 +149,70 @@ AcpiEvEnableGpe ( /******************************************************************************* * + * FUNCTION: AcpiEvMaskGpe + * + * PARAMETERS: GpeEventInfo - GPE to be blocked/unblocked + * IsMasked - Whether the GPE is masked or not + * + * RETURN: Status + * + * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvMaskGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN IsMasked) +{ + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + UINT32 RegisterBit; + + + ACPI_FUNCTION_TRACE (EvMaskGpe); + + + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); + + /* Perform the action */ + + if (IsMasked) + { + if (RegisterBit & GpeRegisterInfo->MaskForRun) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + ACPI_SET_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit); + } + else + { + if (!(RegisterBit & GpeRegisterInfo->MaskForRun)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + ACPI_CLEAR_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit); + if (GpeEventInfo->RuntimeCount && + !GpeEventInfo->DisableForDispatch) + { + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); + } + } + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiEvAddGpeReference * * PARAMETERS: GpeEventInfo - Add a reference to this GPE @@ -715,6 +779,7 @@ AcpiEvFinishGpe ( * in the EventInfo. */ (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); + GpeEventInfo->DisableForDispatch = FALSE; return (AE_OK); } @@ -784,6 +849,8 @@ AcpiEvGpeDispatch ( } } + GpeEventInfo->DisableForDispatch = TRUE; + /* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index 8e2fd340230b..0156ee28035c 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -336,7 +336,9 @@ AcpiEvMatchGpeMethod ( ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; UINT32 GpeNumber; + UINT8 TempGpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; @@ -395,8 +397,8 @@ AcpiEvMatchGpeMethod ( /* 4) The last two characters of the name are the hex GPE Number */ - GpeNumber = strtoul (&Name[2], NULL, 16); - if (GpeNumber == ACPI_UINT32_MAX) + Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber); + if (ACPI_FAILURE (Status)) { /* Conversion failed; invalid method, just ignore it */ @@ -408,6 +410,7 @@ AcpiEvMatchGpeMethod ( /* Ensure that we have a valid GPE number for this GPE block */ + GpeNumber = (UINT32) TempGpeNumber; GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock); if (!GpeEventInfo) { diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c index a9e6be03919f..51e3ce99aa73 100644 --- a/source/components/events/evrgnini.c +++ b/source/components/events/evrgnini.c @@ -618,7 +618,8 @@ AcpiEvInitializeRegion ( * * See AcpiNsExecModuleCode */ - if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) + if (!AcpiGbl_ParseTableAsTermList && + ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { HandlerObj = ObjDesc->Method.Dispatch.Handler; } diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 1d467d9abc1b..e3367032b8ff 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -271,11 +271,13 @@ AcpiSetGpe ( case ACPI_GPE_ENABLE: Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); + GpeEventInfo->DisableForDispatch = FALSE; break; case ACPI_GPE_DISABLE: Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + GpeEventInfo->DisableForDispatch = TRUE; break; default: @@ -294,6 +296,56 @@ ACPI_EXPORT_SYMBOL (AcpiSetGpe) /******************************************************************************* * + * FUNCTION: AcpiMaskGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * IsMasked - Whether the GPE is masked or not + * + * RETURN: Status + * + * DESCRIPTION: Unconditionally mask/unmask the an individual GPE, ex., to + * prevent a GPE flooding. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiMaskGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + BOOLEAN IsMasked) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiMaskGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiEvMaskGpe (GpeEventInfo, IsMasked); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiMaskGpe) + + +/******************************************************************************* + * * FUNCTION: AcpiMarkGpeForWake * * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 diff --git a/source/components/executer/exconcat.c b/source/components/executer/exconcat.c index 49b279ad05d1..22091b5bde3d 100644 --- a/source/components/executer/exconcat.c +++ b/source/components/executer/exconcat.c @@ -164,7 +164,8 @@ AcpiExDoConcatenate ( { case ACPI_TYPE_INTEGER: - Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, 16); + Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, + ACPI_STRTOUL_BASE16); break; case ACPI_TYPE_BUFFER: diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index bb0d2bb411d1..7e2f6996cf3e 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -59,7 +59,6 @@ static ACPI_STATUS AcpiExAddTable ( UINT32 TableIndex, - ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle); static ACPI_STATUS @@ -87,12 +86,9 @@ AcpiExRegionRead ( static ACPI_STATUS AcpiExAddTable ( UINT32 TableIndex, - ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (ExAddTable); @@ -110,42 +106,8 @@ AcpiExAddTable ( ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; - *DdbHandle = ObjDesc; - - /* Install the new table into the local data structures */ - ObjDesc->Reference.Value = TableIndex; - - /* Add the table to the namespace */ - - Status = AcpiNsLoadTable (TableIndex, ParentNode); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - *DdbHandle = NULL; - return_ACPI_STATUS (Status); - } - - /* Execute any module-level code that was found in the table */ - - AcpiExExitInterpreter (); - if (AcpiGbl_GroupModuleLevelCode) - { - AcpiNsExecModuleCodeList (); - } - AcpiExEnterInterpreter (); - - /* - * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is - * responsible for discovering any new wake GPEs by running _PRW methods - * that may have been loaded by this table. - */ - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_SUCCESS (Status)) - { - AcpiEvUpdateGpes (OwnerId); - } - + *DdbHandle = ObjDesc; return_ACPI_STATUS (AE_OK); } @@ -174,7 +136,6 @@ AcpiExLoadTableOp ( ACPI_NAMESPACE_NODE *StartNode; ACPI_NAMESPACE_NODE *ParameterNode = NULL; ACPI_OPERAND_OBJECT *DdbHandle; - ACPI_TABLE_HEADER *Table; UINT32 TableIndex; @@ -183,10 +144,12 @@ AcpiExLoadTableOp ( /* Find the ACPI table in the RSDT/XSDT */ + AcpiExExitInterpreter (); Status = AcpiTbFindTable ( Operand[0]->String.Pointer, Operand[1]->String.Pointer, Operand[2]->String.Pointer, &TableIndex); + AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { if (Status != AE_NOT_FOUND) @@ -219,8 +182,9 @@ AcpiExLoadTableOp ( * Find the node referenced by the RootPathString. This is the * location within the namespace where the table will be loaded. */ - Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParentNode); + Status = AcpiNsGetNodeUnlocked (StartNode, + Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT, + &ParentNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -243,8 +207,9 @@ AcpiExLoadTableOp ( /* Find the node referenced by the ParameterPathString */ - Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer, - ACPI_NS_SEARCH_PARENT, &ParameterNode); + Status = AcpiNsGetNodeUnlocked (StartNode, + Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT, + &ParameterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -253,7 +218,16 @@ AcpiExLoadTableOp ( /* Load the table into the namespace */ - Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle); + ACPI_INFO (("Dynamic OEM Table Load:")); + AcpiExExitInterpreter (); + Status = AcpiTbLoadTable (TableIndex, ParentNode); + AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiExAddTable (TableIndex, &DdbHandle); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -276,21 +250,6 @@ AcpiExLoadTableOp ( } } - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_SUCCESS (Status)) - { - ACPI_INFO (("Dynamic OEM Table Load:")); - AcpiTbPrintTableHeader (0, Table); - } - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); - } - *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -520,13 +479,10 @@ AcpiExLoadOp ( /* Install the new table into the local data structures */ ACPI_INFO (("Dynamic OEM Table Load:")); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE, - &TableIndex); - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + AcpiExExitInterpreter (); + Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, &TableIndex); + AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { /* Delete allocated table buffer */ @@ -536,24 +492,13 @@ AcpiExLoadOp ( } /* - * Note: Now table is "INSTALLED", it must be validated before - * loading. - */ - Status = AcpiTbValidateTable ( - &AcpiGbl_RootTableList.Tables[TableIndex]); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* * Add the table to the namespace. * * Note: Load the table objects relative to the root of the namespace. * This appears to go against the ACPI specification, but we do it for * compatibility with other ACPI implementations. */ - Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle); + Status = AcpiExAddTable (TableIndex, &DdbHandle); if (ACPI_FAILURE (Status)) { /* On error, TablePtr was deallocated above */ @@ -577,15 +522,6 @@ AcpiExLoadOp ( /* Remove the reference by added by AcpiExStore above */ AcpiUtRemoveReference (DdbHandle); - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); - } - return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index ea6f82620dd1..5e0f5499aa4a 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -137,8 +137,8 @@ AcpiExConvertToInteger ( * of ACPI 3.0) is that the ToInteger() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). */ - Status = AcpiUtStrtoul64 ((char *) Pointer, Flags, - AcpiGbl_IntegerByteWidth, &Result); + Status = AcpiUtStrtoul64 (ACPI_CAST_PTR (char, Pointer), + (AcpiGbl_IntegerByteWidth | Flags), &Result); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -684,7 +684,8 @@ AcpiExConvertToTargetType ( * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ - Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, 16); + Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, + ACPI_STRTOUL_BASE16); break; case ACPI_TYPE_STRING: diff --git a/source/components/executer/exmisc.c b/source/components/executer/exmisc.c index a8e5497a9de7..21e30f0f570c 100644 --- a/source/components/executer/exmisc.c +++ b/source/components/executer/exmisc.c @@ -360,7 +360,8 @@ AcpiExDoLogicalOp ( { case ACPI_TYPE_INTEGER: - Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16); + Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, + ACPI_STRTOUL_BASE16); break; case ACPI_TYPE_STRING: diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c index 5a45bead06f9..d91d8c55bce3 100644 --- a/source/components/executer/exoparg1.c +++ b/source/components/executer/exoparg1.c @@ -550,8 +550,9 @@ AcpiExOpcode_1A_1T_1R ( case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */ - Status = AcpiExConvertToInteger ( - Operand[0], &ReturnDesc, ACPI_ANY_BASE); + /* Perform "explicit" conversion */ + + Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0); if (ReturnDesc == Operand[0]) { /* No conversion performed, add ref to handle return value */ @@ -936,7 +937,7 @@ AcpiExOpcode_1A_0T_1R ( * 2) Dereference the node to an actual object. Could be a * Field, so we need to resolve the node to a value. */ - Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node, + Status = AcpiNsGetNodeUnlocked (WalkState->ScopeInfo->Scope.Node, Operand[0]->String.Pointer, ACPI_NS_SEARCH_PARENT, ACPI_CAST_INDIRECT_PTR ( diff --git a/source/components/executer/exresop.c b/source/components/executer/exresop.c index 32ceb6f0217b..d4352e297c16 100644 --- a/source/components/executer/exresop.c +++ b/source/components/executer/exresop.c @@ -428,11 +428,13 @@ AcpiExResolveOperands ( case ARGI_INTEGER: /* - * Need an operand of type ACPI_TYPE_INTEGER, - * But we can implicitly convert from a STRING or BUFFER - * Aka - "Implicit Source Operand Conversion" + * Need an operand of type ACPI_TYPE_INTEGER, but we can + * implicitly convert from a STRING or BUFFER. + * + * Known as "Implicit Source Operand Conversion" */ - Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16); + Status = AcpiExConvertToInteger (ObjDesc, StackPtr, + ACPI_STRTOUL_BASE16); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) diff --git a/source/components/executer/extrace.c b/source/components/executer/extrace.c index 6f8a707ae417..6eaf6e70d630 100644 --- a/source/components/executer/extrace.c +++ b/source/components/executer/extrace.c @@ -226,7 +226,6 @@ AcpiExStartTraceMethod ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status; char *Pathname = NULL; BOOLEAN Enabled = FALSE; @@ -239,12 +238,6 @@ AcpiExStartTraceMethod ( Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - Enabled = AcpiExInterpreterTraceEnabled (Pathname); if (Enabled && !AcpiGbl_TraceMethodObject) { @@ -265,9 +258,6 @@ AcpiExStartTraceMethod ( } } - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -Exit: if (Enabled) { ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE, @@ -302,7 +292,6 @@ AcpiExStopTraceMethod ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status; char *Pathname = NULL; BOOLEAN Enabled; @@ -315,28 +304,14 @@ AcpiExStopTraceMethod ( Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE); } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto ExitPath; - } - Enabled = AcpiExInterpreterTraceEnabled (NULL); - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (Enabled) { ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE, ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname); } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto ExitPath; - } - /* Check whether the tracer should be stopped */ if (AcpiGbl_TraceMethodObject == ObjDesc) @@ -353,9 +328,6 @@ AcpiExStopTraceMethod ( AcpiGbl_TraceMethodObject = NULL; } - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -ExitPath: if (Pathname) { ACPI_FREE (Pathname); diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index 4843a2089143..edaee5526bec 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -103,6 +103,11 @@ AcpiExEnterInterpreter ( { ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex")); } + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not acquire AML Namespace mutex")); + } return_VOID; } @@ -141,6 +146,11 @@ AcpiExExitInterpreter ( ACPI_FUNCTION_TRACE (ExExitInterpreter); + Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not release AML Namespace mutex")); + } Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); if (ACPI_FAILURE (Status)) { diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index 3dbf10ba0a40..ac9934db4f19 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -108,7 +108,7 @@ AcpiHwLowSetGpe ( UINT32 Action) { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; UINT32 EnableMask; UINT32 RegisterBit; @@ -164,9 +164,12 @@ AcpiHwLowSetGpe ( return (AE_BAD_PARAMETER); } - /* Write the updated enable mask */ + if (!(RegisterBit & GpeRegisterInfo->MaskForRun)) + { + /* Write the updated enable mask */ - Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + } return (Status); } @@ -269,6 +272,13 @@ AcpiHwGetGpeStatus ( LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; } + /* GPE currently masked? (masked for runtime?) */ + + if (RegisterBit & GpeRegisterInfo->MaskForRun) + { + LocalEventStatus |= ACPI_EVENT_FLAG_MASKED; + } + /* GPE enabled for wake? */ if (RegisterBit & GpeRegisterInfo->EnableForWake) @@ -440,6 +450,7 @@ AcpiHwEnableRuntimeGpeBlock ( UINT32 i; ACPI_STATUS Status; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + UINT8 EnableMask; /* NOTE: assumes that all GPEs are currently disabled */ @@ -456,8 +467,9 @@ AcpiHwEnableRuntimeGpeBlock ( /* Enable all "runtime" GPEs in this register */ - Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun, - GpeRegisterInfo); + EnableMask = GpeRegisterInfo->EnableForRun & + ~GpeRegisterInfo->MaskForRun; + Status = AcpiHwGpeEnableWrite (EnableMask, GpeRegisterInfo); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index 2fa182eddcff..7ce98a5244cd 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -84,7 +84,7 @@ AcpiNsConvertToInteger ( /* String-to-Integer conversion */ Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, - ACPI_ANY_BASE, AcpiGbl_IntegerByteWidth, &Value); + AcpiGbl_IntegerByteWidth, &Value); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index 9c899e784619..6e11d6b70624 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -46,6 +46,7 @@ #include "acnamesp.h" #include "acdispat.h" #include "actables.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE @@ -89,21 +90,6 @@ AcpiNsLoadTable ( ACPI_FUNCTION_TRACE (NsLoadTable); - /* - * Parse the table and load the namespace with all named - * objects found within. Control methods are NOT parsed - * at this time. In fact, the control methods cannot be - * parsed until the entire namespace is loaded, because - * if a control method makes a forward reference (call) - * to another control method, we can't continue parsing - * because we don't know how many arguments to parse next! - */ - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* If table already loaded into namespace, just return */ if (AcpiTbIsTableLoaded (TableIndex)) @@ -121,6 +107,15 @@ AcpiNsLoadTable ( goto Unlock; } + /* + * Parse the table and load the namespace with all named + * objects found within. Control methods are NOT parsed + * at this time. In fact, the control methods cannot be + * parsed until the entire namespace is loaded, because + * if a control method makes a forward reference (call) + * to another control method, we can't continue parsing + * because we don't know how many arguments to parse next! + */ Status = AcpiNsParseTable (TableIndex, Node); if (ACPI_SUCCESS (Status)) { @@ -137,7 +132,6 @@ AcpiNsLoadTable ( * exist. This target of Scope must already exist in the * namespace, as per the ACPI specification. */ - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); AcpiNsDeleteNamespaceByOwner ( AcpiGbl_RootTableList.Tables[TableIndex].OwnerId); @@ -146,8 +140,6 @@ AcpiNsLoadTable ( } Unlock: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -180,7 +172,7 @@ Unlock: * other ACPI implementations. Optionally, the execution can be deferred * until later, see AcpiInitializeObjects. */ - if (!AcpiGbl_GroupModuleLevelCode) + if (!AcpiGbl_ParseTableAsTermList && !AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); } diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index 1ff33362ed1a..95f6da6ba588 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -47,6 +47,7 @@ #include "acparser.h" #include "acdispat.h" #include "actables.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE @@ -55,6 +56,109 @@ /******************************************************************************* * + * FUNCTION: NsExecuteTable + * + * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse + * StartNode - Where to enter the table into the namespace + * + * RETURN: Status + * + * DESCRIPTION: Load ACPI/AML table by executing the entire table as a + * TermList. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsExecuteTable ( + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *StartNode) +{ + ACPI_STATUS Status; + ACPI_TABLE_HEADER *Table; + ACPI_OWNER_ID OwnerId; + ACPI_EVALUATE_INFO *Info = NULL; + UINT32 AmlLength; + UINT8 *AmlStart; + ACPI_OPERAND_OBJECT *MethodObj = NULL; + + + ACPI_FUNCTION_TRACE (NsExecuteTable); + + + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Table must consist of at least a complete header */ + + if (Table->Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_BAD_HEADER); + } + + AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); + AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); + + Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Create, initialize, and link a new temporary method object */ + + MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + if (!MethodObj) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Allocate the evaluation information block */ + + Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); + if (!Info) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Create table code block: %p\n", MethodObj)); + + MethodObj->Method.AmlStart = AmlStart; + MethodObj->Method.AmlLength = AmlLength; + MethodObj->Method.OwnerId = OwnerId; + MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL; + + Info->PassNumber = ACPI_IMODE_EXECUTE; + Info->Node = StartNode; + Info->ObjDesc = MethodObj; + Info->NodeFlags = Info->Node->Flags; + Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); + if (!Info->FullPathname) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + Status = AcpiPsExecuteTable (Info); + +Cleanup: + if (Info) + { + ACPI_FREE (Info->FullPathname); + Info->FullPathname = NULL; + } + ACPI_FREE (Info); + AcpiUtRemoveReference (MethodObj); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: NsOneCompleteParse * * PARAMETERS: PassNumber - 1 or 2 @@ -156,7 +260,9 @@ AcpiNsOneCompleteParse ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber)); + AcpiExEnterInterpreter (); Status = AcpiPsParseAml (WalkState); + AcpiExExitInterpreter (); Cleanup: AcpiPsDeleteParseTree (ParseRoot); @@ -188,40 +294,53 @@ AcpiNsParseTable ( ACPI_FUNCTION_TRACE (NsParseTable); - /* - * AML Parse, pass 1 - * - * In this pass, we load most of the namespace. Control methods - * are not parsed until later. A parse tree is not created. Instead, - * each Parser Op subtree is deleted when it is finished. This saves - * a great deal of memory, and allows a small cache of parse objects - * to service the entire parse. The second pass of the parse then - * performs another complete parse of the AML. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); - - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, - TableIndex, StartNode); - if (ACPI_FAILURE (Status)) + if (AcpiGbl_ParseTableAsTermList) { - return_ACPI_STATUS (Status); - } + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start load pass\n")); - /* - * AML Parse, pass 2 - * - * In this pass, we resolve forward references and other things - * that could not be completed during the first pass. - * Another complete parse of the AML is performed, but the - * overhead of this is compensated for by the fact that the - * parse objects are all cached. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, - TableIndex, StartNode); - if (ACPI_FAILURE (Status)) + Status = AcpiNsExecuteTable (TableIndex, StartNode); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + else { - return_ACPI_STATUS (Status); + /* + * AML Parse, pass 1 + * + * In this pass, we load most of the namespace. Control methods + * are not parsed until later. A parse tree is not created. + * Instead, each Parser Op subtree is deleted when it is finished. + * This saves a great deal of memory, and allows a small cache of + * parse objects to service the entire parse. The second pass of + * the parse then performs another complete parse of the AML. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); + + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, + TableIndex, StartNode); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * AML Parse, pass 2 + * + * In this pass, we resolve forward references and other things + * that could not be completed during the first pass. + * Another complete parse of the AML is performed, but the + * overhead of this is compensated for by the fact that the + * parse objects are all cached. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, + TableIndex, StartNode); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } return_ACPI_STATUS (Status); diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 72f9105ef5a8..2dafae471940 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -771,7 +771,7 @@ AcpiNsOpensScope ( /******************************************************************************* * - * FUNCTION: AcpiNsGetNode + * FUNCTION: AcpiNsGetNodeUnlocked * * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The * \ (backslash) and ^ (carat) prefixes, and the @@ -787,12 +787,12 @@ AcpiNsOpensScope ( * DESCRIPTION: Look up a name relative to a given scope and return the * corresponding Node. NOTE: Scope can be null. * - * MUTEX: Locks namespace + * MUTEX: Doesn't locks namespace * ******************************************************************************/ ACPI_STATUS -AcpiNsGetNode ( +AcpiNsGetNodeUnlocked ( ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, @@ -803,7 +803,7 @@ AcpiNsGetNode ( char *InternalPath; - ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); + ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname)); /* Simplest case is a null pathname */ @@ -835,14 +835,6 @@ AcpiNsGetNode ( return_ACPI_STATUS (Status); } - /* Must lock namespace during lookup */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - /* Setup lookup scope (search starting point) */ ScopeInfo.Scope.Node = PrefixNode; @@ -858,9 +850,55 @@ AcpiNsGetNode ( Pathname, AcpiFormatException (Status))); } - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - -Cleanup: ACPI_FREE (InternalPath); return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetNode + * + * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The + * \ (backslash) and ^ (carat) prefixes, and the + * . (period) to separate segments are supported. + * PrefixNode - Root of subtree to be searched, or NS_ALL for the + * root of the name space. If Name is fully + * qualified (first INT8 is '\'), the passed value + * of Scope will not be accessed. + * Flags - Used to indicate whether to perform upsearch or + * not. + * ReturnNode - Where the Node is returned + * + * DESCRIPTION: Look up a name relative to a given scope and return the + * corresponding Node. NOTE: Scope can be null. + * + * MUTEX: Locks namespace + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsGetNode ( + ACPI_NAMESPACE_NODE *PrefixNode, + const char *Pathname, + UINT32 Flags, + ACPI_NAMESPACE_NODE **ReturnNode) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname, + Flags, ReturnNode); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 810d97e0e019..8f230320bab4 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -555,8 +555,10 @@ AcpiPsParseAml ( { /* Either the method parse or actual execution failed */ + AcpiExExitInterpreter (); ACPI_ERROR_METHOD ("Method parse/execution failed", WalkState->MethodNode, NULL, Status); + AcpiExEnterInterpreter (); /* Check for possible multi-thread reentrancy problem */ @@ -589,7 +591,8 @@ AcpiPsParseAml ( * cleanup to do */ if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) || + ACPI_PARSE_EXECUTE && + !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) || (ACPI_FAILURE (Status))) { AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); diff --git a/source/components/parser/psxface.c b/source/components/parser/psxface.c index a6fe31648ec2..c85f0e939f33 100644 --- a/source/components/parser/psxface.c +++ b/source/components/parser/psxface.c @@ -275,6 +275,88 @@ Cleanup: /******************************************************************************* * + * FUNCTION: AcpiPsExecuteTable + * + * PARAMETERS: Info - Method info block, contains: + * Node - Node to where the is entered into the + * namespace + * ObjDesc - Pseudo method object describing the AML + * code of the entire table + * PassNumber - Parse or execute pass + * + * RETURN: Status + * + * DESCRIPTION: Execute a table + * + ******************************************************************************/ + +ACPI_STATUS +AcpiPsExecuteTable ( + ACPI_EVALUATE_INFO *Info) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op = NULL; + ACPI_WALK_STATE *WalkState = NULL; + + + ACPI_FUNCTION_TRACE (PsExecuteTable); + + + /* Create and init a Root Node */ + + Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart); + if (!Op) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState ( + Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, + Info->ObjDesc->Method.AmlStart, + Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) + { + WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; + } + + /* + * Parse the AML, WalkState will be deleted by ParseAml + */ + AcpiExEnterInterpreter (); + Status = AcpiPsParseAml (WalkState); + AcpiExExitInterpreter (); + WalkState = NULL; + +Cleanup: + if (WalkState) + { + AcpiDsDeleteWalkState (WalkState); + } + if (Op) + { + AcpiPsDeleteParseTree (Op); + } + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiPsUpdateParameterList * * PARAMETERS: Info - See ACPI_EVALUATE_INFO diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index 31fa25b92e77..11164e2316d9 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -45,6 +45,7 @@ #include "accommon.h" #include "acnamesp.h" #include "actables.h" +#include "acevents.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbdata") @@ -867,3 +868,160 @@ AcpiTbSetTableLoadedFlag ( (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); } + + +/******************************************************************************* + * + * FUNCTION: AcpiTbLoadTable + * + * PARAMETERS: TableIndex - Table index + * ParentNode - Where table index is returned + * + * RETURN: Status + * + * DESCRIPTION: Load an ACPI table + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbLoadTable ( + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *ParentNode) +{ + ACPI_TABLE_HEADER *Table; + ACPI_STATUS Status; + ACPI_OWNER_ID OwnerId; + + + ACPI_FUNCTION_TRACE (TbLoadTable); + + + /* + * Note: Now table is "INSTALLED", it must be validated before + * using. + */ + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiNsLoadTable (TableIndex, ParentNode); + + /* Execute any module-level code that was found in the table */ + + if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) + { + AcpiNsExecModuleCodeList (); + } + + /* + * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is + * responsible for discovering any new wake GPEs by running _PRW methods + * that may have been loaded by this table. + */ + Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); + if (ACPI_SUCCESS (Status)) + { + AcpiEvUpdateGpes (OwnerId); + } + + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, + AcpiGbl_TableHandlerContext); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbInstallAndLoadTable + * + * PARAMETERS: Table - Pointer to the table + * Address - Physical address of the table + * Flags - Allocation flags of the table + * TableIndex - Where table index is returned + * + * RETURN: Status + * + * DESCRIPTION: Install and load an ACPI table + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbInstallAndLoadTable ( + ACPI_TABLE_HEADER *Table, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + BOOLEAN Override, + UINT32 *TableIndex) +{ + ACPI_STATUS Status; + UINT32 i; + ACPI_OWNER_ID OwnerId; + + + ACPI_FUNCTION_TRACE (AcpiLoadTable); + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + + /* Install the table and load it into the namespace */ + + Status = AcpiTbInstallStandardTable (Address, Flags, TRUE, + Override, &i); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* + * Note: Now table is "INSTALLED", it must be validated before + * using. + */ + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); + + /* Execute any module-level code that was found in the table */ + + if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) + { + AcpiNsExecModuleCodeList (); + } + + /* + * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is + * responsible for discovering any new wake GPEs by running _PRW methods + * that may have been loaded by this table. + */ + Status = AcpiTbGetOwnerId (i, &OwnerId); + if (ACPI_SUCCESS (Status)) + { + AcpiEvUpdateGpes (OwnerId); + } + + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, + AcpiGbl_TableHandlerContext); + } + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + +UnlockAndExit: + *TableIndex = i; + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (Status); +} diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index ba49633701d4..b75b52d9d0b9 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -375,8 +375,10 @@ AcpiTbParseFadt ( /* Obtain the DSDT and FACS tables via their addresses within the FADT */ - AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, - ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex); + AcpiTbInstallStandardTable ( + (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, + &AcpiGbl_DsdtIndex); /* If Hardware Reduced flag is set, there is no FACS */ @@ -384,13 +386,17 @@ AcpiTbParseFadt ( { if (AcpiGbl_FADT.Facs) { - AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, - ACPI_SIG_FACS, &AcpiGbl_FacsIndex); + AcpiTbInstallStandardTable ( + (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, + &AcpiGbl_FacsIndex); } if (AcpiGbl_FADT.XFacs) { - AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, &AcpiGbl_XFacsIndex); + AcpiTbInstallStandardTable ( + (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, + &AcpiGbl_XFacsIndex); } } } @@ -593,65 +599,67 @@ AcpiTbConvertFadt ( * * Address32 zero, Address64 [don't care] - Use Address64 * + * No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and: * Address32 non-zero, Address64 zero - Copy/use Address32 * Address32 non-zero == Address64 non-zero - Use Address64 * Address32 non-zero != Address64 non-zero - Warning, use Address64 * * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and: + * Address32 non-zero, Address64 zero - Copy/use Address32 + * Address32 non-zero == Address64 non-zero - Copy/use Address32 * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32 * * Note: SpaceId is always I/O for 32-bit legacy address fields */ if (Address32) { - if (!Address64->Address) - { - /* 64-bit address is zero, use 32-bit address */ - - AcpiTbInitGenericAddress (Address64, - ACPI_ADR_SPACE_SYSTEM_IO, - *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, - FadtInfoTable[i].Length), - (UINT64) Address32, Name, Flags); - } - else if (Address64->Address != (UINT64) Address32) + if (Address64->Address) { - /* Address mismatch */ - - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X address mismatch in FADT/%s: " - "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", - Name, Address32, - ACPI_FORMAT_UINT64 (Address64->Address), - AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); - - if (AcpiGbl_Use32BitFadtAddresses) + if (Address64->Address != (UINT64) Address32) { - /* 32-bit address override */ + /* Address mismatch */ + + ACPI_BIOS_WARNING ((AE_INFO, + "32/64X address mismatch in FADT/%s: " + "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", + Name, Address32, + ACPI_FORMAT_UINT64 (Address64->Address), + AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); + } - AcpiTbInitGenericAddress (Address64, - ACPI_ADR_SPACE_SYSTEM_IO, - *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, - FadtInfoTable[i].Length), - (UINT64) Address32, Name, Flags); + /* + * For each extended field, check for length mismatch + * between the legacy length field and the corresponding + * 64-bit X length field. + * Note: If the legacy length field is > 0xFF bits, ignore + * this check. (GPE registers can be larger than the + * 64-bit GAS structure can accomodate, 0xFF bits). + */ + if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) && + (Address64->BitWidth != ACPI_MUL_8 (Length))) + { + ACPI_BIOS_WARNING ((AE_INFO, + "32/64X length mismatch in FADT/%s: %u/%u", + Name, ACPI_MUL_8 (Length), Address64->BitWidth)); } } - } - /* - * For each extended field, check for length mismatch between the - * legacy length field and the corresponding 64-bit X length field. - * Note: If the legacy length field is > 0xFF bits, ignore this - * check. (GPE registers can be larger than the 64-bit GAS structure - * can accomodate, 0xFF bits). - */ - if (Address64->Address && - (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) && - (Address64->BitWidth != ACPI_MUL_8 (Length))) - { - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X length mismatch in FADT/%s: %u/%u", - Name, ACPI_MUL_8 (Length), Address64->BitWidth)); + /* + * Hardware register access code always uses the 64-bit fields. + * So if the 64-bit field is zero or is to be overridden, + * initialize it with the 32-bit fields. + * Note that when the 32-bit address favor is specified, the + * 64-bit fields are always re-initialized so that + * AccessSize/BitWidth/BitOffset fields can be correctly + * configured to the values to trigger a 32-bit compatible + * access mode in the hardware register access code. + */ + if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses) + { + AcpiTbInitGenericAddress (Address64, + ACPI_ADR_SPACE_SYSTEM_IO, Length, + (UINT64) Address32, Name, Flags); + } } if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED) diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index 32839a3cd328..663e85285eab 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -73,7 +73,7 @@ AcpiTbFindTable ( char *OemTableId, UINT32 *TableIndex) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; ACPI_TABLE_HEADER Header; UINT32 i; @@ -105,6 +105,7 @@ AcpiTbFindTable ( /* Search for the table */ + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature), @@ -124,7 +125,7 @@ AcpiTbFindTable ( Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto UnlockAndExit; } if (!AcpiGbl_RootTableList.Tables[i].Pointer) @@ -148,9 +149,12 @@ AcpiTbFindTable ( ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", Header.Signature)); - return_ACPI_STATUS (AE_OK); + goto UnlockAndExit; } } + Status = AE_NOT_FOUND; +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (AE_NOT_FOUND); } diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index 78e8b4ec8bf6..bb8f127cc712 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -169,74 +169,6 @@ AcpiTbInstallTableWithOverride ( /******************************************************************************* * - * FUNCTION: AcpiTbInstallFixedTable - * - * PARAMETERS: Address - Physical address of DSDT or FACS - * Signature - Table signature, NULL if no need to - * match - * TableIndex - Where the table index is returned - * - * RETURN: Status - * - * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data - * structure. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbInstallFixedTable ( - ACPI_PHYSICAL_ADDRESS Address, - char *Signature, - UINT32 *TableIndex) -{ - ACPI_TABLE_DESC NewTableDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (TbInstallFixedTable); - - - if (!Address) - { - ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]", - Signature)); - return (AE_NO_MEMORY); - } - - /* Fill a table descriptor for validation */ - - Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", - ACPI_FORMAT_UINT64 (Address))); - return_ACPI_STATUS (Status); - } - - /* Validate and verify a table before installation */ - - Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature); - if (ACPI_FAILURE (Status)) - { - goto ReleaseAndExit; - } - - /* Add the table to the global root table list */ - - AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex); - -ReleaseAndExit: - - /* Release the temporary table descriptor */ - - AcpiTbReleaseTempTable (&NewTableDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiTbInstallStandardTable * * PARAMETERS: Address - Address of the table (might be a virtual @@ -248,8 +180,7 @@ ReleaseAndExit: * * RETURN: Status * - * DESCRIPTION: This function is called to install an ACPI table that is - * neither DSDT nor FACS (a "standard" table.) + * DESCRIPTION: This function is called to verify and install an ACPI table. * When this function is called by "Load" or "LoadTable" opcodes, * or by AcpiLoadTable() API, the "Reload" parameter is set. * After sucessfully returning from this function, table is @@ -390,6 +321,14 @@ AcpiTbInstallStandardTable ( AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex); + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_INSTALL, + NewTableDesc.Pointer, AcpiGbl_TableHandlerContext); + } + ReleaseAndExit: /* Release the temporary table descriptor */ diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 9fc26bdad1be..bebfc119f3fb 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -111,7 +111,7 @@ AcpiLoadTables ( "While loading namespace from ACPI tables")); } - if (!AcpiGbl_GroupModuleLevelCode) + if (AcpiGbl_ParseTableAsTermList || !AcpiGbl_GroupModuleLevelCode) { /* * Initialize the objects that remain uninitialized. This @@ -207,11 +207,11 @@ AcpiTbLoadNamespace ( memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - /* Load and parse tables */ + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed")); @@ -224,7 +224,6 @@ AcpiTbLoadNamespace ( /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { Table = &AcpiGbl_RootTableList.Tables[i]; @@ -242,6 +241,7 @@ AcpiTbLoadNamespace ( (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table", @@ -257,8 +257,6 @@ AcpiTbLoadNamespace ( { TablesLoaded++; } - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } if (!TablesFailed) @@ -366,52 +364,11 @@ AcpiLoadTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Must acquire the interpreter lock during this operation */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Install the table and load it into the namespace */ ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), - ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE, - &TableIndex); - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* - * Note: Now table is "INSTALLED", it must be validated before - * using. - */ - Status = AcpiTbValidateTable ( - &AcpiGbl_RootTableList.Tables[TableIndex]); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode); - - /* Invoke table handler if present */ - - if (AcpiGbl_TableHandler) - { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, - AcpiGbl_TableHandlerContext); - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex); return_ACPI_STATUS (Status); } diff --git a/source/components/utilities/utaddress.c b/source/components/utilities/utaddress.c index 4b36391e2482..2bf313fc74e4 100644 --- a/source/components/utilities/utaddress.c +++ b/source/components/utilities/utaddress.c @@ -82,7 +82,6 @@ AcpiUtAddAddressRange ( ACPI_NAMESPACE_NODE *RegionNode) { ACPI_ADDRESS_RANGE *RangeInfo; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE (UtAddAddressRange); @@ -106,13 +105,6 @@ AcpiUtAddAddressRange ( RangeInfo->EndAddress = (Address + Length - 1); RangeInfo->RegionNode = RegionNode; - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (RangeInfo); - return_ACPI_STATUS (Status); - } - RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId]; AcpiGbl_AddressRangeList[SpaceId] = RangeInfo; @@ -122,7 +114,6 @@ AcpiUtAddAddressRange ( ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_OK); } diff --git a/source/components/utilities/uthex.c b/source/components/utilities/uthex.c index b93013b200fc..94f6a7f97871 100644 --- a/source/components/utilities/uthex.c +++ b/source/components/utilities/uthex.c @@ -82,9 +82,46 @@ AcpiUtHexToAsciiChar ( /******************************************************************************* * + * FUNCTION: AcpiUtAsciiToHexByte + * + * PARAMETERS: TwoAsciiChars - Pointer to two ASCII characters + * ReturnByte - Where converted byte is returned + * + * RETURN: Status and converted hex byte + * + * DESCRIPTION: Perform ascii-to-hex translation, exactly two ASCII characters + * to a single converted byte value. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtAsciiToHexByte ( + char *TwoAsciiChars, + UINT8 *ReturnByte) +{ + + /* Both ASCII characters must be valid hex digits */ + + if (!isxdigit ((int) TwoAsciiChars[0]) || + !isxdigit ((int) TwoAsciiChars[1])) + { + return (AE_BAD_HEX_CONSTANT); + } + + *ReturnByte = + AcpiUtAsciiCharToHex (TwoAsciiChars[1]) | + (AcpiUtAsciiCharToHex (TwoAsciiChars[0]) << 4); + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtAsciiCharToHex * - * PARAMETERS: HexChar - Hex character in Ascii + * PARAMETERS: HexChar - Hex character in Ascii. Must be: + * 0-9 or A-F or a-f * * RETURN: The binary value of the ascii/hex character * @@ -97,15 +134,21 @@ AcpiUtAsciiCharToHex ( int HexChar) { - if (HexChar <= 0x39) + /* Values 0-9 */ + + if (HexChar <= '9') { - return ((UINT8) (HexChar - 0x30)); + return ((UINT8) (HexChar - '0')); } - if (HexChar <= 0x46) + /* Upper case A-F */ + + if (HexChar <= 'F') { return ((UINT8) (HexChar - 0x37)); } + /* Lower case a-f */ + return ((UINT8) (HexChar - 0x57)); } diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c index 70fb33e64c0c..4cddcf190b50 100644 --- a/source/components/utilities/utnonansi.c +++ b/source/components/utilities/utnonansi.c @@ -48,10 +48,9 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utnonansi") - /* - * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit - * version of strtoul. + * Non-ANSI C library functions - strlwr, strupr, stricmp, and "safe" + * string functions. */ /******************************************************************************* @@ -238,430 +237,3 @@ AcpiUtSafeStrncat ( return (FALSE); } #endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * Base - Radix of the string: 16 or 10 or - * ACPI_ANY_BASE - * MaxIntegerByteWidth - Maximum allowable integer,in bytes: - * 4 or 8 (32 or 64 bits) - * RetInteger - Where the converted integer is - * returned - * - * RETURN: Status and Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. Performs either a - * 32-bit or 64-bit conversion, depending on the input integer - * size (often the current mode of the interpreter). - * - * NOTES: Negative numbers are not supported, as they are not supported - * by ACPI. - * - * AcpiGbl_IntegerByteWidth should be set to the proper width. - * For the core ACPICA code, this width depends on the DSDT - * version. For iASL, the default byte width is always 8 for the - * parser, but error checking is performed later to flag cases - * where a 64-bit constant is defined in a 32-bit DSDT/SSDT. - * - * Does not support Octal strings, not needed at this time. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT32 Base, - UINT32 MaxIntegerByteWidth, - UINT64 *RetInteger) -{ - UINT32 ThisDigit = 0; - UINT64 ReturnValue = 0; - UINT64 Quotient; - UINT64 Dividend; - UINT8 ValidDigits = 0; - UINT8 SignOf0x = 0; - UINT8 Term = 0; - - - ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); - - - switch (Base) - { - case ACPI_ANY_BASE: - case 10: - case 16: - - break; - - default: - - /* Invalid Base */ - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!String) - { - goto ErrorExit; - } - - /* Skip over any white space in the buffer */ - - while ((*String) && (isspace ((int) *String) || *String == '\t')) - { - String++; - } - - if (Base == ACPI_ANY_BASE) - { - /* - * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'. - * We need to determine if it is decimal or hexadecimal. - */ - if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) - { - SignOf0x = 1; - Base = 16; - - /* Skip over the leading '0x' */ - String += 2; - } - else - { - Base = 10; - } - } - - /* Any string left? Check that '0x' is not followed by white space. */ - - if (!(*String) || isspace ((int) *String) || *String == '\t') - { - if (Base == ACPI_ANY_BASE) - { - goto ErrorExit; - } - else - { - goto AllDone; - } - } - - /* - * Perform a 32-bit or 64-bit conversion, depending upon the input - * byte width - */ - Dividend = (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH) ? - ACPI_UINT32_MAX : ACPI_UINT64_MAX; - - /* Main loop: convert the string to a 32- or 64-bit integer */ - - while (*String) - { - if (isdigit ((int) *String)) - { - /* Convert ASCII 0-9 to Decimal value */ - - ThisDigit = ((UINT8) *String) - '0'; - } - else if (Base == 10) - { - /* Digit is out of range; possible in ToInteger case only */ - - Term = 1; - } - else - { - ThisDigit = (UINT8) toupper ((int) *String); - if (isxdigit ((int) ThisDigit)) - { - /* Convert ASCII Hex char to value */ - - ThisDigit = ThisDigit - 'A' + 10; - } - else - { - Term = 1; - } - } - - if (Term) - { - if (Base == ACPI_ANY_BASE) - { - goto ErrorExit; - } - else - { - break; - } - } - else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) - { - /* Skip zeros */ - String++; - continue; - } - - ValidDigits++; - - if (SignOf0x && ((ValidDigits > 16) || - ((ValidDigits > 8) && (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH)))) - { - /* - * This is ToInteger operation case. - * No restrictions for string-to-integer conversion, - * see ACPI spec. - */ - goto ErrorExit; - } - - /* Divide the digit into the correct position */ - - (void) AcpiUtShortDivide ( - (Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL); - - if (ReturnValue > Quotient) - { - if (Base == ACPI_ANY_BASE) - { - goto ErrorExit; - } - else - { - break; - } - } - - ReturnValue *= Base; - ReturnValue += ThisDigit; - String++; - } - - /* All done, normal exit */ - -AllDone: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ReturnValue))); - - *RetInteger = ReturnValue; - return_ACPI_STATUS (AE_OK); - - -ErrorExit: - - /* Base was set/validated above (10 or 16) */ - - if (Base == 10) - { - return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); - } - else - { - return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); - } -} - - -#ifdef _OBSOLETE_FUNCTIONS -/* Removed: 01/2016 */ - -/******************************************************************************* - * - * FUNCTION: strtoul64 - * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte - * is returned - * Base - Radix of the string - * - * RETURN: Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. - * - ******************************************************************************/ - -ACPI_STATUS -strtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) -{ - UINT32 Index; - UINT32 Sign; - UINT64 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - *RetInteger = 0; - - switch (Base) - { - case 0: - case 8: - case 10: - case 16: - - break; - - default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); - } - - /* Skip over any white space in the buffer: */ - - while (isspace ((int) *String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - Sign = ACPI_SIGN_NEGATIVE; - ++String; - } - else if (*String == '+') - { - ++String; - Sign = ACPI_SIGN_POSITIVE; - } - else - { - Sign = ACPI_SIGN_POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (tolower ((int) *(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - tolower ((int) *(++String)) == 'x') - { - String++; - } - - /* Main loop: convert the string to an unsigned long */ - - while (*String) - { - if (isdigit ((int) *String)) - { - Index = ((UINT8) *String) - '0'; - } - else - { - Index = (UINT8) toupper ((int) *String); - if (isupper ((int) Index)) - { - Index = Index - 'A' + 10; - } - else - { - goto ErrorExit; - } - } - - if (Index >= Base) - { - goto ErrorExit; - } - - /* Check to see if value is out of range: */ - - if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / - (UINT64) Base)) - { - goto ErrorExit; - } - else - { - ReturnValue *= Base; - ReturnValue += Index; - } - - ++String; - } - - - /* If a minus sign was present, then "the conversion is negated": */ - - if (Sign == ACPI_SIGN_NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - *RetInteger = ReturnValue; - return (Status); - - -ErrorExit: - switch (Base) - { - case 8: - - Status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - - Status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: - - Status = AE_BAD_HEX_CONSTANT; - break; - - default: - - /* Base validated above */ - - break; - } - - return (Status); -} -#endif diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index 674fe364d375..5193af52411b 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -442,11 +442,22 @@ AcpiUtGetInterface ( * PARAMETERS: WalkState - Current walk state * * RETURN: Status + * Integer: TRUE (0) if input string is matched + * FALSE (-1) if string is not matched * * DESCRIPTION: Implementation of the _OSI predefined control method. When * an invocation of _OSI is encountered in the system AML, * control is transferred to this function. * + * (August 2016) + * Note: _OSI is now defined to return "Ones" to indicate a match, for + * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones + * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF + * (ACPI_UINT64_MAX). + * + * This function always returns ACPI_UINT64_MAX for TRUE, and later code + * will truncate this to 32 bits if necessary. + * ******************************************************************************/ ACPI_STATUS @@ -458,7 +469,7 @@ AcpiUtOsiImplementation ( ACPI_INTERFACE_INFO *InterfaceInfo; ACPI_INTERFACE_HANDLER InterfaceHandler; ACPI_STATUS Status; - UINT32 ReturnValue; + UINT64 ReturnValue; ACPI_FUNCTION_TRACE (UtOsiImplementation); @@ -507,7 +518,7 @@ AcpiUtOsiImplementation ( AcpiGbl_OsiData = InterfaceInfo->Value; } - ReturnValue = ACPI_UINT32_MAX; + ReturnValue = ACPI_UINT64_MAX; } AcpiOsReleaseMutex (AcpiGbl_OsiMutex); @@ -520,8 +531,11 @@ AcpiUtOsiImplementation ( InterfaceHandler = AcpiGbl_InterfaceHandler; if (InterfaceHandler) { - ReturnValue = InterfaceHandler ( - StringDesc->String.Pointer, ReturnValue); + if (InterfaceHandler ( + StringDesc->String.Pointer, (UINT32) ReturnValue)) + { + ReturnValue = ACPI_UINT64_MAX; + } } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, diff --git a/source/components/utilities/utstrtoul64.c b/source/components/utilities/utstrtoul64.c new file mode 100644 index 000000000000..96cf112a4796 --- /dev/null +++ b/source/components/utilities/utstrtoul64.c @@ -0,0 +1,390 @@ +/******************************************************************************* + * + * Module Name: utstrtoul64 - string to 64-bit integer support + * + ******************************************************************************/ + +/* + * 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 "acpi.h" +#include "accommon.h" + + +/******************************************************************************* + * + * The functions in this module satisfy the need for 64-bit string-to-integer + * conversions on both 32-bit and 64-bit platforms. + * + ******************************************************************************/ + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utstrtoul64") + +/* Local prototypes */ + +static UINT64 +AcpiUtStrtoulBase10 ( + char *String, + UINT32 Flags); + +static UINT64 +AcpiUtStrtoulBase16 ( + char *String, + UINT32 Flags); + + +/******************************************************************************* + * + * String conversion rules as written in the ACPI specification. The error + * conditions and behavior are different depending on the type of conversion. + * + * + * Implicit data type conversion: string-to-integer + * -------------------------------------------------- + * + * Base is always 16. This is the ACPI_STRTOUL_BASE16 case. + * + * Example: + * Add ("BA98", Arg0, Local0) + * + * The integer is initialized to the value zero. + * The ASCII string is interpreted as a hexadecimal constant. + * + * 1) A “0x” prefix is not allowed. However, ACPICA allows this for + * compatibility with previous ACPICA. (NO ERROR) + * + * 2) Terminates when the size of an integer is reached (32 or 64 bits). + * (NO ERROR) + * + * 3) The first non-hex character terminates the conversion without error. + * (NO ERROR) + * + * 4) Conversion of a null (zero-length) string to an integer is not + * allowed. However, ACPICA allows this for compatibility with previous + * ACPICA. This conversion returns the value 0. (NO ERROR) + * + * + * Explicit data type conversion: ToInteger() with string operand + * --------------------------------------------------------------- + * + * Base is either 10 (default) or 16 (with 0x prefix) + * + * Examples: + * ToInteger ("1000") + * ToInteger ("0xABCD") + * + * 1) Can be (must be) either a decimal or hexadecimal numeric string. + * A hex value must be prefixed by "0x" or it is interpreted as a decimal. + * + * 2) The value must not exceed the maximum of an integer value. ACPI spec + * states the behavior is "unpredictable", so ACPICA matches the behavior + * of the implicit conversion case.(NO ERROR) + * + * 3) Behavior on the first non-hex character is not specified by the ACPI + * spec, so ACPICA matches the behavior of the implicit conversion case + * and terminates. (NO ERROR) + * + * 4) A null (zero-length) string is illegal. + * However, ACPICA allows this for compatibility with previous ACPICA. + * This conversion returns the value 0. (NO ERROR) + * + ******************************************************************************/ + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoul64 + * + * PARAMETERS: String - Null terminated input string + * Flags - Conversion info, see below + * ReturnValue - Where the converted integer is + * returned + * + * RETURN: Status and Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. Performs either a + * 32-bit or 64-bit conversion, depending on the input integer + * size in Flags (often the current mode of the interpreter). + * + * Values for Flags: + * ACPI_STRTOUL_32BIT - Max integer value is 32 bits + * ACPI_STRTOUL_64BIT - Max integer value is 64 bits + * ACPI_STRTOUL_BASE16 - Input string is hexadecimal. Default + * is 10/16 based on string prefix (0x). + * + * NOTES: + * Negative numbers are not supported, as they are not supported by ACPI. + * + * Supports only base 16 or base 10 strings/values. Does not + * support Octal strings, as these are not supported by ACPI. + * + * Current users of this support: + * + * Interpreter - Implicit and explicit conversions, GPE method names + * Debugger - Command line input string conversion + * iASL - Main parser, conversion of constants to integers + * iASL - Data Table Compiler parser (constant math expressions) + * iASL - Preprocessor (constant math expressions) + * AcpiDump - Input table addresses + * AcpiExec - Testing of the AcpiUtStrtoul64 function + * + * Note concerning callers: + * AcpiGbl_IntegerByteWidth can be used to set the 32/64 limit. If used, + * this global should be set to the proper width. For the core ACPICA code, + * this width depends on the DSDT version. For iASL, the default byte + * width is always 8 for the parser, but error checking is performed later + * to flag cases where a 64-bit constant is defined in a 32-bit DSDT/SSDT. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Flags, + UINT64 *ReturnValue) +{ + ACPI_STATUS Status = AE_OK; + UINT32 Base; + + + ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); + + + /* Parameter validation */ + + if (!String || !ReturnValue) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + *ReturnValue = 0; + + /* Check for zero-length string, returns 0 */ + + if (*String == 0) + { + return_ACPI_STATUS (AE_OK); + } + + /* Skip over any white space at start of string */ + + while (isspace ((int) *String)) + { + String++; + } + + /* End of string? return 0 */ + + if (*String == 0) + { + return_ACPI_STATUS (AE_OK); + } + + /* + * 1) The "0x" prefix indicates base 16. Per the ACPI specification, + * the "0x" prefix is only allowed for implicit (non-strict) conversions. + * However, we always allow it for compatibility with older ACPICA. + */ + if ((*String == ACPI_ASCII_ZERO) && + (tolower ((int) *(String + 1)) == 'x')) + { + String += 2; /* Go past the 0x */ + if (*String == 0) + { + return_ACPI_STATUS (AE_OK); /* Return value 0 */ + } + + Base = 16; + } + + /* 2) Force to base 16 (implicit conversion case) */ + + else if (Flags & ACPI_STRTOUL_BASE16) + { + Base = 16; + } + + /* 3) Default fallback is to Base 10 */ + + else + { + Base = 10; + } + + /* Skip all leading zeros */ + + while (*String == ACPI_ASCII_ZERO) + { + String++; + if (*String == 0) + { + return_ACPI_STATUS (AE_OK); /* Return value 0 */ + } + } + + /* Perform the base 16 or 10 conversion */ + + if (Base == 16) + { + *ReturnValue = AcpiUtStrtoulBase16 (String, Flags); + } + else + { + *ReturnValue = AcpiUtStrtoulBase10 (String, Flags); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoulBase10 + * + * PARAMETERS: String - Null terminated input string + * Flags - Conversion info + * + * RETURN: 64-bit converted integer + * + * DESCRIPTION: Performs a base 10 conversion of the input string to an + * integer value, either 32 or 64 bits. + * Note: String must be valid and non-null. + * + ******************************************************************************/ + +static UINT64 +AcpiUtStrtoulBase10 ( + char *String, + UINT32 Flags) +{ + int AsciiDigit; + UINT64 NextValue; + UINT64 ReturnValue = 0; + + + /* Main loop: convert each ASCII byte in the input string */ + + while (*String) + { + AsciiDigit = *String; + if (!isdigit (AsciiDigit)) + { + /* Not ASCII 0-9, terminate */ + + goto Exit; + } + + /* Convert and insert (add) the decimal digit */ + + NextValue = + (ReturnValue * 10) + (AsciiDigit - ACPI_ASCII_ZERO); + + /* Check for overflow (32 or 64 bit) - return current converted value */ + + if (((Flags & ACPI_STRTOUL_32BIT) && (NextValue > ACPI_UINT32_MAX)) || + (NextValue < ReturnValue)) /* 64-bit overflow case */ + { + goto Exit; + } + + ReturnValue = NextValue; + String++; + } + +Exit: + return (ReturnValue); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoulBase16 + * + * PARAMETERS: String - Null terminated input string + * Flags - conversion info + * + * RETURN: 64-bit converted integer + * + * DESCRIPTION: Performs a base 16 conversion of the input string to an + * integer value, either 32 or 64 bits. + * Note: String must be valid and non-null. + * + ******************************************************************************/ + +static UINT64 +AcpiUtStrtoulBase16 ( + char *String, + UINT32 Flags) +{ + int AsciiDigit; + UINT32 ValidDigits = 1; + UINT64 ReturnValue = 0; + + + /* Main loop: convert each ASCII byte in the input string */ + + while (*String) + { + /* Check for overflow (32 or 64 bit) - return current converted value */ + + if ((ValidDigits > 16) || + ((ValidDigits > 8) && (Flags & ACPI_STRTOUL_32BIT))) + { + goto Exit; + } + + AsciiDigit = *String; + if (!isxdigit (AsciiDigit)) + { + /* Not Hex ASCII A-F, a-f, or 0-9, terminate */ + + goto Exit; + } + + /* Convert and insert the hex digit */ + + ReturnValue = + (ReturnValue << 4) | AcpiUtAsciiCharToHex (AsciiDigit); + + String++; + ValidDigits++; + } + +Exit: + return (ReturnValue); +} diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 7d7758815869..6b79e08f72ce 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -293,7 +293,7 @@ AcpiInitializeObjects ( * all of the tables have been loaded. It is a legacy option and is * not compatible with other ACPI implementations. See AcpiNsLoadTable. */ - if (AcpiGbl_GroupModuleLevelCode) + if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); diff --git a/source/include/acdebug.h b/source/include/acdebug.h index 8f3f47175b13..6dfa8a22ced6 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -233,8 +233,8 @@ AcpiDbDisassembleAml ( ACPI_PARSE_OBJECT *Op); void -AcpiDbBatchExecute ( - char *CountArg); +AcpiDbEvaluatePredefinedNames ( + void); /* diff --git a/source/include/acevents.h b/source/include/acevents.h index a14dbe57c1b2..14f2b7925b8e 100644 --- a/source/include/acevents.h +++ b/source/include/acevents.h @@ -116,6 +116,11 @@ AcpiEvEnableGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS +AcpiEvMaskGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN IsMasked); + +ACPI_STATUS AcpiEvAddGpeReference ( ACPI_GPE_EVENT_INFO *GpeEventInfo); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index e7a0d37d1447..9820a89a92f0 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -550,11 +550,12 @@ typedef union acpi_gpe_dispatch_info */ typedef struct acpi_gpe_event_info { - union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */ - struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ - UINT8 Flags; /* Misc info about this GPE */ - UINT8 GpeNumber; /* This GPE */ - UINT8 RuntimeCount; /* References to a run GPE */ + union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */ + struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ + UINT8 Flags; /* Misc info about this GPE */ + UINT8 GpeNumber; /* This GPE */ + UINT8 RuntimeCount; /* References to a run GPE */ + BOOLEAN DisableForDispatch; /* Masked during dispatching */ } ACPI_GPE_EVENT_INFO; @@ -567,6 +568,7 @@ typedef struct acpi_gpe_register_info UINT16 BaseGpeNumber; /* Base GPE number for this register */ UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ UINT8 EnableForRun; /* GPEs to keep enabled when running */ + UINT8 MaskForRun; /* GPEs to keep masked when running */ UINT8 EnableMask; /* Current mask of enabled GPEs */ } ACPI_GPE_REGISTER_INFO; diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 11ee70d044ed..440ff5b940eb 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -144,6 +144,11 @@ AcpiNsParseTable ( ACPI_NAMESPACE_NODE *StartNode); ACPI_STATUS +AcpiNsExecuteTable ( + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *StartNode); + +ACPI_STATUS AcpiNsOneCompleteParse ( UINT32 PassNumber, UINT32 TableIndex, @@ -391,6 +396,13 @@ AcpiNsPatternMatch ( char *SearchFor); ACPI_STATUS +AcpiNsGetNodeUnlocked ( + ACPI_NAMESPACE_NODE *PrefixNode, + const char *ExternalPathname, + UINT32 Flags, + ACPI_NAMESPACE_NODE **OutNode); + +ACPI_STATUS AcpiNsGetNode ( ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, diff --git a/source/include/acparser.h b/source/include/acparser.h index dd2782199d00..4137981024f7 100644 --- a/source/include/acparser.h +++ b/source/include/acparser.h @@ -83,6 +83,10 @@ ACPI_STATUS AcpiPsExecuteMethod ( ACPI_EVALUATE_INFO *Info); +ACPI_STATUS +AcpiPsExecuteTable ( + ACPI_EVALUATE_INFO *Info); + /* * psargs - Parse AML opcode arguments diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 33f000fee2fd..17bab19baad4 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 0x20160729 +#define ACPI_CA_VERSION 0x20160831 #include "acconfig.h" #include "actypes.h" @@ -197,6 +197,13 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE); /* + * Optionally support module level code by parsing the entire table as + * a TermList. Default is FALSE, do not execute entire table until some + * lock order issues are fixed. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_ParseTableAsTermList, FALSE); + +/* * Optionally use 32-bit FADT addresses if and when there is a conflict * (address mismatch) between the 32-bit and 64-bit versions of the * address. Although ACPICA adheres to the ACPI specification which @@ -909,6 +916,13 @@ AcpiFinishGpe ( ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS +AcpiMaskGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + BOOLEAN IsMasked)) + +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS AcpiMarkGpeForWake ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber)) diff --git a/source/include/actables.h b/source/include/actables.h index 6abb14cc3ff4..3325f19e2d1d 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -178,6 +178,19 @@ void AcpiTbUninstallTable ( ACPI_TABLE_DESC *TableDesc); +ACPI_STATUS +AcpiTbLoadTable ( + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *ParentNode); + +ACPI_STATUS +AcpiTbInstallAndLoadTable ( + ACPI_TABLE_HEADER *Table, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + BOOLEAN Override, + UINT32 *TableIndex); + void AcpiTbTerminate ( void); @@ -237,12 +250,6 @@ AcpiTbInstallTableWithOverride ( UINT32 *TableIndex); ACPI_STATUS -AcpiTbInstallFixedTable ( - ACPI_PHYSICAL_ADDRESS Address, - char *Signature, - UINT32 *TableIndex); - -ACPI_STATUS ACPI_INIT_FUNCTION AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); diff --git a/source/include/actypes.h b/source/include/actypes.h index 3861f12d5ba0..0d2ab4cc8ad4 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -745,16 +745,17 @@ typedef UINT32 ACPI_EVENT_TYPE; * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+-+-+ - * | Bits 31:5 |4|3|2|1|0| - * +-------------+-+-+-+-+-+ - * | | | | | | - * | | | | | +- Enabled? - * | | | | +--- Enabled for wake? - * | | | +----- Status bit set? - * | | +------- Enable bit set? - * | +--------- Has a handler? - * +--------------- <Reserved> + * +-------------+-+-+-+-+-+-+ + * | Bits 31:6 |5|4|3|2|1|0| + * +-------------+-+-+-+-+-+-+ + * | | | | | | | + * | | | | | | +- Enabled? + * | | | | | +--- Enabled for wake? + * | | | | +----- Status bit set? + * | | | +------- Enable bit set? + * | | +--------- Has a handler? + * | +----------- Masked? + * +----------------- <Reserved> */ typedef UINT32 ACPI_EVENT_STATUS; @@ -764,6 +765,7 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_STATUS_SET (ACPI_EVENT_STATUS) 0x04 #define ACPI_EVENT_FLAG_ENABLE_SET (ACPI_EVENT_STATUS) 0x08 #define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x10 +#define ACPI_EVENT_FLAG_MASKED (ACPI_EVENT_STATUS) 0x20 #define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ @@ -774,14 +776,15 @@ typedef UINT32 ACPI_EVENT_STATUS; /* * GPE info flags - Per GPE - * +-------+-+-+---+ - * | 7:5 |4|3|2:0| - * +-------+-+-+---+ - * | | | | - * | | | +-- Type of dispatch:to method, handler, notify, or none - * | | +----- Interrupt type: edge or level triggered - * | +------- Is a Wake GPE - * +------------ <Reserved> + * +---+-+-+-+---+ + * |7:6|5|4|3|2:0| + * +---+-+-+-+---+ + * | | | | | + * | | | | +-- Type of dispatch:to method, handler, notify, or none + * | | | +----- Interrupt type: edge or level triggered + * | | +------- Is a Wake GPE + * | +--------- Is GPE masked by the software GPE masking machanism + * +------------ <Reserved> */ #define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 @@ -1079,13 +1082,6 @@ typedef struct acpi_statistics } ACPI_STATISTICS; -/* Table Event Types */ - -#define ACPI_TABLE_EVENT_LOAD 0x0 -#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 - - /* * Types specific to the OS service interfaces */ @@ -1158,9 +1154,14 @@ ACPI_STATUS (*ACPI_TABLE_HANDLER) ( void *Table, void *Context); -#define ACPI_TABLE_LOAD 0x0 -#define ACPI_TABLE_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 + +/* Table Event Types */ + +#define ACPI_TABLE_EVENT_LOAD 0x0 +#define ACPI_TABLE_EVENT_UNLOAD 0x1 +#define ACPI_TABLE_EVENT_INSTALL 0x2 +#define ACPI_TABLE_EVENT_UNINSTALL 0x3 +#define ACPI_NUM_TABLE_EVENTS 4 /* Address Spaces (For Operation Regions) */ diff --git a/source/include/acutils.h b/source/include/acutils.h index f83996a41268..bdd6f9b55d21 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -224,14 +224,16 @@ AcpiUtStricmp ( ACPI_STATUS AcpiUtStrtoul64 ( char *String, - UINT32 Base, - UINT32 MaxIntegerByteWidth, + UINT32 Flags, UINT64 *RetInteger); -/* Values for MaxIntegerByteWidth above */ - -#define ACPI_MAX32_BYTE_WIDTH 4 -#define ACPI_MAX64_BYTE_WIDTH 8 +/* + * Values for Flags above + * Note: LIMIT values correspond to AcpiGbl_IntegerByteWidth values (4/8) + */ +#define ACPI_STRTOUL_32BIT 0x04 /* 4 bytes */ +#define ACPI_STRTOUL_64BIT 0x08 /* 8 bytes */ +#define ACPI_STRTOUL_BASE16 0x10 /* Default: Base10/16 */ /* @@ -286,6 +288,11 @@ AcpiUtHexToAsciiChar ( UINT64 Integer, UINT32 Position); +ACPI_STATUS +AcpiUtAsciiToHexByte ( + char *TwoAsciiChars, + UINT8 *ReturnByte); + UINT8 AcpiUtAsciiCharToHex ( int HexChar); diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index 56c4b0aaa19e..af3df6cd81e5 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -246,12 +246,14 @@ struct _ACPI_EFI_FILE_IO_INTERFACE; struct _ACPI_EFI_FILE_HANDLE; struct _ACPI_EFI_BOOT_SERVICES; struct _ACPI_EFI_SYSTEM_TABLE; +struct _ACPI_EFI_PCI_IO; extern struct _ACPI_EFI_SYSTEM_TABLE *ST; extern struct _ACPI_EFI_BOOT_SERVICES *BS; #define FILE struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE -#define stdout ST->ConOut -#define stderr ST->ConOut + +extern FILE *stdout; +extern FILE *stderr; #endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h index 8f98a6266dee..4ae0c6628087 100644 --- a/source/include/platform/acefiex.h +++ b/source/include/platform/acefiex.h @@ -831,6 +831,71 @@ typedef struct _ACPI_EFI_SYSTEM_TABLE { } ACPI_EFI_SYSTEM_TABLE; +/* + * EFI PCI I/O Protocol + */ +#define ACPI_EFI_PCI_IO_PROTOCOL \ + { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} } + +typedef enum { + AcpiEfiPciIoWidthUint8 = 0, + AcpiEfiPciIoWidthUint16, + AcpiEfiPciIoWidthUint32, + AcpiEfiPciIoWidthUint64, + AcpiEfiPciIoWidthFifoUint8, + AcpiEfiPciIoWidthFifoUint16, + AcpiEfiPciIoWidthFifoUint32, + AcpiEfiPciIoWidthFifoUint64, + AcpiEfiPciIoWidthFillUint8, + AcpiEfiPciIoWidthFillUint16, + AcpiEfiPciIoWidthFillUint32, + AcpiEfiPciIoWidthFillUint64, + AcpiEfiPciIoWidthMaximum +} ACPI_EFI_PCI_IO_PROTOCOL_WIDTH; + +typedef +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_CONFIG)( + struct _ACPI_EFI_PCI_IO *This, + ACPI_EFI_PCI_IO_PROTOCOL_WIDTH Width, + UINT32 Offset, + UINTN Count, + VOID *Buffer); + +typedef struct { + ACPI_EFI_PCI_IO_PROTOCOL_CONFIG Read; + ACPI_EFI_PCI_IO_PROTOCOL_CONFIG Write; +} ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS; + +typedef +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION)( + struct _ACPI_EFI_PCI_IO *This, + UINTN *SegmentNumber, + UINTN *BusNumber, + UINTN *DeviceNumber, + UINTN *FunctionNumber); + +typedef struct _ACPI_EFI_PCI_IO { + ACPI_EFI_UNKNOWN_INTERFACE PollMem; + ACPI_EFI_UNKNOWN_INTERFACE PollIo; + ACPI_EFI_UNKNOWN_INTERFACE Mem; + ACPI_EFI_UNKNOWN_INTERFACE Io; + ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci; + ACPI_EFI_UNKNOWN_INTERFACE CopyMem; + ACPI_EFI_UNKNOWN_INTERFACE Map; + ACPI_EFI_UNKNOWN_INTERFACE Unmap; + ACPI_EFI_UNKNOWN_INTERFACE AllocateBuffer; + ACPI_EFI_UNKNOWN_INTERFACE FreeBuffer; + ACPI_EFI_UNKNOWN_INTERFACE Flush; + ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation; + ACPI_EFI_UNKNOWN_INTERFACE Attributes; + ACPI_EFI_UNKNOWN_INTERFACE GetBarAttributes; + ACPI_EFI_UNKNOWN_INTERFACE SetBarAttributes; + UINT64 RomSize; + VOID *RomImage; +} ACPI_EFI_PCI_IO; + /* GNU EFI definitions */ #if defined(_GNU_EFI) diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index 98ca3b6b4e5c..4941c0ecad86 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -326,8 +326,8 @@ ApDumpTableByAddress ( /* Convert argument to an integer physical address */ - Status = AcpiUtStrtoul64 (AsciiAddress, ACPI_ANY_BASE, - ACPI_MAX64_BYTE_WIDTH, &LongAddress); + Status = AcpiUtStrtoul64 (AsciiAddress, ACPI_STRTOUL_64BIT, + &LongAddress); if (ACPI_FAILURE (Status)) { fprintf (stderr, "%s: Could not convert to a physical address\n", diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 26a956e043a8..9f7f3ef7afda 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -236,8 +236,8 @@ ApDoOptions ( case 'r': /* Dump tables from specified RSDP */ - Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_ANY_BASE, - ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase); + Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_STRTOUL_64BIT, + &Gbl_RsdpBase); if (ACPI_FAILURE (Status)) { fprintf (stderr, "%s: Could not convert to a physical address\n", diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c index 9fc80078c4c3..5953e36cd1fd 100644 --- a/source/tools/acpiexec/aeexec.c +++ b/source/tools/acpiexec/aeexec.c @@ -70,7 +70,7 @@ AeGetDevices ( static ACPI_STATUS ExecuteOSI ( char *OsiString, - UINT32 ExpectedResult); + UINT64 ExpectedResult); static void AeMutexInterfaces ( @@ -328,7 +328,7 @@ AeGetDevices ( * FUNCTION: ExecuteOSI * * PARAMETERS: OsiString - String passed to _OSI method - * ExpectedResult - 0 (FALSE) or 0xFFFFFFFF (TRUE) + * ExpectedResult - 0 (FALSE) or ACPI_UINT64_MAX (TRUE) * * RETURN: Status * @@ -339,7 +339,7 @@ AeGetDevices ( static ACPI_STATUS ExecuteOSI ( char *OsiString, - UINT32 ExpectedResult) + UINT64 ExpectedResult) { ACPI_STATUS Status; ACPI_OBJECT_LIST ArgList; @@ -392,8 +392,9 @@ ExecuteOSI ( if (Obj->Integer.Value != ExpectedResult) { AcpiOsPrintf ( - "Invalid return value from _OSI, expected %.8X found %.8X\n", - ExpectedResult, (UINT32) Obj->Integer.Value); + "Invalid return value from _OSI, expected %8.8X%8.8X found %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (ExpectedResult), + ACPI_FORMAT_UINT64 (Obj->Integer.Value)); goto ErrorExit; } @@ -697,10 +698,10 @@ AeMiscellaneousTests ( /* Test _OSI execution */ - Status = ExecuteOSI ("Extended Address Space Descriptor", 0xFFFFFFFF); + Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX); ACPI_CHECK_OK (ExecuteOSI, Status); - Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF); + Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX); ACPI_CHECK_OK (ExecuteOSI, Status); Status = ExecuteOSI ("MichiganTerminalSystem", 0); diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 811e41ec8586..1fa2d375cb67 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -115,6 +115,8 @@ static char *TableEvents[] = { "LOAD", "UNLOAD", + "INSTALL", + "UNINSTALL", "UNKNOWN" }; #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index d41ba1412aa6..8151435e3448 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -172,7 +172,7 @@ CleanupAndExit: * * RETURN: None * - * DESCRIPTION: Perform an overrided for a single namespace object + * DESCRIPTION: Perform an override for a single namespace object * *****************************************************************************/ @@ -203,8 +203,8 @@ AeDoOneOverride ( /* Extract the 64-bit integer */ - Status = AcpiUtStrtoul64 (ValueString, ACPI_ANY_BASE, - ACPI_MAX64_BYTE_WIDTH, &Value); + Status = AcpiUtStrtoul64 (ValueString, + (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("%s %s\n", ValueString, diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index d2c9d519aa49..d4bf335a9801 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -92,6 +92,8 @@ BOOLEAN AcpiGbl_LoadTestTables = FALSE; BOOLEAN AcpiGbl_AeLoadOnly = FALSE; static UINT8 AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP; static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buffer */ +static char AeBuildDate[] = __DATE__; +static char AeBuildTime[] = __TIME__; #define ACPIEXEC_NAME "AML Execution/Debug Utility" #define AE_SUPPORTED_OPTIONS "?b:d:e:f^ghi:lm^rv^:x:" @@ -155,6 +157,7 @@ usage ( ACPI_OPTION ("-ei", "Enable additional tests for ACPICA interfaces"); ACPI_OPTION ("-el", "Enable loading of additional test tables"); ACPI_OPTION ("-em", "Enable grouping of module-level code"); + ACPI_OPTION ("-ep", "Enable TermList parsing for scope objects"); ACPI_OPTION ("-es", "Enable Interpreter Slack Mode"); ACPI_OPTION ("-et", "Enable debug semaphore timeout"); printf ("\n"); @@ -167,6 +170,7 @@ usage ( ACPI_OPTION ("-l", "Load tables and namespace only"); ACPI_OPTION ("-r", "Use hardware-reduced FADT V5"); ACPI_OPTION ("-v", "Display version information"); + ACPI_OPTION ("-vd", "Display build date and time"); ACPI_OPTION ("-vi", "Verbose initialization output"); ACPI_OPTION ("-vr", "Verbose region handler output"); ACPI_OPTION ("-x <DebugLevel>", "Debug output level"); @@ -285,6 +289,11 @@ AeDoOptions ( AcpiGbl_GroupModuleLevelCode = TRUE; break; + case 'p': + + AcpiGbl_ParseTableAsTermList = TRUE; + break; + case 's': AcpiGbl_EnableInterpreterSlack = TRUE; @@ -399,6 +408,11 @@ AeDoOptions ( (void) AcpiOsTerminate (); return (1); + case 'd': + + printf ("Build date/time: %s %s\n", AeBuildDate, AeBuildTime); + return (1); + case 'i': AcpiDbgLevel |= ACPI_LV_INIT_NAMES; @@ -464,8 +478,13 @@ main ( AcpiDbgLevel = ACPI_NORMAL_DEFAULT; AcpiDbgLayer = 0xFFFFFFFF; - /* Init ACPICA and start debugger thread */ - + /* + * Initialize ACPICA and start debugger thread. + * + * NOTE: After ACPICA initialization, AcpiTerminate MUST be called + * before this procedure exits -- otherwise, the console may be + * left in an incorrect state. + */ Status = AcpiInitializeSubsystem (); ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) @@ -491,8 +510,7 @@ main ( if (argc < 2) { usage (); - (void) AcpiOsTerminate (); - return (0); + goto NormalExit; } /* Get the command line options */ @@ -547,7 +565,6 @@ main ( /* Install all of the ACPI tables */ Status = AeInstallTables (); - if (ACPI_FAILURE (Status)) { printf ("**** Could not install ACPI tables, %s\n", @@ -576,7 +593,13 @@ main ( /* * Main initialization for ACPICA subsystem - * TBD: Need a way to call this after the ACPI table "LOAD" command + * TBD: Need a way to call this after the ACPI table "LOAD" command? + * + * NOTE: This initialization does not match the _Lxx and _Exx methods + * to individual GPEs, as there are no real GPEs when the hardware + * is simulated - because there is no namespace until AeLoadTables is + * executed. This may have to change if AcpiExec is ever run natively + * on actual hardware (such as under UEFI). */ Status = AcpiEnableSubsystem (InitFlags); if (ACPI_FAILURE (Status)) @@ -660,14 +683,14 @@ EnterDebugger: /* Temporarily removed */ AcpiTerminateDebugger (); - Status = AcpiTerminate (); + (void) AcpiTerminate (); #endif - Status = AcpiOsTerminate (); - return (0); - +NormalExit: + ExitCode = 0; ErrorExit: + (void) AcpiOsTerminate (); return (ExitCode); } |