From 7b8faf6fc1cf470c2d9b857875cf139094276d75 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sep 01 2016 18:26:04 +0000 Subject: New upstream version 20160831 --- diff --git a/changes.txt b/changes.txt index 03c8d4f..3e87f12 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 4aa98a3..7e3723f 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 d1e5ac2..691b65b 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 ad53dbe..62850ac 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 2a3282c..25ce59f 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 609451f..cb08fc0 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 a231bd6..d06524d 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 5e9a46b..d3cbcba 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 0000000..a0bd61f --- /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 ("-@ ", "Specify command file"); + ACPI_OPTION ("-I ", "Specify additional include directory"); + ACPI_OPTION ("-p ", "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 ", "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 ", "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 ", "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 |ALL", "Create ACPI table template/example files"); + ACPI_OPTION ("-T ", "Emit DSDT and SSDTs to same file"); + ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)"); + + printf ("\nAML Disassembler:\n"); + ACPI_OPTION ("-d ", "Disassemble or decode binary ACPI tables to file (*.dsl)"); + ACPI_OPTION ("", " (Optional, file type is automatically detected)"); + ACPI_OPTION ("-da ", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); + ACPI_OPTION ("-dc ", "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 ", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-fe ", "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 ", "Prune ASL parse tree"); + ACPI_OPTION ("-bt ", "Object type to be pruned from the parse tree"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-m ", "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 ", "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 : 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 423fb59..6041658 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 ("-@ ", "Specify command file"); - ACPI_OPTION ("-I ", "Specify additional include directory"); - ACPI_OPTION ("-p ", "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 ", "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 ", "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 ", "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 |ALL", "Create ACPI table template/example files"); - ACPI_OPTION ("-T ", "Emit DSDT and SSDTs to same file"); - ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)"); - - printf ("\nAML Disassembler:\n"); - ACPI_OPTION ("-d ", "Disassemble or decode binary ACPI tables to file (*.dsl)"); - ACPI_OPTION ("", " (Optional, file type is automatically detected)"); - ACPI_OPTION ("-da ", "Disassemble multiple tables from single namespace"); - ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); - ACPI_OPTION ("-dc ", "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 ", "Include ACPI table(s) for external symbol resolution"); - ACPI_OPTION ("-fe ", "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 ", "Prune ASL parse tree"); - ACPI_OPTION ("-bt ", "Object type to be pruned from the parse tree"); - ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); - ACPI_OPTION ("-m ", "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 ", "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 a07f10c..ce923bc 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 85f5aef..b9d4e3c 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 f0fbe03..b88513f 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 f5ca7b7..990e72f 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 87ebd9d..af7bead 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 a34b8e1..49bae72 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 233aa96..01f25ff 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 4a280a8..fcc0ce7 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 d2f8405..db9490d 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 47d2889..ee5a443 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 b3c6cf9..fcb9b83 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 9a71beb..e2fa432 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 740dcf9..5affd51 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 c725bec..c00800f 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 334dadc..4c4ff22 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 307af60..e284fca 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 2c099ef..ae076e2 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 d683bfd..3122894 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 8e2fd34..0156ee2 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 a9e6be0..51e3ce9 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 1d467d9..e336703 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 49b279a..22091b5 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 bb0d2bb..7e2f699 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 ea6f826..5e0f549 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 a8e5497..21e30f0 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 5a45bea..d91d8c5 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 32ceb6f..d4352e2 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 6f8a707..6eaf6e7 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 4843a20..edaee55 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 3dbf10b..ac9934d 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 2fa182e..7ce98a5 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 9c899e7..6e11d6b 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 1ff3336..95f6da6 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 72f9105..2dafae4 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 810d97e..8f23032 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 a6fe316..c85f0e9 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 31fa25b..11164e2 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 ba49633..b75b52d 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 32839a3..663e852 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 78e8b4e..bb8f127 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 9fc26bd..bebfc11 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 4b36391..2bf313f 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 b93013b..94f6a7f 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 70fb33e..4cddcf1 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 674fe36..5193af5 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 0000000..96cf112 --- /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 7d77588..6b79e08 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 8f3f471..6dfa8a2 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 a14dbe5..14f2b79 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 e7a0d37..9820a89 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 11ee70d..440ff5b 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 dd27821..4137981 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 33f000f..17bab19 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 6abb14c..3325f19 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 3861f12..0d2ab4c 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? - * +--------------- + * +-------------+-+-+-+-+-+-+ + * | Bits 31:6 |5|4|3|2|1|0| + * +-------------+-+-+-+-+-+-+ + * | | | | | | | + * | | | | | | +- Enabled? + * | | | | | +--- Enabled for wake? + * | | | | +----- Status bit set? + * | | | +------- Enable bit set? + * | | +--------- Has a handler? + * | +----------- Masked? + * +----------------- */ 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 - * +------------ + * +---+-+-+-+---+ + * |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 + * +------------ */ #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 f83996a..bdd6f9b 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 56c4b0a..af3df6c 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 8f98a62..4ae0c66 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 98ca3b6..4941c0e 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 26a956e..9f7f3ef 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 9fc8007..5953e36 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 811e41e..1fa2d37 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 d41ba14..8151435 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 d2c9d51..d4bf335 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 ", "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); } diff --git a/tests/aslts/bin/asltsrun b/tests/aslts/bin/asltsrun index 8a4b020..7063400 100755 --- a/tests/aslts/bin/asltsrun +++ b/tests/aslts/bin/asltsrun @@ -171,13 +171,13 @@ run_test_case() AML_DONT_EXIST=$[ $AML_DONT_EXIST + 1 ] TEST_RET=1 else - options="" + options="-ep" if [ $SLMODE == "norm" ]; then method=MN00 - options="" + options="$options" else method=MN01 - options="-es" + options="$options -es" fi if [ "$DO_MEMSTAT" == "yes" ]; then diff --git a/tests/aslts/src/runtime/cntl/common.asl b/tests/aslts/src/runtime/cntl/common.asl index 9d6c774..bb06218 100644 --- a/tests/aslts/src/runtime/cntl/common.asl +++ b/tests/aslts/src/runtime/cntl/common.asl @@ -1712,6 +1712,7 @@ Name(TFN0, Package() { "ns-fullpath.asl", "scope.asl", "object.asl", + "order.asl", // below are incorrect yet: diff --git a/tests/aslts/src/runtime/collections/functional/module/DECL.asl b/tests/aslts/src/runtime/collections/functional/module/DECL.asl index 52da2de..94ffdcd 100644 --- a/tests/aslts/src/runtime/collections/functional/module/DECL.asl +++ b/tests/aslts/src/runtime/collections/functional/module/DECL.asl @@ -29,3 +29,4 @@ Include("../../../../runtime/collections/functional/module/scope.asl") Include("../../../../runtime/collections/functional/module/object.asl") +Include("../../../../runtime/collections/functional/module/order.asl") diff --git a/tests/aslts/src/runtime/collections/functional/module/RUN.asl b/tests/aslts/src/runtime/collections/functional/module/RUN.asl index 8a89e9b..cbecc6d 100644 --- a/tests/aslts/src/runtime/collections/functional/module/RUN.asl +++ b/tests/aslts/src/runtime/collections/functional/module/RUN.asl @@ -30,7 +30,13 @@ if (STTT("Module level code execution", TCLF, 14, W01a)) { SRMT("MLS0") MLS0() + SRMT("MLS1") + MLS1() SRMT("MLO0") MLO0() + SRMT("MLO1") + MLO1() + SRMT("MLD0") + MLD0() } FTTT() diff --git a/tests/aslts/src/runtime/collections/functional/module/object.asl b/tests/aslts/src/runtime/collections/functional/module/object.asl index 19857cd..1e2cc86 100644 --- a/tests/aslts/src/runtime/collections/functional/module/object.asl +++ b/tests/aslts/src/runtime/collections/functional/module/object.asl @@ -31,8 +31,8 @@ */ /* - * Verify if Type1Opcode (ex., If) is allowed under Device, PowerResource, - * Processor, or ThermalZone + * Verify if Type1Opcode (ex., If) and Type2Opcode (ex., Store) is allowed + * under Device, PowerResource, Processor, or ThermalZone * * ASL spec state: * 1. DeviceTerm supports ObjectList for ACPI 1.0 ~ ACPI 6.1. @@ -113,3 +113,68 @@ Method(MLO0,, Serialized) err(ts, z181, 3, z181, 3, ml13, 2) } } + +/* Tests for Type2Opcode */ + +Name(ml14, 0) +Name(ml15, 0) +Name(ml16, 0) +Name(ml17, 0) + +Scope(\_SB) +{ + Device(dev1) + { + Store (1, ml14) + if (LEqual(ml14, 1)) { + Store(2, ml14) + } + PowerResource(pr01, 1, 0) + { + Store (1, ml15) + if (LEqual(ml15, 1)) { + Store(2, ml15) + } + } + } +} +Scope(\_PR) +{ + Processor(cpu1, 0, 0xFFFFFFFF, 0) + { + Store (1, ml16) + if (LEqual(ml16, 1)) { + Store(2, ml16) + } + } +} +Scope(\_TZ) +{ + ThermalZone(thz1) + { + Store (1, ml17) + if (LEqual(ml17, 1)) { + Store(2, ml17) + } + } +} + +Method(MLO1,, Serialized) +{ + Name(ts, "MLO1") + + Store("TEST: MLO1 Type2Opcode is executable under objects", Debug) + + if (LNotEqual(ml14, 2)) { + err(ts, z181, 4, z181, 4, ml14, 2) + } + if (LNotEqual(ml15, 2)) { + err(ts, z181, 5, z181, 5, ml15, 2) + } + if (LNotEqual(ml16, 2)) { + err(ts, z181, 6, z181, 6, ml16, 2) + } + if (LNotEqual(ml17, 2)) { + err(ts, z181, 7, z181, 7, ml17, 2) + } +} diff --git a/tests/aslts/src/runtime/collections/functional/module/order.asl b/tests/aslts/src/runtime/collections/functional/module/order.asl new file mode 100644 index 0000000..0b43802 --- /dev/null +++ b/tests/aslts/src/runtime/collections/functional/module/order.asl @@ -0,0 +1,63 @@ +/* + * Some or all of this work - Copyright (c) 2006 - 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: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 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 DAMAGE. + */ + +/* + * Module level execution order + */ + +/* + * Verify if module level opcode is executed right in place. + */ + +Name(z182, 182) + +/* Tests for Type2Opcode order */ + +Name(ml20, 0) +Name(ob01, 0) + +if (CondRefOf(ob01)) +{ + Store(1, ml20) + if (CondRefOf(ob02)) + { + Store(2, ml20) + } +} +Name(ob02, 0) + +Method(MLD0,, Serialized) +{ + Name(ts, "MLD0") + + Store("TEST: MLD0, Type2Opcode is executed right in place", Debug) + + if (LNotEqual(ml20, 1)) { + err(ts, z182, 6, z182, 6, ml20, 1) + } +} diff --git a/tests/aslts/src/runtime/collections/functional/module/scope.asl b/tests/aslts/src/runtime/collections/functional/module/scope.asl index cbe36b8..d683535 100644 --- a/tests/aslts/src/runtime/collections/functional/module/scope.asl +++ b/tests/aslts/src/runtime/collections/functional/module/scope.asl @@ -31,8 +31,8 @@ */ /* - * Verify if Type1Opcode (ex., If) is allowed under DefinitionBlock or - * Scope + * Verify if Type1Opcode (ex., If) and Type2Opcode (ex., Store) is allowed + * under DefinitionBlock or Scope * * ASL spec state: * 1. DefinitionBlockTerm supports TermList for ACPI 1.0 ~ 6.0. @@ -89,3 +89,45 @@ Method(MLS0,, Serialized) err(ts, z180, 2, z180, 2, ml02, 2) } } + +/* Tests for Type2Opcode */ + +Name(ml03, 0) +Name(ml04, 0) +Name(ml05, 0) + +Store (1, ml03) +if (LEqual(ml03, 1)) { + Store(2, ml03) +} +Scope(\) +{ + Store (1, ml04) + if (LEqual(ml04, 1)) { + Store(2, ml04) + } +} +Scope(\_SB) +{ + Store (1, ml05) + if (LEqual(ml05, 1)) { + Store(2, ml05) + } +} + +Method(MLS1,, Serialized) +{ + Name(ts, "MLS1") + + Store("TEST: MLS1, Type2Opcode is executable under scopes", Debug) + + if (LNotEqual(ml03, 2)) { + err(ts, z180, 3, z180, 3, ml03, 2) + } + if (LNotEqual(ml04, 2)) { + err(ts, z180, 4, z180, 4, ml04, 2) + } + if (LNotEqual(ml05, 2)) { + err(ts, z180, 5, z180, 5, ml05, 2) + } +} diff --git a/tests/misc/grammar.aml b/tests/misc/grammar.aml index 391f2d0..279c91c 100755 Binary files a/tests/misc/grammar.aml and b/tests/misc/grammar.aml differ diff --git a/tests/misc/grammar.dsl b/tests/misc/grammar.dsl index fc780bb..6477a39 100755 --- a/tests/misc/grammar.dsl +++ b/tests/misc/grammar.dsl @@ -1,22 +1,22 @@ /* * Intel ACPI Component Architecture - * AML/ASL+ Disassembler version 20160527-32 + * AML/ASL+ Disassembler version 20160729-32 * Copyright (c) 2000 - 2016 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of grammar.aml, Thu Jul 21 09:14:02 2016 + * Disassembly of grammar.aml, Fri Aug 19 13:49:10 2016 * * Original Table Header: * Signature "DSDT" * Length 0x0000A9E2 (43490) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xF4 + * Checksum 0xF0 * OEM ID "Intel" * OEM Table ID "GRMTEST" * OEM Revision 0x20090511 (537462033) * Compiler ID "INTL" - * Compiler Version 0x20160527 (538314023) + * Compiler Version 0x20160729 (538314537) */ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { @@ -66,7 +66,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (IRES) { - Name (PRT0, ResourceTemplate () + Buffer PRT0 = ResourceTemplate () { IRQ (Edge, ActiveHigh, Exclusive, ) {3,4,5,6,7,9,10,11,14,15} @@ -76,7 +76,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) {0,1,2} } EndDependentFn () - }) + } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { Debug = "_CRS:" @@ -92,16 +92,16 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (_NPK, Package (0x04) + Package _NPK (0x4) = { 0x1111, 0x2222, 0x3333, 0x4444 - }) + } Device (RES) { - Name (_PRT, Package (0x04) // _PRT: PCI Routing Table + Package _PRT (0x4) = { Package (0x04) { @@ -134,10 +134,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Zero, Zero } - }) + } // _PRT: PCI Routing Table Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings { - Name (PRT0, ResourceTemplate () + Buffer PRT0 = ResourceTemplate () { WordBusNumber (ResourceConsumer, MinFixed, MaxFixed, SubDecode, 0x0000, // Granularity @@ -343,7 +343,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) {3,4,5,6,7,9,10,11,14,15} } EndDependentFn () - }) + } CreateWordField (PRT0, \RES._CRS._Y00._MIN, BMIN) // _MIN: Minimum Base Address CreateByteField (PRT0, \RES._CRS._Y01._ASZ, RSIZ) // _ASZ: Access Size BMIN = 0x03 @@ -352,7 +352,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (_PRS, 0, Serialized) // _PRS: Possible Resource Settings { - Name (BUF0, ResourceTemplate () + Buffer BUF0 = ResourceTemplate () { StartDependentFn (0x01, 0x02) { @@ -410,7 +410,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) {1,3,4,5,6,7,8,10,11,12,13,14,15} } EndDependentFn () - }) + } Return (BUF0) /* \RES_._PRS.BUF0 */ } @@ -420,35 +420,35 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (_S0, Package (0x04) // _S0_: S0 System State + Package _S0 (0x4) = { Zero, Zero, Zero, Zero - }) - Name (_S3, Package (0x04) // _S3_: S3 System State + } // _S0_: S0 System State + Package _S3 (0x4) = { 0x05, 0x05, Zero, Zero - }) - Name (_S4, Package (0x04) // _S4_: S4 System State + } // _S3_: S3 System State + Package _S4 (0x4) = { 0x06, 0x06, Zero, Zero - }) - Name (_S5, Package (0x04) // _S5_: S5 System State + } // _S4_: S4 System State + Package _S5 (0x4) = { 0x07, 0x07, Zero, Zero - }) - Name (SIZE, Zero) + } // _S5_: S5 System State + Integer SIZE = Zero OperationRegion (MYOP, 0x80, 0xFD60, 0x06) Field (MYOP, ByteAcc, NoLock, Preserve) { @@ -457,16 +457,20 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TCOP, 0, Serialized) { - Name (_STR, Unicode ("test")) // _STR: Description String + Buffer _STR(0xA) = + { + /* 0000 */ 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, /* t.e.s.t. */ + /* 0008 */ 0x00, 0x00 /* .. */ + } // _STR: Description String MFLD = 0x04 Local0 = MFLD /* \MFLD */ } - Name (ERRS, Zero) - Name (ESC1, "abcdefghijklmn") - Name (ESC2, "abcdefghijklmn") - Name (ESC3, "abc\a\bdef\f\n\r\t\v\x03ffff\x1A") - Name (CRSA, ResourceTemplate () + Integer ERRS = Zero + String ESC1 = "abcdefghijklmn" + String ESC2 = "abcdefghijklmn" + String ESC3 = "abc\a\bdef\f\n\r\t\v\x03ffff\x1A" + Buffer CRSA = ResourceTemplate () { WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, 0x0000, // Granularity @@ -489,8 +493,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x00000000, // Translation Offset 0x04000000, // Length ,, , AddressRangeMemory, TypeStatic) - }) - Name (CRSB, ResourceTemplate () + } + Buffer CRSB = ResourceTemplate () { DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite, 0x00000000, // Granularity @@ -499,30 +503,32 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x00000000, // Translation Offset 0x04000000, // Length ,, , AddressRangeMemory, TypeStatic) - }) - Name (CRSC, ResourceTemplate () + } + Buffer CRSC = ResourceTemplate () { VendorShort () // Length = 0x03 { 0x01, 0x02, 0x03 /* ... */ } - }) - Name (CRSD, ResourceTemplate () + } + Buffer CRSD = ResourceTemplate () { VendorLong () // Length = 0x09 { /* 0000 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* ........ */ /* 0008 */ 0x09 /* . */ } - }) - Name (CRSE, ResourceTemplate () + } + Buffer CRSE = ResourceTemplate () { IRQNoFlags () {3,4,10,11} IRQNoFlags () {3,4,10,11} - }) - Name (CRSR, Buffer (SizeOf (CRSA) + SizeOf (CRSB)) {}) + } + Buffer CRSR(0x63AC80) = + { + } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { Return (CRSR) /* \CRSR */ @@ -530,10 +536,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Scope (\) { - Name (BXXX, Ones) + Integer BXXX = Ones } - Name (LANS, Zero) + Integer LANS = Zero PowerResource (LANP, 0x01, 0x0000) { Method (_STA, 0, NotSerialized) // _STA: Status @@ -586,22 +592,22 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Processor (CPU0, 0x00, 0xFFFFFFFF, 0x00) {} } - Name (B1TP, Ones) - Name (B2TP, Ones) - Name (ADPS, Ones) - Name (B1PS, Ones) - Name (B1RS, Ones) - Name (B1CS, Ones) - Name (B2PS, Ones) - Name (B2RS, Ones) - Name (B2CS, Ones) - Name (B1DC, 0x0BB8) - Name (B2DC, 0x0A28) - Name (B1LF, 0x0BB8) - Name (B2LF, 0x0A28) - Name (BPIF, Zero) - Name (PBLL, Zero) - Name (RBIF, Package (0x0D) + Integer B1TP = Ones + Integer B2TP = Ones + Integer ADPS = Ones + Integer B1PS = Ones + Integer B1RS = Ones + Integer B1CS = Ones + Integer B2PS = Ones + Integer B2RS = Ones + Integer B2CS = Ones + Integer B1DC = 0x0BB8 + Integer B2DC = 0x0A28 + Integer B1LF = 0x0BB8 + Integer B2LF = 0x0A28 + Integer BPIF = Zero + Integer PBLL = Zero + Package RBIF (0xD) = { One, 0x0898, @@ -616,7 +622,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) "1", "LION", "Fujitsu" - }) + } Method (SMWE, 4, NotSerialized) { Return (Ones) @@ -629,7 +635,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Scope (_SB) { - Name (SBUF, Buffer (0x80) {}) + Buffer SBUF(0x80) = + { + } CreateBitField (SBUF, 0x03, BITY) CreateByteField (SBUF, One, BYTY) CreateWordField (SBUF, 0x02, WRDZ) @@ -645,11 +653,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (PCI0) { - Name (_HID, EisaId ("PNP0A03") /* PCI Bus */) // _HID: Hardware ID - Name (_ADR, Zero) // _ADR: Address + Integer _HID = EisaId ("PNP0A03") /* PCI Bus */ // _HID: Hardware ID + Integer _ADR = Zero // _ADR: Address Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings { - Name (PRT0, ResourceTemplate () + Buffer PRT0 = ResourceTemplate () { WordBusNumber (ResourceConsumer, MinFixed, MaxFixed, SubDecode, 0x0000, // Granularity @@ -658,7 +666,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x0032, // Translation Offset 0x0002, // Length ,, _Y02) - }) + } CreateWordField (PRT0, \_SB.PCI0._CRS._Y02._MIN, BMIN) // _MIN: Minimum Base Address BMIN = 0x03 Return (PRT0) /* \_SB_.PCI0._CRS.PRT0 */ @@ -767,8 +775,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (CMB1) { - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, One) // _UID: Unique ID + Integer _HID = EisaId ("PNP0C0A") /* Control Method Battery */ // _HID: Hardware ID + Integer _UID = One // _UID: Unique ID Alias (\_SB.PCI0.EIO.B1P, \_SB.PCI0.XXXX) Alias (\_SB.PCI0.EIO.B1P, B1P) Alias (\_SB.PCI0.EIO.B1C, B1C) @@ -817,7 +825,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Local1 = MKWD (B1CL, B1CH) Local2 = (((B1CP * B1LF) + 0x63) / 0x64) Local3 = MKWD (B1VL, B1VH) - Name (STAT, Package (0x04) {}) + Package STAT (0x4) = + { + } STAT [Zero] = Local0 STAT [One] = Local1 STAT [0x02] = Local2 @@ -839,19 +849,19 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { ThermalZone (TZ1) { - Name (_PSL, Package (0x01) // _PSL: Passive List + Package _PSL (0x1) = { \_PR.CPU0 - }) + } // _PSL: Passive List } } Method (TZ2, 0, Serialized) { - Name (_PSL, Package (0x01) // _PSL: Passive List + Package _PSL (0x1) = { \_PR.CPU0 - }) + } // _PSL: Passive List Return (_PSL) /* \TZ2_._PSL */ } @@ -1206,12 +1216,16 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (OBJ1, 1, Serialized) { Local0 = 0x03 - Name (BUFR, Buffer (Local0) {}) - Name (BUF1, Buffer (0x04) + Buffer BUFR(0x0) = + { + } + Buffer BUF1(0x4) = { 0x01, 0x02, 0x03, 0x04 /* .... */ - }) - Name (BUF2, Buffer (0x04) {}) + } + Buffer BUF2(0x4) = + { + } BUF2 = BUF1 /* \OBJ1.BUF1 */ Mutex (MTX1, 0x04) Alias (MTX1, MTX2) @@ -1222,7 +1236,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (FLDS, 0, Serialized) { Debug = "++++++++ Creating BufferFields" - Name (BUF2, Buffer (0x80) {}) + Buffer BUF2(0x80) = + { + } CreateBitField (BUF2, 0x03, BIT2) CreateByteField (BUF2, One, BYT2) CreateWordField (BUF2, 0x02, WRD2) @@ -1335,7 +1351,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (OBJ2, 1, Serialized) { Debug = "++++++++ Creating Buffer BUFO" - Name (BUFO, Buffer (0x20) {}) + Buffer BUFO(0x20) = + { + } Debug = "++++++++ Creating OpRegion OPR2" OperationRegion (OPR2, SystemMemory, Arg0, 0x0100) Debug = "++++++++ Creating Field(s) in OpRegion OPR2" @@ -1718,11 +1736,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (REFS, 0, Serialized) { - Name (BBUF, Buffer (0x08) + Buffer BBUF(0x8) = { 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7 /* ........ */ - }) - Name (NEST, Package (0x02) + } + Package NEST (0x2) = { Package (0x06) { @@ -1743,7 +1761,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x15, 0x16 } - }) + } Local5 = RefOf (MAIN) Local1 = CondRefOf (ABCD, Local0) If (Local1 != Zero) @@ -1780,14 +1798,16 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (INDX, 0, Serialized) { - Name (STAT, Package (0x04) {}) + Package STAT (0x4) = + { + } STAT [Zero] = 0x44443333 } Device (IFEL) { - Name (DWRD, One) - Name (RSLT, Zero) + Integer DWRD = One + Integer RSLT = Zero Method (IFNR, 0, NotSerialized) { RSLT = DWRD /* \IFEL.DWRD */ @@ -1918,7 +1938,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ NoSave Test" - Name (WRD, 0x1234) + Integer WRD = 0x1234 If (0x03 & One) { WRD = One @@ -2301,10 +2321,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Scope (_SB) { - Name (ZER0, Zero) - Name (ZER1, Zero) - Name (ZER2, Zero) - Name (ONE0, One) + Integer ZER0 = Zero + Integer ZER1 = Zero + Integer ZER2 = Zero + Integer ONE0 = One Device (NSTL) { Method (TEST, 0, NotSerialized) @@ -2333,10 +2353,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (RBUF, 0, Serialized) { - Name (ABUF, Buffer (0x11) + Buffer ABUF(0x11) = { "ARBITRARY_BUFFER" - }) + } Local0 = ABUF /* \RTBF.RBUF.ABUF */ Local1 = ObjectType (Local0) If (Local1 != 0x03) @@ -2352,7 +2372,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Local1 = 0x05 - Name (BUFR, Buffer (Local1) {}) + Buffer BUFR(0x0) = + { + } Local0 = SUBR (BUFR) Local1 = ObjectType (Local0) If (Local1 != 0x03) @@ -2403,7 +2425,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (PRW2) { - Name (_PRW, Package (0x02) // _PRW: Power Resources for Wake + Package _PRW (0x2) = { Package (0x02) { @@ -2412,12 +2434,12 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) }, 0x03 - }) + } // _PRW: Power Resources for Wake } Scope (_GPE) { - Name (ACST, 0xFF) + Integer ACST = 0xFF Method (_L08, 0, NotSerialized) // _Lxx: Level-Triggered GPE { Debug = "Method _GPE._L08 invoked" @@ -2457,32 +2479,32 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (PRW1) { - Name (_PRW, Package (0x02) // _PRW: Power Resources for Wake + Package _PRW (0x2) = { 0x11, 0x03 - }) + } // _PRW: Power Resources for Wake } Device (PWRB) { - Name (_HID, EisaId ("PNP0C0C") /* Power Button Device */) // _HID: Hardware ID - Name (_PRW, Package (0x02) // _PRW: Power Resources for Wake + Integer _HID = EisaId ("PNP0C0C") /* Power Button Device */ // _HID: Hardware ID + Package _PRW (0x2) = { 0x33, 0x03 - }) + } // _PRW: Power Resources for Wake } Scope (_SB) { Device (ACAD) { - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List + String _HID = "ACPI0003" /* Power Source Device */ // _HID: Hardware ID + Package _PCL (0x1) = { _SB - }) + } // _PCL: Power Consumer List OperationRegion (AREG, SystemIO, 0x0372, 0x02) Field (AREG, ByteAcc, NoLock, Preserve) { @@ -2588,34 +2610,34 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Device (LNKA) { - Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */) // _HID: Hardware ID - Name (_UID, One) // _UID: Unique ID + Integer _HID = EisaId ("PNP0C0F") /* PCI Interrupt Link Device */ // _HID: Hardware ID + Integer _UID = One // _UID: Unique ID } Device (LNKB) { - Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */) // _HID: Hardware ID - Name (_UID, 0x02) // _UID: Unique ID + Integer _HID = EisaId ("PNP0C0F") /* PCI Interrupt Link Device */ // _HID: Hardware ID + Integer _UID = 0x02 // _UID: Unique ID } Device (LNKC) { - Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */) // _HID: Hardware ID - Name (_UID, 0x03) // _UID: Unique ID + Integer _HID = EisaId ("PNP0C0F") /* PCI Interrupt Link Device */ // _HID: Hardware ID + Integer _UID = 0x03 // _UID: Unique ID } Device (LNKD) { - Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */) // _HID: Hardware ID - Name (_UID, 0x04) // _UID: Unique ID + Integer _HID = EisaId ("PNP0C0F") /* PCI Interrupt Link Device */ // _HID: Hardware ID + Integer _UID = 0x04 // _UID: Unique ID } Device (PCI1) { - Name (_HID, "PNP0A03" /* PCI Bus */) // _HID: Hardware ID - Name (_ADR, Zero) // _ADR: Address - Name (_CRS, Zero) // _CRS: Current Resource Settings - Name (_PRT, Package (0x0C) // _PRT: PCI Routing Table + String _HID = "PNP0A03" /* PCI Bus */ // _HID: Hardware ID + Integer _ADR = Zero // _ADR: Address + Integer _CRS = Zero // _CRS: Current Resource Settings + Package _PRT (0xC) = { Package (0x04) { @@ -2712,10 +2734,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) LNKB, Zero } - }) + } // _PRT: PCI Routing Table Device (PX40) { - Name (_ADR, 0x00070000) // _ADR: Address + Integer _ADR = 0x00070000 // _ADR: Address } } @@ -2746,7 +2768,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (WHLR) { - Name (LCNT, Zero) + Integer LCNT = Zero Method (WIR, 0, NotSerialized) { While (LCNT < 0x04) @@ -2787,15 +2809,15 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) SMBY, 8 } - Name (BYT1, 0xFF) - Name (BYT2, 0xFF) - Name (BRSL, Zero) - Name (WRD1, 0xFFFF) - Name (WRD2, 0xFFFF) - Name (WRSL, Zero) - Name (DWD1, Ones) - Name (DWD2, Ones) - Name (DRSL, Zero) + Integer BYT1 = 0xFF + Integer BYT2 = 0xFF + Integer BRSL = Zero + Integer WRD1 = 0xFFFF + Integer WRD2 = 0xFFFF + Integer WRSL = Zero + Integer DWD1 = Ones + Integer DWD2 = Ones + Integer DRSL = Zero Method (ANDP, 0, NotSerialized) { BRSL = (BYT1 & BYT2) /* \ANDO.BYT2 */ @@ -2969,7 +2991,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ AndOrOp Test" - Name (RSLT, One) + Integer RSLT = One RSLT = ANDP () If (RSLT == One) { @@ -2997,7 +3019,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (BRKP) { - Name (CNT0, Zero) + Integer CNT0 = Zero Method (BK1, 0, NotSerialized) { BreakPoint @@ -3035,9 +3057,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ AddSubOp Test" - Name (DWRD, 0x12345678) - Name (WRD, 0x1234) - Name (BYT, 0x12) + Integer DWRD = 0x12345678 + Integer WRD = 0x1234 + Integer BYT = 0x12 DWRD = 0x12345678 DWRD += 0x07 If (DWRD != 0x1234567F) @@ -3131,9 +3153,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ IncDecOp Test" - Name (DWRD, 0x12345678) - Name (WRD, 0x1234) - Name (BYT, 0x12) + Integer DWRD = 0x12345678 + Integer WRD = 0x1234 + Integer BYT = 0x12 DWRD = 0x12345678 DWRD++ If (DWRD != 0x12345679) @@ -3224,16 +3246,16 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) SMBY, 8 } - Name (BYT1, 0xFF) - Name (BYT2, 0xFF) - Name (BRSL, Zero) - Name (WRD1, 0xFFFF) - Name (WRD2, 0xFFFF) - Name (WRSL, Zero) - Name (DWD1, Ones) - Name (DWD2, Ones) - Name (DRSL, Zero) - Name (RSLT, One) + Integer BYT1 = 0xFF + Integer BYT2 = 0xFF + Integer BRSL = Zero + Integer WRD1 = 0xFFFF + Integer WRD2 = 0xFFFF + Integer WRSL = Zero + Integer DWD1 = Ones + Integer DWD2 = Ones + Integer DRSL = Zero + Integer RSLT = One Method (ANDL, 2, NotSerialized) { If (Arg0 == Arg1) @@ -3553,14 +3575,14 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) SMBY, 8 } - Name (BYT1, One) - Name (BRSL, Zero) - Name (WRD1, 0x0100) - Name (WRSL, Zero) - Name (DWD1, 0x00010000) - Name (DRSL, Zero) - Name (RSLT, One) - Name (CNTR, One) + Integer BYT1 = One + Integer BRSL = Zero + Integer WRD1 = 0x0100 + Integer WRSL = Zero + Integer DWD1 = 0x00010000 + Integer DRSL = Zero + Integer RSLT = One + Integer CNTR = One Method (SHFT, 2, NotSerialized) { Local0 = Arg0 @@ -3724,10 +3746,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ MulDivOp Test" - Name (RMDR, Zero) - Name (DWRD, 0x12345678) - Name (WRD, 0x1234) - Name (BYT, 0x12) + Integer RMDR = Zero + Integer DWRD = 0x12345678 + Integer WRD = 0x1234 + Integer BYT = 0x12 DWRD = 0x12345678 DWRD *= 0x03 If (DWRD != 0x369D0368) @@ -3848,18 +3870,18 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) SMBY, 8 } - Name (BYT1, 0xFF) - Name (BYT2, 0xFF) - Name (BRSL, Zero) - Name (WRD1, 0xFFFF) - Name (WRD2, 0xFFFF) - Name (WRSL, Zero) - Name (DWD1, Ones) - Name (DWD2, Ones) - Name (DRSL, Zero) - Name (RSLT, One) - Name (ARSL, Zero) - Name (LRSL, Zero) + Integer BYT1 = 0xFF + Integer BYT2 = 0xFF + Integer BRSL = Zero + Integer WRD1 = 0xFFFF + Integer WRD2 = 0xFFFF + Integer WRSL = Zero + Integer DWD1 = Ones + Integer DWD2 = Ones + Integer DRSL = Zero + Integer RSLT = One + Integer ARSL = Zero + Integer LRSL = Zero Method (NNDB, 2, NotSerialized) { SMDW = Ones @@ -4071,16 +4093,16 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) SMBY, 8 } - Name (SHFC, Zero) - Name (BYT1, 0xFF) - Name (BRSL, Zero) - Name (WRD1, 0xFFFF) - Name (WRSL, Zero) - Name (DWD1, Ones) - Name (DRSL, Zero) - Name (RSLT, One) - Name (ARSL, Zero) - Name (LRSL, Zero) + Integer SHFC = Zero + Integer BYT1 = 0xFF + Integer BRSL = Zero + Integer WRD1 = 0xFFFF + Integer WRSL = Zero + Integer DWD1 = Ones + Integer DRSL = Zero + Integer RSLT = One + Integer ARSL = Zero + Integer LRSL = Zero Method (SLFT, 2, NotSerialized) { SMDW = Ones @@ -4560,7 +4582,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, NotSerialized) { Debug = "++++++++ CrBytFld Test" - Local0 = Buffer (0x04) {} + Local0 = 0x04 + } CreateByteField (Local0, Zero, BF0) Local1 = ObjectType (Local0) If (Local1 != 0x03) @@ -5371,13 +5394,13 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (PKG0, Package (0x03) + Package PKG0 (0x3) = { 0x0123, 0x4567, 0x89AB - }) - Name (PKG1, Package (0x03) + } + Package PKG1 (0x3) = { Package (0x03) { @@ -5399,30 +5422,38 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x3210, 0x1234 } - }) - Name (PKG2, Package (0x04) + } + Package PKG2 (0x4) = { 0x0123, 0x4567, 0x89AB, 0x8888 - }) - Name (PKG3, Package (0x05) + } + Package PKG3 (0x5) = { 0x0123, 0x4567, 0x89AB, 0x8888, 0x7777 - }) - Name (STR0, "ACPI permits very flexible methods of expressing a system") - Name (STR1, "MIKE permits very flexible methods of expressing a system") - Name (STR2, "Needless to say, Mike and ACPI are frequently at odds") - Name (STR3, "12345") - Name (BUF0, Buffer (0x0A) {}) - Name (BUF1, Buffer (0x0A) {}) - Name (BUF2, Buffer (0x08) {}) - Name (BUF3, Buffer (0x05) {}) + } + String STR0 = "ACPI permits very flexible methods of expressing a system" + String STR1 = "MIKE permits very flexible methods of expressing a system" + String STR2 = "Needless to say, Mike and ACPI are frequently at odds" + String STR3 = "12345" + Buffer BUF0(0xA) = + { + } + Buffer BUF1(0xA) = + { + } + Buffer BUF2(0x8) = + { + } + Buffer BUF3(0x5) = + { + } Device (SZLV) { Method (CMPR, 2, NotSerialized) @@ -5528,8 +5559,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Mutex (C01F, 0x00) - Name (C020, Zero) - Name (C021, Zero) + Integer C020 = Zero + Integer C021 = Zero Method (C022, 0, NotSerialized) { Acquire (C01F, 0xFFFF) @@ -5548,7 +5579,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Device (C058) { - Name (_HID, "*PNP0A06") // _HID: Hardware ID + String _HID = "*PNP0A06" // _HID: Hardware ID OperationRegion (C059, SystemIO, 0xE0, 0x02) Field (C059, ByteAcc, NoLock, Preserve) { @@ -5632,11 +5663,12 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Mutex (C08B, 0x00) Mutex (C08C, 0x00) Mutex (C08D, 0x00) - Name (C08E, 0xFFFFFFFD) - Name (C08F, Zero) + Integer C08E = 0xFFFFFFFD + Integer C08F = Zero Method (C0AA, 4, NotSerialized) { - Local7 = Buffer (0x04) {} + Local7 = 0x04 + } CreateByteField (Local7, Zero, C0AB) CreateByteField (Local7, One, C0AC) CreateByteField (Local7, 0x02, C0AD) @@ -5678,7 +5710,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Scope (_TZ) { - Name (C18B, Package (0x02) + Package C18B (0x2) = { Package (0x02) { @@ -5721,8 +5753,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x0FA2 } } - }) - Name (C18C, Package (0x02) + } + Package C18C (0x2) = { Package (0x02) { @@ -5740,24 +5772,24 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x32 } } - }) - Name (C18D, Zero) - Name (C18E, Zero) - Name (C18F, Zero) - Name (C190, Zero) - Name (C191, 0x03) - Name (C192, Zero) - Name (C193, One) - Name (C194, 0x02) + } + Integer C18D = Zero + Integer C18E = Zero + Integer C18F = Zero + Integer C190 = Zero + Integer C191 = 0x03 + Integer C192 = Zero + Integer C193 = One + Integer C194 = 0x02 Mutex (C195, 0x00) - Name (C196, One) - Name (C197, 0x0B9C) - Name (C198, 0x0B9C) - Name (C199, 0xFFFFFFFD) - Name (C19A, Zero) + Integer C196 = One + Integer C197 = 0x0B9C + Integer C198 = 0x0B9C + Integer C199 = 0xFFFFFFFD + Integer C19A = Zero Device (C19B) { - Name (RSLT, Zero) + Integer RSLT = Zero Method (XINI, 0, NotSerialized) { C19A = \_SB.C115 () @@ -5795,11 +5827,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (BUFR, Buffer (0x0A) + Buffer BUFR(0xA) = { /* 0000 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ /* 0008 */ 0x00, 0x00 /* .. */ - }) + } Device (DWDF) { Method (TEST, 0, NotSerialized) @@ -5819,8 +5851,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (B1LO, 0xAA) - Name (B1HI, 0xBB) + Integer B1LO = 0xAA + Integer B1HI = 0xBB Method (MKW, 2, NotSerialized) { Local0 = (B1HI * 0x0100) @@ -5906,7 +5938,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (IDX5) { - Name (OSFL, Zero) + Integer OSFL = Zero Method (MCTH, 2, Serialized) { If (SizeOf (Arg0) < SizeOf (Arg1)) @@ -5915,8 +5947,12 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Local0 = (SizeOf (Arg0) + One) - Name (BUF0, Buffer (Local0) {}) - Name (BUF1, Buffer (Local0) {}) + Buffer BUF0(0x0) = + { + } + Buffer BUF1(0x0) = + { + } BUF0 = Arg0 BUF1 = Arg1 Local1 = ObjectType (BUF0) @@ -5971,12 +6007,12 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (PCI2) { - Name (_HID, EisaId ("PNP0A03") /* PCI Bus */) // _HID: Hardware ID - Name (_ADR, Zero) // _ADR: Address - Name (_CRS, Buffer (0x1A) // _CRS: Current Resource Settings + Integer _HID = EisaId ("PNP0A03") /* PCI Bus */ // _HID: Hardware ID + Integer _ADR = Zero // _ADR: Address + Buffer _CRS(0x1A) = { "_SB_.PCI2._CRS..........." - }) + } // _CRS: Current Resource Settings Method (_STA, 0, NotSerialized) // _STA: Status { Return (0x0F) @@ -5984,17 +6020,17 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (ISA) { - Name (_ADR, 0x00030000) // _ADR: Address + Integer _ADR = 0x00030000 // _ADR: Address Device (EC0) { - Name (_GPE, Zero) // _GPE: General Purpose Events - Name (_ADR, 0x00030000) // _ADR: Address + Integer _GPE = Zero // _GPE: General Purpose Events + Integer _ADR = 0x00030000 // _ADR: Address Method (_STA, 0, NotSerialized) // _STA: Status { Return (0x0F) } - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings + Buffer _CRS = ResourceTemplate () { IO (Decode16, 0x0062, // Range Minimum @@ -6008,7 +6044,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x01, // Alignment 0x01, // Length ) - }) + } // _CRS: Current Resource Settings OperationRegion (RAM, SystemMemory, 0x00400000, 0x0100) Field (RAM, AnyAcc, NoLock, Preserve) { @@ -6043,11 +6079,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (IDX0) { - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List + Integer _HID = EisaId ("PNP0C0A") /* Control Method Battery */ // _HID: Hardware ID + Package _PCL (0x1) = { _SB - }) + } // _PCL: Power Consumer List Method (_STA, 0, NotSerialized) // _STA: Status { If (^^PCI2.ISA.EC0.BAT0) @@ -6062,7 +6098,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (_BIF, 0, Serialized) // _BIF: Battery Information { - Name (BUFR, Package (0x0D) {}) + Package BUFR (0xD) = + { + } BUFR [Zero] = ^^PCI2.ISA.EC0.BPU0 /* \_SB_.PCI2.ISA_.EC0_.BPU0 */ BUFR [One] = ^^PCI2.ISA.EC0.BDC0 /* \_SB_.PCI2.ISA_.EC0_.BDC0 */ BUFR [0x02] = ^^PCI2.ISA.EC0.BFC0 /* \_SB_.PCI2.ISA_.EC0_.BFC0 */ @@ -6081,13 +6119,13 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (_BST, 0, Serialized) // _BST: Battery Status { - Name (BUFR, Package (0x04) + Package BUFR (0x4) = { One, 0x0100, 0x76543210, 0x0180 - }) + } Return (BUFR) /* \_SB_.IDX0._BST.BUFR */ } @@ -6099,7 +6137,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ IndexOp Test" - Name (PBUF, Package (0x04) {}) + Package PBUF (0x4) = + { + } PBUF [Zero] = 0x01234567 PBUF [One] = 0x89ABCDEF PBUF [0x02] = 0xFEDCBA98 @@ -6131,11 +6171,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x21) } - Name (BUFR, Buffer (0x10) + Buffer BUFR(0x10) = { /* 0000 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ /* 0008 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* ........ */ - }) + } BUFR [Zero] = 0x01234567 BUFR [0x04] = 0x89ABCDEF BUFR [0x08] = 0xFEDCBA98 @@ -6280,15 +6320,15 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Scope (_SB) { - Name (C174, 0x0D) - Name (C175, 0x08) + Integer C174 = 0x0D + Integer C175 = 0x08 Device (C158) { - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List + String _HID = "ACPI0003" /* Power Source Device */ // _HID: Hardware ID + Package _PCL (0x1) = { _SB - }) + } // _PCL: Power Consumer List Method (_PSR, 0, NotSerialized) // _PSR: Power Source { Acquire (_GL, 0xFFFF) @@ -6298,21 +6338,21 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (C176, Package (0x04) + Package C176 (0x4) = { "Primary", "MultiBay", "DockRight", "DockLeft" - }) - Name (C177, Package (0x04) + } + Package C177 (0x4) = { 0x99F5, 0x99F5, 0x995F, 0x995F - }) - Name (C178, Package (0x04) + } + Package C178 (0x4) = { Package (0x04) { @@ -6345,15 +6385,15 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x966B, 0x4190 } - }) - Name (C179, Package (0x04) + } + Package C179 (0x4) = { Zero, Zero, 0x966B, 0x4190 - }) - Name (C17A, Package (0x04) + } + Package C17A (0x4) = { Package (0x03) { @@ -6382,10 +6422,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Zero, Zero } - }) + } Method (C17B, 1, Serialized) { - Name (C17C, Package (0x0D) + Package C17C (0xD) = { Zero, 0x99F5, @@ -6400,7 +6440,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) "(-Unknown-)", "LIon", Zero - }) + } Local0 = (Arg0 & 0x07) Local4 = (Local0 >> One) C178 [Local4] = C179 /* \_SB_.C179 */ @@ -6437,8 +6477,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (C154) { - Name (_HID, "*PNP0C0A") // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID + String _HID = "*PNP0C0A" // _HID: Hardware ID + Integer _UID = Zero // _UID: Unique ID Method (_BIF, 0, NotSerialized) // _BIF: Battery Information { Return (C17B (0x30)) @@ -6449,11 +6489,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Method (LCLB, 0, Serialized) { - Name (BUFR, Buffer (0x0A) + Buffer BUFR(0xA) = { /* 0000 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* ........ */ /* 0008 */ 0x08, 0x09 /* .. */ - }) + } Local1 = BUFR /* \_SB_.IDX3.LCLB.BUFR */ Local3 = ObjectType (Local1) If (Local3 != 0x03) @@ -6486,7 +6526,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (LCLP, 0, Serialized) { - Name (PKG, Package (0x0A) + Package PKG (0xA) = { Zero, One, @@ -6498,7 +6538,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) 0x07, 0x08, 0x09 - }) + } Local1 = PKG /* \_SB_.IDX3.LCLP.PKG_ */ Local3 = ObjectType (Local1) If (Local3 != 0x04) @@ -6565,13 +6605,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (IDX7) { - Name (PKG4, Package (0x05) + Package PKG4 (0x5) = { 0x02, "A short string", - Buffer (0x04) - { - 0x0A, 0x0B, 0x0C, 0x0D /* .... */ + 0x04, 0x0A, 0x0B, 0x0C, 0x0D /* .... */ }, 0x1234, @@ -6580,13 +6618,13 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) IDX7, 0x03 } - }) + } Method (TST1, 0, Serialized) { - Name (DEST, Buffer (0x3F) + Buffer DEST(0x3F) = { "Destination buffer that is longer than the short source buffer" - }) + } Local1 = DEST [0x02] Local2 = ObjectType (Local1) If (Local2 == 0x0E) @@ -6601,10 +6639,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TST2, 0, Serialized) { - Name (BUF0, Buffer (0x05) + Buffer BUF0(0x5) = { 0x01, 0x02, 0x03, 0x04, 0x05 /* ..... */ - }) + } BUF0 [0x02] = 0x55 Local0 = DerefOf (BUF0 [0x02]) If (Local0 == 0x55) @@ -6619,10 +6657,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TST3, 0, Serialized) { - Name (BUF1, Buffer (0x05) + Buffer BUF1(0x5) = { 0x01, 0x02, 0x03, 0x04, 0x05 /* ..... */ - }) + } Local0 = BUF1 [One] Local1 = DerefOf (Local0) If (Local1 == 0x02) @@ -6789,12 +6827,14 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTF, 0, Serialized) { - Name (SRCB, Buffer (0x0C) {}) + Buffer SRCB(0xC) = + { + } SRCB = "Short Buffer" - Name (DEST, Buffer (0x3F) + Buffer DEST(0x3F) = { "Destination buffer that is longer than the short source buffer" - }) + } DEST [0x02] = SRCB /* \IDX7.TSTF.SRCB */ Local0 = DerefOf (DEST [0x02]) If (Local0 != 0x72) @@ -6807,12 +6847,14 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTG, 0, Serialized) { - Name (SRCB, Buffer (0x0C) {}) + Buffer SRCB(0xC) = + { + } SRCB = "Short Buffer" - Name (DEST, Buffer (0x3F) + Buffer DEST(0x3F) = { "Destination buffer that is longer than the short source buffer" - }) + } DEST [0x02] = SRCB /* \IDX7.TSTG.SRCB */ Local0 = DerefOf (DEST [0x03]) If (Local0 != 0x74) @@ -6855,10 +6897,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTH, 0, Serialized) { - Name (DBUF, Buffer (0x1B) + Buffer DBUF(0x1B) = { "abcdefghijklmnopqrstuvwxyz" - }) + } DBUF [0x02] = 0x12345678 Local0 = DerefOf (DBUF [0x02]) If (Local0 != 0x78) @@ -6889,10 +6931,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTI, 0, Serialized) { - Name (DBUF, Buffer (0x1B) + Buffer DBUF(0x1B) = { "abcdefghijklmnopqrstuvwxyz" - }) + } DBUF [0x02] = "ABCDEFGH" Local0 = DerefOf (DBUF [0x02]) If (Local0 != 0x48) @@ -6923,10 +6965,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTJ, 0, Serialized) { - Name (DBUF, Buffer (0x1B) + Buffer DBUF(0x1B) = { "abcdefghijklmnopqrstuvwxyz" - }) + } DBUF [0x02] = 0x1234 Local0 = DerefOf (DBUF [0x02]) If (Local0 != 0x34) @@ -6957,10 +6999,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTK, 0, Serialized) { - Name (DBUF, Buffer (0x1B) + Buffer DBUF(0x1B) = { "abcdefghijklmnopqrstuvwxyz" - }) + } DBUF [0x02] = 0x00123456 Local0 = DerefOf (DBUF [0x02]) If (Local0 != 0x56) @@ -6991,10 +7033,10 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TSTL, 0, Serialized) { - Name (DBUF, Buffer (0x1B) + Buffer DBUF(0x1B) = { "abcdefghijklmnopqrstuvwxyz" - }) + } DBUF [0x02] = 0x12 Local0 = DerefOf (DBUF [0x02]) If (Local0 != 0x12) @@ -7149,7 +7191,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (TEST, 0, Serialized) { Debug = "++++++++ MatchOp Test" - Name (TIM0, Package (0x08) + Package TIM0 (0x8) = { Package (0x04) { @@ -7217,11 +7259,11 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Zero, Zero } - }) - Name (TMD0, Buffer (0x14) + } + Buffer TMD0(0x14) = { 0xFF, 0xFF, 0xFF, 0xFF /* .... */ - }) + } CreateDWordField (TMD0, Zero, PIO0) CreateDWordField (TMD0, 0x04, DMA0) CreateDWordField (TMD0, 0x08, PIO1) @@ -7336,8 +7378,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (WHLB) { - Name (CNT0, Zero) - Name (CNT1, Zero) + Integer CNT0 = Zero + Integer CNT1 = Zero Method (TEST, 0, NotSerialized) { CNT0 = Zero @@ -7434,8 +7476,8 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Device (MEM) { - Name (_HID, EisaId ("PNP0C01") /* System Board */) // _HID: Hardware ID - Name (_STA, 0x0F) // _STA: Status + Integer _HID = EisaId ("PNP0C01") /* System Board */ // _HID: Hardware ID + Integer _STA = 0x0F // _STA: Status OperationRegion (SMEM, SystemMemory, 0x00800000, 0x0100) Field (SMEM, AnyAcc, NoLock, Preserve) { @@ -7615,12 +7657,12 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Device (BAT1) { - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, One) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List + Integer _HID = EisaId ("PNP0C0A") /* Control Method Battery */ // _HID: Hardware ID + Integer _UID = One // _UID: Unique ID + Package _PCL (0x1) = { _SB - }) + } // _PCL: Power Consumer List Method (_STA, 0, NotSerialized) // _STA: Status { If (^^MEM.BES1) @@ -7635,7 +7677,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (_BIF, 0, Serialized) // _BIF: Battery Information { - Name (BUFR, Package (0x0D) {}) + Package BUFR (0xD) = + { + } BUFR [Zero] = ^^MEM.BPU1 /* \_SB_.MEM_.BPU1 */ BUFR [One] = ^^MEM.BDC1 /* \_SB_.MEM_.BDC1 */ BUFR [0x02] = ^^MEM.BLF1 /* \_SB_.MEM_.BLF1 */ @@ -7657,14 +7701,14 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Method (B2IB, 0, Serialized) { - Name (SRCB, Buffer (0x0D) + Buffer SRCB(0xD) = { "Short Buffer" - }) - Name (DEST, Buffer (0x3F) + } + Buffer DEST(0x3F) = { "Destination buffer that is longer than the short source buffer" - }) + } Local1 = DEST [0x02] Local2 = ObjectType (Local1) If (Local2 != 0x0E) @@ -7778,7 +7822,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (FB2P, 0, Serialized) { - Name (DEST, Package (0x02) {}) + Package DEST (0x2) = + { + } ^^MEM.SMD0 = 0x01234567 ^^MEM.SMD1 = 0x89ABCDEF ^^MEM.SMD2 = 0xFEDCBA98 @@ -7914,26 +7960,32 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (SARG, 0, Serialized) { - Name (BUFR, Buffer (0x0C) {}) - Name (BUF1, Buffer (0x05) + Buffer BUFR(0xC) = + { + } + Buffer BUF1(0x5) = { 0x01, 0x02, 0x03, 0x04, 0x05 /* ..... */ - }) - Name (PKG0, Package (0x04) {}) - Name (STR0, "String") - Name (PKG1, Package (0x04) + } + Package PKG0 (0x4) = + { + } + String STR0 = "String" + Package PKG1 (0x4) = { BUFR, "String2", STR0, PKG0 - }) - Name (PKG2, Package (0x04) + } + Package PKG2 (0x4) = { - Buffer (0x0F) {}, + 0x0F + }, + "String 1", Package (0x02) {} - }) + } Local0 = SAR0 (BUFR, 0x0C) Local1 = ObjectType (Local0) If (Local1 != One) @@ -8084,7 +8136,9 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (SBUF, 0, Serialized) { - Name (BUFR, Buffer (0x0C) {}) + Buffer BUFR(0xC) = + { + } Local0 = SizeOf (BUFR) Local1 = ObjectType (Local0) If (Local1 != One) @@ -8103,9 +8157,13 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (SLOC, 0, Serialized) { - Name (BUFR, Buffer (0x0C) {}) - Name (STR0, "String") - Name (PKG0, Package (0x04) {}) + Buffer BUFR(0xC) = + { + } + String STR0 = "String" + Package PKG0 (0x4) = + { + } Local2 = BUFR /* \SIZO.SLOC.BUFR */ Local0 = SizeOf (Local2) Local1 = ObjectType (Local0) @@ -8384,7 +8442,7 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } } - Name (WQAB, Buffer (0x1A64) + Buffer WQAB(0x1A64) = { /* 0000 */ 0x46, 0x4F, 0x4D, 0x42, 0x01, 0x00, 0x00, 0x00, /* FOMB.... */ /* 0008 */ 0x54, 0x1A, 0x00, 0x00, 0xBA, 0xAD, 0x00, 0x00, /* T....... */ @@ -9231,6 +9289,6 @@ DefinitionBlock ("", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) /* 1A50 */ 0x06, 0x40, 0x40, 0x68, 0x4E, 0x30, 0xAA, 0xA8, /* .@@hN0.. */ /* 1A58 */ 0xD1, 0xD1, 0x84, 0x82, 0x50, 0xDD, 0x2F, 0x4E, /* ....P./N */ /* 1A60 */ 0x81, 0xF8, 0xFF, 0x0F /* .... */ - }) + } }