From c90c234f291222de71399eb6bf3cf20dd5146286 Mon Sep 17 00:00:00 2001 From: jkim Date: Sat, 18 Apr 2015 08:01:12 +0000 Subject: MFC: r281396, r281475 Merge ACPICA 20150410. Relnotes: yes --- sys/contrib/dev/acpica/acpica_prep.sh | 11 +- sys/contrib/dev/acpica/changes.txt | 107 +++- sys/contrib/dev/acpica/common/adfile.c | 10 +- sys/contrib/dev/acpica/common/adisasm.c | 95 ++- sys/contrib/dev/acpica/common/dmtable.c | 136 ++-- sys/contrib/dev/acpica/common/dmtbdump.c | 100 +-- sys/contrib/dev/acpica/common/dmtbinfo.c | 42 +- sys/contrib/dev/acpica/compiler/aslcodegen.c | 2 +- sys/contrib/dev/acpica/compiler/aslcompile.c | 12 +- sys/contrib/dev/acpica/compiler/aslcompiler.h | 8 + sys/contrib/dev/acpica/compiler/asldefine.h | 1 - sys/contrib/dev/acpica/compiler/aslfold.c | 706 ++++++++++++++------- sys/contrib/dev/acpica/compiler/asllisting.c | 5 +- sys/contrib/dev/acpica/compiler/aslmain.c | 1 + sys/contrib/dev/acpica/compiler/aslmap.c | 2 +- sys/contrib/dev/acpica/compiler/aslmapenter.c | 10 +- sys/contrib/dev/acpica/compiler/asloptions.c | 5 + sys/contrib/dev/acpica/compiler/aslrules.y | 53 +- sys/contrib/dev/acpica/compiler/aslstartup.c | 2 +- sys/contrib/dev/acpica/compiler/asltree.c | 199 ++++-- sys/contrib/dev/acpica/compiler/asltypes.y | 2 +- sys/contrib/dev/acpica/compiler/aslutils.c | 9 +- sys/contrib/dev/acpica/compiler/aslwalks.c | 10 +- sys/contrib/dev/acpica/compiler/dtcompile.c | 17 +- sys/contrib/dev/acpica/compiler/dtcompiler.h | 20 +- sys/contrib/dev/acpica/compiler/dtio.c | 6 +- sys/contrib/dev/acpica/compiler/dttable.c | 35 +- sys/contrib/dev/acpica/compiler/dttemplate.h | 17 + sys/contrib/dev/acpica/compiler/dtutils.c | 3 +- .../dev/acpica/components/debugger/dbmethod.c | 4 +- .../dev/acpica/components/debugger/dbxface.c | 13 +- .../dev/acpica/components/disassembler/dmopcode.c | 12 - .../dev/acpica/components/disassembler/dmwalk.c | 2 +- .../dev/acpica/components/dispatcher/dsopcode.c | 6 +- .../dev/acpica/components/dispatcher/dsutils.c | 9 + .../dev/acpica/components/events/evregion.c | 2 +- .../dev/acpica/components/events/evxfevnt.c | 5 +- .../dev/acpica/components/executer/exdump.c | 2 +- .../dev/acpica/components/executer/exfldio.c | 4 +- .../dev/acpica/components/executer/exoparg3.c | 13 +- .../dev/acpica/components/executer/exregion.c | 13 +- sys/contrib/dev/acpica/components/hardware/hwgpe.c | 15 +- .../dev/acpica/components/hardware/hwvalid.c | 12 +- .../dev/acpica/components/namespace/nsdump.c | 6 +- .../dev/acpica/components/parser/psopcode.c | 6 +- .../dev/acpica/components/parser/psopinfo.c | 2 +- .../dev/acpica/components/resources/rsaddr.c | 8 +- .../dev/acpica/components/resources/rsdump.c | 279 ++++---- .../dev/acpica/components/resources/rsdumpinfo.c | 45 +- .../dev/acpica/components/resources/rsxface.c | 10 +- sys/contrib/dev/acpica/components/tables/tbdata.c | 33 +- .../dev/acpica/components/tables/tbinstal.c | 68 +- sys/contrib/dev/acpica/components/tables/tbprint.c | 18 +- .../dev/acpica/components/tables/tbxfroot.c | 6 +- .../dev/acpica/components/utilities/utaddress.c | 22 +- .../dev/acpica/components/utilities/utbuffer.c | 9 + .../dev/acpica/components/utilities/utglobal.c | 13 +- .../dev/acpica/components/utilities/utmisc.c | 2 + .../dev/acpica/components/utilities/utosi.c | 1 + .../dev/acpica/components/utilities/utprint.c | 13 +- .../dev/acpica/components/utilities/utstate.c | 38 -- .../dev/acpica/components/utilities/utuuid.c | 2 + sys/contrib/dev/acpica/include/acdebug.h | 2 +- sys/contrib/dev/acpica/include/acdisasm.h | 20 +- sys/contrib/dev/acpica/include/acglobal.h | 9 +- sys/contrib/dev/acpica/include/aclocal.h | 2 +- sys/contrib/dev/acpica/include/acmacros.h | 13 +- sys/contrib/dev/acpica/include/acopcode.h | 2 + sys/contrib/dev/acpica/include/acpixf.h | 4 +- sys/contrib/dev/acpica/include/acresrc.h | 4 +- sys/contrib/dev/acpica/include/acrestyp.h | 54 +- sys/contrib/dev/acpica/include/acstruct.h | 5 - sys/contrib/dev/acpica/include/actables.h | 13 +- sys/contrib/dev/acpica/include/actbl2.h | 83 +-- sys/contrib/dev/acpica/include/actypes.h | 46 +- sys/contrib/dev/acpica/include/acutils.h | 27 +- sys/contrib/dev/acpica/include/amlcode.h | 2 +- sys/contrib/dev/acpica/include/platform/acenv.h | 1 + sys/dev/acpica/acpi_pcib_acpi.c | 24 +- sys/dev/acpica/acpi_resource.c | 32 +- sys/x86/acpica/OsdEnvironment.c | 2 +- 81 files changed, 1517 insertions(+), 1147 deletions(-) diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index f4fdfb1..efb75b2 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -18,11 +18,12 @@ fulldirs="common compiler components include os_specific" # files to remove stripdirs="generate libraries tests tools" -stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ - aclinux.h aclinuxex.h acmacosx.h acmsvc.h acnetbsd.h acos2.h \ - acwin.h acwin64.h new_table.txt osefitbl.c osefixf.c \ - osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c oswindir.c \ - oswintbl.c oswinxf.c readme.txt utclib.c" +stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \ + acefi.h achaiku.h acintel.h aclinux.h aclinuxex.h acmacosx.h \ + acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h new_table.txt \ + osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \ + osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \ + readme.txt utclib.c" # include files to canonify src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 0469af0..ad9d23c 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,7 +1,84 @@ ---------------------------------------- -04 February 2015. Summary of changes for version 20150204: +10 April 2015. Summary of changes for version 20150410: -This release is available at https://acpica.org/downloads +Reverted a change introduced in version 20150408 that caused +a regression in the disassembler where incorrect operator +symbols could be emitted. + +---------------------------------------- +08 April 2015. Summary of changes for version 20150408: + + +1) ACPICA kernel-resident subsystem: + +Permanently set the return value for the _REV predefined name. It now +returns 2 (was 5). This matches other ACPI implementations. _REV will be +deprecated in the future, and is now defined to be 1 for ACPI 1.0, and 2 +for ACPI 2.0 and later. It should never be used to differentiate or +identify operating systems. + +Added the "Windows 2015" string to the _OSI support. ACPICA will now +return TRUE to a query with this string. + +Fixed several issues with the local version of the printf function. + +Added the C99 compiler option (-std=c99) to the Unix makefiles. + + Current Release: + Non-Debug Version: 99.9K Code, 27.4K Data, 127.3K Total + Debug Version: 195.2K Code, 80.7K Data, 275.9K Total + Previous Release: + Non-Debug Version: 98.8K Code, 27.3K Data, 126.1K Total + Debug Version: 192.1K Code, 79.8K Data, 271.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented an enhancement to the constant folding feature to +transform the parse tree to a simple Store operation whenever possible: + Add (2, 3, X) ==> is converted to: Store (5, X) + X = 2 + 3 ==> is converted to: Store (5, X) + +Updated support for the SLIC table (Software Licensing Description Table) +in both the Data Table compiler and the disassembler. The SLIC table +support now conforms to "Microsoft Software Licensing Tables (SLIC and +MSDM). November 29, 2011. Copyright 2011 Microsoft". Note: Any SLIC data +following the ACPI header is now defined to be "Proprietary Data", and as +such, can only be entered or displayed as a hex data block. + +Implemented full support for the MSDM table as described in the document +above. Note: The format of MSDM is similar to SLIC. Any MSDM data +following the ACPI header is defined to be "Proprietary Data", and can +only be entered or displayed as a hex data block. + +Implemented the -Pn option for the iASL Table Compiler (was only +implemented for the ASL compiler). This option disables the iASL +preprocessor. + +Disassembler: For disassembly of Data Tables, added a comment field +around the Ascii equivalent data that is emitted as part of the "Raw +Table Data" block. This prevents the iASL Preprocessor from possible +confusion if/when the table is compiled. + +Disassembler: Added an option (-df) to force the disassembler to assume +that the table being disassembled contains valid AML. This feature is +useful for disassembling AML files that contain ACPI signatures other +than DSDT or SSDT (such as OEMx or other signatures). + +Changes for the EFI version of the tools: +1) Fixed a build error/issue +2) Fixed a cast warning + +iASL: Fixed a path issue with the __FILE__ operator by making the +directory prefix optional within the internal SplitInputFilename +function. + +Debugger: Removed some unused global variables. + +Tests: Updated the makefile for proper generation of the AAPITS suite. + +---------------------------------------- +04 February 2015. Summary of changes for version 20150204: ACPICA kernel-resident subsystem: @@ -14,24 +91,26 @@ Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues. A raw gpe handling mechanism was created to allow better handling of GPE storms that aren't easily managed by the normal handler. The raw handler allows disabling/renabling of the the GPE so that interrupt storms can be -avoided in cases where events cannot be timely serviced. In this scenario, -handlers should use the AcpiSetGpe() API to disable/enable the GPE. This API -will leave the reference counts undisturbed, thereby preventing unintentional -clearing of the GPE when the intent in only to temporarily disable it. Raw -handlers allow enabling and disabling of a GPE by removing GPE register -locking. As such, raw handlers much provide their own locks while using -GPE API's to protect access to GPE data structures. +avoided in cases where events cannot be timely serviced. In this +scenario, handlers should use the AcpiSetGpe() API to disable/enable the +GPE. This API will leave the reference counts undisturbed, thereby +preventing unintentional clearing of the GPE when the intent in only to +temporarily disable it. Raw handlers allow enabling and disabling of a +GPE by removing GPE register locking. As such, raw handlers much provide +their own locks while using GPE API's to protect access to GPE data +structures. Lv Zheng Events: Always modify GPE registers under the GPE lock. Applies GPE lock around AcpiFinishGpe() to protect access to GPE register values. Reported as bug by joe.liu@apple.com. -Unix makefiles: Separate option to disable optimizations and _FORTIFY_SOURCE. -This change removes the _FORTIFY_SOURCE flag from the NOOPT disable option and -creates a separate flag (NOFORTIFY) for this purpose. Some toolchains may -define _FORTIFY_SOURCE which leads redefined errors when building ACPICA. This -allows disabling the option without also having to disable optimazations. +Unix makefiles: Separate option to disable optimizations and +_FORTIFY_SOURCE. This change removes the _FORTIFY_SOURCE flag from the +NOOPT disable option and creates a separate flag (NOFORTIFY) for this +purpose. Some toolchains may define _FORTIFY_SOURCE which leads redefined +errors when building ACPICA. This allows disabling the option without +also having to disable optimazations. David Box Current Release: diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index edf4513..2bfe7ed 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -295,7 +295,10 @@ FlSplitInputPathname ( char *Filename; - *OutDirectoryPath = NULL; + if (OutDirectoryPath) + { + *OutDirectoryPath = NULL; + } if (!InputPath) { @@ -340,7 +343,10 @@ FlSplitInputPathname ( return (AE_NO_MEMORY); } - *OutDirectoryPath = DirectoryPath; + if (OutDirectoryPath) + { + *OutDirectoryPath = DirectoryPath; + } if (OutFilename) { diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 2212450..658b5be 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -64,6 +64,11 @@ AdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table); +static ACPI_STATUS +AdStoreTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex); + /* Stubs for ASL compiler */ #ifndef ACPI_ASL_COMPILER @@ -298,7 +303,7 @@ AdAmlDisassemble ( return (Status); } - if (!AcpiGbl_DbOpt_disasm) + if (!AcpiGbl_DbOpt_Disasm) { return (AE_OK); } @@ -337,7 +342,6 @@ AdAmlDisassemble ( { fprintf (stderr, "Could not open output file %s\n", DisasmFilename); Status = AE_ERROR; - ACPI_FREE (DisasmFilename); goto Cleanup; } @@ -346,9 +350,11 @@ AdAmlDisassemble ( *OutFilename = DisasmFilename; - if (!AcpiUtIsAmlTable (Table)) + /* ForceAmlDisassembly means to assume the table contains valid AML */ + + if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) { - AdDisassemblerHeader (Filename); + AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", Table->Signature); AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " @@ -486,7 +492,7 @@ AdAmlDisassemble ( /* Optional displays */ - if (AcpiGbl_DbOpt_disasm) + if (AcpiGbl_DbOpt_Disasm) { /* This is the real disassembly */ @@ -515,7 +521,7 @@ AdAmlDisassemble ( Cleanup: - if (Table && !AcpiUtIsAmlTable (Table)) + if (Table && !AcpiGbl_ForceAmlDisassembly &&!AcpiUtIsAmlTable (Table)) { ACPI_FREE (Table); } @@ -543,6 +549,7 @@ Cleanup: * FUNCTION: AdDisassemblerHeader * * PARAMETERS: Filename - Input file for the table + * TableType - Either AML or DataTable * * RETURN: None * @@ -553,7 +560,8 @@ Cleanup: void AdDisassemblerHeader ( - char *Filename) + char *Filename, + UINT8 TableType) { time_t Timer; @@ -565,17 +573,20 @@ AdDisassemblerHeader ( AcpiOsPrintf ("/*\n"); AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * ")); - if (AcpiGbl_CstyleDisassembly) + if (TableType == ACPI_IS_AML_TABLE) { - AcpiOsPrintf ( - " * Disassembling to symbolic ASL+ operators\n" - " *\n"); - } - else - { - AcpiOsPrintf ( - " * Disassembling to non-symbolic legacy ASL operators\n" - " *\n"); + if (AcpiGbl_CstyleDisassembly) + { + AcpiOsPrintf ( + " * Disassembling to symbolic ASL+ operators\n" + " *\n"); + } + else + { + AcpiOsPrintf ( + " * Disassembling to non-symbolic legacy ASL operators\n" + " *\n"); + } } AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); @@ -609,7 +620,7 @@ AdCreateTableHeader ( /* * Print file header and dump original table header */ - AdDisassemblerHeader (Filename); + AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE); AcpiOsPrintf (" * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); @@ -717,7 +728,7 @@ AdDisplayTables ( return (AE_NOT_EXIST); } - if (!AcpiGbl_DbOpt_verbose) + if (!AcpiGbl_DbOpt_Verbose) { AdCreateTableHeader (Filename, Table); } @@ -725,7 +736,7 @@ AdDisplayTables ( AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); MpEmitMappingInfo (); - if (AcpiGbl_DbOpt_verbose) + if (AcpiGbl_DbOpt_Verbose) { AcpiOsPrintf ("\n\nTable Header:\n"); AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), @@ -740,6 +751,43 @@ AdDisplayTables ( } +/******************************************************************************* + * + * FUNCTION: AdStoreTable + * + * PARAMETERS: Table - Table header + * TableIndex - Where the table index is returned + * + * RETURN: Status and table index. + * + * DESCRIPTION: Add an ACPI table to the global table list + * + ******************************************************************************/ + +static ACPI_STATUS +AdStoreTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex) +{ + ACPI_STATUS Status; + ACPI_TABLE_DESC *TableDesc; + + + Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Initialize added table */ + + AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table); + AcpiTbValidateTable (TableDesc); + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: AdGetLocalTables @@ -777,8 +825,7 @@ AdGetLocalTables ( /* Store DSDT in the Table Manager */ - Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, - 0, &TableIndex); + Status = AdStoreTable (NewTable, &TableIndex); if (ACPI_FAILURE (Status)) { fprintf (stderr, "Could not store DSDT\n"); @@ -871,9 +918,7 @@ AdParseTable ( if (LoadTable) { - Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, - &TableIndex); + Status = AdStoreTable (Table, &TableIndex); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index d33d86f..b1875f8 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -241,13 +241,6 @@ static const char *AcpiDmPmttSubnames[] = "Unknown SubTable Type" /* Reserved */ }; -static const char *AcpiDmSlicSubnames[] = -{ - "Public Key Structure", - "Windows Marker Structure", - "Unknown SubTable Type" /* Reserved */ -}; - static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", @@ -339,6 +332,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, + {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm, "Microsoft Data Management table"}, {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, @@ -515,10 +509,20 @@ AcpiDmDumpDataTable ( } else { - AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n", + AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n", Table->Signature); - fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n", + + fprintf (stderr, "Unknown ACPI table signature [%4.4s], ", Table->Signature); + + if (!AcpiGbl_ForceAmlDisassembly) + { + fprintf (stderr, "decoding ACPI table header only\n"); + } + else + { + fprintf (stderr, "assuming table contains valid AML code\n"); + } } } else if (TableData->TableHandler) @@ -686,6 +690,7 @@ AcpiDmDumpTable ( UINT32 ByteLength; UINT8 Temp8; UINT16 Temp16; + UINT32 Temp32; UINT64 Value; ACPI_DMTABLE_DATA *TableData; const char *Name; @@ -715,7 +720,8 @@ AcpiDmDumpTable ( if ((CurrentOffset >= TableLength) || (SubtableLength && (Info->Offset >= SubtableLength))) { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + AcpiOsPrintf ( + "**** ACPI table terminates in the middle of a data structure! (dump table)\n"); return (AE_BAD_DATA); } @@ -760,7 +766,6 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT32: case ACPI_DMT_NAME4: case ACPI_DMT_SIG: - case ACPI_DMT_SLIC: case ACPI_DMT_LPIT: ByteLength = 4; @@ -805,6 +810,12 @@ AcpiDmDumpTable ( ByteLength = 128; break; + case ACPI_DMT_BUFFER: + case ACPI_DMT_RAW_BUFFER: + + ByteLength = SubtableLength; + break; + case ACPI_DMT_STRING: ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; @@ -838,7 +849,8 @@ AcpiDmDumpTable ( if (CurrentOffset + ByteLength > TableLength) { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + AcpiOsPrintf ( + "**** ACPI table terminates in the middle of a data structure!\n"); return (AE_BAD_DATA); } @@ -1005,8 +1017,9 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%2.2X", *Target); Temp8 = AcpiDmGenerateChecksum (Table, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); + ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum); + if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum) { AcpiOsPrintf ( @@ -1032,7 +1045,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_GAS_WIDTH_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGasAccessWidth[Temp8]); break; case ACPI_DMT_GAS: @@ -1069,7 +1082,8 @@ AcpiDmDumpTable ( Temp16 = ACPI_DMAR_TYPE_RESERVED; } - AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), + AcpiDmDmarSubnames[Temp16]); break; case ACPI_DMT_DMAR_SCOPE: @@ -1082,7 +1096,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmDmarScope[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmDmarScope[Temp8]); break; case ACPI_DMT_EINJACT: @@ -1095,7 +1110,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_ACTION_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmEinjActions[Temp8]); break; case ACPI_DMT_EINJINST: @@ -1108,7 +1124,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmEinjInstructions[Temp8]); break; case ACPI_DMT_ERSTACT: @@ -1121,7 +1138,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_ACTION_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmErstActions[Temp8]); break; case ACPI_DMT_ERSTINST: @@ -1134,7 +1152,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmErstInstructions[Temp8]); break; case ACPI_DMT_GTDT: @@ -1147,7 +1166,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_GTDT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGtdtSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmGtdtSubnames[Temp8]); break; case ACPI_DMT_HEST: @@ -1160,12 +1180,15 @@ AcpiDmDumpTable ( Temp16 = ACPI_HEST_TYPE_RESERVED; } - AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), + AcpiDmHestSubnames[Temp16]); break; case ACPI_DMT_HESTNTFY: - AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure"); + AcpiOsPrintf (STRING_FORMAT, + "Hardware Error Notification Structure"); + AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); AcpiOsPrintf ("\n"); @@ -1182,7 +1205,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_HEST_NOTIFY_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmHestNotifySubnames[Temp8]); break; case ACPI_DMT_MADT: @@ -1195,7 +1219,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_MADT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmMadtSubnames[Temp8]); break; case ACPI_DMT_PCCT: @@ -1208,7 +1233,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_PCCT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPcctSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmPcctSubnames[Temp8]); break; case ACPI_DMT_PMTT: @@ -1221,20 +1247,20 @@ AcpiDmDumpTable ( Temp8 = ACPI_PMTT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmPmttSubnames[Temp8]); break; - case ACPI_DMT_SLIC: - - /* SLIC subtable types */ - - Temp8 = *Target; - if (Temp8 > ACPI_SLIC_TYPE_RESERVED) - { - Temp8 = ACPI_SLIC_TYPE_RESERVED; - } + case ACPI_DMT_RAW_BUFFER: + /* + * Currently only used for SLIC table + */ + AcpiOsPrintf ("/* Proprietary data structure */ "); - AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]); + AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER), + ByteLength, sizeof (ACPI_TABLE_HEADER), + "Licensing Data", TRUE); + AcpiOsPrintf ("\n"); break; case ACPI_DMT_SRAT: @@ -1247,7 +1273,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_SRAT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmSratSubnames[Temp8]); break; case ACPI_DMT_FADTPM: @@ -1260,7 +1287,8 @@ AcpiDmDumpTable ( Temp8 = ACPI_FADT_PM_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmFadtProfiles[Temp8]); break; case ACPI_DMT_IVRS: @@ -1295,26 +1323,14 @@ AcpiDmDumpTable ( /* LPIT subtable types */ - Temp8 = *Target; - switch (Temp8) + Temp32 = ACPI_GET32 (Target); + if (Temp32 > ACPI_LPIT_TYPE_RESERVED) { - case ACPI_LPIT_TYPE_NATIVE_CSTATE: - - Name = AcpiDmLpitSubnames[0]; - break; - - case ACPI_LPIT_TYPE_SIMPLE_IO: - - Name = AcpiDmLpitSubnames[1]; - break; - - default: - - Name = AcpiDmLpitSubnames[2]; - break; + Temp32 = ACPI_LPIT_TYPE_RESERVED; } - AcpiOsPrintf (UINT32_FORMAT, *Target, Name); + AcpiOsPrintf (UINT32_FORMAT, ACPI_GET32 (Target), + AcpiDmLpitSubnames[Temp32]); break; case ACPI_DMT_EXIT: @@ -1331,8 +1347,10 @@ AcpiDmDumpTable ( if (TableOffset && !SubtableLength) { - /* If this table is not the main table, subtable must have valid length */ - + /* + * If this table is not the main table, the subtable must have a + * valid length + */ AcpiOsPrintf ("Invalid zero length subtable\n"); return (AE_BAD_DATA); } diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 399afa5..8a44328 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -59,14 +59,6 @@ AcpiDmValidateFadtLength ( UINT32 Revision, UINT32 Length); -static void -AcpiDmDumpBuffer ( - void *Table, - UINT32 BufferOffset, - UINT32 Length, - UINT32 AbsoluteOffset, - char *Header); - /******************************************************************************* * @@ -78,6 +70,7 @@ AcpiDmDumpBuffer ( * AbsoluteOffset - Offset of buffer in the main ACPI table * Header - Name of the buffer field (printed on the * first line only.) + * MultiLine - TRUE if a large, multi-line buffer * * RETURN: None * @@ -86,13 +79,14 @@ AcpiDmDumpBuffer ( * ******************************************************************************/ -static void +void AcpiDmDumpBuffer ( void *Table, UINT32 BufferOffset, UINT32 Length, UINT32 AbsoluteOffset, - char *Header) + char *Header, + BOOLEAN MultiLine) { UINT8 *Buffer; UINT32 i; @@ -110,10 +104,19 @@ AcpiDmDumpBuffer ( { if (!(i % 16)) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (AbsoluteOffset, - ((Length - i) > 16) ? 16 : (Length - i), Header); - Header = NULL; + if (MultiLine) + { + /* Insert a backslash - line continuation character */ + + AcpiOsPrintf ("\\\n "); + } + else + { + AcpiOsPrintf ("\n"); + AcpiDmLineHeader (AbsoluteOffset, + ((Length - i) > 16) ? 16 : (Length - i), Header); + Header = NULL; + } } AcpiOsPrintf ("%.02X ", *Buffer); @@ -526,7 +529,7 @@ AcpiDmDumpAsf ( DataOffset++; if (DataOffset > Table->Length) { - AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure! (ASF! table)\n"); return; } } @@ -692,7 +695,7 @@ AcpiDmDumpCsrt ( InfoLength = SubSubTable->Length - SubSubOffset; AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength, - Offset + SubOffset + SubSubOffset, "ResourceInfo"); + Offset + SubOffset + SubSubOffset, "ResourceInfo", FALSE); SubSubOffset += InfoLength; /* Point to next sub-subtable */ @@ -812,7 +815,7 @@ AcpiDmDumpDbg2 ( if (SubTable->OemDataOffset) { AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, - Offset + SubTable->OemDataOffset, "OEM Data"); + Offset + SubTable->OemDataOffset, "OEM Data", FALSE); } /* Point to next subtable */ @@ -2535,67 +2538,8 @@ void AcpiDmDumpSlic ( ACPI_TABLE_HEADER *Table) { - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_SLIC); - ACPI_SLIC_HEADER *SubTable; - ACPI_DMTABLE_INFO *InfoTable; - - - /* There is no main SLIC table, only subtables */ - - SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset); - while (Offset < Table->Length) - { - /* Common subtable header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoSlicHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - - switch (SubTable->Type) - { - case ACPI_SLIC_TYPE_PUBLIC_KEY: - - InfoTable = AcpiDmTableInfoSlic0; - break; - - case ACPI_SLIC_TYPE_WINDOWS_MARKER: - - InfoTable = AcpiDmTableInfoSlic1; - break; - - default: - - AcpiOsPrintf ("\n**** Unknown SLIC subtable type 0x%X\n", SubTable->Type); - - /* Attempt to continue */ - - if (!SubTable->Length) - { - AcpiOsPrintf ("Invalid zero length subtable\n"); - return; - } - goto NextSubTable; - } - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); - if (ACPI_FAILURE (Status)) - { - return; - } - -NextSubTable: - /* Point to next subtable */ - - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length); - } + AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table, + Table->Length - sizeof (*Table), AcpiDmTableInfoSlic); } diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index 6a71c8a..4ce802b 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -200,9 +200,7 @@ #define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_HEADER,f) #define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f) #define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) -#define ACPI_SLICH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_HEADER,f) -#define ACPI_SLIC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_KEY,f) -#define ACPI_SLIC1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_MARKER,f) +#define ACPI_SLIC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIC,f) #define ACPI_SRATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) #define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) @@ -2043,42 +2041,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = /******************************************************************************* * - * SLIC - Software Licensing Description Table. There is no common table, just - * the standard ACPI header and then subtables. + * SLIC - Software Licensing Description Table. This table contains the standard + * ACPI header followed by proprietary data structures * ******************************************************************************/ -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[] = -{ - {ACPI_DMT_SLIC, ACPI_SLICH_OFFSET (Type), "Subtable Type", 0}, - {ACPI_DMT_UINT32, ACPI_SLICH_OFFSET (Length), "Length", DT_LENGTH}, - ACPI_DMT_TERMINATOR -}; - -ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[] = -{ - {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (KeyType), "Key Type", 0}, - {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (Version), "Version", 0}, - {ACPI_DMT_UINT16, ACPI_SLIC0_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Algorithm), "Algorithm", 0}, - {ACPI_DMT_NAME4, ACPI_SLIC0_OFFSET (Magic), "Magic", 0}, - {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (BitLength), "BitLength", 0}, - {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Exponent), "Exponent", 0}, - {ACPI_DMT_BUF128, ACPI_SLIC0_OFFSET (Modulus[0]), "Modulus", 0}, - ACPI_DMT_TERMINATOR -}; +/* Single subtable, a proprietary format, so treat it as a buffer */ -ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = { - {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (Version), "Version", 0}, - {ACPI_DMT_NAME6, ACPI_SLIC1_OFFSET (OemId[0]), "Oem ID", 0}, - {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (OemTableId[0]), "Oem Table ID", 0}, - {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (WindowsFlag[0]), "Windows Flag", 0}, - {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (SlicVersion), "SLIC Version", 0}, - {ACPI_DMT_BUF16, ACPI_SLIC1_OFFSET (Reserved[0]), "Reserved", 0}, - {ACPI_DMT_BUF128, ACPI_SLIC1_OFFSET (Signature[0]), "Signature", 0}, + {ACPI_DMT_RAW_BUFFER, 0, "Software Licensing Structure", 0}, ACPI_DMT_TERMINATOR }; @@ -2091,7 +2063,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] = { - {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities", 0}, + {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities", 0}, ACPI_DMT_TERMINATOR }; diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index 541236a..8dd30f3 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -460,7 +460,7 @@ CgWriteTableHeader ( /* Compiler version */ - TableHeader.AslCompilerRevision = ASL_REVISION; + TableHeader.AslCompilerRevision = ACPI_CA_VERSION; /* Table length. Checksum zero for now, will rewrite later */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index cf37c6a..0b0ca7a 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -195,8 +195,16 @@ CmDoCompile ( Event = UtBeginEvent ("Constant folding via AML interpreter"); DbgPrint (ASL_DEBUG_OUTPUT, "\nInterpreting compile-time constant expressions\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - OpcAmlConstantWalk, NULL, NULL); + + if (Gbl_FoldConstants) + { + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + OpcAmlConstantWalk, NULL, NULL); + } + else + { + DbgPrint (ASL_PARSE_OUTPUT, " Optional folding disabled\n"); + } UtEndEvent (Event); /* Update AML opcodes if necessary, after constant folding */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 7fb2088..7b07295 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -686,6 +686,10 @@ TrAllocateNode ( UINT32 ParseOpcode); void +TrPrintNodeCompileFlags ( + UINT32 Flags); + +void TrReleaseNode ( ACPI_PARSE_OBJECT *Op); @@ -705,6 +709,10 @@ TrCreateLeafNode ( UINT32 ParseOpcode); ACPI_PARSE_OBJECT * +TrCreateNullTarget ( + void); + +ACPI_PARSE_OBJECT * TrCreateAssignmentNode ( ACPI_PARSE_OBJECT *Target, ACPI_PARSE_OBJECT *Source); diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index f639ecc..14307c1 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -48,7 +48,6 @@ /* * Compiler versions and names */ -#define ASL_REVISION ACPI_CA_VERSION #define ASL_COMPILER_NAME "ASL+ Optimizing Compiler" #define AML_DISASSEMBLER_NAME "AML/ASL+ Disassembler" #define ASL_INVOCATION_NAME "iasl" diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index b8038ec..26b786d 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -76,97 +76,125 @@ OpcUpdateIntegerNode ( ACPI_PARSE_OBJECT *Op, UINT64 Value); +static ACPI_STATUS +TrTransformToStoreOp ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +static ACPI_STATUS +TrSimpleConstantReduction ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + +static void +TrInstallReducedConstant ( + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT *ObjDesc); + /******************************************************************************* * - * FUNCTION: OpcAmlEvaluationWalk1 + * FUNCTION: OpcAmlConstantWalk * * PARAMETERS: ASL_WALK_CALLBACK * * RETURN: Status * - * DESCRIPTION: Descending callback for AML execution of constant subtrees + * DESCRIPTION: Reduce an Op and its subtree to a constant if possible * ******************************************************************************/ -static ACPI_STATUS -OpcAmlEvaluationWalk1 ( +ACPI_STATUS +OpcAmlConstantWalk ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *OutOp; + ACPI_WALK_STATE *WalkState; + ACPI_STATUS Status = AE_OK; - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ + if (Op->Asl.CompileFlags == 0) + { + return (AE_OK); + } - if (Op->Asl.Child) + /* + * Only interested in subtrees that could possibly contain + * expressions that can be evaluated at this time + */ + if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) || + (Op->Asl.CompileFlags & NODE_IS_TARGET)) { - Op->Common.Value.Arg = Op->Asl.Child; + return (AE_OK); } - /* Call AML dispatcher */ + /* Create a new walk state */ - Status = AcpiDsExecBeginOp (WalkState, &OutOp); - if (ACPI_FAILURE (Status)) + WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + if (!WalkState) { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); + return (AE_NO_MEMORY); } - return (Status); -} + WalkState->NextOp = NULL; + WalkState->Params = NULL; + /* + * Examine the entire subtree -- all nodes must be constants + * or type 3/4/5 opcodes + */ + Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD, + OpcAmlCheckForConstant, NULL, WalkState); -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk2 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for AML execution of constant subtrees - * - ******************************************************************************/ + /* + * Did we find an entire subtree that contains all constants + * and type 3/4/5 opcodes? + */ + switch (Status) + { + case AE_OK: -static ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; + /* Simple case, like Add(3,4) -> 7 */ + Status = TrSimpleConstantReduction (Op, WalkState); + break; - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + case AE_CTRL_RETURN_VALUE: - /* Copy child pointer to Arg for compatibility with Interpreter */ + /* More complex case, like Add(3,4,Local0) -> Store(7,Local0) */ - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } + Status = TrTransformToStoreOp (Op, WalkState); + break; - /* Call AML dispatcher */ + case AE_TYPE: + + AcpiDsDeleteWalkState (WalkState); + return (AE_OK); + + default: + AcpiDsDeleteWalkState (WalkState); + break; + } - Status = AcpiDsExecEndOp (WalkState); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); + DbgPrint (ASL_PARSE_OUTPUT, "Cannot resolve, %s\n", + AcpiFormatException (Status)); + + /* We could not resolve the subtree for some reason */ + + AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, + (char *) AcpiFormatException (Status)); + + /* Set the subtree value to ZERO anyway. Eliminates further errors */ + + OpcUpdateIntegerNode (Op, 0); } - return (Status); + /* Abort the walk of this subtree, we are done with it */ + + return (AE_CTRL_DEPTH); } @@ -189,6 +217,7 @@ OpcAmlCheckForConstant ( void *Context) { ACPI_WALK_STATE *WalkState = Context; + ACPI_STATUS Status = AE_OK; WalkState->Op = Op; @@ -196,7 +225,20 @@ OpcAmlCheckForConstant ( WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", - Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); + Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); + + /* + * TBD: Ignore buffer constants for now. The problem is that these + * constants have been transformed into RAW_DATA at this point, from + * the parse tree transform process which currently happens before + * the constant folding process. We may need to defer this transform + * for buffer until after the constant folding. + */ + if (WalkState->Opcode == AML_BUFFER_OP) + { + Status = AE_TYPE; + goto CleanupAndExit; + } /* * These opcodes do not appear in the OpcodeInfo table, but @@ -207,50 +249,32 @@ OpcAmlCheckForConstant ( (WalkState->Opcode == AML_RAW_DATA_DWORD) || (WalkState->Opcode == AML_RAW_DATA_QWORD)) { - WalkState->WalkType = ACPI_WALK_CONST_OPTIONAL; - return (AE_TYPE); + DbgPrint (ASL_PARSE_OUTPUT, "RAW DATA"); + Status = AE_TYPE; + goto CleanupAndExit; } + /* Type 3/4/5 opcodes have the AML_CONSTANT flag set */ + if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) { - /* The opcode is not a Type 3/4/5 opcode */ + /* Not 3/4/5 opcode, but maybe can convert to STORE */ if (Op->Asl.CompileFlags & NODE_IS_TARGET) { DbgPrint (ASL_PARSE_OUTPUT, - "**** Valid Target, cannot reduce ****\n"); - } - else - { - DbgPrint (ASL_PARSE_OUTPUT, - "**** Not a Type 3/4/5 opcode ****\n"); + "**** Valid Target, transform to Store ****\n"); + return (AE_CTRL_RETURN_VALUE); } - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - /* - * We are looking at at normal expression to see if it can be - * reduced. It can't. No error - */ - return (AE_TYPE); - } + /* Expression cannot be reduced */ - /* - * This is an expression that MUST reduce to a constant, and it - * can't be reduced. This is an error - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, - Op->Asl.ParseOpName); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, - Op->Asl.ParseOpName); - } + DbgPrint (ASL_PARSE_OUTPUT, + "**** Not a Type 3/4/5 opcode (%s) ****", + Op->Asl.ParseOpName); - return (AE_TYPE); + Status = AE_TYPE; + goto CleanupAndExit; } /* Debug output */ @@ -259,250 +283,346 @@ OpcAmlCheckForConstant ( if (Op->Asl.CompileFlags & NODE_IS_TARGET) { - DbgPrint (ASL_PARSE_OUTPUT, " TARGET"); + if (Op->Asl.ParseOpcode == PARSEOP_ZERO) + { + DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " NULL TARGET"); + } + else + { + DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " VALID TARGET"); + } } if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) { - DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); + DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " TERMARG"); } +CleanupAndExit: + + /* Dump the node compile flags also */ + + TrPrintNodeCompileFlags (Op->Asl.CompileFlags); DbgPrint (ASL_PARSE_OUTPUT, "\n"); - return (AE_OK); + return (Status); } /******************************************************************************* * - * FUNCTION: OpcAmlConstantWalk + * FUNCTION: TrSimpleConstantReduction * - * PARAMETERS: ASL_WALK_CALLBACK + * PARAMETERS: Op - Parent operator to be transformed + * WalkState - Current walk state * * RETURN: Status * - * DESCRIPTION: Reduce an Op and its subtree to a constant if possible + * DESCRIPTION: Reduce an entire AML operation to a single constant. The + * operation must not have a target operand. + * + * Add (32,64) --> 96 * ******************************************************************************/ -ACPI_STATUS -OpcAmlConstantWalk ( +static ACPI_STATUS +TrSimpleConstantReduction ( ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) + ACPI_WALK_STATE *WalkState) { - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *RootOp; ACPI_PARSE_OBJECT *OriginalParentOp; - UINT8 WalkType; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; - /* - * Only interested in subtrees that could possibly contain - * expressions that can be evaluated at this time - */ - if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) || - (Op->Asl.CompileFlags & NODE_IS_TARGET)) + DbgPrint (ASL_PARSE_OUTPUT, + "Simple subtree constant reduction, operator to constant\n"); + + /* Allocate a new temporary root for this subtree */ + + RootOp = TrAllocateNode (PARSEOP_INTEGER); + if (!RootOp) { - return (AE_OK); + return (AE_NO_MEMORY); } - /* Set the walk type based on the reduction used for this op */ + RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - /* Op is a TermArg, constant folding is merely optional */ + OriginalParentOp = Op->Common.Parent; + Op->Common.Parent = RootOp; - if (!Gbl_FoldConstants) - { - return (AE_CTRL_DEPTH); - } + /* Hand off the subtree to the AML interpreter */ - WalkType = ACPI_WALK_CONST_OPTIONAL; - } - else - { - /* Op is a DataObject, the expression MUST reduced to a constant */ + WalkState->CallerReturnDesc = &ObjDesc; + + Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, + OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); + + /* Restore original parse tree */ + + Op->Common.Parent = OriginalParentOp; - WalkType = ACPI_WALK_CONST_REQUIRED; + if (ACPI_FAILURE (Status)) + { + DbgPrint (ASL_PARSE_OUTPUT, + "Constant Subtree evaluation(1), %s\n", + AcpiFormatException (Status)); + return (Status); } - /* Create a new walk state */ + /* Get the final result */ - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) + Status = AcpiDsResultPop (&ObjDesc, WalkState); + if (ACPI_FAILURE (Status)) { - return (AE_NO_MEMORY); + DbgPrint (ASL_PARSE_OUTPUT, + "Constant Subtree evaluation(2), %s\n", + AcpiFormatException (Status)); + return (Status); } - WalkState->NextOp = NULL; - WalkState->Params = NULL; - WalkState->WalkType = WalkType; - WalkState->CallerReturnDesc = &ObjDesc; + TrInstallReducedConstant (Op, ObjDesc); - /* - * Examine the entire subtree -- all nodes must be constants - * or type 3/4/5 opcodes - */ - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD, - OpcAmlCheckForConstant, NULL, WalkState); + UtSetParseOpName (Op); + Op->Asl.Child = NULL; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: TrTransformToStoreOp + * + * PARAMETERS: Op - Parent operator to be transformed + * WalkState - Current walk state + * + * RETURN: Status + * + * DESCRIPTION: Transforms a single AML operation with a constant and target + * to a simple store operation: + * + * Add (32,64,DATA) --> Store (96,DATA) + * + ******************************************************************************/ + +static ACPI_STATUS +TrTransformToStoreOp ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + ACPI_PARSE_OBJECT *OriginalTarget; + ACPI_PARSE_OBJECT *NewTarget; + ACPI_PARSE_OBJECT *Child1; + ACPI_PARSE_OBJECT *Child2; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_PARSE_OBJECT *NewParent; + ACPI_PARSE_OBJECT *OriginalParent; + ACPI_STATUS Status; + + + DbgPrint (ASL_PARSE_OUTPUT, + "Reduction/Transform to StoreOp: Store(Constant, Target)\n"); + + /* Extract the operands */ + + Child1 = Op->Asl.Child; + Child2 = Child1->Asl.Next; /* - * Did we find an entire subtree that contains all constants and type 3/4/5 - * opcodes? (Only AE_OK or AE_TYPE returned from above) + * Special case for DIVIDE -- it has two targets. The first + * is for the remainder and if present, we will not attempt + * to reduce the expression. */ - if (Status == AE_TYPE) + if (Op->Asl.ParseOpcode == PARSEOP_DIVIDE) { - /* Subtree cannot be reduced to a constant */ - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) + Child2 = Child2->Asl.Next; + if (Child2->Asl.ParseOpcode != PARSEOP_ZERO) { - AcpiDsDeleteWalkState (WalkState); + DbgPrint (ASL_PARSE_OUTPUT, + "Cannot reduce DIVIDE - has two targets\n\n"); return (AE_OK); } + } + + /* + * Create a NULL (zero) target so that we can use the + * interpreter to evaluate the expression. + */ + NewTarget = TrCreateNullTarget (); + NewTarget->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - /* Don't descend any further, and use a default "constant" value */ + /* Handle one-operand cases (NOT, TOBCD, etc.) */ - Status = AE_CTRL_DEPTH; + if (!Child2->Asl.Next) + { + Child2 = Child1; } - else + + /* Link in new NULL target as the last operand */ + + OriginalTarget = Child2->Asl.Next; + Child2->Asl.Next = NewTarget; + NewTarget->Asl.Parent = OriginalTarget->Asl.Parent; + + NewParent = TrAllocateNode (PARSEOP_INTEGER); + NewParent->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; + + OriginalParent = Op->Common.Parent; + Op->Common.Parent = NewParent; + + /* Hand off the subtree to the AML interpreter */ + + WalkState->CallerReturnDesc = &ObjDesc; + + Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, + OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); + if (ACPI_FAILURE (Status)) { - /* Subtree can be reduced */ + DbgPrint (ASL_PARSE_OUTPUT, + "Constant Subtree evaluation(3), %s\n", + AcpiFormatException (Status)); + goto EvalError; + } - /* Allocate a new temporary root for this subtree */ + /* Get the final result */ - RootOp = TrAllocateNode (PARSEOP_INTEGER); - if (!RootOp) - { - return (AE_NO_MEMORY); - } + Status = AcpiDsResultPop (&ObjDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + DbgPrint (ASL_PARSE_OUTPUT, + "Constant Subtree evaluation(4), %s\n", + AcpiFormatException (Status)); + goto EvalError; + } - RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; + /* Folded constant is in ObjDesc, store into Child1 */ - OriginalParentOp = Op->Common.Parent; - Op->Common.Parent = RootOp; + TrInstallReducedConstant (Child1, ObjDesc); - /* Hand off the subtree to the AML interpreter */ + /* Convert operator to STORE */ - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, - OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); - Op->Common.Parent = OriginalParentOp; + Op->Asl.ParseOpcode = PARSEOP_STORE; + Op->Asl.AmlOpcode = AML_STORE_OP; + UtSetParseOpName (Op); + Op->Common.Parent = OriginalParent; - /* TBD: we really *should* release the RootOp node */ + /* Truncate any subtree expressions, they have been evaluated */ - if (ACPI_SUCCESS (Status)) - { - TotalFolds++; + Child1->Asl.Child = NULL; + Child2->Asl.Child = NULL; - /* Get the final result */ + /* First child is the folded constant */ - Status = AcpiDsResultPop (&ObjDesc, WalkState); - } + /* Second child will be the target */ - /* Check for error from the ACPICA core */ + Child1->Asl.Next = OriginalTarget; + return (AE_OK); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, - "Failure during constant evaluation", FALSE); - } - } - if (ACPI_FAILURE (Status)) - { - /* We could not resolve the subtree for some reason */ +EvalError: - AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, - Op->Asl.ParseOpName); + /* Restore original links */ - /* Set the subtree value to ZERO anyway. Eliminates further errors */ + Op->Common.Parent = OriginalParent; + Child2->Asl.Next = OriginalTarget; + return (Status); +} - OpcUpdateIntegerNode (Op, 0); - } - else - { - AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, - Op->Asl.ParseOpName); - - /* - * Because we know we executed type 3/4/5 opcodes above, we know that - * the result must be either an Integer, String, or Buffer. - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value); +/******************************************************************************* + * + * FUNCTION: TrInstallReducedConstant + * + * PARAMETERS: Op - Parent operator to be transformed + * ObjDesc - Reduced constant to be installed + * + * RETURN: None + * + * DESCRIPTION: Transform the original operator to a simple constant. + * Handles Integers, Strings, and Buffers. + * + ******************************************************************************/ + +static void +TrInstallReducedConstant ( + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_PARSE_OBJECT *RootOp; - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (%s) %8.8X%8.8X\n", - Op->Asl.ParseOpName, - ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); - break; - case ACPI_TYPE_STRING: + TotalFolds++; + AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, + Op->Asl.ParseOpName); - Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Op->Common.AmlOpcode = AML_STRING_OP; - Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; - Op->Common.Value.String = ObjDesc->String.Pointer; + /* + * Because we know we executed type 3/4/5 opcodes above, we know that + * the result must be either an Integer, String, or Buffer. + */ + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_INTEGER: - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (STRING) %s\n", - Op->Common.Value.String); + OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value); - break; + DbgPrint (ASL_PARSE_OUTPUT, + "Constant expression reduced to (%s) %8.8X%8.8X\n\n", + Op->Asl.ParseOpName, + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); + break; - case ACPI_TYPE_BUFFER: + case ACPI_TYPE_STRING: - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE; - UtSetParseOpName (Op); + Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; + Op->Common.AmlOpcode = AML_STRING_OP; + Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; + Op->Common.Value.String = ObjDesc->String.Pointer; - /* Child node is the buffer length */ + DbgPrint (ASL_PARSE_OUTPUT, + "Constant expression reduced to (STRING) %s\n\n", + Op->Common.Value.String); - RootOp = TrAllocateNode (PARSEOP_INTEGER); + break; - RootOp->Asl.AmlOpcode = AML_DWORD_OP; - RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; + case ACPI_TYPE_BUFFER: - (void) OpcSetOptimalIntegerSize (RootOp); + Op->Asl.ParseOpcode = PARSEOP_BUFFER; + Op->Common.AmlOpcode = AML_BUFFER_OP; + Op->Asl.CompileFlags = NODE_AML_PACKAGE; + UtSetParseOpName (Op); - Op->Asl.Child = RootOp; - Op = RootOp; - UtSetParseOpName (Op); + /* Child node is the buffer length */ - /* Peer to the child is the raw buffer data */ + RootOp = TrAllocateNode (PARSEOP_INTEGER); - RootOp = TrAllocateNode (PARSEOP_RAW_DATA); - RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - RootOp->Asl.AmlLength = ObjDesc->Buffer.Length; - RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer; - RootOp->Asl.Parent = Op->Asl.Parent; + RootOp->Asl.AmlOpcode = AML_DWORD_OP; + RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; + RootOp->Asl.Parent = Op; - Op->Asl.Next = RootOp; - Op = RootOp; + (void) OpcSetOptimalIntegerSize (RootOp); - DbgPrint (ASL_PARSE_OUTPUT, - "Constant expression reduced to (BUFFER) length %X\n", - ObjDesc->Buffer.Length); - break; + Op->Asl.Child = RootOp; + Op = RootOp; + UtSetParseOpName (Op); - default: + /* Peer to the child is the raw buffer data */ - printf ("Unsupported return type: %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); - break; - } - } + RootOp = TrAllocateNode (PARSEOP_RAW_DATA); + RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + RootOp->Asl.AmlLength = ObjDesc->Buffer.Length; + RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer; + RootOp->Asl.Parent = Op->Asl.Parent; - UtSetParseOpName (Op); - Op->Asl.Child = NULL; + Op->Asl.Next = RootOp; + Op = RootOp; - AcpiDsDeleteWalkState (WalkState); - return (AE_CTRL_DEPTH); + DbgPrint (ASL_PARSE_OUTPUT, + "Constant expression reduced to (BUFFER) length %X\n\n", + ObjDesc->Buffer.Length); + break; + + default: + break; + } } @@ -511,10 +631,11 @@ OpcAmlConstantWalk ( * FUNCTION: OpcUpdateIntegerNode * * PARAMETERS: Op - Current parse object + * Value - Value for the integer op * * RETURN: None * - * DESCRIPTION: Update node to the correct integer type. + * DESCRIPTION: Update node to the correct Integer type and value * ******************************************************************************/ @@ -566,3 +687,98 @@ OpcUpdateIntegerNode ( Op->Asl.AmlLength = 0; } + + +/******************************************************************************* + * + * FUNCTION: OpcAmlEvaluationWalk1 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Descending callback for AML execution of constant subtrees + * + ******************************************************************************/ + +static ACPI_STATUS +OpcAmlEvaluationWalk1 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_WALK_STATE *WalkState = Context; + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *OutOp; + + + WalkState->Op = Op; + WalkState->Opcode = Op->Common.AmlOpcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + + /* Copy child pointer to Arg for compatibility with Interpreter */ + + if (Op->Asl.Child) + { + Op->Common.Value.Arg = Op->Asl.Child; + } + + /* Call AML dispatcher */ + + Status = AcpiDsExecBeginOp (WalkState, &OutOp); + if (ACPI_FAILURE (Status)) + { + DbgPrint (ASL_PARSE_OUTPUT, + "%s Constant interpretation failed (1) - %s\n", + Op->Asl.ParseOpName, AcpiFormatException (Status)); + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: OpcAmlEvaluationWalk2 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Ascending callback for AML execution of constant subtrees + * + ******************************************************************************/ + +static ACPI_STATUS +OpcAmlEvaluationWalk2 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_WALK_STATE *WalkState = Context; + ACPI_STATUS Status; + + + WalkState->Op = Op; + WalkState->Opcode = Op->Common.AmlOpcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + + /* Copy child pointer to Arg for compatibility with Interpreter */ + + if (Op->Asl.Child) + { + Op->Common.Value.Arg = Op->Asl.Child; + } + + /* Call AML dispatcher */ + + Status = AcpiDsExecEndOp (WalkState); + if (ACPI_FAILURE (Status)) + { + DbgPrint (ASL_PARSE_OUTPUT, + "%s: Constant interpretation failed (2) - %s\n", + Op->Asl.ParseOpName, AcpiFormatException (Status)); + } + + return (Status); +} diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index 9c51a93..a8fe2de 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -270,7 +270,10 @@ LsTreeWriteWalk ( UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - DbgPrint (ASL_TREE_OUTPUT, " (%.4X)\n", Op->Asl.ParseOpcode); + DbgPrint (ASL_TREE_OUTPUT, " (%.4X) Flags %8.8X", + Op->Asl.ParseOpcode, Op->Asl.CompileFlags); + TrPrintNodeCompileFlags (Op->Asl.CompileFlags); + DbgPrint (ASL_TREE_OUTPUT, "\n"); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index d7ba1ae..99745ad 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -187,6 +187,7 @@ Usage ( ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-dc ", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); + ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML"); ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)"); ACPI_OPTION ("-e ", "Include ACPI table(s) for external symbol resolution"); ACPI_OPTION ("-fe ", "Specify external symbol declaration file"); diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index 3d0e327..90252cb 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -222,7 +222,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* EXTENDEDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* EXTENDEDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* EXTENDEDSPACE */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* EXTERNAL */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* EXTERNAL */ OP_TABLE_ENTRY (AML_EXTERNAL_OP, 0, 0, 0), /* FATAL */ OP_TABLE_ENTRY (AML_FATAL_OP, 0, 0, 0), /* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0), /* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), diff --git a/sys/contrib/dev/acpica/compiler/aslmapenter.c b/sys/contrib/dev/acpica/compiler/aslmapenter.c index a75ff33..87ad28a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmapenter.c +++ b/sys/contrib/dev/acpica/compiler/aslmapenter.c @@ -216,6 +216,7 @@ MpCreateGpioInfo ( ACPI_GPIO_INFO *Info; ACPI_GPIO_INFO *NextGpio; ACPI_GPIO_INFO *PrevGpio; + char *Buffer; /* @@ -223,8 +224,8 @@ MpCreateGpioInfo ( * sorted by both source device name and then the pin number. There is * one block per pin. */ - Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, - UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO))); + Buffer = UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO)); + Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer); NextGpio = Gbl_GpioList; PrevGpio = NULL; @@ -293,14 +294,15 @@ MpCreateSerialInfo ( ACPI_SERIAL_INFO *Info; ACPI_SERIAL_INFO *NextSerial; ACPI_SERIAL_INFO *PrevSerial; + char *Buffer; /* * Allocate a new info block and insert it into the global Serial list * sorted by both source device name and then the address. */ - Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, - UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO))); + Buffer = UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO)); + Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer); NextSerial = Gbl_SerialList; PrevSerial = NULL; diff --git a/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index 5868d98..cc20bcd 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/compiler/asloptions.c @@ -274,6 +274,11 @@ AslDoOptions ( break; + case 'f': + + AcpiGbl_ForceAmlDisassembly = TRUE; + break; + case 'l': /* Use legacy ASL code (not ASL+) for disassembly */ Gbl_DoCompile = FALSE; diff --git a/sys/contrib/dev/acpica/compiler/aslrules.y b/sys/contrib/dev/acpica/compiler/aslrules.y index 67f0413..dbe0882 100644 --- a/sys/contrib/dev/acpica/compiler/aslrules.y +++ b/sys/contrib/dev/acpica/compiler/aslrules.y @@ -130,7 +130,7 @@ Expression : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafNode (PARSEOP_LNOT);} TermArg {$$ = TrLinkChildren ($2,1,$3);} | PARSEOP_EXP_NOT {$$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg {$$ = TrLinkChildren ($2,2,$3,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($2,2,$3,TrCreateNullTarget ());} | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} {$$ = TrLinkChildren ($3,1,$1);} @@ -140,27 +140,27 @@ Expression /* Binary operators: math and logical */ | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), - TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), + TrCreateNullTarget ());} | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} @@ -198,7 +198,7 @@ EqualsTerm TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafNode (PARSEOP_MOD);} @@ -247,11 +247,10 @@ TermList Term : Object {} - | Expression {} | Type1Opcode {} | Type2Opcode {} - | Type2IntegerOpcode {} - | Type2StringOpcode {} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} + | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} | Type2BufferOpcode {} | Type2BufferOrStringOpcode {} | error {$$ = AslDoError(); yyclearin;} @@ -332,7 +331,7 @@ NameSpaceModifier | ScopeTerm {} ; -UserTerm +MethodInvocationTerm : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);} ArgList ')' {$$ = TrLinkChildNode ($1,$4);} ; @@ -355,8 +354,7 @@ Removed from TermArg due to reduce/reduce conflicts */ TermArg - : Expression {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} @@ -364,8 +362,8 @@ TermArg ; Target - : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */ + : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ + | ',' {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} ; @@ -453,7 +451,7 @@ Type2Opcode | EqualsTerm {} | TimerTerm {} | WaitTerm {} - | UserTerm {} + | MethodInvocationTerm {} ; /* @@ -461,7 +459,8 @@ Type2Opcode */ Type2IntegerOpcode /* "Type3" opcodes */ - : AddTerm {} + : Expression {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} + | AddTerm {} | AndTerm {} | DecTerm {} | DivideTerm {} @@ -507,7 +506,7 @@ Type2BufferOpcode /* "Type5" Opcodes */ ; Type2BufferOrStringOpcode - : ConcatTerm {} + : ConcatTerm {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} | PrintfTerm {} | FprintfTerm {} | MidTerm {} @@ -543,7 +542,7 @@ Type6Opcode : RefOfTerm {} | DerefOfTerm {} | IndexTerm {} - | UserTerm {} + | MethodInvocationTerm {} ; IncludeTerm @@ -1920,7 +1919,7 @@ SuperName | DebugTerm {} | Type6Opcode {} -/* For ObjectType: SuperName except for UserTerm (method invocation) */ +/* For ObjectType: SuperName except for MethodInvocationTerm */ ObjectTypeName : NameString {} @@ -1931,7 +1930,7 @@ ObjectTypeName | DerefOfTerm {} | IndexTerm {} -/* | UserTerm {} */ /* Caused reduce/reduce with Type6Opcode->UserTerm */ +/* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ ; ArgTerm diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index c8840b2..cbebd0d 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -248,7 +248,7 @@ AslDoDisassembly ( /* This is where the disassembly happens */ - AcpiGbl_DbOpt_disasm = TRUE; + AcpiGbl_DbOpt_Disasm = TRUE; Status = AdAmlDisassemble (AslToFile, Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, &Gbl_Files[ASL_FILE_INPUT].Filename); diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index 071231e..68d8072 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -55,10 +55,6 @@ static ACPI_PARSE_OBJECT * TrGetNextNode ( void); -static char * -TrGetNodeFlagName ( - UINT32 Flags); - /******************************************************************************* * @@ -187,7 +183,7 @@ TrUpdateNode ( } DbgPrint (ASL_PARSE_OUTPUT, - "\nUpdateNode: Old - %s, New - %s\n\n", + "\nUpdateNode: Old - %s, New - %s\n", UtGetOpName (Op->Asl.ParseOpcode), UtGetOpName (ParseOpcode)); @@ -261,90 +257,140 @@ TrUpdateNode ( /******************************************************************************* * - * FUNCTION: TrGetNodeFlagName + * FUNCTION: TrPrintNodeCompileFlags * * PARAMETERS: Flags - Flags word to be decoded * - * RETURN: Name string. Always returns a valid string pointer. + * RETURN: None * - * DESCRIPTION: Decode a flags word + * DESCRIPTION: Decode a flags word to text. Displays all flags that are set. * ******************************************************************************/ -static char * -TrGetNodeFlagName ( +void +TrPrintNodeCompileFlags ( UINT32 Flags) { + UINT32 i; + UINT32 FlagBit = 1; + char *FlagName = NULL; + - switch (Flags) + for (i = 0; i < 32; i++) { - case NODE_VISITED: + switch (Flags & FlagBit) + { + case NODE_VISITED: + + FlagName = "NODE_VISITED"; + break; + + case NODE_AML_PACKAGE: - return ("NODE_VISITED"); + FlagName = "NODE_AML_PACKAGE"; + break; + + case NODE_IS_TARGET: + + FlagName = "NODE_IS_TARGET"; + break; + + case NODE_IS_RESOURCE_DESC: - case NODE_AML_PACKAGE: + FlagName = "NODE_IS_RESOURCE_DESC"; + break; + + case NODE_IS_RESOURCE_FIELD: + + FlagName = "NODE_IS_RESOURCE_FIELD"; + break; - return ("NODE_AML_PACKAGE"); + case NODE_HAS_NO_EXIT: - case NODE_IS_TARGET: + FlagName = "NODE_HAS_NO_EXIT"; + break; - return ("NODE_IS_TARGET"); + case NODE_IF_HAS_NO_EXIT: - case NODE_IS_RESOURCE_DESC: + FlagName = "NODE_IF_HAS_NO_EXIT"; + break; - return ("NODE_IS_RESOURCE_DESC"); + case NODE_NAME_INTERNALIZED: - case NODE_IS_RESOURCE_FIELD: + FlagName = "NODE_NAME_INTERNALIZED"; + break; - return ("NODE_IS_RESOURCE_FIELD"); + case NODE_METHOD_NO_RETVAL: - case NODE_HAS_NO_EXIT: + FlagName = "NODE_METHOD_NO_RETVAL"; + break; - return ("NODE_HAS_NO_EXIT"); + case NODE_METHOD_SOME_NO_RETVAL: - case NODE_IF_HAS_NO_EXIT: + FlagName = "NODE_METHOD_SOME_NO_RETVAL"; + break; - return ("NODE_IF_HAS_NO_EXIT"); + case NODE_RESULT_NOT_USED: - case NODE_NAME_INTERNALIZED: + FlagName = "NODE_RESULT_NOT_USED"; + break; - return ("NODE_NAME_INTERNALIZED"); + case NODE_METHOD_TYPED: - case NODE_METHOD_NO_RETVAL: + FlagName = "NODE_METHOD_TYPED"; + break; - return ("NODE_METHOD_NO_RETVAL"); + case NODE_COMPILE_TIME_CONST: - case NODE_METHOD_SOME_NO_RETVAL: + FlagName = "NODE_COMPILE_TIME_CONST"; + break; - return ("NODE_METHOD_SOME_NO_RETVAL"); + case NODE_IS_TERM_ARG: - case NODE_RESULT_NOT_USED: + FlagName = "NODE_IS_TERM_ARG"; + break; - return ("NODE_RESULT_NOT_USED"); + case NODE_WAS_ONES_OP: - case NODE_METHOD_TYPED: + FlagName = "NODE_WAS_ONES_OP"; + break; - return ("NODE_METHOD_TYPED"); + case NODE_IS_NAME_DECLARATION: - case NODE_COMPILE_TIME_CONST: + FlagName = "NODE_IS_NAME_DECLARATION"; + break; - return ("NODE_COMPILE_TIME_CONST"); + case NODE_COMPILER_EMITTED: - case NODE_IS_TERM_ARG: + FlagName = "NODE_COMPILER_EMITTED"; + break; - return ("NODE_IS_TERM_ARG"); + case NODE_IS_DUPLICATE: - case NODE_WAS_ONES_OP: + FlagName = "NODE_IS_DUPLICATE"; + break; - return ("NODE_WAS_ONES_OP"); + case NODE_IS_RESOURCE_DATA: - case NODE_IS_NAME_DECLARATION: + FlagName = "NODE_IS_RESOURCE_DATA"; + break; - return ("NODE_IS_NAME_DECLARATION"); + case NODE_IS_NULL_RETURN: - default: + FlagName = "NODE_IS_NULL_RETURN"; + break; - return ("Multiple Flags (or unknown flag) set"); + default: + break; + } + + if (FlagName) + { + DbgPrint (ASL_PARSE_OUTPUT, " %s", FlagName); + FlagName = NULL; + } + + FlagBit <<= 1; } } @@ -368,15 +414,17 @@ TrSetNodeFlags ( UINT32 Flags) { - DbgPrint (ASL_PARSE_OUTPUT, - "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, - TrGetNodeFlagName (Flags)); - if (!Op) { return (NULL); } + DbgPrint (ASL_PARSE_OUTPUT, + "\nSetNodeFlags: %s Op %p, %8.8X", Op->Asl.ParseOpName, Op, Flags); + + TrPrintNodeCompileFlags (Flags); + DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); + Op->Asl.CompileFlags |= Flags; return (Op); } @@ -588,7 +636,40 @@ TrCreateLeafNode ( DbgPrint (ASL_PARSE_OUTPUT, "\nCreateLeafNode Ln/Col %u/%u NewNode %p Op %s\n\n", - Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode)); + Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode)); + + return (Op); +} + + +/******************************************************************************* + * + * FUNCTION: TrCreateNullTarget + * + * PARAMETERS: None + * + * RETURN: Pointer to the new node. Aborts on allocation failure + * + * DESCRIPTION: Create a "null" target node. This is defined by the ACPI + * specification to be a zero AML opcode, and indicates that + * no target has been specified for the parent operation + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrCreateNullTarget ( + void) +{ + ACPI_PARSE_OBJECT *Op; + + + Op = TrAllocateNode (PARSEOP_ZERO); + Op->Asl.CompileFlags |= (NODE_IS_TARGET | NODE_COMPILE_TIME_CONST); + + DbgPrint (ASL_PARSE_OUTPUT, + "\nCreateNullTarget Ln/Col %u/%u NewNode %p Op %s\n", + Op->Asl.LineNumber, Op->Asl.Column, Op, + UtGetOpName (Op->Asl.ParseOpcode)); return (Op); } @@ -620,7 +701,6 @@ TrCreateConstantLeafNode ( time_t CurrentTime; char *StaticTimeString; char *TimeString; - char *Path; char *Filename; @@ -647,7 +727,7 @@ TrCreateConstantLeafNode ( /* Get the simple filename from the full path */ - FlSplitInputPathname (Op->Asl.Filename, &Path, &Filename); + FlSplitInputPathname (Op->Asl.Filename, NULL, &Filename); Op->Asl.Value.String = Filename; break; @@ -672,7 +752,7 @@ TrCreateConstantLeafNode ( } DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ", + "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X \n", Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode), ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); return (Op); @@ -813,7 +893,8 @@ TrCreateValuedLeafNode ( case PARSEOP_INTEGER: - DbgPrint (ASL_PARSE_OUTPUT, "INTEGER"); + DbgPrint (ASL_PARSE_OUTPUT, "INTEGER->%8.8X%8.8X", + ACPI_FORMAT_UINT64 (Value)); break; default: @@ -948,7 +1029,7 @@ TrCreateNode ( } va_end(ap); - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); + DbgPrint (ASL_PARSE_OUTPUT, "\n"); return (Op); } @@ -1104,7 +1185,7 @@ TrLinkPeerNode ( DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n", + "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n", Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL, Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL); @@ -1130,7 +1211,7 @@ TrLinkPeerNode ( if (Op1 == Op2) { DbgPrint (ASL_DEBUG_OUTPUT, - "\n\n************* Internal error, linking node to itself %p\n\n\n", + "\n************* Internal error, linking node to itself %p\n", Op1); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, "Linking node to itself"); @@ -1214,7 +1295,7 @@ TrLinkPeerNodes ( } va_end (ap); - DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); + DbgPrint (ASL_PARSE_OUTPUT,"\n"); return (Start); } @@ -1241,7 +1322,7 @@ TrLinkChildNode ( DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n", + "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n", Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL, Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL); diff --git a/sys/contrib/dev/acpica/compiler/asltypes.y b/sys/contrib/dev/acpica/compiler/asltypes.y index 3177d1d..650b856 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.y +++ b/sys/contrib/dev/acpica/compiler/asltypes.y @@ -74,7 +74,7 @@ NoEcho(' %type Term %type TermArg %type TermList -%type UserTerm +%type MethodInvocationTerm /* Type4Opcode is obsolete */ diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 7258daa..37d394b 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -503,8 +503,13 @@ UtDisplaySummary ( if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA) { - FlPrintFile (FileId, - ", %u Optimizations", Gbl_ExceptionCount[ASL_OPTIMIZATION]); + FlPrintFile (FileId, ", %u Optimizations", + Gbl_ExceptionCount[ASL_OPTIMIZATION]); + + if (TotalFolds) + { + FlPrintFile (FileId, ", %u Constants Folded", TotalFolds); + } } FlPrintFile (FileId, "\n"); diff --git a/sys/contrib/dev/acpica/compiler/aslwalks.c b/sys/contrib/dev/acpica/compiler/aslwalks.c index c378f2d..c59895d 100644 --- a/sys/contrib/dev/acpica/compiler/aslwalks.c +++ b/sys/contrib/dev/acpica/compiler/aslwalks.c @@ -252,6 +252,13 @@ AnOperandTypecheckWalkEnd ( } return (AE_OK); + case AML_EXTERNAL_OP: + /* + * Not really a "runtime" opcode since it used by disassembler only. + * The parser will find any issues with the operands. + */ + return (AE_OK); + default: break; @@ -388,9 +395,6 @@ AnOperandTypecheckWalkEnd ( break; case PARSEOP_DEBUG: - - break; - case PARSEOP_REFOF: case PARSEOP_INDEX: default: diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index e94a222..74bfc33 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -102,13 +102,18 @@ DtDoCompile ( /* Preprocessor */ - Event = UtBeginEvent ("Preprocess input file"); - PrDoPreprocess (); - UtEndEvent (Event); - - if (Gbl_PreprocessOnly) + if (Gbl_PreprocessFlag) { - return (AE_OK); + /* Preprocessor */ + + Event = UtBeginEvent ("Preprocess input file"); + PrDoPreprocess (); + UtEndEvent (Event); + + if (Gbl_PreprocessOnly) + { + return (AE_OK); + } } /* diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index 307df3f..3a0b763 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -85,15 +85,16 @@ */ typedef struct dt_field { - char *Name; /* Field name (from name : value) */ - char *Value; /* Field value (from name : value) */ - struct dt_field *Next; /* Next field */ - struct dt_field *NextLabel; /* If field is a label, next label */ - UINT32 Line; /* Line number for this field */ - UINT32 ByteOffset; /* Offset in source file for field */ - UINT32 NameColumn; /* Start column for field name */ - UINT32 Column; /* Start column for field value */ - UINT32 TableOffset;/* Binary offset within ACPI table */ + char *Name; /* Field name (from name : value) */ + char *Value; /* Field value (from name : value) */ + UINT32 StringLength;/* Length of Value */ + struct dt_field *Next; /* Next field */ + struct dt_field *NextLabel; /* If field is a label, next label */ + UINT32 Line; /* Line number for this field */ + UINT32 ByteOffset; /* Offset in source file for field */ + UINT32 NameColumn; /* Start column for field name */ + UINT32 Column; /* Start column for field value */ + UINT32 TableOffset; /* Binary offset within ACPI table */ UINT8 Flags; } DT_FIELD; @@ -557,6 +558,7 @@ extern const unsigned char TemplateMcfg[]; extern const unsigned char TemplateMchi[]; extern const unsigned char TemplateMpst[]; extern const unsigned char TemplateMsct[]; +extern const unsigned char TemplateMsdm[]; extern const unsigned char TemplateMtmr[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index e840fc9..bebd927 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -375,6 +375,7 @@ DtParseLine ( Field->ByteOffset = Offset; Field->NameColumn = NameColumn; Field->Column = Column; + Field->StringLength = Length; DtLinkField (Field); } @@ -414,6 +415,7 @@ DtGetNextLine ( int c; + ACPI_MEMSET (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); for (i = 0; ;) { /* @@ -939,11 +941,11 @@ DtDumpFieldList ( DbgPrint (ASL_DEBUG_OUTPUT, "\nField List:\n" "LineNo ByteOff NameCol Column TableOff " - "Flags %32s : %s\n\n", "Name", "Value"); + "Flags %32s : %s\n\n", "Name", "Value"); while (Field) { DbgPrint (ASL_DEBUG_OUTPUT, - "%.08X %.08X %.08X %.08X %.08X %.08X %32s : %s\n", + "%.08X %.08X %.08X %.08X %.08X %2.2X %32s : %s\n", Field->Line, Field->ByteOffset, Field->NameColumn, Field->Column, Field->TableOffset, Field->Flags, Field->Name, Field->Value); diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index bc0cbd2..3fe02e8 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -2240,15 +2240,11 @@ DtCompileSlic ( DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; - DT_FIELD *SubtableStart; - ACPI_SLIC_HEADER *SlicHeader; - ACPI_DMTABLE_INFO *InfoTable; while (*PFieldList) { - SubtableStart = *PFieldList; - Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlicHdr, + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlic, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { @@ -2258,35 +2254,6 @@ DtCompileSlic ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); - - SlicHeader = ACPI_CAST_PTR (ACPI_SLIC_HEADER, Subtable->Buffer); - - switch (SlicHeader->Type) - { - case ACPI_SLIC_TYPE_PUBLIC_KEY: - - InfoTable = AcpiDmTableInfoSlic0; - break; - - case ACPI_SLIC_TYPE_WINDOWS_MARKER: - - InfoTable = AcpiDmTableInfoSlic1; - break; - - default: - - DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SLIC"); - return (AE_ERROR); - } - - Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); DtPopSubtable (); } diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 0398d69..39be761 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -662,6 +662,23 @@ const unsigned char TemplateMchi[] = 0x00,0x00,0x00,0x00,0x00 /* 00000040 "....." */ }; +const unsigned char TemplateMsdm[] = +{ + 0x4D,0x53,0x44,0x4D,0x64,0x00,0x00,0x00, /* 00000000 "MSDMd..." */ + 0x01,0x34,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".4Intel." */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x03,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x04,0x02,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000028 "........" */ + 0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23, /* 00000030 ".... !"#" */ + 0x24,0x25,0x26,0x27,0x10,0x0A,0x15,0x16, /* 00000038 "$%&'...." */ + 0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E, /* 00000040 "........" */ + 0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26, /* 00000048 ". !"#$%&" */ + 0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 00000050 "........" */ + 0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21, /* 00000058 "...... !" */ + 0x22,0x23,0x24,0x25 /* 00000060 ""#$%" */ +}; + const unsigned char TemplateMpst[] = { 0x4D,0x50,0x53,0x54,0xB6,0x00,0x00,0x00, /* 00000000 "MPST...." */ diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 3635f13..7d3c2c8 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -364,6 +364,7 @@ DtGetFieldType ( break; case ACPI_DMT_BUFFER: + case ACPI_DMT_RAW_BUFFER: case ACPI_DMT_BUF7: case ACPI_DMT_BUF10: case ACPI_DMT_BUF16: @@ -531,7 +532,6 @@ DtGetFieldLength ( case ACPI_DMT_UINT32: case ACPI_DMT_NAME4: - case ACPI_DMT_SLIC: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: @@ -588,6 +588,7 @@ DtGetFieldLength ( break; case ACPI_DMT_BUFFER: + case ACPI_DMT_RAW_BUFFER: Value = DtGetFieldValue (Field); if (Value) diff --git a/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index 8f2e4db..5224854 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/components/debugger/dbmethod.c @@ -396,11 +396,11 @@ AcpiDbDisassembleMethod ( /* Now we can disassemble the method */ - AcpiGbl_DbOpt_verbose = FALSE; + AcpiGbl_DbOpt_Verbose = FALSE; #ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (NULL, Op, 0); #endif - AcpiGbl_DbOpt_verbose = TRUE; + AcpiGbl_DbOpt_Verbose = TRUE; AcpiPsDeleteParseTree (Op); diff --git a/sys/contrib/dev/acpica/components/debugger/dbxface.c b/sys/contrib/dev/acpica/components/debugger/dbxface.c index 8d2e0a8..d72ee5e 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbxface.c +++ b/sys/contrib/dev/acpica/components/debugger/dbxface.c @@ -424,13 +424,11 @@ AcpiDbInitialize ( AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - AcpiGbl_DbOpt_tables = FALSE; - AcpiGbl_DbOpt_disasm = FALSE; - AcpiGbl_DbOpt_stats = FALSE; + AcpiGbl_DbOpt_Disasm = FALSE; #ifdef ACPI_DISASSEMBLER - AcpiGbl_DbOpt_verbose = TRUE; + AcpiGbl_DbOpt_Verbose = TRUE; #endif - AcpiGbl_DbOpt_ini_methods = TRUE; + AcpiGbl_DbOpt_NoIniMethods = FALSE; AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); if (!AcpiGbl_DbBuffer) @@ -479,10 +477,9 @@ AcpiDbInitialize ( } #ifdef ACPI_DISASSEMBLER - if (!AcpiGbl_DbOpt_verbose) + if (!AcpiGbl_DbOpt_Verbose) { - AcpiGbl_DbOpt_disasm = TRUE; - AcpiGbl_DbOpt_stats = FALSE; + AcpiGbl_DbOpt_Disasm = TRUE; } #endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index f2ef535..b10d433 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -852,18 +852,6 @@ AcpiDmDisassembleOneOp ( } break; - case AML_INT_STATICSTRING_OP: - - if (Op->Common.Value.String) - { - AcpiOsPrintf ("%s", Op->Common.Value.String); - } - else - { - AcpiOsPrintf ("\"\""); - } - break; - case AML_INT_NAMEPATH_OP: AcpiDmNamestring (Op->Common.Value.Name); diff --git a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c index 43a1139..2dbaa84 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c @@ -562,7 +562,7 @@ AcpiDmDescendingOp ( if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) { - if (AcpiGbl_DbOpt_verbose) + if (AcpiGbl_DbOpt_Verbose) { (void) AcpiPsDisplayObjectPathname (NULL, Op); } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c index 86fe26c..157e4ce 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c @@ -477,7 +477,7 @@ AcpiDsEvalRegionOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ObjDesc, - ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ @@ -579,12 +579,12 @@ AcpiDsEvalTableRegionOperands ( return_ACPI_STATUS (AE_NOT_EXIST); } - ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); + ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table); ObjDesc->Region.Length = Table->Length; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ObjDesc, - ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c index f4f0f33..a115b2e 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c @@ -599,6 +599,15 @@ AcpiDsCreateOperand ( ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); Status = AE_OK; } + else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP) + { + /* TBD: May only be temporary */ + + ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength); + + ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength); + Status = AE_OK; + } else { /* diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c index 19ceb26..54171b6 100644 --- a/sys/contrib/dev/acpica/components/events/evregion.c +++ b/sys/contrib/dev/acpica/components/events/evregion.c @@ -288,7 +288,7 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_NATIVE_UINT (Address), + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); if (!(HandlerDesc->AddressSpace.HandlerFlags & diff --git a/sys/contrib/dev/acpica/components/events/evxfevnt.c b/sys/contrib/dev/acpica/components/events/evxfevnt.c index 08507b3..5515922 100644 --- a/sys/contrib/dev/acpica/components/events/evxfevnt.c +++ b/sys/contrib/dev/acpica/components/events/evxfevnt.c @@ -401,7 +401,8 @@ AcpiGetEventStatus ( if (InByte) { - LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; + LocalEventStatus |= + (ACPI_EVENT_FLAG_ENABLED | ACPI_EVENT_FLAG_ENABLE_SET); } /* Fixed event currently active? */ @@ -415,7 +416,7 @@ AcpiGetEventStatus ( if (InByte) { - LocalEventStatus |= ACPI_EVENT_FLAG_SET; + LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET; } (*EventStatus) = LocalEventStatus; diff --git a/sys/contrib/dev/acpica/components/executer/exdump.c b/sys/contrib/dev/acpica/components/executer/exdump.c index 9986022..622dc14 100644 --- a/sys/contrib/dev/acpica/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/components/executer/exdump.c @@ -784,7 +784,7 @@ AcpiExDumpOperand ( else { AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } break; diff --git a/sys/contrib/dev/acpica/components/executer/exfldio.c b/sys/contrib/dev/acpica/components/executer/exfldio.c index c4d4019..2908da4 100644 --- a/sys/contrib/dev/acpica/components/executer/exfldio.c +++ b/sys/contrib/dev/acpica/components/executer/exfldio.c @@ -289,13 +289,13 @@ AcpiExAccessRegion ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, - " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n", + " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId, ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset)))); + ACPI_FORMAT_UINT64 (RgnDesc->Region.Address + RegionOffset))); /* Invoke the appropriate AddressSpace/OpRegion handler */ diff --git a/sys/contrib/dev/acpica/components/executer/exoparg3.c b/sys/contrib/dev/acpica/components/executer/exoparg3.c index 6d0fdd1..da873c3 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg3.c +++ b/sys/contrib/dev/acpica/components/executer/exoparg3.c @@ -125,7 +125,18 @@ AcpiExOpcode_3A_0T_0R ( /* Might return while OS is shutting down, just continue */ ACPI_FREE (Fatal); - break; + goto Cleanup; + + case AML_EXTERNAL_OP: + /* + * If the interpreter sees this opcode, just ignore it. The External + * op is intended for use by disassemblers in order to properly + * disassemble control method invocations. The opcode or group of + * opcodes should be surrounded by an "if (0)" clause to ensure that + * AML interpreters never see the opcode. + */ + Status = AE_OK; + goto Cleanup; default: diff --git a/sys/contrib/dev/acpica/components/executer/exregion.c b/sys/contrib/dev/acpica/components/executer/exregion.c index 9deef50..59b4612 100644 --- a/sys/contrib/dev/acpica/components/executer/exregion.c +++ b/sys/contrib/dev/acpica/components/executer/exregion.c @@ -175,8 +175,8 @@ AcpiExSystemMemorySpaceHandler ( * one page, which is similar to the original code that used a 4k * maximum window. */ - PageBoundaryMapLength = - ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address; + PageBoundaryMapLength = (ACPI_SIZE) + (ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address); if (PageBoundaryMapLength == 0) { PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE; @@ -189,13 +189,12 @@ AcpiExSystemMemorySpaceHandler ( /* Create a new mapping starting at the address given */ - MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, MapLength); + MemInfo->MappedLogicalAddress = AcpiOsMapMemory (Address, MapLength); if (!MemInfo->MappedLogicalAddress) { ACPI_ERROR ((AE_INFO, "Could not map memory at 0x%8.8X%8.8X, size %u", - ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength)); + ACPI_FORMAT_UINT64 (Address), (UINT32) MapLength)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); } @@ -215,7 +214,7 @@ AcpiExSystemMemorySpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); + BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); /* * Perform the memory read or write @@ -338,7 +337,7 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); + BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); /* Decode the function parameter */ diff --git a/sys/contrib/dev/acpica/components/hardware/hwgpe.c b/sys/contrib/dev/acpica/components/hardware/hwgpe.c index 9cc511e..093ba80 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/components/hardware/hwgpe.c @@ -280,6 +280,19 @@ AcpiHwGetGpeStatus ( LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED; } + /* GPE currently enabled (enable bit == 1)? */ + + Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (RegisterBit & InByte) + { + LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET; + } + /* GPE currently active (status bit == 1)? */ Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress); @@ -290,7 +303,7 @@ AcpiHwGetGpeStatus ( if (RegisterBit & InByte) { - LocalEventStatus |= ACPI_EVENT_FLAG_SET; + LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET; } /* Set return value */ diff --git a/sys/contrib/dev/acpica/components/hardware/hwvalid.c b/sys/contrib/dev/acpica/components/hardware/hwvalid.c index ade53ad..3b6b567 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/components/hardware/hwvalid.c @@ -155,8 +155,8 @@ AcpiHwValidateIoRequest ( ByteWidth = ACPI_DIV_8 (BitWidth); LastAddress = Address + ByteWidth - 1; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %p LastAddress %p Length %X", - ACPI_CAST_PTR (void, Address), ACPI_CAST_PTR (void, LastAddress), + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", + ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (LastAddress), ByteWidth)); /* Maximum 16-bit address in I/O space */ @@ -164,8 +164,8 @@ AcpiHwValidateIoRequest ( if (LastAddress > ACPI_UINT16_MAX) { ACPI_ERROR ((AE_INFO, - "Illegal I/O port address/length above 64K: %p/0x%X", - ACPI_CAST_PTR (void, Address), ByteWidth)); + "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", + ACPI_FORMAT_UINT64 (Address), ByteWidth)); return_ACPI_STATUS (AE_LIMIT); } @@ -196,8 +196,8 @@ AcpiHwValidateIoRequest ( if (AcpiGbl_OsiData >= PortInfo->OsiDependency) { ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", - ACPI_CAST_PTR (void, Address), ByteWidth, PortInfo->Name, + "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", + ACPI_FORMAT_UINT64 (Address), ByteWidth, PortInfo->Name, PortInfo->Start, PortInfo->End)); return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS); diff --git a/sys/contrib/dev/acpica/components/namespace/nsdump.c b/sys/contrib/dev/acpica/components/namespace/nsdump.c index 6140397..77fb279 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/components/namespace/nsdump.c @@ -313,9 +313,9 @@ AcpiNsDumpOneObject ( { case ACPI_TYPE_PROCESSOR: - AcpiOsPrintf ("ID %02X Len %02X Addr %p\n", + AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, - ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); + ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address)); break; case ACPI_TYPE_DEVICE: @@ -388,7 +388,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } else diff --git a/sys/contrib/dev/acpica/components/parser/psopcode.c b/sys/contrib/dev/acpica/components/parser/psopcode.c index c219778..e351e4c 100644 --- a/sys/contrib/dev/acpica/components/parser/psopcode.c +++ b/sys/contrib/dev/acpica/components/parser/psopcode.c @@ -333,7 +333,11 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* ACPI 5.0 opcodes */ /* 7F */ ACPI_OP ("-ConnectField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 80 */ ACPI_OP ("-ExtAccessField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0) +/* 80 */ ACPI_OP ("-ExtAccessField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), + +/* ACPI 6.0 opcodes */ + +/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE,/* ? */ AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R) /*! [End] no source code translation !*/ }; diff --git a/sys/contrib/dev/acpica/components/parser/psopinfo.c b/sys/contrib/dev/acpica/components/parser/psopinfo.c index e44bf7b..872f58a 100644 --- a/sys/contrib/dev/acpica/components/parser/psopinfo.c +++ b/sys/contrib/dev/acpica/components/parser/psopinfo.c @@ -226,7 +226,7 @@ const UINT8 AcpiGbl_ShortOpIndex[256] = /* 8 9 A B C D E F */ /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, +/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, 0x81, _UNK, _UNK, /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, diff --git a/sys/contrib/dev/acpica/components/resources/rsaddr.c b/sys/contrib/dev/acpica/components/resources/rsaddr.c index f05c4fc..decd9a6 100644 --- a/sys/contrib/dev/acpica/components/resources/rsaddr.c +++ b/sys/contrib/dev/acpica/components/resources/rsaddr.c @@ -77,7 +77,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[5] = * Address Translation Offset * Address Length */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Address16.Granularity), + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Address16.Address.Granularity), AML_OFFSET (Address16.Granularity), 5}, @@ -117,7 +117,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[5] = * Address Translation Offset * Address Length */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Address32.Granularity), + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Address32.Address.Granularity), AML_OFFSET (Address32.Granularity), 5}, @@ -157,7 +157,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[5] = * Address Translation Offset * Address Length */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.Address64.Granularity), + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.Address64.Address.Granularity), AML_OFFSET (Address64.Granularity), 5}, @@ -203,7 +203,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[5] = * Address Length * Type-Specific Attribute */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.ExtAddress64.Granularity), + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.ExtAddress64.Address.Granularity), AML_OFFSET (ExtAddress64.Granularity), 6} }; diff --git a/sys/contrib/dev/acpica/components/resources/rsdump.c b/sys/contrib/dev/acpica/components/resources/rsdump.c index ddae6e0..9c1a7ec 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/components/resources/rsdump.c @@ -1,6 +1,6 @@ /******************************************************************************* * - * Module Name: rsdump - Functions to display the resource structures. + * Module Name: rsdump - AML debugger support for resource structures. * ******************************************************************************/ @@ -48,8 +48,10 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsdump") - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) +/* + * All functions in this module are used by the AML Debugger only + */ +#if defined(ACPI_DEBUGGER) /* Local prototypes */ @@ -89,8 +91,8 @@ AcpiRsDumpByteList ( static void AcpiRsDumpWordList ( - UINT16 Length, - UINT16 *Data); + UINT16 Length, + UINT16 *Data); static void AcpiRsDumpDwordList ( @@ -99,8 +101,8 @@ AcpiRsDumpDwordList ( static void AcpiRsDumpShortByteList ( - UINT8 Length, - UINT8 *Data); + UINT8 Length, + UINT8 *Data); static void AcpiRsDumpResourceSource ( @@ -113,7 +115,133 @@ AcpiRsDumpAddressCommon ( static void AcpiRsDumpDescriptor ( void *Resource, - ACPI_RSDUMP_INFO *Table); + ACPI_RSDUMP_INFO *Table); + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpResourceList + * + * PARAMETERS: ResourceList - Pointer to a resource descriptor list + * + * RETURN: None + * + * DESCRIPTION: Dispatches the structure to the correct dump routine. + * + ******************************************************************************/ + +void +AcpiRsDumpResourceList ( + ACPI_RESOURCE *ResourceList) +{ + UINT32 Count = 0; + UINT32 Type; + + + ACPI_FUNCTION_ENTRY (); + + + /* Check if debug output enabled */ + + if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) + { + return; + } + + /* Walk list and dump all resource descriptors (END_TAG terminates) */ + + do + { + AcpiOsPrintf ("\n[%02X] ", Count); + Count++; + + /* Validate Type before dispatch */ + + Type = ResourceList->Type; + if (Type > ACPI_RESOURCE_TYPE_MAX) + { + AcpiOsPrintf ( + "Invalid descriptor type (%X) in resource list\n", + ResourceList->Type); + return; + } + + /* Sanity check the length. It must not be zero, or we loop forever */ + + if (!ResourceList->Length) + { + AcpiOsPrintf ( + "Invalid zero length descriptor in resource list\n"); + return; + } + + /* Dump the resource descriptor */ + + if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) + { + AcpiRsDumpDescriptor (&ResourceList->Data, + AcpiGbl_DumpSerialBusDispatch[ + ResourceList->Data.CommonSerialBus.Type]); + } + else + { + AcpiRsDumpDescriptor (&ResourceList->Data, + AcpiGbl_DumpResourceDispatch[Type]); + } + + /* Point to the next resource structure */ + + ResourceList = ACPI_NEXT_RESOURCE (ResourceList); + + /* Exit when END_TAG descriptor is reached */ + + } while (Type != ACPI_RESOURCE_TYPE_END_TAG); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpIrqList + * + * PARAMETERS: RouteTable - Pointer to the routing table to dump. + * + * RETURN: None + * + * DESCRIPTION: Print IRQ routing table + * + ******************************************************************************/ + +void +AcpiRsDumpIrqList ( + UINT8 *RouteTable) +{ + ACPI_PCI_ROUTING_TABLE *PrtElement; + UINT8 Count; + + + ACPI_FUNCTION_ENTRY (); + + + /* Check if debug output enabled */ + + if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) + { + return; + } + + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable); + + /* Dump all table elements, Exit on zero length element */ + + for (Count = 0; PrtElement->Length; Count++) + { + AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); + AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); + + PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE, + PrtElement, PrtElement->Length); + } +} /******************************************************************************* @@ -288,14 +416,16 @@ AcpiRsDumpDescriptor ( /* * Common flags for all Address resources */ - AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target)); + AcpiRsDumpAddressCommon (ACPI_CAST_PTR ( + ACPI_RESOURCE_DATA, Target)); break; case ACPI_RSD_SOURCE: /* * Optional ResourceSource for Address resources */ - AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target)); + AcpiRsDumpResourceSource (ACPI_CAST_PTR ( + ACPI_RESOURCE_SOURCE, Target)); break; default: @@ -399,131 +529,6 @@ AcpiRsDumpAddressCommon ( /******************************************************************************* * - * FUNCTION: AcpiRsDumpResourceList - * - * PARAMETERS: ResourceList - Pointer to a resource descriptor list - * - * RETURN: None - * - * DESCRIPTION: Dispatches the structure to the correct dump routine. - * - ******************************************************************************/ - -void -AcpiRsDumpResourceList ( - ACPI_RESOURCE *ResourceList) -{ - UINT32 Count = 0; - UINT32 Type; - - - ACPI_FUNCTION_ENTRY (); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) - { - return; - } - - /* Walk list and dump all resource descriptors (END_TAG terminates) */ - - do - { - AcpiOsPrintf ("\n[%02X] ", Count); - Count++; - - /* Validate Type before dispatch */ - - Type = ResourceList->Type; - if (Type > ACPI_RESOURCE_TYPE_MAX) - { - AcpiOsPrintf ( - "Invalid descriptor type (%X) in resource list\n", - ResourceList->Type); - return; - } - - /* Sanity check the length. It must not be zero, or we loop forever */ - - if (!ResourceList->Length) - { - AcpiOsPrintf ( - "Invalid zero length descriptor in resource list\n"); - return; - } - - /* Dump the resource descriptor */ - - if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) - { - AcpiRsDumpDescriptor (&ResourceList->Data, - AcpiGbl_DumpSerialBusDispatch[ResourceList->Data.CommonSerialBus.Type]); - } - else - { - AcpiRsDumpDescriptor (&ResourceList->Data, - AcpiGbl_DumpResourceDispatch[Type]); - } - - /* Point to the next resource structure */ - - ResourceList = ACPI_NEXT_RESOURCE (ResourceList); - - /* Exit when END_TAG descriptor is reached */ - - } while (Type != ACPI_RESOURCE_TYPE_END_TAG); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpIrqList - * - * PARAMETERS: RouteTable - Pointer to the routing table to dump. - * - * RETURN: None - * - * DESCRIPTION: Print IRQ routing table - * - ******************************************************************************/ - -void -AcpiRsDumpIrqList ( - UINT8 *RouteTable) -{ - ACPI_PCI_ROUTING_TABLE *PrtElement; - UINT8 Count; - - - ACPI_FUNCTION_ENTRY (); - - - /* Check if debug output enabled */ - - if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT)) - { - return; - } - - PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable); - - /* Dump all table elements, Exit on zero length element */ - - for (Count = 0; PrtElement->Length; Count++) - { - AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); - AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); - - PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE, - PrtElement, PrtElement->Length); - } -} - - -/******************************************************************************* - * * FUNCTION: AcpiRsOut* * * PARAMETERS: Title - Name of the resource field @@ -620,8 +625,8 @@ AcpiRsDumpByteList ( static void AcpiRsDumpShortByteList ( - UINT8 Length, - UINT8 *Data) + UINT8 Length, + UINT8 *Data) { UINT8 i; diff --git a/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c b/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c index aab597a..dfa1a84 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c +++ b/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c @@ -161,11 +161,12 @@ ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.TranslationOffset), "Translation Offset", NULL}, - {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.AddressLength), "Address Length", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Granularity), "Granularity", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.Maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.TranslationOffset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Address.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL} }; @@ -173,11 +174,12 @@ ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.TranslationOffset), "Translation Offset", NULL}, - {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.AddressLength), "Address Length", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Granularity), "Granularity", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.Maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.TranslationOffset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Address.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL} }; @@ -185,11 +187,12 @@ ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.TranslationOffset), "Translation Offset", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.AddressLength), "Address Length", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Granularity), "Granularity", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.Maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.TranslationOffset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Address.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL} }; @@ -197,11 +200,13 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Granularity), "Granularity", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Minimum), "Address Minimum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Maximum), "Address Maximum", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset), "Translation Offset", NULL}, - {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.AddressLength), "Address Length", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Granularity), "Granularity", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.Maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.TranslationOffset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Address.AddressLength), + "Address Length", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL} }; diff --git a/sys/contrib/dev/acpica/components/resources/rsxface.c b/sys/contrib/dev/acpica/components/resources/rsxface.c index 2fe3e6f..a477f20 100644 --- a/sys/contrib/dev/acpica/components/resources/rsxface.c +++ b/sys/contrib/dev/acpica/components/resources/rsxface.c @@ -61,11 +61,11 @@ ACPI_COPY_FIELD(Out, In, MinAddressFixed); \ ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \ ACPI_COPY_FIELD(Out, In, Info); \ - ACPI_COPY_FIELD(Out, In, Granularity); \ - ACPI_COPY_FIELD(Out, In, Minimum); \ - ACPI_COPY_FIELD(Out, In, Maximum); \ - ACPI_COPY_FIELD(Out, In, TranslationOffset); \ - ACPI_COPY_FIELD(Out, In, AddressLength); \ + ACPI_COPY_FIELD(Out, In, Address.Granularity); \ + ACPI_COPY_FIELD(Out, In, Address.Minimum); \ + ACPI_COPY_FIELD(Out, In, Address.Maximum); \ + ACPI_COPY_FIELD(Out, In, Address.TranslationOffset); \ + ACPI_COPY_FIELD(Out, In, Address.AddressLength); \ ACPI_COPY_FIELD(Out, In, ResourceSource); diff --git a/sys/contrib/dev/acpica/components/tables/tbdata.c b/sys/contrib/dev/acpica/components/tables/tbdata.c index 4ff62dd..70bac2c 100644 --- a/sys/contrib/dev/acpica/components/tables/tbdata.c +++ b/sys/contrib/dev/acpica/components/tables/tbdata.c @@ -121,7 +121,8 @@ AcpiTbAcquireTable ( case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, TableDesc->Address); + Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, + ACPI_PHYSADDR_TO_PTR (TableDesc->Address)); break; default: @@ -227,7 +228,8 @@ AcpiTbAcquireTempTable ( case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Address); + TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, + ACPI_PHYSADDR_TO_PTR (Address)); if (!TableHeader) { return (AE_NO_MEMORY); @@ -437,11 +439,11 @@ AcpiTbVerifyTempTable ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, - "%4.4s " ACPI_PRINTF_UINT + "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", - ACPI_FORMAT_TO_UINT (TableDesc->Address))); + ACPI_FORMAT_UINT64 (TableDesc->Address))); goto InvalidateAndExit; } } @@ -529,21 +531,24 @@ AcpiTbResizeRootTableList ( /******************************************************************************* * - * FUNCTION: AcpiTbGetNextRootIndex + * FUNCTION: AcpiTbGetNextTableDescriptor * * PARAMETERS: TableIndex - Where table index is returned + * TableDesc - Where table descriptor is returned * - * RETURN: Status and table index. + * RETURN: Status and table index/descriptor. * * DESCRIPTION: Allocate a new ACPI table entry to the global table list * ******************************************************************************/ ACPI_STATUS -AcpiTbGetNextRootIndex ( - UINT32 *TableIndex) +AcpiTbGetNextTableDescriptor ( + UINT32 *TableIndex, + ACPI_TABLE_DESC **TableDesc) { ACPI_STATUS Status; + UINT32 i; /* Ensure that there is room for the table in the Root Table List */ @@ -558,8 +563,18 @@ AcpiTbGetNextRootIndex ( } } - *TableIndex = AcpiGbl_RootTableList.CurrentTableCount; + i = AcpiGbl_RootTableList.CurrentTableCount; AcpiGbl_RootTableList.CurrentTableCount++; + + if (TableIndex) + { + *TableIndex = i; + } + if (TableDesc) + { + *TableDesc = &AcpiGbl_RootTableList.Tables[i]; + } + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index 2fe219d..d77d2c8 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/components/tables/tbinstal.c @@ -201,8 +201,8 @@ AcpiTbInstallFixedTable ( ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p", - ACPI_CAST_PTR (void, Address))); + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", + ACPI_FORMAT_UINT64 (Address))); return_ACPI_STATUS (Status); } @@ -268,8 +268,8 @@ AcpiTbInstallStandardTable ( Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags); if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p", - ACPI_CAST_PTR (void, Address))); + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", + ACPI_FORMAT_UINT64 (Address))); return_ACPI_STATUS (Status); } @@ -281,8 +281,8 @@ AcpiTbInstallStandardTable ( AcpiGbl_DisableSsdtTableInstall && ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) { - ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %p", - NewTableDesc.Signature.Ascii, ACPI_CAST_PTR (void, Address))); + ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %8.8X%8.8X", + NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); goto ReleaseAndExit; } @@ -368,7 +368,6 @@ AcpiTbInstallStandardTable ( */ AcpiTbUninstallTable (&NewTableDesc); *TableIndex = i; - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (AE_OK); } } @@ -376,7 +375,7 @@ AcpiTbInstallStandardTable ( /* Add the table to the global root table list */ - Status = AcpiTbGetNextRootIndex (&i); + Status = AcpiTbGetNextTableDescriptor (&i, NULL); if (ACPI_FAILURE (Status)) { goto ReleaseAndExit; @@ -459,11 +458,11 @@ FinishOverride: return; } - ACPI_INFO ((AE_INFO, "%4.4s " ACPI_PRINTF_UINT - " %s table override, new table: " ACPI_PRINTF_UINT, + ACPI_INFO ((AE_INFO, "%4.4s 0x%8.8X%8.8X" + " %s table override, new table: 0x%8.8X%8.8X", OldTableDesc->Signature.Ascii, - ACPI_FORMAT_TO_UINT (OldTableDesc->Address), - OverrideType, ACPI_FORMAT_TO_UINT (NewTableDesc.Address))); + ACPI_FORMAT_UINT64 (OldTableDesc->Address), + OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address))); /* We can now uninstall the original table */ @@ -485,49 +484,6 @@ FinishOverride: /******************************************************************************* * - * FUNCTION: AcpiTbStoreTable - * - * PARAMETERS: Address - Table address - * Table - Table header - * Length - Table length - * Flags - Install flags - * TableIndex - Where the table index is returned - * - * RETURN: Status and table index. - * - * DESCRIPTION: Add an ACPI table to the global table list - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbStoreTable ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER *Table, - UINT32 Length, - UINT8 Flags, - UINT32 *TableIndex) -{ - ACPI_STATUS Status; - ACPI_TABLE_DESC *TableDesc; - - - Status = AcpiTbGetNextRootIndex (TableIndex); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Initialize added table */ - - TableDesc = &AcpiGbl_RootTableList.Tables[*TableIndex]; - AcpiTbInitTableDescriptor (TableDesc, Address, Flags, Table); - TableDesc->Pointer = Table; - return (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: AcpiTbUninstallTable * * PARAMETERS: TableDesc - Table descriptor @@ -558,7 +514,7 @@ AcpiTbUninstallTable ( if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) { - ACPI_FREE (ACPI_CAST_PTR (void, TableDesc->Address)); + ACPI_FREE (ACPI_PHYSADDR_TO_PTR (TableDesc->Address)); } TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL); diff --git a/sys/contrib/dev/acpica/components/tables/tbprint.c b/sys/contrib/dev/acpica/components/tables/tbprint.c index 8be1a9f..f0ea090 100644 --- a/sys/contrib/dev/acpica/components/tables/tbprint.c +++ b/sys/contrib/dev/acpica/components/tables/tbprint.c @@ -144,18 +144,12 @@ AcpiTbPrintTableHeader ( ACPI_TABLE_HEADER LocalHeader; - /* - * The reason that we use ACPI_PRINTF_UINT and ACPI_FORMAT_TO_UINT is to - * support both 32-bit and 64-bit hosts/addresses in a consistent manner. - * The %p specifier does not emit uniform output on all hosts. On some, - * leading zeros are not supported. - */ if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS)) { /* FACS only has signature and length fields */ - ACPI_INFO ((AE_INFO, "%-4.4s " ACPI_PRINTF_UINT " %06X", - Header->Signature, ACPI_FORMAT_TO_UINT (Address), + ACPI_INFO ((AE_INFO, "%-4.4s 0x%8.8X%8.8X %06X", + Header->Signature, ACPI_FORMAT_UINT64 (Address), Header->Length)); } else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature)) @@ -166,8 +160,8 @@ AcpiTbPrintTableHeader ( ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - ACPI_INFO ((AE_INFO, "RSDP " ACPI_PRINTF_UINT " %06X (v%.2d %-6.6s)", - ACPI_FORMAT_TO_UINT (Address), + ACPI_INFO ((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", + ACPI_FORMAT_UINT64 (Address), (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, @@ -180,9 +174,9 @@ AcpiTbPrintTableHeader ( AcpiTbCleanupTableHeader (&LocalHeader, Header); ACPI_INFO ((AE_INFO, - "%-4.4s " ACPI_PRINTF_UINT + "%-4.4s 0x%8.8X%8.8X" " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", - LocalHeader.Signature, ACPI_FORMAT_TO_UINT (Address), + LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address), LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, LocalHeader.OemTableId, LocalHeader.OemRevision, LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); diff --git a/sys/contrib/dev/acpica/components/tables/tbxfroot.c b/sys/contrib/dev/acpica/components/tables/tbxfroot.c index 26babdb..e3b93d3 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfroot.c @@ -158,7 +158,7 @@ AcpiTbValidateRsdp ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_SIZE *TableAddress) + ACPI_PHYSICAL_ADDRESS *TableAddress) { UINT8 *TablePtr; UINT8 *MemRover; @@ -218,7 +218,7 @@ AcpiFindRootPointer ( PhysicalAddress += (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr); - *TableAddress = PhysicalAddress; + *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; return_ACPI_STATUS (AE_OK); } } @@ -249,7 +249,7 @@ AcpiFindRootPointer ( PhysicalAddress = (UINT32) (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr)); - *TableAddress = PhysicalAddress; + *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress; return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/utilities/utaddress.c b/sys/contrib/dev/acpica/components/utilities/utaddress.c index 02d6110..5ed2b4d 100644 --- a/sys/contrib/dev/acpica/components/utilities/utaddress.c +++ b/sys/contrib/dev/acpica/components/utilities/utaddress.c @@ -117,10 +117,10 @@ AcpiUtAddAddressRange ( AcpiGbl_AddressRangeList[SpaceId] = RangeInfo; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "\nAdded [%4.4s] address range: 0x%p-0x%p\n", + "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", AcpiUtGetNodeName (RangeInfo->RegionNode), - ACPI_CAST_PTR (void, Address), - ACPI_CAST_PTR (void, RangeInfo->EndAddress))); + ACPI_FORMAT_UINT64 (Address), + ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_OK); @@ -179,10 +179,10 @@ AcpiUtRemoveAddressRange ( } ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "\nRemoved [%4.4s] address range: 0x%p-0x%p\n", + "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", AcpiUtGetNodeName (RangeInfo->RegionNode), - ACPI_CAST_PTR (void, RangeInfo->StartAddress), - ACPI_CAST_PTR (void, RangeInfo->EndAddress))); + ACPI_FORMAT_UINT64 (RangeInfo->StartAddress), + ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); ACPI_FREE (RangeInfo); return_VOID; @@ -266,12 +266,12 @@ AcpiUtCheckAddressRange ( Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode); ACPI_WARNING ((AE_INFO, - "%s range 0x%p-0x%p conflicts with OpRegion 0x%p-0x%p (%s)", + "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", AcpiUtGetRegionName (SpaceId), - ACPI_CAST_PTR (void, Address), - ACPI_CAST_PTR (void, EndAddress), - ACPI_CAST_PTR (void, RangeInfo->StartAddress), - ACPI_CAST_PTR (void, RangeInfo->EndAddress), + ACPI_FORMAT_UINT64 (Address), + ACPI_FORMAT_UINT64 (EndAddress), + ACPI_FORMAT_UINT64 (RangeInfo->StartAddress), + ACPI_FORMAT_UINT64 (RangeInfo->EndAddress), Pathname)); ACPI_FREE (Pathname); } diff --git a/sys/contrib/dev/acpica/components/utilities/utbuffer.c b/sys/contrib/dev/acpica/components/utilities/utbuffer.c index 862ac6b..cc41419 100644 --- a/sys/contrib/dev/acpica/components/utilities/utbuffer.c +++ b/sys/contrib/dev/acpica/components/utilities/utbuffer.c @@ -158,6 +158,15 @@ AcpiUtDumpBuffer ( return; } + /* + * Add comment characters so rest of line is ignored when + * compiled + */ + if (j == 0) + { + AcpiOsPrintf ("// "); + } + BufChar = Buffer[(ACPI_SIZE) i + j]; if (ACPI_IS_PRINT (BufChar)) { diff --git a/sys/contrib/dev/acpica/components/utilities/utglobal.c b/sys/contrib/dev/acpica/components/utilities/utglobal.c index 1dfd3e1..e027aa1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/components/utilities/utglobal.c @@ -111,12 +111,19 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {"_SB_", ACPI_TYPE_DEVICE, NULL}, {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_TZ_", ACPI_TYPE_DEVICE, NULL}, - {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, + /* + * March, 2015: + * The _REV object is in the process of being deprecated, because + * other ACPI implementations permanently return 2. Thus, it + * has little or no value. Return 2 for compatibility with + * other ACPI implementations. + */ + {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR (char, 2)}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, + {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR (char, 1)}, #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) - {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, + {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR (char, 1)}, #endif /* Table terminator */ diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c index d5d81ca..f3d2222 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/components/utilities/utmisc.c @@ -84,6 +84,7 @@ AcpiUtIsPciRootBridge ( } +#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP) /******************************************************************************* * * FUNCTION: AcpiUtIsAmlTable @@ -114,6 +115,7 @@ AcpiUtIsAmlTable ( return (FALSE); } +#endif /******************************************************************************* diff --git a/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c index 6b225ca..bf6ba86 100644 --- a/sys/contrib/dev/acpica/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/components/utilities/utosi.c @@ -105,6 +105,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ + {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ /* Feature Group Strings */ diff --git a/sys/contrib/dev/acpica/components/utilities/utprint.c b/sys/contrib/dev/acpica/components/utilities/utprint.c index d870ad4..62aecf0 100644 --- a/sys/contrib/dev/acpica/components/utilities/utprint.c +++ b/sys/contrib/dev/acpica/components/utilities/utprint.c @@ -442,11 +442,11 @@ AcpiUtVsnprintf ( const char *Format, va_list Args) { - UINT8 Base = 10; - UINT8 Type = 0; - INT32 Width = -1; - INT32 Precision = -1; - char Qualifier = 0; + UINT8 Base; + UINT8 Type; + INT32 Width; + INT32 Precision; + char Qualifier; UINT64 Number; char *Pos; char *End; @@ -468,6 +468,9 @@ AcpiUtVsnprintf ( continue; } + Type = 0; + Base = 10; + /* Process sign */ do diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c index d90d694..3396319 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstate.c +++ b/sys/contrib/dev/acpica/components/utilities/utstate.c @@ -50,44 +50,6 @@ /******************************************************************************* * - * FUNCTION: AcpiUtCreatePkgStateAndPush - * - * PARAMETERS: Object - Object to be added to the new state - * Action - Increment/Decrement - * StateList - List the state will be added to - * - * RETURN: Status - * - * DESCRIPTION: Create a new state and push it - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtCreatePkgStateAndPush ( - void *InternalObject, - void *ExternalObject, - UINT16 Index, - ACPI_GENERIC_STATE **StateList) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_ENTRY (); - - - State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index); - if (!State) - { - return (AE_NO_MEMORY); - } - - AcpiUtPushGenericState (StateList, State); - return (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtPushGenericState * * PARAMETERS: ListHead - Head of the state stack diff --git a/sys/contrib/dev/acpica/components/utilities/utuuid.c b/sys/contrib/dev/acpica/components/utilities/utuuid.c index 8b3cb99..435c6c3 100644 --- a/sys/contrib/dev/acpica/components/utilities/utuuid.c +++ b/sys/contrib/dev/acpica/components/utilities/utuuid.c @@ -48,6 +48,7 @@ ACPI_MODULE_NAME ("utuuid") +#if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) /* * UUID support functions. * @@ -99,3 +100,4 @@ AcpiUtConvertStringToUuid ( AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); } } +#endif diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index f630575..23464d6 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -77,7 +77,7 @@ typedef struct acpi_db_execute_walk #define PARAM_LIST(pl) pl -#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_verbose) +#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_Verbose) #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ AcpiOsPrintf PARAM_LIST(fp);} diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 34cf1f7..f4487e5 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -129,6 +129,7 @@ typedef enum /* Types used only for the Data Table Compiler */ ACPI_DMT_BUFFER, + ACPI_DMT_RAW_BUFFER, /* Large, multiple line buffer */ ACPI_DMT_DEVICE_PATH, ACPI_DMT_LABEL, ACPI_DMT_PCI_PATH, @@ -351,9 +352,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3ptHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; @@ -422,6 +421,15 @@ AcpiDmLineHeader2 ( * dmtbdump */ void +AcpiDmDumpBuffer ( + void *Table, + UINT32 BufferOffset, + UINT32 Length, + UINT32 AbsoluteOffset, + char *Header, + BOOLEAN MultiLine); + +void AcpiDmDumpAsf ( ACPI_TABLE_HEADER *Table); @@ -996,6 +1004,10 @@ AcpiDmCloseOperator ( */ void AdDisassemblerHeader ( - char *Filename); + char *Filename, + UINT8 TableType); + +#define ACPI_IS_AML_TABLE 0 +#define ACPI_IS_DATA_TABLE 1 #endif /* __ACDISASM_H__ */ diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 9b6e936..ab2fc26 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -310,9 +310,10 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_O ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_disasm); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_verbose); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Disasm); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Verbose); ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods); ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods); ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList); @@ -325,9 +326,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateThreads, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_tables); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_stats); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_ini_methods); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOutputToFile); ACPI_GLOBAL (char *, AcpiGbl_DbBuffer); diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 5f9b0f3..9729930 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -54,7 +54,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE; /* Total number of aml opcodes defined */ -#define AML_NUM_OPCODES 0x81 +#define AML_NUM_OPCODES 0x82 /* Forward declarations */ diff --git a/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index b23d175..35d53f6 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -64,23 +64,12 @@ #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val)) /* - * printf() format helpers. These macros are workarounds for the difficulties + * printf() format helper. This macros is a workaround for the difficulties * with emitting 64-bit integers and 64-bit pointers with the same code * for both 32-bit and 64-bit hosts. */ #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) -#if ACPI_MACHINE_WIDTH == 64 -#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) -#define ACPI_FORMAT_TO_UINT(i) ACPI_FORMAT_UINT64(i) -#define ACPI_PRINTF_UINT "0x%8.8X%8.8X" - -#else -#define ACPI_FORMAT_NATIVE_UINT(i) 0, (UINT32) (i) -#define ACPI_FORMAT_TO_UINT(i) (UINT32) (i) -#define ACPI_PRINTF_UINT "0x%8.8X" -#endif - /* * Macros for moving data around to/from buffers that are possibly unaligned. diff --git a/sys/contrib/dev/acpica/include/acopcode.h b/sys/contrib/dev/acpica/include/acopcode.h index f4ba55d..9432d61 100644 --- a/sys/contrib/dev/acpica/include/acopcode.h +++ b/sys/contrib/dev/acpica/include/acopcode.h @@ -112,6 +112,7 @@ #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) +#define ARGP_EXTERNAL_OP ARGP_LIST3 (ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_BYTEDATA) #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) #define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) @@ -245,6 +246,7 @@ #define ARGI_DWORD_OP ARGI_INVALID_OPCODE #define ARGI_ELSE_OP ARGI_INVALID_OPCODE #define ARGI_EVENT_OP ARGI_INVALID_OPCODE +#define ARGI_EXTERNAL_OP ARGI_LIST3 (ARGI_STRING, ARGI_INTEGER, ARGI_INTEGER) #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) #define ARGI_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 26988ab..8f6e089 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150204 +#define ACPI_CA_VERSION 0x20150410 #include #include @@ -503,7 +503,7 @@ AcpiReallocateRootTable ( ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_SIZE *RsdpAddress)) + ACPI_PHYSICAL_ADDRESS *RsdpAddress)) ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS diff --git a/sys/contrib/dev/acpica/include/acresrc.h b/sys/contrib/dev/acpica/include/acresrc.h index 3b62275..ef3265876 100644 --- a/sys/contrib/dev/acpica/include/acresrc.h +++ b/sys/contrib/dev/acpica/include/acresrc.h @@ -352,8 +352,9 @@ AcpiRsSetResourceLength ( /* - * rsdump + * rsdump - Debugger support */ +#ifdef ACPI_DEBUGGER void AcpiRsDumpResourceList ( ACPI_RESOURCE *Resource); @@ -361,6 +362,7 @@ AcpiRsDumpResourceList ( void AcpiRsDumpIrqList ( UINT8 *RouteTable); +#endif /* diff --git a/sys/contrib/dev/acpica/include/acrestyp.h b/sys/contrib/dev/acpica/include/acrestyp.h index 971dd72..d695451 100644 --- a/sys/contrib/dev/acpica/include/acrestyp.h +++ b/sys/contrib/dev/acpica/include/acrestyp.h @@ -345,6 +345,36 @@ typedef struct acpi_resource_source UINT8 MaxAddressFixed; \ ACPI_RESOURCE_ATTRIBUTE Info; +typedef struct acpi_address16_attribute +{ + UINT16 Granularity; + UINT16 Minimum; + UINT16 Maximum; + UINT16 TranslationOffset; + UINT16 AddressLength; + +} ACPI_ADDRESS16_ATTRIBUTE; + +typedef struct acpi_address32_attribute +{ + UINT32 Granularity; + UINT32 Minimum; + UINT32 Maximum; + UINT32 TranslationOffset; + UINT32 AddressLength; + +} ACPI_ADDRESS32_ATTRIBUTE; + +typedef struct acpi_address64_attribute +{ + UINT64 Granularity; + UINT64 Minimum; + UINT64 Maximum; + UINT64 TranslationOffset; + UINT64 AddressLength; + +} ACPI_ADDRESS64_ATTRIBUTE; + typedef struct acpi_resource_address { ACPI_RESOURCE_ADDRESS_COMMON @@ -354,11 +384,7 @@ typedef struct acpi_resource_address typedef struct acpi_resource_address16 { ACPI_RESOURCE_ADDRESS_COMMON - UINT16 Granularity; - UINT16 Minimum; - UINT16 Maximum; - UINT16 TranslationOffset; - UINT16 AddressLength; + ACPI_ADDRESS16_ATTRIBUTE Address; ACPI_RESOURCE_SOURCE ResourceSource; } ACPI_RESOURCE_ADDRESS16; @@ -366,11 +392,7 @@ typedef struct acpi_resource_address16 typedef struct acpi_resource_address32 { ACPI_RESOURCE_ADDRESS_COMMON - UINT32 Granularity; - UINT32 Minimum; - UINT32 Maximum; - UINT32 TranslationOffset; - UINT32 AddressLength; + ACPI_ADDRESS32_ATTRIBUTE Address; ACPI_RESOURCE_SOURCE ResourceSource; } ACPI_RESOURCE_ADDRESS32; @@ -378,11 +400,7 @@ typedef struct acpi_resource_address32 typedef struct acpi_resource_address64 { ACPI_RESOURCE_ADDRESS_COMMON - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; + ACPI_ADDRESS64_ATTRIBUTE Address; ACPI_RESOURCE_SOURCE ResourceSource; } ACPI_RESOURCE_ADDRESS64; @@ -391,11 +409,7 @@ typedef struct acpi_resource_extended_address64 { ACPI_RESOURCE_ADDRESS_COMMON UINT8 RevisionID; - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; + ACPI_ADDRESS64_ATTRIBUTE Address; UINT64 TypeSpecific; } ACPI_RESOURCE_EXTENDED_ADDRESS64; diff --git a/sys/contrib/dev/acpica/include/acstruct.h b/sys/contrib/dev/acpica/include/acstruct.h index 1de614f..547921b 100644 --- a/sys/contrib/dev/acpica/include/acstruct.h +++ b/sys/contrib/dev/acpica/include/acstruct.h @@ -69,11 +69,6 @@ #define ACPI_WALK_METHOD 0x01 #define ACPI_WALK_METHOD_RESTART 0x02 -/* Flags for iASL compiler only */ - -#define ACPI_WALK_CONST_REQUIRED 0x10 -#define ACPI_WALK_CONST_OPTIONAL 0x20 - typedef struct acpi_walk_state { diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index bc1574d..3eb02d3 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -70,8 +70,9 @@ AcpiTbScanMemoryForRsdp ( * tbdata - table data structure management */ ACPI_STATUS -AcpiTbGetNextRootIndex ( - UINT32 *TableIndex); +AcpiTbGetNextTableDescriptor ( + UINT32 *TableIndex, + ACPI_TABLE_DESC **TableDesc); void AcpiTbInitTableDescriptor ( @@ -173,14 +174,6 @@ AcpiTbInstallStandardTable ( BOOLEAN Override, UINT32 *TableIndex); -ACPI_STATUS -AcpiTbStoreTable ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER *Table, - UINT32 Length, - UINT8 Flags, - UINT32 *TableIndex); - void AcpiTbUninstallTable ( ACPI_TABLE_DESC *TableDesc); diff --git a/sys/contrib/dev/acpica/include/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h index 2251af8..0dd988b 100644 --- a/sys/contrib/dev/acpica/include/actbl2.h +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -75,6 +75,7 @@ #define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ +#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ #define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ @@ -979,7 +980,8 @@ typedef struct acpi_lpit_header enum AcpiLpitType { ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, - ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 + ACPI_LPIT_TYPE_SIMPLE_IO = 0x01, + ACPI_LPIT_TYPE_RESERVED = 0x02 /* 2 and above are reserved */ }; /* Masks for Flags field above */ @@ -1084,6 +1086,24 @@ typedef struct acpi_table_mchi /******************************************************************************* * + * MSDM - Microsoft Data Management table + * + * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", + * November 29, 2011. Copyright 2011 Microsoft + * + ******************************************************************************/ + +/* Basic MSDM table is only the common ACPI header */ + +typedef struct acpi_table_msdm +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_MSDM; + + +/******************************************************************************* + * * MTMR - MID Timer Table * Version 1 * @@ -1113,10 +1133,9 @@ typedef struct acpi_mtmr_entry /******************************************************************************* * * SLIC - Software Licensing Description Table - * Version 1 * - * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems", - * Copyright 2006 + * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", + * November 29, 2011. Copyright 2011 Microsoft * ******************************************************************************/ @@ -1129,62 +1148,6 @@ typedef struct acpi_table_slic } ACPI_TABLE_SLIC; -/* Common SLIC subtable header */ - -typedef struct acpi_slic_header -{ - UINT32 Type; - UINT32 Length; - -} ACPI_SLIC_HEADER; - -/* Values for Type field above */ - -enum AcpiSlicType -{ - ACPI_SLIC_TYPE_PUBLIC_KEY = 0, - ACPI_SLIC_TYPE_WINDOWS_MARKER = 1, - ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */ -}; - - -/* - * SLIC Subtables, correspond to Type in ACPI_SLIC_HEADER - */ - -/* 0: Public Key Structure */ - -typedef struct acpi_slic_key -{ - ACPI_SLIC_HEADER Header; - UINT8 KeyType; - UINT8 Version; - UINT16 Reserved; - UINT32 Algorithm; - char Magic[4]; - UINT32 BitLength; - UINT32 Exponent; - UINT8 Modulus[128]; - -} ACPI_SLIC_KEY; - - -/* 1: Windows Marker Structure */ - -typedef struct acpi_slic_marker -{ - ACPI_SLIC_HEADER Header; - UINT32 Version; - char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ - char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ - char WindowsFlag[8]; - UINT32 SlicVersion; - UINT8 Reserved[16]; - UINT8 Signature[128]; - -} ACPI_SLIC_MARKER; - - /******************************************************************************* * * SPCR - Serial Port Console Redirection table diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index c6f2170..79ae310 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -201,9 +201,29 @@ typedef int INT32; typedef INT32 ACPI_NATIVE_INT; typedef UINT32 ACPI_SIZE; + +#ifdef ACPI_32BIT_PHYSICAL_ADDRESS + +/* + * OSPMs can define this to shrink the size of the structures for 32-bit + * none PAE environment. ASL compiler may always define this to generate + * 32-bit OSPM compliant tables. + */ typedef UINT32 ACPI_IO_ADDRESS; typedef UINT32 ACPI_PHYSICAL_ADDRESS; +#else /* ACPI_32BIT_PHYSICAL_ADDRESS */ + +/* + * It is reported that, after some calculations, the physical addresses can + * wrap over the 32-bit boundary on 32-bit PAE environment. + * https://bugzilla.kernel.org/show_bug.cgi?id=87971 + */ +typedef UINT64 ACPI_IO_ADDRESS; +typedef UINT64 ACPI_PHYSICAL_ADDRESS; + +#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */ + #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX @@ -720,23 +740,26 @@ typedef UINT32 ACPI_EVENT_TYPE; * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+-+ - * | Bits 31:4 |3|2|1|0| - * +-------------+-+-+-+-+ - * | | | | | - * | | | | +- Enabled? - * | | | +--- Enabled for wake? - * | | +----- Set? - * | +------- Has a handler? - * +------------- + * +-------------+-+-+-+-+-+ + * | Bits 31:5 |4|3|2|1|0| + * +-------------+-+-+-+-+-+ + * | | | | | | + * | | | | | +- Enabled? + * | | | | +--- Enabled for wake? + * | | | +----- Status bit set? + * | | +------- Enable bit set? + * | +--------- Has a handler? + * +--------------- */ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 -#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 -#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x08 +#define ACPI_EVENT_FLAG_STATUS_SET (ACPI_EVENT_STATUS) 0x04 +#define ACPI_EVENT_FLAG_ENABLE_SET (ACPI_EVENT_STATUS) 0x08 +#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x10 +#define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ @@ -1344,6 +1367,7 @@ typedef struct acpi_memory_list #define ACPI_OSI_WIN_VISTA_SP2 0x0A #define ACPI_OSI_WIN_7 0x0B #define ACPI_OSI_WIN_8 0x0C +#define ACPI_OSI_WIN_10 0x0D /* Definitions of file IO */ diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index a651863..85426bf 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -723,6 +723,12 @@ const ACPI_PREDEFINED_INFO * AcpiUtMatchPredefinedMethod ( char *Name); +void +AcpiUtGetExpectedReturnTypes ( + char *Buffer, + UINT32 ExpectedBtypes); + +#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) const ACPI_PREDEFINED_INFO * AcpiUtMatchResourceName ( char *Name); @@ -733,15 +739,11 @@ AcpiUtDisplayPredefinedMethod ( const ACPI_PREDEFINED_INFO *ThisName, BOOLEAN MultiLine); -void -AcpiUtGetExpectedReturnTypes ( - char *Buffer, - UINT32 ExpectedBtypes); - UINT32 AcpiUtGetResourceBitWidth ( char *Buffer, UINT16 Types); +#endif /* @@ -782,13 +784,6 @@ AcpiUtCreateUpdateStateAndPush ( UINT16 Action, ACPI_GENERIC_STATE **StateList); -ACPI_STATUS -AcpiUtCreatePkgStateAndPush ( - void *InternalObject, - void *ExternalObject, - UINT16 Index, - ACPI_GENERIC_STATE **StateList); - ACPI_GENERIC_STATE * AcpiUtCreateControlState ( void); @@ -827,9 +822,11 @@ BOOLEAN AcpiUtIsPciRootBridge ( char *Id); +#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP) BOOLEAN AcpiUtIsAmlTable ( ACPI_TABLE_HEADER *Table); +#endif ACPI_STATUS AcpiUtWalkPackageTree ( @@ -918,6 +915,7 @@ void AcpiUtStrupr ( char *SrcString); +#ifdef ACPI_ASL_COMPILER void AcpiUtStrlwr ( char *SrcString); @@ -926,6 +924,7 @@ int AcpiUtStricmp ( char *String1, char *String2); +#endif ACPI_STATUS AcpiUtStrtoul64 ( @@ -938,9 +937,11 @@ AcpiUtPrintString ( char *String, UINT16 MaxLength); +#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP void UtConvertBackslashes ( char *Pathname); +#endif BOOLEAN AcpiUtValidAcpiName ( @@ -1189,9 +1190,11 @@ AcpiUtFilePrintf ( /* * utuuid -- UUID support functions */ +#if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) void AcpiUtConvertStringToUuid ( char *InString, UINT8 *UuidBuffer); +#endif #endif /* _ACUTILS_H */ diff --git a/sys/contrib/dev/acpica/include/amlcode.h b/sys/contrib/dev/acpica/include/amlcode.h index 03530b9..d56f6d9 100644 --- a/sys/contrib/dev/acpica/include/amlcode.h +++ b/sys/contrib/dev/acpica/include/amlcode.h @@ -65,6 +65,7 @@ #define AML_PACKAGE_OP (UINT16) 0x12 #define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */ #define AML_METHOD_OP (UINT16) 0x14 +#define AML_EXTERNAL_OP (UINT16) 0x15 /* ACPI 6.0 */ #define AML_DUAL_NAME_PREFIX (UINT16) 0x2e #define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f #define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30 @@ -209,7 +210,6 @@ #define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 #define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 #define AML_INT_BYTELIST_OP (UINT16) 0x0033 -#define AML_INT_STATICSTRING_OP (UINT16) 0x0034 #define AML_INT_METHODCALL_OP (UINT16) 0x0035 #define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 #define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 diff --git a/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 759a68e..f5f3b1a 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -77,6 +77,7 @@ #define ACPI_LARGE_NAMESPACE_NODE #define ACPI_DATA_TABLE_DISASSEMBLY #define ACPI_SINGLE_THREADED +#define ACPI_32BIT_PHYSICAL_ADDRESS #endif /* AcpiExec configuration. Multithreaded with full AML debugger */ diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 545f641..490f277 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -194,27 +194,27 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) break; switch (res->Type) { case ACPI_RESOURCE_TYPE_ADDRESS16: - min = res->Data.Address16.Minimum; - max = res->Data.Address16.Maximum; - length = res->Data.Address16.AddressLength; + min = res->Data.Address16.Address.Minimum; + max = res->Data.Address16.Address.Maximum; + length = res->Data.Address16.Address.AddressLength; break; case ACPI_RESOURCE_TYPE_ADDRESS32: - min = res->Data.Address32.Minimum; - max = res->Data.Address32.Maximum; - length = res->Data.Address32.AddressLength; + min = res->Data.Address32.Address.Minimum; + max = res->Data.Address32.Address.Maximum; + length = res->Data.Address32.Address.AddressLength; break; case ACPI_RESOURCE_TYPE_ADDRESS64: - min = res->Data.Address64.Minimum; - max = res->Data.Address64.Maximum; - length = res->Data.Address64.AddressLength; + min = res->Data.Address64.Address.Minimum; + max = res->Data.Address64.Address.Maximum; + length = res->Data.Address64.Address.AddressLength; break; default: KASSERT(res->Type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, ("should never happen")); - min = res->Data.ExtAddress64.Minimum; - max = res->Data.ExtAddress64.Maximum; - length = res->Data.ExtAddress64.AddressLength; + min = res->Data.ExtAddress64.Address.Minimum; + max = res->Data.ExtAddress64.Address.Maximum; + length = res->Data.ExtAddress64.Address.AddressLength; break; } if (length == 0) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index 1d710dd..118b0a5 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -296,33 +296,33 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context) case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: switch (res->Type) { case ACPI_RESOURCE_TYPE_ADDRESS16: - gran = res->Data.Address16.Granularity; - min = res->Data.Address16.Minimum; - max = res->Data.Address16.Maximum; - length = res->Data.Address16.AddressLength; + gran = res->Data.Address16.Address.Granularity; + min = res->Data.Address16.Address.Minimum; + max = res->Data.Address16.Address.Maximum; + length = res->Data.Address16.Address.AddressLength; name = "Address16"; break; case ACPI_RESOURCE_TYPE_ADDRESS32: - gran = res->Data.Address32.Granularity; - min = res->Data.Address32.Minimum; - max = res->Data.Address32.Maximum; - length = res->Data.Address32.AddressLength; + gran = res->Data.Address32.Address.Granularity; + min = res->Data.Address32.Address.Minimum; + max = res->Data.Address32.Address.Maximum; + length = res->Data.Address32.Address.AddressLength; name = "Address32"; break; case ACPI_RESOURCE_TYPE_ADDRESS64: - gran = res->Data.Address64.Granularity; - min = res->Data.Address64.Minimum; - max = res->Data.Address64.Maximum; - length = res->Data.Address64.AddressLength; + gran = res->Data.Address64.Address.Granularity; + min = res->Data.Address64.Address.Minimum; + max = res->Data.Address64.Address.Maximum; + length = res->Data.Address64.Address.AddressLength; name = "Address64"; break; default: KASSERT(res->Type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, ("should never happen")); - gran = res->Data.ExtAddress64.Granularity; - min = res->Data.ExtAddress64.Minimum; - max = res->Data.ExtAddress64.Maximum; - length = res->Data.ExtAddress64.AddressLength; + gran = res->Data.ExtAddress64.Address.Granularity; + min = res->Data.ExtAddress64.Address.Minimum; + max = res->Data.ExtAddress64.Address.Maximum; + length = res->Data.ExtAddress64.Address.AddressLength; name = "ExtAddress64"; break; } diff --git a/sys/x86/acpica/OsdEnvironment.c b/sys/x86/acpica/OsdEnvironment.c index 380f1bf..be612b5 100644 --- a/sys/x86/acpica/OsdEnvironment.c +++ b/sys/x86/acpica/OsdEnvironment.c @@ -68,7 +68,7 @@ acpi_get_root_from_loader(void) static u_long acpi_get_root_from_memory(void) { - ACPI_SIZE acpi_root; + ACPI_PHYSICAL_ADDRESS acpi_root; if (ACPI_SUCCESS(AcpiFindRootPointer(&acpi_root))) return (acpi_root); -- cgit v1.1