diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2016-10-04 20:27:15 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2016-10-04 20:27:15 +0000 |
commit | 493deb390baef09f40125589cbdb714cb274ab04 (patch) | |
tree | 29bba1a9065a0902c2ffa3eba651ce8fe1b95e64 | |
parent | 813196a11a12ba7c2de7dc71cb7b01c8cab7ab87 (diff) | |
parent | be99e84498e91a5930864ef7b92b1a7ceb815e44 (diff) |
Notes
123 files changed, 5116 insertions, 4706 deletions
diff --git a/sys/arm64/acpica/OsdEnvironment.c b/sys/arm64/acpica/OsdEnvironment.c index 79dc212e4ec3..6efcee9646d0 100644 --- a/sys/arm64/acpica/OsdEnvironment.c +++ b/sys/arm64/acpica/OsdEnvironment.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> static u_long acpi_root_phys; diff --git a/sys/conf/files b/sys/conf/files index 6353b2573b9c..3806bc6b0fe2 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -480,6 +480,7 @@ contrib/dev/acpica/components/utilities/utpredef.c optional acpi contrib/dev/acpica/components/utilities/utresrc.c optional acpi contrib/dev/acpica/components/utilities/utstate.c optional acpi contrib/dev/acpica/components/utilities/utstring.c optional acpi +contrib/dev/acpica/components/utilities/utstrtoul64.c optional acpi contrib/dev/acpica/components/utilities/utuuid.c optional acpi acpi_debug contrib/dev/acpica/components/utilities/utxface.c optional acpi contrib/dev/acpica/components/utilities/utxferror.c optional acpi diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index 370361760eac..05cc00e98329 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -23,7 +23,7 @@ stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \ acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \ acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \ osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \ - oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" + oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c" # include files to canonify src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \ @@ -87,6 +87,6 @@ rm -rf ${wrk} # assist the developer in generating a diff echo "Directories you may want to 'svn diff':" echo " sys/contrib/dev/acpica sys/dev/acpica \\" -echo " sys/amd64/acpica sys/i386/acpica sys/x86/acpica \\" -echo " sys/amd64/include sys/i386/include include \\" +echo " sys/amd64/acpica sys/arm64/acpica sys/i386/acpica sys/x86/acpica \\" +echo " sys/amd64/include sys/arm64/include sys/i386/include include \\" echo " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi" diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index ff863a7c3cb1..49c88a49bbe6 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,7 +1,249 @@ ---------------------------------------- -27 May 2016. Summary of changes for version 20160527: +30 September 2016. Summary of changes for version 20160930: -This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +Fixed a regression in the internal AcpiTbFindTable function where a non +AE_OK exception could inadvertently be returned even if the function did +not fail. This problem affects the following operators: + DataTableRegion + LoadTable + +Fixed a regression in the LoadTable operator where a load to any +namespace location other than the root no longer worked properly. + +Increased the maximum loop count value that will result in the +AE_AML_INFINITE_LOOP exception. This is a mechanism that is intended to +prevent infinite loops within the AML interpreter and thus the host OS +kernel. The value is increased from 0xFFFF to 0xFFFFF loops (65,535 to +1,048,575). + +Moved the AcpiGbl_MaxLoopIterations configuration variable to the public +acpixf.h file. This allows hosts to easily configure the maximum loop +count at runtime. + +Removed an illegal character in the strtoul64.c file. This character +caused errors with some C compilers. + +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.4K Code, 58.1K Data, 198.5K Total + Debug Version: 200.7K Code, 82.1K Data, 282.8K Total + Previous Release: + Non-Debug Version: 140.0K Code, 58.1K Data, 198.1K Total + Debug Version: 200.3K Code, 82.1K Data, 282.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with the conversion of Else{If{ blocks into +the simpler ASL ElseIf keyword. During the conversion, a trailing If +block could be lost and missing from the disassembled output. + +iASL: Fixed a missing parser rule for the ObjectType operator. For ASL+, +the missing rule caused a parse error when using the Index operator as an +operand to ObjectType. This construct now compiles properly. Example: + ObjectType(PKG1[4]). + +iASL: Correctly handle unresolved symbols in the hardware map file (-lm +option). Previously, unresolved symbols could cause a protection fault. +Such symbols are now marked as unresolved in the map file. + +iASL: Implemented support to allow control method invocations as an +operand to the ASL DeRefOf operator. Example: + DeRefOf(MTH1(Local0)) + +Disassembler: Improved support for the ToPLD ASL macro. Detection of a +possible _PLD buffer now includes examination of both the normal buffer +length (16 or 20) as well as the surrounding AML package length. + +Disassembler: Fixed a problem with the decoding of complex expressions +within the Divide operator for ASL+. For the case where both the quotient +and remainder targets are specified, the entire statement cannot be +disassembled. Previously, the output incorrectly contained a mix of ASL- +and ASL+ operators. This mixed statement causes a syntax error when +compiled. Example: + Divide (Add (INT1, 6), 128, RSLT, QUOT) // was incorrectly +disassembled to: + Divide (INT1 + 6, 128, RSLT, QUOT) + +iASL/Tools: Added support to process AML and non-AML ACPI tables +consistently. For the disassembler and AcpiExec, allow all types of ACPI +tables (AML and data tables). For the iASL -e option, allow only AML +tables (DSDT/SSDT). + +---------------------------------------- +31 August 2016. Summary of changes for version 20160831: + + +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: + +Implemented basic UEFI support for the various ACPICA tools. This +includes: +1) An OSL to implement the various AcpiOs* interfaces on UEFI. +2) Support to obtain the ACPI tables on UEFI. +3) Local implementation of required C library functions not available on +UEFI. +4) A front-end (main) function for the tools for UEFI-related +initialization. + +The initial deployment of this support is the AcpiDump utility executing +as an UEFI application via EDK2 (EDKII, "UEFI Firmware Development Kit"). +Current environments supported are Linux/Unix. MSVC generation is not +supported at this time. See the generate/efi/README file for build +instructions. Lv Zheng. + +Future plans include porting the AcpiExec utility to execute natively on +the platform with I/O and memory access. This will allow viewing/dump of +the platform namespace and native execution of ACPI control methods that +access the actual hardware. To fully implement this support, the OSL +functions below must be implemented with UEFI interfaces. Any community +help in the implementation of these functions would be appreciated: + AcpiOsReadPort + AcpiOsWritePort + AcpiOsReadMemory + AcpiOsWriteMemory + 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 +include files. These changes may affect the existing platform-dependent +configuration files on some hosts. Lv Zheng. + +The current C library configuration options appear below. For any issues, +it may be helpful to examine the existing compiler-dependent and +platform-dependent files as examples. Lv Zheng. + +1) Linux kernel: + ACPI_USE_STANDARD_HEADERS=n in order not to use system-provided C +library. + ACPI_USE_SYSTEM_CLIBRARY=y in order not to use ACPICA mini C library. +2) Unix/Windows/BSD applications: + ACPI_USE_STANDARD_HEADERS=y in order to use system-provided C +library. + ACPI_USE_SYSTEM_CLIBRARY=y in order not to use ACPICA mini C library. +3) UEFI applications: + ACPI_USE_STANDARD_HEADERS=n in order not to use system-provided C +library. + ACPI_USE_SYSTEM_CLIBRARY=n in order to use ACPICA mini C library. +4) UEFI applications (EDK2/StdLib): + ACPI_USE_STANDARD_HEADERS=y in order to use EDK2 StdLib C library. + ACPI_USE_SYSTEM_CLIBRARY=y in order to use EDK2 StdLib C library. + + +AML interpreter: "module-level code" support. Allows for execution of so- +called "executable" AML code (math/logical operations, etc.) outside of +control methods not just at the module level (top level) but also within +any scope declared outside of a control method - Scope{}, Device{}, +Processor{}, PowerResource{}, and ThermalZone{}. Lv Zheng. + +Simplified the configuration of the "maximum AML loops" global option by +adding a global public variable, "AcpiGbl_MaxLoopIterations" which can be +modified at runtime. + + +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: 139.1K Code, 22.9K Data, 162.0K Total + Debug Version: 199.0K Code, 81.8K Data, 280.8K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Add full support for the RASF ACPI table (RAS Features Table). +Includes disassembler, data table compiler, and header support. + +iASL Expand "module-level code" support. Allows for +compilation/disassembly of so-called "executable" AML code (math/logical +operations, etc.) outside of control methods not just at the module level +(top level) but also within any scope declared outside of a control +method - Scope{}, Device{}, Processor{}, PowerResource{}, and +ThermalZone{}. + +AcpiDump: Added support for dumping all SSDTs on newer versions of +Windows. These tables are now easily available -- SSDTs are not available +through the registry on older versions. + +---------------------------------------- +27 May 2016. Summary of changes for version 20160527: 1) ACPICA kernel-resident subsystem: diff --git a/sys/contrib/dev/acpica/common/acfileio.c b/sys/contrib/dev/acpica/common/acfileio.c index da64d40378c6..a38c7ca78c31 100644 --- a/sys/contrib/dev/acpica/common/acfileio.c +++ b/sys/contrib/dev/acpica/common/acfileio.c @@ -43,10 +43,9 @@ #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> -#include <contrib/dev/acpica/include/acapps.h> #include <contrib/dev/acpica/include/actables.h> #include <contrib/dev/acpica/include/acutils.h> -#include <errno.h> +#include <contrib/dev/acpica/include/acapps.h> #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("acfileio") @@ -98,7 +97,7 @@ AcGetAllTablesFromFile ( File = fopen (Filename, "rb"); if (!File) { - perror ("Could not open input file"); + fprintf (stderr, "Could not open input file: %s\n", Filename); if (errno == ENOENT) { return (AE_NOT_EXIST); @@ -263,12 +262,14 @@ AcGetOneTableFromFile ( return (Status); } + if (GetOnlyAmlTables) { - /* Table must be an AML table (DSDT/SSDT) or FADT */ - - if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) && - !AcpiUtIsAmlTable (&TableHeader)) + /* + * Table must be an AML table (DSDT/SSDT). + * Used for iASL -e option only. + */ + if (!AcpiUtIsAmlTable (&TableHeader)) { fprintf (stderr, " %s: Table [%4.4s] is not an AML table - ignoring\n", @@ -280,7 +281,7 @@ AcGetOneTableFromFile ( /* Allocate a buffer for the entire table */ - Table = AcpiOsAllocate ((size_t) TableHeader.Length); + Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length); if (!Table) { return (AE_NO_MEMORY); @@ -388,7 +389,7 @@ AcValidateTableHeader ( long TableOffset) { ACPI_TABLE_HEADER TableHeader; - size_t Actual; + ACPI_SIZE Actual; long OriginalOffset; UINT32 FileSize; UINT32 i; diff --git a/sys/contrib/dev/acpica/common/acgetline.c b/sys/contrib/dev/acpica/common/acgetline.c index 1f67ca359162..98b3679e2e96 100644 --- a/sys/contrib/dev/acpica/common/acgetline.c +++ b/sys/contrib/dev/acpica/common/acgetline.c @@ -47,8 +47,6 @@ #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acdebug.h> -#include <stdio.h> - /* * This is an os-independent implementation of line-editing services needed * by the AcpiExec utility. It uses getchar() and putchar() and the existing diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 73499aeae975..fcc3923fe57e 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -49,8 +49,6 @@ #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acapps.h> -#include <stdio.h> - #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("adisasm") diff --git a/sys/contrib/dev/acpica/common/ahtable.c b/sys/contrib/dev/acpica/common/ahtable.c index a3d18de51532..49653412dcc6 100644 --- a/sys/contrib/dev/acpica/common/ahtable.c +++ b/sys/contrib/dev/acpica/common/ahtable.c @@ -124,6 +124,7 @@ const AH_TABLE AcpiSupportedTables[] = {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, + {ACPI_SIG_RASF, "RAS Features Table"}, {ACPI_RSDP_NAME,"Root System Description Pointer"}, {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, diff --git a/sys/contrib/dev/acpica/common/cmfsize.c b/sys/contrib/dev/acpica/common/cmfsize.c index e27a8de6519f..f4e8ac7966ec 100644 --- a/sys/contrib/dev/acpica/common/cmfsize.c +++ b/sys/contrib/dev/acpica/common/cmfsize.c @@ -44,7 +44,6 @@ #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acapps.h> -#include <stdio.h> #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("cmfsize") @@ -74,19 +73,19 @@ CmGetFileSize ( /* Save the current file pointer, seek to EOF to obtain file size */ - CurrentOffset = AcpiOsGetFileOffset (File); + CurrentOffset = ftell (File); if (CurrentOffset < 0) { goto OffsetError; } - Status = AcpiOsSetFileOffset (File, 0, ACPI_FILE_END); + Status = fseek (File, 0, SEEK_END); if (ACPI_FAILURE (Status)) { goto SeekError; } - FileSize = AcpiOsGetFileOffset (File); + FileSize = ftell (File); if (FileSize < 0) { goto OffsetError; @@ -94,7 +93,7 @@ CmGetFileSize ( /* Restore original file pointer */ - Status = AcpiOsSetFileOffset (File, CurrentOffset, ACPI_FILE_BEGIN); + Status = fseek (File, CurrentOffset, SEEK_SET); if (ACPI_FAILURE (Status)) { goto SeekError; @@ -104,10 +103,10 @@ CmGetFileSize ( OffsetError: - AcpiLogError ("Could not get file offset"); + fprintf (stderr, "Could not get file offset\n"); return (ACPI_UINT32_MAX); SeekError: - AcpiLogError ("Could not set file offset"); + fprintf (stderr, "Could not set file offset\n"); return (ACPI_UINT32_MAX); } diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 36e56d95b432..4ec52db71e41 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -358,6 +358,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, + {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, @@ -844,6 +845,11 @@ AcpiDmDumpTable ( ByteLength = 10; break; + case ACPI_DMT_BUF12: + + ByteLength = 12; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: @@ -1006,6 +1012,7 @@ AcpiDmDumpTable ( case ACPI_DMT_BUF7: case ACPI_DMT_BUF10: + case ACPI_DMT_BUF12: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: /* diff --git a/sys/contrib/dev/acpica/common/dmtables.c b/sys/contrib/dev/acpica/common/dmtables.c index f0963c57e311..258182311b1d 100644 --- a/sys/contrib/dev/acpica/common/dmtables.c +++ b/sys/contrib/dev/acpica/common/dmtables.c @@ -42,14 +42,12 @@ */ #include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/include/acapps.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/actables.h> #include <contrib/dev/acpica/include/acparser.h> +#include <contrib/dev/acpica/include/acapps.h> -#include <stdio.h> -#include <time.h> #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("dmtables") diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index d79658fc1568..2a133e1c945a 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -52,12 +52,31 @@ ACPI_MODULE_NAME ("dmtbdump") -/* Local prototypes */ +/* Table of revision-dependent FADT sizes */ -static void -AcpiDmValidateFadtLength ( - UINT32 Revision, - UINT32 Length); +static const UINT32 FadtRevisionLength [ACPI_FADT_MAX_VERSION + 1] = +{ + 0, /* 0 - illegal */ + ACPI_FADT_V1_SIZE, /* 1 - ACPI 1.0 */ + 0, /* 2 - illegal */ + ACPI_FADT_V3_SIZE, /* 3 - ACPI 2.0 */ + ACPI_FADT_V4_SIZE, /* 4 - ACPI 3.0 and ACPI 4.0 */ + ACPI_FADT_V5_SIZE, /* 5 - ACPI 5.0 */ + ACPI_FADT_V6_SIZE /* 6 - ACPI 6.0 */ +}; + +/* Table of revision-dependent FADT info tables */ + +ACPI_DMTABLE_INFO *FadtRevisionInfo [ACPI_FADT_MAX_VERSION + 1] = +{ + NULL, /* 0 - illegal */ + AcpiDmTableInfoFadt1, /* 1 - ACPI 1.0 */ + NULL, /* 2 - illegal */ + AcpiDmTableInfoFadt3, /* 3 - ACPI 2.0 */ + AcpiDmTableInfoFadt4, /* 4 - ACPI 3.0 and ACPI 4.0 */ + AcpiDmTableInfoFadt5, /* 5 - ACPI 5.0 */ + AcpiDmTableInfoFadt6 /* 6 - ACPI 6.0 */ +}; /******************************************************************************* @@ -347,6 +366,11 @@ AcpiDmDumpXsdt ( * * DESCRIPTION: Format the contents of a FADT * + * Check the FADT revision against the expected table length for + * that revision. Issue a warning if the length is not what was + * expected. This seems to be such a common BIOS bug that the + * FADT revision has been rendered virtually meaningless. + * * NOTE: We cannot depend on the FADT version to indicate the actual * contents of the FADT because of BIOS bugs. The table length * is the only reliable indicator. @@ -358,142 +382,72 @@ AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; + UINT8 FadtRevision; + UINT32 ExpectedLength; + UINT32 i; - /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ + FadtRevision = Table->Revision; - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoFadt1); - if (ACPI_FAILURE (Status)) + /* FADT revision/length validation */ + + if ((FadtRevision == 0) || + (FadtRevision == 2)) { + AcpiOsPrintf ( + "// ACPI Warning: Invalid or unsupported FADT revision: %u\n", + FadtRevision); return; } - /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ - - if ((Table->Length > ACPI_FADT_V1_SIZE) && - (Table->Length <= ACPI_FADT_V2_SIZE)) + if (FadtRevision > ACPI_FADT_MAX_VERSION) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoFadt2); - if (ACPI_FAILURE (Status)) + AcpiOsPrintf ("// ACPI Warning: Revision %u is not fully supported, " + "disassembling known fields (up to revision %u)\n\n", + FadtRevision, ACPI_FADT_MAX_VERSION); + } + else + { + ExpectedLength = FadtRevisionLength[FadtRevision]; + if (Table->Length != ExpectedLength) { - return; + AcpiOsPrintf ( + "// ACPI Warning: Input FADT revision %X does not match " + "expected length: found 0x%X expected 0x%X\n", + FadtRevision, Table->Length, ExpectedLength); } } - /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ - - else if (Table->Length > ACPI_FADT_V2_SIZE) + /* + * Dump the input table on a per-version basis, but is actually + * based upon the length of the table. Table length must + * be larger than the required length of the previous version. + */ + for (i = 1; i <= ACPI_FADT_MAX_VERSION; i++) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoFadt3); - if (ACPI_FAILURE (Status)) + if (!FadtRevisionLength[i]) /* Skip any empty slots */ { - return; + continue; } - /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ + /* Dump the fields specific to FADT revision[i] */ - if (Table->Length > ACPI_FADT_V3_SIZE) + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + FadtRevisionInfo[i]); + if (ACPI_FAILURE (Status)) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoFadt5); - if (ACPI_FAILURE (Status)) - { - return; - } + return; } - /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ - - if (Table->Length > ACPI_FADT_V3_SIZE) + if (Table->Length <= FadtRevisionLength[i]) { - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, - AcpiDmTableInfoFadt6); - if (ACPI_FAILURE (Status)) - { - return; - } + break; /* End of table */ } } - /* Validate various fields in the FADT, including length */ + /* Build a local FADT to test some FADT values */ AcpiTbCreateLocalFadt (Table, Table->Length); - - /* Validate FADT length against the revision */ - - AcpiDmValidateFadtLength (Table->Revision, Table->Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDmValidateFadtLength - * - * PARAMETERS: Revision - FADT revision (Header->Revision) - * Length - FADT length (Header->Length - * - * RETURN: None - * - * DESCRIPTION: Check the FADT revision against the expected table length for - * that revision. Issue a warning if the length is not what was - * expected. This seems to be such a common BIOS bug that the - * FADT revision has been rendered virtually meaningless. - * - ******************************************************************************/ - -static void -AcpiDmValidateFadtLength ( - UINT32 Revision, - UINT32 Length) -{ - UINT32 ExpectedLength; - - - switch (Revision) - { - case 0: - - AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n"); - return; - - case 1: - - ExpectedLength = ACPI_FADT_V1_SIZE; - break; - - case 2: - - ExpectedLength = ACPI_FADT_V2_SIZE; - break; - - case 3: - case 4: - - ExpectedLength = ACPI_FADT_V3_SIZE; - break; - - case 5: - - ExpectedLength = ACPI_FADT_V5_SIZE; - break; - - default: - - return; - } - - if (Length == ExpectedLength) - { - return; - } - - AcpiOsPrintf ( - "\n// ACPI Warning: FADT revision %X does not match length: " - "found %X expected %X\n", - Revision, Length, ExpectedLength); } diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index cce6c5cc1bcb..2c2774516c93 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -106,6 +106,7 @@ #define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f) #define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) #define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) +#define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) @@ -399,7 +400,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = * ******************************************************************************/ -/* ACPI 1.0 FADT (Version 1) */ +/* FADT version 1 (ACPI 1.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = { @@ -485,18 +486,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = ACPI_DMT_TERMINATOR }; -/* ACPI 1.0 MS Extensions (FADT version 2) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = -{ - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (ArmBootFlags), "Reserved", 0}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MinorRevision), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* ACPI 2.0+ Extensions (FADT version 3, 4, and 5) */ +/* FADT version 3 (ACPI 2.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = { @@ -520,16 +510,23 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = ACPI_DMT_TERMINATOR }; -/* ACPI 5.0 Extensions (FADT version 5) */ +/* FADT version 4 (ACPI 3.0 and ACPI 4.0) */ -ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt4[] = { {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepControl), "Sleep Control Register", 0}, + ACPI_DMT_TERMINATOR +}; + +/* FADT version 5 (ACPI 5.0) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = +{ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepStatus), "Sleep Status Register", 0}, ACPI_DMT_TERMINATOR }; -/* ACPI 6.0 Extensions (FADT version 6) */ +/* FADT version 6 (ACPI 6.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[] = { @@ -2440,6 +2437,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = /******************************************************************************* * + * RASF - RAS Feature table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[] = +{ + {ACPI_DMT_BUF12, ACPI_RASF_OFFSET (ChannelId[0]), "Channel ID", 0}, + ACPI_DMT_TERMINATOR +}; + +/******************************************************************************* + * * S3PT - S3 Performance Table * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c index e86085181c47..f59269a021e8 100644 --- a/sys/contrib/dev/acpica/common/getopt.c +++ b/sys/contrib/dev/acpica/common/getopt.c @@ -57,7 +57,7 @@ #include <contrib/dev/acpica/include/acapps.h> #define ACPI_OPTION_ERROR(msg, badchar) \ - if (AcpiGbl_Opterr) {AcpiLogError ("%s%c\n", msg, badchar);} + if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} int AcpiGbl_Opterr = 1; @@ -101,7 +101,7 @@ AcpiGetoptArgument ( } else if (++AcpiGbl_Optind >= argc) { - ACPI_OPTION_ERROR ("Option requires an argument: -", 'v'); + ACPI_OPTION_ERROR ("\nOption requires an argument", 0); CurrentCharPtr = 1; return (-1); diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 4062ce283be3..200cc0236032 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -62,7 +62,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdarg.h> #include <string.h> #include <errno.h> #include <ctype.h> @@ -912,7 +911,7 @@ LkFindUnreferencedObjects ( void); /* - * aslmain - startup + * aslhelp - help screens */ void Usage ( @@ -922,6 +921,10 @@ void AslFilenameHelp ( void); +void +AslDisassemblyHelp ( + void); + /* * aslnamesp - namespace output file generation diff --git a/sys/contrib/dev/acpica/compiler/aslcstyle.y b/sys/contrib/dev/acpica/compiler/aslcstyle.y index 62a7b65f769f..fc7d5933df19 100644 --- a/sys/contrib/dev/acpica/compiler/aslcstyle.y +++ b/sys/contrib/dev/acpica/compiler/aslcstyle.y @@ -82,6 +82,13 @@ NoEcho(' * 13) = += -= *= /= %= <<= >>= &= ^= |= */ + +/******************************************************************************* + * + * Basic operations for math and logical expressions. + * + ******************************************************************************/ + Expression /* Unary operators */ @@ -140,33 +147,43 @@ Expression | TermArg PARSEOP_EXP_LOGICAL_OR {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - /* Parentheses */ + /* Parentheses */ | '(' TermArg ')' { $$ = $2;} - /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ + /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ - | SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT - {$$ = TrCreateLeafNode (PARSEOP_INDEX); + | SuperName PARSEOP_EXP_INDEX_LEFT + TermArg PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafNode (PARSEOP_INDEX); TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} ; - /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ + /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ IndexExpTerm - : SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT - {$$ = TrCreateLeafNode (PARSEOP_INDEX); + : SuperName PARSEOP_EXP_INDEX_LEFT + TermArg PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafNode (PARSEOP_INDEX); TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} ; + +/******************************************************************************* + * + * All assignment-type operations -- math and logical. Includes simple + * assignment and compound assignments. + * + ******************************************************************************/ + EqualsTerm - /* All assignment-type operations */ + /* Simple Store() operation */ : SuperName PARSEOP_EXP_EQUALS TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + /* Compound assignments -- Add (operand, operand, target) */ + | TermArg PARSEOP_EXP_ADD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} diff --git a/sys/contrib/dev/acpica/compiler/aslhelp.c b/sys/contrib/dev/acpica/compiler/aslhelp.c new file mode 100644 index 000000000000..caa1b092624c --- /dev/null +++ b/sys/contrib/dev/acpica/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 <contrib/dev/acpica/compiler/aslcompiler.h> +#include <contrib/dev/acpica/include/acapps.h> + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslhelp") + + +/******************************************************************************* + * + * FUNCTION: Usage + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display option help message. + * Optional items in square brackets. + * + ******************************************************************************/ + +void +Usage ( + void) +{ + printf ("%s\n\n", ASL_COMPLIANCE); + ACPI_USAGE_HEADER ("iasl [Options] [Files]"); + + printf ("\nGeneral:\n"); + ACPI_OPTION ("-@ <file>", "Specify command file"); + ACPI_OPTION ("-I <dir>", "Specify additional include directory"); + ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files"); + ACPI_OPTION ("-v", "Display compiler version"); + ACPI_OPTION ("-vd", "Display compiler build date and time"); + ACPI_OPTION ("-vo", "Enable optimization comments"); + ACPI_OPTION ("-vs", "Disable signon"); + + printf ("\nHelp:\n"); + ACPI_OPTION ("-h", "This message"); + ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); + ACPI_OPTION ("-hd", "Info for obtaining and disassembling binary ACPI tables"); + ACPI_OPTION ("-hf", "Display help for output filename generation"); + ACPI_OPTION ("-hr", "Display ACPI reserved method names"); + ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); + + printf ("\nPreprocessor:\n"); + ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use"); + ACPI_OPTION ("-li", "Create preprocessed output file (*.i)"); + ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)"); + ACPI_OPTION ("-Pn", "Disable preprocessor"); + + printf ("\nErrors, Warnings, and Remarks:\n"); + ACPI_OPTION ("-va", "Disable all errors/warnings/remarks"); + ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)"); + ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); + ACPI_OPTION ("-vr", "Disable remarks"); + ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark"); + ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); + ACPI_OPTION ("-we", "Report warnings as errors"); + + printf ("\nAML Code Generation (*.aml):\n"); + ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)"); + ACPI_OPTION ("-of", "Disable constant folding"); + ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); + ACPI_OPTION ("-on", "Disable named reference string optimization"); + ACPI_OPTION ("-ot", "Disable typechecking"); + ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking"); + ACPI_OPTION ("-in", "Ignore NoOp operators"); + ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)"); + + printf ("\nListings:\n"); + ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)"); + ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)"); + ACPI_OPTION ("-ln", "Create namespace file (*.nsp)"); + ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); + ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)"); + + printf ("\nFirmware Support - C Output:\n"); + ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)"); + ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)"); + ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)"); + ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)"); + + printf ("\nFirmware Support - Assembler Output:\n"); + ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)"); + ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)"); + ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)"); + + printf ("\nFirmware Support - ASL Output:\n"); + ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)"); + + printf ("\nData Table Compiler:\n"); + ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); + ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files"); + ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file"); + ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)"); + + printf ("\nAML Disassembler:\n"); + ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)"); + ACPI_OPTION ("", " (Optional, file type is automatically detected)"); + ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); + ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it"); + ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); + ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML"); + ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)"); + ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file"); + ACPI_OPTION ("-in", "Ignore NoOp opcodes"); + ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code"); + ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); + + printf ("\nDebug Options:\n"); + ACPI_OPTION ("-bf", "Create debug file (full output) (*.txt)"); + ACPI_OPTION ("-bs", "Create debug file (parse tree only) (*.txt)"); + ACPI_OPTION ("-bp <depth>", "Prune ASL parse tree"); + ACPI_OPTION ("-bt <type>", "Object type to be pruned from the parse tree"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)"); + ACPI_OPTION ("-n", "Parse only, no output generation"); + ACPI_OPTION ("-oc", "Display compile times and statistics"); + ACPI_OPTION ("-x <level>", "Set debug level for trace output"); + ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); +} + + +/******************************************************************************* + * + * FUNCTION: FilenameHelp + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display help message for output filename generation + * + ******************************************************************************/ + +void +AslFilenameHelp ( + void) +{ + + printf ("\nAML output filename generation:\n"); + printf (" Output filenames are generated by appending an extension to a common\n"); + printf (" filename prefix. The filename prefix is obtained via one of the\n"); + printf (" following methods (in priority order):\n"); + printf (" 1) The -p option specifies the prefix\n"); + printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); + printf (" 3) The prefix of the input filename\n"); + printf ("\n"); +} + +/******************************************************************************* + * + * FUNCTION: AslDisassemblyHelp + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL + * files. + * + ******************************************************************************/ + +void +AslDisassemblyHelp ( + void) +{ + + printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n"); + printf ("Use the following ACPICA toolchain:\n"); + printf (" AcpiDump: Dump all ACPI tables to a hex ascii file\n"); + printf (" AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n"); + printf (" iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n"); + printf ("\n"); +} diff --git a/sys/contrib/dev/acpica/compiler/aslhelpers.y b/sys/contrib/dev/acpica/compiler/aslhelpers.y new file mode 100644 index 000000000000..f3a94de9c4cd --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslhelpers.y @@ -0,0 +1,286 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslhelpers.y - helper and option terms + * + *****************************************************************************/ + +/* + * 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. + */ + +') + + +/******************************************************************************* + * + * ASL Helper Terms + * + ******************************************************************************/ + +OptionalBusMasterKeyword + : ',' {$$ = TrCreateLeafNode ( + PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode ( + PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode ( + PARSEOP_BUSMASTERTYPE_NOTMASTER);} + ; + +OptionalAccessAttribTerm + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ByteConstExpr {$$ = $2;} + | ',' AccessAttribKeyword {$$ = $2;} + ; + +OptionalAccessSize + : {$$ = TrCreateValuedLeafNode ( + PARSEOP_BYTECONST, 0);} + | ',' {$$ = TrCreateValuedLeafNode ( + PARSEOP_BYTECONST, 0);} + | ',' ByteConstExpr {$$ = $2;} + ; + +OptionalAddressingMode + : ',' {$$ = NULL;} + | ',' AddressingModeKeyword {$$ = $2;} + ; + +OptionalAddressRange + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' AddressKeyword {$$ = $2;} + ; + +OptionalBitsPerByte + : ',' {$$ = NULL;} + | ',' BitsPerByteKeyword {$$ = $2;} + ; + +OptionalBuffer_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' RawDataBufferTerm {$$ = $2;} + ; + +OptionalByteConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ByteConstExpr {$$ = $2;} + ; + +OptionalDecodeType + : ',' {$$ = NULL;} + | ',' DecodeKeyword {$$ = $2;} + ; + +OptionalDevicePolarity + : ',' {$$ = NULL;} + | ',' DevicePolarityKeyword {$$ = $2;} + ; + +OptionalDWordConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' DWordConstExpr {$$ = $2;} + ; + +OptionalEndian + : ',' {$$ = NULL;} + | ',' EndianKeyword {$$ = $2;} + ; + +OptionalFlowControl + : ',' {$$ = NULL;} + | ',' FlowControlKeyword {$$ = $2;} + ; + +OptionalIoRestriction + : ',' {$$ = NULL;} + | ',' IoRestrictionKeyword {$$ = $2;} + ; + +OptionalListString + : {$$ = TrCreateValuedLeafNode ( + PARSEOP_STRING_LITERAL, + ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' {$$ = TrCreateValuedLeafNode ( + PARSEOP_STRING_LITERAL, + ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' TermArg {$$ = $2;} + ; + +OptionalMaxType + : ',' {$$ = NULL;} + | ',' MaxKeyword {$$ = $2;} + ; + +OptionalMemType + : ',' {$$ = NULL;} + | ',' MemTypeKeyword {$$ = $2;} + ; + +OptionalMinType + : ',' {$$ = NULL;} + | ',' MinKeyword {$$ = $2;} + ; + +OptionalNameString + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' NameString {$$ = $2;} + ; + +OptionalNameString_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' NameString {$$ = $2;} + ; + +OptionalNameString_First + : {$$ = TrCreateLeafNode ( + PARSEOP_ZERO);} + | NameString {$$ = $1;} + ; + +OptionalObjectTypeKeyword + : {$$ = TrCreateLeafNode ( + PARSEOP_OBJECTTYPE_UNK);} + | ',' ObjectTypeKeyword {$$ = $2;} + ; + +OptionalParityType + : ',' {$$ = NULL;} + | ',' ParityTypeKeyword {$$ = $2;} + ; + +OptionalQWordConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' QWordConstExpr {$$ = $2;} + ; + +OptionalRangeType + : ',' {$$ = NULL;} + | ',' RangeTypeKeyword {$$ = $2;} + ; + +OptionalReadWriteKeyword + : {$$ = TrCreateLeafNode ( + PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode ( + PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode ( + PARSEOP_READWRITETYPE_READONLY);} + ; + +OptionalResourceType_First + : {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ResourceTypeKeyword {$$ = $1;} + ; + +OptionalResourceType + : {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' ResourceTypeKeyword {$$ = $2;} + ; + +OptionalSlaveMode + : ',' {$$ = NULL;} + | ',' SlaveModeKeyword {$$ = $2;} + ; + +OptionalShareType + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ShareTypeKeyword {$$ = $2;} + ; + +OptionalShareType_First + : {$$ = NULL;} + | ShareTypeKeyword {$$ = $1;} + ; + +OptionalStopBits + : ',' {$$ = NULL;} + | ',' StopBitsKeyword {$$ = $2;} + ; + +OptionalStringData + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' StringData {$$ = $2;} + ; + +OptionalTranslationType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TranslationKeyword {$$ = $2;} + ; + +OptionalType + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalWireMode + : ',' {$$ = NULL;} + | ',' WireModeKeyword {$$ = $2;} + ; + +OptionalWordConstExpr + : ',' {$$ = NULL;} + | ',' WordConstExpr {$$ = $2;} + ; + +OptionalXferSize + : {$$ = TrCreateValuedLeafNode ( + PARSEOP_XFERSIZE_32, 2);} + | ',' {$$ = TrCreateValuedLeafNode ( + PARSEOP_XFERSIZE_32, 2);} + | ',' XferSizeKeyword {$$ = $2;} + ; diff --git a/sys/contrib/dev/acpica/compiler/aslkeywords.y b/sys/contrib/dev/acpica/compiler/aslkeywords.y new file mode 100644 index 000000000000..51af1c684a31 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslkeywords.y @@ -0,0 +1,352 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslkeywords.y - Rules for resource descriptor keywords + * + *****************************************************************************/ + +/* + * 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. + */ + +') + +/******************************************************************************* + * + * ASL Parameter Keyword Terms + * + ******************************************************************************/ + +AccessAttribKeyword + : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} + | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} + | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} + | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} + | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} + | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} + | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} + | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + ; + +AccessTypeKeyword + : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} + | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} + | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} + | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} + | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} + | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} + ; + +AddressingModeKeyword + : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} + | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} + ; + +AddressKeyword + : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} + | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} + | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} + | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} + ; + +AddressSpaceKeyword + : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + | RegionSpaceKeyword {} + ; + +BitsPerByteKeyword + : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} + | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} + | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} + | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} + | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} + ; + +ClockPhaseKeyword + : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} + | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} + ; + +ClockPolarityKeyword + : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} + | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} + ; + +DecodeKeyword + : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} + | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} + ; + +DevicePolarityKeyword + : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} + | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} + ; + +DMATypeKeyword + : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} + | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} + | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} + | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} + ; + +EndianKeyword + : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} + | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} + ; + +FlowControlKeyword + : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} + | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} + | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} + ; + +InterruptLevel + : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} + | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} + | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} + ; + +InterruptTypeKeyword + : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} + | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} + ; + +IODecodeKeyword + : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} + | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} + ; + +IoRestrictionKeyword + : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} + | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} + | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} + | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} + ; + +LockRuleKeyword + : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} + | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} + ; + +MatchOpKeyword + : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} + | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} + | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} + | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} + | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} + | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} + ; + +MaxKeyword + : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} + | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} + ; + +MemTypeKeyword + : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} + | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} + | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} + | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} + ; + +MinKeyword + : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} + | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} + ; + +ObjectTypeKeyword + : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} + | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} + | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} + | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} + | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} + | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} + | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} + | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} + | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} + | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} + | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} + | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} + | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} + | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} + | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} + | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} + ; + +ParityTypeKeyword + : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} + | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} + | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} + | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} + | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} + ; + +PinConfigByte + : PinConfigKeyword {$$ = $1;} + | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +PinConfigKeyword + : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} + | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} + | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} + | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} + ; + +PldKeyword + : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} + | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} + | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} + | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} + | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} + | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} + | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} + | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} + | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} + | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} + | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} + | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} + | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} + | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} + | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} + | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} + | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} + | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} + | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} + | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} + | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} + | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} + | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} + | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} + | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} + | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} + | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} + | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} + ; + +RangeTypeKeyword + : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} + | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} + | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} + ; + +RegionSpaceKeyword + : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} + | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} + | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} + | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} + | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} + | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} + | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} + | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} + | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} + | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} + ; + +ResourceTypeKeyword + : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} + ; + +SerializeRuleKeyword + : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} + | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} + ; + +ShareTypeKeyword + : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} + | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} + | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} + | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} + ; + +SlaveModeKeyword + : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} + | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} + ; + +StopBitsKeyword + : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} + | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} + | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} + | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} + ; + +TranslationKeyword + : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} + | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} + ; + +TypeKeyword + : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} + | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} + ; + +UpdateRuleKeyword + : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} + | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} + | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} + ; + +WireModeKeyword + : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} + | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);} + ; + +XferSizeKeyword + : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8, 0);} + | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16, 1);} + | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64, 3);} + | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);} + | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);} + ; + +XferTypeKeyword + : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} + | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} + | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} + ; diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 25c7b9a68089..0e8cda9ef479 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -76,234 +76,15 @@ AslInitialize ( /******************************************************************************* * - * FUNCTION: Usage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display option help message. - * Optional items in square brackets. - * - ******************************************************************************/ - -void -Usage ( - void) -{ - printf ("%s\n\n", ASL_COMPLIANCE); - ACPI_USAGE_HEADER ("iasl [Options] [Files]"); - - printf ("\nGeneral:\n"); - ACPI_OPTION ("-@ <file>", "Specify command file"); - ACPI_OPTION ("-I <dir>", "Specify additional include directory"); - ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files"); - ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file"); - ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files"); - ACPI_OPTION ("-v", "Display compiler version"); - ACPI_OPTION ("-vo", "Enable optimization comments"); - ACPI_OPTION ("-vs", "Disable signon"); - - printf ("\nHelp:\n"); - ACPI_OPTION ("-h", "This message"); - ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); - ACPI_OPTION ("-hf", "Display help for output filename generation"); - ACPI_OPTION ("-hr", "Display ACPI reserved method names"); - ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); - - printf ("\nPreprocessor:\n"); - ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use"); - ACPI_OPTION ("-li", "Create preprocessed output file (*.i)"); - ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)"); - ACPI_OPTION ("-Pn", "Disable preprocessor"); - - printf ("\nErrors, Warnings, and Remarks:\n"); - ACPI_OPTION ("-va", "Disable all errors/warnings/remarks"); - ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)"); - ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); - ACPI_OPTION ("-vr", "Disable remarks"); - ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark"); - ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level"); - ACPI_OPTION ("-we", "Report warnings as errors"); - - printf ("\nAML Code Generation (*.aml):\n"); - ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)"); - ACPI_OPTION ("-of", "Disable constant folding"); - ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); - ACPI_OPTION ("-on", "Disable named reference string optimization"); - ACPI_OPTION ("-ot", "Disable typechecking"); - ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking"); - ACPI_OPTION ("-in", "Ignore NoOp operators"); - ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)"); - - printf ("\nOptional Source Code Output Files:\n"); - ACPI_OPTION ("-sc -sa", "Create source file in C or assembler (*.c or *.asm)"); - ACPI_OPTION ("-ic -ia", "Create include file in C or assembler (*.h or *.inc)"); - ACPI_OPTION ("-tc -ta -ts", "Create hex AML table in C, assembler, or ASL (*.hex)"); - ACPI_OPTION ("-so", "Create offset table in C (*.offset.h)"); - - printf ("\nOptional Listing Files:\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 ("\nData Table Compiler:\n"); - ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); - ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)"); - - printf ("\nAML Disassembler:\n"); - ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)"); - ACPI_OPTION ("", " (Optional, file type is automatically detected)"); - ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace"); - ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); - ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it"); - ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); - ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML"); - ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)"); - ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution"); - ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file"); - ACPI_OPTION ("-in", "Ignore NoOp opcodes"); - ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code"); - ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); - - printf ("\nDebug Options:\n"); - ACPI_OPTION ("-bf", "Create debug file (full output) (*.txt)"); - ACPI_OPTION ("-bs", "Create debug file (parse tree only) (*.txt)"); - ACPI_OPTION ("-bp <depth>", "Prune ASL parse tree"); - ACPI_OPTION ("-bt <type>", "Object type to be pruned from the parse tree"); - ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); - ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)"); - ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-oc", "Display compile times and statistics"); - ACPI_OPTION ("-x <level>", "Set debug level for trace output"); - ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); -} - - -/******************************************************************************* - * - * FUNCTION: FilenameHelp - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display help message for output filename generation - * - ******************************************************************************/ - -void -AslFilenameHelp ( - void) -{ - - printf ("\nAML output filename generation:\n"); - printf (" Output filenames are generated by appending an extension to a common\n"); - printf (" filename prefix. The filename prefix is obtained via one of the\n"); - printf (" following methods (in priority order):\n"); - printf (" 1) The -p option specifies the prefix\n"); - printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); - printf (" 3) The prefix of the input filename\n"); - printf ("\n"); -} - - -/****************************************************************************** - * - * FUNCTION: AslSignalHandler - * - * PARAMETERS: Sig - Signal that invoked this handler - * - * RETURN: None - * - * DESCRIPTION: Control-C handler. Delete any intermediate files and any - * output files that may be left in an indeterminate state. - * - *****************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AslSignalHandler ( - int Sig) -{ - UINT32 i; - - - signal (Sig, SIG_IGN); - printf ("Aborting\n\n"); - - /* Close all open files */ - - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */ - - for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) - { - FlCloseFile (i); - } - - /* Delete any output files */ - - for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) - { - FlDeleteFile (i); - } - - exit (0); -} - - -/******************************************************************************* - * - * FUNCTION: AslInitialize - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize compiler globals - * - ******************************************************************************/ - -static void -AslInitialize ( - void) -{ - UINT32 i; - - - AcpiGbl_DmOpt_Verbose = FALSE; - - /* Default integer width is 64 bits */ - - AcpiGbl_IntegerBitWidth = 64; - AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; - - for (i = 0; i < ASL_NUM_FILES; i++) - { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; - } - - Gbl_Files[ASL_FILE_STDOUT].Handle = stdout; - Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - - Gbl_Files[ASL_FILE_STDERR].Handle = stderr; - Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; -} - - -/******************************************************************************* - * * FUNCTION: main * * PARAMETERS: Standard argc/argv * * RETURN: Program termination code * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile for each file on the command line + * DESCRIPTION: C main routine for the iASL Compiler/Disassembler. Process + * command line options and begin the compile/disassembly for each file on + * the command line (wildcards supported). * ******************************************************************************/ @@ -341,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 */ @@ -401,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/sys/contrib/dev/acpica/compiler/aslmaputils.c b/sys/contrib/dev/acpica/compiler/aslmaputils.c index a9d5136c2529..01185e6af1f2 100644 --- a/sys/contrib/dev/acpica/compiler/aslmaputils.c +++ b/sys/contrib/dev/acpica/compiler/aslmaputils.c @@ -80,6 +80,12 @@ MpGetHidFromParseTree ( Op = HidNode->Op; + if (!Op) + { + /* Object is not resolved, probably an External */ + + return ("Unresolved Symbol - referenced but not defined in this table"); + } switch (Op->Asl.ParseOpcode) { diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index 68e760cf30ef..36a324f1ac21 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -351,6 +351,20 @@ OpnDoFieldCommon ( NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; CurrentBitOffset += NewBitOffset; + if ((NewBitOffset == 0) && + (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES)) + { + /* + * Unnamed field with a bit length of zero. We can + * safely just ignore this. However, we will not ignore + * a named field of zero length, we don't want to just + * toss out a name. + */ + Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + break; + } + /* Save the current AccessAs value for error checking later */ switch (AccessType) diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 9c26d270212c..680e3fceee52 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index aee456427dcc..afd86351f754 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/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__; + /******************************************************************************* * @@ -275,11 +278,25 @@ AslDoOptions ( { case '^': + /* Get the required argument */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + Gbl_DoCompile = FALSE; break; case 'a': + /* Get the required argument */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + Gbl_DoCompile = FALSE; Gbl_DisassembleAll = TRUE; break; @@ -390,6 +407,11 @@ AslDoOptions ( UtDisplayConstantOpcodes (); exit (0); + case 'd': + + AslDisassemblyHelp (); + exit (0); + case 'f': AslFilenameHelp (); @@ -539,6 +561,13 @@ AslDoOptions ( Gbl_CompileTimesFlag = TRUE; break; + case 'd': + + /* Disable disassembler code optimizations */ + + AcpiGbl_DoDisassemblerOptimizations = FALSE; + break; + case 'e': /* iASL: Disable External opcode generation */ @@ -698,6 +727,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/sys/contrib/dev/acpica/compiler/aslparser.y b/sys/contrib/dev/acpica/compiler/aslparser.y index 17cd5be10189..4c750fcda31b 100644 --- a/sys/contrib/dev/acpica/compiler/aslparser.y +++ b/sys/contrib/dev/acpica/compiler/aslparser.y @@ -66,6 +66,7 @@ void * AslLocalAllocate ( unsigned int Size); + /* Bison/yacc configuration */ #define static @@ -99,7 +100,7 @@ AslLocalAllocate ( * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 101 +%expect 102 /*! [Begin] no source code translation */ @@ -122,8 +123,11 @@ m4_include(asltypes.y) /* Production rules */ m4_include(aslrules.y) +m4_include(aslprimaries.y) m4_include(aslcstyle.y) +m4_include(aslkeywords.y) m4_include(aslresources.y) +m4_include(aslhelpers.y) %% /*! [End] no source code translation !*/ diff --git a/sys/contrib/dev/acpica/compiler/aslprimaries.y b/sys/contrib/dev/acpica/compiler/aslprimaries.y new file mode 100644 index 000000000000..742213ab623b --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslprimaries.y @@ -0,0 +1,1160 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslprimaries.y - Rules for primary ASL operators + * + *****************************************************************************/ + +/* + * 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. + */ + +') + + +/******************************************************************************* + * + * ASL Primary Terms + * + ******************************************************************************/ + +AccessAsTerm + : PARSEOP_ACCESSAS '(' + AccessTypeKeyword + OptionalAccessAttribTerm + ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} + | PARSEOP_ACCESSAS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +AcquireTerm + : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} + SuperName + ',' WordConstExpr + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);} + | PARSEOP_ACQUIRE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +AddTerm + : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_ADD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +AliasTerm + : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);} + NameString + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4, + TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} + | PARSEOP_ALIAS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +AndTerm + : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_AND '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ArgTerm + : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} + | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} + | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} + | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} + | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} + | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} + | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} + ; + +BankFieldTerm + : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} + NameString + NameStringItem + TermArgItem + ',' AccessTypeKeyword + ',' LockRuleKeyword + ',' UpdateRuleKeyword + ')' '{' + FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,7, + $4,$5,$6,$8,$10,$12,$15);} + | PARSEOP_BANKFIELD '(' + error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +BreakTerm + : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} + ; + +BreakPointTerm + : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} + ; + +BufferTerm + : PARSEOP_BUFFER {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} + OptionalDataCount + '{' BufferTermData '}' {$$ = TrLinkChildren ($<n>2,2,$3,$5);} + ; + +BufferTermData + : ByteList {} + | StringData {} + ; + +CaseTerm + : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);} + DataObject + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_CASE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ConcatTerm + : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_CONCATENATE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ConcatResTerm + : PARSEOP_CONCATENATERESTEMPLATE '(' {$<n>$ = TrCreateLeafNode ( + PARSEOP_CONCATENATERESTEMPLATE);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_CONCATENATERESTEMPLATE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ConnectionTerm + : PARSEOP_CONNECTION '(' + NameString + ')' {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);} + | PARSEOP_CONNECTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);} + ResourceMacroTerm + ')' {$$ = TrLinkChildren ($<n>3, 1, + TrLinkChildren ( + TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3, + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + $4));} + | PARSEOP_CONNECTION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CondRefOfTerm + : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} + SuperName + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_CONDREFOF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ContinueTerm + : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} + ; + +CopyObjectTerm + : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} + TermArg + ',' SimpleTarget + ')' {$$ = TrLinkChildren ($<n>3,2,$4, + TrSetNodeFlags ($6, NODE_IS_TARGET));} + | PARSEOP_COPYOBJECT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateBitFieldTerm + : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} + TermArg + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5, + TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEBITFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateByteFieldTerm + : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} + TermArg + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5, + TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEBYTEFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateDWordFieldTerm + : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} + TermArg + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5, + TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEDWORDFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateFieldTerm + : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} + TermArg + TermArgItem + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6, + TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateQWordFieldTerm + : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} + TermArg + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5, + TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEQWORDFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +CreateWordFieldTerm + : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} + TermArg + TermArgItem + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5, + TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} + | PARSEOP_CREATEWORDFIELD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DataRegionTerm + : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} + NameString + TermArgItem + TermArgItem + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,4, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);} + | PARSEOP_DATATABLEREGION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DebugTerm + : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} + ; + +DecTerm + : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DECREMENT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DefaultTerm + : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);} + TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DEFAULT '{' + error '}' {$$ = AslDoError(); yyclearin;} + ; + +DerefOfTerm + : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DEREFOF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DeviceTerm + : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);} + NameString + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} + | PARSEOP_DEVICE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DivideTerm + : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg + TermArgItem + Target + Target + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} + | PARSEOP_DIVIDE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +EISAIDTerm + : PARSEOP_EISAID '(' + StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} + | PARSEOP_EISAID '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ElseIfTerm + : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);} + ; + +ElseTerm + : {$$ = NULL;} + | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} + TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} + + | PARSEOP_ELSE '{' + error '}' {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSE + error {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} + TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} + ')' '{' + TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);} + ElseTerm {TrLinkPeerNode ($<n>5,$11);} + {$$ = TrLinkChildren ($<n>3,1,$<n>5);} + + | PARSEOP_ELSEIF '(' + error ')' {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSEIF + error {$$ = AslDoError(); yyclearin;} + ; + +EventTerm + : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);} + NameString + ')' {$$ = TrLinkChildren ($<n>3,1, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} + | PARSEOP_EVENT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ExternalTerm + : PARSEOP_EXTERNAL '(' + NameString + OptionalObjectTypeKeyword + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} + | PARSEOP_EXTERNAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FatalTerm + : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);} + ByteConstExpr + ',' DWordConstExpr + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} + | PARSEOP_FATAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FieldTerm + : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);} + NameString + ',' AccessTypeKeyword + ',' LockRuleKeyword + ',' UpdateRuleKeyword + ')' '{' + FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);} + | PARSEOP_FIELD '(' + error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +FindSetLeftBitTerm + : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_FINDSETLEFTBIT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FindSetRightBitTerm + : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_FINDSETRIGHTBIT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + + /* Convert a For() loop to a While() loop */ +ForTerm + : PARSEOP_FOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} + OptionalTermArg ',' {} + OptionalPredicate ',' + OptionalTermArg {$<n>$ = TrLinkPeerNode ($4,$<n>3); + TrSetParent ($9,$<n>3);} /* New parent is WHILE */ + ')' '{' TermList '}' {$<n>$ = TrLinkChildren ($<n>3,2,$7,$13);} + {$<n>$ = TrLinkPeerNode ($13,$9); + $$ = $<n>10;} + ; + +OptionalPredicate + : {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, 1);} + | TermArg {$$ = $1;} + ; + +FprintfTerm + : PARSEOP_FPRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);} + TermArg ',' + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} + | PARSEOP_FPRINTF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FromBCDTerm + : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_FROMBCD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FunctionTerm + : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} + NameString + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,7, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), + TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), + TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} + | PARSEOP_FUNCTION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IfTerm + : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} + TermArg + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + + | PARSEOP_IF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IncludeTerm + : PARSEOP_INCLUDE '(' + String ')' {$$ = TrUpdateNode (PARSEOP_INCLUDE, $3); + FlOpenIncludeFile ($3);} + ; + +IncludeEndTerm + : PARSEOP_INCLUDE_END {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE_END); + TrSetCurrentFilename ($$);} + ; + +IncTerm + : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_INCREMENT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IndexFieldTerm + : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} + NameString + NameStringItem + ',' AccessTypeKeyword + ',' LockRuleKeyword + ',' UpdateRuleKeyword + ')' '{' + FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);} + | PARSEOP_INDEXFIELD '(' + error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +IndexTerm + : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_INDEX '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LAndTerm + : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} + TermArg + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LAND '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LEqualTerm + : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + TermArg + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LEQUAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LGreaterEqualTerm + : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg + TermArgItem + ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, + TrLinkChildren ($<n>3,2,$4,$5));} + | PARSEOP_LGREATEREQUAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LGreaterTerm + : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} + TermArg + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LGREATER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LLessEqualTerm + : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} + TermArg + TermArgItem + ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, + TrLinkChildren ($<n>3,2,$4,$5));} + | PARSEOP_LLESSEQUAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LLessTerm + : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LLESS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LNotEqualTerm + : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + TermArg + TermArgItem + ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, + TrLinkChildren ($<n>3,2,$4,$5));} + | PARSEOP_LNOTEQUAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LNotTerm + : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_LNOT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LoadTableTerm + : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} + TermArg + TermArgItem + TermArgItem + OptionalListString + OptionalListString + OptionalReference + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);} + | PARSEOP_LOADTABLE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LoadTerm + : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);} + NameString + RequiredTarget + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LOAD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LocalTerm + : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} + | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} + | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} + | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} + | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} + | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} + | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} + | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} + ; + +LOrTerm + : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} + TermArg + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LOR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +MatchTerm + : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);} + TermArg + ',' MatchOpKeyword + TermArgItem + ',' MatchOpKeyword + TermArgItem + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);} + | PARSEOP_MATCH '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +MethodTerm + : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} + NameString + OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} + OptionalSerializeRuleKeyword + OptionalByteConstExpr + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,7, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + $5,$7,$8,$9,$10,$13);} + | PARSEOP_METHOD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +MidTerm + : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);} + TermArg + TermArgItem + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} + | PARSEOP_MID '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ModTerm + : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_MOD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +MultiplyTerm + : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_MULTIPLY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +MutexTerm + : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);} + NameString + ',' ByteConstExpr + ')' {$$ = TrLinkChildren ($<n>3,2, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} + | PARSEOP_MUTEX '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NameTerm + : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);} + NameString + ',' DataObject + ')' {$$ = TrLinkChildren ($<n>3,2, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} + | PARSEOP_NAME '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NAndTerm + : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_NAND '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NoOpTerm + : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} + ; + +NOrTerm + : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_NOR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NotifyTerm + : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);} + SuperName + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_NOTIFY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NotTerm + : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_NOT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ObjectTypeTerm + : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} + ObjectTypeName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_OBJECTTYPE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +OffsetTerm + : PARSEOP_OFFSET '(' + AmlPackageLengthTerm + ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} + | PARSEOP_OFFSET '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +OpRegionTerm + : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} + NameString + ',' OpRegionSpaceIdTerm + TermArgItem + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,4, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + $6,$7,$8);} + | PARSEOP_OPERATIONREGION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +OpRegionSpaceIdTerm + : RegionSpaceKeyword {} + | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +OrTerm + : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_OR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PackageTerm + : PARSEOP_PACKAGE {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} + OptionalDataCount + '{' PackageList '}' {$$ = TrLinkChildren ($<n>2,2,$3,$5);} + +PowerResTerm + : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} + NameString + ',' ByteConstExpr + ',' WordConstExpr + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,4, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + $6,$8,$11);} + | PARSEOP_POWERRESOURCE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PrintfTerm + : PARSEOP_PRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);} + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_PRINTF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PrintfArgList + : {$$ = NULL;} + | TermArg {$$ = $1;} + | PrintfArgList ',' + TermArg {$$ = TrLinkPeerNode ($1, $3);} + ; + +ProcessorTerm + : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} + NameString + ',' ByteConstExpr + OptionalDWordConstExpr + OptionalByteConstExpr + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,5, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + $6,$7,$8,$11);} + | PARSEOP_PROCESSOR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +RawDataBufferTerm + : PARSEOP_DATABUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);} + OptionalWordConst + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_DATABUFFER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +/* + * In RefOf, the node isn't really a target, but we can't keep track of it after + * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) + */ +RefOfTerm + : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1, + TrSetNodeFlags ($4, NODE_IS_TARGET));} + | PARSEOP_REFOF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ReleaseTerm + : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RELEASE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ResetTerm + : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RESET '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ReturnTerm + : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} + OptionalReturnArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RETURN {$$ = TrLinkChildren ( + TrCreateLeafNode (PARSEOP_RETURN),1, + TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), + NODE_IS_NULL_RETURN));} + | PARSEOP_RETURN '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ScopeTerm + : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);} + NameString + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} + | PARSEOP_SCOPE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ShiftLeftTerm + : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_SHIFTLEFT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ShiftRightTerm + : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_SHIFTRIGHT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SignalTerm + : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_SIGNAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SizeOfTerm + : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_SIZEOF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SleepTerm + : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_SLEEP '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StallTerm + : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_STALL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StoreTerm + : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);} + TermArg + ',' SuperName + ')' {$$ = TrLinkChildren ($<n>3,2,$4, + TrSetNodeFlags ($6, NODE_IS_TARGET));} + | PARSEOP_STORE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SubtractTerm + : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_SUBTRACT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SwitchTerm + : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);} + TermArg + ')' '{' + CaseDefaultTermList '}' + {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_SWITCH '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ThermalZoneTerm + : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} + NameString + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2, + TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} + | PARSEOP_THERMALZONE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +TimerTerm + : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);} + ')' {$$ = TrLinkChildren ($<n>3,0);} + | PARSEOP_TIMER {$$ = TrLinkChildren ( + TrCreateLeafNode (PARSEOP_TIMER),0);} + | PARSEOP_TIMER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToBCDTerm + : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_TOBCD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToBufferTerm + : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_TOBUFFER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToDecimalStringTerm + : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_TODECIMALSTRING '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToHexStringTerm + : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_TOHEXSTRING '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToIntegerTerm + : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} + TermArg + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_TOINTEGER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToPLDTerm + : PARSEOP_TOPLD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);} + PldKeywordList + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_TOPLD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PldKeywordList + : {$$ = NULL;} + | PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkChildren ($1,1,$3);} + | PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkChildren ($1,1,$3);} + | PldKeywordList ',' /* Allows a trailing comma at list end */ + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} + ; + + +ToStringTerm + : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);} + TermArg + OptionalCount + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_TOSTRING '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ToUUIDTerm + : PARSEOP_TOUUID '(' + StringData ')' {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);} + | PARSEOP_TOUUID '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +UnicodeTerm + : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} + StringData + ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} + | PARSEOP_UNICODE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +UnloadTerm + : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_UNLOAD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +WaitTerm + : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);} + SuperName + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_WAIT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +XOrTerm + : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_XOR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +WhileTerm + : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} + TermArg + ')' '{' TermList '}' + {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_WHILE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; diff --git a/sys/contrib/dev/acpica/compiler/aslresources.y b/sys/contrib/dev/acpica/compiler/aslresources.y index 074536bb0d77..92d58a9257d7 100644 --- a/sys/contrib/dev/acpica/compiler/aslresources.y +++ b/sys/contrib/dev/acpica/compiler/aslresources.y @@ -44,313 +44,6 @@ NoEcho(' ') -/******************************************************************************* - * - * ASL Parameter Keyword Terms - * - ******************************************************************************/ - -AccessAttribKeyword - : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} - | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} - | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} - | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} - | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} - | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} - | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - ; - -AccessTypeKeyword - : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} - | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} - | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} - | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} - | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} - | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} - ; - -AddressingModeKeyword - : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} - | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} - ; - -AddressKeyword - : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} - | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} - | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} - | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} - ; - -AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} - | RegionSpaceKeyword {} - ; - -BitsPerByteKeyword - : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} - | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} - | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} - | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} - | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} - ; - -ClockPhaseKeyword - : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} - | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} - ; - -ClockPolarityKeyword - : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} - | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} - ; - -DecodeKeyword - : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} - | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} - ; - -DevicePolarityKeyword - : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} - | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} - ; - -DMATypeKeyword - : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} - | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} - | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} - | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} - ; - -EndianKeyword - : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} - | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} - ; - -FlowControlKeyword - : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} - | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} - | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} - ; - -InterruptLevel - : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} - | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} - | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} - ; - -InterruptTypeKeyword - : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} - | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} - ; - -IODecodeKeyword - : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} - | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} - ; - -IoRestrictionKeyword - : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} - | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} - | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} - | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} - ; - -LockRuleKeyword - : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} - | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} - ; - -MatchOpKeyword - : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} - | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} - | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} - | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} - | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} - | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} - ; - -MaxKeyword - : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} - | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} - ; - -MemTypeKeyword - : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} - | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} - | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} - | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} - ; - -MinKeyword - : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} - | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} - ; - -ObjectTypeKeyword - : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} - | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} - | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} - | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} - | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} - | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} - | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} - | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} - | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} - | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} - | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} - | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} - | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} - | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} - | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} - ; - -ParityTypeKeyword - : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} - | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} - | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} - | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} - | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} - ; - -PinConfigByte - : PinConfigKeyword {$$ = $1;} - | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -PinConfigKeyword - : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} - | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} - | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} - | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} - ; - -PldKeyword - : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} - | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} - | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} - | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} - | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} - | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} - | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} - | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} - | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} - | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} - | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} - | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} - | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} - | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} - | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} - | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} - | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} - | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} - | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} - | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} - | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} - | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} - | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} - | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} - | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} - | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} - | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} - | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} - ; - -RangeTypeKeyword - : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} - | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} - | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} - ; - -RegionSpaceKeyword - : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} - | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} - | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} - | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} - | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} - | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} - | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} - | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} - | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} - | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} - | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} - | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} - ; - -ResourceTypeKeyword - : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} - ; - -SerializeRuleKeyword - : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} - | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} - ; - -ShareTypeKeyword - : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} - | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} - | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} - | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} - ; - -SlaveModeKeyword - : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} - | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} - ; - -StopBitsKeyword - : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} - | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} - | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} - | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} - ; - -TranslationKeyword - : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} - | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} - ; - -TypeKeyword - : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} - | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} - ; - -UpdateRuleKeyword - : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} - | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} - | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} - ; - -WireModeKeyword - : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} - | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);} - ; - -XferSizeKeyword - : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8, 0);} - | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16, 1);} - | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64, 3);} - | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);} - | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);} - ; - -XferTypeKeyword - : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} - | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} - | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} - ; - /******************************************************************************* * @@ -363,15 +56,20 @@ XferTypeKeyword * Also, insert the EndTag at the end of the template. */ ResourceTemplateTerm - : PARSEOP_RESOURCETEMPLATE '(' ')' + : PARSEOP_RESOURCETEMPLATE OptionalParentheses '{' ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4, TrCreateLeafNode (PARSEOP_DEFAULT_ARG), TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - $5, + $4, TrCreateLeafNode (PARSEOP_ENDTAG));} ; +OptionalParentheses + : {$$ = NULL;} + | '(' ')' {$$ = NULL;} + ; + ResourceMacroList : {$$ = NULL;} | ResourceMacroList @@ -446,7 +144,8 @@ DWordIOTerm OptionalNameString OptionalType OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} | PARSEOP_DWORDIO '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -469,7 +168,8 @@ DWordMemoryTerm OptionalNameString OptionalAddressRange OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + ')' {$$ = TrLinkChildren ($<n>3,16, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} | PARSEOP_DWORDMEMORY '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -490,7 +190,8 @@ DWordSpaceTerm OptionalByteConstExpr OptionalStringData OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} | PARSEOP_DWORDSPACE '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -518,7 +219,8 @@ ExtendedIOTerm OptionalNameString OptionalType OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} | PARSEOP_EXTENDEDIO '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -540,7 +242,8 @@ ExtendedMemoryTerm OptionalNameString OptionalAddressRange OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} | PARSEOP_EXTENDEDMEMORY '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -560,7 +263,8 @@ ExtendedSpaceTerm ',' QWordConstExpr OptionalQWordConstExpr OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} + ')' {$$ = TrLinkChildren ($<n>3,13, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} | PARSEOP_EXTENDEDSPACE '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -599,7 +303,8 @@ GpioIntTerm OptionalNameString /* 15: DescriptorName */ OptionalBuffer_Last /* 16: VendorData */ ')' '{' - DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} + DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11, + $4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} | PARSEOP_GPIO_INT '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -617,7 +322,8 @@ GpioIoTerm OptionalNameString /* 14: DescriptorName */ OptionalBuffer_Last /* 15: VendorData */ ')' '{' - DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} + DWordList '}' {$$ = TrLinkChildren ($<n>3,11, + $4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} | PARSEOP_GPIO_IO '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -633,7 +339,8 @@ I2cSerialBusTerm OptionalResourceType /* 12: ResourceType */ OptionalNameString /* 13: DescriptorName */ OptionalBuffer_Last /* 14: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,10,$4,$5,$7,$8,$10,$11,$12,$13, + ')' {$$ = TrLinkChildren ($<n>3,10, + $4,$5,$7,$8,$10,$11,$12,$13, TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$14);} | PARSEOP_I2C_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -651,8 +358,8 @@ I2cSerialBusTermV2 OptionalNameString /* 13: DescriptorName */ OptionalShareType /* 14: Share */ OptionalBuffer_Last /* 15: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,10,$4,$5,$7,$8,$10,$11,$12,$13, - $14,$15);} + ')' {$$ = TrLinkChildren ($<n>3,10, + $4,$5,$7,$8,$10,$11,$12,$13,$14,$15);} | PARSEOP_I2C_SERIALBUS_V2 '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -667,7 +374,8 @@ InterruptTerm OptionalStringData OptionalNameString_Last ')' '{' - DWordList '}' {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);} + DWordList '}' {$$ = TrLinkChildren ($<n>3,8, + $4,$6,$8,$9,$10,$11,$12,$15);} | PARSEOP_INTERRUPT '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -760,7 +468,8 @@ QWordIOTerm OptionalNameString OptionalType OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} | PARSEOP_QWORDIO '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -783,7 +492,8 @@ QWordMemoryTerm OptionalNameString OptionalAddressRange OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + ')' {$$ = TrLinkChildren ($<n>3,16, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} | PARSEOP_QWORDMEMORY '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -804,7 +514,8 @@ QWordSpaceTerm OptionalByteConstExpr OptionalStringData OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} | PARSEOP_QWORDSPACE '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -837,7 +548,8 @@ SpiSerialBusTerm OptionalResourceType /* 19: ResourceType */ OptionalNameString /* 20: DescriptorName */ OptionalBuffer_Last /* 21: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20, + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20, TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$21);} | PARSEOP_SPI_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -859,8 +571,8 @@ SpiSerialBusTermV2 OptionalNameString /* 20: DescriptorName */ OptionalShareType /* 21: Share */ OptionalBuffer_Last /* 22: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20, - $21,$22);} + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21,$22);} | PARSEOP_SPI_SERIALBUS_V2 '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -899,7 +611,8 @@ UartSerialBusTerm OptionalResourceType /* 19: ResourceType */ OptionalNameString /* 20: DescriptorName */ OptionalBuffer_Last /* 21: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20, + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20, TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$21);} | PARSEOP_UART_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} @@ -922,8 +635,8 @@ UartSerialBusTermV2 OptionalNameString /* 20: DescriptorName */ OptionalShareType /* 21: Share */ OptionalBuffer_Last /* 22: VendorData */ - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20, - $21,$22);} + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21,$22);} | PARSEOP_UART_SERIALBUS_V2 '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -960,7 +673,8 @@ WordBusNumberTerm OptionalByteConstExpr OptionalStringData OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} + ')' {$$ = TrLinkChildren ($<n>3,12, + $4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} | PARSEOP_WORDBUSNUMBER '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -982,7 +696,8 @@ WordIOTerm OptionalNameString OptionalType OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + ')' {$$ = TrLinkChildren ($<n>3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} | PARSEOP_WORDIO '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -1003,246 +718,8 @@ WordSpaceTerm OptionalByteConstExpr OptionalStringData OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + ')' {$$ = TrLinkChildren ($<n>3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} | PARSEOP_WORDSPACE '(' error ')' {$$ = AslDoError(); yyclearin;} ; - - -/******* Object References ***********************************************/ - -/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */ - -NameString - : NameSeg {} - | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);} - | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} - | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} - | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} - ; - -NameSeg - : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - - -/******************************************************************************* - * - * ASL Helper Terms - * - ******************************************************************************/ - -OptionalBusMasterKeyword - : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);} - ; - -OptionalAccessAttribTerm - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - | ',' AccessAttribKeyword {$$ = $2;} - ; - -OptionalAccessSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalAddressingMode - : ',' {$$ = NULL;} - | ',' AddressingModeKeyword {$$ = $2;} - ; - -OptionalAddressRange - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' AddressKeyword {$$ = $2;} - ; - -OptionalBitsPerByte - : ',' {$$ = NULL;} - | ',' BitsPerByteKeyword {$$ = $2;} - ; - -OptionalBuffer_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' RawDataBufferTerm {$$ = $2;} - ; - -OptionalByteConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalDecodeType - : ',' {$$ = NULL;} - | ',' DecodeKeyword {$$ = $2;} - ; - -OptionalDevicePolarity - : ',' {$$ = NULL;} - | ',' DevicePolarityKeyword {$$ = $2;} - ; - -OptionalDWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' DWordConstExpr {$$ = $2;} - ; - -OptionalEndian - : ',' {$$ = NULL;} - | ',' EndianKeyword {$$ = $2;} - ; - -OptionalFlowControl - : ',' {$$ = NULL;} - | ',' FlowControlKeyword {$$ = $2;} - ; - -OptionalIoRestriction - : ',' {$$ = NULL;} - | ',' IoRestrictionKeyword {$$ = $2;} - ; - -OptionalListString - : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' TermArg {$$ = $2;} - ; - -OptionalMaxType - : ',' {$$ = NULL;} - | ',' MaxKeyword {$$ = $2;} - ; - -OptionalMemType - : ',' {$$ = NULL;} - | ',' MemTypeKeyword {$$ = $2;} - ; - -OptionalMinType - : ',' {$$ = NULL;} - | ',' MinKeyword {$$ = $2;} - ; - -OptionalNameString - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' NameString {$$ = $2;} - ; - -OptionalNameString_First - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} - | NameString {$$ = $1;} - ; - -OptionalObjectTypeKeyword - : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | ',' ObjectTypeKeyword {$$ = $2;} - ; - -OptionalParityType - : ',' {$$ = NULL;} - | ',' ParityTypeKeyword {$$ = $2;} - ; - -OptionalQWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' QWordConstExpr {$$ = $2;} - ; - -OptionalRangeType - : ',' {$$ = NULL;} - | ',' RangeTypeKeyword {$$ = $2;} - ; - -OptionalReadWriteKeyword - : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} - ; - -OptionalResourceType_First - : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ResourceTypeKeyword {$$ = $1;} - ; - -OptionalResourceType - : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ',' {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ',' ResourceTypeKeyword {$$ = $2;} - ; - -OptionalSlaveMode - : ',' {$$ = NULL;} - | ',' SlaveModeKeyword {$$ = $2;} - ; - -OptionalShareType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ShareTypeKeyword {$$ = $2;} - ; - -OptionalShareType_First - : {$$ = NULL;} - | ShareTypeKeyword {$$ = $1;} - ; - -OptionalStopBits - : ',' {$$ = NULL;} - | ',' StopBitsKeyword {$$ = $2;} - ; - -OptionalStringData - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' StringData {$$ = $2;} - ; - -OptionalTranslationType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TranslationKeyword {$$ = $2;} - ; - -OptionalType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalWireMode - : ',' {$$ = NULL;} - | ',' WireModeKeyword {$$ = $2;} - ; - -OptionalWordConstExpr - : ',' {$$ = NULL;} - | ',' WordConstExpr {$$ = $2;} - ; - -OptionalXferSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | ',' XferSizeKeyword {$$ = $2;} - ; diff --git a/sys/contrib/dev/acpica/compiler/aslrules.y b/sys/contrib/dev/acpica/compiler/aslrules.y index a5d8387d7ee4..2cb972f8056d 100644 --- a/sys/contrib/dev/acpica/compiler/aslrules.y +++ b/sys/contrib/dev/acpica/compiler/aslrules.y @@ -55,7 +55,8 @@ NoEcho(' * to handle output from preprocessors */ AslCode - : DefinitionBlockList {$<n>$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_ASL_CODE),1, $1);} + : DefinitionBlockList {$<n>$ = TrLinkChildren ( + TrCreateLeafNode (PARSEOP_ASL_CODE),1, $1);} | error {YYABORT; $$ = NULL;} ; @@ -88,7 +89,8 @@ DefinitionBlockTerm String ',' DWordConst ')' {TrSetEndLineNumber ($<n>3);} - '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);} + '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7, + $4,$6,$8,$10,$12,$14,$18);} ; DefinitionBlockList @@ -97,12 +99,36 @@ DefinitionBlockList DefinitionBlockList {$$ = TrLinkPeerNodes (2, $1,$2);} ; +/* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */ + +NameString + : NameSeg {} + | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);} + | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} + | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} + | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} + | PARSEOP_FOR {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");} + ; +/* +NameSeg + : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) + TrNormalizeNameSeg ($1));} + ; +*/ + +NameSeg + : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, + (ACPI_NATIVE_INT) AslCompilerlval.s);} + ; + + SuperName : NameString {} | ArgTerm {} | LocalTerm {} | DebugTerm {} | Type6Opcode {} + ; Target : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ @@ -116,6 +142,8 @@ TermArg | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + + ; /* @@ -140,9 +168,26 @@ OptionalCount | ',' TermArg {$$ = $2;} ; -VarPackageLengthTerm - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | TermArg {$$ = $1;} +/* + * Data count for buffers and packages (byte count for buffers, + * element count for packages). + */ +OptionalDataCount + + /* Legacy ASL */ + : {$$ = NULL;} + | '(' TermArg ')' {$$ = $2;} + | '(' ')' {$$ = NULL;} + + /* C-style (ASL+) -- adds equals term */ + + | PARSEOP_EXP_EQUALS {$$ = NULL;} + + | '(' TermArg ')' + PARSEOP_EXP_EQUALS {$$ = $2;} + + | '(' ')' String + PARSEOP_EXP_EQUALS {$$ = NULL;} ; @@ -197,6 +242,7 @@ Object : CompilerDirective {} | NamedObject {} | NameSpaceModifier {} +// | StructureTerm {} ; PackageList @@ -229,7 +275,8 @@ ParameterTypePackageList OptionalParameterTypePackage : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} + | ',' ParameterTypePackageList {$$ = TrLinkChildren ( + TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} ; /* Rules for specifying the types for method arguments */ @@ -248,17 +295,22 @@ ParameterTypesPackageList OptionalParameterTypesPackage : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} + | ',' ParameterTypesPackageList {$$ = TrLinkChildren ( + TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} ; /* ACPI 3.0 -- allow semicolons between terms */ TermList : {$$ = NULL;} - | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} - | TermList Term ';' {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} - | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} - | TermList ';' Term ';' {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} + | TermList Term {$$ = TrLinkPeerNode ( + TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} + | TermList Term ';' {$$ = TrLinkPeerNode ( + TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} + | TermList ';' Term {$$ = TrLinkPeerNode ( + TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} + | TermList ';' Term ';' {$$ = TrLinkPeerNode ( + TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} ; Term @@ -366,29 +418,37 @@ QWordConst * constant folding code in the node AmlLength field. */ ByteConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 1);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 1);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} | ByteConst {} ; WordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 2);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 2);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} | WordConst {} ; DWordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 4);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 4);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} | DWordConst {} ; QWordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 8);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); + TrSetNodeAmlLength ($1, 8);} | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} | QWordConst {} ; @@ -409,11 +469,13 @@ ConstExprTerm ; Integer - : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);} + : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, + AslCompilerlval.i);} ; String - : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);} + : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, + (ACPI_NATIVE_INT) AslCompilerlval.s);} ; @@ -454,6 +516,7 @@ NamedObject NameSpaceModifier : AliasTerm {} | NameTerm {} +// | NameTermAslPlus {} | ScopeTerm {} ; @@ -467,6 +530,7 @@ ObjectTypeName | RefOfTerm {} | DerefOfTerm {} | IndexTerm {} + | IndexExpTerm {} /* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ ; @@ -532,6 +596,8 @@ Type2IntegerOpcode /* "Type3" opcodes */ | FromBCDTerm {} | IncTerm {} | IndexTerm {} +// | StructureIndexTerm {} +// | StructurePointerTerm {} | LAndTerm {} | LEqualTerm {} | LGreaterTerm {} @@ -592,6 +658,8 @@ Type4Opcode ; */ +/* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */ + Type5Opcode : ResourceTemplateTerm {} | UnicodeTerm {} @@ -604,1103 +672,21 @@ Type6Opcode | DerefOfTerm {} | IndexTerm {} | IndexExpTerm {} +// | StructureIndexTerm {} +// | StructurePointerTerm {} | MethodInvocationTerm {} ; /******************************************************************************* * - * ASL Primary Terms - * - ******************************************************************************/ - -AccessAsTerm - : PARSEOP_ACCESSAS '(' - AccessTypeKeyword - OptionalAccessAttribTerm - ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} - | PARSEOP_ACCESSAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AcquireTerm - : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} - SuperName - ',' WordConstExpr - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);} - | PARSEOP_ACQUIRE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AddTerm - : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_ADD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AliasTerm - : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);} - NameString - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4, - TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} - | PARSEOP_ALIAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -AndTerm - : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_AND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ArgTerm - : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} - | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} - | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} - | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} - | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} - | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} - | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} - ; - -BankFieldTerm - : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} - NameString - NameStringItem - TermArgItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);} - | PARSEOP_BANKFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -BreakTerm - : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} - ; - -BreakPointTerm - : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} - ; - -BufferTerm - : PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} - OptionalBufferLength - ')' '{' - BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_BUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -BufferTermData - : ByteList {} - | StringData {} - ; - -CaseTerm - : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);} - DataObject - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_CASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatTerm - : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_CONCATENATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConcatResTerm - : PARSEOP_CONCATENATERESTEMPLATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_CONCATENATERESTEMPLATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ConnectionTerm - : PARSEOP_CONNECTION '(' - NameString - ')' {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);} - | PARSEOP_CONNECTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);} - ResourceMacroTerm - ')' {$$ = TrLinkChildren ($<n>3, 1, - TrLinkChildren (TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3, - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - $4));} - | PARSEOP_CONNECTION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CondRefOfTerm - : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} - SuperName - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_CONDREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ContinueTerm - : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} - ; - -CopyObjectTerm - : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} - TermArg - ',' SimpleTarget - ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_COPYOBJECT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateBitFieldTerm - : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBITFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateByteFieldTerm - : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEBYTEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateDWordFieldTerm - : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEDWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateFieldTerm - : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} - TermArg - TermArgItem - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateQWordFieldTerm - : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEQWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CreateWordFieldTerm - : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} - TermArg - TermArgItem - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));} - | PARSEOP_CREATEWORDFIELD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DataRegionTerm - : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} - NameString - TermArgItem - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);} - | PARSEOP_DATATABLEREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DebugTerm - : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} - ; - -DecTerm - : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DECREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DefaultTerm - : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);} - TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DEFAULT '{' - error '}' {$$ = AslDoError(); yyclearin;} - ; - -DerefOfTerm - : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DEREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DeviceTerm - : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);} - NameString - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_DEVICE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DivideTerm - : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg - TermArgItem - Target - Target - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} - | PARSEOP_DIVIDE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -EISAIDTerm - : PARSEOP_EISAID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} - | PARSEOP_EISAID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ElseIfTerm - : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -ElseTerm - : {$$ = NULL;} - | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} - - | PARSEOP_ELSE '{' - error '}' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSE - error {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} - ')' '{' - TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);} - ElseTerm {TrLinkPeerNode ($<n>5,$11);} - {$$ = TrLinkChildren ($<n>3,1,$<n>5);} - - | PARSEOP_ELSEIF '(' - error ')' {$$ = AslDoError(); yyclearin;} - - | PARSEOP_ELSEIF - error {$$ = AslDoError(); yyclearin;} - ; - -EventTerm - : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);} - NameString - ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} - | PARSEOP_EVENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExternalTerm - : PARSEOP_EXTERNAL '(' - NameString - OptionalObjectTypeKeyword - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} - | PARSEOP_EXTERNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FatalTerm - : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);} - ByteConstExpr - ',' DWordConstExpr - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} - | PARSEOP_FATAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FieldTerm - : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);} - NameString - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);} - | PARSEOP_FIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FindSetLeftBitTerm - : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FINDSETLEFTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FindSetRightBitTerm - : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FINDSETRIGHTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - /* Convert a For() loop to a While() loop */ -ForTerm - : PARSEOP_FOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} - OptionalTermArg ',' {} - OptionalPredicate ',' - OptionalTermArg {$<n>$ = TrLinkPeerNode ($4,$<n>3); - TrSetParent ($9,$<n>3);} /* New parent is WHILE */ - ')' '{' TermList '}' {$<n>$ = TrLinkChildren ($<n>3,2,$7,$13);} - {$<n>$ = TrLinkPeerNode ($13,$9); - $$ = $<n>10;} - ; - -OptionalPredicate - : {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, 1);} - | TermArg {$$ = $1;} - ; - -FprintfTerm - : PARSEOP_FPRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);} - TermArg ',' - StringData - PrintfArgList - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} - | PARSEOP_FPRINTF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FromBCDTerm - : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FROMBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FunctionTerm - : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), - TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} - | PARSEOP_FUNCTION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IfTerm - : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} - TermArg - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - - | PARSEOP_IF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IncludeTerm - : PARSEOP_INCLUDE '(' - String ')' {$$ = TrUpdateNode (PARSEOP_INCLUDE, $3); - FlOpenIncludeFile ($3);} - ; - -IncludeEndTerm - : PARSEOP_INCLUDE_END {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE_END); TrSetCurrentFilename ($$);} - ; - -IncTerm - : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_INCREMENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexFieldTerm - : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} - NameString - NameStringItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);} - | PARSEOP_INDEXFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -IndexTerm - : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_INDEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LAndTerm - : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LEqualTerm - : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterEqualTerm - : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LGREATEREQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LGreaterTerm - : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LGREATER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessEqualTerm - : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LLESSEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LLessTerm - : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LLESS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotEqualTerm - : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LNOTEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LNotTerm - : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_LNOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LoadTableTerm - : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} - TermArg - TermArgItem - TermArgItem - OptionalListString - OptionalListString - OptionalReference - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);} - | PARSEOP_LOADTABLE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LoadTerm - : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);} - NameString - RequiredTarget - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -LocalTerm - : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} - | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} - | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} - | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} - | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} - | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} - | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} - | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} - ; - -LOrTerm - : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} - TermArg - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MatchTerm - : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);} - TermArg - ',' MatchOpKeyword - TermArgItem - ',' MatchOpKeyword - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);} - | PARSEOP_MATCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MethodTerm - : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} - OptionalSerializeRuleKeyword - OptionalByteConstExpr - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);} - | PARSEOP_METHOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MidTerm - : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);} - TermArg - TermArgItem - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} - | PARSEOP_MID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ModTerm - : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_MOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MultiplyTerm - : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_MULTIPLY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MutexTerm - : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);} - NameString - ',' ByteConstExpr - ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_MUTEX '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NameTerm - : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);} - NameString - ',' DataObject - ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_NAME '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NAndTerm - : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_NAND '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NoOpTerm - : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} - ; - -NOrTerm - : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_NOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NotifyTerm - : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_NOTIFY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NotTerm - : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_NOT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ObjectTypeTerm - : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} - ObjectTypeName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_OBJECTTYPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OffsetTerm - : PARSEOP_OFFSET '(' - AmlPackageLengthTerm - ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} - | PARSEOP_OFFSET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionTerm - : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} - NameString - ',' OpRegionSpaceIdTerm - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);} - | PARSEOP_OPERATIONREGION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -OpRegionSpaceIdTerm - : RegionSpaceKeyword {} - | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -OrTerm - : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_OR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PackageTerm - : PARSEOP_PACKAGE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} - VarPackageLengthTerm - ')' '{' - PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_PACKAGE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PowerResTerm - : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} - NameString - ',' ByteConstExpr - ',' WordConstExpr - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);} - | PARSEOP_POWERRESOURCE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PrintfTerm - : PARSEOP_PRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);} - StringData - PrintfArgList - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_PRINTF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PrintfArgList - : {$$ = NULL;} - | TermArg {$$ = $1;} - | PrintfArgList ',' - TermArg {$$ = TrLinkPeerNode ($1, $3);} - ; - -ProcessorTerm - : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} - NameString - ',' ByteConstExpr - OptionalDWordConstExpr - OptionalByteConstExpr - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);} - | PARSEOP_PROCESSOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -RawDataBufferTerm - : PARSEOP_DATABUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);} - OptionalWordConst - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_DATABUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -/* - * In RefOf, the node isn't really a target, but we can't keep track of it after - * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) - */ -RefOfTerm - : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));} - | PARSEOP_REFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReleaseTerm - : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RELEASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResetTerm - : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RESET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReturnTerm - : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} - OptionalReturnArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));} - | PARSEOP_RETURN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ScopeTerm - : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);} - NameString - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_SCOPE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftLeftTerm - : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_SHIFTLEFT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ShiftRightTerm - : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_SHIFTRIGHT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SignalTerm - : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_SIGNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SizeOfTerm - : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_SIZEOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SleepTerm - : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_SLEEP '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StallTerm - : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_STALL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StoreTerm - : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);} - TermArg - ',' SuperName - ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_STORE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SubtractTerm - : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_SUBTRACT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; -SwitchTerm - : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);} - TermArg - ')' '{' - CaseDefaultTermList '}' - {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_SWITCH '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ThermalZoneTerm - : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} - NameString - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_THERMALZONE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -TimerTerm - : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);} - ')' {$$ = TrLinkChildren ($<n>3,0);} - | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);} - | PARSEOP_TIMER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBCDTerm - : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_TOBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToBufferTerm - : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_TOBUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToDecimalStringTerm - : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_TODECIMALSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToHexStringTerm - : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_TOHEXSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToIntegerTerm - : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_TOINTEGER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToPLDTerm - : PARSEOP_TOPLD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);} - PldKeywordList - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_TOPLD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PldKeywordList - : {$$ = NULL;} - | PldKeyword - PARSEOP_EXP_EQUALS Integer {$$ = TrLinkChildren ($1,1,$3);} - | PldKeyword - PARSEOP_EXP_EQUALS String {$$ = TrLinkChildren ($1,1,$3);} - | PldKeywordList ',' /* Allows a trailing comma at list end */ - | PldKeywordList ',' - PldKeyword - PARSEOP_EXP_EQUALS Integer {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} - | PldKeywordList ',' - PldKeyword - PARSEOP_EXP_EQUALS String {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} - ; - - -ToStringTerm - : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);} - TermArg - OptionalCount - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_TOSTRING '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ToUUIDTerm - : PARSEOP_TOUUID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);} - | PARSEOP_TOUUID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -UnicodeTerm - : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} - StringData - ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} - | PARSEOP_UNICODE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -UnloadTerm - : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_UNLOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WaitTerm - : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_WAIT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -XOrTerm - : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_XOR '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WhileTerm - : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} - TermArg - ')' '{' TermList '}' - {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_WHILE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******************************************************************************* - * * ASL Helper Terms * ******************************************************************************/ AmlPackageLengthTerm - : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);} + : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH, + (ACPI_PARSE_OBJECT *) $1);} ; NameStringItem @@ -1720,7 +706,8 @@ OptionalReference ; OptionalReturnArg - : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ + : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), + NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ | TermArg {$$ = $1;} ; @@ -1735,11 +722,6 @@ OptionalTermArg | TermArg {$$ = $1;} ; -OptionalBufferLength - : {$$ = NULL;} - | TermArg {$$ = $1;} - ; - OptionalWordConst : {$$ = NULL;} | WordConst {$$ = $1;} diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c index 2d8d21c92acf..03b4ea2dad02 100644 --- a/sys/contrib/dev/acpica/compiler/aslstubs.c +++ b/sys/contrib/dev/acpica/compiler/aslstubs.c @@ -47,6 +47,7 @@ #include <contrib/dev/acpica/include/acevents.h> #include <contrib/dev/acpica/include/acinterp.h> #include <contrib/dev/acpica/include/acnamesp.h> +#include <contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/asltokens.y b/sys/contrib/dev/acpica/compiler/asltokens.y index 429fa424cb9a..ff1dd42535c8 100644 --- a/sys/contrib/dev/acpica/compiler/asltokens.y +++ b/sys/contrib/dev/acpica/compiler/asltokens.y @@ -53,6 +53,16 @@ NoEcho(' * *****************************************************************************/ +/* + * Most tokens are defined to return <i>, which is a UINT64. + * + * These tokens return <s>, a pointer to the associated lexed string: + * + * PARSEOP_NAMESEG + * PARSEOP_NAMESTRING + * PARSEOP_STRING_LITERAL + * PARSEOP_STRUCTURE_NAMESTRING + */ %token <i> PARSEOP_ACCESSAS %token <i> PARSEOP_ACCESSATTRIB_BLOCK %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL @@ -466,12 +476,42 @@ NoEcho(' %token <i> PARSEOP_FPRINTF %token <i> PARSEOP_FOR +/* Structures */ + +%token <i> PARSEOP_STRUCTURE +%token <s> PARSEOP_STRUCTURE_NAMESTRING +%token <i> PARSEOP_STRUCTURE_TAG +%token <i> PARSEOP_STRUCTURE_ELEMENT +%token <i> PARSEOP_STRUCTURE_INSTANCE +%token <i> PARSEOP_STRUCTURE_REFERENCE +%token <i> PARSEOP_STRUCTURE_POINTER + +/* Top level */ + +%token <i> PARSEOP_ASL_CODE + + +/******************************************************************************* + * + * Tokens below are not in the aslmap.c file + * + ******************************************************************************/ + + +/* Tokens below this are not in the aslmap.c file */ + /* Specific parentheses tokens are not used at this time */ /* PARSEOP_EXP_PAREN_OPEN */ /* PARSEOP_EXP_PAREN_CLOSE */ +/* ASL+ variable creation */ + +%token <i> PARSEOP_INTEGER_TYPE +%token <i> PARSEOP_STRING_TYPE +%token <i> PARSEOP_BUFFER_TYPE +%token <i> PARSEOP_PACKAGE_TYPE +%token <i> PARSEOP_REFERENCE_TYPE -%token <i> PARSEOP_ASL_CODE /* * Special functions. These should probably stay at the end of this diff --git a/sys/contrib/dev/acpica/compiler/asltypes.y b/sys/contrib/dev/acpica/compiler/asltypes.y index 1faecb4587e9..1152a422d79f 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.y +++ b/sys/contrib/dev/acpica/compiler/asltypes.y @@ -278,7 +278,6 @@ NoEcho(' %type <n> PackageElement %type <n> PackageList %type <n> PackageTerm -%type <n> VarPackageLengthTerm /* Macros */ @@ -350,9 +349,9 @@ NoEcho(' %type <n> OptionalAddressRange %type <n> OptionalBitsPerByte %type <n> OptionalBuffer_Last -%type <n> OptionalBufferLength %type <n> OptionalByteConstExpr %type <n> OptionalCount +%type <n> OptionalDataCount %type <n> OptionalDecodeType %type <n> OptionalDevicePolarity %type <n> OptionalDWordConstExpr @@ -369,6 +368,7 @@ NoEcho(' %type <n> OptionalObjectTypeKeyword %type <n> OptionalParameterTypePackage %type <n> OptionalParameterTypesPackage +%type <n> OptionalParentheses %type <n> OptionalParityType %type <n> OptionalPredicate %type <n> OptionalQWordConstExpr @@ -393,8 +393,53 @@ NoEcho(' %type <n> OptionalXferSize /* - * C-style expression parser + * ASL+ (C-style) parser */ + +/* Expressions and symbolic operators */ + %type <n> Expression %type <n> EqualsTerm %type <n> IndexExpTerm + +/* ASL+ Named object declaration support */ +/* +%type <n> NameTermAslPlus + +%type <n> BufferBegin +%type <n> BufferEnd +%type <n> PackageBegin +%type <n> PackageEnd +%type <n> OptionalLength +*/ +/* ASL+ Structure declarations */ +/* +%type <n> StructureTerm +%type <n> StructureTermBegin +%type <n> StructureType +%type <n> StructureTag +%type <n> StructureElementList +%type <n> StructureElement +%type <n> StructureElementType +%type <n> OptionalStructureElementType +%type <n> StructureId +*/ +/* Structure instantiantion */ +/* +%type <n> StructureInstanceTerm +%type <n> StructureTagReference +%type <n> StructureInstanceEnd +*/ +/* Pseudo-instantiantion for method Args/Locals */ +/* +%type <n> MethodStructureTerm +%type <n> LocalStructureName +*/ +/* Direct structure references via the Index operator */ +/* +%type <n> StructureReference +%type <n> StructureIndexTerm +%type <n> StructurePointerTerm +%type <n> StructurePointerReference +%type <n> OptionalDefinePointer +*/ diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index b3dc354adb5e..e8a6220bc915 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslxref.c b/sys/contrib/dev/acpica/compiler/aslxref.c index b09572e5e640..6c0f0aec21b1 100644 --- a/sys/contrib/dev/acpica/compiler/aslxref.c +++ b/sys/contrib/dev/acpica/compiler/aslxref.c @@ -826,16 +826,18 @@ XfNamespaceLocateBegin ( /* * A reference to a method within one of these opcodes is not an * invocation of the method, it is simply a reference to the method. + * + * September 2016: Removed DeRefOf from this list */ if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || + ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)|| (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) { return_ACPI_STATUS (AE_OK); } + /* * There are two types of method invocation: * 1) Invocation with arguments -- the parser recognizes this diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index ca7fb591d864..120c03d1e721 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/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); @@ -609,6 +604,7 @@ extern const unsigned char TemplateMtmr[]; extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; +extern const unsigned char TemplateRasf[]; extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; extern const unsigned char TemplateSbst[]; diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index 844820686248..399e1d8aacc9 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/dtparser.y b/sys/contrib/dev/acpica/compiler/dtparser.y index fe29e3893296..d4a6c13b476f 100644 --- a/sys/contrib/dev/acpica/compiler/dtparser.y +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index dc554495c498..ca1a29470b6b 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -129,9 +129,12 @@ DtCompileFadt ( DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; ACPI_TABLE_HEADER *Table; - UINT8 Revision; + UINT8 FadtRevision; + UINT32 i; + /* Minimum table is the FADT version 1 (ACPI 1.0) */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1, &Subtable, TRUE); if (ACPI_FAILURE (Status)) @@ -143,53 +146,48 @@ DtCompileFadt ( DtInsertSubtable (ParentTable, Subtable); Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer); - Revision = Table->Revision; + FadtRevision = Table->Revision; + + /* Revision 0 and 2 are illegal */ - if (Revision == 2) + if ((FadtRevision == 0) || + (FadtRevision == 2)) { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } + DtError (ASL_ERROR, 0, NULL, + "Invalid value for FADT revision"); - DtInsertSubtable (ParentTable, Subtable); + return (AE_BAD_VALUE); } - else if (Revision >= 2) + + /* Revision out of supported range? */ + + if (FadtRevision > ACPI_FADT_MAX_VERSION) { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } + DtError (ASL_ERROR, 0, NULL, + "Unknown or unsupported value for FADT revision"); - DtInsertSubtable (ParentTable, Subtable); + return (AE_BAD_VALUE); + } + + /* Compile individual sub-parts of the FADT, per-revision */ - if (Revision >= 5) + for (i = 3; i <= ACPI_FADT_MAX_VERSION; i++) + { + if (i > FadtRevision) { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt5, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); + break; } - if (Revision >= 6) + /* Compile the fields specific to this FADT revision */ + + Status = DtCompileTable (PFieldList, FadtRevisionInfo[i], + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6, - &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - DtInsertSubtable (ParentTable, Subtable); + return (Status); } + + DtInsertSubtable (ParentTable, Subtable); } return (AE_OK); diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 23ef0517678c..b18ac31bc7b6 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -906,6 +906,16 @@ const unsigned char TemplatePmtt[] = 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ }; +const unsigned char TemplateRasf[] = +{ + 0x52,0x41,0x53,0x46,0x30,0x00,0x00,0x00, /* 00000000 "RASF0..." */ + 0x01,0x31,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".1INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x27,0x05,0x16,0x20,0x00,0x00,0x00,0x00, /* 00000020 "'.. ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */ +}; + const unsigned char TemplateRsdp[] = { 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */ diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 2f3fdcdf0c77..1099b8498afa 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/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 @@ -367,6 +280,7 @@ DtGetFieldType ( case ACPI_DMT_RAW_BUFFER: case ACPI_DMT_BUF7: case ACPI_DMT_BUF10: + case ACPI_DMT_BUF12: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: case ACPI_DMT_PCI_PATH: @@ -616,6 +530,11 @@ DtGetFieldLength ( ByteLength = 10; break; + case ACPI_DMT_BUF12: + + ByteLength = 12; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: diff --git a/sys/contrib/dev/acpica/compiler/prparser.y b/sys/contrib/dev/acpica/compiler/prparser.y index 749f7d528950..32bb407a5fe7 100644 --- a/sys/contrib/dev/acpica/compiler/prparser.y +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/debugger/dbconvert.c b/sys/contrib/dev/acpica/components/debugger/dbconvert.c index 09379a8ab4b1..d25d2a9afd40 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbconvert.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/debugger/dbexec.c b/sys/contrib/dev/acpica/components/debugger/dbexec.c index 00890e6b00c1..93fa103064a5 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index 38f3678e88b1..0b3d5a4fa29e 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -46,15 +46,15 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acdebug.h> #include <contrib/dev/acpica/include/actables.h> -#include <stdio.h> -#ifdef ACPI_APPLICATION -#include <contrib/dev/acpica/include/acapps.h> -#endif #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbfileio") +#ifdef ACPI_APPLICATION +#include <contrib/dev/acpica/include/acapps.h> + + #ifdef ACPI_DEBUGGER /******************************************************************************* * @@ -73,8 +73,6 @@ AcpiDbCloseDebugFile ( void) { -#ifdef ACPI_APPLICATION - if (AcpiGbl_DebugFile) { fclose (AcpiGbl_DebugFile); @@ -83,7 +81,6 @@ AcpiDbCloseDebugFile ( AcpiOsPrintf ("Debug output file %s closed\n", AcpiGbl_DbDebugFilename); } -#endif } @@ -104,8 +101,6 @@ AcpiDbOpenDebugFile ( char *Name) { -#ifdef ACPI_APPLICATION - AcpiDbCloseDebugFile (); AcpiGbl_DebugFile = fopen (Name, "w+"); if (!AcpiGbl_DebugFile) @@ -118,8 +113,6 @@ AcpiDbOpenDebugFile ( strncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; - -#endif } #endif @@ -169,8 +162,7 @@ AcpiDbLoadTables ( return (Status); } - fprintf (stderr, - "Acpi table [%4.4s] successfully installed and loaded\n", + AcpiOsPrintf ("Acpi table [%4.4s] successfully installed and loaded\n", Table->Signature); TableListHead = TableListHead->Next; @@ -178,3 +170,4 @@ AcpiDbLoadTables ( return (AE_OK); } +#endif diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index a52ee4d0f1a3..ecc5475199c9 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index 2d047f597376..5925a5bf6160 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c index d4a95700a11c..8134848aa39a 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c @@ -529,7 +529,8 @@ AcpiDmIsStringBuffer ( * * PARAMETERS: Op - Buffer Object to be examined * - * RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise + * RETURN: TRUE if buffer appears to contain data produced via the + * ToPLD macro, FALSE otherwise * * DESCRIPTION: Determine if a buffer Op contains a _PLD structure * @@ -541,12 +542,60 @@ AcpiDmIsPldBuffer ( { ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *SizeOp; + ACPI_PARSE_OBJECT *ByteListOp; ACPI_PARSE_OBJECT *ParentOp; + UINT64 BufferSize; + UINT64 InitializerSize; - /* Buffer size is the buffer argument */ - + /* + * Get the BufferSize argument - Buffer(BufferSize) + * If the buffer was generated by the ToPld macro, it must + * be a BYTE constant. + */ SizeOp = Op->Common.Value.Arg; + if (SizeOp->Common.AmlOpcode != AML_BYTE_OP) + { + return (FALSE); + } + + /* Check the declared BufferSize, two possibilities */ + + BufferSize = SizeOp->Common.Value.Integer; + if ((BufferSize != ACPI_PLD_REV1_BUFFER_SIZE) && + (BufferSize != ACPI_PLD_REV2_BUFFER_SIZE)) + { + return (FALSE); + } + + /* + * Check the initializer list length. This is the actual + * number of bytes in the buffer as counted by the AML parser. + * The declared BufferSize can be larger than the actual length. + * However, for the ToPLD macro, the BufferSize will be the same + * as the initializer list length. + */ + ByteListOp = SizeOp->Common.Next; + if (!ByteListOp) + { + return (FALSE); /* Zero-length buffer case */ + } + + InitializerSize = ByteListOp->Common.Value.Integer; + if ((InitializerSize != ACPI_PLD_REV1_BUFFER_SIZE) && + (InitializerSize != ACPI_PLD_REV2_BUFFER_SIZE)) + { + return (FALSE); + } + + /* Final size check */ + + if (BufferSize != InitializerSize) + { + return (FALSE); + } + + /* Now examine the buffer parent */ ParentOp = Op->Common.Parent; if (!ParentOp) @@ -571,8 +620,17 @@ AcpiDmIsPldBuffer ( return (FALSE); } - /* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */ - + /* + * Check for proper form: Name(_PLD, Package() {ToPLD()}) + * + * Note: All other forms such as + * Return (Package() {ToPLD()}) + * Local0 = ToPLD() + * etc. are not converted back to the ToPLD macro, because + * there is really no deterministic way to disassemble the buffer + * back to the ToPLD macro, other than trying to find the "_PLD" + * name + */ if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP) { ParentOp = ParentOp->Common.Parent; diff --git a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c index a7049ef764d7..6307bfe52cf9 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c @@ -98,6 +98,9 @@ AcpiDmCheckForSymbolicOpcode ( ACPI_PARSE_OBJECT *Child1; ACPI_PARSE_OBJECT *Child2; ACPI_PARSE_OBJECT *Target; + ACPI_PARSE_OBJECT *GrandChild1; + ACPI_PARSE_OBJECT *GrandChild2; + ACPI_PARSE_OBJECT *GrandTarget = NULL; /* Exit immediately if ASL+ not enabled */ @@ -107,6 +110,14 @@ AcpiDmCheckForSymbolicOpcode ( return (FALSE); } + /* Check for a non-ASL+ statement, propagate the flag */ + + if (Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + /* Get the first operand */ Child1 = AcpiPsGetArg (Op, 0); @@ -323,6 +334,7 @@ AcpiDmCheckForSymbolicOpcode ( if (AcpiDmIsValidTarget (Target)) { Child1->Common.OperatorSymbol = NULL; + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; return (FALSE); } @@ -339,6 +351,13 @@ AcpiDmCheckForSymbolicOpcode ( if (!AcpiDmIsValidTarget (Target)) { + if (Op->Common.Parent->Common.AmlOpcode == AML_STORE_OP) + { + Op->Common.DisasmFlags = 0; + Child1->Common.OperatorSymbol = NULL; + return (FALSE); + } + /* Not a valid target (placeholder only, from parser) */ break; } @@ -478,6 +497,69 @@ AcpiDmCheckForSymbolicOpcode ( /* * Target is the 2nd operand. * We know the target is valid, it is not optional. + * + * The following block implements "Ignore conversion if a store + * is followed by a math/bit operator that has no target". Used + * only for the ASL test suite. + */ + if (!AcpiGbl_DoDisassemblerOptimizations) + { + switch (Child1->Common.AmlOpcode) + { + /* This operator has two operands and two targets */ + + case AML_DIVIDE_OP: + + GrandChild1 = Child1->Common.Value.Arg; + GrandChild2 = GrandChild1->Common.Next; + GrandTarget = GrandChild2->Common.Next; + + if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + GrandTarget = GrandTarget->Common.Next; + break; + + case AML_ADD_OP: + case AML_SUBTRACT_OP: + case AML_MULTIPLY_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + case AML_INDEX_OP: + + /* These operators have two operands and a target */ + + GrandChild1 = Child1->Common.Value.Arg; + GrandChild2 = GrandChild1->Common.Next; + GrandTarget = GrandChild2->Common.Next; + break; + + case AML_BIT_NOT_OP: + + /* This operator has one operand and a target */ + + GrandChild1 = Child1->Common.Value.Arg; + GrandTarget = GrandChild1->Common.Next; + break; + + default: + break; + } + + if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + } + + /* * In the parse tree, simply swap the target with the * source so that the target is processed first. */ @@ -563,6 +645,7 @@ AcpiDmCloseOperator ( { BOOLEAN IsCStyleOp = FALSE; + /* Always emit paren if ASL+ disassembly disabled */ if (!AcpiGbl_CstyleDisassembly) @@ -571,6 +654,14 @@ AcpiDmCloseOperator ( return; } + /* Check for a non-ASL+ statement */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY) + { + AcpiOsPrintf (")"); + return; + } + /* Check if we need to add an additional closing paren */ switch (Op->Common.AmlOpcode) diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index 2ca1c859a0a8..8c9cacc96f04 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -64,6 +64,10 @@ static void AcpiDmConvertToElseIf ( ACPI_PARSE_OBJECT *Op); +static void +AcpiDmPromoteSubtree ( + ACPI_PARSE_OBJECT *StartOp); + /******************************************************************************* * @@ -1067,12 +1071,22 @@ AcpiDmConvertToElseIf ( * be the only blocks under the original Else. */ IfOp = OriginalElseOp->Common.Value.Arg; + if (!IfOp || (IfOp->Common.AmlOpcode != AML_IF_OP) || (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP))) { - /* Not an Else..If sequence, cannot convert to ElseIf */ + /* Not a proper Else..If sequence, cannot convert to ElseIf */ + + AcpiOsPrintf ("%s", "Else"); + return; + } + + /* Cannot have anything following the If...Else block */ + ElseOp = IfOp->Common.Next; + if (ElseOp && ElseOp->Common.Next) + { AcpiOsPrintf ("%s", "Else"); return; } @@ -1100,7 +1114,10 @@ AcpiDmConvertToElseIf ( /* If an ELSE matches the IF, promote it also */ ElseOp->Common.Parent = OriginalElseOp->Common.Parent; - ElseOp->Common.Next = OriginalElseOp->Common.Next; + + /* Promote the entire block under the ElseIf (All Next OPs) */ + + AcpiDmPromoteSubtree (OriginalElseOp); } else { @@ -1122,3 +1139,48 @@ AcpiDmConvertToElseIf ( OriginalElseOp->Common.Next = IfOp; } + + +/******************************************************************************* + * + * FUNCTION: AcpiDmPromoteSubtree + * + * PARAMETERS: StartOpOp - Original parent of the entire subtree + * + * RETURN: None + * + * DESCRIPTION: Promote an entire parse subtree up one level. + * + ******************************************************************************/ + +static void +AcpiDmPromoteSubtree ( + ACPI_PARSE_OBJECT *StartOp) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_PARSE_OBJECT *ParentOp; + + + /* New parent for subtree elements */ + + ParentOp = StartOp->Common.Parent; + + /* First child starts the subtree */ + + Op = StartOp->Common.Value.Arg; + + /* Walk the top-level elements of the subtree */ + + while (Op) + { + Op->Common.Parent = ParentOp; + if (!Op->Common.Next) + { + /* Last Op in list, update its next field */ + + Op->Common.Next = StartOp->Common.Next; + break; + } + Op = Op->Common.Next; + } +} diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c index 50b4bd68e7d1..f7d53083af90 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c @@ -443,16 +443,17 @@ AcpiDmIoFlags2 ( UINT8 SpecificFlags) { + /* _TTP */ + AcpiOsPrintf (", %s", AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]); - /* TRS is only used if TTP is TypeTranslation */ - - if (SpecificFlags & 0x10) - { - AcpiOsPrintf (", %s", - AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); - } + /* + * TRS is only used if TTP is TypeTranslation. However, the disassembler + * always emits exactly what is in the AML. + */ + AcpiOsPrintf (", %s", + AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); } diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index 58cdd7b471f2..318c1616c3a6 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -516,7 +516,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 */ @@ -601,7 +601,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 */ @@ -689,7 +689,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/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c index 2c0e7aba9082..27ba6343b8e4 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/dispatcher/dswexec.c b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c index 5873ed399d34..c43889d754b4 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/dispatcher/dswload2.c b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c index 09fbb8843402..e9a34cc05dd9 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/events/evgpe.c b/sys/contrib/dev/acpica/components/events/evgpe.c index 9bc5e190da3d..a6439eb4b048 100644 --- a/sys/contrib/dev/acpica/components/events/evgpe.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/events/evgpeinit.c b/sys/contrib/dev/acpica/components/events/evgpeinit.c index 9e77a228652f..f4254f8e8f98 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeinit.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/events/evrgnini.c b/sys/contrib/dev/acpica/components/events/evrgnini.c index 14976e013d2b..4859e692767d 100644 --- a/sys/contrib/dev/acpica/components/events/evrgnini.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/events/evxfgpe.c b/sys/contrib/dev/acpica/components/events/evxfgpe.c index 9d3e8815e6d1..47ad6de96358 100644 --- a/sys/contrib/dev/acpica/components/events/evxfgpe.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exconcat.c b/sys/contrib/dev/acpica/components/executer/exconcat.c index 1814a5c6eaaa..8bfbcd48b6b5 100644 --- a/sys/contrib/dev/acpica/components/executer/exconcat.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exconfig.c b/sys/contrib/dev/acpica/components/executer/exconfig.c index cf76bf10de51..a6be0a7d5ef4 100644 --- a/sys/contrib/dev/acpica/components/executer/exconfig.c +++ b/sys/contrib/dev/acpica/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); } @@ -645,11 +581,18 @@ AcpiExUnloadTable ( TableIndex = TableDesc->Reference.Value; + /* + * Release the interpreter lock so that the table lock won't have + * strict order requirement against it. + */ + AcpiExExitInterpreter (); + /* Ensure the table is still loaded */ if (!AcpiTbIsTableLoaded (TableIndex)) { - return_ACPI_STATUS (AE_NOT_EXIST); + Status = AE_NOT_EXIST; + goto LockAndExit; } /* Invoke table handler if present */ @@ -669,16 +612,25 @@ AcpiExUnloadTable ( Status = AcpiTbDeleteNamespaceByOwner (TableIndex); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto LockAndExit; } (void) AcpiTbReleaseOwnerId (TableIndex); AcpiTbSetTableLoadedFlag (TableIndex, FALSE); +LockAndExit: + + /* Re-acquire the interpreter lock */ + + AcpiExEnterInterpreter (); + /* * Invalidate the handle. We do this because the handle may be stored * in a named object and may not be actually deleted until much later. */ - DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; - return_ACPI_STATUS (AE_OK); + if (ACPI_SUCCESS (Status)) + { + DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; + } + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/executer/exconvrt.c b/sys/contrib/dev/acpica/components/executer/exconvrt.c index 871e1e3f9e06..5e664d676813 100644 --- a/sys/contrib/dev/acpica/components/executer/exconvrt.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exmisc.c b/sys/contrib/dev/acpica/components/executer/exmisc.c index 1ba30f4282f4..598bf782be17 100644 --- a/sys/contrib/dev/acpica/components/executer/exmisc.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exoparg1.c b/sys/contrib/dev/acpica/components/executer/exoparg1.c index 5028fa2055b1..eae2168c9c72 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg1.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exresop.c b/sys/contrib/dev/acpica/components/executer/exresop.c index 7f7425ff3a80..6bff61530793 100644 --- a/sys/contrib/dev/acpica/components/executer/exresop.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/extrace.c b/sys/contrib/dev/acpica/components/executer/extrace.c index ea675d9ccfd2..bc366ed7592d 100644 --- a/sys/contrib/dev/acpica/components/executer/extrace.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/executer/exutils.c b/sys/contrib/dev/acpica/components/executer/exutils.c index cfe5d04e3254..2c7dc8aa0e1e 100644 --- a/sys/contrib/dev/acpica/components/executer/exutils.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/hardware/hwgpe.c b/sys/contrib/dev/acpica/components/hardware/hwgpe.c index d58a8f47374c..27bb46815e07 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/namespace/nsconvert.c b/sys/contrib/dev/acpica/components/namespace/nsconvert.c index 441710bf6408..71df3a0977ed 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsconvert.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/namespace/nsload.c b/sys/contrib/dev/acpica/components/namespace/nsload.c index 4c8c6bf8d5ad..a7dba4fd762e 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsload.c +++ b/sys/contrib/dev/acpica/components/namespace/nsload.c @@ -46,6 +46,7 @@ #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/actables.h> +#include <contrib/dev/acpica/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/sys/contrib/dev/acpica/components/namespace/nsparse.c b/sys/contrib/dev/acpica/components/namespace/nsparse.c index d0f9e959c825..7bb45de946a1 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsparse.c +++ b/sys/contrib/dev/acpica/components/namespace/nsparse.c @@ -47,6 +47,7 @@ #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/actables.h> +#include <contrib/dev/acpica/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/sys/contrib/dev/acpica/components/namespace/nsutils.c b/sys/contrib/dev/acpica/components/namespace/nsutils.c index 220ad9032651..f561f851c93c 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/parser/psparse.c b/sys/contrib/dev/acpica/components/parser/psparse.c index caf2a0e4dcb6..700441ee31a7 100644 --- a/sys/contrib/dev/acpica/components/parser/psparse.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/parser/psxface.c b/sys/contrib/dev/acpica/components/parser/psxface.c index b99cee0c827f..69b00d2c2f4d 100644 --- a/sys/contrib/dev/acpica/components/parser/psxface.c +++ b/sys/contrib/dev/acpica/components/parser/psxface.c @@ -275,6 +275,100 @@ 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; + } + + /* Info->Node is the default location to load the table */ + + if (Info->Node && Info->Node != AcpiGbl_RootNode) + { + Status = AcpiDsScopeStackPush ( + Info->Node, ACPI_TYPE_METHOD, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } + + /* + * 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/sys/contrib/dev/acpica/components/tables/tbdata.c b/sys/contrib/dev/acpica/components/tables/tbdata.c index fc3c58c9935b..39c627c0bbac 100644 --- a/sys/contrib/dev/acpica/components/tables/tbdata.c +++ b/sys/contrib/dev/acpica/components/tables/tbdata.c @@ -45,6 +45,7 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/actables.h> +#include <contrib/dev/acpica/include/acevents.h> #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbdata") @@ -680,18 +681,13 @@ AcpiTbDeleteNamespaceByOwner ( * lock may block, and also since the execution of a namespace walk * must be allowed to use the interpreter. */ - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); - - AcpiNsDeleteNamespaceByOwner (OwnerId); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - + AcpiNsDeleteNamespaceByOwner (OwnerId); AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); - - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); return_ACPI_STATUS (Status); } @@ -867,3 +863,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/sys/contrib/dev/acpica/components/tables/tbfadt.c b/sys/contrib/dev/acpica/components/tables/tbfadt.c index 0dfa7d6d0b88..2ab5da088ed0 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/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); } } } @@ -516,17 +522,19 @@ AcpiTbConvertFadt ( /* - * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which + * For ACPI 1.0 FADTs (revision 1), ensure that reserved fields which * should be zero are indeed zero. This will workaround BIOSs that * inadvertently place values in these fields. * * The ACPI 1.0 reserved fields that will be zeroed are the bytes located * at offset 45, 55, 95, and the word located at offset 109, 110. * - * Note: The FADT revision value is unreliable. Only the length can be - * trusted. + * Note: The FADT revision value is unreliable because of BIOS errors. + * The table length is instead used as the final word on the version. + * + * Note: FADT revision 3 is the ACPI 2.0 version of the FADT. */ - if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE) + if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V3_SIZE) { AcpiGbl_FADT.PreferredProfile = 0; AcpiGbl_FADT.PstateControl = 0; @@ -591,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) + 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) - { - /* 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/sys/contrib/dev/acpica/components/tables/tbfind.c b/sys/contrib/dev/acpica/components/tables/tbfind.c index 33d6a4078996..eadfd6fc10cb 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfind.c +++ b/sys/contrib/dev/acpica/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; - return_ACPI_STATUS (AE_NOT_FOUND); +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index bc105a6fae0e..81a13d2a8ff2 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/tables/tbutils.c b/sys/contrib/dev/acpica/components/tables/tbutils.c index e99f1b99c943..d9a12fedeb81 100644 --- a/sys/contrib/dev/acpica/components/tables/tbutils.c +++ b/sys/contrib/dev/acpica/components/tables/tbutils.c @@ -273,7 +273,7 @@ AcpiTbGetRootTableEntry ( * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress) { diff --git a/sys/contrib/dev/acpica/components/tables/tbxface.c b/sys/contrib/dev/acpica/components/tables/tbxface.c index d61b406c4ae1..2b12bb790aee 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxface.c +++ b/sys/contrib/dev/acpica/components/tables/tbxface.c @@ -103,7 +103,7 @@ AcpiAllocateRootTable ( * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables ( ACPI_TABLE_DESC *InitialTableArray, UINT32 InitialTableCount, @@ -179,7 +179,7 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables) * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiReallocateRootTable ( void) { diff --git a/sys/contrib/dev/acpica/components/tables/tbxfload.c b/sys/contrib/dev/acpica/components/tables/tbxfload.c index c2203e5f1a9a..12af13182c36 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfload.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfload.c @@ -65,7 +65,7 @@ * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void) { @@ -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,14 +257,12 @@ AcpiTbLoadNamespace ( { TablesLoaded++; } - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } if (!TablesFailed) { ACPI_INFO (( - "%u ACPI AML tables successfully acquired and loaded\n", + "%u ACPI AML tables successfully acquired and loaded", TablesLoaded)); } else @@ -278,6 +276,11 @@ AcpiTbLoadNamespace ( Status = AE_CTRL_TERMINATE; } +#ifdef ACPI_APPLICATION + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\n")); +#endif + + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); @@ -300,7 +303,7 @@ UnlockAndExit: * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable ( ACPI_PHYSICAL_ADDRESS Address, BOOLEAN Physical) @@ -366,52 +369,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); } @@ -466,9 +428,9 @@ AcpiUnloadParentTable ( return_ACPI_STATUS (AE_TYPE); } - /* Must acquire the interpreter lock during this operation */ + /* Must acquire the table lock during this operation */ - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); + Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -499,9 +461,11 @@ AcpiUnloadParentTable ( /* Ensure the table is actually loaded */ + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (!AcpiTbIsTableLoaded (i)) { Status = AE_NOT_EXIST; + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); break; } @@ -528,10 +492,11 @@ AcpiUnloadParentTable ( Status = AcpiTbReleaseOwnerId (i); AcpiTbSetTableLoadedFlag (i, FALSE); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); break; } - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/tables/tbxfroot.c b/sys/contrib/dev/acpica/components/tables/tbxfroot.c index 5c122619d20f..c5a6af296609 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfroot.c @@ -156,7 +156,7 @@ AcpiTbValidateRsdp ( * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiFindRootPointer ( ACPI_PHYSICAL_ADDRESS *TableAddress) { @@ -262,7 +262,7 @@ AcpiFindRootPointer ( return_ACPI_STATUS (AE_NOT_FOUND); } -ACPI_EXPORT_SYMBOL (AcpiFindRootPointer) +ACPI_EXPORT_SYMBOL_INIT (AcpiFindRootPointer) /******************************************************************************* diff --git a/sys/contrib/dev/acpica/components/utilities/utaddress.c b/sys/contrib/dev/acpica/components/utilities/utaddress.c index 166f552a02db..870826d012fd 100644 --- a/sys/contrib/dev/acpica/components/utilities/utaddress.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/utilities/utbuffer.c b/sys/contrib/dev/acpica/components/utilities/utbuffer.c index dfe54d1b4f24..8b3f75d34c63 100644 --- a/sys/contrib/dev/acpica/components/utilities/utbuffer.c +++ b/sys/contrib/dev/acpica/components/utilities/utbuffer.c @@ -264,7 +264,7 @@ AcpiUtDumpBufferToFile ( if (!Buffer) { - AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n"); + fprintf (File, "Null Buffer Pointer in DumpBuffer!\n"); return; } @@ -279,7 +279,7 @@ AcpiUtDumpBufferToFile ( { /* Print current offset */ - AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i)); + fprintf (File, "%6.4X: ", (BaseOffset + i)); /* Print 16 hex chars */ @@ -289,7 +289,7 @@ AcpiUtDumpBufferToFile ( { /* Dump fill spaces */ - AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " "); + fprintf (File, "%*s", ((Display * 2) + 1), " "); j += Display; continue; } @@ -299,28 +299,28 @@ AcpiUtDumpBufferToFile ( case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ - AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); + fprintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiUtFilePrintf (File, "%04X ", Temp32); + fprintf (File, "%04X ", Temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiUtFilePrintf (File, "%08X ", Temp32); + fprintf (File, "%08X ", Temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); - AcpiUtFilePrintf (File, "%08X", Temp32); + fprintf (File, "%08X", Temp32); ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); - AcpiUtFilePrintf (File, "%08X ", Temp32); + fprintf (File, "%08X ", Temp32); break; } @@ -331,29 +331,29 @@ AcpiUtDumpBufferToFile ( * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ - AcpiUtFilePrintf (File, " "); + fprintf (File, " "); for (j = 0; j < 16; j++) { if (i + j >= Count) { - AcpiUtFilePrintf (File, "\n"); + fprintf (File, "\n"); return; } BufChar = Buffer[(ACPI_SIZE) i + j]; if (isprint (BufChar)) { - AcpiUtFilePrintf (File, "%c", BufChar); + fprintf (File, "%c", BufChar); } else { - AcpiUtFilePrintf (File, "."); + fprintf (File, "."); } } /* Done with that line. */ - AcpiUtFilePrintf (File, "\n"); + fprintf (File, "\n"); i += 16; } diff --git a/sys/contrib/dev/acpica/components/utilities/utdebug.c b/sys/contrib/dev/acpica/components/utilities/utdebug.c index 7e03b226f0d5..2f60e8780080 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c @@ -708,33 +708,3 @@ AcpiTracePoint ( ACPI_EXPORT_SYMBOL (AcpiTracePoint) #endif - - -#ifdef ACPI_APPLICATION -/******************************************************************************* - * - * FUNCTION: AcpiLogError - * - * PARAMETERS: Format - Printf format field - * ... - Optional printf arguments - * - * RETURN: None - * - * DESCRIPTION: Print error message to the console, used by applications. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiLogError ( - const char *Format, - ...) -{ - va_list Args; - - va_start (Args, Format); - (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args); - va_end (Args); -} - -ACPI_EXPORT_SYMBOL (AcpiLogError) -#endif diff --git a/sys/contrib/dev/acpica/components/utilities/uthex.c b/sys/contrib/dev/acpica/components/utilities/uthex.c index 2bae5c7521f4..d4571a258890 100644 --- a/sys/contrib/dev/acpica/components/utilities/uthex.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c index a33c4bc03105..87fb9f65be2f 100644 --- a/sys/contrib/dev/acpica/components/utilities/utinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utinit.c @@ -226,7 +226,7 @@ AcpiUtInitGlobals ( AcpiGbl_NextOwnerIdOffset = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_OsiMutex = NULL; - AcpiGbl_MaxLoopIterations = 0xFFFF; + AcpiGbl_MaxLoopIterations = ACPI_MAX_LOOP_COUNT; /* Hardware oriented */ diff --git a/sys/contrib/dev/acpica/components/utilities/utnonansi.c b/sys/contrib/dev/acpica/components/utilities/utnonansi.c index ca6bc7a33109..720436e4063c 100644 --- a/sys/contrib/dev/acpica/components/utilities/utnonansi.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c index 2a9fa792c5b6..ec3dade0ef71 100644 --- a/sys/contrib/dev/acpica/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/components/utilities/utpredef.c b/sys/contrib/dev/acpica/components/utilities/utpredef.c index 496b9006fa04..015d11b6ff64 100644 --- a/sys/contrib/dev/acpica/components/utilities/utpredef.c +++ b/sys/contrib/dev/acpica/components/utilities/utpredef.c @@ -196,8 +196,6 @@ AcpiUtGetExpectedReturnTypes ( ******************************************************************************/ #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) -#include <stdio.h> -#include <string.h> /* Local prototypes */ diff --git a/sys/contrib/dev/acpica/components/utilities/utprint.c b/sys/contrib/dev/acpica/components/utilities/utprint.c deleted file mode 100644 index 910a2b7ff363..000000000000 --- a/sys/contrib/dev/acpica/components/utilities/utprint.c +++ /dev/null @@ -1,812 +0,0 @@ -/****************************************************************************** - * - * Module Name: utprint - Formatted printing routines - * - *****************************************************************************/ - -/* - * 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 <contrib/dev/acpica/include/acpi.h> -#include <contrib/dev/acpica/include/accommon.h> - -#define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("utprint") - - -#define ACPI_FORMAT_SIGN 0x01 -#define ACPI_FORMAT_SIGN_PLUS 0x02 -#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04 -#define ACPI_FORMAT_ZERO 0x08 -#define ACPI_FORMAT_LEFT 0x10 -#define ACPI_FORMAT_UPPER 0x20 -#define ACPI_FORMAT_PREFIX 0x40 - - -/* Local prototypes */ - -static ACPI_SIZE -AcpiUtBoundStringLength ( - const char *String, - ACPI_SIZE Count); - -static char * -AcpiUtBoundStringOutput ( - char *String, - const char *End, - char c); - -static char * -AcpiUtFormatNumber ( - char *String, - char *End, - UINT64 Number, - UINT8 Base, - INT32 Width, - INT32 Precision, - UINT8 Type); - -static char * -AcpiUtPutNumber ( - char *String, - UINT64 Number, - UINT8 Base, - BOOLEAN Upper); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtBoundStringLength - * - * PARAMETERS: String - String with boundary - * Count - Boundary of the string - * - * RETURN: Length of the string. Less than or equal to Count. - * - * DESCRIPTION: Calculate the length of a string with boundary. - * - ******************************************************************************/ - -static ACPI_SIZE -AcpiUtBoundStringLength ( - const char *String, - ACPI_SIZE Count) -{ - UINT32 Length = 0; - - - while (*String && Count) - { - Length++; - String++; - Count--; - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtBoundStringOutput - * - * PARAMETERS: String - String with boundary - * End - Boundary of the string - * c - Character to be output to the string - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Output a character into a string with boundary check. - * - ******************************************************************************/ - -static char * -AcpiUtBoundStringOutput ( - char *String, - const char *End, - char c) -{ - - if (String < End) - { - *String = c; - } - - ++String; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPutNumber - * - * PARAMETERS: String - Buffer to hold reverse-ordered string - * Number - Integer to be converted - * Base - Base of the integer - * Upper - Whether or not using upper cased digits - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Convert an integer into a string, note that, the string holds a - * reversed ordered number without the trailing zero. - * - ******************************************************************************/ - -static char * -AcpiUtPutNumber ( - char *String, - UINT64 Number, - UINT8 Base, - BOOLEAN Upper) -{ - const char *Digits; - UINT64 DigitIndex; - char *Pos; - - - Pos = String; - Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits; - - if (Number == 0) - { - *(Pos++) = '0'; - } - else - { - while (Number) - { - (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex); - *(Pos++) = Digits[DigitIndex]; - } - } - - /* *(Pos++) = '0'; */ - return (Pos); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtScanNumber - * - * PARAMETERS: String - String buffer - * NumberPtr - Where the number is returned - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Scan a string for a decimal integer. - * - ******************************************************************************/ - -const char * -AcpiUtScanNumber ( - const char *String, - UINT64 *NumberPtr) -{ - UINT64 Number = 0; - - - while (isdigit ((int) *String)) - { - Number *= 10; - Number += *(String++) - '0'; - } - - *NumberPtr = Number; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtPrintNumber - * - * PARAMETERS: String - String buffer - * Number - The number to be converted - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Print a decimal integer into a string. - * - ******************************************************************************/ - -const char * -AcpiUtPrintNumber ( - char *String, - UINT64 Number) -{ - char AsciiString[20]; - const char *Pos1; - char *Pos2; - - - Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE); - Pos2 = String; - - while (Pos1 != AsciiString) - { - *(Pos2++) = *(--Pos1); - } - - *Pos2 = 0; - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtFormatNumber - * - * PARAMETERS: String - String buffer with boundary - * End - Boundary of the string - * Number - The number to be converted - * Base - Base of the integer - * Width - Field width - * Precision - Precision of the integer - * Type - Special printing flags - * - * RETURN: Updated position for next valid character - * - * DESCRIPTION: Print an integer into a string with any base and any precision. - * - ******************************************************************************/ - -static char * -AcpiUtFormatNumber ( - char *String, - char *End, - UINT64 Number, - UINT8 Base, - INT32 Width, - INT32 Precision, - UINT8 Type) -{ - char *Pos; - char Sign; - char Zero; - BOOLEAN NeedPrefix; - BOOLEAN Upper; - INT32 i; - char ReversedString[66]; - - - /* Parameter validation */ - - if (Base < 2 || Base > 16) - { - return (NULL); - } - - if (Type & ACPI_FORMAT_LEFT) - { - Type &= ~ACPI_FORMAT_ZERO; - } - - NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE; - Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE; - Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' '; - - /* Calculate size according to sign and prefix */ - - Sign = '\0'; - if (Type & ACPI_FORMAT_SIGN) - { - if ((INT64) Number < 0) - { - Sign = '-'; - Number = - (INT64) Number; - Width--; - } - else if (Type & ACPI_FORMAT_SIGN_PLUS) - { - Sign = '+'; - Width--; - } - else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE) - { - Sign = ' '; - Width--; - } - } - if (NeedPrefix) - { - Width--; - if (Base == 16) - { - Width--; - } - } - - /* Generate full string in reverse order */ - - Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper); - i = ACPI_PTR_DIFF (Pos, ReversedString); - - /* Printing 100 using %2d gives "100", not "00" */ - - if (i > Precision) - { - Precision = i; - } - - Width -= Precision; - - /* Output the string */ - - if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) - { - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, ' '); - } - } - if (Sign) - { - String = AcpiUtBoundStringOutput (String, End, Sign); - } - if (NeedPrefix) - { - String = AcpiUtBoundStringOutput (String, End, '0'); - if (Base == 16) - { - String = AcpiUtBoundStringOutput ( - String, End, Upper ? 'X' : 'x'); - } - } - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, Zero); - } - } - - while (i <= --Precision) - { - String = AcpiUtBoundStringOutput (String, End, '0'); - } - while (--i >= 0) - { - String = AcpiUtBoundStringOutput (String, End, - ReversedString[i]); - } - while (--Width >= 0) - { - String = AcpiUtBoundStringOutput (String, End, ' '); - } - - return (String); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtVsnprintf - * - * PARAMETERS: String - String with boundary - * Size - Boundary of the string - * Format - Standard printf format - * Args - Argument list - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a string using argument list pointer. - * - ******************************************************************************/ - -int -AcpiUtVsnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - va_list Args) -{ - UINT8 Base; - UINT8 Type; - INT32 Width; - INT32 Precision; - char Qualifier; - UINT64 Number; - char *Pos; - char *End; - char c; - const char *s; - const void *p; - INT32 Length; - int i; - - - Pos = String; - End = String + Size; - - for (; *Format; ++Format) - { - if (*Format != '%') - { - Pos = AcpiUtBoundStringOutput (Pos, End, *Format); - continue; - } - - Type = 0; - Base = 10; - - /* Process sign */ - - do - { - ++Format; - if (*Format == '#') - { - Type |= ACPI_FORMAT_PREFIX; - } - else if (*Format == '0') - { - Type |= ACPI_FORMAT_ZERO; - } - else if (*Format == '+') - { - Type |= ACPI_FORMAT_SIGN_PLUS; - } - else if (*Format == ' ') - { - Type |= ACPI_FORMAT_SIGN_PLUS_SPACE; - } - else if (*Format == '-') - { - Type |= ACPI_FORMAT_LEFT; - } - else - { - break; - } - - } while (1); - - /* Process width */ - - Width = -1; - if (isdigit ((int) *Format)) - { - Format = AcpiUtScanNumber (Format, &Number); - Width = (INT32) Number; - } - else if (*Format == '*') - { - ++Format; - Width = va_arg (Args, int); - if (Width < 0) - { - Width = -Width; - Type |= ACPI_FORMAT_LEFT; - } - } - - /* Process precision */ - - Precision = -1; - if (*Format == '.') - { - ++Format; - if (isdigit ((int) *Format)) - { - Format = AcpiUtScanNumber (Format, &Number); - Precision = (INT32) Number; - } - else if (*Format == '*') - { - ++Format; - Precision = va_arg (Args, int); - } - - if (Precision < 0) - { - Precision = 0; - } - } - - /* Process qualifier */ - - Qualifier = -1; - if (*Format == 'h' || *Format == 'l' || *Format == 'L') - { - Qualifier = *Format; - ++Format; - - if (Qualifier == 'l' && *Format == 'l') - { - Qualifier = 'L'; - ++Format; - } - } - - switch (*Format) - { - case '%': - - Pos = AcpiUtBoundStringOutput (Pos, End, '%'); - continue; - - case 'c': - - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (--Width > 0) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - } - - c = (char) va_arg (Args, int); - Pos = AcpiUtBoundStringOutput (Pos, End, c); - - while (--Width > 0) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - continue; - - case 's': - - s = va_arg (Args, char *); - if (!s) - { - s = "<NULL>"; - } - Length = AcpiUtBoundStringLength (s, Precision); - if (!(Type & ACPI_FORMAT_LEFT)) - { - while (Length < Width--) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - } - - for (i = 0; i < Length; ++i) - { - Pos = AcpiUtBoundStringOutput (Pos, End, *s); - ++s; - } - - while (Length < Width--) - { - Pos = AcpiUtBoundStringOutput (Pos, End, ' '); - } - continue; - - case 'o': - - Base = 8; - break; - - case 'X': - - Type |= ACPI_FORMAT_UPPER; - - case 'x': - - Base = 16; - break; - - case 'd': - case 'i': - - Type |= ACPI_FORMAT_SIGN; - - case 'u': - - break; - - case 'p': - - if (Width == -1) - { - Width = 2 * sizeof (void *); - Type |= ACPI_FORMAT_ZERO; - } - - p = va_arg (Args, void *); - Pos = AcpiUtFormatNumber ( - Pos, End, ACPI_TO_INTEGER (p), 16, Width, Precision, Type); - continue; - - default: - - Pos = AcpiUtBoundStringOutput (Pos, End, '%'); - if (*Format) - { - Pos = AcpiUtBoundStringOutput (Pos, End, *Format); - } - else - { - --Format; - } - continue; - } - - if (Qualifier == 'L') - { - Number = va_arg (Args, UINT64); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT64) Number; - } - } - else if (Qualifier == 'l') - { - Number = va_arg (Args, unsigned long); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT32) Number; - } - } - else if (Qualifier == 'h') - { - Number = (UINT16) va_arg (Args, int); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (INT16) Number; - } - } - else - { - Number = va_arg (Args, unsigned int); - if (Type & ACPI_FORMAT_SIGN) - { - Number = (signed int) Number; - } - } - - Pos = AcpiUtFormatNumber (Pos, End, Number, Base, - Width, Precision, Type); - } - - if (Size > 0) - { - if (Pos < End) - { - *Pos = '\0'; - } - else - { - End[-1] = '\0'; - } - } - - return (ACPI_PTR_DIFF (Pos, String)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtSnprintf - * - * PARAMETERS: String - String with boundary - * Size - Boundary of the string - * Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a string. - * - ******************************************************************************/ - -int -AcpiUtSnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = AcpiUtVsnprintf (String, Size, Format, Args); - va_end (Args); - - return (Length); -} - - -#ifdef ACPI_APPLICATION -/******************************************************************************* - * - * FUNCTION: AcpiUtFileVprintf - * - * PARAMETERS: File - File descriptor - * Format - Standard printf format - * Args - Argument list - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a file using argument list pointer. - * - ******************************************************************************/ - -int -AcpiUtFileVprintf ( - ACPI_FILE File, - const char *Format, - va_list Args) -{ - ACPI_CPU_FLAGS Flags; - int Length; - - - Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, - sizeof (AcpiGbl_PrintBuffer), Format, Args); - - (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); - AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtFilePrintf - * - * PARAMETERS: File - File descriptor - * Format, ... - Standard printf format - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Formatted output to a file. - * - ******************************************************************************/ - -int -AcpiUtFilePrintf ( - ACPI_FILE File, - const char *Format, - ...) -{ - va_list Args; - int Length; - - - va_start (Args, Format); - Length = AcpiUtFileVprintf (File, Format, Args); - va_end (Args); - - return (Length); -} -#endif diff --git a/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c b/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c new file mode 100644 index 000000000000..5a7294a24d68 --- /dev/null +++ b/sys/contrib/dev/acpica/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 <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/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/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c index 76e915b8de1d..6cc0cde7fdf1 100644 --- a/sys/contrib/dev/acpica/components/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c @@ -107,14 +107,12 @@ AcpiUtCreateList ( ACPI_MEMORY_LIST *Cache; - Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST)); + Cache = AcpiOsAllocateZeroed (sizeof (ACPI_MEMORY_LIST)); if (!Cache) { return (AE_NO_MEMORY); } - memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = ListName; Cache->ObjectSize = ObjectSize; diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c index 02ca6328c342..df74a51cdb11 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxface.c +++ b/sys/contrib/dev/acpica/components/utilities/utxface.c @@ -63,7 +63,7 @@ * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTerminate ( void) { diff --git a/sys/contrib/dev/acpica/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/components/utilities/utxfinit.c index f7085b462791..0a6fc10243a1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfinit.c @@ -72,7 +72,7 @@ AeDoObjectOverrides ( * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeSubsystem ( void) { @@ -151,7 +151,7 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem) * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiEnableSubsystem ( UINT32 Flags) { @@ -263,7 +263,7 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem) * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeObjects ( UINT32 Flags) { @@ -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/sys/contrib/dev/acpica/include/acapps.h b/sys/contrib/dev/acpica/include/acapps.h index 87284f20b0da..d14bce1ff03f 100644 --- a/sys/contrib/dev/acpica/include/acapps.h +++ b/sys/contrib/dev/acpica/include/acapps.h @@ -44,11 +44,9 @@ #ifndef _ACAPPS #define _ACAPPS -#include <stdio.h> - -#ifdef _MSC_VER /* disable some level-4 warnings */ -#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ -#endif +#ifdef ACPI_USE_STANDARD_HEADERS +#include <sys/stat.h> +#endif /* ACPI_USE_STANDARD_HEADERS */ /* Common info for tool signons */ @@ -85,13 +83,13 @@ /* Macros for usage messages */ #define ACPI_USAGE_HEADER(Usage) \ - AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage); + printf ("Usage: %s\nOptions:\n", Usage); #define ACPI_USAGE_TEXT(Description) \ - AcpiOsPrintf (Description); + printf (Description); #define ACPI_OPTION(Name, Description) \ - AcpiOsPrintf (" %-20s%s\n", Name, Description); + printf (" %-20s%s\n", Name, Description); /* Check for unexpected exceptions */ diff --git a/sys/contrib/dev/acpica/include/acclib.h b/sys/contrib/dev/acpica/include/acclib.h index 56a30723ae35..0b104b6126e2 100644 --- a/sys/contrib/dev/acpica/include/acclib.h +++ b/sys/contrib/dev/acpica/include/acclib.h @@ -73,6 +73,23 @@ extern const UINT8 AcpiGbl_Ctypes[]; #define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) #define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) +/* Error code */ + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define EBADF 9 /* Bad file number */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define ENODEV 19 /* No such device */ +#define EINVAL 22 /* Invalid argument */ +#define EPIPE 32 /* Broken pipe */ +#define ERANGE 34 /* Math result not representable */ /* Strings */ @@ -164,4 +181,105 @@ int toupper ( int c); +/* + * utprint - printf/vprintf output functions + */ +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr); + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number); + +int +vsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args); + +int +snprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...); + +int +sprintf ( + char *String, + const char *Format, + ...); + +#ifdef ACPI_APPLICATION +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +/* + * NOTE: Currently we only need to update errno for file IOs. Other + * Clibrary invocations in ACPICA do not make descisions according to + * the errno. + */ +extern int errno; + +int +vprintf ( + const char *Format, + va_list Args); + +int +printf ( + const char *Format, + ...); + +int +vfprintf ( + FILE *File, + const char *Format, + va_list Args); + +int +fprintf ( + FILE *File, + const char *Format, + ...); + +FILE * +fopen ( + const char *Path, + const char *Modes); + +void +fclose ( + FILE *File); + +int +fread ( + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count, + FILE *File); + +int +fwrite ( + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count, + FILE *File); + +int +fseek ( + FILE *File, + long Offset, + int From); + +long +ftell ( + FILE *File); +#endif + #endif /* _ACCLIB_H */ diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index a626f87591eb..d6324911e8a7 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -146,6 +146,10 @@ #define ACPI_ADDRESS_RANGE_MAX 2 +/* Maximum number of While() loops before abort */ + +#define ACPI_MAX_LOOP_COUNT 0x000FFFFF + /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index 3e625656cafa..10f626ce4097 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -233,8 +233,8 @@ AcpiDbDisassembleAml ( ACPI_PARSE_OBJECT *Op); void -AcpiDbBatchExecute ( - char *CountArg); +AcpiDbEvaluatePredefinedNames ( + void); /* diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 07be53f50502..11f95e3610a6 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -109,6 +109,7 @@ typedef enum ACPI_DMT_UINT64, ACPI_DMT_BUF7, ACPI_DMT_BUF10, + ACPI_DMT_BUF12, ACPI_DMT_BUF16, ACPI_DMT_BUF128, ACPI_DMT_SIG, @@ -279,8 +280,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[]; @@ -386,6 +387,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; @@ -423,6 +425,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; +extern ACPI_DMTABLE_INFO *FadtRevisionInfo [ACPI_FADT_MAX_VERSION + 1]; + + /* * dmtable and ahtable */ diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index a14dbe57c1b2..14f2b7925b8e 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index a883ac492116..1d5c17e6377a 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -245,10 +245,6 @@ ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); -/* Maximum number of While() loop iterations before forced abort */ - -ACPI_GLOBAL (UINT16, AcpiGbl_MaxLoopIterations); - /* Control method single step flag */ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); @@ -322,6 +318,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmEmitExternalOpcodes, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DoDisassemblerOptimizations, TRUE); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); @@ -392,6 +389,7 @@ ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); /* Print buffer */ diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index e7a0d37d1447..f41160953b17 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/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; @@ -915,7 +917,7 @@ typedef union acpi_parse_value ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ UINT8 ArgListLength; /* Number of elements in the arg list */\ ACPI_DISASM_ONLY_MEMBERS (\ - UINT8 DisasmFlags; /* Used during AML disassembly */\ + UINT16 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ char *OperatorSymbol;/* Used for C-style operator name strings */\ char AmlOpName[16]) /* Op name (debug only) */ @@ -1035,14 +1037,15 @@ typedef struct acpi_parse_state /* Parse object DisasmFlags */ -#define ACPI_PARSEOP_IGNORE 0x01 -#define ACPI_PARSEOP_PARAMETER_LIST 0x02 -#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 -#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08 -#define ACPI_PARSEOP_CLOSING_PAREN 0x10 -#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20 -#define ACPI_PARSEOP_ASSIGNMENT 0x40 -#define ACPI_PARSEOP_ELSEIF 0x80 +#define ACPI_PARSEOP_IGNORE 0x0001 +#define ACPI_PARSEOP_PARAMETER_LIST 0x0002 +#define ACPI_PARSEOP_EMPTY_TERMLIST 0x0004 +#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x0008 +#define ACPI_PARSEOP_CLOSING_PAREN 0x0010 +#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x0020 +#define ACPI_PARSEOP_ASSIGNMENT 0x0040 +#define ACPI_PARSEOP_ELSEIF 0x0080 +#define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100 /***************************************************************************** diff --git a/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 11ee70d044ed..440ff5b940eb 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acparser.h b/sys/contrib/dev/acpica/include/acparser.h index dd2782199d00..4137981024f7 100644 --- a/sys/contrib/dev/acpica/include/acparser.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index b6d0f80acef9..4595cabf2a00 100644 --- a/sys/contrib/dev/acpica/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/include/acpiosxf.h @@ -492,6 +492,15 @@ AcpiOsGetLine ( UINT32 *BytesRead); #endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint +void +AcpiOsTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname); +#endif + /* * Obtain ACPI table(s) @@ -552,62 +561,4 @@ AcpiOsCloseDirectory ( #endif -/* - * File I/O and related support - */ -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile -ACPI_FILE -AcpiOsOpenFile ( - const char *Path, - UINT8 Modes); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile -void -AcpiOsCloseFile ( - ACPI_FILE File); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile -int -AcpiOsReadFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile -int -AcpiOsWriteFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset -long -AcpiOsGetFileOffset ( - ACPI_FILE File); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset -ACPI_STATUS -AcpiOsSetFileOffset ( - ACPI_FILE File, - long Offset, - UINT8 From); -#endif - -#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint -void -AcpiOsTracePoint ( - ACPI_TRACE_EVENT_TYPE Type, - BOOLEAN Begin, - UINT8 *Aml, - char *Pathname); -#endif - - #endif /* __ACPIOSXF_H__ */ diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 725317ca7456..e10608d4785a 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160527 +#define ACPI_CA_VERSION 0x20160930 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/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 @@ -254,6 +261,13 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); /* + * Maximum number of While() loop iterations before forced method abort. + * This mechanism is intended to prevent infinite loops during interpreter + * execution within a host kernel. + */ +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_COUNT); + +/* * This mechanism is used to trace a specified AML method. The method is * traced each time it is executed. */ @@ -420,29 +434,29 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); * Initialization */ ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables ( ACPI_TABLE_DESC *InitialStorage, UINT32 InitialTableCount, BOOLEAN AllowResize)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeSubsystem ( void)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiEnableSubsystem ( UINT32 Flags)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeObjects ( UINT32 Flags)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTerminate ( void)) @@ -520,7 +534,7 @@ AcpiDecodePldBuffer ( * ACPI table load/unload interfaces */ ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable ( ACPI_PHYSICAL_ADDRESS Address, BOOLEAN Physical)) @@ -536,7 +550,7 @@ AcpiUnloadParentTable ( ACPI_HANDLE Object)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void)) @@ -545,12 +559,12 @@ AcpiLoadTables ( * ACPI table manipulation interfaces */ ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiReallocateRootTable ( void)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiFindRootPointer ( ACPI_PHYSICAL_ADDRESS *RsdpAddress)) @@ -909,6 +923,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)) @@ -1232,13 +1253,6 @@ AcpiTracePoint ( UINT8 *Aml, char *Pathname)) -ACPI_APP_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(1) -void ACPI_INTERNAL_VAR_XFACE -AcpiLogError ( - const char *Format, - ...)) - ACPI_STATUS AcpiInitializeDebugger ( void); diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index e1a4a6eb63a4..3325f19e2d1d 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/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 AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); diff --git a/sys/contrib/dev/acpica/include/actbl.h b/sys/contrib/dev/acpica/include/actbl.h index 0ef82cda611e..d56ee27cb82e 100644 --- a/sys/contrib/dev/acpica/include/actbl.h +++ b/sys/contrib/dev/acpica/include/actbl.h @@ -256,62 +256,72 @@ typedef struct acpi_table_facs typedef struct acpi_table_fadt { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Facs; /* 32-bit physical address of FACS */ - UINT32 Dsdt; /* 32-bit physical address of DSDT */ - UINT8 Model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ - UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */ - UINT16 SciInterrupt; /* System vector of SCI interrupt */ - UINT32 SmiCommand; /* 32-bit Port address of SMI command port */ - UINT8 AcpiEnable; /* Value to write to SMI_CMD to enable ACPI */ - UINT8 AcpiDisable; /* Value to write to SMI_CMD to disable ACPI */ - UINT8 S4BiosRequest; /* Value to write to SMI_CMD to enter S4BIOS state */ - UINT8 PstateControl; /* Processor performance state control*/ - UINT32 Pm1aEventBlock; /* 32-bit port address of Power Mgt 1a Event Reg Blk */ - UINT32 Pm1bEventBlock; /* 32-bit port address of Power Mgt 1b Event Reg Blk */ - UINT32 Pm1aControlBlock; /* 32-bit port address of Power Mgt 1a Control Reg Blk */ - UINT32 Pm1bControlBlock; /* 32-bit port address of Power Mgt 1b Control Reg Blk */ - UINT32 Pm2ControlBlock; /* 32-bit port address of Power Mgt 2 Control Reg Blk */ - UINT32 PmTimerBlock; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ - UINT32 Gpe0Block; /* 32-bit port address of General Purpose Event 0 Reg Blk */ - UINT32 Gpe1Block; /* 32-bit port address of General Purpose Event 1 Reg Blk */ - UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */ - UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */ - UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */ - UINT8 PmTimerLength; /* Byte Length of ports at PmTimerBlock */ - UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */ - UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */ - UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */ - UINT8 CstControl; /* Support for the _CST object and C-States change notification */ - UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */ - UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */ - UINT16 FlushSize; /* Processor memory cache line width, in bytes */ - UINT16 FlushStride; /* Number of flush strides that need to be read */ - UINT8 DutyOffset; /* Processor duty cycle index in processor P_CNT reg */ - UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register */ - UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */ - UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */ - UINT8 Century; /* Index to century in RTC CMOS RAM */ - UINT16 BootFlags; /* IA-PC Boot Architecture Flags (see below for individual flags) */ - UINT8 Reserved; /* Reserved, must be zero */ - UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */ - ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */ - UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */ - UINT16 ArmBootFlags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ - UINT8 MinorRevision; /* FADT Minor Revision (ACPI 5.1) */ - UINT64 XFacs; /* 64-bit physical address of FACS */ - UINT64 XDsdt; /* 64-bit physical address of DSDT */ - ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1bEventBlock; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1aControlBlock; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm1bControlBlock; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPm2ControlBlock; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ - ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ - ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ - ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ - ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */ - ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */ - UINT64 HypervisorId; /* Hypervisor Vendor ID (ACPI 6.0) */ + ACPI_TABLE_HEADER Header; /* [V1] Common ACPI table header */ + UINT32 Facs; /* [V1] 32-bit physical address of FACS */ + UINT32 Dsdt; /* [V1] 32-bit physical address of DSDT */ + UINT8 Model; /* [V1] System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ + UINT8 PreferredProfile; /* [V1] Conveys preferred power management profile to OSPM. */ + UINT16 SciInterrupt; /* [V1] System vector of SCI interrupt */ + UINT32 SmiCommand; /* [V1] 32-bit Port address of SMI command port */ + UINT8 AcpiEnable; /* [V1] Value to write to SMI_CMD to enable ACPI */ + UINT8 AcpiDisable; /* [V1] Value to write to SMI_CMD to disable ACPI */ + UINT8 S4BiosRequest; /* [V1] Value to write to SMI_CMD to enter S4BIOS state */ + UINT8 PstateControl; /* [V1] Processor performance state control*/ + UINT32 Pm1aEventBlock; /* [V1] 32-bit port address of Power Mgt 1a Event Reg Blk */ + UINT32 Pm1bEventBlock; /* [V1] 32-bit port address of Power Mgt 1b Event Reg Blk */ + UINT32 Pm1aControlBlock; /* [V1] 32-bit port address of Power Mgt 1a Control Reg Blk */ + UINT32 Pm1bControlBlock; /* [V1] 32-bit port address of Power Mgt 1b Control Reg Blk */ + UINT32 Pm2ControlBlock; /* [V1] 32-bit port address of Power Mgt 2 Control Reg Blk */ + UINT32 PmTimerBlock; /* [V1] 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ + UINT32 Gpe0Block; /* [V1] 32-bit port address of General Purpose Event 0 Reg Blk */ + UINT32 Gpe1Block; /* [V1] 32-bit port address of General Purpose Event 1 Reg Blk */ + UINT8 Pm1EventLength; /* [V1] Byte Length of ports at Pm1xEventBlock */ + UINT8 Pm1ControlLength; /* [V1] Byte Length of ports at Pm1xControlBlock */ + UINT8 Pm2ControlLength; /* [V1] Byte Length of ports at Pm2ControlBlock */ + UINT8 PmTimerLength; /* [V1] Byte Length of ports at PmTimerBlock */ + UINT8 Gpe0BlockLength; /* [V1] Byte Length of ports at Gpe0Block */ + UINT8 Gpe1BlockLength; /* [V1] Byte Length of ports at Gpe1Block */ + UINT8 Gpe1Base; /* [V1] Offset in GPE number space where GPE1 events start */ + UINT8 CstControl; /* [V1] Support for the _CST object and C-States change notification */ + UINT16 C2Latency; /* [V1] Worst case HW latency to enter/exit C2 state */ + UINT16 C3Latency; /* [V1] Worst case HW latency to enter/exit C3 state */ + UINT16 FlushSize; /* [V1] Processor memory cache line width, in bytes */ + UINT16 FlushStride; /* [V1] Number of flush strides that need to be read */ + UINT8 DutyOffset; /* [V1] Processor duty cycle index in processor P_CNT reg */ + UINT8 DutyWidth; /* [V1] Processor duty cycle value bit width in P_CNT register */ + UINT8 DayAlarm; /* [V1] Index to day-of-month alarm in RTC CMOS RAM */ + UINT8 MonthAlarm; /* [V1] Index to month-of-year alarm in RTC CMOS RAM */ + UINT8 Century; /* [V1] Index to century in RTC CMOS RAM */ + UINT16 BootFlags; /* [V3] IA-PC Boot Architecture Flags (see below for individual flags) */ + UINT8 Reserved; /* [V1] Reserved, must be zero */ + UINT32 Flags; /* [V1] Miscellaneous flag bits (see below for individual flags) */ + /* End of Version 1 FADT fields (ACPI 1.0) */ + + ACPI_GENERIC_ADDRESS ResetRegister; /* [V3] 64-bit address of the Reset register */ + UINT8 ResetValue; /* [V3] Value to write to the ResetRegister port to reset the system */ + UINT16 ArmBootFlags; /* [V5] ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ + UINT8 MinorRevision; /* [V5] FADT Minor Revision (ACPI 5.1) */ + UINT64 XFacs; /* [V3] 64-bit physical address of FACS */ + UINT64 XDsdt; /* [V3] 64-bit physical address of DSDT */ + ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* [V3] 64-bit Extended Power Mgt 1a Event Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bEventBlock; /* [V3] 64-bit Extended Power Mgt 1b Event Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1aControlBlock; /* [V3] 64-bit Extended Power Mgt 1a Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bControlBlock; /* [V3] 64-bit Extended Power Mgt 1b Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm2ControlBlock; /* [V3] 64-bit Extended Power Mgt 2 Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPmTimerBlock; /* [V3] 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe0Block; /* [V3] 64-bit Extended General Purpose Event 0 Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe1Block; /* [V3] 64-bit Extended General Purpose Event 1 Reg Blk address */ + /* End of Version 3 FADT fields (ACPI 2.0) */ + + ACPI_GENERIC_ADDRESS SleepControl; /* [V4] 64-bit Sleep Control register (ACPI 5.0) */ + /* End of Version 4 FADT fields (ACPI 3.0 and ACPI 4.0) (Field was originally reserved in ACPI 3.0) */ + + ACPI_GENERIC_ADDRESS SleepStatus; /* [V5] 64-bit Sleep Status register (ACPI 5.0) */ + /* End of Version 5 FADT fields (ACPI 5.0) */ + + UINT64 HypervisorId; /* [V6] Hypervisor Vendor ID (ACPI 6.0) */ + /* End of Version 6 FADT fields (ACPI 6.0) */ + } ACPI_TABLE_FADT; @@ -327,8 +337,8 @@ typedef struct acpi_table_fadt /* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ -#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */ -#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ +#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5] PSCI 0.2+ is implemented */ +#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5] HVC must be used instead of SMC as the PSCI conduit */ /* Masks for FADT flags */ @@ -435,20 +445,34 @@ typedef struct acpi_table_desc * match the expected length. In other words, the length of the * FADT is the bottom line as to what the version really is. * - * For reference, the values below are as follows: - * FADT V1 size: 0x074 - * FADT V2 size: 0x084 - * FADT V3 size: 0x0F4 - * FADT V4 size: 0x0F4 - * FADT V5 size: 0x10C - * FADT V6 size: 0x114 + * NOTE: There is no officialy released V2 of the FADT. This + * version was used only for prototyping and testing during the + * 32-bit to 64-bit transition. V3 was the first official 64-bit + * version of the FADT. + * + * Update this list of defines when a new version of the FADT is + * added to the ACPI specification. Note that the FADT version is + * only incremented when new fields are appended to the existing + * version. Therefore, the FADT version is competely independent + * from the version of the ACPI specification where it is + * defined. + * + * For reference, the various FADT lengths are as follows: + * FADT V1 size: 0x074 ACPI 1.0 + * FADT V3 size: 0x0F4 ACPI 2.0 + * FADT V4 size: 0x100 ACPI 3.0 and ACPI 4.0 + * FADT V5 size: 0x10C ACPI 5.0 + * FADT V6 size: 0x114 ACPI 6.0 */ -#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) -#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) -#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) -#define ACPI_FADT_V5_SIZE (UINT32) (ACPI_FADT_OFFSET (HypervisorId)) -#define ACPI_FADT_V6_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) +#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) /* ACPI 1.0 */ +#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) /* ACPI 2.0 */ +#define ACPI_FADT_V4_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepStatus)) /* ACPI 3.0 and ACPI 4.0 */ +#define ACPI_FADT_V5_SIZE (UINT32) (ACPI_FADT_OFFSET (HypervisorId)) /* ACPI 5.0 */ +#define ACPI_FADT_V6_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) /* ACPI 6.0 */ + +/* Update these when new FADT versions are added */ +#define ACPI_FADT_MAX_VERSION 6 #define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)" #endif /* __ACTBL_H__ */ diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 395b91538381..0d2ab4cc8ad4 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -745,16 +745,17 @@ typedef UINT32 ACPI_EVENT_TYPE; * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+-+-+ - * | Bits 31:5 |4|3|2|1|0| - * +-------------+-+-+-+-+-+ - * | | | | | | - * | | | | | +- Enabled? - * | | | | +--- Enabled for wake? - * | | | +----- Status bit set? - * | | +------- Enable bit set? - * | +--------- Has a handler? - * +--------------- <Reserved> + * +-------------+-+-+-+-+-+-+ + * | Bits 31:6 |5|4|3|2|1|0| + * +-------------+-+-+-+-+-+-+ + * | | | | | | | + * | | | | | | +- Enabled? + * | | | | | +--- Enabled for wake? + * | | | | +----- Status bit set? + * | | | +------- Enable bit set? + * | | +--------- Has a handler? + * | +----------- Masked? + * +----------------- <Reserved> */ typedef UINT32 ACPI_EVENT_STATUS; @@ -764,6 +765,7 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_STATUS_SET (ACPI_EVENT_STATUS) 0x04 #define ACPI_EVENT_FLAG_ENABLE_SET (ACPI_EVENT_STATUS) 0x08 #define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x10 +#define ACPI_EVENT_FLAG_MASKED (ACPI_EVENT_STATUS) 0x20 #define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ @@ -774,14 +776,15 @@ typedef UINT32 ACPI_EVENT_STATUS; /* * GPE info flags - Per GPE - * +-------+-+-+---+ - * | 7:5 |4|3|2:0| - * +-------+-+-+---+ - * | | | | - * | | | +-- Type of dispatch:to method, handler, notify, or none - * | | +----- Interrupt type: edge or level triggered - * | +------- Is a Wake GPE - * +------------ <Reserved> + * +---+-+-+-+---+ + * |7:6|5|4|3|2:0| + * +---+-+-+-+---+ + * | | | | | + * | | | | +-- Type of dispatch:to method, handler, notify, or none + * | | | +----- Interrupt type: edge or level triggered + * | | +------- Is a Wake GPE + * | +--------- Is GPE masked by the software GPE masking machanism + * +------------ <Reserved> */ #define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 @@ -1079,13 +1082,6 @@ typedef struct acpi_statistics } ACPI_STATISTICS; -/* Table Event Types */ - -#define ACPI_TABLE_EVENT_LOAD 0x0 -#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 - - /* * Types specific to the OS service interfaces */ @@ -1158,9 +1154,14 @@ ACPI_STATUS (*ACPI_TABLE_HANDLER) ( void *Table, void *Context); -#define ACPI_TABLE_LOAD 0x0 -#define ACPI_TABLE_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 + +/* Table Event Types */ + +#define ACPI_TABLE_EVENT_LOAD 0x0 +#define ACPI_TABLE_EVENT_UNLOAD 0x1 +#define ACPI_TABLE_EVENT_INSTALL 0x2 +#define ACPI_TABLE_EVENT_UNINSTALL 0x3 +#define ACPI_NUM_TABLE_EVENTS 4 /* Address Spaces (For Operation Regions) */ @@ -1387,16 +1388,6 @@ typedef enum #define ACPI_OSI_WIN_10 0x0D -/* Definitions of file IO */ - -#define ACPI_FILE_READING 0x01 -#define ACPI_FILE_WRITING 0x02 -#define ACPI_FILE_BINARY 0x04 - -#define ACPI_FILE_BEGIN 0x01 -#define ACPI_FILE_END 0x02 - - /* Definitions of getopt */ #define ACPI_OPT_END -1 diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index b92a39b27246..f4c358399229 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/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); @@ -1068,48 +1075,6 @@ AcpiAhMatchUuid ( /* - * utprint - printf/vprintf output functions - */ -const char * -AcpiUtScanNumber ( - const char *String, - UINT64 *NumberPtr); - -const char * -AcpiUtPrintNumber ( - char *String, - UINT64 Number); - -int -AcpiUtVsnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - va_list Args); - -int -AcpiUtSnprintf ( - char *String, - ACPI_SIZE Size, - const char *Format, - ...); - -#ifdef ACPI_APPLICATION -int -AcpiUtFileVprintf ( - ACPI_FILE File, - const char *Format, - va_list Args); - -int -AcpiUtFilePrintf ( - ACPI_FILE File, - const char *Format, - ...); -#endif - - -/* * utuuid -- UUID support functions */ #if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) diff --git a/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 591af132ab33..3580d09cbe87 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -79,6 +79,7 @@ (defined ACPI_EXAMPLE_APP) #define ACPI_APPLICATION #define ACPI_SINGLE_THREADED +#define USE_NATIVE_ALLOCATE_ZEROED #endif /* iASL configuration */ @@ -125,7 +126,6 @@ #ifdef ACPI_DUMP_APP #define ACPI_USE_NATIVE_MEMORY_MAPPING -#define USE_NATIVE_ALLOCATE_ZEROED #endif /* AcpiNames/Example configuration. Hardware disabled */ @@ -150,7 +150,6 @@ /* Common for all ACPICA applications */ #ifdef ACPI_APPLICATION -#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_LOCAL_CACHE #endif @@ -167,10 +166,21 @@ /****************************************************************************** * * Host configuration files. The compiler configuration files are included - * by the host files. + * first. * *****************************************************************************/ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#include <contrib/dev/acpica/include/platform/acgcc.h> + +#elif defined(_MSC_VER) +#include "acmsvc.h" + +#elif defined(__INTEL_COMPILER) +#include "acintel.h" + +#endif + #if defined(_LINUX) || defined(__linux__) #include "aclinux.h" @@ -210,18 +220,20 @@ #elif defined(__OS2__) #include "acos2.h" -#elif defined(_AED_EFI) -#include "acefi.h" - -#elif defined(_GNU_EFI) -#include "acefi.h" - #elif defined(__HAIKU__) #include "achaiku.h" #elif defined(__QNX__) #include "acqnx.h" +/* + * EFI applications can be built with -nostdlib, in this case, it must be + * included after including all other host environmental definitions, in + * order to override the definitions. + */ +#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI) +#include "acefi.h" + #else /* Unknown environment */ @@ -330,7 +342,8 @@ * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. * Otherwise, local versions of string/memory functions will be used. * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and - * the standard header files may be used. + * the standard header files may be used. Defining this implies that + * ACPI_USE_SYSTEM_CLIBRARY has been defined. * * The ACPICA subsystem only uses low level C library functions that do not * call operating system services and may therefore be inlined in the code. @@ -338,7 +351,6 @@ * It may be necessary to tailor these include files to the target * generation environment. */ -#ifdef ACPI_USE_SYSTEM_CLIBRARY /* Use the standard C library headers. We want to keep these to a minimum. */ @@ -346,57 +358,20 @@ /* Use the standard headers from the standard locations */ -#include <stdarg.h> #include <stdlib.h> #include <string.h> #include <ctype.h> +#ifdef ACPI_APPLICATION +#include <stdio.h> +#include <fcntl.h> +#include <errno.h> +#include <time.h> +#include <signal.h> +#endif #endif /* ACPI_USE_STANDARD_HEADERS */ -/* We will be linking to the standard Clib functions */ - -#else - -/****************************************************************************** - * - * Not using native C library, use local implementations - * - *****************************************************************************/ - -/* - * Use local definitions of C library macros and functions. These function - * implementations may not be as efficient as an inline or assembly code - * implementation provided by a native C library, but they are functionally - * equivalent. - */ -#ifndef va_arg - -#ifndef _VALIST -#define _VALIST -typedef char *va_list; -#endif /* _VALIST */ - -/* Storage alignment properties */ - -#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1) -#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1) - -/* Variable argument list macro definitions */ - -#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) -#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND)))) -#define va_end(ap) (ap = (va_list) NULL) -#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND)))) - -#endif /* va_arg */ - -/* Use the local (ACPICA) definitions of the clib functions */ - -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - -#ifndef ACPI_FILE #ifdef ACPI_APPLICATION -#include <stdio.h> #define ACPI_FILE FILE * #define ACPI_FILE_OUT stdout #define ACPI_FILE_ERR stderr @@ -405,6 +380,9 @@ typedef char *va_list; #define ACPI_FILE_OUT NULL #define ACPI_FILE_ERR NULL #endif /* ACPI_APPLICATION */ -#endif /* ACPI_FILE */ + +#ifndef ACPI_INIT_FUNCTION +#define ACPI_INIT_FUNCTION +#endif #endif /* __ACENV_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acenvex.h b/sys/contrib/dev/acpica/include/platform/acenvex.h index 02a46f148b33..d7da594b926e 100644 --- a/sys/contrib/dev/acpica/include/platform/acenvex.h +++ b/sys/contrib/dev/acpica/include/platform/acenvex.h @@ -56,17 +56,24 @@ #if defined(_LINUX) || defined(__linux__) #include "aclinuxex.h" -#elif defined(WIN32) -#include "acwinex.h" +#elif defined(__DragonFly__) +#include "acdragonflyex.h" -#elif defined(_AED_EFI) +/* + * EFI applications can be built with -nostdlib, in this case, it must be + * included after including all other host environmental definitions, in + * order to override the definitions. + */ +#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI) #include "acefiex.h" -#elif defined(_GNU_EFI) -#include "acefiex.h" +#endif -#elif defined(__DragonFly__) -#include "acdragonflyex.h" +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#include "acgccex.h" + +#elif defined(_MSC_VER) +#include "acmsvcex.h" #endif diff --git a/sys/contrib/dev/acpica/include/platform/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index e2f5556c81ea..928aaa64bd54 100644 --- a/sys/contrib/dev/acpica/include/platform/acfreebsd.h +++ b/sys/contrib/dev/acpica/include/platform/acfreebsd.h @@ -45,9 +45,6 @@ #define __ACFREEBSD_H__ -/* FreeBSD uses GCC */ - -#include <contrib/dev/acpica/include/platform/acgcc.h> #include <sys/types.h> #ifdef __LP64__ diff --git a/sys/contrib/dev/acpica/include/platform/acgcc.h b/sys/contrib/dev/acpica/include/platform/acgcc.h index 7d703da3dcfb..732de2aabffb 100644 --- a/sys/contrib/dev/acpica/include/platform/acgcc.h +++ b/sys/contrib/dev/acpica/include/platform/acgcc.h @@ -44,6 +44,14 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +#ifndef _KERNEL +/* + * Use compiler specific <stdarg.h> is a good practice for even when + * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined. + */ +#include <stdarg.h> +#endif + #define ACPI_INLINE __inline__ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ @@ -64,17 +72,6 @@ */ #define ACPI_UNUSED_VAR __attribute__ ((unused)) -/* - * Some versions of gcc implement strchr() with a buggy macro. So, - * undef it here. Prevents error messages of this form (usually from the - * file getopt.c): - * - * error: logical '&&' with non-zero constant will always evaluate as true - */ -#ifdef strchr -#undef strchr -#endif - /* GCC supports __VA_ARGS__ in macros */ #define COMPILER_VA_MACRO 1 diff --git a/sys/contrib/dev/acpica/include/platform/acgccex.h b/sys/contrib/dev/acpica/include/platform/acgccex.h new file mode 100644 index 000000000000..3c02ad50649f --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acgccex.h @@ -0,0 +1,58 @@ +/****************************************************************************** + * + * Name: acgccex.h - Extra GCC specific defines, etc. + * + *****************************************************************************/ + +/* + * 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. + */ + +#ifndef __ACGCCEX_H__ +#define __ACGCCEX_H__ + +/* + * Some versions of gcc implement strchr() with a buggy macro. So, + * undef it here. Prevents error messages of this form (usually from the + * file getopt.c): + * + * error: logical '&&' with non-zero constant will always evaluate as true + */ +#ifdef strchr +#undef strchr +#endif + +#endif /* __ACGCCEX_H__ */ diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c b/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c deleted file mode 100644 index 44a0ff90ddd1..000000000000 --- a/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c +++ /dev/null @@ -1,258 +0,0 @@ -/****************************************************************************** - * - * Module Name: oslibcfs - C library OSL for file I/O - * - *****************************************************************************/ - -/* - * 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 <contrib/dev/acpica/include/acpi.h> -#include <stdio.h> -#include <stdarg.h> - -#define _COMPONENT ACPI_OS_SERVICES - ACPI_MODULE_NAME ("oslibcfs") - - -/******************************************************************************* - * - * FUNCTION: AcpiOsOpenFile - * - * PARAMETERS: Path - File path - * Modes - File operation type - * - * RETURN: File descriptor. - * - * DESCRIPTION: Open a file for reading (ACPI_FILE_READING) or/and writing - * (ACPI_FILE_WRITING). - * - ******************************************************************************/ - -ACPI_FILE -AcpiOsOpenFile ( - const char *Path, - UINT8 Modes) -{ - ACPI_FILE File; - UINT32 i = 0; - char ModesStr[4]; - - - if (Modes & ACPI_FILE_READING) - { - ModesStr[i++] = 'r'; - } - if (Modes & ACPI_FILE_WRITING) - { - ModesStr[i++] = 'w'; - } - - if (Modes & ACPI_FILE_BINARY) - { - ModesStr[i++] = 'b'; - } - - ModesStr[i++] = '\0'; - - File = fopen (Path, ModesStr); - if (!File) - { - perror ("Could not open file"); - } - - return (File); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsCloseFile - * - * PARAMETERS: File - An open file descriptor - * - * RETURN: None. - * - * DESCRIPTION: Close a file opened via AcpiOsOpenFile. - * - ******************************************************************************/ - -void -AcpiOsCloseFile ( - ACPI_FILE File) -{ - - fclose (File); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsReadFile - * - * PARAMETERS: File - An open file descriptor - * Buffer - Data buffer - * Size - Data block size - * Count - Number of data blocks - * - * RETURN: Number of bytes actually read. - * - * DESCRIPTION: Read from a file. - * - ******************************************************************************/ - -int -AcpiOsReadFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count) -{ - int Length; - - - Length = fread (Buffer, Size, Count, File); - if (Length < 0) - { - perror ("Error reading file"); - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsWriteFile - * - * PARAMETERS: File - An open file descriptor - * Buffer - Data buffer - * Size - Data block size - * Count - Number of data blocks - * - * RETURN: Number of bytes actually written. - * - * DESCRIPTION: Write to a file. - * - ******************************************************************************/ - -int -AcpiOsWriteFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count) -{ - int Length; - - - Length = fwrite (Buffer, Size, Count, File); - if (Length < 0) - { - perror ("Error writing file"); - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsGetFileOffset - * - * PARAMETERS: File - An open file descriptor - * - * RETURN: Current file pointer position. - * - * DESCRIPTION: Get current file offset. - * - ******************************************************************************/ - -long -AcpiOsGetFileOffset ( - ACPI_FILE File) -{ - long Offset; - - - Offset = ftell (File); - return (Offset); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsSetFileOffset - * - * PARAMETERS: File - An open file descriptor - * Offset - New file offset - * From - From begin/end of file - * - * RETURN: Status - * - * DESCRIPTION: Set current file offset. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiOsSetFileOffset ( - ACPI_FILE File, - long Offset, - UINT8 From) -{ - int Ret = 0; - - - if (From == ACPI_FILE_BEGIN) - { - Ret = fseek (File, Offset, SEEK_SET); - } - - if (From == ACPI_FILE_END) - { - Ret = fseek (File, Offset, SEEK_END); - } - - if (Ret < 0) - { - return (AE_ERROR); - } - else - { - return (AE_OK); - } -} diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c index f169f8388f89..6d8855a9aec5 100644 --- a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c +++ b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c @@ -64,9 +64,6 @@ ACPI_MODULE_NAME ("osunixxf") -BOOLEAN AcpiGbl_DebugTimeout = FALSE; - - /* Upcalls to AcpiExec */ void @@ -757,8 +754,12 @@ AcpiOsCreateSemaphore ( #ifdef __APPLE__ { - char *SemaphoreName = tmpnam (NULL); + static int SemaphoreCount = 0; + char SemaphoreName[32]; + snprintf (SemaphoreName, sizeof (SemaphoreName), "acpi_sem_%d", + SemaphoreCount++); + printf ("%s\n", SemaphoreName); Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits); if (!Sem) { @@ -810,10 +811,17 @@ AcpiOsDeleteSemaphore ( return (AE_BAD_PARAMETER); } +#ifdef __APPLE__ + if (sem_close (Sem) == -1) + { + return (AE_BAD_PARAMETER); + } +#else if (sem_destroy (Sem) == -1) { return (AE_BAD_PARAMETER); } +#endif return (AE_OK); } diff --git a/sys/dev/acpica/Osd/OsdTable.c b/sys/dev/acpica/Osd/OsdTable.c index 006b2ce0268a..2ec94e395f0a 100644 --- a/sys/dev/acpica/Osd/OsdTable.c +++ b/sys/dev/acpica/Osd/OsdTable.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/linker.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> #undef _COMPONENT diff --git a/sys/x86/acpica/OsdEnvironment.c b/sys/x86/acpica/OsdEnvironment.c index ab8a7fbaacc0..61bd05b61756 100644 --- a/sys/x86/acpica/OsdEnvironment.c +++ b/sys/x86/acpica/OsdEnvironment.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> static u_long acpi_root_phys; diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index e884c867bf3f..959530c0d890 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <x86/vmware.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> #include <dev/acpica/acpivar.h> diff --git a/sys/x86/acpica/srat.c b/sys/x86/acpica/srat.c index 1d0f73d9282b..7eca75bafca9 100644 --- a/sys/x86/acpica/srat.c +++ b/sys/x86/acpica/srat.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_phys.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> #include <machine/intr_machdep.h> diff --git a/sys/x86/xen/pvcpu_enum.c b/sys/x86/xen/pvcpu_enum.c index 5b8b053a73d3..37404aa87944 100644 --- a/sys/x86/xen/pvcpu_enum.c +++ b/sys/x86/xen/pvcpu_enum.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <xen/interface/vcpu.h> #include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/aclocal.h> #include <contrib/dev/acpica/include/actables.h> #include <dev/acpica/acpivar.h> diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index 3f6cbb4557fd..2fa091f694aa 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -64,12 +64,12 @@ SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \ utcopy.c utdebug.c utdecode.c utdelete.c uterror.c \ uteval.c utexcep.c utglobal.c uthex.c utids.c utinit.c \ utlock.c utmath.c utmisc.c utmutex.c utnonansi.c \ - utobject.c utosi.c utownerid.c utpredef.c utprint.c \ - utresrc.c utstate.c utstring.c uttrack.c utuuid.c \ + utobject.c utosi.c utownerid.c utpredef.c utresrc.c \ + utstate.c utstring.c utstrtoul64.c uttrack.c utuuid.c \ utxface.c utxferror.c utxfinit.c # os_specific/service_layers -SRCS+= oslibcfs.c osunixxf.c +SRCS+= osunixxf.c MAN= acpidb.8 WARNS?= 3 diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile index 4217c967a181..59194c7dd36c 100644 --- a/usr.sbin/acpi/iasl/Makefile +++ b/usr.sbin/acpi/iasl/Makefile @@ -12,12 +12,12 @@ SRCS= acfileio.c adfile.c adisasm.c adwalk.c ahids.c \ SRCS+= aslanalyze.c aslascii.c aslbtypes.c aslcodegen.c \ aslcompile.c aslcompiler.y.h aslcompilerlex.c \ aslcompilerparse.c asldebug.c aslerror.c aslexternal.c \ - aslfileio.c aslfiles.c aslfold.c aslhex.c asllength.c \ - asllisting.c asllistsup.c aslload.c asllookup.c \ - aslmain.c aslmap.c aslmapenter.c aslmapoutput.c \ - aslmaputils.c aslmessages.c aslmethod.c aslnamesp.c \ - asloffset.c aslopcodes.c asloperands.c aslopt.c \ - asloptions.c aslpld.c aslpredef.c aslprepkg.c \ + aslfileio.c aslfiles.c aslfold.c aslhelp.c aslhex.c \ + asllength.c asllisting.c asllistsup.c aslload.c \ + asllookup.c aslmain.c aslmap.c aslmapenter.c \ + aslmapoutput.c aslmaputils.c aslmessages.c aslmethod.c \ + aslnamesp.c asloffset.c aslopcodes.c asloperands.c \ + aslopt.c asloptions.c aslpld.c aslpredef.c aslprepkg.c \ aslprintf.c aslprune.c aslresource.c aslrestype1.c \ aslrestype1i.c aslrestype2.c aslrestype2d.c \ aslrestype2e.c aslrestype2q.c aslrestype2s.c \ @@ -65,11 +65,11 @@ SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \ utcopy.c utdebug.c utdecode.c utdelete.c uterror.c \ utexcep.c utglobal.c uthex.c utinit.c utlock.c utmath.c \ utmisc.c utmutex.c utnonansi.c utobject.c utownerid.c \ - utpredef.c utprint.c utresrc.c utstate.c utstring.c \ + utpredef.c utresrc.c utstate.c utstring.c utstrtoul64.c \ utuuid.c utxface.c utxferror.c # os_specific/service_layers -SRCS+= oslibcfs.c osunixxf.c +SRCS+= osunixxf.c WARNS?= 2 @@ -85,8 +85,9 @@ CLEANFILES= aslcompiler.y aslcompiler.y.h aslcompilerlex.c \ prparser.y.h prparserlex.c prparserparse.c \ prparserparse.h -PARSER= aslcstyle.y aslparser.y aslresources.y aslrules.y \ - aslsupport.y asltokens.y asltypes.y +PARSER= aslcstyle.y aslhelpers.y aslkeywords.y aslparser.y \ + aslprimaries.y aslresources.y aslrules.y aslsupport.y \ + asltokens.y asltypes.y aslcompilerlex.c: aslcompiler.l aslsupport.l ${LEX} ${LFLAGS} -PAslCompiler -o${.TARGET} \ |