diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2016-08-01 21:20:41 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2016-08-01 21:20:41 +0000 |
commit | 8bc6ab62dbdb3e8b0d2253e0440f6f58ac9afd3d (patch) | |
tree | b2316b6fda5368bb277671853a71b2a758582b05 | |
parent | 4d46bb7749ef0cf25eb2b25f2d7324023cb754b4 (diff) |
Import ACPICA 20160729.vendor/acpica/20160729
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=303639
svn path=/vendor-sys/acpica/20160729/; revision=303640; tag=vendor/acpica/20160729
106 files changed, 3973 insertions, 5350 deletions
diff --git a/changes.txt b/changes.txt index ff863a7c3cb1..03c8d4f3688a 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,105 @@ ---------------------------------------- +29 July 2016. Summary of changes for version 20160729: + +This release is available at https://acpica.org/downloads + + +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: This release is available at https://acpica.org/downloads diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile index e856499a5da6..72094bd29809 100644 --- a/generate/unix/acpibin/Makefile +++ b/generate/unix/acpibin/Makefile @@ -43,11 +43,9 @@ OBJECTS = \ $(OBJDIR)/utmath.o\ $(OBJDIR)/utmisc.o\ $(OBJDIR)/utmutex.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ $(OBJDIR)/utxferror.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o # diff --git a/generate/unix/acpidump/Makefile b/generate/unix/acpidump/Makefile index d6e19644c65a..4aa98a345e24 100644 --- a/generate/unix/acpidump/Makefile +++ b/generate/unix/acpidump/Makefile @@ -33,7 +33,6 @@ OBJECTS = \ $(OBJDIR)/apmain.o\ $(OBJDIR)/cmfsize.o\ $(OBJDIR)/getopt.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixdir.o\ $(OBJDIR)/osunixmap.o\ $(OBJDIR)/osunixxf.o\ @@ -46,7 +45,6 @@ OBJECTS = \ $(OBJDIR)/utglobal.o\ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utstring.o\ $(OBJDIR)/utxferror.o diff --git a/generate/unix/acpiexamples/Makefile b/generate/unix/acpiexamples/Makefile index 54d74739ed68..d1e5ac2136da 100644 --- a/generate/unix/acpiexamples/Makefile +++ b/generate/unix/acpiexamples/Makefile @@ -107,7 +107,6 @@ OBJECTS = \ $(OBJDIR)/nsxfeval.o\ $(OBJDIR)/nsxfname.o\ $(OBJDIR)/nsxfobj.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/psargs.o\ $(OBJDIR)/psloop.o\ @@ -154,7 +153,6 @@ OBJECTS = \ $(OBJDIR)/utownerid.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utpredef.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 7f8befabb23a..ad53dbe7bfcd 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -163,7 +163,6 @@ OBJECTS = \ $(OBJDIR)/nsxfeval.o\ $(OBJDIR)/nsxfname.o\ $(OBJDIR)/nsxfobj.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/psargs.o\ $(OBJDIR)/psloop.o\ @@ -224,7 +223,6 @@ OBJECTS = \ $(OBJDIR)/utownerid.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utpredef.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index d50e416c8965..b0896755c2b2 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -32,13 +32,13 @@ OBJECTS = \ $(OBJDIR)/ahaslkey.o\ $(OBJDIR)/ahaslops.o\ $(OBJDIR)/ahdecode.o\ + $(OBJDIR)/ahgrammar.o\ $(OBJDIR)/ahids.o\ $(OBJDIR)/ahpredef.o\ $(OBJDIR)/ahmain.o\ $(OBJDIR)/ahtable.o\ $(OBJDIR)/ahuuids.o\ $(OBJDIR)/getopt.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utexcep.o\ @@ -47,7 +47,6 @@ OBJECTS = \ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utpredef.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utuuid.o # diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile index 4ff5558f06e8..fd263a01a7a9 100644 --- a/generate/unix/acpinames/Makefile +++ b/generate/unix/acpinames/Makefile @@ -72,7 +72,6 @@ OBJECTS = \ $(OBJDIR)/nsxfeval.o\ $(OBJDIR)/nsxfname.o\ $(OBJDIR)/nsxfobj.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/psargs.o\ $(OBJDIR)/psloop.o\ @@ -116,7 +115,6 @@ OBJECTS = \ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ $(OBJDIR)/utxface.o\ diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile index 93a9868cfab0..2a3282c8bc75 100644 --- a/generate/unix/acpisrc/Makefile +++ b/generate/unix/acpisrc/Makefile @@ -36,16 +36,14 @@ OBJECTS = \ $(OBJDIR)/asutils.o\ $(OBJDIR)/cmfsize.o\ $(OBJDIR)/getopt.o \ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixdir.o\ $(OBJDIR)/osunixxf.o\ - $(OBJDIR)/utascii.o\ + $(OBJDIR)/utascii.o\ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ $(OBJDIR)/utmath.o\ - $(OBJDIR)/utnonansi.o\ - $(OBJDIR)/utprint.o\ + $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utstring.o\ $(OBJDIR)/utxferror.o diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile index 272cbd091ea9..609451fd1677 100644 --- a/generate/unix/acpixtract/Makefile +++ b/generate/unix/acpixtract/Makefile @@ -31,7 +31,6 @@ OBJECTS = \ $(OBJDIR)/axmain.o\ $(OBJDIR)/axutils.o\ $(OBJDIR)/getopt.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/utascii.o\ $(OBJDIR)/utdebug.o\ @@ -39,7 +38,6 @@ OBJECTS = \ $(OBJDIR)/utglobal.o\ $(OBJDIR)/utmath.o\ $(OBJDIR)/utnonansi.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utxferror.o # diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 73682f801753..a231bd6b919e 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -177,7 +177,6 @@ OBJECTS = \ $(OBJDIR)/nswalk.o\ $(OBJDIR)/nsxfobj.o\ $(OBJDIR)/osunixxf.o\ - $(OBJDIR)/oslibcfs.o\ $(OBJDIR)/prexpress.o\ $(OBJDIR)/prmacros.o\ $(OBJDIR)/prscan.o\ @@ -221,7 +220,6 @@ OBJECTS = \ $(OBJDIR)/utobject.o\ $(OBJDIR)/utownerid.o\ $(OBJDIR)/utpredef.o\ - $(OBJDIR)/utprint.o\ $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ @@ -245,12 +243,14 @@ MISC = \ ASL_PARSER = \ $(ASL_COMPILER)/aslcstyle.y\ + $(ASL_COMPILER)/aslhelpers.y\ $(ASL_COMPILER)/aslparser.y\ + $(ASL_COMPILER)/aslprimaries.y\ $(ASL_COMPILER)/aslresources.y\ + $(ASL_COMPILER)/aslrules.y\ $(ASL_COMPILER)/aslsupport.y\ $(ASL_COMPILER)/asltokens.y\ - $(ASL_COMPILER)/asltypes.y\ - $(ASL_COMPILER)/aslrules.y + $(ASL_COMPILER)/asltypes.y ASL_LEXER = \ $(ASL_COMPILER)/aslcompiler.l\ @@ -277,7 +277,7 @@ include ../Makefile.rules safe_yacc = \ _d=`mktemp -d $(OBJDIR)/$(1).XXXXXX` &&\ cd $$_d &&\ - $(YACC) $(YFLAGS) -d -p$(1) $(abspath $(2)) &&\ + $(YACC) $(YFLAGS) -v -d -p$(1) $(abspath $(2)) &&\ cd - &&\ mv $$_d/y.tab$(suffix $(3)) $(3);\ _r=$$?;\ diff --git a/source/common/acfileio.c b/source/common/acfileio.c index 589eaea26314..c2ae8550dfa0 100644 --- a/source/common/acfileio.c +++ b/source/common/acfileio.c @@ -43,10 +43,9 @@ #include "acpi.h" #include "accommon.h" -#include "acapps.h" #include "actables.h" #include "acutils.h" -#include <errno.h> +#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); @@ -280,7 +279,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 +387,7 @@ AcValidateTableHeader ( long TableOffset) { ACPI_TABLE_HEADER TableHeader; - size_t Actual; + ACPI_SIZE Actual; long OriginalOffset; UINT32 FileSize; UINT32 i; diff --git a/source/common/acgetline.c b/source/common/acgetline.c index b08fb637d08d..45f9fe9bbe50 100644 --- a/source/common/acgetline.c +++ b/source/common/acgetline.c @@ -47,8 +47,6 @@ #include "acparser.h" #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/source/common/adisasm.c b/source/common/adisasm.c index bb83ab6f4c6b..e9b9292832dc 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -49,8 +49,6 @@ #include "acparser.h" #include "acapps.h" -#include <stdio.h> - #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("adisasm") diff --git a/source/common/ahtable.c b/source/common/ahtable.c index beb64c85ed54..67d1be06cc8c 100644 --- a/source/common/ahtable.c +++ b/source/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/source/common/cmfsize.c b/source/common/cmfsize.c index d9df6bc06cc4..5b55fcd43c90 100644 --- a/source/common/cmfsize.c +++ b/source/common/cmfsize.c @@ -44,7 +44,6 @@ #include "acpi.h" #include "accommon.h" #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/source/common/dmtable.c b/source/common/dmtable.c index 5ad46e9ff43a..18f68870adea 100644 --- a/source/common/dmtable.c +++ b/source/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/source/common/dmtables.c b/source/common/dmtables.c index 85abfe7e7f76..c45c4feb28cc 100644 --- a/source/common/dmtables.c +++ b/source/common/dmtables.c @@ -42,14 +42,12 @@ */ #include "aslcompiler.h" -#include "acapps.h" #include "acdispat.h" #include "acnamesp.h" #include "actables.h" #include "acparser.h" +#include "acapps.h" -#include <stdio.h> -#include <time.h> #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("dmtables") diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index 789256c12d3b..4ef670d0ce9c 100644 --- a/source/common/dmtbdump.c +++ b/source/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/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 2ae6594d25a3..e0a6070f06a8 100644 --- a/source/common/dmtbinfo.c +++ b/source/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/source/common/getopt.c b/source/common/getopt.c index f747e0d9a3f0..5c1de884111c 100644 --- a/source/common/getopt.c +++ b/source/common/getopt.c @@ -57,7 +57,7 @@ #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/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index b34686325f70..5e9a46b6c918 100644 --- a/source/compiler/aslcompiler.h +++ b/source/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> diff --git a/source/compiler/aslcstyle.y b/source/compiler/aslcstyle.y index 62a7b65f769f..fc7d5933df19 100644 --- a/source/compiler/aslcstyle.y +++ b/source/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/source/compiler/aslhelpers.y b/source/compiler/aslhelpers.y new file mode 100644 index 000000000000..f3a94de9c4cd --- /dev/null +++ b/source/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/source/compiler/aslkeywords.y b/source/compiler/aslkeywords.y new file mode 100644 index 000000000000..51af1c684a31 --- /dev/null +++ b/source/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/source/compiler/aslmain.c b/source/compiler/aslmain.c index 064e790a5905..423fb59b38ce 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -97,8 +97,6 @@ Usage ( 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"); @@ -123,7 +121,7 @@ Usage ( 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 ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); printf ("\nAML Code Generation (*.aml):\n"); @@ -136,21 +134,31 @@ Usage ( 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"); + 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"); diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index d19c3f3f64bd..85f5aef8dfc1 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -275,11 +275,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; diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index b3d83b8392a0..196422fe8b45 100644 --- a/source/compiler/aslparser.y +++ b/source/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/source/compiler/aslprimaries.y b/source/compiler/aslprimaries.y new file mode 100644 index 000000000000..742213ab623b --- /dev/null +++ b/source/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/source/compiler/aslresources.y b/source/compiler/aslresources.y index 074536bb0d77..92d58a9257d7 100644 --- a/source/compiler/aslresources.y +++ b/source/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/source/compiler/aslrules.y b/source/compiler/aslrules.y index a5d8387d7ee4..a7a41e2ed1b8 100644 --- a/source/compiler/aslrules.y +++ b/source/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 {} + /* | 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/source/compiler/asltokens.y b/source/compiler/asltokens.y index 429fa424cb9a..ff1dd42535c8 100644 --- a/source/compiler/asltokens.y +++ b/source/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/source/compiler/asltypes.y b/source/compiler/asltypes.y index 1faecb4587e9..1152a422d79f 100644 --- a/source/compiler/asltypes.y +++ b/source/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/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 8102e8203a50..87ebd9d547de 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -609,6 +609,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/source/compiler/dttable.c b/source/compiler/dttable.c index 7b33e4d2302e..c1011f823135 100644 --- a/source/compiler/dttable.c +++ b/source/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/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 23ef0517678c..b18ac31bc7b6 100644 --- a/source/compiler/dttemplate.h +++ b/source/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/source/compiler/dtutils.c b/source/compiler/dtutils.c index c9756da9c40d..4a280a80971f 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -367,6 +367,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 +617,11 @@ DtGetFieldLength ( ByteLength = 10; break; + case ACPI_DMT_BUF12: + + ByteLength = 12; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index e90a138e5c88..6e97689c0ff1 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -46,15 +46,15 @@ #include "accommon.h" #include "acdebug.h" #include "actables.h" -#include <stdio.h> -#ifdef ACPI_APPLICATION -#include "acapps.h" -#endif #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbfileio") +#ifdef ACPI_APPLICATION +#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/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 51eb49b42acf..ba49633701d4 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -516,17 +516,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; diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 5fc07b76e0fb..85b9c3e4c561 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -273,7 +273,7 @@ AcpiTbGetRootTableEntry ( * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress) { diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 8c0caaee75e6..4c8c065cf373 100644 --- a/source/components/tables/tbxface.c +++ b/source/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/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 645b9d57acdd..9fc26bdad1be 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -65,7 +65,7 @@ * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void) { @@ -300,7 +300,7 @@ UnlockAndExit: * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable ( ACPI_PHYSICAL_ADDRESS Address, BOOLEAN Physical) diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index aaa24c470f65..2c7bce78763f 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/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/source/components/utilities/utbuffer.c b/source/components/utilities/utbuffer.c index 863055f7375d..19c670796929 100644 --- a/source/components/utilities/utbuffer.c +++ b/source/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/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index 6a298d175b34..10785399d7d5 100644 --- a/source/components/utilities/utdebug.c +++ b/source/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/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 03c3e510b82d..c3da33d06cbb 100644 --- a/source/components/utilities/utinit.c +++ b/source/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/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index 0f6658ecf7f8..ced72a7331a3 100644 --- a/source/components/utilities/utpredef.c +++ b/source/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/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index e01f1734a94f..7d4c48939aeb 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -416,7 +416,7 @@ AcpiUtFormatNumber ( /******************************************************************************* * - * FUNCTION: AcpiUtVsnprintf + * FUNCTION: vsnprintf * * PARAMETERS: String - String with boundary * Size - Boundary of the string @@ -430,7 +430,7 @@ AcpiUtFormatNumber ( ******************************************************************************/ int -AcpiUtVsnprintf ( +vsnprintf ( char *String, ACPI_SIZE Size, const char *Format, @@ -713,7 +713,7 @@ AcpiUtVsnprintf ( /******************************************************************************* * - * FUNCTION: AcpiUtSnprintf + * FUNCTION: snprintf * * PARAMETERS: String - String with boundary * Size - Boundary of the string @@ -726,7 +726,7 @@ AcpiUtVsnprintf ( ******************************************************************************/ int -AcpiUtSnprintf ( +snprintf ( char *String, ACPI_SIZE Size, const char *Format, @@ -737,7 +737,38 @@ AcpiUtSnprintf ( va_start (Args, Format); - Length = AcpiUtVsnprintf (String, Size, Format, Args); + Length = vsnprintf (String, Size, Format, Args); + va_end (Args); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: sprintf + * + * PARAMETERS: String - String with boundary + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string. + * + ******************************************************************************/ + +int +sprintf ( + char *String, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args); va_end (Args); return (Length); @@ -747,7 +778,69 @@ AcpiUtSnprintf ( #ifdef ACPI_APPLICATION /******************************************************************************* * - * FUNCTION: AcpiUtFileVprintf + * FUNCTION: vprintf + * + * PARAMETERS: Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to stdout using argument list pointer. + * + ******************************************************************************/ + +int +vprintf ( + const char *Format, + va_list Args) +{ + ACPI_CPU_FLAGS Flags; + int Length; + + + Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); + Length = vsnprintf (AcpiGbl_PrintBuffer, + sizeof (AcpiGbl_PrintBuffer), Format, Args); + + (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, ACPI_FILE_OUT); + AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: printf + * + * PARAMETERS: Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to stdout. + * + ******************************************************************************/ + +int +printf ( + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = vprintf (Format, Args); + va_end (Args); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: vfprintf * * PARAMETERS: File - File descriptor * Format - Standard printf format @@ -760,8 +853,8 @@ AcpiUtSnprintf ( ******************************************************************************/ int -AcpiUtFileVprintf ( - ACPI_FILE File, +vfprintf ( + FILE *File, const char *Format, va_list Args) { @@ -770,10 +863,10 @@ AcpiUtFileVprintf ( Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, + Length = vsnprintf (AcpiGbl_PrintBuffer, sizeof (AcpiGbl_PrintBuffer), Format, Args); - (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); + (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, File); AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); return (Length); @@ -782,7 +875,7 @@ AcpiUtFileVprintf ( /******************************************************************************* * - * FUNCTION: AcpiUtFilePrintf + * FUNCTION: fprintf * * PARAMETERS: File - File descriptor * Format, ... - Standard printf format @@ -794,8 +887,8 @@ AcpiUtFileVprintf ( ******************************************************************************/ int -AcpiUtFilePrintf ( - ACPI_FILE File, +fprintf ( + FILE *File, const char *Format, ...) { @@ -804,7 +897,7 @@ AcpiUtFilePrintf ( va_start (Args, Format); - Length = AcpiUtFileVprintf (File, Format, Args); + Length = vfprintf (File, Format, Args); va_end (Args); return (Length); diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 9efa9d6ec75d..2902e2c8b6fa 100644 --- a/source/components/utilities/uttrack.c +++ b/source/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/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index a8452c32955b..ff91886466a3 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -63,7 +63,7 @@ * ******************************************************************************/ -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTerminate ( void) { diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 2a518bc82d99..7d7758815869 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/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) { diff --git a/source/include/acapps.h b/source/include/acapps.h index 87284f20b0da..d14bce1ff03f 100644 --- a/source/include/acapps.h +++ b/source/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/source/include/acclib.h b/source/include/acclib.h index 56a30723ae35..0b104b6126e2 100644 --- a/source/include/acclib.h +++ b/source/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/source/include/acconfig.h b/source/include/acconfig.h index a626f87591eb..fb9727138ec5 100644 --- a/source/include/acconfig.h +++ b/source/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 0xFFFF + /****************************************************************************** * diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 545622d4ec54..d60be8fd0b4e 100644 --- a/source/include/acdisasm.h +++ b/source/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/source/include/acglobal.h b/source/include/acglobal.h index a883ac492116..fc7a7a213fd7 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -392,6 +392,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/source/include/acpiosxf.h b/source/include/acpiosxf.h index eb61d9a8ce4e..788e06644d13 100644 --- a/source/include/acpiosxf.h +++ b/source/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/source/include/acpixf.h b/source/include/acpixf.h index 10eeb1104143..33f000fee2fd 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160527 +#define ACPI_CA_VERSION 0x20160729 #include "acconfig.h" #include "actypes.h" @@ -420,29 +420,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 +520,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 +536,7 @@ AcpiUnloadParentTable ( ACPI_HANDLE Object)) ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void)) @@ -545,12 +545,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)) @@ -1232,13 +1232,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/source/include/actables.h b/source/include/actables.h index e1a4a6eb63a4..6abb14cc3ff4 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -242,7 +242,7 @@ AcpiTbInstallFixedTable ( char *Signature, UINT32 *TableIndex); -ACPI_STATUS +ACPI_STATUS ACPI_INIT_FUNCTION AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); diff --git a/source/include/actbl.h b/source/include/actbl.h index faeb744962eb..b5c76c9c1b0c 100644 --- a/source/include/actbl.h +++ b/source/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/source/include/actypes.h b/source/include/actypes.h index 395b91538381..3861f12d5ba0 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -1387,16 +1387,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/source/include/acutils.h b/source/include/acutils.h index 7e53961e5b55..f83996a41268 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -1068,48 +1068,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_EXEC_APP || defined ACPI_HELP_APP) diff --git a/source/include/platform/accygwin.h b/source/include/platform/accygwin.h index 518fc27d6bd7..be2219210179 100644 --- a/source/include/platform/accygwin.h +++ b/source/include/platform/accygwin.h @@ -47,6 +47,7 @@ /* * ACPICA configuration */ +#define ACPI_USE_STANDARD_HEADERS #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_DO_WHILE_0 #define ACPI_FLUSH_CPU_CACHE() @@ -58,11 +59,9 @@ #define ACPI_USE_ALTERNATE_TIMEOUT -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> +#ifdef ACPI_USE_STANDARD_HEADERS #include <unistd.h> +#endif #if defined(__ia64__) || defined(__x86_64__) #define ACPI_MACHINE_WIDTH 64 @@ -86,10 +85,6 @@ #define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread)) -/* Cygwin uses GCC */ - -#include "acgcc.h" - /* * The vsnprintf/snprintf functions are defined by c99, but cygwin/gcc diff --git a/source/include/platform/acdragonfly.h b/source/include/platform/acdragonfly.h index 73a1867f75db..90b9438e0b9a 100644 --- a/source/include/platform/acdragonfly.h +++ b/source/include/platform/acdragonfly.h @@ -44,7 +44,6 @@ #ifndef __ACDRAGONFLY_H_ #define __ACDRAGONFLY_H_ -#include <platform/acgcc.h> /* DragonFly uses GCC */ #include <sys/types.h> #ifdef __LP64__ diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index 1a9e7c402fcc..56c4b0aaa19e 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -44,10 +44,12 @@ #ifndef __ACEFI_H__ #define __ACEFI_H__ -#include <stdarg.h> -#if defined(_GNU_EFI) -#include <stdint.h> -#include <unistd.h> +/* EDK2 EFI environemnt */ + +#if defined(_EDK2_EFI) + +#define _GNU_EFI + #endif #if defined(__x86_64__) @@ -57,23 +59,13 @@ #endif #ifdef _MSC_EXTENSIONS -#define EFIAPI __cdecl +#define ACPI_EFI_API __cdecl #elif USE_MS_ABI -#define EFIAPI __attribute__((ms_abi)) +#define ACPI_EFI_API __attribute__((ms_abi)) #else -#define EFIAPI +#define ACPI_EFI_API #endif -typedef uint8_t UINT8; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint64_t UINT64; -typedef int64_t INT64; -typedef uint8_t BOOLEAN; -typedef uint16_t CHAR16; - #define VOID void #if defined(__ia64__) || defined(__x86_64__) @@ -94,23 +86,23 @@ typedef uint16_t CHAR16; #endif -typedef uint64_t UINTN; -typedef int64_t INTN; +#define UINTN uint64_t +#define INTN int64_t -#define EFIERR(a) (0x8000000000000000 | a) +#define ACPI_EFI_ERR(a) (0x8000000000000000 | a) #else #define ACPI_MACHINE_WIDTH 32 -#define ACPI_USE_NATIVE_DIVIDE -typedef uint32_t UINTN; -typedef int32_t INTN; +#define UINTN uint32_t +#define INTN int32_t -#define EFIERR(a) (0x80000000 | a) +#define ACPI_EFI_ERR(a) (0x80000000 | a) #endif +#define CHAR16 uint16_t #ifdef USE_EFI_FUNCTION_WRAPPER #define __VA_NARG__(...) \ @@ -230,15 +222,6 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, #if defined(_GNU_EFI) -/* Using GCC for GNU EFI */ - -#include "acgcc.h" - -#undef ACPI_USE_SYSTEM_CLIBRARY -#undef ACPI_USE_STANDARD_HEADERS -#undef ACPI_USE_NATIVE_DIVIDE -#define ACPI_USE_SYSTEM_INTTYPES - /* * Math helpers */ @@ -255,21 +238,20 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, (n_hi) >>= 1; \ } while (0) - #endif -struct _SIMPLE_TEXT_OUTPUT_INTERFACE; -struct _SIMPLE_INPUT_INTERFACE; -struct _EFI_FILE_IO_INTERFACE; -struct _EFI_FILE_HANDLE; -struct _EFI_BOOT_SERVICES; -struct _EFI_SYSTEM_TABLE; +struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE; +struct _ACPI_SIMPLE_INPUT_INTERFACE; +struct _ACPI_EFI_FILE_IO_INTERFACE; +struct _ACPI_EFI_FILE_HANDLE; +struct _ACPI_EFI_BOOT_SERVICES; +struct _ACPI_EFI_SYSTEM_TABLE; -extern struct _EFI_SYSTEM_TABLE *ST; -extern struct _EFI_BOOT_SERVICES *BS; +extern struct _ACPI_EFI_SYSTEM_TABLE *ST; +extern struct _ACPI_EFI_BOOT_SERVICES *BS; -#define ACPI_FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE * -#define ACPI_FILE_OUT ST->ConOut -#define ACPI_FILE_ERR ST->ConOut +#define FILE struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE +#define stdout ST->ConOut +#define stderr ST->ConOut #endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h index 7df5012806da..8f98a6266dee 100644 --- a/source/include/platform/acefiex.h +++ b/source/include/platform/acefiex.h @@ -45,177 +45,190 @@ #define __ACEFIEX_H__ -#define EFI_ERROR(a) (((INTN) a) < 0) -#define EFI_SUCCESS 0 -#define EFI_LOAD_ERROR EFIERR(1) -#define EFI_INVALID_PARAMETER EFIERR(2) -#define EFI_UNSUPPORTED EFIERR(3) -#define EFI_BAD_BUFFER_SIZE EFIERR(4) -#define EFI_BUFFER_TOO_SMALL EFIERR(5) -#define EFI_NOT_READY EFIERR(6) -#define EFI_DEVICE_ERROR EFIERR(7) -#define EFI_WRITE_PROTECTED EFIERR(8) -#define EFI_OUT_OF_RESOURCES EFIERR(9) -#define EFI_VOLUME_CORRUPTED EFIERR(10) -#define EFI_VOLUME_FULL EFIERR(11) -#define EFI_NO_MEDIA EFIERR(12) -#define EFI_MEDIA_CHANGED EFIERR(13) -#define EFI_NOT_FOUND EFIERR(14) -#define EFI_ACCESS_DENIED EFIERR(15) -#define EFI_NO_RESPONSE EFIERR(16) -#define EFI_NO_MAPPING EFIERR(17) -#define EFI_TIMEOUT EFIERR(18) -#define EFI_NOT_STARTED EFIERR(19) -#define EFI_ALREADY_STARTED EFIERR(20) -#define EFI_ABORTED EFIERR(21) -#define EFI_PROTOCOL_ERROR EFIERR(24) - - -typedef UINTN EFI_STATUS; -typedef VOID *EFI_HANDLE; -typedef VOID *EFI_EVENT; +#ifndef ACPI_USE_SYSTEM_CLIBRARY + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef COMPILER_DEPENDENT_INT64 int64_t; +typedef COMPILER_DEPENDENT_UINT64 uint64_t; + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ + +#define ACPI_EFI_ERROR(a) (((INTN) a) < 0) +#define ACPI_EFI_SUCCESS 0 +#define ACPI_EFI_LOAD_ERROR ACPI_EFI_ERR(1) +#define ACPI_EFI_INVALID_PARAMETER ACPI_EFI_ERR(2) +#define ACPI_EFI_UNSUPPORTED ACPI_EFI_ERR(3) +#define ACPI_EFI_BAD_BUFFER_SIZE ACPI_EFI_ERR(4) +#define ACPI_EFI_BUFFER_TOO_SMALL ACPI_EFI_ERR(5) +#define ACPI_EFI_NOT_READY ACPI_EFI_ERR(6) +#define ACPI_EFI_DEVICE_ERROR ACPI_EFI_ERR(7) +#define ACPI_EFI_WRITE_PROTECTED ACPI_EFI_ERR(8) +#define ACPI_EFI_OUT_OF_RESOURCES ACPI_EFI_ERR(9) +#define ACPI_EFI_VOLUME_CORRUPTED ACPI_EFI_ERR(10) +#define ACPI_EFI_VOLUME_FULL ACPI_EFI_ERR(11) +#define ACPI_EFI_NO_MEDIA ACPI_EFI_ERR(12) +#define ACPI_EFI_MEDIA_CHANGED ACPI_EFI_ERR(13) +#define ACPI_EFI_NOT_FOUND ACPI_EFI_ERR(14) +#define ACPI_EFI_ACCESS_DENIED ACPI_EFI_ERR(15) +#define ACPI_EFI_NO_RESPONSE ACPI_EFI_ERR(16) +#define ACPI_EFI_NO_MAPPING ACPI_EFI_ERR(17) +#define ACPI_EFI_TIMEOUT ACPI_EFI_ERR(18) +#define ACPI_EFI_NOT_STARTED ACPI_EFI_ERR(19) +#define ACPI_EFI_ALREADY_STARTED ACPI_EFI_ERR(20) +#define ACPI_EFI_ABORTED ACPI_EFI_ERR(21) +#define ACPI_EFI_PROTOCOL_ERROR ACPI_EFI_ERR(24) + + +typedef UINTN ACPI_EFI_STATUS; +typedef VOID *ACPI_EFI_HANDLE; +typedef VOID *ACPI_EFI_EVENT; typedef struct { UINT32 Data1; UINT16 Data2; UINT16 Data3; UINT8 Data4[8]; -} EFI_GUID; +} ACPI_EFI_GUID; -typedef struct _EFI_DEVICE_PATH { +typedef struct _ACPI_EFI_DEVICE_PATH { UINT8 Type; UINT8 SubType; UINT8 Length[2]; -} EFI_DEVICE_PATH; +} ACPI_EFI_DEVICE_PATH; -typedef UINT64 EFI_PHYSICAL_ADDRESS; -typedef UINT64 EFI_VIRTUAL_ADDRESS; +typedef UINT64 ACPI_EFI_PHYSICAL_ADDRESS; +typedef UINT64 ACPI_EFI_VIRTUAL_ADDRESS; typedef enum { - AllocateAnyPages, - AllocateMaxAddress, - AllocateAddress, - MaxAllocateType -} EFI_ALLOCATE_TYPE; + AcpiEfiAllocateAnyPages, + AcpiEfiAllocateMaxAddress, + AcpiEfiAllocateAddress, + AcpiEfiMaxAllocateType +} ACPI_EFI_ALLOCATE_TYPE; typedef enum { - EfiReservedMemoryType, - EfiLoaderCode, - EfiLoaderData, - EfiBootServicesCode, - EfiBootServicesData, - EfiRuntimeServicesCode, - EfiRuntimeServicesData, - EfiConventionalMemory, - EfiUnusableMemory, - EfiACPIReclaimMemory, - EfiACPIMemoryNVS, - EfiMemoryMappedIO, - EfiMemoryMappedIOPortSpace, - EfiPalCode, - EfiMaxMemoryType -} EFI_MEMORY_TYPE; + AcpiEfiReservedMemoryType, + AcpiEfiLoaderCode, + AcpiEfiLoaderData, + AcpiEfiBootServicesCode, + AcpiEfiBootServicesData, + AcpiEfiRuntimeServicesCode, + AcpiEfiRuntimeServicesData, + AcpiEfiConventionalMemory, + AcpiEfiUnusableMemory, + AcpiEfiACPIReclaimMemory, + AcpiEfiACPIMemoryNVS, + AcpiEfiMemoryMappedIO, + AcpiEfiMemoryMappedIOPortSpace, + AcpiEfiPalCode, + AcpiEfiMaxMemoryType +} ACPI_EFI_MEMORY_TYPE; /* possible caching types for the memory range */ -#define EFI_MEMORY_UC 0x0000000000000001 -#define EFI_MEMORY_WC 0x0000000000000002 -#define EFI_MEMORY_WT 0x0000000000000004 -#define EFI_MEMORY_WB 0x0000000000000008 -#define EFI_MEMORY_UCE 0x0000000000000010 +#define ACPI_EFI_MEMORY_UC 0x0000000000000001 +#define ACPI_EFI_MEMORY_WC 0x0000000000000002 +#define ACPI_EFI_MEMORY_WT 0x0000000000000004 +#define ACPI_EFI_MEMORY_WB 0x0000000000000008 +#define ACPI_EFI_MEMORY_UCE 0x0000000000000010 /* physical memory protection on range */ -#define EFI_MEMORY_WP 0x0000000000001000 -#define EFI_MEMORY_RP 0x0000000000002000 -#define EFI_MEMORY_XP 0x0000000000004000 +#define ACPI_EFI_MEMORY_WP 0x0000000000001000 +#define ACPI_EFI_MEMORY_RP 0x0000000000002000 +#define ACPI_EFI_MEMORY_XP 0x0000000000004000 /* range requires a runtime mapping */ -#define EFI_MEMORY_RUNTIME 0x8000000000000000 +#define ACPI_EFI_MEMORY_RUNTIME 0x8000000000000000 -#define EFI_MEMORY_DESCRIPTOR_VERSION 1 +#define ACPI_EFI_MEMORY_DESCRIPTOR_VERSION 1 typedef struct { UINT32 Type; UINT32 Pad; - EFI_PHYSICAL_ADDRESS PhysicalStart; - EFI_VIRTUAL_ADDRESS VirtualStart; + ACPI_EFI_PHYSICAL_ADDRESS PhysicalStart; + ACPI_EFI_VIRTUAL_ADDRESS VirtualStart; UINT64 NumberOfPages; UINT64 Attribute; -} EFI_MEMORY_DESCRIPTOR; +} ACPI_EFI_MEMORY_DESCRIPTOR; -typedef struct _EFI_TABLE_HEARDER { +typedef struct _ACPI_EFI_TABLE_HEARDER { UINT64 Signature; UINT32 Revision; UINT32 HeaderSize; UINT32 CRC32; UINT32 Reserved; -} EFI_TABLE_HEADER; +} ACPI_EFI_TABLE_HEADER; typedef -EFI_STATUS -(EFIAPI *EFI_UNKNOWN_INTERFACE) ( +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_UNKNOWN_INTERFACE) ( void); /* * Text output protocol */ -#define SIMPLE_TEXT_OUTPUT_PROTOCOL \ +#define ACPI_SIMPLE_TEXT_OUTPUT_PROTOCOL \ { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_RESET) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - BOOLEAN ExtendedVerification); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_RESET) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN ExtendedVerification); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_OUTPUT_STRING) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - CHAR16 *String); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_OUTPUT_STRING) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_TEST_STRING) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - CHAR16 *String); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_TEST_STRING) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_QUERY_MODE) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - UINTN ModeNumber, - UINTN *Columns, - UINTN *Rows); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_QUERY_MODE) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber, + UINTN *Columns, + UINTN *Rows); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_MODE) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - UINTN ModeNumber); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_SET_MODE) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - UINTN Attribute); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_SET_ATTRIBUTE) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Attribute); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_CLEAR_SCREEN) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - UINTN Column, - UINTN Row); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_SET_CURSOR_POSITION) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Column, + UINTN Row); typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( - struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - BOOLEAN Enable); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_TEXT_ENABLE_CURSOR) ( + struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN Enable); typedef struct { INT32 MaxMode; @@ -224,35 +237,35 @@ typedef struct { INT32 CursorColumn; INT32 CursorRow; BOOLEAN CursorVisible; -} SIMPLE_TEXT_OUTPUT_MODE; +} ACPI_SIMPLE_TEXT_OUTPUT_MODE; -typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { - EFI_TEXT_RESET Reset; +typedef struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE { + ACPI_EFI_TEXT_RESET Reset; - EFI_TEXT_OUTPUT_STRING OutputString; - EFI_TEXT_TEST_STRING TestString; + ACPI_EFI_TEXT_OUTPUT_STRING OutputString; + ACPI_EFI_TEXT_TEST_STRING TestString; - EFI_TEXT_QUERY_MODE QueryMode; - EFI_TEXT_SET_MODE SetMode; - EFI_TEXT_SET_ATTRIBUTE SetAttribute; + ACPI_EFI_TEXT_QUERY_MODE QueryMode; + ACPI_EFI_TEXT_SET_MODE SetMode; + ACPI_EFI_TEXT_SET_ATTRIBUTE SetAttribute; - EFI_TEXT_CLEAR_SCREEN ClearScreen; - EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; - EFI_TEXT_ENABLE_CURSOR EnableCursor; + ACPI_EFI_TEXT_CLEAR_SCREEN ClearScreen; + ACPI_EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; + ACPI_EFI_TEXT_ENABLE_CURSOR EnableCursor; - SIMPLE_TEXT_OUTPUT_MODE *Mode; -} SIMPLE_TEXT_OUTPUT_INTERFACE; + ACPI_SIMPLE_TEXT_OUTPUT_MODE *Mode; +} ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE; /* * Text input protocol */ -#define SIMPLE_TEXT_INPUT_PROTOCOL \ +#define ACPI_SIMPLE_TEXT_INPUT_PROTOCOL \ { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } typedef struct { UINT16 ScanCode; CHAR16 UnicodeChar; -} EFI_INPUT_KEY; +} ACPI_EFI_INPUT_KEY; /* * Baseline unicode control chars @@ -264,243 +277,243 @@ typedef struct { #define CHAR_CARRIAGE_RETURN 0x000D typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_RESET) ( - struct _SIMPLE_INPUT_INTERFACE *This, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_INPUT_RESET) ( + struct _ACPI_SIMPLE_INPUT_INTERFACE *This, BOOLEAN ExtendedVerification); typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_READ_KEY) ( - struct _SIMPLE_INPUT_INTERFACE *This, - EFI_INPUT_KEY *Key); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_INPUT_READ_KEY) ( + struct _ACPI_SIMPLE_INPUT_INTERFACE *This, + ACPI_EFI_INPUT_KEY *Key); -typedef struct _SIMPLE_INPUT_INTERFACE { - EFI_INPUT_RESET Reset; - EFI_INPUT_READ_KEY ReadKeyStroke; - EFI_EVENT WaitForKey; -} SIMPLE_INPUT_INTERFACE; +typedef struct _ACPI_SIMPLE_INPUT_INTERFACE { + ACPI_EFI_INPUT_RESET Reset; + ACPI_EFI_INPUT_READ_KEY ReadKeyStroke; + ACPI_EFI_EVENT WaitForKey; +} ACPI_SIMPLE_INPUT_INTERFACE; /* * Simple file system protocol */ -#define SIMPLE_FILE_SYSTEM_PROTOCOL \ +#define ACPI_SIMPLE_FILE_SYSTEM_PROTOCOL \ { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } typedef -EFI_STATUS -(EFIAPI *EFI_VOLUME_OPEN) ( - struct _EFI_FILE_IO_INTERFACE *This, - struct _EFI_FILE_HANDLE **Root); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_VOLUME_OPEN) ( + struct _ACPI_EFI_FILE_IO_INTERFACE *This, + struct _ACPI_EFI_FILE_HANDLE **Root); -#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 +#define ACPI_EFI_FILE_IO_INTERFACE_REVISION 0x00010000 -typedef struct _EFI_FILE_IO_INTERFACE { +typedef struct _ACPI_EFI_FILE_IO_INTERFACE { UINT64 Revision; - EFI_VOLUME_OPEN OpenVolume; -} EFI_FILE_IO_INTERFACE; + ACPI_EFI_VOLUME_OPEN OpenVolume; +} ACPI_EFI_FILE_IO_INTERFACE; typedef -EFI_STATUS -(EFIAPI *EFI_FILE_OPEN) ( - struct _EFI_FILE_HANDLE *File, - struct _EFI_FILE_HANDLE **NewHandle, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_OPEN) ( + struct _ACPI_EFI_FILE_HANDLE *File, + struct _ACPI_EFI_FILE_HANDLE **NewHandle, CHAR16 *FileName, UINT64 OpenMode, UINT64 Attributes); /* Values for OpenMode used above */ -#define EFI_FILE_MODE_READ 0x0000000000000001 -#define EFI_FILE_MODE_WRITE 0x0000000000000002 -#define EFI_FILE_MODE_CREATE 0x8000000000000000 +#define ACPI_EFI_FILE_MODE_READ 0x0000000000000001 +#define ACPI_EFI_FILE_MODE_WRITE 0x0000000000000002 +#define ACPI_EFI_FILE_MODE_CREATE 0x8000000000000000 /* Values for Attribute used above */ -#define EFI_FILE_READ_ONLY 0x0000000000000001 -#define EFI_FILE_HIDDEN 0x0000000000000002 -#define EFI_FILE_SYSTEM 0x0000000000000004 -#define EFI_FILE_RESERVIED 0x0000000000000008 -#define EFI_FILE_DIRECTORY 0x0000000000000010 -#define EFI_FILE_ARCHIVE 0x0000000000000020 -#define EFI_FILE_VALID_ATTR 0x0000000000000037 +#define ACPI_EFI_FILE_READ_ONLY 0x0000000000000001 +#define ACPI_EFI_FILE_HIDDEN 0x0000000000000002 +#define ACPI_EFI_FILE_SYSTEM 0x0000000000000004 +#define ACPI_EFI_FILE_RESERVIED 0x0000000000000008 +#define ACPI_EFI_FILE_DIRECTORY 0x0000000000000010 +#define ACPI_EFI_FILE_ARCHIVE 0x0000000000000020 +#define ACPI_EFI_FILE_VALID_ATTR 0x0000000000000037 typedef -EFI_STATUS -(EFIAPI *EFI_FILE_CLOSE) ( - struct _EFI_FILE_HANDLE *File); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_CLOSE) ( + struct _ACPI_EFI_FILE_HANDLE *File); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_DELETE) ( - struct _EFI_FILE_HANDLE *File); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_DELETE) ( + struct _ACPI_EFI_FILE_HANDLE *File); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_READ) ( - struct _EFI_FILE_HANDLE *File, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_READ) ( + struct _ACPI_EFI_FILE_HANDLE *File, UINTN *BufferSize, VOID *Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_WRITE) ( - struct _EFI_FILE_HANDLE *File, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_WRITE) ( + struct _ACPI_EFI_FILE_HANDLE *File, UINTN *BufferSize, VOID *Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_POSITION) ( - struct _EFI_FILE_HANDLE *File, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_SET_POSITION) ( + struct _ACPI_EFI_FILE_HANDLE *File, UINT64 Position); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_POSITION) ( - struct _EFI_FILE_HANDLE *File, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_GET_POSITION) ( + struct _ACPI_EFI_FILE_HANDLE *File, UINT64 *Position); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_INFO) ( - struct _EFI_FILE_HANDLE *File, - EFI_GUID *InformationType, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) ( + struct _ACPI_EFI_FILE_HANDLE *File, + ACPI_EFI_GUID *InformationType, UINTN *BufferSize, VOID *Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_INFO) ( - struct _EFI_FILE_HANDLE *File, - EFI_GUID *InformationType, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_SET_INFO) ( + struct _ACPI_EFI_FILE_HANDLE *File, + ACPI_EFI_GUID *InformationType, UINTN BufferSize, VOID *Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_FILE_FLUSH) ( - struct _EFI_FILE_HANDLE *File); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FILE_FLUSH) ( + struct _ACPI_EFI_FILE_HANDLE *File); -#define EFI_FILE_HANDLE_REVISION 0x00010000 +#define ACPI_EFI_FILE_HANDLE_REVISION 0x00010000 -typedef struct _EFI_FILE_HANDLE { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; -} EFI_FILE, *EFI_FILE_HANDLE; +typedef struct _ACPI_EFI_FILE_HANDLE { + UINT64 Revision; + ACPI_EFI_FILE_OPEN Open; + ACPI_EFI_FILE_CLOSE Close; + ACPI_EFI_FILE_DELETE Delete; + ACPI_EFI_FILE_READ Read; + ACPI_EFI_FILE_WRITE Write; + ACPI_EFI_FILE_GET_POSITION GetPosition; + ACPI_EFI_FILE_SET_POSITION SetPosition; + ACPI_EFI_FILE_GET_INFO GetInfo; + ACPI_EFI_FILE_SET_INFO SetInfo; + ACPI_EFI_FILE_FLUSH Flush; +} ACPI_EFI_FILE_STRUCT, *ACPI_EFI_FILE_HANDLE; /* * Loaded image protocol */ -#define LOADED_IMAGE_PROTOCOL \ +#define ACPI_EFI_LOADED_IMAGE_PROTOCOL \ { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( - EFI_HANDLE ImageHandle, - struct _EFI_SYSTEM_TABLE *SystemTable); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_IMAGE_ENTRY_POINT) ( + ACPI_EFI_HANDLE ImageHandle, + struct _ACPI_EFI_SYSTEM_TABLE *SystemTable); typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_LOAD) ( +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_IMAGE_LOAD) ( BOOLEAN BootPolicy, - EFI_HANDLE ParentImageHandle, - EFI_DEVICE_PATH *FilePath, + ACPI_EFI_HANDLE ParentImageHandle, + ACPI_EFI_DEVICE_PATH *FilePath, VOID *SourceBuffer, UINTN SourceSize, - EFI_HANDLE *ImageHandle); + ACPI_EFI_HANDLE *ImageHandle); typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_START) ( - EFI_HANDLE ImageHandle, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_IMAGE_START) ( + ACPI_EFI_HANDLE ImageHandle, UINTN *ExitDataSize, CHAR16 **ExitData); typedef -EFI_STATUS -(EFIAPI *EFI_EXIT) ( - EFI_HANDLE ImageHandle, - EFI_STATUS ExitStatus, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_EXIT) ( + ACPI_EFI_HANDLE ImageHandle, + ACPI_EFI_STATUS ExitStatus, UINTN ExitDataSize, CHAR16 *ExitData); typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_UNLOAD) ( - EFI_HANDLE ImageHandle); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_IMAGE_UNLOAD) ( + ACPI_EFI_HANDLE ImageHandle); #define EFI_IMAGE_INFORMATION_REVISION 0x1000 typedef struct { UINT32 Revision; - EFI_HANDLE ParentHandle; - struct _EFI_SYSTEM_TABLE *SystemTable; - EFI_HANDLE DeviceHandle; - EFI_DEVICE_PATH *FilePath; + ACPI_EFI_HANDLE ParentHandle; + struct _ACPI_EFI_SYSTEM_TABLE *SystemTable; + ACPI_EFI_HANDLE DeviceHandle; + ACPI_EFI_DEVICE_PATH *FilePath; VOID *Reserved; UINT32 LoadOptionsSize; VOID *LoadOptions; VOID *ImageBase; UINT64 ImageSize; - EFI_MEMORY_TYPE ImageCodeType; - EFI_MEMORY_TYPE ImageDataType; - EFI_IMAGE_UNLOAD Unload; + ACPI_EFI_MEMORY_TYPE ImageCodeType; + ACPI_EFI_MEMORY_TYPE ImageDataType; + ACPI_EFI_IMAGE_UNLOAD Unload; -} EFI_LOADED_IMAGE; +} ACPI_EFI_LOADED_IMAGE; /* * EFI Memory */ typedef -EFI_STATUS -(EFIAPI *EFI_ALLOCATE_PAGES) ( - EFI_ALLOCATE_TYPE Type, - EFI_MEMORY_TYPE MemoryType, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_ALLOCATE_PAGES) ( + ACPI_EFI_ALLOCATE_TYPE Type, + ACPI_EFI_MEMORY_TYPE MemoryType, UINTN NoPages, - EFI_PHYSICAL_ADDRESS *Memory); + ACPI_EFI_PHYSICAL_ADDRESS *Memory); typedef -EFI_STATUS -(EFIAPI *EFI_FREE_PAGES) ( - EFI_PHYSICAL_ADDRESS Memory, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FREE_PAGES) ( + ACPI_EFI_PHYSICAL_ADDRESS Memory, UINTN NoPages); typedef -EFI_STATUS -(EFIAPI *EFI_GET_MEMORY_MAP) ( +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_GET_MEMORY_MAP) ( UINTN *MemoryMapSize, - EFI_MEMORY_DESCRIPTOR *MemoryMap, + ACPI_EFI_MEMORY_DESCRIPTOR *MemoryMap, UINTN *MapKey, UINTN *DescriptorSize, UINT32 *DescriptorVersion); -#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) +#define NextMemoryDescriptor(Ptr,Size) ((ACPI_EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) typedef -EFI_STATUS -(EFIAPI *EFI_ALLOCATE_POOL) ( - EFI_MEMORY_TYPE PoolType, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_ALLOCATE_POOL) ( + ACPI_EFI_MEMORY_TYPE PoolType, UINTN Size, VOID **Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_FREE_POOL) ( +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_FREE_POOL) ( VOID *Buffer); @@ -508,167 +521,167 @@ EFI_STATUS * Protocol handler functions */ typedef enum { - EFI_NATIVE_INTERFACE, - EFI_PCODE_INTERFACE -} EFI_INTERFACE_TYPE; + ACPI_EFI_NATIVE_INTERFACE, + ACPI_EFI_PCODE_INTERFACE +} ACPI_EFI_INTERFACE_TYPE; typedef enum { - AllHandles, - ByRegisterNotify, - ByProtocol -} EFI_LOCATE_SEARCH_TYPE; + AcpiEfiAllHandles, + AcpiEfiByRegisterNotify, + AcpiEfiByProtocol +} ACPI_EFI_LOCATE_SEARCH_TYPE; typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( - EFI_HANDLE *Handle, - EFI_GUID *Protocol, - EFI_INTERFACE_TYPE InterfaceType, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_INSTALL_PROTOCOL_INTERFACE) ( + ACPI_EFI_HANDLE *Handle, + ACPI_EFI_GUID *Protocol, + ACPI_EFI_INTERFACE_TYPE InterfaceType, VOID *Interface); typedef -EFI_STATUS -(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, VOID *OldInterface, VOID *NewInterface); typedef -EFI_STATUS -(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, VOID *Interface); typedef -EFI_STATUS -(EFIAPI *EFI_HANDLE_PROTOCOL) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_HANDLE_PROTOCOL) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, VOID **Interface); typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( - EFI_GUID *Protocol, - EFI_EVENT Event, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_REGISTER_PROTOCOL_NOTIFY) ( + ACPI_EFI_GUID *Protocol, + ACPI_EFI_EVENT Event, VOID **Registration); typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE) ( - EFI_LOCATE_SEARCH_TYPE SearchType, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE) ( + ACPI_EFI_LOCATE_SEARCH_TYPE SearchType, + ACPI_EFI_GUID *Protocol, VOID *SearchKey, UINTN *BufferSize, - EFI_HANDLE *Buffer); + ACPI_EFI_HANDLE *Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( - EFI_GUID *Protocol, - EFI_DEVICE_PATH **DevicePath, - EFI_HANDLE *Device); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_LOCATE_DEVICE_PATH) ( + ACPI_EFI_GUID *Protocol, + ACPI_EFI_DEVICE_PATH **DevicePath, + ACPI_EFI_HANDLE *Device); typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( - EFI_GUID *Guid, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_INSTALL_CONFIGURATION_TABLE) ( + ACPI_EFI_GUID *Guid, VOID *Table); -#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 -#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 -#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 -#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 -#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 -#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 +#define ACPI_EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 +#define ACPI_EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 +#define ACPI_EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 +#define ACPI_EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 +#define ACPI_EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 +#define ACPI_EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 typedef -EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, VOID **Interface, - EFI_HANDLE AgentHandle, - EFI_HANDLE ControllerHandle, + ACPI_EFI_HANDLE AgentHandle, + ACPI_EFI_HANDLE ControllerHandle, UINT32 Attributes); typedef -EFI_STATUS -(EFIAPI *EFI_CLOSE_PROTOCOL) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, - EFI_HANDLE AgentHandle, - EFI_HANDLE ControllerHandle); +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_CLOSE_PROTOCOL) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, + ACPI_EFI_HANDLE AgentHandle, + ACPI_EFI_HANDLE ControllerHandle); typedef struct { - EFI_HANDLE AgentHandle; - EFI_HANDLE ControllerHandle; - UINT32 Attributes; - UINT32 OpenCount; -} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; - -typedef -EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( - EFI_HANDLE Handle, - EFI_GUID *Protocol, - EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + ACPI_EFI_HANDLE AgentHandle; + ACPI_EFI_HANDLE ControllerHandle; + UINT32 Attributes; + UINT32 OpenCount; +} ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; + +typedef +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_OPEN_PROTOCOL_INFORMATION) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID *Protocol, + ACPI_EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, UINTN *EntryCount); typedef -EFI_STATUS -(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( - EFI_HANDLE Handle, - EFI_GUID ***ProtocolBuffer, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_PROTOCOLS_PER_HANDLE) ( + ACPI_EFI_HANDLE Handle, + ACPI_EFI_GUID ***ProtocolBuffer, UINTN *ProtocolBufferCount); typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( - EFI_LOCATE_SEARCH_TYPE SearchType, - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_LOCATE_HANDLE_BUFFER) ( + ACPI_EFI_LOCATE_SEARCH_TYPE SearchType, + ACPI_EFI_GUID *Protocol, VOID *SearchKey, UINTN *NoHandles, - EFI_HANDLE **Buffer); + ACPI_EFI_HANDLE **Buffer); typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_PROTOCOL) ( - EFI_GUID *Protocol, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_LOCATE_PROTOCOL) ( + ACPI_EFI_GUID *Protocol, VOID *Registration, VOID **Interface); typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( - EFI_HANDLE *Handle, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + ACPI_EFI_HANDLE *Handle, ...); typedef -EFI_STATUS -(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( - EFI_HANDLE Handle, +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + ACPI_EFI_HANDLE Handle, ...); typedef -EFI_STATUS -(EFIAPI *EFI_CALCULATE_CRC32) ( +ACPI_EFI_STATUS +(ACPI_EFI_API *ACPI_EFI_CALCULATE_CRC32) ( VOID *Data, UINTN DataSize, UINT32 *Crc32); typedef VOID -(EFIAPI *EFI_COPY_MEM) ( +(ACPI_EFI_API *ACPI_EFI_COPY_MEM) ( VOID *Destination, VOID *Source, UINTN Length); typedef VOID -(EFIAPI *EFI_SET_MEM) ( +(ACPI_EFI_API *ACPI_EFI_SET_MEM) ( VOID *Buffer, UINTN Size, UINT8 Value); @@ -676,97 +689,97 @@ VOID /* * EFI Boot Services Table */ -#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) +#define ACPI_EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 +#define ACPI_EFI_BOOT_SERVICES_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION) -typedef struct _EFI_BOOT_SERVICES { - EFI_TABLE_HEADER Hdr; +typedef struct _ACPI_EFI_BOOT_SERVICES { + ACPI_EFI_TABLE_HEADER Hdr; #if 0 - EFI_RAISE_TPL RaiseTPL; - EFI_RESTORE_TPL RestoreTPL; + ACPI_EFI_RAISE_TPL RaiseTPL; + ACPI_EFI_RESTORE_TPL RestoreTPL; #else - EFI_UNKNOWN_INTERFACE RaiseTPL; - EFI_UNKNOWN_INTERFACE RestoreTPL; + ACPI_EFI_UNKNOWN_INTERFACE RaiseTPL; + ACPI_EFI_UNKNOWN_INTERFACE RestoreTPL; #endif - EFI_ALLOCATE_PAGES AllocatePages; - EFI_FREE_PAGES FreePages; - EFI_GET_MEMORY_MAP GetMemoryMap; - EFI_ALLOCATE_POOL AllocatePool; - EFI_FREE_POOL FreePool; + ACPI_EFI_ALLOCATE_PAGES AllocatePages; + ACPI_EFI_FREE_PAGES FreePages; + ACPI_EFI_GET_MEMORY_MAP GetMemoryMap; + ACPI_EFI_ALLOCATE_POOL AllocatePool; + ACPI_EFI_FREE_POOL FreePool; #if 0 - EFI_CREATE_EVENT CreateEvent; - EFI_SET_TIMER SetTimer; - EFI_WAIT_FOR_EVENT WaitForEvent; - EFI_SIGNAL_EVENT SignalEvent; - EFI_CLOSE_EVENT CloseEvent; - EFI_CHECK_EVENT CheckEvent; + ACPI_EFI_CREATE_EVENT CreateEvent; + ACPI_EFI_SET_TIMER SetTimer; + ACPI_EFI_WAIT_FOR_EVENT WaitForEvent; + ACPI_EFI_SIGNAL_EVENT SignalEvent; + ACPI_EFI_CLOSE_EVENT CloseEvent; + ACPI_EFI_CHECK_EVENT CheckEvent; #else - EFI_UNKNOWN_INTERFACE CreateEvent; - EFI_UNKNOWN_INTERFACE SetTimer; - EFI_UNKNOWN_INTERFACE WaitForEvent; - EFI_UNKNOWN_INTERFACE SignalEvent; - EFI_UNKNOWN_INTERFACE CloseEvent; - EFI_UNKNOWN_INTERFACE CheckEvent; + ACPI_EFI_UNKNOWN_INTERFACE CreateEvent; + ACPI_EFI_UNKNOWN_INTERFACE SetTimer; + ACPI_EFI_UNKNOWN_INTERFACE WaitForEvent; + ACPI_EFI_UNKNOWN_INTERFACE SignalEvent; + ACPI_EFI_UNKNOWN_INTERFACE CloseEvent; + ACPI_EFI_UNKNOWN_INTERFACE CheckEvent; #endif - EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; - EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; - EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; - EFI_HANDLE_PROTOCOL HandleProtocol; - EFI_HANDLE_PROTOCOL PCHandleProtocol; - EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; - EFI_LOCATE_HANDLE LocateHandle; - EFI_LOCATE_DEVICE_PATH LocateDevicePath; - EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; - - EFI_IMAGE_LOAD LoadImage; - EFI_IMAGE_START StartImage; - EFI_EXIT Exit; - EFI_IMAGE_UNLOAD UnloadImage; + ACPI_EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; + ACPI_EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; + ACPI_EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; + ACPI_EFI_HANDLE_PROTOCOL HandleProtocol; + ACPI_EFI_HANDLE_PROTOCOL PCHandleProtocol; + ACPI_EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; + ACPI_EFI_LOCATE_HANDLE LocateHandle; + ACPI_EFI_LOCATE_DEVICE_PATH LocateDevicePath; + ACPI_EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; + + ACPI_EFI_IMAGE_LOAD LoadImage; + ACPI_EFI_IMAGE_START StartImage; + ACPI_EFI_EXIT Exit; + ACPI_EFI_IMAGE_UNLOAD UnloadImage; #if 0 - EFI_EXIT_BOOT_SERVICES ExitBootServices; - EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; - EFI_STALL Stall; - EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; + ACPI_EFI_EXIT_BOOT_SERVICES ExitBootServices; + ACPI_EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; + ACPI_EFI_STALL Stall; + ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; #else - EFI_UNKNOWN_INTERFACE ExitBootServices; - EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; - EFI_UNKNOWN_INTERFACE Stall; - EFI_UNKNOWN_INTERFACE SetWatchdogTimer; + ACPI_EFI_UNKNOWN_INTERFACE ExitBootServices; + ACPI_EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; + ACPI_EFI_UNKNOWN_INTERFACE Stall; + ACPI_EFI_UNKNOWN_INTERFACE SetWatchdogTimer; #endif #if 0 - EFI_CONNECT_CONTROLLER ConnectController; - EFI_DISCONNECT_CONTROLLER DisconnectController; + ACPI_EFI_CONNECT_CONTROLLER ConnectController; + ACPI_EFI_DISCONNECT_CONTROLLER DisconnectController; #else - EFI_UNKNOWN_INTERFACE ConnectController; - EFI_UNKNOWN_INTERFACE DisconnectController; + ACPI_EFI_UNKNOWN_INTERFACE ConnectController; + ACPI_EFI_UNKNOWN_INTERFACE DisconnectController; #endif - EFI_OPEN_PROTOCOL OpenProtocol; - EFI_CLOSE_PROTOCOL CloseProtocol; - EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; - EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; - EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; - EFI_LOCATE_PROTOCOL LocateProtocol; - EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; - EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; + ACPI_EFI_OPEN_PROTOCOL OpenProtocol; + ACPI_EFI_CLOSE_PROTOCOL CloseProtocol; + ACPI_EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; + ACPI_EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; + ACPI_EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; + ACPI_EFI_LOCATE_PROTOCOL LocateProtocol; + ACPI_EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; + ACPI_EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; - EFI_CALCULATE_CRC32 CalculateCrc32; + ACPI_EFI_CALCULATE_CRC32 CalculateCrc32; - EFI_COPY_MEM CopyMem; - EFI_SET_MEM SetMem; + ACPI_EFI_COPY_MEM CopyMem; + ACPI_EFI_SET_MEM SetMem; #if 0 - EFI_CREATE_EVENT_EX CreateEventEx; + ACPI_EFI_CREATE_EVENT_EX CreateEventEx; #else - EFI_UNKNOWN_INTERFACE CreateEventEx; + ACPI_EFI_UNKNOWN_INTERFACE CreateEventEx; #endif -} EFI_BOOT_SERVICES; +} ACPI_EFI_BOOT_SERVICES; /* @@ -776,46 +789,46 @@ typedef struct _EFI_BOOT_SERVICES { /* * EFI Configuration Table and GUID definitions */ -#define ACPI_TABLE_GUID \ +#define ACPI_TABLE_GUID \ { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define ACPI_20_TABLE_GUID \ +#define ACPI_20_TABLE_GUID \ { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } -typedef struct _EFI_CONFIGURATION_TABLE { - EFI_GUID VendorGuid; +typedef struct _ACPI_EFI_CONFIGURATION_TABLE { + ACPI_EFI_GUID VendorGuid; VOID *VendorTable; -} EFI_CONFIGURATION_TABLE; +} ACPI_EFI_CONFIGURATION_TABLE; -#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) +#define ACPI_EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 +#define ACPI_EFI_SYSTEM_TABLE_REVISION (ACPI_EFI_SPECIFICATION_MAJOR_REVISION<<16) | (ACPI_EFI_SPECIFICATION_MINOR_REVISION) -typedef struct _EFI_SYSTEM_TABLE { - EFI_TABLE_HEADER Hdr; +typedef struct _ACPI_EFI_SYSTEM_TABLE { + ACPI_EFI_TABLE_HEADER Hdr; - CHAR16 *FirmwareVendor; - UINT32 FirmwareRevision; + CHAR16 *FirmwareVendor; + UINT32 FirmwareRevision; - EFI_HANDLE ConsoleInHandle; - SIMPLE_INPUT_INTERFACE *ConIn; + ACPI_EFI_HANDLE ConsoleInHandle; + ACPI_SIMPLE_INPUT_INTERFACE *ConIn; - EFI_HANDLE ConsoleOutHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; + ACPI_EFI_HANDLE ConsoleOutHandle; + ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; - EFI_HANDLE StandardErrorHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; + ACPI_EFI_HANDLE StandardErrorHandle; + ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; #if 0 - EFI_RUNTIME_SERVICES *RuntimeServices; + ACPI_EFI_RUNTIME_SERVICES *RuntimeServices; #else - EFI_HANDLE *RuntimeServices; + ACPI_EFI_HANDLE *RuntimeServices; #endif - EFI_BOOT_SERVICES *BootServices; + ACPI_EFI_BOOT_SERVICES *BootServices; - UINTN NumberOfTableEntries; - EFI_CONFIGURATION_TABLE *ConfigurationTable; + UINTN NumberOfTableEntries; + ACPI_EFI_CONFIGURATION_TABLE *ConfigurationTable; -} EFI_SYSTEM_TABLE; +} ACPI_EFI_SYSTEM_TABLE; /* GNU EFI definitions */ @@ -834,10 +847,10 @@ DivU64x32 ( /* * EFI specific prototypes */ -EFI_STATUS +ACPI_EFI_STATUS efi_main ( - EFI_HANDLE Image, - EFI_SYSTEM_TABLE *SystemTab); + ACPI_EFI_HANDLE Image, + ACPI_EFI_SYSTEM_TABLE *SystemTab); int acpi_main ( @@ -847,9 +860,9 @@ acpi_main ( #endif -extern EFI_GUID AcpiGbl_LoadedImageProtocol; -extern EFI_GUID AcpiGbl_TextInProtocol; -extern EFI_GUID AcpiGbl_TextOutProtocol; -extern EFI_GUID AcpiGbl_FileSystemProtocol; +extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol; +extern ACPI_EFI_GUID AcpiGbl_TextInProtocol; +extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol; +extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol; #endif /* __ACEFIEX_H__ */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 99adf5f4913d..97187f8b0c1d 100644 --- a/source/include/platform/acenv.h +++ b/source/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 "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/source/include/platform/acenvex.h b/source/include/platform/acenvex.h index 02a46f148b33..d7da594b926e 100644 --- a/source/include/platform/acenvex.h +++ b/source/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/source/include/platform/acfreebsd.h b/source/include/platform/acfreebsd.h index a968e12cc201..928aaa64bd54 100644 --- a/source/include/platform/acfreebsd.h +++ b/source/include/platform/acfreebsd.h @@ -45,9 +45,6 @@ #define __ACFREEBSD_H__ -/* FreeBSD uses GCC */ - -#include "acgcc.h" #include <sys/types.h> #ifdef __LP64__ diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h index 7d703da3dcfb..9adb603958d0 100644 --- a/source/include/platform/acgcc.h +++ b/source/include/platform/acgcc.h @@ -44,6 +44,12 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +/* + * 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> + #define ACPI_INLINE __inline__ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ @@ -64,17 +70,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/source/include/platform/acwinex.h b/source/include/platform/acgccex.h index 8c8e21b2507c..3c02ad50649f 100644 --- a/source/include/platform/acwinex.h +++ b/source/include/platform/acgccex.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: acwinex.h - Extra OS specific defines, etc. + * Name: acgccex.h - Extra GCC specific defines, etc. * *****************************************************************************/ @@ -41,12 +41,18 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#ifndef __ACWINEX_H__ -#define __ACWINEX_H__ +#ifndef __ACGCCEX_H__ +#define __ACGCCEX_H__ -/* Windows uses VC */ -#ifdef _MSC_VER -#include "acmsvcex.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 /* __ACWINEX_H__ */ +#endif /* __ACGCCEX_H__ */ diff --git a/source/include/platform/achaiku.h b/source/include/platform/achaiku.h index 10aa6a3f4a7c..75ee9e745ba5 100644 --- a/source/include/platform/achaiku.h +++ b/source/include/platform/achaiku.h @@ -44,7 +44,9 @@ #ifndef __ACHAIKU_H__ #define __ACHAIKU_H__ -#include "acgcc.h" +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_SYSTEM_CLIBRARY + #include <KernelExport.h> struct mutex; @@ -52,9 +54,6 @@ struct mutex; /* Host-dependent types and defines for user- and kernel-space ACPICA */ -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_USE_STANDARD_HEADERS - #define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX #define ACPI_MUTEX struct mutex * diff --git a/source/include/platform/acintel.h b/source/include/platform/acintel.h index b8dda571f2cd..15683d61e621 100644 --- a/source/include/platform/acintel.h +++ b/source/include/platform/acintel.h @@ -44,6 +44,12 @@ #ifndef __ACINTEL_H__ #define __ACINTEL_H__ +/* + * 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> + /* Configuration specific to Intel 64-bit C compiler */ #define COMPILER_DEPENDENT_INT64 __int64 diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index bd45cdb14e37..048f76a598ac 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -89,6 +89,8 @@ #include <asm/acenv.h> #endif +#define ACPI_INIT_FUNCTION __init + #ifndef CONFIG_ACPI /* External globals for __KERNEL__, stubs is needed */ @@ -173,11 +175,11 @@ #else /* !__KERNEL__ */ -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> +#define ACPI_USE_STANDARD_HEADERS + +#ifdef ACPI_USE_STANDARD_HEADERS #include <unistd.h> +#endif /* Define/disable kernel-specific declarators */ @@ -208,8 +210,4 @@ #endif /* __KERNEL__ */ -/* Linux uses GCC */ - -#include "acgcc.h" - #endif /* __ACLINUX_H__ */ diff --git a/source/include/platform/aclinuxex.h b/source/include/platform/aclinuxex.h index c262e4081999..f1f9c9a21a23 100644 --- a/source/include/platform/aclinuxex.h +++ b/source/include/platform/aclinuxex.h @@ -71,7 +71,7 @@ /* * Overrides for in-kernel ACPICA */ -ACPI_STATUS __init AcpiOsInitialize ( +ACPI_STATUS ACPI_INIT_FUNCTION AcpiOsInitialize ( void); ACPI_STATUS AcpiOsTerminate ( diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h index e8c801f568ea..039fef023205 100644 --- a/source/include/platform/acmsvc.h +++ b/source/include/platform/acmsvc.h @@ -64,6 +64,10 @@ #define stat _stat #define fstat _fstat #define mkdir _mkdir +#define snprintf _snprintf +#if _MSC_VER <= 1200 /* Versions below VC++ 6 */ +#define vsnprintf _vsnprintf +#endif #define O_RDONLY _O_RDONLY #define O_BINARY _O_BINARY #define O_CREAT _O_CREAT @@ -102,6 +106,10 @@ #define ACPI_INTERNAL_XFACE #define ACPI_INTERNAL_VAR_XFACE __cdecl + +/* Do not maintain the architecture specific stuffs for the EFI ports */ + +#if !defined(_EDK2_EFI) && !defined(_GNU_EFI) #ifndef _LINT /* * Math helper functions @@ -136,6 +144,7 @@ n_lo >>= 1; \ } #endif +#endif /* warn C4100: unreferenced formal parameter */ #pragma warning(disable:4100) @@ -192,4 +201,15 @@ _CrtSetBreakAlloc (937); #else #endif +/* Begin standard headers */ + +/* + * warn C4001: nonstandard extension 'single line comment' was used + * + * We need to enable this for ACPICA internal files, but disable it for + * buggy MS runtime headers. + */ +#pragma warning(push) +#pragma warning(disable:4001) + #endif /* __ACMSVC_H__ */ diff --git a/source/include/platform/acmsvcex.h b/source/include/platform/acmsvcex.h index f99a034a47bf..45233e715dbf 100644 --- a/source/include/platform/acmsvcex.h +++ b/source/include/platform/acmsvcex.h @@ -44,6 +44,14 @@ #ifndef __ACMSVCEX_H__ #define __ACMSVCEX_H__ +/* va_arg implementation can be compiler specific */ + +#ifdef ACPI_USE_STANDARD_HEADERS + +#include <stdarg.h> + +#endif /* ACPI_USE_STANDARD_HEADERS */ + /* Debug support. */ #ifdef _DEBUG @@ -51,4 +59,39 @@ #include <crtdbg.h> #endif +/* End standard headers */ + +#pragma warning(pop) + +#ifndef ACPI_USE_SYSTEM_CLIBRARY + +/****************************************************************************** + * + * Not using native C library, use local implementations + * + *****************************************************************************/ + +#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 */ + +#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ + #endif /* __ACMSVCEX_H__ */ diff --git a/source/include/platform/acnetbsd.h b/source/include/platform/acnetbsd.h index 09259af3aae4..c0a9c6da154f 100644 --- a/source/include/platform/acnetbsd.h +++ b/source/include/platform/acnetbsd.h @@ -44,10 +44,6 @@ #ifndef __ACNETBSD_H__ #define __ACNETBSD_H__ -/* NetBSD uses GCC */ - -#include "acgcc.h" - #define ACPI_UINTPTR_T uintptr_t #define ACPI_USE_LOCAL_CACHE #define ACPI_CAST_PTHREAD_T(x) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (x)) diff --git a/source/include/platform/acos2.h b/source/include/platform/acos2.h index 419579bac090..b96d2758efa6 100644 --- a/source/include/platform/acos2.h +++ b/source/include/platform/acos2.h @@ -43,6 +43,10 @@ #ifndef __ACOS2_H__ #define __ACOS2_H__ + +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_SYSTEM_CLIBRARY + #define INCL_LONGLONG #include <os2.h> @@ -66,7 +70,6 @@ */ #define ACPI_UNUSED_VAR -#define ACPI_USE_STANDARD_HEADERS #include <io.h> #define ACPI_FLUSH_CPU_CACHE() Wbinvd() diff --git a/source/include/platform/acqnx.h b/source/include/platform/acqnx.h index 76252f8668d9..3480ecb2f86e 100644 --- a/source/include/platform/acqnx.h +++ b/source/include/platform/acqnx.h @@ -44,9 +44,8 @@ #ifndef __ACQNX_H__ #define __ACQNX_H__ -/* QNX uses GCC */ - -#include "acgcc.h" +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_UINTPTR_T uintptr_t #define ACPI_USE_LOCAL_CACHE @@ -62,13 +61,10 @@ #include <stdint.h> #include <sys/neutrino.h> -#define ACPI_USE_STANDARD_HEADERS - #define __cli() InterruptDisable(); #define __sti() InterruptEnable(); #define __cdecl -#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_NATIVE_DIVIDE #endif /* __ACQNX_H__ */ diff --git a/source/include/platform/acwin.h b/source/include/platform/acwin.h index dd5b334b236c..31a99bd16766 100644 --- a/source/include/platform/acwin.h +++ b/source/include/platform/acwin.h @@ -44,18 +44,11 @@ #ifndef __ACWIN_H__ #define __ACWIN_H__ -/*! [Begin] no source code translation (Keep the include) */ - -/* Windows uses VC */ -#ifdef _MSC_VER -#include "acmsvc.h" -#endif -/*! [End] no source code translation !*/ +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_MACHINE_WIDTH 32 -#define ACPI_USE_STANDARD_HEADERS - #ifdef ACPI_DEFINE_ALTERNATE_TYPES /* * Types used only in (Linux) translated source, defined here to enable diff --git a/source/include/platform/acwin64.h b/source/include/platform/acwin64.h index 6481f4611473..f25a4cb2a7a5 100644 --- a/source/include/platform/acwin64.h +++ b/source/include/platform/acwin64.h @@ -44,15 +44,11 @@ #ifndef __ACWIN64_H__ #define __ACWIN64_H__ -/*! [Begin] no source code translation (Keep the include) */ - -#include "acintel.h" -/*! [End] no source code translation !*/ +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_MACHINE_WIDTH 64 -#define ACPI_USE_STANDARD_HEADERS - /* * Handle platform- and compiler-specific assembly language differences. * diff --git a/source/os_specific/service_layers/osefitbl.c b/source/os_specific/service_layers/osefitbl.c deleted file mode 100644 index ef95e164bea1..000000000000 --- a/source/os_specific/service_layers/osefitbl.c +++ /dev/null @@ -1,1033 +0,0 @@ -/****************************************************************************** - * - * Module Name: osefitbl - EFI OSL for obtaining ACPI tables - * - *****************************************************************************/ - -/* - * 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 "acpidump.h" - - -#define _COMPONENT ACPI_OS_SERVICES - ACPI_MODULE_NAME ("osefitbl") - - -#ifndef PATH_MAX -#define PATH_MAX 256 -#endif - - -/* List of information about obtained ACPI tables */ - -typedef struct osl_table_info -{ - struct osl_table_info *Next; - UINT32 Instance; - char Signature[ACPI_NAME_SIZE]; - -} OSL_TABLE_INFO; - -/* Local prototypes */ - -static ACPI_STATUS -OslTableInitialize ( - void); - -static ACPI_STATUS -OslAddTableToList ( - char *Signature, - UINT32 Instance); - -static ACPI_STATUS -OslMapTable ( - ACPI_SIZE Address, - char *Signature, - ACPI_TABLE_HEADER **Table); - -static void -OslUnmapTable ( - ACPI_TABLE_HEADER *Table); - -static ACPI_STATUS -OslLoadRsdp ( - void); - -static ACPI_STATUS -OslListTables ( - void); - -static ACPI_STATUS -OslGetTable ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address); - - -/* File locations */ - -#define EFI_SYSTAB "/sys/firmware/efi/systab" - -/* Initialization flags */ - -UINT8 Gbl_TableListInitialized = FALSE; - -/* Local copies of main ACPI tables */ - -ACPI_TABLE_RSDP Gbl_Rsdp; -ACPI_TABLE_FADT *Gbl_Fadt = NULL; -ACPI_TABLE_RSDT *Gbl_Rsdt = NULL; -ACPI_TABLE_XSDT *Gbl_Xsdt = NULL; - -/* Table addresses */ - -ACPI_PHYSICAL_ADDRESS Gbl_FadtAddress = 0; -ACPI_PHYSICAL_ADDRESS Gbl_RsdpAddress = 0; - -/* Revision of RSD PTR */ - -UINT8 Gbl_Revision = 0; - -OSL_TABLE_INFO *Gbl_TableListHead = NULL; -UINT32 Gbl_TableCount = 0; - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetTableByAddress - * - * PARAMETERS: Address - Physical address of the ACPI table - * Table - Where a pointer to the table is returned - * - * RETURN: Status; Table buffer is returned if AE_OK. - * AE_NOT_FOUND: A valid table was not found at the address - * - * DESCRIPTION: Get an ACPI table via a physical memory address. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsGetTableByAddress ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER **Table) -{ - UINT32 TableLength; - ACPI_TABLE_HEADER *MappedTable; - ACPI_TABLE_HEADER *LocalTable = NULL; - ACPI_STATUS Status = AE_OK; - - - /* Get main ACPI tables from memory on first invocation of this function */ - - Status = OslTableInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Map the table and validate it */ - - Status = OslMapTable (Address, NULL, &MappedTable); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Copy table to local buffer and return it */ - - TableLength = ApGetTableLength (MappedTable); - if (TableLength == 0) - { - Status = AE_BAD_HEADER; - goto Exit; - } - - LocalTable = ACPI_ALLOCATE_ZEROED (TableLength); - if (!LocalTable) - { - Status = AE_NO_MEMORY; - goto Exit; - } - - memcpy (LocalTable, MappedTable, TableLength); - -Exit: - OslUnmapTable (MappedTable); - *Table = LocalTable; - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetTableByName - * - * PARAMETERS: Signature - ACPI Signature for desired table. Must be - * a null terminated 4-character string. - * Instance - Multiple table support for SSDT/UEFI (0...n) - * Must be 0 for other tables. - * Table - Where a pointer to the table is returned - * Address - Where the table physical address is returned - * - * RETURN: Status; Table buffer and physical address returned if AE_OK. - * AE_LIMIT: Instance is beyond valid limit - * AE_NOT_FOUND: A table with the signature was not found - * - * NOTE: Assumes the input signature is uppercase. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsGetTableByName ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address) -{ - ACPI_STATUS Status; - - - /* Get main ACPI tables from memory on first invocation of this function */ - - Status = OslTableInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Not a main ACPI table, attempt to extract it from the RSDT/XSDT */ - - if (!Gbl_DumpCustomizedTables) - { - /* Attempt to get the table from the memory */ - - Status = OslGetTable (Signature, Instance, Table, Address); - } - else - { - /* Attempt to get the table from the static directory */ - - Status = AE_SUPPORT; - } - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: OslAddTableToList - * - * PARAMETERS: Signature - Table signature - * Instance - Table instance - * - * RETURN: Status; Successfully added if AE_OK. - * AE_NO_MEMORY: Memory allocation error - * - * DESCRIPTION: Insert a table structure into OSL table list. - * - *****************************************************************************/ - -static ACPI_STATUS -OslAddTableToList ( - char *Signature, - UINT32 Instance) -{ - OSL_TABLE_INFO *NewInfo; - OSL_TABLE_INFO *Next; - UINT32 NextInstance = 0; - BOOLEAN Found = FALSE; - - - NewInfo = ACPI_ALLOCATE_ZEROED (sizeof (OSL_TABLE_INFO)); - if (!NewInfo) - { - return (AE_NO_MEMORY); - } - - ACPI_MOVE_NAME (NewInfo->Signature, Signature); - - if (!Gbl_TableListHead) - { - Gbl_TableListHead = NewInfo; - } - else - { - Next = Gbl_TableListHead; - while (1) - { - if (ACPI_COMPARE_NAME (Next->Signature, Signature)) - { - if (Next->Instance == Instance) - { - Found = TRUE; - } - if (Next->Instance >= NextInstance) - { - NextInstance = Next->Instance + 1; - } - } - - if (!Next->Next) - { - break; - } - Next = Next->Next; - } - Next->Next = NewInfo; - } - - if (Found) - { - if (Instance) - { - AcpiLogError ( - "%4.4s: Warning unmatched table instance %d, expected %d\n", - Signature, Instance, NextInstance); - } - Instance = NextInstance; - } - - NewInfo->Instance = Instance; - Gbl_TableCount++; - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetTableByIndex - * - * PARAMETERS: Index - Which table to get - * Table - Where a pointer to the table is returned - * Instance - Where a pointer to the table instance no. is - * returned - * Address - Where the table physical address is returned - * - * RETURN: Status; Table buffer and physical address returned if AE_OK. - * AE_LIMIT: Index is beyond valid limit - * - * DESCRIPTION: Get an ACPI table via an index value (0 through n). Returns - * AE_LIMIT when an invalid index is reached. Index is not - * necessarily an index into the RSDT/XSDT. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsGetTableByIndex ( - UINT32 Index, - ACPI_TABLE_HEADER **Table, - UINT32 *Instance, - ACPI_PHYSICAL_ADDRESS *Address) -{ - OSL_TABLE_INFO *Info; - ACPI_STATUS Status; - UINT32 i; - - - /* Get main ACPI tables from memory on first invocation of this function */ - - Status = OslTableInitialize (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Validate Index */ - - if (Index >= Gbl_TableCount) - { - return (AE_LIMIT); - } - - /* Point to the table list entry specified by the Index argument */ - - Info = Gbl_TableListHead; - for (i = 0; i < Index; i++) - { - Info = Info->Next; - } - - /* Now we can just get the table via the signature */ - - Status = AcpiOsGetTableByName (Info->Signature, Info->Instance, - Table, Address); - - if (ACPI_SUCCESS (Status)) - { - *Instance = Info->Instance; - } - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: OslLoadRsdp - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Scan and load RSDP. - * - *****************************************************************************/ - -static ACPI_STATUS -OslLoadRsdp ( - void) -{ - ACPI_TABLE_HEADER *MappedTable; - UINT8 *RsdpAddress; - ACPI_PHYSICAL_ADDRESS RsdpBase; - ACPI_SIZE RsdpSize; - - - /* Get RSDP from memory */ - - RsdpSize = sizeof (ACPI_TABLE_RSDP); - if (Gbl_RsdpBase) - { - RsdpBase = Gbl_RsdpBase; - } - else - { - RsdpBase = AcpiOsGetRootPointer (); - } - - if (!RsdpBase) - { - RsdpBase = ACPI_HI_RSDP_WINDOW_BASE; - RsdpSize = ACPI_HI_RSDP_WINDOW_SIZE; - } - - RsdpAddress = AcpiOsMapMemory (RsdpBase, RsdpSize); - if (!RsdpAddress) - { - return (AE_BAD_ADDRESS); - } - - /* Search low memory for the RSDP */ - - MappedTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - AcpiTbScanMemoryForRsdp (RsdpAddress, RsdpSize)); - if (!MappedTable) - { - AcpiOsUnmapMemory (RsdpAddress, RsdpSize); - return (AE_NOT_FOUND); - } - - Gbl_RsdpAddress = RsdpBase + (ACPI_CAST8 (MappedTable) - RsdpAddress); - - memcpy (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP)); - AcpiOsUnmapMemory (RsdpAddress, RsdpSize); - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: OslCanUseXsdt - * - * PARAMETERS: None - * - * RETURN: TRUE if XSDT is allowed to be used. - * - * DESCRIPTION: This function collects logic that can be used to determine if - * XSDT should be used instead of RSDT. - * - *****************************************************************************/ - -static BOOLEAN -OslCanUseXsdt ( - void) -{ - if (Gbl_Revision && !AcpiGbl_DoNotUseXsdt) - { - return (TRUE); - } - else - { - return (FALSE); - } -} - - -/****************************************************************************** - * - * FUNCTION: OslTableInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize ACPI table data. Get and store main ACPI tables to - * local variables. Main ACPI tables include RSDT, FADT, RSDT, - * and/or XSDT. - * - *****************************************************************************/ - -static ACPI_STATUS -OslTableInitialize ( - void) -{ - ACPI_STATUS Status; - ACPI_PHYSICAL_ADDRESS Address; - - - if (Gbl_TableListInitialized) - { - return (AE_OK); - } - - /* Get RSDP from memory */ - - Status = OslLoadRsdp (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Get XSDT from memory */ - - if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt) - { - if (Gbl_Xsdt) - { - ACPI_FREE (Gbl_Xsdt); - Gbl_Xsdt = NULL; - } - - Gbl_Revision = 2; - Status = OslGetTable (ACPI_SIG_XSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Xsdt), &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get RSDT from memory */ - - if (Gbl_Rsdp.RsdtPhysicalAddress) - { - if (Gbl_Rsdt) - { - ACPI_FREE (Gbl_Rsdt); - Gbl_Rsdt = NULL; - } - - Status = OslGetTable (ACPI_SIG_RSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Rsdt), &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get FADT from memory */ - - if (Gbl_Fadt) - { - ACPI_FREE (Gbl_Fadt); - Gbl_Fadt = NULL; - } - - Status = OslGetTable (ACPI_SIG_FADT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Fadt), &Gbl_FadtAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (!Gbl_DumpCustomizedTables) - { - /* Add mandatory tables to global table list first */ - - Status = OslAddTableToList (ACPI_RSDP_NAME, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = OslAddTableToList (ACPI_SIG_RSDT, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (Gbl_Revision == 2) - { - Status = OslAddTableToList (ACPI_SIG_XSDT, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - Status = OslAddTableToList (ACPI_SIG_DSDT, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = OslAddTableToList (ACPI_SIG_FACS, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Add all tables found in the memory */ - - Status = OslListTables (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Add all tables found in the static directory */ - - Status = AE_SUPPORT; - } - - Gbl_TableListInitialized = TRUE; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: OslListTables - * - * PARAMETERS: None - * - * RETURN: Status; Table list is initialized if AE_OK. - * - * DESCRIPTION: Add ACPI tables to the table list from memory. - * - *****************************************************************************/ - -static ACPI_STATUS -OslListTables ( - void) -{ - ACPI_TABLE_HEADER *MappedTable = NULL; - UINT8 *TableData; - UINT8 NumberOfTables; - UINT8 ItemSize; - ACPI_PHYSICAL_ADDRESS TableAddress = 0; - ACPI_STATUS Status = AE_OK; - UINT32 i; - - - if (OslCanUseXsdt ()) - { - ItemSize = sizeof (UINT64); - TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER); - NumberOfTables = - (UINT8) ((Gbl_Xsdt->Header.Length - sizeof (ACPI_TABLE_HEADER)) - / ItemSize); - } - else /* Use RSDT if XSDT is not available */ - { - ItemSize = sizeof (UINT32); - TableData = ACPI_CAST8 (Gbl_Rsdt) + sizeof (ACPI_TABLE_HEADER); - NumberOfTables = - (UINT8) ((Gbl_Rsdt->Header.Length - sizeof (ACPI_TABLE_HEADER)) - / ItemSize); - } - - /* Search RSDT/XSDT for the requested table */ - - for (i = 0; i < NumberOfTables; ++i, TableData += ItemSize) - { - if (OslCanUseXsdt ()) - { - TableAddress = - (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData)); - } - else - { - TableAddress = - (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST32 (TableData)); - } - - /* Skip NULL entries in RSDT/XSDT */ - - if (!TableAddress) - { - continue; - } - - Status = OslMapTable (TableAddress, NULL, &MappedTable); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - OslAddTableToList (MappedTable->Signature, 0); - OslUnmapTable (MappedTable); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: OslGetTable - * - * PARAMETERS: Signature - ACPI Signature for common table. Must be - * a null terminated 4-character string. - * Instance - Multiple table support for SSDT/UEFI (0...n) - * Must be 0 for other tables. - * Table - Where a pointer to the table is returned - * Address - Where the table physical address is returned - * - * RETURN: Status; Table buffer and physical address returned if AE_OK. - * AE_LIMIT: Instance is beyond valid limit - * AE_NOT_FOUND: A table with the signature was not found - * - * DESCRIPTION: Get a BIOS provided ACPI table - * - * NOTE: Assumes the input signature is uppercase. - * - *****************************************************************************/ - -static ACPI_STATUS -OslGetTable ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address) -{ - ACPI_TABLE_HEADER *LocalTable = NULL; - ACPI_TABLE_HEADER *MappedTable = NULL; - UINT8 *TableData; - UINT8 NumberOfTables; - UINT8 ItemSize; - UINT32 CurrentInstance = 0; - ACPI_PHYSICAL_ADDRESS TableAddress = 0; - UINT32 TableLength = 0; - ACPI_STATUS Status = AE_OK; - UINT32 i; - - - /* Handle special tables whose addresses are not in RSDT/XSDT */ - - if (ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME) || - ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT) || - ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT) || - ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) || - ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) - { - /* - * Get the appropriate address, either 32-bit or 64-bit. Be very - * careful about the FADT length and validate table addresses. - * Note: The 64-bit addresses have priority. - */ - if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) - { - if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) && - Gbl_Fadt->XDsdt) - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt; - } - else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) && - Gbl_Fadt->Dsdt) - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt; - } - } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) - { - if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) && - Gbl_Fadt->XFacs) - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs; - } - else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) && - Gbl_Fadt->Facs) - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs; - } - } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT)) - { - if (!Gbl_Revision) - { - return (AE_BAD_SIGNATURE); - } - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress; - } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT)) - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress; - } - else - { - TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress; - Signature = ACPI_SIG_RSDP; - } - - /* Now we can get the requested special table */ - - Status = OslMapTable (TableAddress, Signature, &MappedTable); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - TableLength = ApGetTableLength (MappedTable); - } - else /* Case for a normal ACPI table */ - { - if (OslCanUseXsdt ()) - { - ItemSize = sizeof (UINT64); - TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER); - NumberOfTables = - (UINT8) ((Gbl_Xsdt->Header.Length - sizeof (ACPI_TABLE_HEADER)) - / ItemSize); - } - else /* Use RSDT if XSDT is not available */ - { - ItemSize = sizeof (UINT32); - TableData = ACPI_CAST8 (Gbl_Rsdt) + sizeof (ACPI_TABLE_HEADER); - NumberOfTables = - (UINT8) ((Gbl_Rsdt->Header.Length - sizeof (ACPI_TABLE_HEADER)) - / ItemSize); - } - - /* Search RSDT/XSDT for the requested table */ - - for (i = 0; i < NumberOfTables; ++i, TableData += ItemSize) - { - if (OslCanUseXsdt ()) - { - TableAddress = - (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData)); - } - else - { - TableAddress = - (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST32 (TableData)); - } - - /* Skip NULL entries in RSDT/XSDT */ - - if (!TableAddress) - { - continue; - } - - Status = OslMapTable (TableAddress, NULL, &MappedTable); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - TableLength = MappedTable->Length; - - /* Does this table match the requested signature? */ - - if (!ACPI_COMPARE_NAME (MappedTable->Signature, Signature)) - { - OslUnmapTable (MappedTable); - MappedTable = NULL; - continue; - } - - /* Match table instance (for SSDT/UEFI tables) */ - - if (CurrentInstance != Instance) - { - OslUnmapTable (MappedTable); - MappedTable = NULL; - CurrentInstance++; - continue; - } - - break; - } - } - - if (!MappedTable) - { - return (AE_LIMIT); - } - - if (TableLength == 0) - { - Status = AE_BAD_HEADER; - goto Exit; - } - - /* Copy table to local buffer and return it */ - - LocalTable = ACPI_ALLOCATE_ZEROED (TableLength); - if (!LocalTable) - { - Status = AE_NO_MEMORY; - goto Exit; - } - - memcpy (LocalTable, MappedTable, TableLength); - *Address = TableAddress; - *Table = LocalTable; - -Exit: - OslUnmapTable (MappedTable); - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: OslMapTable - * - * PARAMETERS: Address - Address of the table in memory - * Signature - Optional ACPI Signature for desired table. - * Null terminated 4-character string. - * Table - Where a pointer to the mapped table is - * returned - * - * RETURN: Status; Mapped table is returned if AE_OK. - * AE_NOT_FOUND: A valid table was not found at the address - * - * DESCRIPTION: Map entire ACPI table into caller's address space. - * - *****************************************************************************/ - -static ACPI_STATUS -OslMapTable ( - ACPI_SIZE Address, - char *Signature, - ACPI_TABLE_HEADER **Table) -{ - ACPI_TABLE_HEADER *MappedTable; - UINT32 Length; - - - if (!Address) - { - return (AE_BAD_ADDRESS); - } - - /* - * Map the header so we can get the table length. - * Use sizeof (ACPI_TABLE_HEADER) as: - * 1. it is bigger than 24 to include RSDP->Length - * 2. it is smaller than sizeof (ACPI_TABLE_RSDP) - */ - MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!MappedTable) - { - AcpiLogError ("Could not map table header at 0x%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address)); - return (AE_BAD_ADDRESS); - } - - /* If specified, signature must match */ - - if (Signature) - { - if (ACPI_VALIDATE_RSDP_SIG (Signature)) - { - if (!ACPI_VALIDATE_RSDP_SIG (MappedTable->Signature)) - { - AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); - return (AE_BAD_SIGNATURE); - } - } - else if (!ACPI_COMPARE_NAME (Signature, MappedTable->Signature)) - { - AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); - return (AE_BAD_SIGNATURE); - } - } - - /* Map the entire table */ - - Length = ApGetTableLength (MappedTable); - AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); - if (Length == 0) - { - return (AE_BAD_HEADER); - } - - MappedTable = AcpiOsMapMemory (Address, Length); - if (!MappedTable) - { - AcpiLogError ("Could not map table at 0x%8.8X%8.8X length %8.8X\n", - ACPI_FORMAT_UINT64 (Address), Length); - return (AE_INVALID_TABLE_LENGTH); - } - - (void) ApIsValidChecksum (MappedTable); - - *Table = MappedTable; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: OslUnmapTable - * - * PARAMETERS: Table - A pointer to the mapped table - * - * RETURN: None - * - * DESCRIPTION: Unmap entire ACPI table. - * - *****************************************************************************/ - -static void -OslUnmapTable ( - ACPI_TABLE_HEADER *Table) -{ - if (Table) - { - AcpiOsUnmapMemory (Table, ApGetTableLength (Table)); - } -} diff --git a/source/os_specific/service_layers/osefixf.c b/source/os_specific/service_layers/osefixf.c deleted file mode 100644 index 091c0eae6322..000000000000 --- a/source/os_specific/service_layers/osefixf.c +++ /dev/null @@ -1,1091 +0,0 @@ -/****************************************************************************** - * - * Module Name: osefixf - EFI OSL interfaces - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 - 2016, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include "acpi.h" -#include "accommon.h" -#include "acapps.h" - -#define _COMPONENT ACPI_OS_SERVICES - ACPI_MODULE_NAME ("osefixf") - - -/* Local definitions */ - -#define ACPI_EFI_PRINT_LENGTH 256 - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiEfiArgify ( - char *String, - int *ArgcPtr, - char ***ArgvPtr); - -static BOOLEAN -AcpiEfiCompareGuid ( - EFI_GUID *Guid1, - EFI_GUID *Guid2); - -static ACPI_STATUS -AcpiEfiConvertArgcv ( - CHAR16 *LoadOpt, - UINT32 LoadOptSize, - int *ArgcPtr, - char ***ArgvPtr, - char **BufferPtr); - -static ACPI_PHYSICAL_ADDRESS -AcpiEfiGetRsdpViaGuid ( - EFI_GUID *Guid); - -static CHAR16 * -AcpiEfiFlushFile ( - ACPI_FILE File, - CHAR16 *Begin, - CHAR16 *End, - CHAR16 *Pos, - BOOLEAN FlushAll); - - -/* Local variables */ - -static EFI_FILE_HANDLE AcpiGbl_EfiCurrentVolume = NULL; -EFI_GUID AcpiGbl_LoadedImageProtocol = LOADED_IMAGE_PROTOCOL; -EFI_GUID AcpiGbl_TextInProtocol = SIMPLE_TEXT_INPUT_PROTOCOL; -EFI_GUID AcpiGbl_TextOutProtocol = SIMPLE_TEXT_OUTPUT_PROTOCOL; -EFI_GUID AcpiGbl_FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL; - - -/****************************************************************************** - * - * FUNCTION: AcpiEfiGetRsdpViaGuid - * - * PARAMETERS: Guid1 - GUID to compare - * Guid2 - GUID to compare - * - * RETURN: TRUE if Guid1 == Guid2 - * - * DESCRIPTION: Compares two GUIDs - * - *****************************************************************************/ - -static BOOLEAN -AcpiEfiCompareGuid ( - EFI_GUID *Guid1, - EFI_GUID *Guid2) -{ - INT32 *g1; - INT32 *g2; - INT32 r; - - - g1 = (INT32 *) Guid1; - g2 = (INT32 *) Guid2; - - r = g1[0] - g2[0]; - r |= g1[1] - g2[1]; - r |= g1[2] - g2[2]; - r |= g1[3] - g2[3]; - - return (r ? FALSE : TRUE); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEfiGetRsdpViaGuid - * - * PARAMETERS: None - * - * RETURN: RSDP address if found - * - * DESCRIPTION: Find RSDP address via EFI using specified GUID. - * - *****************************************************************************/ - -static ACPI_PHYSICAL_ADDRESS -AcpiEfiGetRsdpViaGuid ( - EFI_GUID *Guid) -{ - ACPI_PHYSICAL_ADDRESS Address = 0; - int i; - - - for (i = 0; i < ST->NumberOfTableEntries; i++) - { - if (AcpiEfiCompareGuid (&ST->ConfigurationTable[i].VendorGuid, Guid)) - { - Address = ACPI_PTR_TO_PHYSADDR ( - ST->ConfigurationTable[i].VendorTable); - break; - } - } - - return (Address); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetRootPointer - * - * PARAMETERS: None - * - * RETURN: RSDP physical address - * - * DESCRIPTION: Gets the ACPI root pointer (RSDP) - * - *****************************************************************************/ - -ACPI_PHYSICAL_ADDRESS -AcpiOsGetRootPointer ( - void) -{ - ACPI_PHYSICAL_ADDRESS Address; - EFI_GUID Guid10 = ACPI_TABLE_GUID; - EFI_GUID Guid20 = ACPI_20_TABLE_GUID; - - - Address = AcpiEfiGetRsdpViaGuid (&Guid20); - if (!Address) - { - Address = AcpiEfiGetRsdpViaGuid (&Guid10); - } - - return (Address); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsMapMemory - * - * PARAMETERS: where - Physical address of memory to be mapped - * length - How much memory to map - * - * RETURN: Pointer to mapped memory. Null on error. - * - * DESCRIPTION: Map physical memory into caller's address space - * - *****************************************************************************/ - -void * -AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS where, - ACPI_SIZE length) -{ - - return (ACPI_TO_POINTER ((ACPI_SIZE) where)); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsUnmapMemory - * - * PARAMETERS: where - Logical address of memory to be unmapped - * length - How much memory to unmap - * - * RETURN: None - * - * DESCRIPTION: Delete a previously created mapping. Where and Length must - * correspond to a previous mapping exactly. - * - *****************************************************************************/ - -void -AcpiOsUnmapMemory ( - void *where, - ACPI_SIZE length) -{ - - return; -} - - -/****************************************************************************** - * - * FUNCTION: Spinlock interfaces - * - * DESCRIPTION: No-op on single threaded BIOS - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsCreateLock ( - ACPI_SPINLOCK *OutHandle) -{ - return (AE_OK); -} - -void -AcpiOsDeleteLock ( - ACPI_SPINLOCK Handle) -{ -} - -ACPI_CPU_FLAGS -AcpiOsAcquireLock ( - ACPI_SPINLOCK Handle) -{ - return (0); -} - -void -AcpiOsReleaseLock ( - ACPI_SPINLOCK Handle, - ACPI_CPU_FLAGS Flags) -{ -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsAllocate - * - * PARAMETERS: Size - Amount to allocate, in bytes - * - * RETURN: Pointer to the new allocation. Null on error. - * - * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. - * - *****************************************************************************/ - -void * -AcpiOsAllocate ( - ACPI_SIZE Size) -{ - EFI_STATUS EfiStatus; - void *Mem; - - - EfiStatus = uefi_call_wrapper (BS->AllocatePool, 3, - EfiLoaderData, Size, &Mem); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_BOOT_SERVICES->AllocatePool(EfiLoaderData) failure.\n"); - return (NULL); - } - - return (Mem); -} - - -#ifdef USE_NATIVE_ALLOCATE_ZEROED -/****************************************************************************** - * - * FUNCTION: AcpiOsAllocateZeroed - * - * PARAMETERS: Size - Amount to allocate, in bytes - * - * RETURN: Pointer to the new allocation. Null on error. - * - * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS. - * - *****************************************************************************/ - -void * -AcpiOsAllocateZeroed ( - ACPI_SIZE Size) -{ - void *Mem; - - - Mem = AcpiOsAllocate (Size); - if (Mem) - { - memset (Mem, 0, Size); - } - - return (Mem); -} -#endif - - -/****************************************************************************** - * - * FUNCTION: AcpiOsFree - * - * PARAMETERS: Mem - Pointer to previously allocated memory - * - * RETURN: None - * - * DESCRIPTION: Free memory allocated via AcpiOsAllocate - * - *****************************************************************************/ - -void -AcpiOsFree ( - void *Mem) -{ - - uefi_call_wrapper (BS->FreePool, 1, Mem); -} - - -/******************************************************************************* - * - * 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) -{ - EFI_STATUS EfiStatus = EFI_SUCCESS; - UINT64 OpenModes; - EFI_FILE_HANDLE EfiFile = NULL; - CHAR16 *Path16 = NULL; - CHAR16 *Pos16; - const char *Pos; - INTN Count, i; - - - if (!Path) - { - return (NULL); - } - - /* Convert modes */ - - OpenModes = EFI_FILE_MODE_READ; - if (Modes & ACPI_FILE_WRITING) - { - OpenModes |= (EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE); - } - - /* Allocate path buffer */ - - Count = strlen (Path); - Path16 = ACPI_ALLOCATE_ZEROED ((Count + 1) * sizeof (CHAR16)); - if (!Path16) - { - EfiStatus = EFI_BAD_BUFFER_SIZE; - goto ErrorExit; - } - Pos = Path; - Pos16 = Path16; - while (*Pos == '/' || *Pos == '\\') - { - Pos++; - Count--; - } - for (i = 0; i < Count; i++) - { - if (*Pos == '/') - { - *Pos16++ = '\\'; - Pos++; - } - else - { - *Pos16++ = *Pos++; - } - } - *Pos16 = '\0'; - - EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Open, 5, - AcpiGbl_EfiCurrentVolume, &EfiFile, Path16, OpenModes, 0); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_FILE_HANDLE->Open() failure.\n"); - goto ErrorExit; - } - -ErrorExit: - - if (Path16) - { - ACPI_FREE (Path16); - } - - return ((ACPI_FILE) EfiFile); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsCloseFile - * - * PARAMETERS: File - File descriptor - * - * RETURN: None. - * - * DESCRIPTION: Close a file. - * - ******************************************************************************/ - -void -AcpiOsCloseFile ( - ACPI_FILE File) -{ - EFI_FILE_HANDLE EfiFile; - - - if (File == ACPI_FILE_OUT || - File == ACPI_FILE_ERR) - { - return; - } - EfiFile = (EFI_FILE_HANDLE) File; - (void) uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Close, 1, EfiFile); - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsReadFile - * - * PARAMETERS: File - File descriptor - * Buffer - Data buffer - * Size - Data block size - * Count - Number of data blocks - * - * RETURN: Size of successfully read buffer - * - * DESCRIPTION: Read from a file. - * - ******************************************************************************/ - -int -AcpiOsReadFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count) -{ - int Length = -1; - EFI_FILE_HANDLE EfiFile; - UINTN ReadSize; - EFI_STATUS EfiStatus; - - - if (File == ACPI_FILE_OUT || - File == ACPI_FILE_ERR) - { - } - else - { - EfiFile = (EFI_FILE_HANDLE) File; - if (!EfiFile) - { - goto ErrorExit; - } - ReadSize = Size * Count; - - EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Read, 3, - EfiFile, &ReadSize, Buffer); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_FILE_HANDLE->Read() failure.\n"); - goto ErrorExit; - } - Length = ReadSize; - } - -ErrorExit: - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEfiFlushFile - * - * PARAMETERS: File - File descriptor - * Begin - String with boundary - * End - Boundary of the string - * Pos - Current position - * FlushAll - Whether checking boundary before flushing - * - * RETURN: Updated position - * - * DESCRIPTION: Flush cached buffer to the file. - * - ******************************************************************************/ - -static CHAR16 * -AcpiEfiFlushFile ( - ACPI_FILE File, - CHAR16 *Begin, - CHAR16 *End, - CHAR16 *Pos, - BOOLEAN FlushAll) -{ - - if (FlushAll || Pos >= (End - 1)) - { - *Pos = 0; - uefi_call_wrapper (File->OutputString, 2, File, Begin); - Pos = Begin; - } - - return (Pos); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsWriteFile - * - * PARAMETERS: File - File descriptor - * Buffer - Data buffer - * Size - Data block size - * Count - Number of data blocks - * - * RETURN: Size of successfully written buffer - * - * DESCRIPTION: Write to a file. - * - ******************************************************************************/ - -int -AcpiOsWriteFile ( - ACPI_FILE File, - void *Buffer, - ACPI_SIZE Size, - ACPI_SIZE Count) -{ - int Length = -1; - CHAR16 String[ACPI_EFI_PRINT_LENGTH]; - const char *Ascii; - CHAR16 *End; - CHAR16 *Pos; - int i, j; - EFI_FILE_HANDLE EfiFile; - UINTN WriteSize; - EFI_STATUS EfiStatus; - - - if (File == ACPI_FILE_OUT || - File == ACPI_FILE_ERR) - { - Pos = String; - End = String + ACPI_EFI_PRINT_LENGTH - 1; - Ascii = ACPI_CAST_PTR (const char, Buffer); - Length = 0; - - for (j = 0; j < Count; j++) - { - for (i = 0; i < Size; i++) - { - if (*Ascii == '\n') - { - *Pos++ = '\r'; - Pos = AcpiEfiFlushFile (File, String, - End, Pos, FALSE); - } - *Pos++ = *Ascii++; - Length++; - Pos = AcpiEfiFlushFile (File, String, - End, Pos, FALSE); - } - } - Pos = AcpiEfiFlushFile (File, String, End, Pos, TRUE); - } - else - { - EfiFile = (EFI_FILE_HANDLE) File; - if (!EfiFile) - { - goto ErrorExit; - } - WriteSize = Size * Count; - - EfiStatus = uefi_call_wrapper (AcpiGbl_EfiCurrentVolume->Write, 3, - EfiFile, &WriteSize, Buffer); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_FILE_HANDLE->Write() failure.\n"); - goto ErrorExit; - } - Length = WriteSize; - } - -ErrorExit: - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsGetFileOffset - * - * PARAMETERS: File - File descriptor - * - * RETURN: Size of current position - * - * DESCRIPTION: Get current file offset. - * - ******************************************************************************/ - -long -AcpiOsGetFileOffset ( - ACPI_FILE File) -{ - long Offset = -1; - - - return (Offset); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsSetFileOffset - * - * PARAMETERS: File - File descriptor - * Offset - 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) -{ - - return (AE_SUPPORT); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsPrintf - * - * PARAMETERS: Format, ... - Standard printf format - * - * RETURN: None - * - * DESCRIPTION: Formatted output. - * - *****************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiOsPrintf ( - const char *Format, - ...) -{ - va_list Args; - - - va_start (Args, Format); - AcpiOsVprintf (Format, Args); - va_end (Args); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsVprintf - * - * PARAMETERS: Format - Standard printf format - * Args - Argument list - * - * RETURN: None - * - * DESCRIPTION: Formatted output with arguments list pointer. - * - *****************************************************************************/ - -void -AcpiOsVprintf ( - const char *Format, - va_list Args) -{ - - (void) AcpiUtFileVprintf (ACPI_FILE_OUT, Format, Args); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsInitialize - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize this module. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsInitialize ( - void) -{ - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEfiArgify - * - * PARAMETERS: String - Pointer to command line argument strings - * which are seperated with spaces - * ArgcPtr - Return number of the arguments - * ArgvPtr - Return vector of the arguments - * - * RETURN: Status - * - * DESCRIPTION: Convert EFI arguments into C arguments. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiEfiArgify ( - char *String, - int *ArgcPtr, - char ***ArgvPtr) -{ - char *CopyBuffer; - int MaxArgc = *ArgcPtr; - int Argc = 0; - char **Argv = *ArgvPtr; - char *Arg; - BOOLEAN IsSingleQuote = FALSE; - BOOLEAN IsDoubleQuote = FALSE; - BOOLEAN IsEscape = FALSE; - - - if (String == NULL) - { - return (AE_BAD_PARAMETER); - } - - CopyBuffer = String; - - while (*String != '\0') - { - while (isspace (*String)) - { - *String++ = '\0'; - } - Arg = CopyBuffer; - while (*String != '\0') - { - if (isspace (*String) && - !IsSingleQuote && !IsDoubleQuote && !IsEscape) - { - *Arg++ = '\0'; - String++; - break; - } - if (IsEscape) - { - IsEscape = FALSE; - *Arg++ = *String; - } - else if (*String == '\\') - { - IsEscape = TRUE; - } - else if (IsSingleQuote) - { - if (*String == '\'') - { - IsSingleQuote = FALSE; - *Arg++ = '\0'; - } - else - { - *Arg++ = *String; - } - } - else if (IsDoubleQuote) - { - if (*String == '"') - { - IsDoubleQuote = FALSE; - *Arg = '\0'; - } - else - { - *Arg++ = *String; - } - } - else - { - if (*String == '\'') - { - IsSingleQuote = TRUE; - } - else if (*String == '"') - { - IsDoubleQuote = TRUE; - } - else - { - *Arg++ = *String; - } - } - String++; - } - if (Argv && Argc < MaxArgc) - { - Argv[Argc] = CopyBuffer; - } - Argc++; - CopyBuffer = Arg; - } - if (Argv && Argc < MaxArgc) - { - Argv[Argc] = NULL; - } - - *ArgcPtr = Argc; - *ArgvPtr = Argv; - - return ((MaxArgc < Argc) ? AE_NO_MEMORY : AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEfiConvertArgcv - * - * PARAMETERS: LoadOptions - Pointer to the EFI options buffer, which - * is NULL terminated - * LoadOptionsSize - Size of the EFI options buffer - * ArgcPtr - Return number of the arguments - * ArgvPtr - Return vector of the arguments - * BufferPtr - Buffer to contain the argument strings - * - * RETURN: Status - * - * DESCRIPTION: Convert EFI arguments into C arguments. - * - *****************************************************************************/ - -static ACPI_STATUS -AcpiEfiConvertArgcv ( - CHAR16 *LoadOptions, - UINT32 LoadOptionsSize, - int *ArgcPtr, - char ***ArgvPtr, - char **BufferPtr) -{ - ACPI_STATUS Status = AE_OK; - UINT32 Count = LoadOptionsSize / sizeof (CHAR16); - UINT32 i; - CHAR16 *From; - char *To; - int Argc = 0; - char **Argv = NULL; - char *Buffer; - - - /* Prepare a buffer to contain the argument strings */ - - Buffer = ACPI_ALLOCATE_ZEROED (Count); - if (!Buffer) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } - -TryAgain: - - /* Extend the argument vector */ - - if (Argv) - { - ACPI_FREE (Argv); - Argv = NULL; - } - if (Argc > 0) - { - Argv = ACPI_ALLOCATE_ZEROED (sizeof (char *) * (Argc + 1)); - if (!Argv) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } - } - - /* - * Note: As AcpiEfiArgify() will modify the content of the buffer, so - * we need to restore it each time before invoking - * AcpiEfiArgify(). - */ - From = LoadOptions; - To = ACPI_CAST_PTR (char, Buffer); - for (i = 0; i < Count; i++) - { - *To++ = (char) *From++; - } - - /* - * The "Buffer" will contain NULL terminated strings after invoking - * AcpiEfiArgify(). The number of the strings are saved in Argc and the - * pointers of the strings are saved in Argv. - */ - Status = AcpiEfiArgify (Buffer, &Argc, &Argv); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NO_MEMORY) - { - goto TryAgain; - } - } - -ErrorExit: - - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Buffer); - ACPI_FREE (Argv); - } - else - { - *ArgcPtr = Argc; - *ArgvPtr = Argv; - *BufferPtr = Buffer; - } - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: efi_main - * - * PARAMETERS: Image - EFI image handle - * SystemTab - EFI system table - * - * RETURN: EFI Status - * - * DESCRIPTION: Entry point of EFI executable - * - *****************************************************************************/ - -EFI_STATUS -efi_main ( - EFI_HANDLE Image, - EFI_SYSTEM_TABLE *SystemTab) -{ - EFI_LOADED_IMAGE *Info; - EFI_STATUS EfiStatus = EFI_SUCCESS; - ACPI_STATUS Status; - int argc; - char **argv = NULL; - char *OptBuffer = NULL; - EFI_FILE_IO_INTERFACE *Volume = NULL; - - - /* Initialize global variables */ - - ST = SystemTab; - BS = SystemTab->BootServices; - - /* Retrieve image information */ - - EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3, - Image, &AcpiGbl_LoadedImageProtocol, ACPI_CAST_PTR (VOID, &Info)); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(LoadedImageProtocol) failure.\n"); - return (EfiStatus); - } - - EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3, - Info->DeviceHandle, &AcpiGbl_FileSystemProtocol, (void **) &Volume); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(FileSystemProtocol) failure.\n"); - return (EfiStatus); - } - EfiStatus = uefi_call_wrapper (Volume->OpenVolume, 2, - Volume, &AcpiGbl_EfiCurrentVolume); - if (EFI_ERROR (EfiStatus)) - { - AcpiLogError ("EFI_FILE_IO_INTERFACE->OpenVolume() failure.\n"); - return (EfiStatus); - } - - Status = AcpiEfiConvertArgcv (Info->LoadOptions, - Info->LoadOptionsSize, &argc, &argv, &OptBuffer); - if (ACPI_FAILURE (Status)) - { - EfiStatus = EFI_DEVICE_ERROR; - goto ErrorAlloc; - } - - acpi_main (argc, argv); - -ErrorAlloc: - - if (argv) - { - ACPI_FREE (argv); - } - if (OptBuffer) - { - ACPI_FREE (OptBuffer); - } - - return (EfiStatus); -} diff --git a/source/os_specific/service_layers/oslibcfs.c b/source/os_specific/service_layers/oslibcfs.c deleted file mode 100644 index 192354c38153..000000000000 --- a/source/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 "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/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index 21ac91d84712..643b02e86a50 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -64,9 +64,6 @@ ACPI_MODULE_NAME ("osunixxf") -BOOLEAN AcpiGbl_DebugTimeout = FALSE; - - /* Upcalls to AcpiExec */ void diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index 4e6e9ded2977..464e92db855c 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -71,8 +71,8 @@ static char KeyBuffer[LOCAL_BUFFER_SIZE]; static char ErrorBuffer[LOCAL_BUFFER_SIZE]; /* - * Tables supported in the Windows registry. SSDTs are not placed into - * the registry, a limitation. + * Tables supported in the Windows registry. Zero or more SSDTs are assumed to + * follow these tables. */ static char *SupportedTables[] = { @@ -82,9 +82,9 @@ static char *SupportedTables[] = "FACP" }; -/* Max index for table above */ +/* Number of table names for the table above. */ -#define ACPI_OS_MAX_TABLE_INDEX 3 +#define ACPI_OS_NUM_TABLE_ENTRIES 4 /****************************************************************************** @@ -171,14 +171,32 @@ AcpiOsGetTableByIndex ( ACPI_PHYSICAL_ADDRESS *Address) { ACPI_STATUS Status; + char *Signature; - if (Index > ACPI_OS_MAX_TABLE_INDEX) + if (Index < ACPI_OS_NUM_TABLE_ENTRIES) { - return (AE_LIMIT); + Signature = SupportedTables[Index]; + Index = 0; + } + else + { + Signature = ACPI_SIG_SSDT; + Index -= ACPI_OS_NUM_TABLE_ENTRIES; + } + + Status = AcpiOsGetTableByName (Signature, Index, Table, Address); + + if (ACPI_SUCCESS (Status)) + { + *Instance = Index; + } + else if (Status == AE_NOT_FOUND && ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + /* Treat SSDTs that are not found as invalid index. */ + Status = (AE_LIMIT); } - Status = AcpiOsGetTableByName (SupportedTables[Index], 0, Table, Address); return (Status); } @@ -225,11 +243,9 @@ AcpiOsGetTableByName ( ACPI_STATUS Status = AE_OK; - /* - * Windows has no SSDTs in the registry, so multiple instances are - * not supported. - */ - if (Instance > 0) + /* Multiple instances are only supported for SSDT tables. */ + + if (Instance > 0 && !ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) { return (AE_LIMIT); } @@ -244,6 +260,28 @@ AcpiOsGetTableByName ( return (AE_BUFFER_OVERFLOW); } + /* + * Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT, + * SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same + * OEM ID, Table ID and Revision, then the 29th entry will overwrite the + * first entry... Let's hope that we do not have that many entries. + */ + if (Instance > 0 && ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + if (Instance < 10) + { + KeyBuffer[strlen (KeyBuffer) - 1] = '0' + (char) Instance; + } + else if (Instance < 29) + { + KeyBuffer[strlen (KeyBuffer) - 1] = 'A' + (char) (Instance - 10); + } + else + { + return (AE_LIMIT); + } + } + WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer, 0L, KEY_READ, &Handle); @@ -265,6 +303,12 @@ AcpiOsGetTableByName ( { Signature = "RSDT"; } + else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) + { + /* SSDT may not be present on older Windows versions, but it is + * also possible that the index is not found. */ + return (AE_NOT_FOUND); + } else { fprintf (stderr, diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 73af3a87db03..b4fc999c7bef 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -100,9 +100,6 @@ ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES]; #endif /* ACPI_SINGLE_THREADED */ -BOOLEAN AcpiGbl_DebugTimeout = FALSE; - - /****************************************************************************** * * FUNCTION: AcpiOsTerminate diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index 452d2036e37a..b997a5cdae4f 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -42,7 +42,6 @@ */ #include "acpibin.h" -#include "acapps.h" ACPI_TABLE_HEADER Header1; diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c index 53a1ffd325ef..5334bc002a3a 100644 --- a/source/tools/acpibin/abmain.c +++ b/source/tools/acpibin/abmain.c @@ -43,7 +43,6 @@ #define _DECLARE_GLOBALS #include "acpibin.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h index cc22be76fa69..679f1a5538bc 100644 --- a/source/tools/acpibin/acpibin.h +++ b/source/tools/acpibin/acpibin.h @@ -43,10 +43,7 @@ #include "acpi.h" #include "accommon.h" - -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> +#include "acapps.h" #define DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h index 0817338dac22..3fd4202c0713 100644 --- a/source/tools/acpidump/acpidump.h +++ b/source/tools/acpidump/acpidump.h @@ -55,12 +55,7 @@ #include "acpi.h" #include "accommon.h" #include "actables.h" - -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/stat.h> - +#include "acapps.h" /* Globals */ @@ -73,12 +68,6 @@ EXTERN ACPI_FILE INIT_GLOBAL (Gbl_OutputFile, NULL); EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL); EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0); -/* Globals required for use with ACPICA modules */ - -#ifdef _DECLARE_GLOBALS -UINT8 AcpiGbl_IntegerByteWidth = 8; -#endif - /* Action table used to defer requested options */ typedef struct ap_dump_action diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index 58e430c5a41c..98ca3b6b4e5c 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -76,7 +76,7 @@ ApIsValidHeader ( if (!AcpiUtValidNameseg (Table->Signature)) { - AcpiLogError ("Table signature (0x%8.8X) is invalid\n", + fprintf (stderr, "Table signature (0x%8.8X) is invalid\n", *(UINT32 *) Table->Signature); return (FALSE); } @@ -85,7 +85,7 @@ ApIsValidHeader ( if (Table->Length < sizeof (ACPI_TABLE_HEADER)) { - AcpiLogError ("Table length (0x%8.8X) is invalid\n", + fprintf (stderr, "Table length (0x%8.8X) is invalid\n", Table->Length); return (FALSE); } @@ -131,7 +131,7 @@ ApIsValidChecksum ( if (ACPI_FAILURE (Status)) { - AcpiLogError ("%4.4s: Warning: wrong checksum in table\n", + fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n", Table->Signature); } @@ -223,13 +223,13 @@ ApDumpTableBuffer ( * Note: simplest to just always emit a 64-bit address. AcpiXtract * utility can handle this. */ - AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", + fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", Table->Signature, ACPI_FORMAT_UINT64 (Address)); AcpiUtDumpBufferToFile (Gbl_OutputFile, ACPI_CAST_PTR (UINT8, Table), TableLength, DB_BYTE_DISPLAY, 0); - AcpiUtFilePrintf (Gbl_OutputFile, "\n"); + fprintf (Gbl_OutputFile, "\n"); return (0); } @@ -274,13 +274,13 @@ ApDumpAllTables ( } else if (i == 0) { - AcpiLogError ("Could not get ACPI tables, %s\n", + fprintf (stderr, "Could not get ACPI tables, %s\n", AcpiFormatException (Status)); return (-1); } else { - AcpiLogError ("Could not get ACPI table at index %u, %s\n", + fprintf (stderr, "Could not get ACPI table at index %u, %s\n", i, AcpiFormatException (Status)); continue; } @@ -330,7 +330,7 @@ ApDumpTableByAddress ( ACPI_MAX64_BYTE_WIDTH, &LongAddress); if (ACPI_FAILURE (Status)) { - AcpiLogError ("%s: Could not convert to a physical address\n", + fprintf (stderr, "%s: Could not convert to a physical address\n", AsciiAddress); return (-1); } @@ -339,7 +339,7 @@ ApDumpTableByAddress ( Status = AcpiOsGetTableByAddress (Address, &Table); if (ACPI_FAILURE (Status)) { - AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n", + fprintf (stderr, "Could not get table at 0x%8.8X%8.8X, %s\n", ACPI_FORMAT_UINT64 (Address), AcpiFormatException (Status)); return (-1); @@ -378,7 +378,7 @@ ApDumpTableByName ( if (strlen (Signature) != ACPI_NAME_SIZE) { - AcpiLogError ( + fprintf (stderr, "Invalid table signature [%s]: must be exactly 4 characters\n", Signature); return (-1); @@ -415,7 +415,7 @@ ApDumpTableByName ( return (0); } - AcpiLogError ( + fprintf (stderr, "Could not get ACPI table with signature [%s], %s\n", LocalSignature, AcpiFormatException (Status)); return (-1); @@ -467,7 +467,7 @@ ApDumpTableFromFile ( if (!AcpiUtValidNameseg (Table->Signature)) { - AcpiLogError ( + fprintf (stderr, "No valid ACPI signature was found in input file %s\n", Pathname); } @@ -476,7 +476,7 @@ ApDumpTableFromFile ( if (Table->Length > FileSize) { - AcpiLogError ( + fprintf (stderr, "Table length (0x%X) is too large for input file (0x%X) %s\n", Table->Length, FileSize, Pathname); goto Exit; @@ -484,7 +484,7 @@ ApDumpTableFromFile ( if (Gbl_VerboseMode) { - AcpiLogError ( + fprintf (stderr, "Input file: %s contains table [%4.4s], 0x%X (%u) bytes\n", Pathname, Table->Signature, FileSize, FileSize); } diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index f26ef6b6ce6a..02de98238d72 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -42,7 +42,6 @@ */ #include "acpidump.h" -#include "acapps.h" /* Local prototypes */ @@ -74,7 +73,7 @@ ApIsExistingFile ( if (!stat (Pathname, &StatInfo)) { - AcpiLogError ("Target path already exists, overwrite? [y|n] "); + fprintf (stderr, "Target path already exists, overwrite? [y|n] "); if (getchar () != 'y') { @@ -116,10 +115,10 @@ ApOpenOutputFile ( /* Point stdout to the file */ - File = AcpiOsOpenFile (Pathname, ACPI_FILE_WRITING); + File = fopen (Pathname, "w"); if (!File) { - AcpiLogError ("Could not open output file: %s\n", Pathname); + fprintf (stderr, "Could not open output file: %s\n", Pathname); return (-1); } @@ -153,7 +152,7 @@ ApWriteToBinaryFile ( char Filename[ACPI_NAME_SIZE + 16]; char InstanceStr [16]; ACPI_FILE File; - size_t Actual; + ACPI_SIZE Actual; UINT32 TableLength; @@ -182,7 +181,7 @@ ApWriteToBinaryFile ( if (Instance > 0) { - AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); + snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); strcat (Filename, InstanceStr); } @@ -190,30 +189,29 @@ ApWriteToBinaryFile ( if (Gbl_VerboseMode) { - AcpiLogError ( + fprintf (stderr, "Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n", Table->Signature, Filename, Table->Length, Table->Length); } /* Open the file and dump the entire table in binary mode */ - File = AcpiOsOpenFile (Filename, - ACPI_FILE_WRITING | ACPI_FILE_BINARY); + File = fopen (Filename, "wb"); if (!File) { - AcpiLogError ("Could not open output file: %s\n", Filename); + fprintf (stderr, "Could not open output file: %s\n", Filename); return (-1); } - Actual = AcpiOsWriteFile (File, Table, 1, TableLength); + Actual = fwrite (Table, 1, TableLength, File); if (Actual != TableLength) { - AcpiLogError ("Error writing binary output file: %s\n", Filename); - AcpiOsCloseFile (File); + fprintf (stderr, "Error writing binary output file: %s\n", Filename); + fclose (File); return (-1); } - AcpiOsCloseFile (File); + fclose (File); return (0); } @@ -239,15 +237,15 @@ ApGetTableFromFile ( ACPI_TABLE_HEADER *Buffer = NULL; ACPI_FILE File; UINT32 FileSize; - size_t Actual; + ACPI_SIZE Actual; /* Must use binary mode */ - File = AcpiOsOpenFile (Pathname, ACPI_FILE_READING | ACPI_FILE_BINARY); + File = fopen (Pathname, "rb"); if (!File) { - AcpiLogError ("Could not open input file: %s\n", Pathname); + fprintf (stderr, "Could not open input file: %s\n", Pathname); return (NULL); } @@ -256,7 +254,7 @@ ApGetTableFromFile ( FileSize = CmGetFileSize (File); if (FileSize == ACPI_UINT32_MAX) { - AcpiLogError ( + fprintf (stderr, "Could not get input file size: %s\n", Pathname); goto Cleanup; } @@ -266,18 +264,17 @@ ApGetTableFromFile ( Buffer = ACPI_ALLOCATE_ZEROED (FileSize); if (!Buffer) { - AcpiLogError ( + fprintf (stderr, "Could not allocate file buffer of size: %u\n", FileSize); goto Cleanup; } /* Read the entire file */ - Actual = AcpiOsReadFile (File, Buffer, 1, FileSize); + Actual = fread (Buffer, 1, FileSize, File); if (Actual != FileSize) { - AcpiLogError ( - "Could not read input file: %s\n", Pathname); + fprintf (stderr, "Could not read input file: %s\n", Pathname); ACPI_FREE (Buffer); Buffer = NULL; goto Cleanup; @@ -286,6 +283,6 @@ ApGetTableFromFile ( *OutFileSize = FileSize; Cleanup: - AcpiOsCloseFile (File); + fclose (File); return (Buffer); } diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 65d7b157815f..26a956e043a8 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -43,7 +43,6 @@ #define _DECLARE_GLOBALS #include "acpidump.h" -#include "acapps.h" /* @@ -161,7 +160,7 @@ ApInsertAction ( CurrentAction++; if (CurrentAction > AP_MAX_ACTIONS) { - AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS); + fprintf (stderr, "Too many table options (max %u)\n", AP_MAX_ACTIONS); return (-1); } @@ -215,7 +214,7 @@ ApDoOptions ( } else { - AcpiLogError ("%s: Cannot handle this switch, please use on|off\n", + fprintf (stderr, "%s: Cannot handle this switch, please use on|off\n", AcpiGbl_Optarg); return (-1); } @@ -241,7 +240,7 @@ ApDoOptions ( ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase); if (ACPI_FAILURE (Status)) { - AcpiLogError ("%s: Could not convert to a physical address\n", + fprintf (stderr, "%s: Could not convert to a physical address\n", AcpiGbl_Optarg); return (-1); } @@ -272,7 +271,7 @@ ApDoOptions ( case 'z': /* Verbose mode */ Gbl_VerboseMode = TRUE; - AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); + fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); continue; /* @@ -355,6 +354,7 @@ acpi_main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); Gbl_OutputFile = ACPI_FILE_OUT; + AcpiGbl_IntegerByteWidth = 8; /* Process command line options */ @@ -397,7 +397,7 @@ acpi_main ( default: - AcpiLogError ("Internal error, invalid action: 0x%X\n", + fprintf (stderr, "Internal error, invalid action: 0x%X\n", Action->ToBeDone); return (-1); } @@ -415,11 +415,11 @@ acpi_main ( /* Summary for the output file */ FileSize = CmGetFileSize (Gbl_OutputFile); - AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n", + fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n", Gbl_OutputFilename, FileSize, FileSize); } - AcpiOsCloseFile (Gbl_OutputFile); + fclose (Gbl_OutputFile); } return (Status); diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index e573f73ebc46..8650707e294c 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -59,11 +59,6 @@ #include "amlresrc.h" #include "acapps.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> - /* * Debug Regions diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 9b2f45d5d0d3..d41ba1412aa6 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -86,7 +86,8 @@ AeOpenInitializationFile ( InitFile = fopen (Filename, "r"); if (!InitFile) { - perror ("Could not open initialization file"); + fprintf (stderr, + "Could not open initialization file: %s\n", Filename); return (-1); } diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 22688c2452f4..d2c9d519aa49 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -42,7 +42,6 @@ */ #include "aecommon.h" -#include "errno.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aemain") @@ -59,7 +58,6 @@ * Windows: The setargv.obj module must be linked in to automatically * expand wildcards. */ -extern BOOLEAN AcpiGbl_DebugTimeout; /* Local prototypes */ @@ -68,7 +66,7 @@ AeDoOptions ( int argc, char **argv); -static ACPI_STATUS +static void AcpiDbRunBatchMode ( void); @@ -653,20 +651,23 @@ EnterDebugger: case AE_MODE_BATCH_SINGLE: AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP); - - /* Shut down the debugger */ - - AcpiTerminateDebugger (); - Status = AcpiTerminate (); break; } - (void) AcpiOsTerminate (); + /* Shut down the debugger and ACPICA */ + +#if 0 + + /* Temporarily removed */ + AcpiTerminateDebugger (); + Status = AcpiTerminate (); +#endif + + Status = AcpiOsTerminate (); return (0); ErrorExit: - (void) AcpiOsTerminate (); return (ExitCode); } @@ -679,18 +680,17 @@ ErrorExit: * to be executed. * Use only commas to separate elements of * particular command. - * RETURN: Status + * RETURN: None * * DESCRIPTION: For each command of list separated by ';' prepare the command * buffer and pass it to AcpiDbCommandDispatch. * *****************************************************************************/ -static ACPI_STATUS +static void AcpiDbRunBatchMode ( void) { - ACPI_STATUS Status; char *Ptr = BatchBuffer; char *Cmd = Ptr; UINT8 Run = 0; @@ -721,10 +721,4 @@ AcpiDbRunBatchMode ( Cmd = Ptr; } } - - /* Shut down the debugger */ - - AcpiTerminateDebugger (); - Status = AcpiTerminate (); - return (Status); } diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 19f005265cee..20055674762d 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -49,17 +49,11 @@ #include "accommon.h" #include "acapps.h" -#include <stdio.h> -#include <sys/stat.h> #include <sys/types.h> -#include <fcntl.h> -#include <ctype.h> -#include <string.h> #ifdef WIN32 #include <io.h> #include <direct.h> #endif -#include <errno.h> typedef enum @@ -70,9 +64,11 @@ typedef enum AH_DECODE_PREDEFINED_NAME, AH_DECODE_AML, AH_DECODE_AML_OPCODE, - AH_DISPLAY_DEVICE_IDS, - AH_DECODE_EXCEPTION, + AH_DECODE_AML_TYPE, AH_DECODE_ASL_AML, + AH_DECODE_EXCEPTION, + + AH_DISPLAY_DEVICE_IDS, AH_DISPLAY_UUIDS, AH_DISPLAY_TABLES, AH_DISPLAY_DIRECTIVES @@ -96,6 +92,13 @@ typedef struct ah_aml_opcode } AH_AML_OPCODE; +typedef struct ah_aml_type +{ + char *Name; + char *Description; + +} AH_AML_TYPE; + typedef struct ah_asl_operator { char *Name; @@ -120,6 +123,7 @@ typedef struct ah_directive_info } AH_DIRECTIVE_INFO; extern const AH_AML_OPCODE AmlOpcodeInfo[]; +extern const AH_AML_TYPE AmlTypesInfo[]; extern const AH_ASL_OPERATOR AslOperatorInfo[]; extern const AH_ASL_KEYWORD AslKeywordInfo[]; extern const AH_UUID AcpiUuids[]; @@ -156,6 +160,10 @@ AhFindAslKeywords ( char *Name); void +AhFindAmlTypes ( + char *Name); + +void AhDisplayDeviceIds ( char *Name); diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c index 8ca28728c572..57a0963c1f29 100644 --- a/source/tools/acpihelp/ahamlops.c +++ b/source/tools/acpihelp/ahamlops.c @@ -43,6 +43,7 @@ #include "acpihelp.h" + /* * AML opcodes with related syntax and grammar information. * This table was extracted from the ACPI specification. diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index ec22e4964fa5..5f422904a53c 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -81,6 +81,10 @@ AhDisplayAmlOpcode ( const AH_AML_OPCODE *Op); static void +AhDisplayAmlType ( + const AH_AML_TYPE *Op); + +static void AhDisplayAslOperator ( const AH_ASL_OPERATOR *Op); @@ -152,7 +156,7 @@ AhFindPredefinedNames ( char Name[9]; - if (!NamePrefix) + if (!NamePrefix || (NamePrefix[0] == '*')) { Found = AhDisplayPredefinedName (NULL, 0); return; @@ -356,7 +360,7 @@ AhFindAmlOpcode ( continue; } - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAmlOpcode (Op); Found = TRUE; @@ -503,6 +507,122 @@ AhDisplayAmlOpcode ( /******************************************************************************* * + * FUNCTION: AhFindAmlTypes (entry point for AML grammar keyword search) + * + * PARAMETERS: Name - Name or prefix for an AML grammar element. + * NULL means "find all" + * + * RETURN: None + * + * DESCRIPTION: Find all AML grammar keywords that match the input Name or name + * prefix. + * + ******************************************************************************/ + +void +AhFindAmlTypes ( + char *Name) +{ + const AH_AML_TYPE *Keyword; + BOOLEAN Found = FALSE; + + + AcpiUtStrupr (Name); + + for (Keyword = AmlTypesInfo; Keyword->Name; Keyword++) + { + if (!Name) + { + printf (" %s\n", Keyword->Name); + Found = TRUE; + continue; + } + + if (*Name == '*') + { + AhDisplayAmlType (Keyword); + Found = TRUE; + continue; + } + + /* Upper case the operator name before substring compare */ + + strcpy (Gbl_Buffer, Keyword->Name); + AcpiUtStrupr (Gbl_Buffer); + + if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) + { + AhDisplayAmlType (Keyword); + Found = TRUE; + } + } + + if (!Found) + { + printf ("%s, no matching AML grammar type\n", Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayAmlType + * + * PARAMETERS: Op - Pointer to AML grammar info + * + * RETURN: None + * + * DESCRIPTION: Format and display info for an AML grammar element. + * + ******************************************************************************/ + +static void +AhDisplayAmlType ( + const AH_AML_TYPE *Op) +{ + char *Description; + + + Description = Op->Description; + printf ("%4s", " "); /* Primary indent */ + + /* Emit the entire description string */ + + while (*Description) + { + /* Description can be multiple lines, must indent each */ + + while (*Description != '\n') + { + printf ("%c", *Description); + Description++; + } + + printf ("\n"); + Description++; + + /* Do indent */ + + if (*Description) + { + printf ("%8s", " "); /* Secondary indent */ + + /* Index extra for a comment */ + + if ((Description[0] == '/') && + (Description[1] == '/')) + { + printf ("%4s", " "); + } + } + } + + printf ("\n"); +} + + +/******************************************************************************* + * * FUNCTION: AhFindAslKeywords (entry point for ASL keyword search) * * PARAMETERS: Name - Name or prefix for an ASL keyword. @@ -527,7 +647,7 @@ AhFindAslKeywords ( for (Keyword = AslKeywordInfo; Keyword->Name; Keyword++) { - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAslKeyword (Keyword); Found = TRUE; @@ -644,7 +764,7 @@ AhFindAslOperators ( for (Operator = AslOperatorInfo; Operator->Name; Operator++) { - if (!Name) + if (!Name || (Name[0] == '*')) { AhDisplayAslOperator (Operator); MatchCount++; @@ -859,7 +979,7 @@ AhDisplayDeviceIds ( /* Null input name indicates "display all" */ - if (!Name) + if (!Name || (Name[0] == '*')) { printf ("ACPI and PNP Device/Hardware IDs:\n\n"); for (Info = AslDeviceIds; Info->Name; Info++) diff --git a/source/tools/acpihelp/ahgrammar.c b/source/tools/acpihelp/ahgrammar.c new file mode 100644 index 000000000000..1e0d54974689 --- /dev/null +++ b/source/tools/acpihelp/ahgrammar.c @@ -0,0 +1,289 @@ +/****************************************************************************** + * + * Module Name: ahgrammar - AML grammar items + * + *****************************************************************************/ + +/* + * 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 "acpihelp.h" + +const AH_AML_TYPE AmlTypesInfo[] = +{ + {"ComputationalData", + "ComputationalData :=\n" + "ByteConst | WordConst | DWordConst | QWordConst |\n" + "String | ConstObj | RevisionOp | DefBuffer\n\n" + "DataObject := ComputationalData | DefPackage | DefVarPackage\n" + "DataRefObject := DataObject | ObjectReference | DDBHandle\n\n" + + "ByteConst := BytePrefix ByteData\n" + "BytePrefix := 0x0A\n" + "ByteList := Nothing | <ByteData ByteList>\n" + "ByteData := 0x00 - 0xFF\n\n" + + "WordConst := WordPrefix WordData\n" + "WordPrefix := 0x0B\n" + "WordData := 0x0000-0xFFFF\n\n" + + "DWordConst := DWordPrefix DWordData\n" + "DWordPrefix := 0x0C\n" + "DWordData := 0x00000000-0xFFFFFFFF\n\n" + + "QWordConst := QWordPrefix QWordData\n" + "QWordPrefix := 0x0E\n" + "QWordData := 0x0000000000000000-0xFFFFFFFFFFFFFFFF\n\n" + + "String := StringPrefix AsciiCharList NullChar\n" + "StringPrefix := 0x0D\n" + "AsciiCharList := Nothing | <AsciiChar AsciiCharList>\n" + "AsciiChar := 0x01 - 0x7F\n" + "NullChar := 0x00\n\n" + + "ConstObj := ZeroOp | OneOp | OnesOp\n\n"}, + + {"DefinitionBlock", + "DefinitionBlockHeader :=\n" + "TableSignature TableLength SpecCompliance Checksum\n" + "OemID OemTableID OemRevision CreatorID CreatorRevision\n\n" + + "TableSignature := AsciiChar AsciiChar AsciiChar AsciiChar\n" + "TableLength := DWordData\n" + "// Length of the table in bytes including\n" + "// the block header.\n\n" + + "SpecCompliance := ByteData\n" + "// The revision of the structure\n\n" + + "CheckSum := ByteData\n" + "// Byte checksum of the entire table\n\n" + + "OemID := ByteData(6)\n" + "// OEM ID of up to 6 characters. If the OEM\n" + "// ID is shorter than 6 characters, it\n" + "// can be terminated with a NULL\n" + "// character.\n\n" + + "OemTableID := ByteData(8)\n" + "// OEM Table ID of up to 8 characters. If\n" + "// the OEM Table ID is shorter than 8\n" + "// characters, it can be terminated with\n" + "// a NULL character.\n" + "OemRevision := DWordData\n" + "// OEM Table Revision\n\n" + "CreatorID := DWordData\n" + "// Vendor ID of the ASL compiler\n" + "CreatorRevision := DWordData\n" + "// Revision of the ASL compiler\n"}, + + {"FieldFlags", + "FieldFlags := ByteData\n" + "// bits 0-3: AccessType\n" + "// 0 AnyAcc\n" + "// 1 ByteAcc\n" + "// 2 WordAcc\n" + "// 3 DWordAcc\n" + "// 4 QWordAcc\n" + "// 5 BufferAcc\n" + "// 6 Reserved\n" + "// 7 Reserved\n" + "// bit 4: LockRule\n" + "// 0 NoLock\n" + "// 1 Lock\n" + "// bits 5-6: UpdateRule\n" + "// 0 Preserve\n" + "// 1 WriteAsOnes\n" + "// 2 WriteAsZeros\n" + "// bit 7:\n" + "// 0 Reserved (must be 0)\n"}, + + {"FieldList", + "FieldList := Nothing | <FieldElement FieldList>\n\n" + "FieldElement := NamedField | ReservedField | AccessField |\n" + " ExtendedAccessField | ConnectField\n\n" + "NamedField := NameSeg PkgLength\n" + "ReservedField := 0x00 PkgLength\n\n" + + "AccessField := 0x01 AccessType\n" + "AccessField := 0x01 AccessType AccessAttrib\n\n" + + "AccessType := ByteData\n" + "// Bits 0:3 - Same as AccessType bits of FieldFlags.\n" + "// Bits 4:5 - Reserved\n" + "// Bits 7:6 - 0 = AccessAttribute\n" + "// Normal Access Attributes\n" + "// 1 = AttribBytes (x)\n" + "// 2 = AttribRawBytes (x)\n" + "// 3 = AttribRawProcessBytes (x)\n" + "// Note: 'x' is encoded as bits 0:7 of the AccessAttrib byte.\n\n" + + "AccessAttrib := ByteData\n" + "// bits 0:7: Byte length\n" + "//\n" + "// If AccessType is BufferAcc for the SMB or\n" + "// GPIO OpRegions, AccessAttrib can be one of\n" + "// the following values:\n" + "// 0x02 AttribQuick\n" + "// 0x04 AttribSendReceive\n" + "// 0x06 AttribByte\n" + "// 0x08 AttribWord\n" + "// 0x0A AttribBlock\n" + "// 0x0C AttribProcessCall\n" + "// 0x0D AttribBlockProcessCall\n\n" + + "ExtendedAccessField := 0x03 AccessType ExtendedAccessAttrib AccessLength\n" + "ExtendedAccessAttrib := ByteData\n" + "// 0x0B AttribBytes\n" + "// 0x0E AttribRawBytes\n" + "// 0x0F AttribRawProcess\n\n" + + "ConnectField := 0x02 NameString> | <0x02 BufferData\n"}, + + {"MatchOpcode", + "DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex\n" + "MatchOp := 0x89\n" + "SearchPkg := TermArg => Package\n" + "MatchOpcode := ByteData\n" + "// 0 MTR\n" + "// 1 MEQ\n" + "// 2 MLE\n" + "// 3 MLT\n" + "// 4 MGE\n" + "// 5 MGT\n"}, + + {"MethodFlags", + "DefMethod := MethodOp PkgLength NameString MethodFlags TermList\n" + "MethodOp := 0x14\n" + "MethodFlags := ByteData\n" + "// bit 0-2: ArgCount (0-7)\n" + "// bit 3: SerializeFlag\n" + "// 0 NotSerialized\n" + "// 1 Serialized\n" + "// bit 4-7: SyncLevel (0x00-0x0f)\n"}, + + {"Miscellaneous", + "ZeroOp := 0x00\n" + "OneOp := 0x01\n" + "OnesOp := 0xFF\n" + "RevisionOp := ExtOpPrefix 0x30\n" + "ExtOpPrefix := 0x5B\n"}, + + {"NameSeg", + "NameSeg := <LeadNameChar NameChar NameChar NameChar>\n" + "// Note: NameSegs shorter than 4 characters are filled with\n" + "// trailing underscores.\n\n" + "NameChar := DigitChar | LeadNameChar\n" + "LeadNameChar := 'A'-'Z' | '_' (0x41 - 0x5A) | (0x5F)\n" + "DigitChar := '0'-'9' (0x30 - 0x39)\n"}, + + {"NameString", + "NameString := <RootChar NamePath> | <PrefixPath NamePath>\n" + "PrefixPath := Nothing | <ParentPrefixChar PrefixPath>\n" + "RootChar := '\\' (0x5C)\n" + "ParentPrefixChar := '^' (0x5E)\n"}, + + {"NamePath", + "NamePath := NameSeg | DualNamePath | MultiNamePath | NullName\n" + "DualNamePath := DualNamePrefix NameSeg NameSeg\n" + "DualNamePrefix := 0x2E\n" + "MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)\n" + "MultiNamePrefix := 0x2F\n" + "SegCount := ByteData\n" + "// Note: SegCount can be from 1 to 255. For example: MultiNamePrefix(35)\n" + "// is encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total\n" + "// encoding length will be 1 + 1 + (35 * 4) = 142. Notice that:\n" + "// DualNamePrefix NameSeg NameSeg has a smaller encoding than the\n" + "// encoding of: MultiNamePrefix(2) NameSeg NameSeg\n\n" + + "SimpleName := NameString | ArgObj | LocalObj\n" + "SuperName := SimpleName | DebugObj | Type6Opcode\n" + "NullName := 0x00\n" + "Target := SuperName | NullName\n"}, + + {"PkgLength", + "PkgLength := PkgLeadByte |\n" + "<PkgLeadByte ByteData> |\n" + "<PkgLeadByte ByteData ByteData> |\n" + "<PkgLeadByte ByteData ByteData ByteData>\n\n" + + "PkgLeadByte :=\n" + "bit 7-6: Count of ByteData that follows (0-3)\n" + "bit 5-4: Only used if (PkgLength < 63)\n" + "bit 3-0: Least significant package length nybble\n" + "// Note: The high 2 bits of the first byte reveal how many follow bytes\n" + "// are in the PkgLength. If the PkgLength has only one byte, bit 0 through 5\n" + "// are used to encode the package length (in other words, values 0-63). If\n" + "// the package length value is more than 63, more than one byte must be\n" + "// used for the encoding in which case bit 4 and 5 of the PkgLeadByte are\n" + "// reserved and must be zero. If the multiple bytes encoding is used, bits\n" + "// 0-3 of the PkgLeadByte become the least significant 4 bits of the\n" + "// resulting package length value. The next ByteData will become the next\n" + "// least significant 8 bits of the resulting value and so on, up to 3\n" + "// ByteData bytes. Thus, the maximum package length is 2**28.\n"}, + + {"RegionSpace", + "RegionSpace := ByteData\n" + "// 0x00 SystemMemory\n" + "// 0x01 SystemIO\n" + "// 0x02 PCI_Config\n" + "// 0x03 EmbeddedControl\n" + "// 0x04 SMBus\n" + "// 0x05 SystemCMOS\n" + "// 0x06 PciBarTarget\n" + "// 0x07 IPMI\n" + "// 0x08 GeneralPurposeIO\n" + "// 0x09 GenericSerialBus\n" + "// 0x0A Platform Communications Channel\n" + "// 0x0B-0x7E: Reserved\n" + "// 0x7F: Functional Fixed Hardware\n" + "// 0x80-0xBF: Reserved\n" + "// 0xC0-0xFF: OEM Defined\n"}, + + {"TermObj", + "TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode\n" + "TermList := Nothing | <TermObj TermList>\n\n" + + "MethodInvocation := NameString TermArgList\n" + "TermArgList := Nothing | <TermArg TermArgList>\n" + "TermArg := Type2Opcode | DataObject | ArgObj | LocalObj\n\n" + + "ObjectList := Nothing | <Object ObjectList>\n" + "Object := NameSpaceModifierObj | NamedObj\n"}, + + {NULL, NULL} +}; diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c index 4538ae4ea203..1c45e436269e 100644 --- a/source/tools/acpihelp/ahmain.c +++ b/source/tools/acpihelp/ahmain.c @@ -51,9 +51,16 @@ AhDisplayUsage ( void); #define AH_UTILITY_NAME "ACPI Help Utility" -#define AH_SUPPORTED_OPTIONS "adehikmopstuv" +#define AH_SUPPORTED_OPTIONS "adeghikmopstuv" +#if defined ACPI_OPTION +#undef ACPI_OPTION +#endif + +#define ACPI_OPTION(Name, Description) \ + AcpiOsPrintf (" %-24s%s\n", Name, Description); + /****************************************************************************** * * FUNCTION: AhDisplayUsage @@ -71,21 +78,22 @@ AhDisplayUsage ( ACPI_OPTION ("-h", "Display help"); ACPI_OPTION ("-v", "Display version information"); - ACPI_USAGE_TEXT ("\nAML (ACPI Machine Language) Names and Encodings:\n"); - ACPI_OPTION ("-a [Name/Prefix]", "Find/Display both ASL operator and AML opcode name(s)"); - ACPI_OPTION ("-m [Name/Prefix]", "Find/Display AML opcode name(s)"); + ACPI_USAGE_TEXT ("\nAML Names and Encodings (ACPI Machine Language):\n"); + ACPI_OPTION ("-a [Name/Prefix | *]", "Display both ASL operator and AML opcode name(s)"); + ACPI_OPTION ("-g [Name/Prefix | *]", "Display AML grammar elements(s)"); + ACPI_OPTION ("-m [Name/Prefix | *]", "Display AML opcode name(s)"); ACPI_USAGE_TEXT ("\nACPI Values:\n"); ACPI_OPTION ("-e [HexValue]", "Decode ACPICA exception code"); ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode"); - ACPI_USAGE_TEXT ("\nASL (ACPI Source Language) Names and Symbols:\n"); - ACPI_OPTION ("-k [Name/Prefix]", "Find/Display ASL non-operator keyword(s)"); - ACPI_OPTION ("-p [Name/Prefix]", "Find/Display ASL predefined method name(s)"); - ACPI_OPTION ("-s [Name/Prefix]", "Find/Display ASL operator name(s)"); + ACPI_USAGE_TEXT ("\nASL Names and Symbols (ACPI Source Language):\n"); + ACPI_OPTION ("-k [Name/Prefix | *]", "Display ASL non-operator keyword(s)"); + ACPI_OPTION ("-p [Name/Prefix | *]", "Display ASL predefined method name(s)"); + ACPI_OPTION ("-s [Name/Prefix | *]", "Display ASL operator name(s)"); - ACPI_USAGE_TEXT ("\nOther ACPI Names:\n"); - ACPI_OPTION ("-i [Name/Prefix]", "Find/Display ACPI/PNP Hardware ID(s)"); + ACPI_USAGE_TEXT ("\nOther miscellaneous ACPI Names:\n"); + ACPI_OPTION ("-i [Name/Prefix | *]", "Display ACPI/PNP Hardware ID(s)"); ACPI_OPTION ("-d", "Display iASL Preprocessor directives"); ACPI_OPTION ("-t", "Display supported ACPI tables"); ACPI_OPTION ("-u", "Display ACPI-related UUIDs"); @@ -145,6 +153,11 @@ main ( DecodeType = AH_DECODE_EXCEPTION; break; + case 'g': + + DecodeType = AH_DECODE_AML_TYPE; + break; + case 'i': DecodeType = AH_DISPLAY_DEVICE_IDS; @@ -217,6 +230,11 @@ main ( AhDecodeAmlOpcode (Name); break; + case AH_DECODE_AML_TYPE: + + AhFindAmlTypes (Name); + break; + case AH_DECODE_PREDEFINED_NAME: AhFindPredefinedNames (Name); diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h index ea1161f0075a..78a215ed6868 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -43,10 +43,7 @@ #include "acpi.h" #include "accommon.h" - -#include <stdio.h> -#include <sys/stat.h> -#include <errno.h> +#include "acapps.h" /* mkdir support */ diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index 2c595735fccc..b8f0501d6c48 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index f64e95f5fc05..5554f69d02cd 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /* Local prototypes */ diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 63e78f92e522..a6c0a5c517e9 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -42,7 +42,6 @@ */ #include "acpisrc.h" -#include "acapps.h" /****************************************************************************** |