diff --git a/sys/external/bsd/acpica/dist/changes.txt b/sys/external/bsd/acpica/dist/changes.txt index 510a4ca24017..c4c281382a9c 100644 --- a/sys/external/bsd/acpica/dist/changes.txt +++ b/sys/external/bsd/acpica/dist/changes.txt @@ -1,3 +1,71 @@ +---------------------------------------- +13 December 2019. Summary of changes for version 20191213: + + +1) ACPICA kernel-resident subsystem: + +Return a Buffer object for all fields created via the CreateField operator. Previously, an Integer would be returned if the size of the field was less than or equal to the current size of an Integer. Although this goes against the ACPI specification, it provides compatibility with other ACPI implementations. Also updated the ASLTS test suite to reflect this new behavior. + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Implemented detection of (and throw an error for) duplicate values for Case statements within a single Switch statement. Duplicate Integers, Strings, and Buffers are supported. + +iASL: Fix error logging issue during multiple file compilation -- Switch to the correct input file during error node creation. + +iASL: For duplicate named object creation, now emit an error instead of a warning - since this will cause a runtime error. + +AcpiSrc: Add unix line-ending support for non-Windows builds. + +iASL: Add an error condition for an attempt to create a NameString with > 255 NameSegs (the max allowable via the AML definition). + + +---------------------------------------- +18 October 2019. Summary of changes for version 20191018: + + +1) ACPICA kernel-resident subsystem: + +Debugger: added a new command: ?Fields [address space ID]?. This command +dumps the contents of all field units that are defined within the +namespace with a particular address space ID. + +Modified the external interface AcpiLoadTable() to return a table index. +This table index can be used for unloading a table for debugging. + ACPI_STATUS + AcpiLoadTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex)) + +Implemented a new external interface: AcpiUnloadTable() This new function +takes a table index as an argument and unloads the table. Useful for +debugging only. + ACPI_STATUS + AcpiUnloadTable ( + UINT32 TableIndex)) + +Ported the AcpiNames utility to use the new table initialization +sequence. The utility was broken before this change. Also, it was +required to include most of the AML interpreter into the utility in order +to process table initialization (module-level code execution.) + +Update for results from running Clang V8.0.1. This fixes all "dead +assignment" warnings. There are still several "Dereference of NULL +pointer" warnings, but these have been found to be false positive +warnings. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: numerous table compiler changes to ensure that the usage of +yacc/bison syntax is POSIX-compliant. + +iASL/disassembler: several simple bug fixes in the data table +disassembler. + +Acpiexec: expanded the initialization file (the -fi option) to initialize +strings, buffers, packages, and field units. + + ---------------------------------------- 16 August 2019. Summary of changes for version 20190816: diff --git a/sys/external/bsd/acpica/dist/common/acgetline.c b/sys/external/bsd/acpica/dist/common/acgetline.c index aff7414407f1..8bbca6886678 100644 --- a/sys/external/bsd/acpica/dist/common/acgetline.c +++ b/sys/external/bsd/acpica/dist/common/acgetline.c @@ -424,7 +424,7 @@ AcpiOsGetLine ( * Ignore the various keys like insert/delete/home/end, etc. * But we must eat the final character of the ESC sequence. */ - InputChar = getchar (); + (void) getchar (); continue; default: diff --git a/sys/external/bsd/acpica/dist/common/adisasm.c b/sys/external/bsd/acpica/dist/common/adisasm.c index fbd079fd13af..6a493ae61d37 100644 --- a/sys/external/bsd/acpica/dist/common/adisasm.c +++ b/sys/external/bsd/acpica/dist/common/adisasm.c @@ -638,7 +638,6 @@ AdDoExternalFileList ( { ExternalFileList = ExternalFileList->Next; GlobalStatus = AE_TYPE; - Status = AE_OK; continue; } diff --git a/sys/external/bsd/acpica/dist/common/adwalk.c b/sys/external/bsd/acpica/dist/common/adwalk.c index 65aabecb0913..fa8e17f7b387 100644 --- a/sys/external/bsd/acpica/dist/common/adwalk.c +++ b/sys/external/bsd/acpica/dist/common/adwalk.c @@ -493,7 +493,9 @@ AcpiDmFindOrphanDescending ( return (AE_OK); } +#ifdef ACPI_UNDER_DEVELOPMENT OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); +#endif switch (Op->Common.AmlOpcode) { @@ -992,7 +994,7 @@ AcpiDmCommonDescendingOp ( /* Switch/Case conversion */ Status = AcpiDmProcessSwitch (Op); - return (AE_OK); + return (Status); } diff --git a/sys/external/bsd/acpica/dist/common/dmtbdump1.c b/sys/external/bsd/acpica/dist/common/dmtbdump1.c index 6de7f818abd2..f89021e0f0ab 100644 --- a/sys/external/bsd/acpica/dist/common/dmtbdump1.c +++ b/sys/external/bsd/acpica/dist/common/dmtbdump1.c @@ -366,7 +366,6 @@ AcpiDmDumpCsrt ( { return; } - SubSubOffset += InfoLength; } /* Point to next sub-subtable */ @@ -1293,7 +1292,6 @@ AcpiDmDumpHmat ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - SubtableOffset = 0; /* Dump HMAT structure header */ @@ -1376,6 +1374,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1392,6 +1395,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1411,6 +1419,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); + if (ACPI_FAILURE(Status)) + { + return; + } + SubtableOffset += 2; } } @@ -1434,6 +1447,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 2; } break; diff --git a/sys/external/bsd/acpica/dist/common/dmtbdump2.c b/sys/external/bsd/acpica/dist/common/dmtbdump2.c index fd1aba81c5f0..bcba82677aeb 100644 --- a/sys/external/bsd/acpica/dist/common/dmtbdump2.c +++ b/sys/external/bsd/acpica/dist/common/dmtbdump2.c @@ -79,6 +79,7 @@ AcpiDmDumpIort ( ACPI_DMTABLE_INFO *InfoTable; char *String; UINT32 i; + UINT32 MappingByteLength; /* Main table */ @@ -206,6 +207,11 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 4, AcpiDmTableInfoIort0a); + if (ACPI_FAILURE (Status)) + { + return; + } + NodeOffset += 4; } } @@ -217,8 +223,10 @@ AcpiDmDumpIort ( if (IortNode->Length > NodeOffset) { + MappingByteLength = + IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - Table, IortNode->Length - NodeOffset, + Table, IortNode->Length - NodeOffset - MappingByteLength, AcpiDmTableInfoIort1a); if (ACPI_FAILURE (Status)) { @@ -302,7 +310,6 @@ NextSubtable: /* Point to next node subtable */ Offset += IortNode->Length; - IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); } } @@ -1103,7 +1110,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 32-bit values at the end */ InfoTable = AcpiDmTableInfoNfit2; - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); break; @@ -1128,7 +1134,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 64-bit addresses at the end */ InfoTable = AcpiDmTableInfoNfit6; - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); break; @@ -1165,6 +1170,7 @@ AcpiDmDumpNfit ( { case ACPI_NFIT_TYPE_INTERLEAVE: + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); for (i = 0; i < Interleave->LineCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1200,6 +1206,7 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); for (i = 0; i < Hint->HintCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1698,6 +1705,11 @@ AcpiDmDumpPptt ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } break; @@ -1955,6 +1967,10 @@ AcpiDmDumpSdev ( Status = AcpiDmDumpTable (Table->Length, 0, ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), VendorDataLength, AcpiDmTableInfoSdev1b); + if (ACPI_FAILURE (Status)) + { + return; + } } break; diff --git a/sys/external/bsd/acpica/dist/common/dmtbdump3.c b/sys/external/bsd/acpica/dist/common/dmtbdump3.c index c7c1561a760b..9943389ca735 100644 --- a/sys/external/bsd/acpica/dist/common/dmtbdump3.c +++ b/sys/external/bsd/acpica/dist/common/dmtbdump3.c @@ -302,7 +302,7 @@ AcpiDmDumpStao ( Namepath = ACPI_ADD_PTR (char, Table, Offset); StringLength = strlen (Namepath) + 1; - AcpiDmLineHeader (Offset, StringLength, "Namestring"); + AcpiDmLineHeader (Offset, StringLength, "Namepath"); AcpiOsPrintf ("\"%s\"\n", Namepath); /* Point to next namepath */ @@ -418,7 +418,7 @@ AcpiDmDumpTpm2Rev3 ( { case ACPI_TPM23_ACPI_START_METHOD: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + (void) AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTpm23a); break; @@ -483,7 +483,7 @@ AcpiDmDumpTpm2 ( Offset += sizeof (ACPI_TPM2_TRAILER); AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, + (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, Table->Length - Offset, AcpiDmTableInfoTpm211); break; diff --git a/sys/external/bsd/acpica/dist/compiler/aslbtypes.c b/sys/external/bsd/acpica/dist/compiler/aslbtypes.c index 33b80ff02f50..477d978b607e 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslbtypes.c +++ b/sys/external/bsd/acpica/dist/compiler/aslbtypes.c @@ -366,7 +366,6 @@ AnFormatBtype ( strcat (Buffer, "|"); } - First = FALSE; strcat (Buffer, "Resource"); } } diff --git a/sys/external/bsd/acpica/dist/compiler/asldefine.h b/sys/external/bsd/acpica/dist/compiler/asldefine.h index 1645c552c764..474f36eda74b 100644 --- a/sys/external/bsd/acpica/dist/compiler/asldefine.h +++ b/sys/external/bsd/acpica/dist/compiler/asldefine.h @@ -114,11 +114,11 @@ /* Misc */ -#define ASL_EXTERNAL_METHOD 255 -#define ASL_ABORT TRUE -#define ASL_NO_ABORT FALSE -#define ASL_EOF ACPI_UINT32_MAX -#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1) +#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS 255 +#define ASL_ABORT TRUE +#define ASL_NO_ABORT FALSE +#define ASL_EOF ACPI_UINT32_MAX +#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1) /* Listings */ diff --git a/sys/external/bsd/acpica/dist/compiler/aslkeywords.y b/sys/external/bsd/acpica/dist/compiler/aslkeywords.y index 7f82dd94189f..7a9967192e32 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslkeywords.y +++ b/sys/external/bsd/acpica/dist/compiler/aslkeywords.y @@ -94,7 +94,7 @@ AddressKeyword ; AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);} | RegionSpaceKeyword {} ; diff --git a/sys/external/bsd/acpica/dist/compiler/aslmessages.c b/sys/external/bsd/acpica/dist/compiler/aslmessages.c index bcce4348fc33..6a4308bd3ce4 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslmessages.c +++ b/sys/external/bsd/acpica/dist/compiler/aslmessages.c @@ -260,7 +260,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", /* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal", /* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer", -/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead." +/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.", +/* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)", +/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:" }; /* Table compiler */ @@ -279,7 +281,10 @@ const char *AslTableCompilerMsgs [] = /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", +/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected", +/* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list", +/* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list" }; /* Preprocessor */ diff --git a/sys/external/bsd/acpica/dist/compiler/aslmessages.h b/sys/external/bsd/acpica/dist/compiler/aslmessages.h index 84912a233fc6..8198f5daad7c 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslmessages.h +++ b/sys/external/bsd/acpica/dist/compiler/aslmessages.h @@ -263,6 +263,8 @@ typedef enum ASL_MSG_INVALID_SPECIAL_NAME, ASL_MSG_INVALID_PROCESSOR_UID, ASL_MSG_LEGACY_PROCESSOR_OP, + ASL_MSG_NAMESTRING_LENGTH, + ASL_MSG_CASE_FOUND_HERE, /* These messages are used by the Data Table compiler only */ @@ -279,6 +281,9 @@ typedef enum ASL_MSG_UNKNOWN_SUBTABLE, ASL_MSG_UNKNOWN_TABLE, ASL_MSG_ZERO_VALUE, + ASL_MSG_INVALID_LABEL, + ASL_MSG_BUFFER_LIST, + ASL_MSG_ENTRY_LIST, /* These messages are used by the Preprocessor only */ diff --git a/sys/external/bsd/acpica/dist/compiler/aslmethod.c b/sys/external/bsd/acpica/dist/compiler/aslmethod.c index 322a86a82014..f772c75f2411 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslmethod.c +++ b/sys/external/bsd/acpica/dist/compiler/aslmethod.c @@ -91,6 +91,8 @@ MtMethodAnalysisWalkBegin ( ACPI_PARSE_OBJECT *NextType; ACPI_PARSE_OBJECT *NextParamType; UINT8 ActualArgs = 0; + BOOLEAN HidExists; + BOOLEAN AdrExists; /* Build cross-reference output file if requested */ @@ -427,12 +429,26 @@ MtMethodAnalysisWalkBegin ( case PARSEOP_DEVICE: - if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) && - !ApFindNameInDeviceTree (METHOD_NAME__ADR, Op)) + /* Check usage of _HID and _ADR objects */ + + HidExists = ApFindNameInDeviceTree (METHOD_NAME__HID, Op); + AdrExists = ApFindNameInDeviceTree (METHOD_NAME__ADR, Op); + + if (!HidExists && !AdrExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, "Device object requires a _HID or _ADR in same scope"); } + else if (HidExists && AdrExists) + { + /* + * According to the ACPI spec, "A device object must contain + * either an _HID object or an _ADR object, but should not contain + * both". + */ + AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op, + "Device object requires either a _HID or _ADR, but not both"); + } break; case PARSEOP_EVENT: @@ -462,7 +478,7 @@ MtMethodAnalysisWalkBegin ( /* Special typechecking for _HID */ - if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg)) + if (ACPI_COMPARE_NAMESEG (METHOD_NAME__HID, Op->Asl.NameSeg)) { Next = Op->Asl.Child->Asl.Next; AnCheckId (Next, ASL_TYPE_HID); @@ -470,7 +486,7 @@ MtMethodAnalysisWalkBegin ( /* Special typechecking for _CID */ - else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg)) + else if (ACPI_COMPARE_NAMESEG (METHOD_NAME__CID, Op->Asl.NameSeg)) { Next = Op->Asl.Child->Asl.Next; diff --git a/sys/external/bsd/acpica/dist/compiler/aslnamesp.c b/sys/external/bsd/acpica/dist/compiler/aslnamesp.c index 7494b1a027eb..73cb8575ce03 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslnamesp.c +++ b/sys/external/bsd/acpica/dist/compiler/aslnamesp.c @@ -126,6 +126,10 @@ NsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Print the full pathname for each namespace node */ diff --git a/sys/external/bsd/acpica/dist/compiler/aslresource.c b/sys/external/bsd/acpica/dist/compiler/aslresource.c index 4dda7714f0c0..1cbabfbf6cfc 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslresource.c +++ b/sys/external/bsd/acpica/dist/compiler/aslresource.c @@ -1118,7 +1118,7 @@ RsDoResourceTemplate ( BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; BufferOp->Asl.AmlOpcodeLength = 0; BufferOp->Asl.AmlLength = CurrentByteOffset; - BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; + BufferOp->Asl.Value.Buffer = ACPI_CAST_PTR (UINT8, HeadRnode.Next); BufferOp->Asl.CompileFlags |= OP_IS_RESOURCE_DATA; UtSetParseOpName (BufferOp); diff --git a/sys/external/bsd/acpica/dist/compiler/aslrestype2.c b/sys/external/bsd/acpica/dist/compiler/aslrestype2.c index b670f88c8bae..21899390fde3 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslrestype2.c +++ b/sys/external/bsd/acpica/dist/compiler/aslrestype2.c @@ -379,10 +379,7 @@ RsDoInterruptDescriptor ( if (StringLength && ResSourceString) { - strcpy ((char *) Rover, (char *) ResSourceString); - Rover = ACPI_ADD_PTR ( - AML_RESOURCE, &(Rover->ByteItem), StringLength); Descriptor->ExtendedIrq.ResourceLength = (UINT16) (Descriptor->ExtendedIrq.ResourceLength + StringLength); diff --git a/sys/external/bsd/acpica/dist/compiler/aslrestype2s.c b/sys/external/bsd/acpica/dist/compiler/aslrestype2s.c index 456d9f0586bd..5c25ae7ae0fd 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslrestype2s.c +++ b/sys/external/bsd/acpica/dist/compiler/aslrestype2s.c @@ -566,7 +566,6 @@ RsDoGpioIoDescriptor ( ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); - PinList = InterruptList; DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + ResSourceLength + VendorLength + InterruptLength; diff --git a/sys/external/bsd/acpica/dist/compiler/aslstartup.c b/sys/external/bsd/acpica/dist/compiler/aslstartup.c index aacac487c740..4a923d423544 100644 --- a/sys/external/bsd/acpica/dist/compiler/aslstartup.c +++ b/sys/external/bsd/acpica/dist/compiler/aslstartup.c @@ -349,10 +349,6 @@ AslDoOneFile ( } FileNode = FlGetCurrentFileNode(); - if (!FileNode) - { - return (AE_ERROR); - } FileNode->OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT); diff --git a/sys/external/bsd/acpica/dist/compiler/asltransform.c b/sys/external/bsd/acpica/dist/compiler/asltransform.c index 4b78f1bffa9b..fbb16e9e980d 100644 --- a/sys/external/bsd/acpica/dist/compiler/asltransform.c +++ b/sys/external/bsd/acpica/dist/compiler/asltransform.c @@ -43,6 +43,7 @@ #include "aslcompiler.h" #include "aslcompiler.y.h" +#include "acnamesp.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("asltransform") @@ -86,6 +87,16 @@ static void TrDoSwitch ( ACPI_PARSE_OBJECT *StartNode); +static void +TrCheckForDuplicateCase ( + ACPI_PARSE_OBJECT *CaseOp, + ACPI_PARSE_OBJECT *Predicate1); + +static BOOLEAN +TrCheckForBufferMatch ( + ACPI_PARSE_OBJECT *Next1, + ACPI_PARSE_OBJECT *Next2); + /******************************************************************************* * @@ -323,6 +334,7 @@ TrTransformSubtree ( ACPI_PARSE_OBJECT *Op) { ACPI_PARSE_OBJECT *MethodOp; + ACPI_NAMESTRING_INFO Info; if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) @@ -384,6 +396,22 @@ TrTransformSubtree ( Op->Asl.Value.String = "\\"; break; + case PARSEOP_NAMESTRING: + /* + * A NameString can be up to 255 (0xFF) individual NameSegs maximum + * (with 254 dot separators) - as per the ACPI specification. Note: + * Cannot check for NumSegments == 0 because things like + * Scope(\) are legal and OK. + */ + Info.ExternalName = Op->Asl.Value.String; + AcpiNsGetInternalNameLength (&Info); + + if (Info.NumSegments > 255) + { + AslError (ASL_ERROR, ASL_MSG_NAMESTRING_LENGTH, Op, NULL); + } + break; + case PARSEOP_UNLOAD: AslError (ASL_WARNING, ASL_MSG_UNLOAD, Op, NULL); @@ -402,7 +430,6 @@ TrTransformSubtree ( case PARSEOP_PROCESSOR: AslError (ASL_WARNING, ASL_MSG_LEGACY_PROCESSOR_OP, Op, Op->Asl.ExternalName); - break; default: @@ -538,6 +565,8 @@ TrDoSwitch ( if (Next->Asl.ParseOpcode == PARSEOP_CASE) { + TrCheckForDuplicateCase (Next, Next->Asl.Child); + if (CaseOp) { /* Add an ELSE to complete the previous CASE */ @@ -869,3 +898,176 @@ TrDoSwitch ( BreakOp->Asl.Parent = StartNode; TrAmlInsertPeer (Conditional, BreakOp); } + + +/******************************************************************************* + * + * FUNCTION: TrCheckForDuplicateCase + * + * PARAMETERS: CaseOp - Parse node for first Case statement in list + * Predicate1 - Case value for the input CaseOp + * + * RETURN: None + * + * DESCRIPTION: Check for duplicate case values. Currently, only handles + * Integers, Strings and Buffers. No support for Package objects. + * + ******************************************************************************/ + +static void +TrCheckForDuplicateCase ( + ACPI_PARSE_OBJECT *CaseOp, + ACPI_PARSE_OBJECT *Predicate1) +{ + ACPI_PARSE_OBJECT *Next; + ACPI_PARSE_OBJECT *Predicate2; + + + /* Walk the list of CASE opcodes */ + + Next = CaseOp->Asl.Next; + while (Next) + { + if (Next->Asl.ParseOpcode == PARSEOP_CASE) + { + /* Emit error only once */ + + if (Next->Asl.CompileFlags & OP_IS_DUPLICATE) + { + goto NextCase; + } + + /* Check for a duplicate plain integer */ + + Predicate2 = Next->Asl.Child; + if ((Predicate1->Asl.ParseOpcode == PARSEOP_INTEGER) && + (Predicate2->Asl.ParseOpcode == PARSEOP_INTEGER)) + { + if (Predicate1->Asl.Value.Integer == Predicate2->Asl.Value.Integer) + { + goto FoundDuplicate; + } + } + + /* Check for pairs of the constants ZERO, ONE, ONES */ + + else if (((Predicate1->Asl.ParseOpcode == PARSEOP_ZERO) && + (Predicate2->Asl.ParseOpcode == PARSEOP_ZERO)) || + ((Predicate1->Asl.ParseOpcode == PARSEOP_ONE) && + (Predicate2->Asl.ParseOpcode == PARSEOP_ONE)) || + ((Predicate1->Asl.ParseOpcode == PARSEOP_ONES) && + (Predicate2->Asl.ParseOpcode == PARSEOP_ONES))) + { + goto FoundDuplicate; + } + + /* Check for a duplicate string constant (literal) */ + + else if ((Predicate1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) && + (Predicate2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)) + { + if (!strcmp (Predicate1->Asl.Value.String, + Predicate2->Asl.Value.String)) + { + goto FoundDuplicate; + } + } + + /* Check for a duplicate buffer constant */ + + else if ((Predicate1->Asl.ParseOpcode == PARSEOP_BUFFER) && + (Predicate2->Asl.ParseOpcode == PARSEOP_BUFFER)) + { + if (TrCheckForBufferMatch (Predicate1->Asl.Child, + Predicate2->Asl.Child)) + { + goto FoundDuplicate; + } + } + } + goto NextCase; + +FoundDuplicate: + /* Emit error message only once */ + + Next->Asl.CompileFlags |= OP_IS_DUPLICATE; + + AslDualParseOpError (ASL_ERROR, ASL_MSG_DUPLICATE_CASE, Next, + Next->Asl.Value.String, ASL_MSG_CASE_FOUND_HERE, CaseOp, + CaseOp->Asl.ExternalName); + +NextCase: + Next = Next->Asl.Next; + } +} + + +/******************************************************************************* + * + * FUNCTION: TrCheckForBufferMatch + * + * PARAMETERS: Next1 - Parse node for first opcode in first buffer list + * (The DEFAULT_ARG or INTEGER node) + * Next2 - Parse node for first opcode in second buffer list + * (The DEFAULT_ARG or INTEGER node) + * + * RETURN: TRUE if buffers match, FALSE otherwise + * + * DESCRIPTION: Check for duplicate Buffer case values. + * + ******************************************************************************/ + +static BOOLEAN +TrCheckForBufferMatch ( + ACPI_PARSE_OBJECT *NextOp1, + ACPI_PARSE_OBJECT *NextOp2) +{ + + if (NextOp1->Asl.Value.Integer != NextOp2->Asl.Value.Integer) + { + return (FALSE); + } + + /* Start at the BYTECONST initializer node list */ + + NextOp1 = NextOp1->Asl.Next; + NextOp2 = NextOp2->Asl.Next; + + /* + * Walk both lists until either a mismatch is found, or one or more + * end-of-lists are found + */ + while (NextOp1 && NextOp2) + { + if ((NextOp1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) && + (NextOp2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)) + { + if (!strcmp (NextOp1->Asl.Value.String, NextOp2->Asl.Value.String)) + { + return (TRUE); + } + else + { + return (FALSE); + } + } + if ((UINT8) NextOp1->Asl.Value.Integer != (UINT8) NextOp2->Asl.Value.Integer) + { + return (FALSE); + } + + NextOp1 = NextOp1->Asl.Next; + NextOp2 = NextOp2->Asl.Next; + } + + /* Not a match if one of the lists is not at end-of-list */ + + if (NextOp1 || NextOp2) + { + return (FALSE); + } + + /* Otherwise, the buffers match */ + + return (TRUE); +} diff --git a/sys/external/bsd/acpica/dist/compiler/cvdisasm.c b/sys/external/bsd/acpica/dist/compiler/cvdisasm.c index 3fc8ca4cb1c3..c40868180505 100644 --- a/sys/external/bsd/acpica/dist/compiler/cvdisasm.c +++ b/sys/external/bsd/acpica/dist/compiler/cvdisasm.c @@ -436,8 +436,11 @@ CvSwitchFiles( Current = Current->Parent; } - /* Redirect output to Op->Common.CvFilename */ + if (FNode) + { + /* Redirect output to Op->Common.CvFilename */ - AcpiOsRedirectOutput (FNode->File); - AcpiGbl_CurrentFilename = FNode->Filename; + AcpiOsRedirectOutput (FNode->File); + AcpiGbl_CurrentFilename = FNode->Filename; + } } diff --git a/sys/external/bsd/acpica/dist/compiler/cvparser.c b/sys/external/bsd/acpica/dist/compiler/cvparser.c index 03148a72d5dd..7ca4f179331c 100644 --- a/sys/external/bsd/acpica/dist/compiler/cvparser.c +++ b/sys/external/bsd/acpica/dist/compiler/cvparser.c @@ -804,7 +804,6 @@ CvCaptureCommentsOnly ( /* Not a valid comment option. Revert the AML */ - Aml -= 2; goto DefBlock; } /* End switch statement */ diff --git a/sys/external/bsd/acpica/dist/compiler/dtcompiler.h b/sys/external/bsd/acpica/dist/compiler/dtcompiler.h index 964c88f681aa..581ce9fa855b 100644 --- a/sys/external/bsd/acpica/dist/compiler/dtcompiler.h +++ b/sys/external/bsd/acpica/dist/compiler/dtcompiler.h @@ -102,6 +102,17 @@ typedef struct dt_field #define DT_FIELD_NOT_ALLOCATED 1 +/* + * Structure used for each individual key or value + */ +typedef struct dt_table_unit +{ + char *Value; /* Field value (from name : value) */ + UINT32 Line; /* Line number for this field */ + UINT32 Column; /* Start column for field value */ + +} DT_TABLE_UNIT; + /* * Structure used for individual subtables within an ACPI table @@ -184,14 +195,6 @@ DtCompilePadding ( UINT32 Length, DT_SUBTABLE **RetSubtable); -void -DtCreateField ( - char *Name, - char *Value, - UINT32 Line, - UINT32 Offset, - UINT32 Column, - UINT32 NameColumn); /* dtio - binary and text input/output */ @@ -329,6 +332,25 @@ DtCompileFlag ( ACPI_DMTABLE_INFO *Info); +/* dtfield - DT_FIELD operations */ + +void +DtLinkField ( + DT_FIELD *Field); + +void +DtCreateField ( + DT_TABLE_UNIT *FieldKey, + DT_TABLE_UNIT *FieldValue, + UINT32 Offset); + +DT_TABLE_UNIT * +DtCreateTableUnit ( + char *Data, + UINT32 Line, + UINT32 Column); + + /* dtparser - lex/yacc files */ UINT64 DtCompilerParserResult; /* Expression return value */ diff --git a/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.l b/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.l index 316bfb2fa715..cf74d7b8f702 100644 --- a/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.l +++ b/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.l @@ -53,18 +53,20 @@ YYSTYPE DtCompilerlval; /* handle locations */ int DtCompilerParsercolumn = 1; +int DtLabelByteOffset = 0; int DtCompilerParserByteOffset = 0; +UINT32 DtTokenFirstLine = 0; +UINT32 DtTokenFirstColumn = 0; + #define YY_USER_ACTION \ - DtCompilerParserlloc.first_line = DtCompilerParserlloc.last_line = DtCompilerParserlineno; \ - DtCompilerParserlloc.first_column = DtCompilerParsercolumn; \ - DtCompilerParserlloc.first_byte_offset = DtCompilerParserByteOffset; \ - DtCompilerParserlloc.last_column = DtCompilerParsercolumn + DtCompilerParserleng-1; \ + DtTokenFirstLine = DtCompilerParserlineno; \ + DtTokenFirstColumn = DtCompilerParsercolumn; \ DtCompilerParsercolumn += DtCompilerParserleng; \ DtCompilerParserByteOffset += DtCompilerParserleng; \ DbgPrint (ASL_PARSE_OUTPUT,\ - "user action occurred. DtCompilerParserlloc.first_line: %u offset: %u\n",\ - DtCompilerParserlloc.first_line, DtCompilerParserlloc.first_byte_offset); + "user action occurred. DtCompilerParserlloc.first_line: %u\n",\ + DtTokenFirstLine); %} %option nounput noinput yylineno @@ -128,7 +130,11 @@ CommentField {LabelName}{WhiteSpace}*:{WhiteSpace}{Comment}?$ int size = strlen (DtCompilerParsertext); s=UtLocalCacheCalloc (size + 1); AcpiUtSafeStrncpy (s, DtCompilerParsertext, size + 1); - DtCompilerParserlval.s = s; + DtCompilerParserlval.u = (DT_TABLE_UNIT *) UtLocalCacheCalloc (sizeof (DT_TABLE_UNIT)); + DtCompilerParserlval.u->Value = s; + DtCompilerParserlval.u->Line = DtCompilerParserlineno; + DtCompilerParserlval.u->Column = DtCompilerParsercolumn; + DtLabelByteOffset = DtCompilerParserByteOffset; DbgPrint (ASL_PARSE_OUTPUT, "Label: %s\n", s); return (DT_PARSEOP_LABEL); } diff --git a/sys/external/bsd/acpica/dist/compiler/dtio.c b/sys/external/bsd/acpica/dist/compiler/dtio.c index 678657257d91..737d76979f9d 100644 --- a/sys/external/bsd/acpica/dist/compiler/dtio.c +++ b/sys/external/bsd/acpica/dist/compiler/dtio.c @@ -54,10 +54,6 @@ static char * DtTrim ( char *String); -static void -DtLinkField ( - DT_FIELD *Field); - static ACPI_STATUS DtParseLine ( char *LineBuffer, @@ -189,45 +185,6 @@ DtTrim ( } -/****************************************************************************** - * - * FUNCTION: DtLinkField - * - * PARAMETERS: Field - New field object to link - * - * RETURN: None - * - * DESCRIPTION: Link one field name and value to the list - * - *****************************************************************************/ - -static void -DtLinkField ( - DT_FIELD *Field) -{ - DT_FIELD *Prev; - DT_FIELD *Next; - - - Prev = Next = AslGbl_FieldList; - - while (Next) - { - Prev = Next; - Next = Next->Next; - } - - if (Prev) - { - Prev->Next = Field; - } - else - { - AslGbl_FieldList = Field; - } -} - - /****************************************************************************** * * FUNCTION: DtParseLine @@ -385,59 +342,6 @@ DtParseLine ( } -/****************************************************************************** - * - * FUNCTION: DtCreateField - * - * PARAMETERS: Name - * Value - * Line - * Offset - * Column - * NameColumn - * - * RETURN: None - * - * DESCRIPTION: Create a field - * - *****************************************************************************/ - -void -DtCreateField ( - char *Name, - char *Value, - UINT32 Line, - UINT32 Offset, - UINT32 Column, - UINT32 NameColumn) -{ - DT_FIELD *Field = UtFieldCacheCalloc (); - - - Field->StringLength = 0; - if (Name) - { - Field->Name = - strcpy (UtLocalCacheCalloc (strlen (Name) + 1), Name); - } - - if (Value) - { - Field->StringLength = strlen (Value); - Field->Value = - strcpy (UtLocalCacheCalloc (Field->StringLength + 1), Value); - } - - Field->Line = Line; - Field->ByteOffset = Offset; - Field->NameColumn = NameColumn; - Field->Column = Column; - DtLinkField (Field); - - DtDumpFieldList (AslGbl_FieldList); -} - - /****************************************************************************** * * FUNCTION: DtGetNextLine @@ -732,7 +636,6 @@ DtGetNextLine ( case '\n': - CurrentLineOffset = AslGbl_NextLineOffset; AslGbl_NextLineOffset = (UINT32) ftell (Handle); AslGbl_CurrentLineNumber++; break; @@ -774,7 +677,6 @@ DtGetNextLine ( /* Ignore newline, this will merge the lines */ - CurrentLineOffset = AslGbl_NextLineOffset; AslGbl_NextLineOffset = (UINT32) ftell (Handle); AslGbl_CurrentLineNumber++; State = DT_NORMAL_TEXT; diff --git a/sys/external/bsd/acpica/dist/compiler/dttable2.c b/sys/external/bsd/acpica/dist/compiler/dttable2.c index c24bcbe4a8b4..d83990791d21 100644 --- a/sys/external/bsd/acpica/dist/compiler/dttable2.c +++ b/sys/external/bsd/acpica/dist/compiler/dttable2.c @@ -1366,13 +1366,14 @@ DtCompileSdev ( Namesp->DeviceIdOffset + Namesp->DeviceIdLength; Namesp->VendorDataLength = (UINT16) Subtable->Length; + + /* Final size of entire namespace structure */ + + SdevHeader->Length = (UINT16)(sizeof(ACPI_SDEV_NAMESPACE) + + Subtable->Length + Namesp->DeviceIdLength); } } - /* Final size of entire namespace structure */ - - SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_NAMESPACE) + - Subtable->Length + Namesp->DeviceIdLength); break; case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: @@ -1512,7 +1513,9 @@ DtCompileSlit ( DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *FieldList; + DT_FIELD *EndOfFieldList = NULL; UINT32 Localities; + UINT32 LocalityListLength; UINT8 *LocalityBuffer; @@ -1528,6 +1531,7 @@ DtCompileSlit ( Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); + LocalityListLength = 0; /* Compile each locality buffer */ @@ -1537,11 +1541,23 @@ DtCompileSlit ( DtCompileBuffer (LocalityBuffer, FieldList->Value, FieldList, Localities); + LocalityListLength++; DtCreateSubtable (LocalityBuffer, Localities, &Subtable); DtInsertSubtable (ParentTable, Subtable); + EndOfFieldList = FieldList; FieldList = FieldList->Next; } + if (LocalityListLength != Localities) + { + sprintf(AslGbl_MsgBuffer, + "Found %u entries, must match LocalityCount: %u", + LocalityListLength, Localities); + DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer); + ACPI_FREE (LocalityBuffer); + return (AE_LIMIT); + } + ACPI_FREE (LocalityBuffer); return (AE_OK); } diff --git a/sys/external/bsd/acpica/dist/debugger/dbconvert.c b/sys/external/bsd/acpica/dist/debugger/dbconvert.c index 6a7ffc2e52c9..b55d63895ecf 100644 --- a/sys/external/bsd/acpica/dist/debugger/dbconvert.c +++ b/sys/external/bsd/acpica/dist/debugger/dbconvert.c @@ -166,6 +166,10 @@ AcpiDbConvertToBuffer ( ACPI_STATUS Status; + /* Skip all preceding white space*/ + + AcpiUtRemoveWhitespace (&String); + /* Generate the final buffer length */ for (i = 0, Length = 0; String[i];) diff --git a/sys/external/bsd/acpica/dist/debugger/dbfileio.c b/sys/external/bsd/acpica/dist/debugger/dbfileio.c index 2e6a645081b1..8fb856de1442 100644 --- a/sys/external/bsd/acpica/dist/debugger/dbfileio.c +++ b/sys/external/bsd/acpica/dist/debugger/dbfileio.c @@ -145,7 +145,7 @@ AcpiDbLoadTables ( { Table = TableListHead->Table; - Status = AcpiLoadTable (Table); + Status = AcpiLoadTable (Table, NULL); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) diff --git a/sys/external/bsd/acpica/dist/debugger/dbobject.c b/sys/external/bsd/acpica/dist/debugger/dbobject.c index 502d5a98255f..a0c4da0b3069 100644 --- a/sys/external/bsd/acpica/dist/debugger/dbobject.c +++ b/sys/external/bsd/acpica/dist/debugger/dbobject.c @@ -541,7 +541,6 @@ AcpiDbDecodeArguments ( Node = WalkState->MethodNode; - ObjDesc = WalkState->MethodDesc; /* There are no arguments for the module-level code case */ diff --git a/sys/external/bsd/acpica/dist/disassembler/dmdeferred.c b/sys/external/bsd/acpica/dist/disassembler/dmdeferred.c index 1901fd1ac23a..e984eca673e9 100644 --- a/sys/external/bsd/acpica/dist/disassembler/dmdeferred.c +++ b/sys/external/bsd/acpica/dist/disassembler/dmdeferred.c @@ -201,6 +201,10 @@ AcpiDmDeferredParse ( WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS(Status); + } StartOp = (Op->Common.Value.Arg)->Common.Next; SearchOp = StartOp; diff --git a/sys/external/bsd/acpica/dist/dispatcher/dsfield.c b/sys/external/bsd/acpica/dist/dispatcher/dsfield.c index 43c1fe4fa1c7..4d7280a1de93 100644 --- a/sys/external/bsd/acpica/dist/dispatcher/dsfield.c +++ b/sys/external/bsd/acpica/dist/dispatcher/dsfield.c @@ -201,7 +201,6 @@ AcpiDsCreateBufferField ( if (WalkState->DeferredNode) { Node = WalkState->DeferredNode; - Status = AE_OK; } else { @@ -306,7 +305,7 @@ Cleanup: * FUNCTION: AcpiDsGetFieldNames * * PARAMETERS: Info - CreateField info structure - * ` WalkState - Current method state + * WalkState - Current method state * Arg - First parser arg for the field name list * * RETURN: Status @@ -327,7 +326,6 @@ AcpiDsGetFieldNames ( ACPI_PARSE_OBJECT *Child; #ifdef ACPI_EXEC_APP - UINT64 Value = 0; ACPI_OPERAND_OBJECT *ResultDesc; ACPI_OPERAND_OBJECT *ObjDesc; char *NamePath; @@ -469,14 +467,13 @@ AcpiDsGetFieldNames ( } #ifdef ACPI_EXEC_APP NamePath = AcpiNsGetExternalPathname (Info->FieldNode); - ObjDesc = AcpiUtCreateIntegerObject (Value); - if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &Value))) + if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &ObjDesc))) { AcpiExWriteDataToField (ObjDesc, AcpiNsGetAttachedObject (Info->FieldNode), &ResultDesc); + AcpiUtRemoveReference (ObjDesc); } - AcpiUtRemoveReference (ObjDesc); ACPI_FREE (NamePath); #endif } @@ -705,8 +702,6 @@ AcpiDsInitFieldObjects ( } /* Name already exists, just ignore this error */ - - Status = AE_OK; } Arg->Common.Node = Node; diff --git a/sys/external/bsd/acpica/dist/dispatcher/dswload.c b/sys/external/bsd/acpica/dist/dispatcher/dswload.c index bc99b2b166cc..8badd9f897e9 100644 --- a/sys/external/bsd/acpica/dist/dispatcher/dswload.c +++ b/sys/external/bsd/acpica/dist/dispatcher/dswload.c @@ -459,6 +459,28 @@ AcpiDsLoad1EndOp ( Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + /* + * Disassembler: handle create field operators here. + * + * CreateBufferField is a deferred op that is typically processed in load + * pass 2. However, disassembly of control method contents walk the parse + * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed + * in a later walk. This is a problem when there is a control method that + * has the same name as the AML_CREATE object. In this case, any use of the + * name segment will be detected as a method call rather than a reference + * to a buffer field. + * + * This earlier creation during disassembly solves this issue by inserting + * the named object in the ACPI namespace so that references to this name + * would be a name string rather than a method call. + */ + if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) && + (WalkState->OpInfo->Flags & AML_CREATE)) + { + Status = AcpiDsCreateBufferField (Op, WalkState); + return_ACPI_STATUS (Status); + } + /* We are only interested in opcodes that have an associated name */ if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) diff --git a/sys/external/bsd/acpica/dist/events/evgpeblk.c b/sys/external/bsd/acpica/dist/events/evgpeblk.c index b523bbf50a92..283b5ffedd23 100644 --- a/sys/external/bsd/acpica/dist/events/evgpeblk.c +++ b/sys/external/bsd/acpica/dist/events/evgpeblk.c @@ -164,6 +164,10 @@ AcpiEvDeleteGpeBlock ( /* Disable all GPEs in this block */ Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } if (!GpeBlock->Previous && !GpeBlock->Next) { @@ -434,7 +438,7 @@ AcpiEvCreateGpeBlock ( WalkInfo.GpeDevice = GpeDevice; WalkInfo.ExecuteByOwnerId = FALSE; - Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, + (void) AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); diff --git a/sys/external/bsd/acpica/dist/events/evgpeinit.c b/sys/external/bsd/acpica/dist/events/evgpeinit.c index 9b2d5ce928c3..82d3e0c6efea 100644 --- a/sys/external/bsd/acpica/dist/events/evgpeinit.c +++ b/sys/external/bsd/acpica/dist/events/evgpeinit.c @@ -194,8 +194,6 @@ AcpiEvGpeInitialize ( * GPE0 and GPE1 do not have to be contiguous in the GPE number * space. However, GPE0 always starts at GPE number zero. */ - GpeNumberMax = AcpiGbl_FADT.Gpe1Base + - ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1); } } @@ -207,7 +205,6 @@ AcpiEvGpeInitialize ( ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "There are no GPE blocks defined in the FADT\n")); - Status = AE_OK; goto Cleanup; } diff --git a/sys/external/bsd/acpica/dist/events/evmisc.c b/sys/external/bsd/acpica/dist/events/evmisc.c index 37132d41bb6a..b9bf22e44adf 100644 --- a/sys/external/bsd/acpica/dist/events/evmisc.c +++ b/sys/external/bsd/acpica/dist/events/evmisc.c @@ -292,11 +292,16 @@ AcpiEvTerminate ( /* Disable all GPEs in all GPE blocks */ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not disable GPEs in GPE block")); + } Status = AcpiEvRemoveGlobalLockHandler (); - if (ACPI_FAILURE(Status)) + if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, + ACPI_EXCEPTION ((AE_INFO, Status, "Could not remove Global Lock handler")); } @@ -306,7 +311,7 @@ AcpiEvTerminate ( /* Remove SCI handlers */ Status = AcpiEvRemoveAllSciHandlers (); - if (ACPI_FAILURE(Status)) + if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not remove SCI handler")); @@ -315,6 +320,12 @@ AcpiEvTerminate ( /* Deallocate all handler objects installed within GPE info structs */ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not delete GPE handlers")); + } + /* Return to original mode if necessary */ diff --git a/sys/external/bsd/acpica/dist/executer/exfield.c b/sys/external/bsd/acpica/dist/executer/exfield.c index f4c4139b97cd..70e73babde4c 100644 --- a/sys/external/bsd/acpica/dist/executer/exfield.c +++ b/sys/external/bsd/acpica/dist/executer/exfield.c @@ -138,7 +138,8 @@ AcpiExGetProtocolBufferLength ( * RETURN: Status * * DESCRIPTION: Read from a named field. Returns either an Integer or a - * Buffer, depending on the size of the field. + * Buffer, depending on the size of the field and whether if a + * field is created by the CreateField() operator. * ******************************************************************************/ @@ -202,12 +203,17 @@ AcpiExReadDataFromField ( * the use of arithmetic operators on the returned value if the * field size is equal or smaller than an Integer. * + * However, all buffer fields created by CreateField operator needs to + * remain as a buffer to match other AML interpreter implementations. + * * Note: Field.length is in bits. */ BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( ObjDesc->Field.BitLength); - if (BufferLength > AcpiGbl_IntegerByteWidth) + if (BufferLength > AcpiGbl_IntegerByteWidth || + (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD && + ObjDesc->BufferField.IsCreateField)) { /* Field is too large for an Integer, create a Buffer instead */ diff --git a/sys/external/bsd/acpica/dist/generate/unix/acpinames/Makefile b/sys/external/bsd/acpica/dist/generate/unix/acpinames/Makefile index db87d8840e29..90d3afe29e4f 100644 --- a/sys/external/bsd/acpica/dist/generate/unix/acpinames/Makefile +++ b/sys/external/bsd/acpica/dist/generate/unix/acpinames/Makefile @@ -22,7 +22,9 @@ PROG = $(OBJDIR)/acpinames vpath %.c \ $(ACPINAMES)\ $(ACPICA_DISPATCHER)\ + $(ACPICA_EVENTS)\ $(ACPICA_EXECUTER)\ + $(ACPICA_HARDWARE)\ $(ACPICA_NAMESPACE)\ $(ACPICA_PARSER)\ $(ACPICA_TABLES)\ @@ -39,34 +41,69 @@ OBJECTS = \ $(OBJDIR)/anstubs.o\ $(OBJDIR)/antables.o\ $(OBJDIR)/cmfsize.o\ + $(OBJDIR)/dscontrol.o\ + $(OBJDIR)/dsdebug.o\ $(OBJDIR)/dsfield.o\ $(OBJDIR)/dsinit.o\ + $(OBJDIR)/dsmethod.o\ $(OBJDIR)/dsmthdat.o\ $(OBJDIR)/dsobject.o\ + $(OBJDIR)/dsopcode.o\ $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ + $(OBJDIR)/dswexec.o\ $(OBJDIR)/dswload.o\ $(OBJDIR)/dswload2.o\ $(OBJDIR)/dswscope.o\ $(OBJDIR)/dswstate.o\ + $(OBJDIR)/evhandler.o\ + $(OBJDIR)/evmisc.o\ + $(OBJDIR)/evregion.o\ + $(OBJDIR)/evrgnini.o\ + $(OBJDIR)/evxfregn.o\ + $(OBJDIR)/exconcat.o\ + $(OBJDIR)/exconfig.o\ + $(OBJDIR)/exconvrt.o\ $(OBJDIR)/excreate.o\ $(OBJDIR)/exdump.o\ + $(OBJDIR)/exfield.o\ + $(OBJDIR)/exfldio.o\ + $(OBJDIR)/exmisc.o\ $(OBJDIR)/exmutex.o\ $(OBJDIR)/exnames.o\ + $(OBJDIR)/exoparg1.o\ + $(OBJDIR)/exoparg2.o\ + $(OBJDIR)/exoparg3.o\ + $(OBJDIR)/exoparg6.o\ $(OBJDIR)/exprep.o\ + $(OBJDIR)/exregion.o\ $(OBJDIR)/exresnte.o\ $(OBJDIR)/exresolv.o\ + $(OBJDIR)/exresop.o\ + $(OBJDIR)/exserial.o\ + $(OBJDIR)/exstore.o\ + $(OBJDIR)/exstoren.o\ + $(OBJDIR)/exstorob.o\ $(OBJDIR)/exsystem.o\ $(OBJDIR)/exutils.o\ $(OBJDIR)/getopt.o\ + $(OBJDIR)/hwpci.o\ + $(OBJDIR)/hwvalid.o\ $(OBJDIR)/nsaccess.o\ $(OBJDIR)/nsalloc.o\ + $(OBJDIR)/nsarguments.o\ + $(OBJDIR)/nsconvert.o\ $(OBJDIR)/nsdump.o\ + $(OBJDIR)/nseval.o\ $(OBJDIR)/nsinit.o\ $(OBJDIR)/nsload.o\ $(OBJDIR)/nsnames.o\ $(OBJDIR)/nsobject.o\ $(OBJDIR)/nsparse.o\ + $(OBJDIR)/nspredef.o\ + $(OBJDIR)/nsprepkg.o\ + $(OBJDIR)/nsrepair.o\ + $(OBJDIR)/nsrepair2.o\ $(OBJDIR)/nssearch.o\ $(OBJDIR)/nsutils.o\ $(OBJDIR)/nswalk.o\ @@ -99,6 +136,7 @@ OBJECTS = \ $(OBJDIR)/utascii.o\ $(OBJDIR)/utbuffer.o\ $(OBJDIR)/utcache.o\ + $(OBJDIR)/utcopy.o\ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utdecode.o\ $(OBJDIR)/utdelete.o\ @@ -117,8 +155,12 @@ OBJECTS = \ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ + $(OBJDIR)/utpredef.o\ + $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ + $(OBJDIR)/utstrsuppt.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/utxface.o\ $(OBJDIR)/utxferror.o\ $(OBJDIR)/utxfinit.o diff --git a/sys/external/bsd/acpica/dist/include/acobject.h b/sys/external/bsd/acpica/dist/include/acobject.h index 45f09839b6d3..8fe089777770 100644 --- a/sys/external/bsd/acpica/dist/include/acobject.h +++ b/sys/external/bsd/acpica/dist/include/acobject.h @@ -381,6 +381,7 @@ typedef struct acpi_object_buffer_field { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO + BOOLEAN IsCreateField; /* Special case for objects created by CreateField() */ union acpi_operand_object *BufferObj; /* Containing Buffer object */ } ACPI_OBJECT_BUFFER_FIELD; diff --git a/sys/external/bsd/acpica/dist/include/acstruct.h b/sys/external/bsd/acpica/dist/include/acstruct.h index ae168d757801..755df603c0f4 100644 --- a/sys/external/bsd/acpica/dist/include/acstruct.h +++ b/sys/external/bsd/acpica/dist/include/acstruct.h @@ -249,6 +249,19 @@ typedef struct acpi_device_walk_info } ACPI_DEVICE_WALK_INFO; +/* Info used by Acpi AcpiDbDisplayFields */ + +typedef struct acpi_region_walk_info +{ + UINT32 DebugLevel; + UINT32 Count; + ACPI_OWNER_ID OwnerId; + UINT8 DisplayType; + UINT32 AddressSpaceId; + +} ACPI_REGION_WALK_INFO; + + /* TBD: [Restructure] Merge with struct above */ typedef struct acpi_walk_info diff --git a/sys/external/bsd/acpica/dist/include/platform/acenv.h b/sys/external/bsd/acpica/dist/include/platform/acenv.h index 83f5853a463d..6f8c284d4931 100644 --- a/sys/external/bsd/acpica/dist/include/platform/acenv.h +++ b/sys/external/bsd/acpica/dist/include/platform/acenv.h @@ -162,6 +162,21 @@ #define ACPI_DISASSEMBLER 1 #endif +/* + * acpisrc CR\LF support + * Unix file line endings do not include the carriage return. + * If the acpisrc utility is being built using a microsoft compiler, it means + * that it will be running on a windows machine which means that the output is + * expected to have CR/LF newlines. If the acpisrc utility is built with + * anything else, it will likely run on a system with LF newlines. This flag + * tells the acpisrc utility that newlines will be in the LF format. + */ +#if defined(ACPI_SRC_APP) && !defined(_MSC_VER) +#define ACPI_SRC_OS_LF_ONLY 1 +#else +#define ACPI_SRC_OS_LF_ONLY 0 +#endif + /*! [Begin] no source code translation */ /****************************************************************************** diff --git a/sys/external/bsd/acpica/dist/include/platform/acfreebsd.h b/sys/external/bsd/acpica/dist/include/platform/acfreebsd.h index 40da5b0a177b..d49393890c83 100644 --- a/sys/external/bsd/acpica/dist/include/platform/acfreebsd.h +++ b/sys/external/bsd/acpica/dist/include/platform/acfreebsd.h @@ -95,6 +95,10 @@ #define DEBUGGER_THREADING 0 /* integrated with DDB */ +#ifdef INVARIANTS +#define ACPI_MUTEX_DEBUG +#endif + #else /* _KERNEL */ #if __STDC_HOSTED__ diff --git a/sys/external/bsd/acpica/dist/namespace/nsconvert.c b/sys/external/bsd/acpica/dist/namespace/nsconvert.c index a96ff5bd4d94..fe854747ce6b 100644 --- a/sys/external/bsd/acpica/dist/namespace/nsconvert.c +++ b/sys/external/bsd/acpica/dist/namespace/nsconvert.c @@ -562,5 +562,5 @@ AcpiNsConvertToReference ( ErrorExit: ACPI_FREE (Name); *ReturnObject = NewObject; - return (AE_OK); + return (Status); } diff --git a/sys/external/bsd/acpica/dist/os_specific/service_layers/oswinxf.c b/sys/external/bsd/acpica/dist/os_specific/service_layers/oswinxf.c index 636c1b802d2e..24dd682f0500 100644 --- a/sys/external/bsd/acpica/dist/os_specific/service_layers/oswinxf.c +++ b/sys/external/bsd/acpica/dist/os_specific/service_layers/oswinxf.c @@ -350,7 +350,7 @@ AcpiOsGetTimer ( { /* Convert milliseconds to 100 nanosecond ticks */ - return ((UINT64) GetTickCount() * ACPI_100NSEC_PER_MSEC); + return (GetTickCount64() * ACPI_100NSEC_PER_MSEC); } } diff --git a/sys/external/bsd/acpica/dist/parser/psobject.c b/sys/external/bsd/acpica/dist/parser/psobject.c index fb9652ec85a2..252c13fe5807 100644 --- a/sys/external/bsd/acpica/dist/parser/psobject.c +++ b/sys/external/bsd/acpica/dist/parser/psobject.c @@ -544,7 +544,7 @@ AcpiPsCompleteOp ( WalkState->Opcode = (*Op)->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, *Op, Status); + (void) AcpiPsNextParseState (WalkState, *Op, Status); Status2 = AcpiPsCompleteThisOp (WalkState, *Op); if (ACPI_FAILURE (Status2)) @@ -553,7 +553,6 @@ AcpiPsCompleteOp ( } } - Status = AE_OK; break; case AE_CTRL_BREAK: @@ -574,7 +573,7 @@ AcpiPsCompleteOp ( WalkState->Opcode = (*Op)->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, *Op, Status); + (void) AcpiPsNextParseState (WalkState, *Op, Status); Status2 = AcpiPsCompleteThisOp (WalkState, *Op); if (ACPI_FAILURE (Status2)) @@ -582,7 +581,6 @@ AcpiPsCompleteOp ( return_ACPI_STATUS (Status2); } - Status = AE_OK; break; case AE_CTRL_TERMINATE: diff --git a/sys/external/bsd/acpica/dist/resources/rscreate.c b/sys/external/bsd/acpica/dist/resources/rscreate.c index 5f8d5351abc4..67ae548d2a95 100644 --- a/sys/external/bsd/acpica/dist/resources/rscreate.c +++ b/sys/external/bsd/acpica/dist/resources/rscreate.c @@ -373,6 +373,10 @@ AcpiRsCreatePciRoutingTable ( Status = AcpiNsHandleToPathname ( (ACPI_HANDLE) Node, &PathBuffer, FALSE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* +1 to include null terminator */ diff --git a/sys/external/bsd/acpica/dist/tests/misc/badcode.asl b/sys/external/bsd/acpica/dist/tests/misc/badcode.asl index 996adfc74f3a..12de101b2026 100644 --- a/sys/external/bsd/acpica/dist/tests/misc/badcode.asl +++ b/sys/external/bsd/acpica/dist/tests/misc/badcode.asl @@ -11,7 +11,7 @@ * iasl badcode.asl * * Output: - * Compilation complete. 45 Errors, 22 Warnings, 3 Remarks, 16 Optimizations + * Compilation complete. 45 Errors, 28 Warnings, 11 Remarks, 14 Optimizations * */ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) diff --git a/sys/external/bsd/acpica/dist/tests/templates/Makefile b/sys/external/bsd/acpica/dist/tests/templates/Makefile index bc08d6342e2e..88c78244cfb3 100644 --- a/sys/external/bsd/acpica/dist/tests/templates/Makefile +++ b/sys/external/bsd/acpica/dist/tests/templates/Makefile @@ -1,5 +1,5 @@ # Before running this file, we assume we have generated all tables by running -# the command `iasl -T ALL` +# the command `$(ASL) -T ALL` # # Note: the NAME flag is required when running the test @@ -12,17 +12,17 @@ all: $(aml_obj2) # recompile and binary compare $(aml_obj2): %_recomp.aml: %.dsl - iasl -p `basename $@` $< > /dev/null 2> /dev/null - acpibin -c $@ $(patsubst %_recomp.aml,%.aml,$@) > /dev/null 2> /dev/null + $(ASL) -p `basename $@` $< > /dev/null 2> /dev/null + $(acpibin) -c $@ $(patsubst %_recomp.aml,%.aml,$@) > /dev/null 2> /dev/null printf "Data table %s PASS\n" $(basename $< .dsl) # disassemble $(dsl_obj): %.dsl: %.aml - iasl -d $< > /dev/null 2> /dev/null + $(ASL) -d $< > /dev/null 2> /dev/null # initial compile $(aml_obj): %.aml: %.asl - iasl $< > /dev/null 2> /dev/null + $(ASL) $< > /dev/null 2> /dev/null templates : diff --git a/sys/external/bsd/acpica/dist/tools/acpiexec/aecommon.h b/sys/external/bsd/acpica/dist/tools/acpiexec/aecommon.h index 7394a58fc480..eb6010e974b1 100644 --- a/sys/external/bsd/acpica/dist/tools/acpiexec/aecommon.h +++ b/sys/external/bsd/acpica/dist/tools/acpiexec/aecommon.h @@ -87,7 +87,8 @@ typedef struct ae_debug_regions typedef struct init_file_entry { char *Name; - UINT64 Value; + ACPI_OPERAND_OBJECT *ObjDesc; + } INIT_FILE_ENTRY; extern BOOLEAN AcpiGbl_UseLocalFaultHandler; @@ -248,7 +249,7 @@ AeSetupConfiguration ( ACPI_STATUS AeLookupInitFileEntry ( char *Pathname, - UINT64 *Value); + ACPI_OPERAND_OBJECT **ObjDesc); /* aeexec */ diff --git a/sys/external/bsd/acpica/dist/tools/acpiexec/aehandlers.c b/sys/external/bsd/acpica/dist/tools/acpiexec/aehandlers.c index a5d14d4a781b..3377e6b45ffb 100644 --- a/sys/external/bsd/acpica/dist/tools/acpiexec/aehandlers.c +++ b/sys/external/bsd/acpica/dist/tools/acpiexec/aehandlers.c @@ -575,20 +575,27 @@ AeInstallLateHandlers ( { Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); + Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler2); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); } Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle); @@ -596,9 +603,11 @@ AeInstallLateHandlers ( { Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); } #if (!ACPI_REDUCED_HARDWARE) @@ -747,13 +756,15 @@ AeInstallEarlyHandlers ( Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status); Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status); /* Attempt duplicate handler installation, should fail */ - Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, + (void) AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777)); Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); diff --git a/sys/external/bsd/acpica/dist/tools/acpiexec/aeinitfile.c b/sys/external/bsd/acpica/dist/tools/acpiexec/aeinitfile.c index 2f1295d96cb5..d65ba882e6bd 100644 --- a/sys/external/bsd/acpica/dist/tools/acpiexec/aeinitfile.c +++ b/sys/external/bsd/acpica/dist/tools/acpiexec/aeinitfile.c @@ -116,9 +116,13 @@ AeProcessInitFile( void) { ACPI_WALK_STATE *WalkState; - int i; UINT64 idx; ACPI_STATUS Status; + char *Token; + char *ObjectBuffer; + char *TempNameBuffer; + ACPI_OBJECT_TYPE Type; + ACPI_OBJECT TempObject; if (!InitFile) @@ -141,26 +145,44 @@ AeProcessInitFile( AcpiOsAllocate (sizeof (INIT_FILE_ENTRY) * AcpiGbl_InitFileLineCount); for (idx = 0; fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile); ++idx) { - if (sscanf (LineBuffer, "%s %s\n", - &NameBuffer[1], ValueBuffer) != 2) + + TempNameBuffer = AcpiDbGetNextToken (LineBuffer, &Token, &Type); + if (LineBuffer[0] == '\\') { - goto CleanupAndExit; + strcpy (NameBuffer, TempNameBuffer); } - - /* Add a root prefix if not present in the string */ - - i = 0; - if (NameBuffer[1] == '\\') + else { - i = 1; + /* Add a root prefix if not present in the string */ + + strcpy (NameBuffer + 1, TempNameBuffer); } AcpiGbl_InitEntries[idx].Name = - AcpiOsAllocateZeroed (strnlen (NameBuffer + i, AE_FILE_BUFFER_SIZE) + 1); + AcpiOsAllocateZeroed (strnlen (NameBuffer, AE_FILE_BUFFER_SIZE) + 1); - strcpy (AcpiGbl_InitEntries[idx].Name, NameBuffer + i); + strcpy (AcpiGbl_InitEntries[idx].Name, NameBuffer); + + ObjectBuffer = AcpiDbGetNextToken (Token, &Token, &Type); + + if (Type == ACPI_TYPE_FIELD_UNIT) + { + Status = AcpiDbConvertToObject (ACPI_TYPE_BUFFER, ObjectBuffer, + &TempObject); + } + else + { + Status = AcpiDbConvertToObject (Type, ObjectBuffer, &TempObject); + } + + Status = AcpiUtCopyEobjectToIobject (&TempObject, + &AcpiGbl_InitEntries[idx].ObjDesc); + + if (Type == ACPI_TYPE_BUFFER || Type == ACPI_TYPE_FIELD_UNIT) + { + ACPI_FREE (TempObject.Buffer.Pointer); + } - Status = AcpiUtStrtoul64 (ValueBuffer, &AcpiGbl_InitEntries[idx].Value); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("%s %s\n", ValueBuffer, @@ -168,7 +190,16 @@ AeProcessInitFile( goto CleanupAndExit; } - AeEnterInitFileEntry (AcpiGbl_InitEntries[idx], WalkState); + /* + * Special case for field units. Field units are dependent on the + * parent region. This parent region has yet to be created so defer the + * initialization until the dispatcher. For all other types, initialize + * the namespace node with the value found in the init file. + */ + if (Type != ACPI_TYPE_FIELD_UNIT) + { + AeEnterInitFileEntry (AcpiGbl_InitEntries[idx], WalkState); + } } /* Cleanup */ @@ -201,14 +232,12 @@ AeEnterInitFileEntry ( ACPI_WALK_STATE *WalkState) { char *Pathname = InitEntry.Name; - UINT64 Value = InitEntry.Value; - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *ObjDesc = InitEntry.ObjDesc; ACPI_NAMESPACE_NODE *NewNode; ACPI_STATUS Status; - AcpiOsPrintf ("Initializing namespace element: %s\n", Pathname); - Status = AcpiNsLookup (NULL, Pathname, ACPI_TYPE_INTEGER, + Status = AcpiNsLookup (NULL, Pathname, ObjDesc->Common.Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_ERROR_IF_FOUND | ACPI_NS_NO_UPSEARCH | ACPI_NS_EARLY_INIT, NULL, &NewNode); if (ACPI_FAILURE (Status)) @@ -219,15 +248,17 @@ AeEnterInitFileEntry ( return; } - ObjDesc = AcpiUtCreateIntegerObject (Value); - - AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Value)); - /* Store pointer to value descriptor in the Node */ Status = AcpiNsAttachObject (NewNode, ObjDesc, - ACPI_TYPE_INTEGER); + ObjDesc->Common.Type); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "While attaching object to node from namespace initialization file: %s", + Pathname)); + return; + } /* Remove local reference to the object */ @@ -251,7 +282,7 @@ AeEnterInitFileEntry ( ACPI_STATUS AeLookupInitFileEntry ( char *Pathname, - UINT64 *Value) + ACPI_OPERAND_OBJECT **ObjDesc) { UINT32 i; @@ -264,7 +295,7 @@ AeLookupInitFileEntry ( { if (!strcmp(AcpiGbl_InitEntries[i].Name, Pathname)) { - *Value = AcpiGbl_InitEntries[i].Value; + *ObjDesc = AcpiGbl_InitEntries[i].ObjDesc; return AE_OK; } } diff --git a/sys/external/bsd/acpica/dist/tools/acpiexec/aemain.c b/sys/external/bsd/acpica/dist/tools/acpiexec/aemain.c index 58640dd89646..040d1215c341 100644 --- a/sys/external/bsd/acpica/dist/tools/acpiexec/aemain.c +++ b/sys/external/bsd/acpica/dist/tools/acpiexec/aemain.c @@ -733,8 +733,8 @@ NormalExit: ErrorExit: AeLateTest (); + AcpiOsFree (AcpiGbl_InitEntries); (void) AcpiTerminate (); AcDeleteTableList (ListHead); - AcpiOsFree (AcpiGbl_InitEntries); return (ExitCode); } diff --git a/sys/external/bsd/acpica/dist/tools/acpiexec/aetests.c b/sys/external/bsd/acpica/dist/tools/acpiexec/aetests.c index 28d91fce22d9..c3c87a7801be 100644 --- a/sys/external/bsd/acpica/dist/tools/acpiexec/aetests.c +++ b/sys/external/bsd/acpica/dist/tools/acpiexec/aetests.c @@ -82,6 +82,7 @@ AeMiscellaneousTests ( ACPI_STATUS Status; ACPI_STATISTICS Stats; ACPI_HANDLE Handle; + UINT32 TableIndex; #if (!ACPI_REDUCED_HARDWARE) UINT32 Temp; @@ -110,18 +111,15 @@ AeMiscellaneousTests ( /* Load and unload SSDT4 */ - Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); + Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code, &TableIndex); ACPI_CHECK_OK (AcpiLoadTable, Status); - Status = AcpiGetHandle (NULL, "\\_T96", &Handle); - ACPI_CHECK_OK (AcpiGetHandle, Status); - - Status = AcpiUnloadParentTable (Handle); - ACPI_CHECK_OK (AcpiUnloadParentTable, Status); + Status = AcpiUnloadTable (TableIndex); + ACPI_CHECK_OK (AcpiUnloadTable, Status); /* Re-load SSDT4 */ - Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code); + Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code, NULL); ACPI_CHECK_OK (AcpiLoadTable, Status); /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */ @@ -132,12 +130,12 @@ AeMiscellaneousTests ( Status = AcpiUnloadParentTable (Handle); ACPI_CHECK_OK (AcpiUnloadParentTable, Status); - Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code); + Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code, NULL); ACPI_CHECK_OK (AcpiLoadTable, Status); /* Load OEM9 table (causes table override) */ - Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code); + Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code, NULL); ACPI_CHECK_OK (AcpiLoadTable, Status); } diff --git a/sys/external/bsd/acpica/dist/tools/acpihelp/ahdecode.c b/sys/external/bsd/acpica/dist/tools/acpihelp/ahdecode.c index 3b5a03bf139e..0ce521f08f46 100644 --- a/sys/external/bsd/acpica/dist/tools/acpihelp/ahdecode.c +++ b/sys/external/bsd/acpica/dist/tools/acpihelp/ahdecode.c @@ -194,7 +194,7 @@ AhFindPredefinedNames ( if (!NamePrefix || (*NamePrefix == '*')) { - Found = AhDisplayPredefinedName (NULL, 0); + (void) AhDisplayPredefinedName (NULL, 0); return; } diff --git a/sys/external/bsd/acpica/dist/tools/acpinames/anstubs.c b/sys/external/bsd/acpica/dist/tools/acpinames/anstubs.c index c140025d1a2d..e519a2f90c47 100644 --- a/sys/external/bsd/acpica/dist/tools/acpinames/anstubs.c +++ b/sys/external/bsd/acpica/dist/tools/acpinames/anstubs.c @@ -60,6 +60,8 @@ /* Utilities */ +#ifdef ACPI_OBSOLETE_FUNCTIONS + ACPI_STATUS AcpiUtCopyIobjectToEobject ( ACPI_OPERAND_OBJECT *Obj, @@ -93,6 +95,7 @@ AcpiUtCopyIobjectToIobject ( return (AE_NOT_IMPLEMENTED); } +#endif /* Hardware */ @@ -105,6 +108,8 @@ AcpiHwGetMode ( /* Event manager */ +#ifdef ACPI_OBSOLETE_FUNCTIONS + ACPI_STATUS AcpiEvInstallRegionHandlers ( void) @@ -125,6 +130,7 @@ AcpiEvInitializeRegion ( { return (AE_OK); } +#endif ACPI_STATUS AcpiEvInstallXruptHandlers ( @@ -143,6 +149,8 @@ AcpiEvInitializeEvents ( /* AML Interpreter */ +#ifdef ACPI_OBSOLETE_FUNCTIONS + ACPI_STATUS AcpiExReadDataFromField ( ACPI_WALK_STATE *WalkState, @@ -180,7 +188,6 @@ AcpiExStoreObjectToNode ( return (AE_NOT_IMPLEMENTED); } - /* Namespace manager */ ACPI_STATUS @@ -192,6 +199,7 @@ AcpiNsEvaluate ( return (AE_NOT_IMPLEMENTED); } +#endif void AcpiExDoDebugObject ( @@ -250,6 +258,8 @@ AcpiExTracePoint ( /* Dispatcher */ +#ifdef ACPI_OBSOLETE_FUNCTIONS + ACPI_STATUS AcpiDsAutoSerializeMethod ( ACPI_NAMESPACE_NODE *Node, @@ -328,6 +338,7 @@ AcpiDsGetPredicateValue ( return (AE_NOT_IMPLEMENTED); } +#endif ACPI_STATUS AcpiDsGetBufferFieldArguments ( @@ -364,6 +375,8 @@ AcpiDsGetPackageArguments ( return (AE_OK); } +#ifdef ACPI_OBSOLETE_FUNCTIONS + ACPI_STATUS AcpiDsExecBeginOp ( ACPI_WALK_STATE *WalkState, @@ -384,3 +397,4 @@ AcpiDsExecEndOp ( return (AE_NOT_IMPLEMENTED); } +#endif diff --git a/sys/external/bsd/acpica/dist/tools/acpisrc/asfile.c b/sys/external/bsd/acpica/dist/tools/acpisrc/asfile.c index 73539876b06f..82d22c3198db 100644 --- a/sys/external/bsd/acpica/dist/tools/acpisrc/asfile.c +++ b/sys/external/bsd/acpica/dist/tools/acpisrc/asfile.c @@ -438,7 +438,7 @@ AsConvertFile ( { /* Decode the function bitmap */ - switch ((1 << i) & Functions) + switch (((UINT32) 1 << i) & Functions) { case 0: diff --git a/sys/external/bsd/acpica/dist/tools/acpisrc/asmain.c b/sys/external/bsd/acpica/dist/tools/acpisrc/asmain.c index 0a2627c8b99b..ff8069a2a4ea 100644 --- a/sys/external/bsd/acpica/dist/tools/acpisrc/asmain.c +++ b/sys/external/bsd/acpica/dist/tools/acpisrc/asmain.c @@ -454,6 +454,13 @@ main ( ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; } + /* + * Set LF only support. Note ACPI_SRC_OS_LF_ONLY indicates that newlines + * are represented as LF only rather than CR/LF + */ + ConversionTable->Flags |= ACPI_SRC_OS_LF_ONLY; + Gbl_IgnoreLoneLineFeeds = ACPI_SRC_OS_LF_ONLY; + /* Check source and target paths and files */ if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) diff --git a/sys/external/bsd/acpica/dist/tools/acpisrc/asremove.c b/sys/external/bsd/acpica/dist/tools/acpisrc/asremove.c index ec4eba5ddb5e..712f3fa230a6 100644 --- a/sys/external/bsd/acpica/dist/tools/acpisrc/asremove.c +++ b/sys/external/bsd/acpica/dist/tools/acpisrc/asremove.c @@ -156,7 +156,6 @@ AsRemoveConditionalCompile ( KeywordLength = strlen (Keyword); - SubBuffer = Buffer; SubString = Buffer; while (SubString) @@ -293,7 +292,7 @@ AsRemoveConditionalCompile ( /* Remove the lines */ - SubBuffer = AsRemoveData (SubString, SubBuffer); + (void) AsRemoveData (SubString, SubBuffer); } } @@ -483,7 +482,7 @@ AsReduceTypedefs ( /* Remove the typedef itself */ SubBuffer = SubString + strlen ("typedef") + 1; - SubBuffer = AsRemoveData (SubString, SubBuffer); + (void) AsRemoveData (SubString, SubBuffer); /* Find the opening brace of the struct or union */ diff --git a/sys/external/bsd/acpica/dist/tools/acpisrc/astable.c b/sys/external/bsd/acpica/dist/tools/acpisrc/astable.c index 046eef55961a..52a59808230b 100644 --- a/sys/external/bsd/acpica/dist/tools/acpisrc/astable.c +++ b/sys/external/bsd/acpica/dist/tools/acpisrc/astable.c @@ -356,6 +356,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_RASF_PARAMETER_BLOCK", SRC_TYPE_STRUCT}, {"ACPI_RASF_PATROL_SCRUB_PARAMETER", SRC_TYPE_STRUCT}, {"ACPI_RASF_SHARED_MEMORY", SRC_TYPE_STRUCT}, + {"ACPI_REGION_WALK_INFO", SRC_TYPE_STRUCT}, {"ACPI_REPAIR_FUNCTION", SRC_TYPE_SIMPLE}, {"ACPI_REPAIR_INFO", SRC_TYPE_STRUCT}, {"ACPI_REG_WALK_INFO", SRC_TYPE_STRUCT}, diff --git a/sys/external/bsd/acpica/dist/utilities/utbuffer.c b/sys/external/bsd/acpica/dist/utilities/utbuffer.c index e1fdc01ed2e9..09d4bbe4c600 100644 --- a/sys/external/bsd/acpica/dist/utilities/utbuffer.c +++ b/sys/external/bsd/acpica/dist/utilities/utbuffer.c @@ -78,8 +78,10 @@ AcpiUtDumpBuffer ( UINT32 j; UINT32 Temp32; UINT8 BufChar; + UINT32 DisplayDataOnly = Display & DB_DISPLAY_DATA_ONLY; + Display &= ~DB_DISPLAY_DATA_ONLY; if (!Buffer) { AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); @@ -97,7 +99,10 @@ AcpiUtDumpBuffer ( { /* Print current offset */ - AcpiOsPrintf ("%8.4X: ", (BaseOffset + i)); + if (!DisplayDataOnly) + { + AcpiOsPrintf ("%8.4X: ", (BaseOffset + i)); + } /* Print 16 hex chars */ @@ -149,38 +154,41 @@ AcpiUtDumpBuffer ( * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ - AcpiOsPrintf (" "); - for (j = 0; j < 16; j++) + if (!DisplayDataOnly) { - if (i + j >= Count) + AcpiOsPrintf (" "); + for (j = 0; j < 16; j++) { - AcpiOsPrintf ("\n"); - return; + if (i + j >= Count) + { + AcpiOsPrintf ("\n"); + return; + } + + /* + * Add comment characters so rest of line is ignored when + * compiled + */ + if (j == 0) + { + AcpiOsPrintf ("// "); + } + + BufChar = Buffer[(ACPI_SIZE) i + j]; + if (isprint (BufChar)) + { + AcpiOsPrintf ("%c", BufChar); + } + else + { + AcpiOsPrintf ("."); + } } - /* - * Add comment characters so rest of line is ignored when - * compiled - */ - if (j == 0) - { - AcpiOsPrintf ("// "); - } + /* Done with that line. */ - BufChar = Buffer[(ACPI_SIZE) i + j]; - if (isprint (BufChar)) - { - AcpiOsPrintf ("%c", BufChar); - } - else - { - AcpiOsPrintf ("."); - } + AcpiOsPrintf ("\n"); } - - /* Done with that line. */ - - AcpiOsPrintf ("\n"); i += 16; }