From d4e02b59d015dd5ab0e03d36200d3d6669102a2a Mon Sep 17 00:00:00 2001 From: Al Stone Date: Feb 22 2016 23:59:45 +0000 Subject: Imported Upstream version 20160212 --- diff --git a/changes.txt b/changes.txt index 1d3ec5a..c9eaa64 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,66 @@ ---------------------------------------- +12 February 2016. Summary of changes for version 20160212: + +This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +Implemented full support for the ACPI 6.1 specification (released in +January). This version of the specification is available at: +http://www.uefi.org/specifications + +Only a relatively small number of changes were required in ACPICA to +support ACPI 6.1, in these areas: +- New predefined names +- New _HID values +- A new subtable for HEST +- A few other header changes for new values + +Ensure \_SB_._INI is executed before any _REG methods are executed. There +appears to be existing BIOS code that relies on this behavior. Lv Zheng. + +Reverted a change made in version 20151218 which enabled method +invocations to be targets of various ASL operators (SuperName and Target +grammar elements). While the new behavior is supported by the ACPI +specification, other AML interpreters do not support this behavior and +never will. The ACPI specification will be updated for ACPI 6.2 to remove +this support. Therefore, the change was reverted to the original ACPICA +behavior. + +ACPICA now supports the GCC 6 compiler. + +Current Release: (Note: build changes increased sizes) + Non-Debug Version: 136.2K Code, 51.5K Data, 187.7K Total + Debug Version: 200.4K Code, 82.0K Data, 282.4K Total +Previous Release: + Non-Debug Version: 102.7K Code, 28.4K Data, 131.1K Total + Debug Version: 200.4K Code, 81.9K Data, 282.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +Completed full support for the ACPI 6.0 External() AML opcode. The +compiler emits an external AML opcode for each ASL External statement. +This opcode is used by the disassembler to assist with the disassembly of +external control methods by specifying the required number of arguments +for the method. AML interpreters do not use this opcode. To ensure that +interpreters do not even see the opcode, a block of one or more external +opcodes is surrounded by an "If(0)" construct. As this feature becomes +commonly deployed in BIOS code, the ability of disassemblers to correctly +disassemble AML code will be greatly improved. David Box. + +iASL: Implemented support for an optional cross-reference output file. +The -lx option will create a the cross-reference file with the suffix +"xrf". Three different types of cross-reference are created in this file: +- List of object references made from within each control method +- Invocation (caller) list for each user-defined control method +- List of references to each non-method object in the namespace + +iASL: Method invocations as ASL Target operands are now disallowed and +flagged as errors in preparation for ACPI 6.2 (see the description of the +problem above). + +---------------------------------------- 8 January 2016. Summary of changes for version 20160108: 1) ACPICA kernel-resident subsystem: diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 8b71edd..ed4ed2d 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -56,7 +56,9 @@ OBJECTS = \ $(OBJDIR)/aslbtypes.o\ $(OBJDIR)/aslcodegen.o\ $(OBJDIR)/aslcompile.o\ + $(OBJDIR)/asldebug.o\ $(OBJDIR)/aslerror.o\ + $(OBJDIR)/aslexternal.o\ $(OBJDIR)/aslfiles.o\ $(OBJDIR)/aslfileio.o\ $(OBJDIR)/aslfold.o\ @@ -100,6 +102,7 @@ OBJECTS = \ $(OBJDIR)/asluuid.o\ $(OBJDIR)/aslwalks.o\ $(OBJDIR)/aslxref.o\ + $(OBJDIR)/aslxrefout.o\ $(OBJDIR)/cmfsize.o\ $(OBJDIR)/dbfileio.o\ $(OBJDIR)/dmbuffer.o\ diff --git a/source/common/adwalk.c b/source/common/adwalk.c index daa3929..28255c6 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -760,6 +760,7 @@ AcpiDmXrefDescendingOp ( ACPI_OPERAND_OBJECT *Object; UINT32 ParamCount = 0; char *Pathname; + UINT16 Flags = 0; WalkState = Info->WalkState; @@ -774,7 +775,24 @@ AcpiDmXrefDescendingOp ( { goto Exit; } + else if (Op->Common.Parent && + Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP) + { + /* External() NamePath */ + + Path = Op->Common.Value.String; + ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer; + if (ObjectType == ACPI_TYPE_METHOD) + { + ParamCount = (UINT32) + Op->Common.Next->Common.Next->Common.Value.Integer; + } + + AcpiDmAddOpToExternalList (Op, Path, + (UINT8) ObjectType, ParamCount, Flags); + goto Exit; + } /* Get the NamePath from the appropriate place */ @@ -842,6 +860,7 @@ AcpiDmXrefDescendingOp ( /* Node was created by an External() statement */ Status = AE_NOT_FOUND; + Flags = ACPI_EXT_RESOLVED_REFERENCE; } if (ACPI_FAILURE (Status)) @@ -861,12 +880,12 @@ AcpiDmXrefDescendingOp ( if (Node) { AcpiDmAddNodeToExternalList (Node, - (UINT8) ObjectType, 0, 0); + (UINT8) ObjectType, 0, Flags); } else { AcpiDmAddOpToExternalList (Op, Path, - (UINT8) ObjectType, 0, 0); + (UINT8) ObjectType, 0, Flags); } } } diff --git a/source/common/ahids.c b/source/common/ahids.c index 2a5fdc7..51dc8dc 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -75,6 +75,10 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI000D", "Power Meter Device"}, {"ACPI000E", "Time and Alarm Device"}, {"ACPI000F", "User Presence Detection Device"}, + {"ACPI0010", "Processor Container Device"}, + {"ACPI0011", "Generic Buttons Device"}, + {"ACPI0012", "NVDIMM Root Device"}, + {"ACPI0013", "Generic Event Device"}, {"ADMA0F28", "Intel Audio DMA"}, {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, @@ -185,6 +189,7 @@ const AH_DEVICE_ID AslDeviceIds[] = {"PNP0C12", "Device Bay Controller"}, {"PNP0C14", "Windows Management Instrumentation Device"}, {"PNP0C15", "Docking Station"}, + {"PNP0C33", "Error Device"}, {"PNP0C40", "Standard Button Controller"}, {"PNP0C50", "HID Protocol Device (I2C bus)"}, {"PNP0C60", "Display Sensor Device"}, diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index 845e685..c3991be 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -140,6 +140,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_FDI", "Floppy Drive Information", "Returns a floppy drive information block"), AH_PREDEF ("_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"), AH_PREDEF ("_FIF", "Fan Information", "Returns fan device information"), + AH_PREDEF ("_FIT", "Firmware Interface Table", "Returns a list of NFIT structures"), AH_PREDEF ("_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"), AH_PREDEF ("_FLC", "Flow Control", "Flow control, Resource Descriptor field"), AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"), @@ -332,8 +333,10 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"), AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"), AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"), - AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"), AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), + AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"), + AH_PREDEF ("_WPC", "Wireless Power Calibration", "Calibrate power and notify wireless device"), + AH_PREDEF ("_WPP", "Wireless Power Polling", "Get recommended polling interval"), AH_PREDEF (NULL, NULL, NULL) }; diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 403e684..bb44b88 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -754,6 +754,46 @@ AcpiDmAddPathToExternalList ( /******************************************************************************* * + * FUNCTION: AcpiDmEternalIsMatch + * + * PARAMETERS: NamePath - Path to match to External Name + * ExternalPath - External NamePath to be matched + * + * RETURN: BOOLEAN + * + * DESCRIPTION: Returns TRUE if NamePath matches the last NamePath-length + * characters of ExternalPath. + * + * External (_SB_.DEV0.ABCD) will match: + * _SB_.DEV0.ABCD + * DEV0.ABCD + * ABCD + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmExternalIsMatch ( + const char * NamePath, + const char * ListNamePath) +{ + BOOLEAN Match = FALSE; + + + if (strlen (ListNamePath) >= strlen (NamePath)) + { + if (!strcmp (ListNamePath + + (strlen (ListNamePath) - strlen (NamePath)), NamePath)) + { + return (TRUE); + } + } + + return (Match); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmCreateNewExternal * * PARAMETERS: ExternalPath - External path to the object @@ -808,11 +848,14 @@ AcpiDmCreateNewExternal ( NextExternal = AcpiGbl_ExternalList; while (NextExternal) { - if (!strcmp (ExternalPath, NextExternal->Path)) + /* Check for duplicates */ + + if (AcpiDmExternalIsMatch (ExternalPath, NextExternal->Path)) { /* Duplicate method, check that the Value (ArgCount) is the same */ if ((NextExternal->Type == ACPI_TYPE_METHOD) && + (NextExternal->Flags & ANOBJ_IS_EXTERNAL) && (NextExternal->Value != Value) && (Value > 0)) { @@ -830,6 +873,11 @@ AcpiDmCreateNewExternal ( NextExternal->Value = Value; } + /* Update flags. */ + + NextExternal->Flags |= Flags; + NextExternal->Flags &= ~ACPI_EXT_INTERNAL_PATH_ALLOCATED; + return_ACPI_STATUS (AE_ALREADY_EXISTS); } @@ -1266,76 +1314,85 @@ appearing in an SSDT, the disassembler does not know what to do unless the owning SSDT has been loaded via the -e option. #endif +static char ExternalWarningPart1[600]; +static char ExternalWarningPart2[400]; +static char ExternalWarningPart3[400]; +static char ExternalWarningPart4[200]; + void AcpiDmUnresolvedWarning ( UINT8 Type) { + char *Format; + char Pad[] = " *"; + char NoPad[] = ""; + if (!AcpiGbl_NumExternalMethods) { return; } + if (AcpiGbl_NumExternalMethods == AcpiGbl_ResolvedExternalMethods) + { + return; + } + + Format = Type ? Pad : NoPad; + + sprintf (ExternalWarningPart1, + "%s iASL Warning: There were %u external control methods found during\n" + "%s disassembly, but only %u %s resolved (%u unresolved). Additional\n" + "%s ACPI tables may be required to properly disassemble the code. This\n" + "%s resulting disassembler output file may not compile because the\n" + "%s disassembler did not know how many arguments to assign to the\n" + "%s unresolved methods. Note: SSDTs can be dynamically loaded at\n" + "%s runtime and may or may not be available via the host OS.\n", + Format, AcpiGbl_NumExternalMethods, Format, AcpiGbl_ResolvedExternalMethods, + (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), + (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods), + Format, Format, Format, Format, Format); + + sprintf (ExternalWarningPart2, + "%s To specify the tables needed to resolve external control method\n" + "%s references, the -e option can be used to specify the filenames.\n" + "%s Example iASL invocations:\n" + "%s iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" + "%s iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" + "%s iasl -e ssdt*.aml -d dsdt.aml\n", + Format, Format, Format, Format, Format, Format); + + sprintf (ExternalWarningPart3, + "%s In addition, the -fe option can be used to specify a file containing\n" + "%s control method external declarations with the associated method\n" + "%s argument counts. Each line of the file must be of the form:\n" + "%s External (, MethodObj, )\n" + "%s Invocation:\n" + "%s iasl -fe refs.txt -d dsdt.aml\n", + Format, Format, Format, Format, Format, Format); + + sprintf (ExternalWarningPart4, + "%s The following methods were unresolved and many not compile properly\n" + "%s because the disassembler had to guess at the number of arguments\n" + "%s required for each:\n", + Format, Format, Format); + if (Type) { if (!AcpiGbl_ExternalFileList) { /* The -e option was not specified */ - AcpiOsPrintf (" /*\n" - " * iASL Warning: There were %u external control methods found during\n" - " * disassembly, but additional ACPI tables to resolve these externals\n" - " * were not specified. This resulting disassembler output file may not\n" - " * compile because the disassembler did not know how many arguments\n" - " * to assign to these methods. To specify the tables needed to resolve\n" - " * external control method references, the -e option can be used to\n" - " * specify the filenames. Note: SSDTs can be dynamically loaded at\n" - " * runtime and may or may not be available via the host OS.\n" - " * Example iASL invocations:\n" - " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" - " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" - " * iasl -e ssdt*.aml -d dsdt.aml\n" - " *\n" - " * In addition, the -fe option can be used to specify a file containing\n" - " * control method external declarations with the associated method\n" - " * argument counts. Each line of the file must be of the form:\n" - " * External (, MethodObj, )\n" - " * Invocation:\n" - " * iasl -fe refs.txt -d dsdt.aml\n" - " *\n" - " * The following methods were unresolved and many not compile properly\n" - " * because the disassembler had to guess at the number of arguments\n" - " * required for each:\n" - " */\n", - AcpiGbl_NumExternalMethods); + AcpiOsPrintf (" /*\n%s *\n%s *\n%s *\n%s */\n", + ExternalWarningPart1, ExternalWarningPart2, ExternalWarningPart3, + ExternalWarningPart4); } - else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) + else { /* The -e option was specified, but there are still some unresolved externals */ - AcpiOsPrintf (" /*\n" - " * iASL Warning: There were %u external control methods found during\n" - " * disassembly, but only %u %s resolved (%u unresolved). Additional\n" - " * ACPI tables may be required to properly disassemble the code. This\n" - " * resulting disassembler output file may not compile because the\n" - " * disassembler did not know how many arguments to assign to the\n" - " * unresolved methods. Note: SSDTs can be dynamically loaded at\n" - " * runtime and may or may not be available via the host OS.\n" - " *\n" - " * If necessary, the -fe option can be used to specify a file containing\n" - " * control method external declarations with the associated method\n" - " * argument counts. Each line of the file must be of the form:\n" - " * External (, MethodObj, )\n" - " * Invocation:\n" - " * iasl -fe refs.txt -d dsdt.aml\n" - " *\n" - " * The following methods were unresolved and many not compile properly\n" - " * because the disassembler had to guess at the number of arguments\n" - " * required for each:\n" - " */\n", - AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, - (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), - (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); + AcpiOsPrintf (" /*\n%s *\n *\n */\n", + ExternalWarningPart1, ExternalWarningPart3, ExternalWarningPart4); } } else @@ -1344,50 +1401,15 @@ AcpiDmUnresolvedWarning ( { /* The -e option was not specified */ - fprintf (stderr, "\n" - "iASL Warning: There were %u external control methods found during\n" - "disassembly, but additional ACPI tables to resolve these externals\n" - "were not specified. The resulting disassembler output file may not\n" - "compile because the disassembler did not know how many arguments\n" - "to assign to these methods. To specify the tables needed to resolve\n" - "external control method references, the -e option can be used to\n" - "specify the filenames. Note: SSDTs can be dynamically loaded at\n" - "runtime and may or may not be available via the host OS.\n" - "Example iASL invocations:\n" - " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" - " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" - " iasl -e ssdt*.aml -d dsdt.aml\n" - "\n" - "In addition, the -fe option can be used to specify a file containing\n" - "control method external declarations with the associated method\n" - "argument counts. Each line of the file must be of the form:\n" - " External (, MethodObj, )\n" - "Invocation:\n" - " iasl -fe refs.txt -d dsdt.aml\n", - AcpiGbl_NumExternalMethods); + fprintf (stderr, "\n%s\n%s\n%s\n", + ExternalWarningPart1, ExternalWarningPart2, ExternalWarningPart3); } - else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) + else { /* The -e option was specified, but there are still some unresolved externals */ - fprintf (stderr, "\n" - "iASL Warning: There were %u external control methods found during\n" - "disassembly, but only %u %s resolved (%u unresolved). Additional\n" - "ACPI tables may be required to properly disassemble the code. The\n" - "resulting disassembler output file may not compile because the\n" - "disassembler did not know how many arguments to assign to the\n" - "unresolved methods. Note: SSDTs can be dynamically loaded at\n" - "runtime and may or may not be available via the host OS.\n" - "\n" - "If necessary, the -fe option can be used to specify a file containing\n" - "control method external declarations with the associated method\n" - "argument counts. Each line of the file must be of the form:\n" - " External (, MethodObj, )\n" - "Invocation:\n" - " iasl -fe refs.txt -d dsdt.aml\n", - AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, - (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), - (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); + fprintf (stderr, "\n%s\n%s\n", + ExternalWarningPart1, ExternalWarningPart3); } } } diff --git a/source/common/dmtable.c b/source/common/dmtable.c index b66f2d8..89f6db0 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -196,6 +196,7 @@ static const char *AcpiDmHestSubnames[] = "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", "Generic Hardware Error Source", + "Generic Hardware Error Source V2", "Unknown Subtable Type" /* Reserved */ }; diff --git a/source/common/dmtables.c b/source/common/dmtables.c index 5df4457..5758b9d 100644 --- a/source/common/dmtables.c +++ b/source/common/dmtables.c @@ -145,6 +145,11 @@ AdCreateTableHeader ( UINT8 Checksum; + /* Reset globals for External statements */ + + AcpiGbl_NumExternalMethods = 0; + AcpiGbl_ResolvedExternalMethods = 0; + /* * Print file header and dump original table header */ diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index 3c5ce77..c6e0c4e 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -1616,6 +1616,12 @@ AcpiDmDumpHest ( SubTableLength = sizeof (ACPI_HEST_GENERIC); break; + case ACPI_HEST_TYPE_GENERIC_ERROR_V2: + + InfoTable = AcpiDmTableInfoHest10; + SubTableLength = sizeof (ACPI_HEST_GENERIC_V2); + break; + default: /* Cannot continue on unknown type - no length */ diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 5ccea2a..dde36d3 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -163,6 +163,7 @@ #define ACPI_HEST7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER,f) #define ACPI_HEST8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) +#define ACPI_HEST10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC_V2,f) #define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) #define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) #define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f) @@ -1342,6 +1343,26 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = ACPI_DMT_TERMINATOR }; +/* 10: Generic Hardware Error Source - Version 2 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[] = +{ + ACPI_DM_HEST_HEADER, + {ACPI_DMT_UINT16, ACPI_HEST10_OFFSET (RelatedSourceId), "Related Source Id", 0}, + {ACPI_DMT_UINT8, ACPI_HEST10_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_HEST10_OFFSET (Enabled), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, + {ACPI_DMT_GAS, ACPI_HEST10_OFFSET (ErrorStatusAddress), "Error Status Address", 0}, + {ACPI_DMT_HESTNTFY, ACPI_HEST10_OFFSET (Notify), "Notify", 0}, + {ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (ErrorBlockLength), "Error Status Block Length", 0}, + {ACPI_DMT_GAS, ACPI_HEST10_OFFSET (ReadAckRegister), "Read Ack Register", 0}, + {ACPI_DMT_UINT64, ACPI_HEST10_OFFSET (ReadAckPreserve), "Read Ack Preserve", 0}, + {ACPI_DMT_UINT64, ACPI_HEST10_OFFSET (ReadAckWrite), "Read Ack Write", 0}, + ACPI_DMT_TERMINATOR +}; + ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = { {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0}, @@ -2141,6 +2162,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[] = {ACPI_DMT_FLAG3, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Device not armed", 0}, {ACPI_DMT_FLAG4, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events observed", 0}, {ACPI_DMT_FLAG5, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events enabled", 0}, + {ACPI_DMT_FLAG6, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Mapping failed", 0}, {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 45ca35c..668f660 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -308,6 +308,12 @@ AnCheckMethodReturnValue ( Node = ArgOp->Asl.Node; + if (!Node) + { + /* No error message, this can happen and is OK */ + + return; + } /* Examine the parent op of this method */ diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 7ac4ca7..c956516 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -408,12 +408,25 @@ AnGetBtype ( Node = Op->Asl.Node; if (!Node) { + /* These are not expected to have a node at this time */ + + if ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEWORDFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEDWORDFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEQWORDFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBYTEFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBITFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEFIELD) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) + { + return (ACPI_UINT32_MAX - 1); + } + DbgPrint (ASL_DEBUG_OUTPUT, "No attached Nsnode: [%s] at line %u name [%s], " - "ignoring typecheck\n", + "ignoring typecheck. Parent [%s]\n", Op->Asl.ParseOpName, Op->Asl.LineNumber, - Op->Asl.ExternalName); - return (ACPI_UINT32_MAX); + Op->Asl.ExternalName, Op->Asl.Parent->Asl.ParseOpName); + return (ACPI_UINT32_MAX - 1); } ThisNodeBtype = AnMapEtypeToBtype (Node->Type); diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 08fcc37..5e25d0d 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -97,22 +97,16 @@ CgGenerateAmlOutput ( void) { - DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); - /* Generate the AML output file */ FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); Gbl_SourceLine = 0; Gbl_NextError = Gbl_ErrorLog; - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL); - DbgPrint (ASL_TREE_OUTPUT, - "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr" - " Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n", - 76, " "); - + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2); CgCloseTable (); } @@ -136,40 +130,43 @@ CgAmlWriteWalk ( void *Context) { - /* - * Print header at level 0. Alignment assumes 32-bit pointers - */ - if (!Level) + /* Generate the AML for this node */ + + CgWriteNode (Op); + + if (!Gbl_DebugFlag) { - DbgPrint (ASL_TREE_OUTPUT, - "Final parse tree used for AML output:\n"); - DbgPrint (ASL_TREE_OUTPUT, - "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr" - " Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n", - 76, " "); + return (AE_OK); } - /* Debug output */ - - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); + /* Print header at level 0. Alignment assumes 32-bit pointers */ - if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG || - Op->Asl.ParseOpcode == PARSEOP_NAMESTRING || - Op->Asl.ParseOpcode == PARSEOP_METHODCALL) + if (!Level) { DbgPrint (ASL_TREE_OUTPUT, - "%10.32s ", Op->Asl.ExternalName); + "\nFinal parse tree used for AML output:\n"); + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2); } - else + + /* Dump ParseOp name and possible value */ + + switch (Op->Asl.ParseOpcode) { - DbgPrint (ASL_TREE_OUTPUT, " "); + case PARSEOP_NAMESEG: + case PARSEOP_NAMESTRING: + case PARSEOP_METHODCALL: + case PARSEOP_STRING_LITERAL: + + UtDumpStringOp (Op, Level); + break; + + default: + + UtDumpBasicOp (Op, Level); + break; } - DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X " - "%08X %08X %08X %08X %08X %08X %04X %02d %02d %02d %02d %02d\n", + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG2, /* 1 */ (UINT32) Op->Asl.Value.Integer, /* 2 */ Op->Asl.ParseOpcode, /* 3 */ Op->Asl.AmlOpcode, @@ -191,9 +188,6 @@ CgAmlWriteWalk ( /* 19 */ Op->Asl.LogicalLineNumber, /* 20 */ Op->Asl.EndLogicalLine); - /* Generate the AML for this node */ - - CgWriteNode (Op); return (AE_OK); } @@ -558,7 +552,7 @@ CgCloseTable ( /* Process all definition blocks */ - Op = RootNode->Asl.Child; + Op = Gbl_ParseTreeRoot->Asl.Child; while (Op) { CgUpdateHeader (Op); @@ -590,7 +584,6 @@ CgWriteNode ( /* TBD: this may not be the best place for this check */ if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) || (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END)) { diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 4b8f15e..54c863e 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -138,7 +138,7 @@ CmDoCompile ( /* Did the parse tree get successfully constructed? */ - if (!RootNode) + if (!Gbl_ParseTreeRoot) { /* * If there are no errors, then we have some sort of @@ -166,22 +166,22 @@ CmDoCompile ( LsDumpParseTree (); - OpcGetIntegerWidth (RootNode->Asl.Child); + OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child); UtEndEvent (Event); /* Pre-process parse tree for any operator transforms */ Event = UtBeginEvent ("Parse tree transforms"); DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, - TrAmlTransformWalk, NULL, NULL); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL); UtEndEvent (Event); /* Generate AML opcodes corresponding to the parse tokens */ Event = UtBeginEvent ("Generate AML opcodes"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, + DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL); UtEndEvent (Event); @@ -203,11 +203,11 @@ CmDoCompile ( Event = UtBeginEvent ("Constant folding via AML interpreter"); DbgPrint (ASL_DEBUG_OUTPUT, - "\nInterpreting compile-time constant expressions\n\n"); + "Interpreting compile-time constant expressions\n\n"); if (Gbl_FoldConstants) { - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, OpcAmlConstantWalk, NULL, NULL); } else @@ -220,16 +220,16 @@ CmDoCompile ( Event = UtBeginEvent ("Updating AML opcodes after constant folding"); DbgPrint (ASL_DEBUG_OUTPUT, - "\nUpdating AML opcodes after constant folding\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, + "Updating AML opcodes after constant folding\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeUpdateWalk, NULL); UtEndEvent (Event); /* Calculate all AML package lengths */ Event = UtBeginEvent ("Generate AML package lengths"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, + DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); UtEndEvent (Event); @@ -255,7 +255,8 @@ CmDoCompile ( /* Namespace loading */ Event = UtBeginEvent ("Create ACPI Namespace"); - Status = LdLoadNamespace (RootNode); + DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n"); + Status = LdLoadNamespace (Gbl_ParseTreeRoot); UtEndEvent (Event); if (ACPI_FAILURE (Status)) { @@ -266,6 +267,7 @@ CmDoCompile ( AslGbl_NamespaceEvent = UtBeginEvent ( "Cross reference parse tree and Namespace"); + DbgPrint (ASL_DEBUG_OUTPUT, "Cross referencing namespace\n\n"); Status = XfCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { @@ -277,6 +279,14 @@ CmDoCompile ( LkFindUnreferencedObjects (); UtEndEvent (AslGbl_NamespaceEvent); + /* Resolve External Declarations */ + + Event = UtBeginEvent ("Resolve all Externals"); + DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); + UtEndEvent (Event); + /* * Semantic analysis. This can happen only after the * namespace has been loaded and cross-referenced. @@ -286,17 +296,30 @@ CmDoCompile ( Event = UtBeginEvent ("Analyze control method return types"); AnalysisWalkInfo.MethodStack = NULL; - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, + DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n"); + + if (Gbl_CrossReferenceOutput) + { + OtPrintHeaders ("Part 1: Object Reference Map " + "(Object references from within each control method)"); + } + + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, MtMethodAnalysisWalkBegin, MtMethodAnalysisWalkEnd, &AnalysisWalkInfo); UtEndEvent (Event); + /* Generate the object cross-reference file if requested */ + + Event = UtBeginEvent ("Generate cross-reference file"); + OtCreateXrefFile (); + UtEndEvent (Event); + /* Semantic error checking part two - typing of method returns */ Event = UtBeginEvent ("Determine object types returned by methods"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, + DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, AnMethodTypingWalkEnd, NULL); UtEndEvent (Event); @@ -304,10 +327,10 @@ CmDoCompile ( Event = UtBeginEvent ("Analyze AML operand types"); DbgPrint (ASL_DEBUG_OUTPUT, - "\nSemantic analysis - Operand type checking\n\n"); + "Semantic analysis - Operand type checking\n\n"); if (Gbl_DoTypechecking) { - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); } UtEndEvent (Event); @@ -315,8 +338,8 @@ CmDoCompile ( /* Semantic error checking part four - other miscellaneous checks */ Event = UtBeginEvent ("Miscellaneous analysis"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, AnOtherSemanticAnalysisWalkBegin, NULL, &AnalysisWalkInfo); UtEndEvent (Event); @@ -324,16 +347,17 @@ CmDoCompile ( /* Calculate all AML package lengths */ Event = UtBeginEvent ("Finish AML package length generation"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, + DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnInitLengthsWalk, NULL); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); UtEndEvent (Event); /* Code generation - emit the AML */ Event = UtBeginEvent ("Generate AML code and write output files"); + DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n"); CgGenerateAmlOutput (); UtEndEvent (Event); @@ -816,7 +840,7 @@ CmDeleteCaches ( Gbl_ParseOpCount = 0; Gbl_ParseOpCacheNext = NULL; Gbl_ParseOpCacheLast = NULL; - RootNode = NULL; + Gbl_ParseTreeRoot = NULL; /* Generic string cache */ diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 721abe4..d92b9b1 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -652,7 +652,13 @@ ApCheckPackage ( * asltransform - parse tree transformations */ ACPI_STATUS -TrAmlTransformWalk ( +TrAmlTransformWalkBegin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +ACPI_STATUS +TrAmlTransformWalkEnd ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); @@ -669,6 +675,25 @@ TrWalkParseTree ( ASL_WALK_CALLBACK AscendingCallback, void *Context); +/* + * aslexternal - External opcode support + */ +ACPI_STATUS +ExAmlExternalWalkBegin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +ACPI_STATUS +ExAmlExternalWalkEnd ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +void +ExDoExternal ( + ACPI_PARSE_OBJECT *Op); + /* Values for "Visitation" parameter above */ #define ASL_WALK_VISIT_DOWNWARD 0x01 @@ -909,6 +934,24 @@ XfCrossReferenceNamespace ( /* + * aslxrefout + */ +void +OtPrintHeaders ( + char *Message); + +void +OtCreateXrefFile ( + void); + +void +OtXrefWalkPart1 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + ASL_METHOD_INFO *MethodInfo); + + +/* * aslutils - common compiler utilites */ void @@ -923,11 +966,31 @@ DbgPrint ( #define ASL_PARSE_OUTPUT 1 #define ASL_TREE_OUTPUT 2 +UINT8 +UtIsBigEndianMachine ( + void); + BOOLEAN UtQueryForOverwrite ( char *Pathname); void +UtDumpStringOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level); + +void +UtDumpIntegerOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + UINT32 IntegerLength); + +void +UtDumpBasicOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level); + +void UtDisplaySupportedTables ( void); @@ -948,11 +1011,6 @@ UtLocalCalloc ( UINT32 Size); void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level); - -void UtDisplaySummary ( UINT32 FileId); @@ -1006,12 +1064,6 @@ UINT64 UtDoConstant ( char *String); -ACPI_STATUS -stroul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger); - /* * asluuid - UUID support diff --git a/source/compiler/asldebug.c b/source/compiler/asldebug.c new file mode 100644 index 0000000..6ba6066 --- /dev/null +++ b/source/compiler/asldebug.c @@ -0,0 +1,253 @@ +/****************************************************************************** + * + * Module Name: asldebug -- Debug output support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" + + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("asldebug") + + +/* Local prototypes */ + +static void +UtDumpParseOpName ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + UINT32 DataLength); + + +/******************************************************************************* + * + * FUNCTION: UtDumpIntegerOp + * + * PARAMETERS: Op - Current parse op + * Level - Current output indentation level + * IntegerLength - Output length of the integer (2/4/8/16) + * + * RETURN: None + * + * DESCRIPTION: Emit formatted debug output for "integer" ops. + * Note: IntegerLength must be one of 2,4,8,16. + * + ******************************************************************************/ + +void +UtDumpIntegerOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + UINT32 IntegerLength) +{ + + /* Emit the ParseOp name, leaving room for the integer */ + + UtDumpParseOpName (Op, Level, IntegerLength); + + /* Emit the integer based upon length */ + + switch (IntegerLength) + { + case 2: /* Byte */ + case 4: /* Word */ + case 8: /* Dword */ + + DbgPrint (ASL_TREE_OUTPUT, + "%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer); + break; + + case 16: /* Qword and Integer */ + + DbgPrint (ASL_TREE_OUTPUT, + "%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); + break; + + default: + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: UtDumpStringOp + * + * PARAMETERS: Op - Current parse op + * Level - Current output indentation level + * + * RETURN: None + * + * DESCRIPTION: Emit formatted debug output for String/Pathname ops. + * + ******************************************************************************/ + +void +UtDumpStringOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level) +{ + char *String; + + + String = Op->Asl.Value.String; + + if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) + { + /* + * For the "path" ops NAMEPATH, NAMESEG, METHODCALL -- if the + * ExternalName is valid, it takes precedence. In these cases the + * Value.String is the raw "internal" name from the AML code, which + * we don't want to use, because it contains non-ascii characters. + */ + if (Op->Asl.ExternalName) + { + String = Op->Asl.ExternalName; + } + } + + if (!String) + { + DbgPrint (ASL_TREE_OUTPUT, + " ERROR: Could not find a valid String/Path pointer\n"); + return; + } + + /* Emit the ParseOp name, leaving room for the string */ + + UtDumpParseOpName (Op, Level, strlen (String)); + DbgPrint (ASL_TREE_OUTPUT, "%s", String); +} + + +/******************************************************************************* + * + * FUNCTION: UtDumpBasicOp + * + * PARAMETERS: Op - Current parse op + * Level - Current output indentation level + * + * RETURN: None + * + * DESCRIPTION: Generic formatted debug output for "basic" ops that have no + * associated strings or integer values. + * + ******************************************************************************/ + +void +UtDumpBasicOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level) +{ + + /* Just print out the ParseOp name, there is no extra data */ + + UtDumpParseOpName (Op, Level, 0); +} + + +/******************************************************************************* + * + * FUNCTION: UtDumpParseOpName + * + * PARAMETERS: Op - Current parse op + * Level - Current output indentation level + * DataLength - Length of data to appear after the name + * + * RETURN: None + * + * DESCRIPTION: Indent and emit the ascii ParseOp name for the op + * + ******************************************************************************/ + +static void +UtDumpParseOpName ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + UINT32 DataLength) +{ + char *ParseOpName; + UINT32 IndentLength; + UINT32 NameLength; + UINT32 LineLength; + UINT32 PaddingLength; + + + /* Emit the LineNumber/IndentLevel prefix on each output line */ + + DbgPrint (ASL_TREE_OUTPUT, + "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); + + ParseOpName = UtGetOpName (Op->Asl.ParseOpcode); + + /* Calculate various lengths for output alignment */ + + IndentLength = Level * DEBUG_SPACES_PER_INDENT; + NameLength = strlen (ParseOpName); + LineLength = IndentLength + 1 + NameLength + 1 + DataLength; + PaddingLength = (DEBUG_MAX_LINE_LENGTH + 1) - LineLength; + + /* Parse tree indentation is based upon the nesting/indent level */ + + if (Level) + { + DbgPrint (ASL_TREE_OUTPUT, "%*s", IndentLength, " "); + } + + /* Emit the actual name here */ + + DbgPrint (ASL_TREE_OUTPUT, " %s", ParseOpName); + + /* Emit extra padding blanks for alignment of later data items */ + + if (LineLength > DEBUG_MAX_LINE_LENGTH) + { + /* Split a long line immediately after the ParseOpName string */ + + DbgPrint (ASL_TREE_OUTPUT, "\n%*s", + (DEBUG_FULL_LINE_LENGTH - DataLength), " "); + } + else + { + DbgPrint (ASL_TREE_OUTPUT, "%*s", PaddingLength, " "); + } +} diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index b42bae2..f615cb2 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -54,7 +54,7 @@ #define ASL_CREATOR_ID "INTL" #define ASL_DEFINE "__IASL__" -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.1" /* Configuration constants */ @@ -118,8 +118,7 @@ #define ASL_ABORT TRUE #define ASL_NO_ABORT FALSE #define ASL_EOF ACPI_UINT32_MAX -#define ASL_WITHIN_COMMENT (ACPI_UINT32_MAX -1) -#define ASL_BLANK_LINE (ACPI_UINT32_MAX -1) +#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1) /* Listings */ @@ -156,4 +155,34 @@ #define RsCreateQwordField(Op, Name, ByteOffset) \ RsCreateResourceField (Op, Name, ByteOffset, 0, 64); + +/* + * Macros for debug output + */ + +#define DEBUG_MAX_LINE_LENGTH 61 +#define DEBUG_SPACES_PER_INDENT 3 +#define DEBUG_FULL_LINE_LENGTH 71 + +#define ASL_PARSE_TREE_FULL_LINE "\n%71.71s" + +/* Header/Trailer for original parse tree directly from the parser */ + +#define ASL_PARSE_TREE_HEADER1 \ + "%*s Value P_Op Flags Line# End# LogL# EndL#\n", 65, " " + +#define ASL_PARSE_TREE_DEBUG1 \ + " %4.4X %8.8X %5d %5d %5d %5d" + +/* Header/Trailer for processed parse tree used for AML generation */ + +#define ASL_PARSE_TREE_HEADER2 \ + "%*s NameString Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"\ + " Parent Child Next Flags AcTyp Final Col"\ + " Line# End# LogL# EndL#\n", 60, " " + +#define ASL_PARSE_TREE_DEBUG2 \ + " %08X %04X %04X %01X %04X %04X %05X %05X "\ + "%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d\n" + #endif /* ASLDEFINE.H */ diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c new file mode 100644 index 0000000..5335048 --- /dev/null +++ b/source/compiler/aslexternal.c @@ -0,0 +1,491 @@ +/****************************************************************************** + * + * Module Name: aslexternal - ASL External opcode compiler support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslexternal") + + +/* Local prototypes */ + +static void +ExInsertArgCount ( + ACPI_PARSE_OBJECT *Op); + +static void +ExMoveExternals ( + ACPI_PARSE_OBJECT *DefinitionBlockOp); + + +/******************************************************************************* + * + * FUNCTION: ExDoExternal + * + * PARAMETERS: Op - Current Parse node + * + * RETURN: None + * + * DESCRIPTION: Add an External() definition to the global list. This list + * is used to generate External opcodes. + * + ******************************************************************************/ + +void +ExDoExternal ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *ListOp; + ACPI_PARSE_OBJECT *Prev; + ACPI_PARSE_OBJECT *Next; + ACPI_PARSE_OBJECT *ArgCountOp; + + + ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next; + ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST; + ArgCountOp->Asl.Value.Integer = 0; + UtSetParseOpName (ArgCountOp); + + /* Create new list node of arbitrary type */ + + ListOp = TrAllocateNode (PARSEOP_DEFAULT_ARG); + + /* Store External node as child */ + + ListOp->Asl.Child = Op; + ListOp->Asl.Next = NULL; + + if (Gbl_ExternalsListHead) + { + /* Link new External to end of list */ + + Prev = Gbl_ExternalsListHead; + Next = Prev; + while (Next) + { + Prev = Next; + Next = Next->Asl.Next; + } + + Prev->Asl.Next = ListOp; + } + else + { + Gbl_ExternalsListHead = ListOp; + } +} + + +/******************************************************************************* + * + * FUNCTION: ExInsertArgCount + * + * PARAMETERS: Op - Op for a method invocation + * + * RETURN: None + * + * DESCRIPTION: Obtain the number of arguments for a control method -- from + * the actual invocation. + * + ******************************************************************************/ + +static void +ExInsertArgCount ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Next; + ACPI_PARSE_OBJECT *NameOp; + ACPI_PARSE_OBJECT *Child; + ACPI_PARSE_OBJECT *ArgCountOp; + char * ExternalName; + char * CallName; + UINT16 ArgCount = 0; + + + CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); + + Next = Gbl_ExternalsListHead; + while (Next) + { + ArgCount = 0; + + /* Skip if External node already handled */ + + if (Next->Asl.Child->Asl.CompileFlags & NODE_VISITED) + { + Next = Next->Asl.Next; + continue; + } + + NameOp = Next->Asl.Child->Asl.Child; + ExternalName = AcpiNsGetNormalizedPathname (NameOp->Asl.Node, TRUE); + + if (!strcmp (CallName, ExternalName)) + { + Next->Asl.Child->Asl.CompileFlags |= NODE_VISITED; + + /* + * Since we will reposition Externals to the Root, set Namepath + * to the fully qualified name and recalculate the aml length + */ + if (ACPI_FAILURE (UtInternalizeName ( + ExternalName, &NameOp->Asl.Value.String))) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not Internalize External"); + + break; + } + + NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String); + + /* Get argument count */ + + Child = Op->Asl.Child; + while (Child) + { + ArgCount++; + Child = Child->Asl.Next; + } + + /* Setup ArgCount operand */ + + ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next; + ArgCountOp->Asl.Value.Integer = ArgCount; + break; + } + + Next = Next->Asl.Next; + } +} + + +/******************************************************************************* + * + * FUNCTION: ExAmlExternalWalkBegin + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: None + * + * DESCRIPTION: Parse tree walk to create external opcode list for methods. + * + ******************************************************************************/ + +ACPI_STATUS +ExAmlExternalWalkBegin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + + /* External list head saved in the definition block op */ + + if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) + { + Gbl_ExternalsListHead = Op->Asl.Value.Arg; + } + + if (!Gbl_ExternalsListHead) + { + return (AE_OK); + } + + if (Op->Asl.ParseOpcode != PARSEOP_METHODCALL) + { + return (AE_OK); + } + + /* + * The NameOp child under an ExternalOp gets turned into PARSE_METHODCALL + * by XfNamespaceLocateBegin(). Ignore these. + */ + if (Op->Asl.Parent && + Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_EXTERNAL) + { + return (AE_OK); + } + + ExInsertArgCount (Op); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: ExAmlExternalWalkEnd + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: None + * + * DESCRIPTION: Parse tree walk to create external opcode list for methods. + * Here, we just want to catch the case where a definition block + * has been completed. Then we move all of the externals into + * a single block in the parse tree and thus the AML code. + * + ******************************************************************************/ + +ACPI_STATUS +ExAmlExternalWalkEnd ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + + if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) + { + /* + * Process any existing external list. (Support for + * multiple definition blocks in a single file/compile) + */ + ExMoveExternals (Op); + Gbl_ExternalsListHead = NULL; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: ExMoveExternals + * + * PARAMETERS: DefinitionBlockOp - Op for current definition block + * + * RETURN: None + * + * DESCRIPTION: Move all externals present in the source file into a single + * block of AML code, surrounded by an "If (0)" to prevent + * AML interpreters from attempting to execute the External + * opcodes. + * + ******************************************************************************/ + +static void +ExMoveExternals ( + ACPI_PARSE_OBJECT *DefinitionBlockOp) +{ + ACPI_PARSE_OBJECT *ParentOp; + ACPI_PARSE_OBJECT *ExternalOp; + ACPI_PARSE_OBJECT *PredicateOp; + ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *Prev; + ACPI_PARSE_OBJECT *Next; + ACPI_OBJECT_TYPE ObjType; + UINT32 i; + + + if (!Gbl_ExternalsListHead) + { + return; + } + + /* Remove the External nodes from the tree */ + + NextOp = Gbl_ExternalsListHead; + while (NextOp) + { + /* + * The External is stored in child pointer of each node in the + * list + */ + ExternalOp = NextOp->Asl.Child; + + /* Set line numbers (for listings, etc.) */ + + ExternalOp->Asl.LineNumber = 0; + ExternalOp->Asl.LogicalLineNumber = 0; + + Next = ExternalOp->Asl.Child; + Next->Asl.LineNumber = 0; + Next->Asl.LogicalLineNumber = 0; + + Next = Next->Asl.Next; + Next->Asl.LineNumber = 0; + Next->Asl.LogicalLineNumber = 0; + + Next = Next->Asl.Next; + Next->Asl.LineNumber = 0; + Next->Asl.LogicalLineNumber = 0; + + Next = Next->Asl.Next; + Next->Asl.LineNumber = 0; + Next->Asl.LogicalLineNumber = 0; + + ParentOp = ExternalOp->Asl.Parent; + Prev = Next = ParentOp->Asl.Child; + + /* Now find the External node's position in parse tree */ + + while (Next != ExternalOp) + { + Prev = Next; + Next = Next->Asl.Next; + } + + /* Remove the External from the parse tree */ + + if (Prev == ExternalOp) + { + /* External was the first child node */ + + ParentOp->Asl.Child = ExternalOp->Asl.Next; + } + + Prev->Asl.Next = ExternalOp->Asl.Next; + ExternalOp->Asl.Next = NULL; + ExternalOp->Asl.Parent = Gbl_ExternalsListHead; + + /* Point the External to the next in the list */ + + if (NextOp->Asl.Next) + { + ExternalOp->Asl.Next = NextOp->Asl.Next->Asl.Child; + } + + NextOp = NextOp->Asl.Next; + } + + /* + * Loop again to remove MethodObj Externals for which + * a MethodCall was not found (dead external reference) + */ + Prev = Gbl_ExternalsListHead->Asl.Child; + Next = Prev; + while (Next) + { + ObjType = (ACPI_OBJECT_TYPE) + Next->Asl.Child->Asl.Next->Asl.Value.Integer; + + if (ObjType == ACPI_TYPE_METHOD && + !(Next->Asl.CompileFlags & NODE_VISITED)) + { + if (Next == Prev) + { + Gbl_ExternalsListHead->Asl.Child = Next->Asl.Next; + Next->Asl.Next = NULL; + Prev = Gbl_ExternalsListHead->Asl.Child; + Next = Prev; + continue; + } + else + { + Prev->Asl.Next = Next->Asl.Next; + Next->Asl.Next = NULL; + Next = Prev->Asl.Next; + continue; + } + } + + Prev = Next; + Next = Next->Asl.Next; + } + + /* If list is now empty, don't bother to make If (0) block */ + + if (!Gbl_ExternalsListHead->Asl.Child) + { + return; + } + + /* Convert Gbl_ExternalsListHead parent to If(). */ + + Gbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF; + Gbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP; + Gbl_ExternalsListHead->Asl.CompileFlags = NODE_AML_PACKAGE; + UtSetParseOpName (Gbl_ExternalsListHead); + + /* Create a Zero op for the If predicate */ + + PredicateOp = TrAllocateNode (PARSEOP_ZERO); + PredicateOp->Asl.AmlOpcode = AML_ZERO_OP; + + PredicateOp->Asl.Parent = Gbl_ExternalsListHead; + PredicateOp->Asl.Child = NULL; + PredicateOp->Asl.Next = Gbl_ExternalsListHead->Asl.Child; + Gbl_ExternalsListHead->Asl.Child = PredicateOp; + + /* Set line numbers (for listings, etc.) */ + + Gbl_ExternalsListHead->Asl.LineNumber = 0; + Gbl_ExternalsListHead->Asl.LogicalLineNumber = 0; + + PredicateOp->Asl.LineNumber = 0; + PredicateOp->Asl.LogicalLineNumber = 0; + + /* Insert block back in the list */ + + Prev = DefinitionBlockOp->Asl.Child; + Next = Prev; + + /* Find last default arg */ + + for (i = 0; i < 6; i++) + { + Prev = Next; + Next = Prev->Asl.Next; + } + + if (Next) + { + /* Definition Block is not empty */ + + Gbl_ExternalsListHead->Asl.Next = Next; + } + else + { + /* Definition Block is empty. */ + + Gbl_ExternalsListHead->Asl.Next = NULL; + } + + Prev->Asl.Next = Gbl_ExternalsListHead; + Gbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent; +} diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 0d1c794..52939f4 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -633,6 +633,24 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); } + /* Create/Open a cross-reference output file if asked */ + + if (Gbl_CrossReferenceOutput) + { + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_XREF); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + FlOpenFile (ASL_FILE_XREF_OUTPUT, Filename, "w+t"); + + AslCompilerSignon (ASL_FILE_XREF_OUTPUT); + AslCompilerFileHeader (ASL_FILE_XREF_OUTPUT); + } + /* Create/Open a listing output file if asked */ if (Gbl_ListingFlag) diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 1fb7935..0e534f3 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -83,7 +83,8 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, {NULL, NULL, "C Include: ", "C Header Output"}, {NULL, NULL, "Offset Table: ", "C Offset Table Output"}, - {NULL, NULL, "Device Map: ", "Device Map Output"} + {NULL, NULL, "Device Map: ", "Device Map Output"}, + {NULL, NULL, "Cross Ref: ", "Cross-reference Output"} }; #else @@ -149,6 +150,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CrossReferenceOutput, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE); @@ -240,14 +242,16 @@ ASL_EXTERN ACPI_SERIAL_INFO ASL_INIT_GLOBAL (*Gbl_SerialList, NULL); ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ParseTreeRoot, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ExternalsListHead, NULL); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; + ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); @@ -268,7 +272,7 @@ ASL_EXTERN ACPI_TABLE_HEADER TableHeader; /* Event timing */ -#define ASL_NUM_EVENTS 20 +#define ASL_NUM_EVENTS 24 ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; ASL_EXTERN UINT8 AslGbl_NextEvent; ASL_EXTERN UINT8 AslGbl_NamespaceEvent; diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 0cea63c..44c85aa 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -399,7 +399,6 @@ CgGenerateAmlLengths ( break; case PARSEOP_DEFAULT_ARG: - case PARSEOP_EXTERNAL: case PARSEOP_INCLUDE: case PARSEOP_INCLUDE_END: diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index 4923b73..692d199 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -163,16 +163,16 @@ LsGenerateListing ( LsDoOffsetTableHeader (FileId); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); LsDoOffsetTableFooter (FileId); return; } /* Process all parse nodes */ - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId)); /* Final processing */ @@ -258,8 +258,12 @@ LsDumpParseTree ( } DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); + + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, LsTreeWriteWalk, NULL, NULL); + + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); } @@ -270,43 +274,69 @@ LsTreeWriteWalk ( void *Context) { - /* Debug output */ + /* Dump ParseOp name and possible value */ - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_NAMESEG: + case PARSEOP_NAMESTRING: + case PARSEOP_METHODCALL: + case PARSEOP_STRING_LITERAL: - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); + UtDumpStringOp (Op, Level); + break; + + case PARSEOP_BYTECONST: + + UtDumpIntegerOp (Op, Level, 2); + break; + + case PARSEOP_WORDCONST: + case PARSEOP_PACKAGE_LENGTH: + + UtDumpIntegerOp (Op, Level, 4); + break; + + case PARSEOP_DWORDCONST: + case PARSEOP_EISAID: + + UtDumpIntegerOp (Op, Level, 8); + break; + + case PARSEOP_QWORDCONST: + case PARSEOP_INTEGER: + case PARSEOP_ONE: + case PARSEOP_ZERO: + case PARSEOP_ONES: + + UtDumpIntegerOp (Op, Level, 16); + break; + + case PARSEOP_INCLUDE: - if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) - { - DbgPrint (ASL_TREE_OUTPUT, - "%10.4s ", Op->Asl.Value.Name); - } - else if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - DbgPrint (ASL_TREE_OUTPUT, - "%10.32s ", Op->Asl.Value.String); - } - else if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) - { DbgPrint (ASL_TREE_OUTPUT, "Open: %s\n", Op->Asl.Value.String); return (AE_OK); - } - else if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END) - { + + case PARSEOP_INCLUDE_END: + DbgPrint (ASL_TREE_OUTPUT, "Close: %s\n", Op->Asl.Filename); return (AE_OK); + + default: + + UtDumpBasicOp (Op, Level); + break; } - else - { - DbgPrint (ASL_TREE_OUTPUT, " "); - } - DbgPrint (ASL_TREE_OUTPUT, " (%.4X) Flags %8.8X", - Op->Asl.ParseOpcode, Op->Asl.CompileFlags); + /* Dump the remaining data */ + + DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG1, + Op->Asl.ParseOpcode, Op->Asl.CompileFlags, + Op->Asl.LineNumber, Op->Asl.EndLine, + Op->Asl.LogicalLineNumber, Op->Asl.EndLogicalLine); + TrPrintNodeCompileFlags (Op->Asl.CompileFlags); DbgPrint (ASL_TREE_OUTPUT, "\n"); return (AE_OK); @@ -399,6 +429,9 @@ LsWriteNodeToListing ( { case PARSEOP_DEFINITION_BLOCK: + /* Always start a definition block at AML offset zero */ + + Gbl_CurrentAmlOffset = 0; LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); /* Use the table Signature and TableId to build a unique name */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index f36bee8..955fd7f 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -104,8 +104,6 @@ LdLoadNamespace ( ACPI_WALK_STATE *WalkState; - DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n"); - /* Create a new walk state */ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index cc7764a..064e790 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -73,36 +73,6 @@ static void AslInitialize ( void); -UINT8 -AcpiIsBigEndianMachine ( - void); - - -/******************************************************************************* - * - * FUNCTION: AcpiIsBigEndianMachine - * - * PARAMETERS: None - * - * RETURN: TRUE if machine is big endian - * FALSE if machine is little endian - * - * DESCRIPTION: Detect whether machine is little endian or big endian. - * - ******************************************************************************/ - -UINT8 -AcpiIsBigEndianMachine ( - void) -{ - union { - UINT32 Integer; - UINT8 Bytes[4]; - } Overlay = {0xFF000000}; - - return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ -} - /******************************************************************************* * @@ -177,6 +147,7 @@ Usage ( ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)"); ACPI_OPTION ("-ln", "Create namespace file (*.nsp)"); ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); + ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)"); printf ("\nData Table Compiler:\n"); ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); @@ -303,6 +274,12 @@ AslInitialize ( AcpiGbl_DmOpt_Verbose = FALSE; + /* Default integer width is 64 bits */ + + AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerNybbleWidth = 16; + AcpiGbl_IntegerByteWidth = 8; + for (i = 0; i < ASL_NUM_FILES; i++) { Gbl_Files[i].Handle = NULL; @@ -346,7 +323,7 @@ main ( * be little-endian, and support for big-endian machines needs to * be implemented. */ - if (AcpiIsBigEndianMachine ()) + if (UtIsBigEndianMachine ()) { fprintf (stderr, "iASL is not currently supported on big-endian machines.\n"); diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index dec6320..013f7c9 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -314,22 +314,22 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER), /* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0), /* OBJECTTYPE */ OP_TABLE_ENTRY (AML_OBJECT_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0), -/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0), -/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0), -/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0), -/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0), -/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0), -/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0), -/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0), -/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0), -/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0), -/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0), -/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0), -/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PROCESSOR, 0, 0), -/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0), -/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0), -/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0), +/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_BUFFER_FIELD, 0, 0), +/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_BUFFER, 0, 0), +/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_DDB_HANDLE, 0, 0), +/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_DEVICE, 0, 0), +/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_EVENT, 0, 0), +/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_FIELD_UNIT, 0, 0), +/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_INTEGER, 0, 0), +/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_METHOD, 0, 0), +/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_MUTEX, 0, 0), +/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_REGION, 0, 0), +/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_PACKAGE, 0, 0), +/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_POWER, 0, 0), +/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_PROCESSOR, 0, 0), +/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_STRING, 0, 0), +/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_THERMAL, 0, 0), +/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_ANY, 0, 0), /* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), /* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER), diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c index c17b69c..a5b19e7 100644 --- a/source/compiler/aslmapoutput.c +++ b/source/compiler/aslmapoutput.c @@ -533,7 +533,7 @@ MpXrefDevices ( /* Walk the entire parse tree */ - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, MpNamespaceXrefBegin, NULL, Info); if (!Info->References) diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index a5c02b1..2c74ff0 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -53,7 +53,7 @@ /* Local prototypes */ -void +static void MtCheckNamedObjectInMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo); @@ -93,6 +93,13 @@ MtMethodAnalysisWalkBegin ( UINT8 ActualArgs = 0; + /* Build cross-reference output file if requested */ + + if (Gbl_CrossReferenceOutput) + { + OtXrefWalkPart1 (Op, Level, MethodInfo); + } + switch (Op->Asl.ParseOpcode) { case PARSEOP_METHOD: @@ -493,7 +500,7 @@ MtMethodAnalysisWalkBegin ( * ******************************************************************************/ -void +static void MtCheckNamedObjectInMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo) diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index fcc6113..d1e4277 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -1513,12 +1513,6 @@ OpcGenerateAmlOpcode ( Gbl_HasIncludeFiles = TRUE; break; - case PARSEOP_EXTERNAL: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - break; - case PARSEOP_TIMER: if (AcpiGbl_IntegerBitWidth == 32) diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 2d33514..3f84114 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -1049,15 +1049,12 @@ OpnAttachNameToNode ( ACPI_PARSE_OBJECT *Child = NULL; - if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) - { - Child = UtGetArg (Op, 0); - } - else switch (Op->Asl.AmlOpcode) + switch (Op->Asl.AmlOpcode) { case AML_DATA_REGION_OP: case AML_DEVICE_OP: case AML_EVENT_OP: + case AML_EXTERNAL_OP: case AML_METHOD_OP: case AML_MUTEX_OP: case AML_REGION_OP: @@ -1188,9 +1185,6 @@ OpnGenerateAmlOperands ( case PARSEOP_NAMESTRING: case PARSEOP_METHODCALL: case PARSEOP_STRING_LITERAL: - - break; - default: break; diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index ca392b6..61d2cbf 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -490,6 +490,13 @@ AslDoOptions ( Gbl_SourceOutputFlag = TRUE; break; + case 'x': + + /* Produce cross-reference file */ + + Gbl_CrossReferenceOutput = TRUE; + break; + default: printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); diff --git a/source/compiler/aslprune.c b/source/compiler/aslprune.c index f15c17a..11b3ad9 100644 --- a/source/compiler/aslprune.c +++ b/source/compiler/aslprune.c @@ -122,7 +122,7 @@ AslPruneParseTree ( AcpiOsPrintf ("\nRemoving Objects:\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj)); AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count); diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index dcf0d7b..ecdab19 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -338,13 +338,6 @@ RsDoGpioIntDescriptor ( Descriptor->Gpio.ResSourceOffset = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor); - DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: " - "%.2X, VendLen: %.2X, IntLen: %.2X\n", - "GpioInt", Descriptor->Gpio.ResourceLength, - (UINT16) sizeof (AML_RESOURCE_GPIO), - ResSourceLength, VendorLength, InterruptLength); - /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) @@ -554,13 +547,6 @@ RsDoGpioIoDescriptor ( Descriptor->Gpio.ResSourceOffset = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor); - DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: " - "%.2X, VendLen: %.2X, IntLen: %.2X\n", - "GpioIo", Descriptor->Gpio.ResourceLength, - (UINT16) sizeof (AML_RESOURCE_GPIO), - ResSourceLength, VendorLength, InterruptLength); - /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) @@ -753,13 +739,6 @@ RsDoI2cSerialBusDescriptor ( VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS)); ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); - DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: " - "%.2X, VendLen: %.2X, TypLen: %.2X\n", - "I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength, - (UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength, - VendorLength, Descriptor->I2cSerialBus.TypeDataLength); - /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) @@ -904,13 +883,6 @@ RsDoSpiSerialBusDescriptor ( sizeof (AML_RESOURCE_SPI_SERIALBUS)); ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); - DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: " - "%.2X, VendLen: %.2X, TypLen: %.2X\n", - "SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength, - (UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength, - VendorLength, Descriptor->SpiSerialBus.TypeDataLength); - /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) @@ -1082,13 +1054,6 @@ RsDoUartSerialBusDescriptor ( VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS)); ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); - DbgPrint (ASL_DEBUG_OUTPUT, - "%16s - Actual: %.2X, Base: %.2X, ResLen: " - "%.2X, VendLen: %.2X, TypLen: %.2X\n", - "UartSerialBus", Descriptor->UartSerialBus.ResourceLength, - (UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength, - VendorLength, Descriptor->UartSerialBus.TypeDataLength); - /* Process all child initialization nodes */ for (i = 0; InitializerOp; i++) diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index dcf3c22..33aef64 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -469,7 +469,6 @@ ObjectTypeName | RefOfTerm {} | DerefOfTerm {} | IndexTerm {} - /* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ ; diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index e57df5e..47c4720 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -120,6 +120,13 @@ AcpiDsStoreObjectToLocal ( } ACPI_STATUS +AcpiEvInstallRegionHandlers ( + void) +{ + return (AE_OK); +} + +ACPI_STATUS AcpiEvQueueNotifyRequest ( ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue) diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 607b1bb..8de5ba1 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -249,7 +249,7 @@ TrAmlInsertPeer ( /******************************************************************************* * - * FUNCTION: TrAmlTransformWalk + * FUNCTION: TrAmlTransformWalkBegin * * PARAMETERS: ASL_WALK_CALLBACK * @@ -261,7 +261,7 @@ TrAmlInsertPeer ( ******************************************************************************/ ACPI_STATUS -TrAmlTransformWalk ( +TrAmlTransformWalkBegin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) @@ -274,6 +274,38 @@ TrAmlTransformWalk ( /******************************************************************************* * + * FUNCTION: TrAmlTransformWalkEnd + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: None + * + * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML + * operands. + * + ******************************************************************************/ + +ACPI_STATUS +TrAmlTransformWalkEnd ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + + /* Save possible Externals list in the DefintionBlock Op */ + + if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) + { + Op->Asl.Value.Arg = Gbl_ExternalsListHead; + Gbl_ExternalsListHead = NULL; + } + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: TrTransformSubtree * * PARAMETERS: Op - The parent parse node @@ -316,6 +348,11 @@ TrTransformSubtree ( Gbl_TempCount = 0; break; + case PARSEOP_EXTERNAL: + + ExDoExternal (Op); + break; + default: /* Nothing to do here for other opcodes */ @@ -347,6 +384,10 @@ TrDoDefinitionBlock ( UINT32 i; + /* Reset external list when starting a definition block */ + + Gbl_ExternalsListHead = NULL; + Next = Op->Asl.Child; for (i = 0; i < 5; i++) { diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index c6eb57b..97a56ec 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -982,7 +982,7 @@ TrCreateNode ( { case PARSEOP_ASL_CODE: - RootNode = Op; + Gbl_ParseTreeRoot = Op; Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); break; @@ -1111,7 +1111,7 @@ TrLinkChildren ( { case PARSEOP_ASL_CODE: - RootNode = Op; + Gbl_ParseTreeRoot = Op; Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->"); break; @@ -1417,7 +1417,7 @@ TrWalkParseTree ( ACPI_STATUS Status; - if (!RootNode) + if (!Gbl_ParseTreeRoot) { return (AE_OK); } diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index a3a714b..411faed 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -81,6 +81,7 @@ typedef struct asl_method_info { ACPI_PARSE_OBJECT *Op; + ACPI_PARSE_OBJECT *CurrentOp; struct asl_method_info *Next; UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS]; UINT32 ValidReturnTypes; @@ -171,12 +172,13 @@ typedef enum ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */ ASL_FILE_C_INCLUDE_OUTPUT, /* .h */ ASL_FILE_C_OFFSET_OUTPUT, /* .offset.h */ - ASL_FILE_MAP_OUTPUT /* .map */ + ASL_FILE_MAP_OUTPUT, /* .map */ + ASL_FILE_XREF_OUTPUT /* .xrf */ } ASL_FILE_TYPES; -#define ASL_MAX_FILE_TYPE 16 +#define ASL_MAX_FILE_TYPE 17 #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) /* Name suffixes used to create filenames for output files */ @@ -196,6 +198,7 @@ typedef enum #define FILE_SUFFIX_C_INCLUDE "h" #define FILE_SUFFIX_C_OFFSET "offset.h" #define FILE_SUFFIX_MAP "map" +#define FILE_SUFFIX_XREF "xrf" /* Cache block structure for ParseOps and Strings */ @@ -316,4 +319,21 @@ typedef struct asl_method_local #define ASL_ARG_INITIALIZED (1<<3) #define ASL_ARG_REFERENCED (1<<4) +/* Info used to track method counts for cross reference output file */ + +typedef struct asl_xref_info +{ + UINT32 ThisMethodInvocations; + UINT32 TotalPredefinedMethods; + UINT32 TotalUserMethods; + UINT32 TotalUnreferenceUserMethods; + UINT32 ThisObjectReferences; + UINT32 TotalObjects; + UINT32 TotalUnreferencedObjects; + ACPI_PARSE_OBJECT *MethodOp; + ACPI_PARSE_OBJECT *CurrentMethodOp; + +} ASL_XREF_INFO; + + #endif /* __ASLTYPES_H */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 82862af..288fe1f 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -67,6 +67,33 @@ UtAttachNameseg ( char *Name); +/******************************************************************************* + * + * FUNCTION: UtIsBigEndianMachine + * + * PARAMETERS: None + * + * RETURN: TRUE if machine is big endian + * FALSE if machine is little endian + * + * DESCRIPTION: Detect whether machine is little endian or big endian. + * + ******************************************************************************/ + +UINT8 +UtIsBigEndianMachine ( + void) +{ + union { + UINT32 Integer; + UINT8 Bytes[4]; + } Overlay = {0xFF000000}; + + + return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ +} + + /****************************************************************************** * * FUNCTION: UtQueryForOverwrite @@ -269,63 +296,6 @@ UtEndEvent ( /******************************************************************************* * - * FUNCTION: UtConvertByteToHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be - * stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = 'x'; - - Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); - Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToAsmHex - * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be - * stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with '0', and a trailing 'h' is added. - * - ******************************************************************************/ - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); - Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); - Buffer[3] = 'h'; -} - - -/******************************************************************************* - * * FUNCTION: DbgPrint * * PARAMETERS: Type - Type of output @@ -368,43 +338,6 @@ DbgPrint ( /******************************************************************************* * - * FUNCTION: UtPrintFormattedName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * Level - Indentation level - * - * RETURN: None - * - * DESCRIPTION: Print the ascii name of the parse opcode. - * - ******************************************************************************/ - -#define TEXT_OFFSET 10 - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level) -{ - - if (Level) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (3 * Level), " "); - } - DbgPrint (ASL_TREE_OUTPUT, - " %-20.20s", UtGetOpName (ParseOpcode)); - - if (Level < TEXT_OFFSET) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (TEXT_OFFSET - Level) * 3, " "); - } -} - - -/******************************************************************************* - * * FUNCTION: UtSetParseOpName * * PARAMETERS: Op - Parse op to be named. @@ -973,7 +906,7 @@ UtDoConstant ( char ErrBuf[64]; - Status = stroul64 (String, 0, &Converted); + Status = AcpiUtStrtoul64 (String, 0, &Converted); if (ACPI_FAILURE (Status)) { sprintf (ErrBuf, "%s %s\n", "Conversion error:", @@ -985,198 +918,62 @@ UtDoConstant ( } -/* TBD: use version in ACPICA main code base? */ +#ifdef _OBSOLETE_FUNCTIONS +/* Removed 01/2016 */ /******************************************************************************* * - * FUNCTION: stroul64 + * FUNCTION: UtConvertByteToHex * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte - * is returned - * Base - Radix of the string + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * - * RETURN: Converted value + * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Convert a string into an unsigned value. + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * with "0x" * ******************************************************************************/ -ACPI_STATUS -stroul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) +void +UtConvertByteToHex ( + UINT8 RawByte, + UINT8 *Buffer) { - UINT32 Index; - UINT32 Sign; - UINT64 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - *RetInteger = 0; - - switch (Base) - { - case 0: - case 8: - case 10: - case 16: - - break; - - default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); - } - - /* Skip over any white space in the buffer: */ - - while (isspace ((int) *String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - Sign = ACPI_SIGN_NEGATIVE; - ++String; - } - else if (*String == '+') - { - ++String; - Sign = ACPI_SIGN_POSITIVE; - } - else - { - Sign = ACPI_SIGN_POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (tolower ((int) *(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - tolower ((int) *(++String)) == 'x') - { - String++; - } - - /* Main loop: convert the string to an unsigned long */ - - while (*String) - { - if (isdigit ((int) *String)) - { - Index = ((UINT8) *String) - '0'; - } - else - { - Index = (UINT8) toupper ((int) *String); - if (isupper ((int) Index)) - { - Index = Index - 'A' + 10; - } - else - { - goto ErrorExit; - } - } - - if (Index >= Base) - { - goto ErrorExit; - } - - /* Check to see if value is out of range: */ - - if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / - (UINT64) Base)) - { - goto ErrorExit; - } - else - { - ReturnValue *= Base; - ReturnValue += Index; - } - - ++String; - } - - - /* If a minus sign was present, then "the conversion is negated": */ - - if (Sign == ACPI_SIGN_NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - *RetInteger = ReturnValue; - return (Status); - - -ErrorExit: - switch (Base) - { - case 8: - Status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - - Status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: + Buffer[0] = '0'; + Buffer[1] = 'x'; - Status = AE_BAD_HEX_CONSTANT; - break; + Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); + Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); +} - default: - /* Base validated above */ +/******************************************************************************* + * + * FUNCTION: UtConvertByteToAsmHex + * + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored + * + * RETURN: Ascii hex byte is stored in Buffer. + * + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * with '0', and a trailing 'h' is added. + * + ******************************************************************************/ - break; - } +void +UtConvertByteToAsmHex ( + UINT8 RawByte, + UINT8 *Buffer) +{ - return (Status); + Buffer[0] = '0'; + Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); + Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); + Buffer[3] = 'h'; } +#endif /* OBSOLETE_FUNCTIONS */ diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index aa4f6ea..a4e5a8c 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -859,10 +859,21 @@ AnAnalyzeStoreOperator ( case PARSEOP_DEREFOF: case PARSEOP_REFOF: case PARSEOP_INDEX: - case PARSEOP_METHODCALL: return; + case PARSEOP_METHODCALL: + /* + * A target is not allowed to be a method call. + * It is not supported by the ACPICA interpreter, nor is it + * supported by the MS ASL compiler or the MS interpreter. + * Although legal syntax up until ACPI 6.1, support for this + * will be removed for ACPI 6.2 (02/2016) + */ + AslError (ASL_ERROR, ASL_MSG_SYNTAX, + TargetOperandOp, "Illegal method invocation as a target operand"); + return; + default: break; } diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index 74038d9..a2cb6b3 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -133,8 +133,6 @@ XfCrossReferenceNamespace ( ACPI_WALK_STATE *WalkState; - DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); - /* * Create a new walk state for use when looking up names * within the namespace (Passed as context to the callbacks) @@ -147,8 +145,8 @@ XfCrossReferenceNamespace ( /* Walk the entire parse tree */ - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin, - XfNamespaceLocateEnd, WalkState); + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, + XfNamespaceLocateBegin, XfNamespaceLocateEnd, WalkState); ACPI_FREE (WalkState); return (AE_OK); @@ -880,7 +878,8 @@ XfNamespaceLocateBegin ( NextOp = NextOp->Asl.Next; } - if (Node->Value != ASL_EXTERNAL_METHOD) + if (Node->Value != ASL_EXTERNAL_METHOD && + Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL) { /* * Check the parsed arguments with the number expected by the diff --git a/source/compiler/aslxrefout.c b/source/compiler/aslxrefout.c new file mode 100644 index 0000000..554f51f --- /dev/null +++ b/source/compiler/aslxrefout.c @@ -0,0 +1,810 @@ +/****************************************************************************** + * + * Module Name: aslxrefout.c - support for optional cross-reference file + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acnamesp.h" +#include "acparser.h" +#include "amlcode.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslxrefout") + + +/* Local prototypes */ + +static ACPI_STATUS +OtXrefWalkPart2 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static ACPI_STATUS +OtXrefWalkPart3 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static ACPI_STATUS +OtXrefAnalysisWalkPart1 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + + +static ACPI_STATUS +OtXrefAnalysisWalkPart2 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static ACPI_STATUS +OtXrefAnalysisWalkPart3 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + + +/******************************************************************************* + * + * FUNCTION: OtPrintHeaders + * + * PARAMETERS: Message - Main header message + * + * RETURN: None + * + * DESCRIPTION: Emits the main header message along with field descriptions + * + ******************************************************************************/ + +void +OtPrintHeaders ( + char *Message) +{ + UINT32 Length; + + + Length = strlen (Message); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\n%s\n", Message); + while (Length) + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, "-"); + Length--; + } + + FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nLineno %-40s Description\n", + "Full Pathname"); +} + + +/******************************************************************************* + * + * FUNCTION: OtCreateXrefFile + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION Main entry point for parts 2 and 3 of the cross-reference + * file. + * + ******************************************************************************/ + +void +OtCreateXrefFile ( + void) +{ + ASL_XREF_INFO XrefInfo; + + + /* Build cross-reference output file if requested */ + + if (!Gbl_CrossReferenceOutput) + { + return; + } + + memset (&XrefInfo, 0, sizeof (ASL_XREF_INFO)); + + /* Cross-reference output file, part 2 (Method invocations) */ + + OtPrintHeaders ("Part 2: Method Reference Map " + "(Invocations of each user-defined control method)"); + + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + OtXrefWalkPart2, NULL, &XrefInfo); + + /* Cross-reference output file, part 3 (All other object refs) */ + + OtPrintHeaders ("Part 3: Full Object Reference Map " + "(Methods that reference each object in namespace"); + + TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + OtXrefWalkPart3, NULL, &XrefInfo); + + /* Cross-reference summary */ + + FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nObject Summary\n"); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\nTotal methods: %u\n", + XrefInfo.TotalPredefinedMethods + XrefInfo.TotalUserMethods); + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "Total predefined methods: %u\n", + XrefInfo.TotalPredefinedMethods); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\nTotal user methods: %u\n", + XrefInfo.TotalUserMethods); + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "Total unreferenced user methods %u\n", + XrefInfo.TotalUnreferenceUserMethods); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\nTotal defined objects: %u\n", + XrefInfo.TotalObjects); + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "Total unreferenced objects: %u\n", + XrefInfo.TotalUnreferencedObjects); +} + + +/* + * Part 1 of the cross reference file. This part emits the namespace objects + * that are referenced by each control method in the namespace. + * + * Part 2 and 3 are below part 1. + */ + +/******************************************************************************* + * + * FUNCTION: OtXrefWalkPart1 + * + * PARAMETERS: Op - Current parse Op + * Level - Current tree nesting level + * MethodInfo - Info block for the current method + * + * + * RETURN: None + * + * DESCRIPTION: Entry point for the creation of the method call reference map. + * For each control method in the namespace, all other methods + * that invoke the method are listed. Predefined names/methods + * that start with an underscore are ignored, because these are + * essentially external/public interfaces. + + * DESCRIPTION: Entry point for the creation of the object reference map. + * For each control method in the namespace, all objects that + * are referenced by the method are listed. + * + * Called during a normal namespace walk, once per namespace + * object. (MtMethodAnalysisWalkBegin) + * + ******************************************************************************/ + +void +OtXrefWalkPart1 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + ASL_METHOD_INFO *MethodInfo) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *FieldOp; + char *ParentPath; + UINT32 Length; + ACPI_STATUS Status; + + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_NAMESEG: + case PARSEOP_NAMESTRING: + case PARSEOP_METHODCALL: + + if (!MethodInfo || + (MethodInfo->Op->Asl.Child == Op) || + !Op->Asl.Node) + { + break; + } + + MethodInfo->CurrentOp = Op; + Node = Op->Asl.Node; + ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + + /* Find all objects referenced by this method */ + + Status = TrWalkParseTree (MethodInfo->Op, ASL_WALK_VISIT_DOWNWARD, + OtXrefAnalysisWalkPart1, NULL, MethodInfo); + + if (Status == AE_CTRL_TERMINATE) + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, " %-40s %s", + ParentPath, AcpiUtGetTypeName (Node->Type)); + + switch (Node->Type) + { + /* Handle externals */ + + case ACPI_TYPE_ANY: + case ACPI_TYPE_FIELD_UNIT: + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " "); + break; + + case ACPI_TYPE_INTEGER: + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " %8.8X%8.8X", + ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); + break; + + case ACPI_TYPE_METHOD: + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " Invocation (%u args)", + Node->ArgCount); + break; + + case ACPI_TYPE_BUFFER_FIELD: + + NextOp = Node->Op; /* Create Buffer Field Op */ + switch (NextOp->Asl.ParseOpcode) + { + case PARSEOP_CREATEBITFIELD: + Length = 1; + break; + + case PARSEOP_CREATEBYTEFIELD: + Length = 8; + break; + + case PARSEOP_CREATEWORDFIELD: + Length = 16; + break; + + case PARSEOP_CREATEDWORDFIELD: + Length = 32; + break; + + case PARSEOP_CREATEQWORDFIELD: + Length = 64; + break; + + default: + Length = 0; + break; + } + + NextOp = NextOp->Asl.Child; /* Buffer name */ + + if (!NextOp->Asl.ExternalName) + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, " in Arg/Local"); + } + else + { + ACPI_FREE (ParentPath); + ParentPath = AcpiNsGetNormalizedPathname ( + NextOp->Asl.Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Buffer %s", + Length, ParentPath); + } + break; + + case ACPI_TYPE_LOCAL_REGION_FIELD: + + NextOp = Node->Op; + FieldOp = NextOp->Asl.Parent; + NextOp = FieldOp->Asl.Child; + + ACPI_FREE (ParentPath); + ParentPath = AcpiNsGetNormalizedPathname ( + NextOp->Asl.Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Region %s", + (UINT32) Node->Op->Asl.Child->Asl.Value.Integer, + ParentPath); + + if (FieldOp->Asl.ParseOpcode == PARSEOP_FIELD) + { + Node = NextOp->Asl.Node; /* Region node */ + NextOp = Node->Op; /* PARSEOP_REGION */ + NextOp = NextOp->Asl.Child; /* Region name */ + NextOp = NextOp->Asl.Next; + + /* Get region space/addr/len? */ + + FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%s)", + AcpiUtGetRegionName ((UINT8) + NextOp->Asl.Value.Integer)); + } + break; + + default: + break; + } + + FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n"); + ACPI_FREE (ParentPath); + } + break; + + case PARSEOP_METHOD: + + ParentPath = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\n[%5u] %-40s %s Declaration (%u args)\n", + Op->Asl.LogicalLineNumber, ParentPath, + AcpiUtGetTypeName (Op->Asl.Node->Type), Op->Asl.Node->ArgCount); + + ACPI_FREE (ParentPath); + break; + + default: + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: OtXrefAnalysisWalkPart1 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Secondary walk for cross-reference part 1. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart1 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ASL_METHOD_INFO *MethodInfo = (ASL_METHOD_INFO *) Context; + ACPI_PARSE_OBJECT *Next; + + + /* Only interested in name string Ops -- ignore all others */ + + if ((Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && + (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && + (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) + { + return (AE_OK); + } + + /* No node means a locally declared object -- ignore */ + + if (!Op->Asl.Node) + { + return (AE_OK); + } + + /* When we encounter the source Op, we are done */ + + Next = MethodInfo->CurrentOp; + if (Next == Op) + { + return (AE_CTRL_TERMINATE); + } + + /* If we have a name match, this Op is a duplicate */ + + if ((Next->Asl.ParseOpcode == PARSEOP_NAMESEG) || + (Next->Asl.ParseOpcode == PARSEOP_NAMESTRING) || + (Next->Asl.ParseOpcode == PARSEOP_METHODCALL)) + { + if (!strcmp (Op->Asl.ExternalName, Next->Asl.ExternalName)) + { + return (AE_ALREADY_EXISTS); + } + } + + return (AE_OK); +} + + +/* + * Part 2 of the cross reference file. This part emits the names of each + * non-predefined method in the namespace (user methods), along with the + * names of each control method that references that method. + */ + +/******************************************************************************* + * + * FUNCTION: OtXrefWalkPart2 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: For each control method in the namespace, we will re-walk the + * namespace to find each and every invocation of that control + * method. Brute force, but does not matter, even for large + * namespaces. Ignore predefined names (start with underscore). + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefWalkPart2 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context; + ACPI_NAMESPACE_NODE *Node; + char *ParentPath; + + + /* Looking for Method Declaration Ops only */ + + if (!Op->Asl.Node || + (Op->Asl.ParseOpcode != PARSEOP_METHOD)) + { + return (AE_OK); + } + + /* Ignore predefined names */ + + if (Op->Asl.Node->Name.Ascii[0] == '_') + { + XrefInfo->TotalPredefinedMethods++; + return (AE_OK); + } + + Node = Op->Asl.Node; + ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\n[%5u] %-40s %s Declaration (%u args)\n", + Op->Asl.LogicalLineNumber, ParentPath, + AcpiUtGetTypeName (Node->Type), Node->ArgCount); + + XrefInfo->TotalUserMethods++; + XrefInfo->ThisMethodInvocations = 0; + XrefInfo->MethodOp = Op; + + (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + OtXrefAnalysisWalkPart2, NULL, XrefInfo); + + if (!XrefInfo->ThisMethodInvocations) + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, + " Zero invocations of this method in this module\n"); + XrefInfo->TotalUnreferenceUserMethods++; + } + else + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, + " %u invocations of method %s in this module\n", + XrefInfo->ThisMethodInvocations, ParentPath); + } + + ACPI_FREE (ParentPath); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: OtXrefAnalysisWalkPart2 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: For every Op that is a method invocation, emit a reference + * line if the Op is invoking the target method. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart2 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context; + ACPI_PARSE_OBJECT *CallerOp; + char *CallerFullPathname; + + + /* Looking for MethodCall Ops only */ + + if (!Op->Asl.Node || + (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) + { + return (AE_OK); + } + + /* If not a match to the target method, we are done */ + + if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node) + { + return (AE_CTRL_DEPTH); + } + + /* Find parent method to get method caller namepath */ + + CallerOp = Op->Asl.Parent; + while (CallerOp && + (CallerOp->Asl.ParseOpcode != PARSEOP_METHOD)) + { + CallerOp = CallerOp->Asl.Parent; + } + + /* There is no parent method for External() statements */ + + if (!CallerOp) + { + return (AE_OK); + } + + CallerFullPathname = AcpiNsGetNormalizedPathname ( + CallerOp->Asl.Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "[%5u] %-40s Invocation path: %s\n", + Op->Asl.LogicalLineNumber, CallerFullPathname, + Op->Asl.ExternalName); + + ACPI_FREE (CallerFullPathname); + XrefInfo->ThisMethodInvocations++; + return (AE_OK); +} + + +/* + * Part 3 of the cross reference file. This part emits the names of each + * non-predefined method in the namespace (user methods), along with the + * names of each control method that references that method. + */ + +/******************************************************************************* + * + * FUNCTION: OtXrefWalkPart3 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Cross-reference part 3. references to objects other than + * control methods. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefWalkPart3 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context; + ACPI_NAMESPACE_NODE *Node; + char *ParentPath; + const ACPI_OPCODE_INFO *OpInfo; + + + /* Ignore method declarations */ + + if (!Op->Asl.Node || + (Op->Asl.ParseOpcode == PARSEOP_METHOD)) + { + return (AE_OK); + } + + OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); + if (!(OpInfo->Class & AML_CLASS_NAMED_OBJECT)) + { + return (AE_OK); + } + + /* Only care about named object creation opcodes */ + + if ((Op->Asl.ParseOpcode != PARSEOP_NAME) && + (Op->Asl.ParseOpcode != PARSEOP_DEVICE) && + (Op->Asl.ParseOpcode != PARSEOP_MUTEX) && + (Op->Asl.ParseOpcode != PARSEOP_OPERATIONREGION) && + (Op->Asl.ParseOpcode != PARSEOP_FIELD) && + (Op->Asl.ParseOpcode != PARSEOP_EVENT)) + { + return (AE_OK); + } + + /* Ignore predefined names */ + + if (Op->Asl.Node->Name.Ascii[0] == '_') + { + return (AE_OK); + } + + Node = Op->Asl.Node; + ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "\n[%5u] %-40s %s Declaration\n", + Op->Asl.LogicalLineNumber, ParentPath, + AcpiUtGetTypeName (Node->Type)); + + XrefInfo->MethodOp = Op; + XrefInfo->ThisObjectReferences = 0; + XrefInfo->TotalObjects = 0; + + (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + OtXrefAnalysisWalkPart3, NULL, XrefInfo); + + if (!XrefInfo->ThisObjectReferences) + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, + " Zero references to this object in this module\n"); + XrefInfo->TotalUnreferencedObjects++; + } + else + { + FlPrintFile (ASL_FILE_XREF_OUTPUT, + " %u references to this object in this module\n", + XrefInfo->ThisObjectReferences, ParentPath); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: OtXrefAnalysisWalkPart3 + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Secondary walk for cross-reference part 3. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart3 ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context; + char *CallerFullPathname; + ACPI_PARSE_OBJECT *CallerOp; + const char *Operator; + + + if (!Op->Asl.Node) + { + return (AE_OK); + } + + XrefInfo->TotalObjects++; + + /* Ignore Op that actually defined the object */ + + if (Op == XrefInfo->MethodOp) + { + return (AE_OK); + } + + /* Only interested in Ops that reference the target node */ + + if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node) + { + return (AE_OK); + } + + /* Find parent "open scope" object to get method caller namepath */ + + CallerOp = Op->Asl.Parent; + while (CallerOp && + (CallerOp->Asl.ParseOpcode != PARSEOP_NAME) && + (CallerOp->Asl.ParseOpcode != PARSEOP_METHOD) && + (CallerOp->Asl.ParseOpcode != PARSEOP_DEVICE) && + (CallerOp->Asl.ParseOpcode != PARSEOP_POWERRESOURCE) && + (CallerOp->Asl.ParseOpcode != PARSEOP_PROCESSOR) && + (CallerOp->Asl.ParseOpcode != PARSEOP_THERMALZONE)) + { + CallerOp = CallerOp->Asl.Parent; + } + + /* There are some special cases for the oddball operators */ + + if (CallerOp) + { + CallerFullPathname = AcpiNsGetNormalizedPathname ( + CallerOp->Asl.Node, TRUE); + } + else + { + CallerFullPathname = ""; + } + + if (CallerOp == XrefInfo->CurrentMethodOp) + { + return (AE_OK); + } + + if (Op->Asl.ParseOpcode == PARSEOP_SCOPE) + { + Operator = "Scope"; + + } + else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_ALIAS) + { + Operator = "Alias"; + } + else if (!CallerOp) + { + Operator = "ModLevel"; + } + else + { + Operator = AcpiUtGetTypeName (CallerOp->Asl.Node->Type); + } + + FlPrintFile (ASL_FILE_XREF_OUTPUT, + "[%5u] %-40s %-8s via path: %s, Operator: %s\n", + Op->Asl.LogicalLineNumber, + CallerFullPathname, + Operator, + Op->Asl.ExternalName, + Op->Asl.Parent->Asl.ParseOpName); + + if (!CallerOp) + { + CallerOp = ACPI_TO_POINTER (0xFFFFFFFF); + } + + XrefInfo->CurrentMethodOp = CallerOp; + XrefInfo->ThisObjectReferences++; + return (AE_OK); +} diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index c4578e1..fbd424a 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -169,15 +169,15 @@ Expression /* Default base for a non-prefixed integer is 16 */ - | EXPOP_NUMBER { stroul64 (DtParsertext, 16, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { stroul64 (DtParsertext, 16, &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, &$$);} - /* TBD: Decimal number with prefix (0d1234) - Not supported by stroul64 at this time */ + /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */ - | EXPOP_DECIMAL_NUMBER { stroul64 (DtParsertext, 10, &$$);} + | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, &$$);} ; %% diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index 0819769..ba2dc55 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -182,11 +182,11 @@ Expression /* Default base for a non-prefixed integer is 10 */ - | EXPOP_NUMBER { stroul64 (PrParsertext, 10, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, 10, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { stroul64 (PrParsertext, 16, &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, 16, &$$);} ; %% diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index e96fba5..8a4f241 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -334,8 +334,7 @@ PrPreprocessInputFile ( Gbl_CurrentLineNumber++; Gbl_LogicalLineNumber++; - if ((Status == ASL_WITHIN_COMMENT) || - (Status == ASL_BLANK_LINE)) + if (Status == ASL_IGNORE_LINE) { goto WriteEntireLine; } @@ -870,7 +869,8 @@ SyntaxError: * * RETURN: Status of the GetLine operation: * AE_OK - Normal line, OK status - * ASL_WITHIN_COMMENT - Line is part of a multi-line comment + * ASL_IGNORE_LINE - Line is blank or part of a multi-line + * comment * ASL_EOF - End-of-file reached * * DESCRIPTION: Get the next text line from the input file. Does not strip @@ -986,7 +986,7 @@ PrGetNextLine ( if (AcpiGbl_LineScanState == PR_MULTI_LINE_COMMENT) { - return (ASL_WITHIN_COMMENT); + return (ASL_IGNORE_LINE); } /* End of single-line comment */ @@ -1001,7 +1001,7 @@ PrGetNextLine ( if (i == 1) { - return (ASL_BLANK_LINE); + return (ASL_IGNORE_LINE); } return (AE_OK); diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 3b5c266..76f01ac 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -405,7 +405,7 @@ AcpiDbDisplayTableInfo ( { /* If the pointer is null, the table has been unloaded */ - ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", + ACPI_INFO (("%4.4s - Table has been unloaded", TableDesc->Signature.Ascii)); } } diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index fc3bbda..01cb37a 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -465,7 +465,7 @@ AcpiDbDumpPldBuffer ( NewBuffer = AcpiDbEncodePldBuffer (PldInfo); if (!NewBuffer) { - return; + goto Exit; } /* The two bit-packed buffers should match */ @@ -524,6 +524,7 @@ AcpiDbDumpPldBuffer ( AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); } - ACPI_FREE (PldInfo); ACPI_FREE (NewBuffer); +Exit: + ACPI_FREE (PldInfo); } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index dd5a0d4..20d7ce5 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -969,6 +969,10 @@ AcpiDmDisassembleOneOp ( AcpiDmConvertToElseIf (Op); break; + case AML_EXTERNAL_OP: + + break; + default: /* Just get the opcode name and print it */ diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 8dd0011..43f5686 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -410,6 +410,7 @@ AcpiDmDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *NextOp2; UINT32 AmlOffset; @@ -436,8 +437,7 @@ AcpiDmDescendingOp ( AcpiUtDumpBuffer ( (Info->StartAml + Info->AmlOffset), (Op->Common.Aml - Info->PreviousAml), - DB_BYTE_DISPLAY, - Info->AmlOffset); + DB_BYTE_DISPLAY, Info->AmlOffset); AcpiOsPrintf ("\n"); } @@ -455,6 +455,33 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } + if (Op->Common.AmlOpcode == AML_IF_OP) + { + NextOp = AcpiPsGetDepthNext (NULL, Op); + if (NextOp) + { + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + } + + /* + * A Zero predicate indicates the possibility of one or more + * External() opcodes within the If() block. + */ + if (NextOp->Common.AmlOpcode == AML_ZERO_OP) + { + NextOp2 = NextOp->Common.Next; + + if (NextOp2 && + (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP)) + { + /* Ignore the If 0 block and all children */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (AE_CTRL_DEPTH); + } + } + } + /* Level 0 is at the Definition Block level */ if (Level == 0) @@ -788,8 +815,8 @@ AcpiDmDescendingOp ( NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); - case AML_VAR_PACKAGE_OP: case AML_IF_OP: + case AML_VAR_PACKAGE_OP: case AML_WHILE_OP: /* The next op is the size or predicate parameter */ diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 356739a..25d278c 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -867,7 +867,7 @@ AcpiDsTerminateControlMethod ( { if (WalkState) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Marking method %4.4s as Serialized " "because of AE_ALREADY_EXISTS error", WalkState->MethodNode->Name.Ascii)); diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 452c66b..3f7b540 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -538,7 +538,7 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Common.Next; } - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Actual Package length (%u) is larger than " "NumElements field (%u), truncated", i, ElementCount)); diff --git a/source/components/events/evgpeblk.c b/source/components/events/evgpeblk.c index 21f0692..2e1d354 100644 --- a/source/components/events/evgpeblk.c +++ b/source/components/events/evgpeblk.c @@ -542,7 +542,7 @@ AcpiEvInitializeGpeBlock ( if (GpeEnabledCount) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount, (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)))); diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index b62f91a..8e2fd34 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -292,7 +292,7 @@ AcpiEvUpdateGpes ( if (WalkInfo.Count) { - ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count)); + ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index db4080a..0853a32 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -99,7 +99,6 @@ AcpiEvInitializeOpRegions ( /* Run the _REG methods for OpRegions in each default address space */ - AcpiGbl_RegMethodsEnabled = TRUE; for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { /* @@ -637,7 +636,7 @@ AcpiEvExecuteRegMethod ( if (RegionObj2->Extra.Method_REG == NULL || RegionObj->Region.Handler == NULL || - !AcpiGbl_RegMethodsEnabled) + !AcpiGbl_NamespaceInitialized) { return_ACPI_STATUS (AE_OK); } diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 60aea38..7a78e3c 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -276,7 +276,7 @@ AcpiExLoadTableOp ( Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_SUCCESS (Status)) { - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); + ACPI_INFO (("Dynamic OEM Table Load:")); AcpiTbPrintTableHeader (0, Table); } @@ -516,7 +516,7 @@ AcpiExLoadOp ( /* Install the new table into the local data structures */ - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); + ACPI_INFO (("Dynamic OEM Table Load:")); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index db9fd11..de46a97 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -134,8 +134,10 @@ AcpiExOpcode_3A_0T_0R ( * 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. + * AML interpreters never see the opcode. Thus, something is + * wrong if an external opcode ever gets here. */ + ACPI_ERROR ((AE_INFO, "Executed External Op")); Status = AE_OK; goto Cleanup; diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index 1e43d98..7a0eaf5 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -97,7 +97,7 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = * PhysicalAddress - 32-bit physical address of ACPI real mode * entry point * PhysicalAddress64 - 64-bit physical address of ACPI protected - * entry point + * mode entry point * * RETURN: Status * @@ -153,7 +153,7 @@ AcpiHwSetFirmwareWakingVector ( * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode * entry point * PhysicalAddress64 - 64-bit physical address of ACPI protected - * entry point + * mode entry point * * RETURN: Status * diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 33a45c0..63051b8 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -396,7 +396,7 @@ AcpiNsExecModuleCodeList ( AcpiUtRemoveReference (Prev); } - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Executed %u blocks of module-level executable AML code", MethodCount)); diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index fc08197..99f1527 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -46,6 +46,7 @@ #include "acnamesp.h" #include "acdispat.h" #include "acinterp.h" +#include "acevents.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsinit") @@ -151,84 +152,112 @@ AcpiNsInitializeObjects ( ACPI_STATUS AcpiNsInitializeDevices ( - void) + UINT32 Flags) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; ACPI_DEVICE_WALK_INFO Info; ACPI_FUNCTION_TRACE (NsInitializeDevices); - /* Init counters */ + if (!(Flags & ACPI_NO_DEVICE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Initializing ACPI Devices\n")); - Info.DeviceCount = 0; - Info.Num_STA = 0; - Info.Num_INI = 0; + /* Init counters */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Initializing Device/Processor/Thermal objects " - "and executing _INI/_STA methods:\n")); + Info.DeviceCount = 0; + Info.Num_STA = 0; + Info.Num_INI = 0; - /* Tree analysis: find all subtrees that contain _INI methods */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "Initializing Device/Processor/Thermal objects " + "and executing _INI/_STA methods:\n")); - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } + /* Tree analysis: find all subtrees that contain _INI methods */ - /* Allocate the evaluation information block */ + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } - Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info.EvaluateInfo) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } + /* Allocate the evaluation information block */ - /* - * Execute the "global" _INI method that may appear at the root. This - * support is provided for Windows compatibility (Vista+) and is not - * part of the ACPI specification. - */ - Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; - Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; - Info.EvaluateInfo->Parameters = NULL; - Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); + if (!Info.EvaluateInfo) + { + Status = AE_NO_MEMORY; + goto ErrorExit; + } - Status = AcpiNsEvaluate (Info.EvaluateInfo); - if (ACPI_SUCCESS (Status)) - { - Info.Num_INI++; + /* + * Execute the "global" _INI method that may appear at the root. + * This support is provided for Windows compatibility (Vista+) and + * is not part of the ACPI specification. + */ + Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; + Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; + Info.EvaluateInfo->Parameters = NULL; + Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + + Status = AcpiNsEvaluate (Info.EvaluateInfo); + if (ACPI_SUCCESS (Status)) + { + Info.Num_INI++; + } } - /* Walk namespace to execute all _INIs on present devices */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); - /* - * Any _OSI requests should be completed by now. If the BIOS has - * requested any Windows OSI strings, we will always truncate - * I/O addresses to 16 bits -- for Windows compatibility. + * Run all _REG methods + * + * Note: Any objects accessed by the _REG methods will be automatically + * initialized, even if they contain executable AML (see the call to + * AcpiNsInitializeObjects below). */ - if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) + if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { - AcpiGbl_TruncateIoAddresses = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[Init] Executing _REG OpRegion methods\n")); + + Status = AcpiEvInitializeOpRegions (); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } } - ACPI_FREE (Info.EvaluateInfo); - if (ACPI_FAILURE (Status)) + if (!(Flags & ACPI_NO_DEVICE_INIT)) { - goto ErrorExit; - } + /* Walk namespace to execute all _INIs on present devices */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Executed %u _INI methods requiring %u _STA executions " - "(examined %u objects)\n", - Info.Num_INI, Info.Num_STA, Info.DeviceCount)); + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); + + /* + * Any _OSI requests should be completed by now. If the BIOS has + * requested any Windows OSI strings, we will always truncate + * I/O addresses to 16 bits -- for Windows compatibility. + */ + if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) + { + AcpiGbl_TruncateIoAddresses = TRUE; + } + + ACPI_FREE (Info.EvaluateInfo); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + " Executed %u _INI methods requiring %u _STA executions " + "(examined %u objects)\n", + Info.Num_INI, Info.Num_STA, Info.DeviceCount)); + } return_ACPI_STATUS (Status); diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index ccffb71..a4745c3 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -298,7 +298,7 @@ AcpiPsGetNextNamepath ( PossibleMethodCall && (Node->Type == ACPI_TYPE_METHOD)) { - if (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) + if (WalkState->Opcode == AML_UNLOAD_OP) { /* * AcpiPsGetNextNamestring has increased the AML pointer, @@ -744,7 +744,7 @@ AcpiPsGetNextField ( * * PARAMETERS: WalkState - Current state * ParserState - Current parser state object - * ArgType - The parser argument type (ARGP_*) + * ArgType - The argument type (AML_*_ARG) * ReturnArg - Where the next arg is returned * * RETURN: Status, and an op object containing the next argument. @@ -873,9 +873,9 @@ AcpiPsGetNextArg ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* SuperName allows argument to be a method call */ + /* To support SuperName arg of Unload */ - if (ArgType == ARGP_SUPERNAME) + if (WalkState->Opcode == AML_UNLOAD_OP) { Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, ACPI_POSSIBLE_METHOD_CALL); diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index d5ae920..32d63ee 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -292,7 +292,7 @@ AcpiTbInstallStandardTable ( AcpiGbl_DisableSsdtTableInstall && ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Ignoring installation of %4.4s at %8.8X%8.8X", NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); goto ReleaseAndExit; @@ -464,7 +464,7 @@ FinishOverride: return; } - ACPI_INFO ((AE_INFO, "%4.4s 0x%8.8X%8.8X" + ACPI_INFO (("%4.4s 0x%8.8X%8.8X" " %s table override, new table: 0x%8.8X%8.8X", OldTableDesc->Signature.Ascii, ACPI_FORMAT_UINT64 (OldTableDesc->Address), diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 65ce709..9dab6d9 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -149,7 +149,7 @@ AcpiTbPrintTableHeader ( { /* FACS only has signature and length fields */ - ACPI_INFO ((AE_INFO, "%-4.4s 0x%8.8X%8.8X %06X", + ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", Header->Signature, ACPI_FORMAT_UINT64 (Address), Header->Length)); } @@ -161,7 +161,7 @@ AcpiTbPrintTableHeader ( Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - ACPI_INFO ((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", + ACPI_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, @@ -174,7 +174,7 @@ AcpiTbPrintTableHeader ( AcpiTbCleanupTableHeader (&LocalHeader, Header); - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "%-4.4s 0x%8.8X%8.8X" " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address), diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 0a34708..3e68d75 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -185,7 +185,7 @@ AcpiTbCopyDsdt ( ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "Forced DSDT copy: length 0x%05X copied locally, original unmapped", NewTable->Length)); diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 3583e81..0302eb9 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -47,6 +47,7 @@ #include "accommon.h" #include "acnamesp.h" #include "actables.h" +#include "acevents.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbxfload") @@ -74,6 +75,28 @@ AcpiLoadTables ( ACPI_FUNCTION_TRACE (AcpiLoadTables); + /* + * Install the default operation region handlers. These are the + * handlers that are defined by the ACPI specification to be + * "always accessible" -- namely, SystemMemory, SystemIO, and + * PCI_Config. This also means that no _REG methods need to be + * run for these address spaces. We need to have these handlers + * installed before any AML code can be executed, especially any + * module-level code (11/2015). + * Note that we allow OSPMs to install their own region handlers + * between AcpiInitializeSubsystem() and AcpiLoadTables() to use + * their customized default region handlers. + */ + if (AcpiGbl_GroupModuleLevelCode) + { + Status = AcpiEvInstallRegionHandlers (); + if (ACPI_FAILURE (Status) && Status != AE_ALREADY_EXISTS) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); + return_ACPI_STATUS (Status); + } + } + /* Load the namespace from the tables */ Status = AcpiTbLoadNamespace (); @@ -227,7 +250,7 @@ AcpiTbLoadNamespace ( if (!TablesFailed) { - ACPI_INFO ((AE_INFO, + ACPI_INFO (( "%u ACPI AML tables successfully acquired and loaded\n", TablesLoaded)); } @@ -340,7 +363,7 @@ AcpiLoadTable ( /* Install the table and load it into the namespace */ - ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:")); + ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index 66fa868..049dae8 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -279,7 +279,7 @@ AcpiOsAcquireObject ( void *Object; - ACPI_FUNCTION_NAME (OsAcquireObject); + ACPI_FUNCTION_TRACE (OsAcquireObject); if (!Cache) diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 06817ab..648cc5c 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -506,7 +506,7 @@ AcpiUtGetMutexName ( /* Names for Notify() values, used for debug output */ -static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = +static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] = { /* 00 */ "Bus Check", /* 01 */ "Device Check", @@ -520,32 +520,35 @@ static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request", + /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */ /* 0D */ "System Resource Affinity Update" }; -static const char *AcpiGbl_DeviceNotify[4] = +static const char *AcpiGbl_DeviceNotify[5] = { /* 80 */ "Status Change", /* 81 */ "Information Change", /* 82 */ "Device-Specific Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Device-Specific Change", + /* 84 */ "Reserved" }; -static const char *AcpiGbl_ProcessorNotify[4] = +static const char *AcpiGbl_ProcessorNotify[5] = { /* 80 */ "Performance Capability Change", /* 81 */ "C-State Change", /* 82 */ "Throttling Capability Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Guaranteed Change", + /* 84 */ "Minimum Excursion" }; -static const char *AcpiGbl_ThermalNotify[4] = +static const char *AcpiGbl_ThermalNotify[5] = { /* 80 */ "Thermal Status Change", /* 81 */ "Thermal Trip Point Change", /* 82 */ "Thermal Device List Change", - /* 83 */ "Thermal Relationship Change" + /* 83 */ "Thermal Relationship Change", + /* 84 */ "Reserved" }; @@ -555,23 +558,23 @@ AcpiUtGetNotifyName ( ACPI_OBJECT_TYPE Type) { - /* 00 - 0D are common to all object types */ + /* 00 - 0D are "common to all object types" (from ACPI Spec) */ - if (NotifyValue <= ACPI_NOTIFY_MAX) + if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX) { return (AcpiGbl_GenericNotify[NotifyValue]); } - /* 0D - 7F are reserved */ + /* 0E - 7F are reserved */ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { return ("Reserved"); } - /* 80 - 83 are per-object-type */ + /* 80 - 84 are per-object-type */ - if (NotifyValue <= 0x83) + if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX) { switch (Type) { diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c index 5f45aaa..572d24a 100644 --- a/source/components/utilities/utnonansi.c +++ b/source/components/utilities/utnonansi.c @@ -164,6 +164,82 @@ AcpiUtStricmp ( } +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +/******************************************************************************* + * + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * + * PARAMETERS: Adds a "DestSize" parameter to each of the standard string + * functions. This is the size of the Destination buffer. + * + * RETURN: TRUE if the operation would overflow the destination buffer. + * + * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that + * the result of the operation will not overflow the output string + * buffer. + * + * NOTE: These functions are typically only helpful for processing + * user input and command lines. For most ACPICA code, the + * required buffer length is precisely calculated before buffer + * allocation, so the use of these functions is unnecessary. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtSafeStrcpy ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if (strlen (Source) >= DestSize) + { + return (TRUE); + } + + strcpy (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrcat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if ((strlen (Dest) + strlen (Source)) >= DestSize) + { + return (TRUE); + } + + strcat (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrncat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source, + ACPI_SIZE MaxTransferLength) +{ + ACPI_SIZE ActualTransferLength; + + + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); + + if ((strlen (Dest) + ActualTransferLength) >= DestSize) + { + return (TRUE); + } + + strncat (Dest, Source, MaxTransferLength); + return (FALSE); +} +#endif + + /******************************************************************************* * * FUNCTION: AcpiUtStrtoul64 @@ -179,7 +255,15 @@ AcpiUtStricmp ( * 32-bit or 64-bit conversion, depending on the current mode * of the interpreter. * - * NOTE: Does not support Octal strings, not needed. + * NOTES: AcpiGbl_IntegerByteWidth should be set to the proper width. + * For the core ACPICA code, this width depends on the DSDT + * version. For iASL, the default byte width is always 8. + * + * Does not support Octal strings, not needed at this time. + * + * There is an earlier version of the function after this one, + * below. It is slightly different than this one, and the two + * may eventually may need to be merged. (01/2016). * ******************************************************************************/ @@ -200,7 +284,7 @@ AcpiUtStrtoul64 ( UINT8 Term = 0; - ACPI_FUNCTION_TRACE_STR (UtStroul64, String); + ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); switch (Base) @@ -376,78 +460,201 @@ ErrorExit: } } +#ifdef _OBSOLETE_FUNCTIONS +/* TBD: use version in ACPICA main code base? */ +/* DONE: 01/2016 */ -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) /******************************************************************************* * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * FUNCTION: strtoul64 * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte + * is returned + * Base - Radix of the string * - * RETURN: TRUE if the operation would overflow the destination buffer. - * - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that - * the result of the operation will not overflow the output string - * buffer. + * RETURN: Converted value * - * NOTE: These functions are typically only helpful for processing - * user input and command lines. For most ACPICA code, the - * required buffer length is precisely calculated before buffer - * allocation, so the use of these functions is unnecessary. + * DESCRIPTION: Convert a string into an unsigned value. * ******************************************************************************/ -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) +ACPI_STATUS +strtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger) { + UINT32 Index; + UINT32 Sign; + UINT64 ReturnValue = 0; + ACPI_STATUS Status = AE_OK; - if (strlen (Source) >= DestSize) + + *RetInteger = 0; + + switch (Base) { - return (TRUE); + case 0: + case 8: + case 10: + case 16: + + break; + + default: + /* + * The specified Base parameter is not in the domain of + * this function: + */ + return (AE_BAD_PARAMETER); } - strcpy (Dest, Source); - return (FALSE); -} + /* Skip over any white space in the buffer: */ -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ + while (isspace ((int) *String) || *String == '\t') + { + ++String; + } - if ((strlen (Dest) + strlen (Source)) >= DestSize) + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*String == '-') { - return (TRUE); + Sign = ACPI_SIGN_NEGATIVE; + ++String; + } + else if (*String == '+') + { + ++String; + Sign = ACPI_SIGN_POSITIVE; + } + else + { + Sign = ACPI_SIGN_POSITIVE; } - strcat (Dest, Source); - return (FALSE); -} + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (Base == 0) + { + if (*String == '0') + { + if (tolower ((int) *(++String)) == 'x') + { + Base = 16; + ++String; + } + else + { + Base = 8; + } + } + else + { + Base = 10; + } + } -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (Base == 8 && *String == '0') + { + String++; + } + if (Base == 16 && + *String == '0' && + tolower ((int) *(++String)) == 'x') + { + String++; + } - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); + /* Main loop: convert the string to an unsigned long */ - if ((strlen (Dest) + ActualTransferLength) >= DestSize) + while (*String) { - return (TRUE); + if (isdigit ((int) *String)) + { + Index = ((UINT8) *String) - '0'; + } + else + { + Index = (UINT8) toupper ((int) *String); + if (isupper ((int) Index)) + { + Index = Index - 'A' + 10; + } + else + { + goto ErrorExit; + } + } + + if (Index >= Base) + { + goto ErrorExit; + } + + /* Check to see if value is out of range: */ + + if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / + (UINT64) Base)) + { + goto ErrorExit; + } + else + { + ReturnValue *= Base; + ReturnValue += Index; + } + + ++String; } - strncat (Dest, Source, MaxTransferLength); - return (FALSE); + + /* If a minus sign was present, then "the conversion is negated": */ + + if (Sign == ACPI_SIGN_NEGATIVE) + { + ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; + } + + *RetInteger = ReturnValue; + return (Status); + + +ErrorExit: + switch (Base) + { + case 8: + + Status = AE_BAD_OCTAL_CONSTANT; + break; + + case 10: + + Status = AE_BAD_DECIMAL_CONSTANT; + break; + + case 16: + + Status = AE_BAD_HEX_CONSTANT; + break; + + default: + + /* Base validated above */ + + break; + } + + return (Status); } #endif diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index b5383c8..b6d6a33 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -775,7 +775,7 @@ AcpiUtDumpAllocations ( if (!NumOutstanding) { - ACPI_INFO ((AE_INFO, "No outstanding allocations")); + ACPI_INFO (("No outstanding allocations")); } else { diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 35efd52..e79ffc9 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -205,8 +205,6 @@ ACPI_EXPORT_SYMBOL (AcpiWarning) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( - const char *ModuleName, - UINT32 LineNumber, const char *Format, ...) { diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 898a75c..a8ea3fd 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -132,25 +132,6 @@ AcpiInitializeSubsystem ( return_ACPI_STATUS (Status); } - if (!AcpiGbl_OverrideDefaultRegionHandlers) - { - /* - * Install the default operation region handlers. These are the - * handlers that are defined by the ACPI specification to be - * "always accessible" -- namely, SystemMemory, SystemIO, and - * PCI_Config. This also means that no _REG methods need to be - * run for these address spaces. We need to have these handlers - * installed before any AML code can be executed, especially any - * module-level code (11/2015). - */ - Status = AcpiEvInstallRegionHandlers (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); - return_ACPI_STATUS (Status); - } - } - return_ACPI_STATUS (AE_OK); } @@ -187,17 +168,17 @@ AcpiEnableSubsystem ( */ AcpiGbl_EarlyInitialization = FALSE; - if (AcpiGbl_OverrideDefaultRegionHandlers) + /* + * Install the default operation region handlers. These are the + * handlers that are defined by the ACPI specification to be + * "always accessible" -- namely, SystemMemory, SystemIO, and + * PCI_Config. This also means that no _REG methods need to be + * run for these address spaces. We need to have these handlers + * installed before any AML code can be executed, especially any + * module-level code (11/2015). + */ + if (!AcpiGbl_GroupModuleLevelCode) { - /* - * Install the default operation region handlers. These are the - * handlers that are defined by the ACPI specification to be - * "always accessible" -- namely, SystemMemory, SystemIO, and - * PCI_Config. This also means that no _REG methods need to be - * run for these address spaces. We need to have these handlers - * installed before any AML code can be executed, especially any - * module-level code (11/2015). - */ Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { @@ -206,7 +187,6 @@ AcpiEnableSubsystem ( } } - #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ @@ -312,25 +292,6 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); - /* - * Run all _REG methods - * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * AcpiNsInitializeObjects below). - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); - - Status = AcpiEvInitializeOpRegions (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - #ifdef ACPI_EXEC_APP /* * This call implements the "initialization file" option for AcpiExec. @@ -373,16 +334,15 @@ AcpiInitializeObjects ( } } + AcpiGbl_NamespaceInitialized = TRUE; + /* - * Initialize all device objects in the namespace. This runs the device - * _STA and _INI methods. + * Initialize all device/region objects in the namespace. This runs + * the device _STA and _INI methods and region _REG methods. */ - if (!(Flags & ACPI_NO_DEVICE_INIT)) + if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT))) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); - - Status = AcpiNsInitializeDevices (); + Status = AcpiNsInitializeDevices (Flags); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index b6e250e..e722416 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -302,6 +302,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 2fe04d4..11361c5 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -86,8 +86,6 @@ ACPI_GLOBAL (UINT8, AcpiGbl_IntegerBitWidth); ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth); ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE); - /***************************************************************************** * @@ -170,7 +168,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); /* Initialization sequencing */ -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_RegMethodsEnabled, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE); /* Misc */ diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 0866182..46d430a 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -89,7 +89,7 @@ union acpi_parse_object; #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ #define ACPI_MAX_MUTEX 5 -#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 +#define ACPI_NUM_MUTEX (ACPI_MAX_MUTEX+1) /* Lock structure for reader/writer interfaces */ @@ -111,12 +111,12 @@ typedef struct acpi_rw_lock #define ACPI_LOCK_HARDWARE 1 #define ACPI_MAX_LOCK 1 -#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 +#define ACPI_NUM_LOCK (ACPI_MAX_LOCK+1) /* This Thread ID means that the mutex is not in use (unlocked) */ -#define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1 +#define ACPI_MUTEX_NOT_ACQUIRED ((ACPI_THREAD_ID) -1) /* This Thread ID means an invalid thread ID */ diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 492f187..e3c089f 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -94,7 +94,7 @@ AcpiNsInitializeObjects ( ACPI_STATUS AcpiNsInitializeDevices ( - void); + UINT32 Flags); /* diff --git a/source/include/acoutput.h b/source/include/acoutput.h index 49dbc86..9c7e954 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -267,7 +267,7 @@ #define ACPI_GET_FUNCTION_NAME _AcpiFunctionName /* - * The Name parameter should be the procedure name as a quoted string. + * The Name parameter should be the procedure name as a non-quoted string. * The function name is also used by the function exit macros below. * Note: (const char) is used to be compatible with the debug interfaces * and macros such as __FUNCTION__. diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 408bdf9..53adadc 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160108 +#define ACPI_CA_VERSION 0x20160212 #include "acconfig.h" #include "actypes.h" @@ -192,9 +192,9 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); /* - * Optionally allow default region handlers to be overridden. + * Optionally support group module level code. */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OverrideDefaultRegionHandlers, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE); /* * Optionally use 32-bit FADT addresses if and when there is a conflict @@ -1172,11 +1172,9 @@ AcpiWarning ( ...)) ACPI_MSG_DEPENDENT_RETURN_VOID ( -ACPI_PRINTF_LIKE(3) +ACPI_PRINTF_LIKE(1) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( - const char *ModuleName, - UINT32 LineNumber, const char *Format, ...)) diff --git a/source/include/acpredef.h b/source/include/acpredef.h index 2e95223..c335645 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -516,6 +516,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), + {{"_FIT", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, /* ACPI 6.0 */ + {{"_FIX", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0,0,0), @@ -1030,6 +1033,12 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_WED", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER)}}, + {{"_WPC", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */ + + {{"_WPP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */ + PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ }; #else @@ -1104,7 +1113,7 @@ const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[] = PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ }; -static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { +const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { {{"_GPE", 0, 0}}, {{"_PR_", 0, 0}}, {{"_SB_", 0, 0}}, @@ -1113,7 +1122,7 @@ static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { PACKAGE_INFO (0,0,0,0,0,0) /* Table terminator */ }; #else -extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[]; +extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[]; #endif #endif diff --git a/source/include/actbl.h b/source/include/actbl.h index e868909..6aa1df2 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -248,7 +248,7 @@ typedef struct acpi_table_facs /******************************************************************************* * * FADT - Fixed ACPI Description Table (Signature "FACP") - * Version 4 + * Version 6 * ******************************************************************************/ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index e789b9b..df5abe3 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -268,7 +268,8 @@ enum AcpiEinjActions ACPI_EINJ_CHECK_BUSY_STATUS = 6, ACPI_EINJ_GET_COMMAND_STATUS = 7, ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8, - ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */ + ACPI_EINJ_GET_EXECUTE_TIMINGS = 9, + ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */ ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ }; @@ -397,7 +398,8 @@ enum AcpiErstActions ACPI_ERST_GET_ERROR_RANGE = 13, ACPI_ERST_GET_ERROR_LENGTH = 14, ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, - ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ + ACPI_ERST_EXECUTE_TIMINGS = 16, + ACPI_ERST_ACTION_RESERVED = 17 /* 17 and greater are reserved */ }; /* Values for Instruction field above */ @@ -489,7 +491,8 @@ enum AcpiHestTypes ACPI_HEST_TYPE_AER_ENDPOINT = 7, ACPI_HEST_TYPE_AER_BRIDGE = 8, ACPI_HEST_TYPE_GENERIC_ERROR = 9, - ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ + ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10, + ACPI_HEST_TYPE_RESERVED = 11 /* 11 and greater are reserved */ }; @@ -697,6 +700,27 @@ typedef struct acpi_hest_generic } ACPI_HEST_GENERIC; +/* 10: Generic Hardware Error Source, version 2 */ + +typedef struct acpi_hest_generic_v2 +{ + ACPI_HEST_HEADER Header; + UINT16 RelatedSourceId; + UINT8 Reserved; + UINT8 Enabled; + UINT32 RecordsToPreallocate; + UINT32 MaxSectionsPerRecord; + UINT32 MaxRawDataLength; + ACPI_GENERIC_ADDRESS ErrorStatusAddress; + ACPI_HEST_NOTIFY Notify; + UINT32 ErrorBlockLength; + ACPI_GENERIC_ADDRESS ReadAckRegister; + UINT64 ReadAckPreserve; + UINT64 ReadAckWrite; + +} ACPI_HEST_GENERIC_V2; + + /* Generic Error Status block */ typedef struct acpi_hest_generic_status @@ -730,6 +754,7 @@ typedef struct acpi_hest_generic_data UINT32 ErrorDataLength; UINT8 FruId[16]; UINT8 FruText[20]; + UINT64 TimeStamp; } ACPI_HEST_GENERIC_DATA; @@ -1187,6 +1212,7 @@ typedef struct acpi_nfit_memory_map #define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ +#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */ /* 2: Interleave Structure */ diff --git a/source/include/actypes.h b/source/include/actypes.h index e43424a..e1a733e 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -642,7 +642,8 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C #define ACPI_NOTIFY_AFFINITY_UPDATE (UINT8) 0x0D -#define ACPI_NOTIFY_MAX 0x0D +#define ACPI_GENERIC_NOTIFY_MAX 0x0D +#define ACPI_SPECIFIC_NOTIFY_MAX 0x84 /* * Types associated with ACPI names and objects. The first group of diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index a182a43..22688c2 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -468,7 +468,6 @@ main ( /* Init ACPICA and start debugger thread */ - AcpiGbl_OverrideDefaultRegionHandlers = TRUE; Status = AcpiInitializeSubsystem (); ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index 2836dd6..5cea124 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -575,6 +575,7 @@ AsProcessOneFile ( if (AsGetFile (Pathname, &Gbl_FileBuffer, &Gbl_FileSize)) { + free (Pathname); return (-1); } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 0e921ad..9f8853a 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -501,6 +501,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ASL_RESOURCE_INFO", SRC_TYPE_STRUCT}, {"ASL_RESOURCE_NODE", SRC_TYPE_STRUCT}, {"ASL_WALK_CALLBACK", SRC_TYPE_SIMPLE}, + {"ASL_XREF_INFO", SRC_TYPE_STRUCT}, {"UINT64_OVERLAY", SRC_TYPE_UNION}, {"UINT64_STRUCT", SRC_TYPE_STRUCT}, @@ -606,6 +607,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_HEST_AER", SRC_TYPE_STRUCT}, {"ACPI_HEST_AER_BRIDGE", SRC_TYPE_STRUCT}, {"ACPI_HEST_GENERIC", SRC_TYPE_STRUCT}, + {"ACPI_HEST_GENERIC_V2", SRC_TYPE_STRUCT}, {"ACPI_HEST_GENERIC_STATUS", SRC_TYPE_STRUCT}, {"ACPI_HEST_GENERIC_DATA", SRC_TYPE_STRUCT}, {"ACPI_IBFT_HEADER", SRC_TYPE_STRUCT}, diff --git a/source/tools/examples/examples.c b/source/tools/examples/examples.c index d6b15b2..4827d6a 100644 --- a/source/tools/examples/examples.c +++ b/source/tools/examples/examples.c @@ -149,7 +149,7 @@ main ( /* Example warning and error output */ - ACPI_INFO ((AE_INFO, "Example ACPICA info message")); + ACPI_INFO (("Example ACPICA info message")); ACPI_WARNING ((AE_INFO, "Example ACPICA warning message")); ACPI_ERROR ((AE_INFO, "Example ACPICA error message")); ACPI_EXCEPTION ((AE_INFO, AE_AML_OPERAND_TYPE, @@ -176,7 +176,6 @@ InitializeFullAcpica (void) /* Initialize the ACPICA subsystem */ - AcpiGbl_OverrideDefaultRegionHandlers = TRUE; Status = AcpiInitializeSubsystem (); if (ACPI_FAILURE (Status)) { @@ -186,7 +185,7 @@ InitializeFullAcpica (void) /* Initialize the ACPICA Table Manager and get all ACPI tables */ - ACPI_INFO ((AE_INFO, "Loading ACPI tables")); + ACPI_INFO (("Loading ACPI tables")); Status = AcpiInitializeTables (NULL, 16, FALSE); if (ACPI_FAILURE (Status)) @@ -284,7 +283,6 @@ InitializeAcpi ( /* Initialize the ACPICA subsystem */ - AcpiGbl_OverrideDefaultRegionHandlers = TRUE; Status = AcpiInitializeSubsystem (); if (ACPI_FAILURE (Status)) { @@ -349,7 +347,7 @@ NotifyHandler ( void *Context) { - ACPI_INFO ((AE_INFO, "Received a notify 0x%X", Value)); + ACPI_INFO (("Received a notify 0x%X", Value)); } @@ -384,7 +382,7 @@ RegionHandler ( void *RegionContext) { - ACPI_INFO ((AE_INFO, "Received a region access")); + ACPI_INFO (("Received a region access")); return (AE_OK); } @@ -444,7 +442,7 @@ ExecuteOSI (void) ACPI_OBJECT *Object; - ACPI_INFO ((AE_INFO, "Executing _OSI reserved method")); + ACPI_INFO (("Executing _OSI reserved method")); /* Setup input argument */ @@ -483,7 +481,7 @@ ExecuteOSI (void) AcpiOsPrintf ("Invalid return type from _OSI, %.2X\n", Object->Type); } - ACPI_INFO ((AE_INFO, "_OSI returned 0x%8.8X", + ACPI_INFO (("_OSI returned 0x%8.8X", (UINT32) Object->Integer.Value)); @@ -511,7 +509,7 @@ ExecuteMAIN (void) ACPI_OBJECT *Object; - ACPI_INFO ((AE_INFO, "Executing MAIN method")); + ACPI_INFO (("Executing MAIN method")); /* Setup input argument */ diff --git a/tests/misc/grammar.aml b/tests/misc/grammar.aml index 698a32f..819dfee 100755 Binary files a/tests/misc/grammar.aml and b/tests/misc/grammar.aml differ