diff options
author | jkim <jkim@FreeBSD.org> | 2012-11-20 21:01:59 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2012-11-20 21:01:59 +0000 |
commit | 3fd80a82666158c3a0cc79d8aeeecb24bd186c3a (patch) | |
tree | fa7a75101aa590769412545429cb755ccbff57f4 /sys/contrib | |
parent | 3c42bc6af3ec177b17f3bf185bf4a3c8ea62edcf (diff) | |
parent | 526bfcf905004d9b67338a445cb661a63c3de018 (diff) | |
download | FreeBSD-src-3fd80a82666158c3a0cc79d8aeeecb24bd186c3a.zip FreeBSD-src-3fd80a82666158c3a0cc79d8aeeecb24bd186c3a.tar.gz |
Merge ACPICA 20121114.
Diffstat (limited to 'sys/contrib')
44 files changed, 860 insertions, 502 deletions
diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 1aa5c8a..6374788 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,4 +1,94 @@ ---------------------------------------- +14 November 2012. Summary of changes for version 20121114: + +This release is available at https://www.acpica.org/downloads +The ACPI 5.0 specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +Implemented a performance enhancement for ACPI/AML Package objects. This +change greatly increases the performance of Package objects within the +interpreter. It changes the processing of reference counts for packages by +optimizing for the most common case where the package sub-objects are +either Integers, Strings, or Buffers. Increases the overall performance of +the ASLTS test suite by 1.5X (Increases the Slack Mode performance by 2X.) +Chao Guan. ACPICA BZ 943. + +Implemented and deployed common macros to extract flag bits from resource +descriptors. Improves readability and maintainability of the code. Fixes a +problem with the UART serial bus descriptor for the number of data bits +flags (was incorrectly 2 bits, should be 3). + +Enhanced the ACPI_GETx and ACPI_SETx macros. Improved the implementation +of the macros and changed the SETx macros to the style of (destination, +source). Also added ACPI_CASTx companion macros. Lv Zheng. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Previous Release: + Non-Debug Version: 93.9K Code, 25.2K Data, 119.1K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + Current Release: + Non-Debug Version: 94.3K Code, 25.3K Data, 119.6K Total + Debug Version: 175.5K Code, 74.5K Data, 250.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added the new ACPI 5.0 interrupt sharing flags. This change +adds the ShareAndWake and ExclusiveAndWake flags which were added to the +Irq, Interrupt, and Gpio resource descriptors in ACPI 5.0. ACPICA BZ 986. + +Disassembler: Fixed a problem with external declaration generation. Fixes +a problem where an incorrect pathname could be generated for an external +declaration if the original reference to the object includes leading +carats (^). ACPICA BZ 984. + +Debugger: Completed a major update for the Disassemble<method> command. +This command was out-of-date and did not properly disassemble control +methods that had any reasonable complexity. This fix brings the command up +to the same level as the rest of the disassembler. Adds one new file, +dmdeferred.c, which is existing code that is now common with the main +disassembler and the debugger disassemble command. ACPICA MZ 978. + +iASL: Moved the parser entry prototype to avoid a duplicate declaration. +Newer versions of Bison emit this prototype, so moved the prototype out of +the iASL header to where it is actually used in order to avoid a duplicate +declaration. + +iASL/Tools: Standardized use of the stream I/O functions: + 1) Ensure check for I/O error after every fopen/fread/fwrite + 2) Ensure proper order of size/count arguments for fread/fwrite + 3) Use test of (Actual != Requested) after all fwrite, and most fread + 4) Standardize I/O error messages +Improves reliability and maintainability of the code. Bob Moore, Lv Zheng. +ACPICA BZ 981. + +Disassembler: Prevent duplicate External() statements. During generation +of external statements, detect similar pathnames that are actually +duplicates such as these: + External (\ABCD) + External (ABCD) +Remove all leading '\' characters from pathnames during the external +statement generation so that duplicates will be detected and tossed. +ACPICA BZ 985. + +Tools: Replace low-level I/O with stream I/O functions. Replace +open/read/write/close with the stream I/O equivalents +fopen/fread/fwrite/fclose for portability and performance. Lv Zheng, Bob +Moore. + +AcpiBin: Fix for the dump-to-hex function. Now correctly output the table +name header so that AcpiXtract recognizes the output file/table. + +iASL: Remove obsolete -2 option flag. Originally intended to force the +compiler/disassembler into an ACPI 2.0 mode, this was never implemented +and the entire concept is now obsolete. + +---------------------------------------- 18 October 2012. Summary of changes for version 20121018: diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index 748fbb9..67d7b79 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -124,19 +124,24 @@ AdWriteBuffer ( char *Buffer, UINT32 Length) { - FILE *fp; + FILE *File; ACPI_SIZE Actual; - fp = fopen (Filename, "wb"); - if (!fp) + File = fopen (Filename, "wb"); + if (!File) { - printf ("Couldn't open %s\n", Filename); + printf ("Could not open file %s\n", Filename); return (-1); } - Actual = fwrite (Buffer, (size_t) Length, 1, fp); - fclose (fp); + Actual = fwrite (Buffer, 1, (size_t) Length, File); + if (Actual != Length) + { + printf ("Could not write to file %s\n", Filename); + } + + fclose (File); return ((INT32) Actual); } diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 5f8e11a..c63d9b5 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -88,17 +88,6 @@ AdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table); -static ACPI_STATUS -AdDeferredParse ( - ACPI_PARSE_OBJECT *Op, - UINT8 *Aml, - UINT32 AmlLength); - -static ACPI_STATUS -AdParseDeferredOps ( - ACPI_PARSE_OBJECT *Root); - - /* Stubs for ASL compiler */ #ifndef ACPI_ASL_COMPILER @@ -753,207 +742,6 @@ AdDisplayTables ( /****************************************************************************** * - * FUNCTION: AdDeferredParse - * - * PARAMETERS: Op - Root Op of the deferred opcode - * Aml - Pointer to the raw AML - * AmlLength - Length of the AML - * - * RETURN: Status - * - * DESCRIPTION: Parse one deferred opcode - * (Methods, operation regions, etc.) - * - *****************************************************************************/ - -static ACPI_STATUS -AdDeferredParse ( - ACPI_PARSE_OBJECT *Op, - UINT8 *Aml, - UINT32 AmlLength) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *SearchOp; - ACPI_PARSE_OBJECT *StartOp; - UINT32 BaseAmlOffset; - ACPI_PARSE_OBJECT *ExtraOp; - - - ACPI_FUNCTION_TRACE (AdDeferredParse); - - - fprintf (stderr, "."); - - if (!Aml || !AmlLength) - { - return_ACPI_STATUS (AE_OK); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n", - Op->Common.AmlOpName, (char *) &Op->Named.Name)); - - WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); - if (!WalkState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Parse the method */ - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; - Status = AcpiPsParseAml (WalkState); - - /* - * We need to update all of the Aml offsets, since the parser thought - * that the method began at offset zero. In reality, it began somewhere - * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that - * was just created and update the AmlOffset in each Op - */ - BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; - StartOp = (Op->Common.Value.Arg)->Common.Next; - SearchOp = StartOp; - - /* Walk the parse tree */ - - while (SearchOp) - { - SearchOp->Common.AmlOffset += BaseAmlOffset; - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - - /* - * Link the newly parsed subtree into the main parse tree - */ - switch (Op->Common.AmlOpcode) - { - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - switch (Op->Common.AmlOpcode) - { - case AML_PACKAGE_OP: - ExtraOp = Op->Common.Value.Arg; - ExtraOp = ExtraOp->Common.Next; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - - case AML_VAR_PACKAGE_OP: - case AML_BUFFER_OP: - default: - ExtraOp = Op->Common.Value.Arg; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - } - - /* Must point all parents to the main tree */ - - StartOp = Op; - SearchOp = StartOp; - while (SearchOp) - { - if (SearchOp->Common.Parent == ExtraOp) - { - SearchOp->Common.Parent = Op; - } - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - break; - - default: - break; - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AdParseDeferredOps - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.) - * - *****************************************************************************/ - -static ACPI_STATUS -AdParseDeferredOps ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_STATUS Status = AE_OK; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_NAME (AdParseDeferredOps); - fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - - while (Op) - { - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_DEFER)) - { - Op = AcpiPsGetDepthNext (Root, Op); - continue; - } - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - - case AML_REGION_OP: - case AML_DATA_REGION_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_FIELD_OP: - case AML_BANK_FIELD_OP: - - /* Nothing to do in these cases */ - - break; - - default: - ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]", - Op->Common.AmlOpName)); - break; - } - - Op = AcpiPsGetDepthNext (Root, Op); - } - - fprintf (stderr, "\n"); - return (Status); -} - - -/****************************************************************************** - * * FUNCTION: AdGetLocalTables * * PARAMETERS: Filename - Not used @@ -1191,7 +979,9 @@ AdParseTable ( /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ - Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot); + fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); + Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); + fprintf (stderr, "\n"); /* Process Resource Templates */ diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c index d0290c1..f5d676d 100644 --- a/sys/contrib/dev/acpica/common/dmextern.c +++ b/sys/contrib/dev/acpica/common/dmextern.c @@ -153,10 +153,17 @@ AcpiDmNormalizeParentPrefix ( char *Fullpath; char *ParentPath; ACPI_SIZE Length; + UINT32 Index = 0; - /* Search upwards in the parse tree until we reach a namespace node */ + if (!Op) + { + return (NULL); + } + + /* Search upwards in the parse tree until we reach the next namespace node */ + Op = Op->Common.Parent; while (Op) { if (Op->Common.Node) @@ -205,6 +212,13 @@ AcpiDmNormalizeParentPrefix ( * for the required dot separator (ParentPath.Path) */ Length++; + + /* For External() statements, we do not want a leading '\' */ + + if (*ParentPath == AML_ROOT_PREFIX) + { + Index = 1; + } } Fullpath = ACPI_ALLOCATE_ZEROED (Length); @@ -219,7 +233,7 @@ AcpiDmNormalizeParentPrefix ( * * Copy the parent path */ - ACPI_STRCAT (Fullpath, ParentPath); + ACPI_STRCPY (Fullpath, &ParentPath[Index]); /* * Add dot separator @@ -366,7 +380,22 @@ AcpiDmAddToExternalList ( return; } - /* Externalize the ACPI path */ + /* + * We don't want External() statements to contain a leading '\'. + * This prevents duplicate external statements of the form: + * + * External (\ABCD) + * External (ABCD) + * + * This would cause a compile time error when the disassembled + * output file is recompiled. + */ + if ((*Path == AML_ROOT_PREFIX) && (Path[1])) + { + Path++; + } + + /* Externalize the ACPI pathname */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, NULL, &ExternalPath); @@ -375,8 +404,10 @@ AcpiDmAddToExternalList ( return; } - /* Get the full pathname from root if "Path" has a parent prefix */ - + /* + * Get the full pathname from the root if "Path" has one or more + * parent prefixes (^). Note: path will not contain a leading '\'. + */ if (*Path == (UINT8) AML_PARENT_PREFIX) { Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath); diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index 583ac83..1e9bd88 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -625,7 +625,7 @@ AcpiGetTagPathname ( Aml = ACPI_CAST_PTR (AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]); - Status = AcpiUtValidateResource (Aml, &ResourceTableIndex); + Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex); if (ACPI_FAILURE (Status)) { return (NULL); @@ -938,7 +938,7 @@ AcpiDmFindResources ( * resource descriptors to the namespace, as children of the * buffer node. */ - if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op))) + if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (NULL, Op))) { Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op); @@ -991,7 +991,7 @@ AcpiDmAddResourcesToNamespace ( * Insert each resource into the namespace * NextOp contains the Aml pointer and the Aml length */ - AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data, + AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data, (ACPI_SIZE) NextOp->Common.Value.Integer, AcpiDmAddResourceToNamespace, BufferNode); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index 0c18d41..4ca98f6 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -50,6 +50,15 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslcompile") +/* + * Main parser entry + * External is here in case the parser emits the same external in the + * generated header. (Newer versions of Bison) + */ +int +AslCompilerparse( + void); + /* Local prototypes */ static void @@ -274,7 +283,7 @@ FlConsumeAnsiComment ( BOOLEAN ClosingComment = FALSE; - while (fread (&Byte, 1, 1, Handle)) + while (fread (&Byte, 1, 1, Handle) == 1) { /* Scan until comment close is found */ @@ -317,7 +326,7 @@ FlConsumeNewComment ( UINT8 Byte; - while (fread (&Byte, 1, 1, Handle)) + while (fread (&Byte, 1, 1, Handle) == 1) { Status->Offset++; @@ -368,7 +377,7 @@ FlCheckForAscii ( /* Read the entire file */ - while (fread (&Byte, 1, 1, Handle)) + while (fread (&Byte, 1, 1, Handle) == 1) { /* Ignore comment fields (allow non-ascii within) */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index d6a80c2..72c21ab 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -86,10 +86,6 @@ /* * Main ASL parser - generated from flex/bison, lex/yacc, etc. */ -int -AslCompilerparse( - void); - ACPI_PARSE_OBJECT * AslDoError ( void); diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 00b1fe4..41ae967 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -294,7 +294,7 @@ AePrintException ( else { RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) + if (RActual != 1) { fprintf (OutputFile, "[*** iASL: Read error on source code temp file %s ***]", @@ -304,8 +304,20 @@ AePrintException ( { while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256)) { - fwrite (&SourceByte, 1, 1, OutputFile); + if (fwrite (&SourceByte, 1, 1, OutputFile) != 1) + { + printf ("[*** iASL: Write error on output file ***]\n"); + return; + } + RActual = fread (&SourceByte, 1, 1, SourceFile); + if (RActual != 1) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + return; + } Total++; } diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 19b6980..39f64b7 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -143,15 +143,14 @@ FlOpenFile ( File = fopen (Filename, Mode); - - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = File; - if (!File) { FlFileError (FileId, ASL_MSG_OPEN); AslAbort (); } + + Gbl_Files[FileId].Filename = Filename; + Gbl_Files[FileId].Handle = File; } @@ -216,7 +215,7 @@ FlReadFile ( /* Read and check for error */ Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) + if (Actual < Length) { if (feof (Gbl_Files[FileId].Handle)) { @@ -659,16 +658,17 @@ FlOpenIncludeWithPrefix ( /* Attempt to open the file, push if successful */ IncludeFile = fopen (Pathname, "r"); - if (IncludeFile) + if (!IncludeFile) { - /* Push the include file on the open input file stack */ - - AslPushInputFileStack (IncludeFile, Pathname); - return (IncludeFile); + fprintf (stderr, "Could not open include file %s\n", Pathname); + ACPI_FREE (Pathname); + return (NULL); } - ACPI_FREE (Pathname); - return (NULL); + /* Push the include file on the open input file stack */ + + AslPushInputFileStack (IncludeFile, Pathname); + return (IncludeFile); } @@ -952,7 +952,7 @@ FlOpenMiscOutputFiles ( return (AE_OK); } - /* Create/Open a combined source output file */ + /* Create/Open a combined source output file */ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); if (!Filename) diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 987ed1c..101b23d 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -137,7 +137,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index 1c2fc15..9a85fd7 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -135,6 +135,10 @@ LsTreeWriteWalk ( UINT32 Level, void *Context); +static UINT32 +LsReadAmlOutputFile ( + UINT8 *Buffer); + /******************************************************************************* * @@ -1282,6 +1286,38 @@ LsDoHexOutput ( /******************************************************************************* * + * FUNCTION: LsReadAmlOutputFile + * + * PARAMETERS: Buffer - Where to return data + * + * RETURN: None. + * + * DESCRIPTION: Read a line of the AML output prior to formatting the data + * + ******************************************************************************/ + +static UINT32 +LsReadAmlOutputFile ( + UINT8 *Buffer) +{ + UINT32 Actual; + + + Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE, + Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + + if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)) + { + FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); + AslAbort (); + } + + return (Actual); +} + + +/******************************************************************************* + * * FUNCTION: LsDoHexOutputC * * PARAMETERS: None @@ -1319,8 +1355,7 @@ LsDoHexOutputC ( { /* Read enough bytes needed for one output line */ - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + LineLength = LsReadAmlOutputFile (FileData); if (!LineLength) { break; @@ -1407,8 +1442,7 @@ LsDoHexOutputAsl ( { /* Read enough bytes needed for one output line */ - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + LineLength = LsReadAmlOutputFile (FileData); if (!LineLength) { break; @@ -1494,8 +1528,7 @@ LsDoHexOutputAsm ( { /* Read enough bytes needed for one output line */ - LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + LineLength = LsReadAmlOutputFile (FileData); if (!LineLength) { break; diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index dcadc67..9af193b 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/compiler/asllookup.c @@ -329,16 +329,19 @@ LsDoOneNamespaceObject ( case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - if (Node->Flags & 0x80) + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, + " [Field Offset 0x%.4X Bits 0x%.4X Bytes] ", + Node->Value, Node->Value / 8); + + if (Node->Flags & ANOBJ_IS_REFERENCED) { FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bits 0x%.4X Bytes]", - Node->Value, Node->Value / 8); + "Referenced"); } else { FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, - " [Field Offset 0x%.4X Bytes]", Node->Value); + "Name not referenced"); } break; diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index ecefd08..3b6d45b 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -100,7 +100,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z" /******************************************************************************* @@ -171,7 +171,6 @@ Options ( ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution"); - ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); @@ -473,11 +472,6 @@ AslDoOptions ( break; - case '2': /* ACPI 2.0 compatibility mode */ - Gbl_Acpi2 = TRUE; - break; - - case 'b': /* Debug output options */ switch (AcpiGbl_Optarg[0]) { diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 06fe225..3d50a21 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -337,6 +337,13 @@ AslDoOneFile ( return (Status); } +#if 0 + /* TBD: Handle additional output files for disassembler */ + + Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); + LsDisplayNamespace (); +#endif + /* Shutdown compiler and ACPICA subsystem */ AeClearErrorLog (); diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index 9e02a87..fda712b 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -280,6 +280,7 @@ DtCreateOneTemplate ( char *DisasmFilename; FILE *File; ACPI_STATUS Status = AE_OK; + ACPI_SIZE Actual; /* New file will have a .asl suffix */ @@ -334,18 +335,32 @@ DtCreateOneTemplate ( } else { - /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */ + /* Special ACPI tables - DSDT, SSDT, FADT, RSDP */ AcpiOsPrintf (" */\n\n"); if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) { - fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File); + Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File); + if (Actual != sizeof (TemplateDsdt) -1) + { + fprintf (stderr, + "Could not write to output file %s\n", DisasmFilename); + Status = AE_ERROR; + goto Cleanup; + } } else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) { - fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File); + Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File); + if (Actual != sizeof (TemplateSsdt) -1) + { + fprintf (stderr, + "Could not write to output file %s\n", DisasmFilename); + Status = AE_ERROR; + goto Cleanup; + } } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) + else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */ { AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TemplateFacs)); @@ -359,7 +374,8 @@ DtCreateOneTemplate ( { fprintf (stderr, "%4.4s, Unrecognized ACPI table signature\n", Signature); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } } @@ -367,6 +383,7 @@ DtCreateOneTemplate ( "Created ACPI table template for [%4.4s], written to \"%s\"\n", Signature, DisasmFilename); +Cleanup: fclose (File); AcpiOsRedirectOutput (stdout); ACPI_FREE (DisasmFilename); diff --git a/sys/contrib/dev/acpica/compiler/prutils.c b/sys/contrib/dev/acpica/compiler/prutils.c index 2906d61..c8faeb6 100644 --- a/sys/contrib/dev/acpica/compiler/prutils.c +++ b/sys/contrib/dev/acpica/compiler/prutils.c @@ -337,16 +337,17 @@ PrOpenIncludeWithPrefix ( /* Attempt to open the file, push if successful */ IncludeFile = fopen (Pathname, "r"); - if (IncludeFile) + if (!IncludeFile) { - /* Push the include file on the open input file stack */ - - PrPushInputFileStack (IncludeFile, Pathname); - return (IncludeFile); + fprintf (stderr, "Could not open include file %s\n", Pathname); + ACPI_FREE (Pathname); + return (NULL); } - ACPI_FREE (Pathname); - return (NULL); + /* Push the include file on the open input file stack */ + + PrPushInputFileStack (IncludeFile, Pathname); + return (IncludeFile); } diff --git a/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index b5ba056..5c4b100 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -135,17 +135,16 @@ AcpiDbOpenDebugFile ( AcpiDbCloseDebugFile (); AcpiGbl_DebugFile = fopen (Name, "w+"); - if (AcpiGbl_DebugFile) - { - AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); - AcpiGbl_DbOutputToFile = TRUE; - } - else + if (!AcpiGbl_DebugFile) { AcpiOsPrintf ("Could not open debug file %s\n", Name); + return; } + AcpiOsPrintf ("Debug output file %s opened\n", Name); + ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); + AcpiGbl_DbOutputToFile = TRUE; + #endif } #endif @@ -288,7 +287,7 @@ AcpiDbReadTable ( { /* Read the table header */ - if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != + if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) != sizeof (ACPI_TABLE_HEADER)) { AcpiOsPrintf ("Could not read the table header\n"); @@ -387,7 +386,6 @@ AcpiDbReadTable ( AcpiOsFree (*Table); *Table = NULL; *TableLength = 0; - return (AE_ERROR); } @@ -485,15 +483,15 @@ AcpiDbReadTableFromFile ( char *Filename, ACPI_TABLE_HEADER **Table) { - FILE *fp; + FILE *File; UINT32 TableLength; ACPI_STATUS Status; /* Open the file */ - fp = fopen (Filename, "rb"); - if (!fp) + File = fopen (Filename, "rb"); + if (!File) { AcpiOsPrintf ("Could not open input file %s\n", Filename); return (AE_ERROR); @@ -502,8 +500,8 @@ AcpiDbReadTableFromFile ( /* Get the entire file */ fprintf (stderr, "Loading Acpi table from file %s\n", Filename); - Status = AcpiDbReadTable (fp, Table, &TableLength); - fclose(fp); + Status = AcpiDbReadTable (File, Table, &TableLength); + fclose(File); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index 2bef193..f5db216 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -100,6 +100,7 @@ enum AcpiExDebuggerCommands CMD_CLOSE, CMD_DEBUG, CMD_DISASSEMBLE, + CMD_DISASM, CMD_DUMP, CMD_ENABLEACPI, CMD_EVALUATE, @@ -170,6 +171,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"CLOSE", 0}, {"DEBUG", 1}, {"DISASSEMBLE", 1}, + {"DISASM", 1}, {"DUMP", 1}, {"ENABLEACPI", 0}, {"EVALUATE", 1}, @@ -796,6 +798,7 @@ AcpiDbCommandDispatch ( break; case CMD_DISASSEMBLE: + case CMD_DISASM: (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); break; diff --git a/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index eb265d3..ccfb7d5 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/components/debugger/dbmethod.c @@ -347,6 +347,13 @@ AcpiDbDisassembleMethod ( return (AE_BAD_PARAMETER); } + if (Method->Type != ACPI_TYPE_METHOD) + { + ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method", + Name, AcpiUtGetTypeName (Method->Type))); + return (AE_BAD_PARAMETER); + } + ObjDesc = Method->Object; Op = AcpiPsCreateScopeOp (); @@ -364,23 +371,48 @@ AcpiDbDisassembleMethod ( } Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); + WalkState->OwnerId = ObjDesc->Method.OwnerId; + + /* Push start scope on scope stack and make it current */ + + Status = AcpiDsScopeStackPush (Method, + Method->Type, WalkState); if (ACPI_FAILURE (Status)) { return (Status); } - /* Parse the AML */ + /* Parse the entire method AML including deferred operators */ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; + Status = AcpiPsParseAml (WalkState); + AcpiDmParseDeferredOps (Op); + /* Now we can disassemble the method */ + + AcpiGbl_DbOpt_verbose = FALSE; #ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (NULL, Op, 0); #endif + AcpiGbl_DbOpt_verbose = TRUE; + AcpiPsDeleteParseTree (Op); + + /* Method cleanup */ + + AcpiNsDeleteNamespaceSubtree (Method); + AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId); + AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c new file mode 100644 index 0000000..1e8c224 --- /dev/null +++ b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c @@ -0,0 +1,272 @@ +/****************************************************************************** + * + * Module Name: dmdeferred - Disassembly of deferred AML opcodes + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acdispat.h> +#include <contrib/dev/acpica/include/amlcode.h> +#include <contrib/dev/acpica/include/acdisasm.h> +#include <contrib/dev/acpica/include/acparser.h> + +#define _COMPONENT ACPI_CA_DISASSEMBLER + ACPI_MODULE_NAME ("dmdeferred") + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiDmDeferredParse ( + ACPI_PARSE_OBJECT *Op, + UINT8 *Aml, + UINT32 AmlLength); + + +/****************************************************************************** + * + * FUNCTION: AcpiDmParseDeferredOps + * + * PARAMETERS: Root - Root of the parse tree + * + * RETURN: Status + * + * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.) + * + *****************************************************************************/ + +ACPI_STATUS +AcpiDmParseDeferredOps ( + ACPI_PARSE_OBJECT *Root) +{ + const ACPI_OPCODE_INFO *OpInfo; + ACPI_PARSE_OBJECT *Op = Root; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (DmParseDeferredOps); + + + /* Traverse the entire parse tree */ + + while (Op) + { + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + if (!(OpInfo->Flags & AML_DEFER)) + { + Op = AcpiPsGetDepthNext (Root, Op); + continue; + } + + /* Now we know we have a deferred opcode */ + + switch (Op->Common.AmlOpcode) + { + case AML_METHOD_OP: + case AML_BUFFER_OP: + case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: + + Status = AcpiDmDeferredParse (Op, Op->Named.Data, Op->Named.Length); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + /* We don't need to do anything for these deferred opcodes */ + + case AML_REGION_OP: + case AML_DATA_REGION_OP: + case AML_CREATE_QWORD_FIELD_OP: + case AML_CREATE_DWORD_FIELD_OP: + case AML_CREATE_WORD_FIELD_OP: + case AML_CREATE_BYTE_FIELD_OP: + case AML_CREATE_BIT_FIELD_OP: + case AML_CREATE_FIELD_OP: + case AML_BANK_FIELD_OP: + + break; + + default: + ACPI_ERROR ((AE_INFO, "Unhandled deferred AML opcode [0x%.4X]", + Op->Common.AmlOpcode)); + break; + } + + Op = AcpiPsGetDepthNext (Root, Op); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiDmDeferredParse + * + * PARAMETERS: Op - Root Op of the deferred opcode + * Aml - Pointer to the raw AML + * AmlLength - Length of the AML + * + * RETURN: Status + * + * DESCRIPTION: Parse one deferred opcode + * (Methods, operation regions, etc.) + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiDmDeferredParse ( + ACPI_PARSE_OBJECT *Op, + UINT8 *Aml, + UINT32 AmlLength) +{ + ACPI_WALK_STATE *WalkState; + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *SearchOp; + ACPI_PARSE_OBJECT *StartOp; + UINT32 BaseAmlOffset; + ACPI_PARSE_OBJECT *NewRootOp; + ACPI_PARSE_OBJECT *ExtraOp; + + + ACPI_FUNCTION_TRACE (DmDeferredParse); + + + if (!Aml || !AmlLength) + { + return_ACPI_STATUS (AE_OK); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing deferred opcode %s [%4.4s]\n", + Op->Common.AmlOpName, (char *) &Op->Named.Name)); + + /* Need a new walk state to parse the AML */ + + WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, + AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Parse the AML for this deferred opcode */ + + WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; + WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; + Status = AcpiPsParseAml (WalkState); + + /* + * We need to update all of the AML offsets, since the parser thought + * that the method began at offset zero. In reality, it began somewhere + * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that + * was just created and update the AmlOffset in each Op. + */ + BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; + StartOp = (Op->Common.Value.Arg)->Common.Next; + SearchOp = StartOp; + + while (SearchOp) + { + SearchOp->Common.AmlOffset += BaseAmlOffset; + SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); + } + + /* + * For Buffer and Package opcodes, link the newly parsed subtree + * into the main parse tree + */ + switch (Op->Common.AmlOpcode) + { + case AML_BUFFER_OP: + case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: + + switch (Op->Common.AmlOpcode) + { + case AML_PACKAGE_OP: + + ExtraOp = Op->Common.Value.Arg; + NewRootOp = ExtraOp->Common.Next; + ACPI_FREE (ExtraOp); + break; + + case AML_VAR_PACKAGE_OP: + case AML_BUFFER_OP: + default: + + NewRootOp = Op->Common.Value.Arg; + break; + } + + Op->Common.Value.Arg = NewRootOp->Common.Value.Arg; + + /* Must point all parents to the main tree */ + + StartOp = Op; + SearchOp = StartOp; + while (SearchOp) + { + if (SearchOp->Common.Parent == NewRootOp) + { + SearchOp->Common.Parent = Op; + } + + SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); + } + + ACPI_FREE (NewRootOp); + break; + + default: + break; + } + + return_ACPI_STATUS (AE_OK); +} diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index c7dd29a..822a1a5 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -645,7 +645,7 @@ AcpiDmDisassembleOneOp ( */ if (!AcpiGbl_NoResourceDisassembly) { - Status = AcpiDmIsResourceTemplate (Op); + Status = AcpiDmIsResourceTemplate (WalkState, Op); if (ACPI_SUCCESS (Status)) { Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c index c3f8302..5217084 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c @@ -279,7 +279,7 @@ AcpiDmResourceTemplate ( /* Validate the Resource Type and Resource Length */ - Status = AcpiUtValidateResource (Aml, &ResourceIndex); + Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n", @@ -366,7 +366,8 @@ AcpiDmResourceTemplate ( * * FUNCTION: AcpiDmIsResourceTemplate * - * PARAMETERS: Op - Buffer Op to be examined + * PARAMETERS: WalkState - Current walk info + * Op - Buffer Op to be examined * * RETURN: Status. AE_OK if valid template * @@ -377,6 +378,7 @@ AcpiDmResourceTemplate ( ACPI_STATUS AcpiDmIsResourceTemplate ( + ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status; @@ -396,6 +398,12 @@ AcpiDmIsResourceTemplate ( /* Get the ByteData list and length */ NextOp = Op->Common.Value.Arg; + if (!NextOp) + { + AcpiOsPrintf ("NULL byte list in buffer\n"); + return (AE_TYPE); + } + NextOp = NextOp->Common.Next; if (!NextOp) { @@ -407,7 +415,7 @@ AcpiDmIsResourceTemplate ( /* Walk the byte list, abort on any invalid descriptor type or length */ - Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml); + Status = AcpiUtWalkAmlResources (WalkState, Aml, Length, NULL, &EndAml); if (ACPI_FAILURE (Status)) { return (AE_TYPE); diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c index 72a6e0f..700370f 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c @@ -318,7 +318,7 @@ AcpiDmAddressCommon ( /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */ - AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]); + AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]); /* Decode the general and type-specific flags */ @@ -331,7 +331,7 @@ AcpiDmAddressCommon ( AcpiDmIoFlags (Flags); if (ResourceType == ACPI_IO_RANGE) { - AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]); + AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]); } } } @@ -383,10 +383,10 @@ AcpiDmSpaceFlags ( { AcpiOsPrintf ("%s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]); + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)], + AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)], + AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)], + AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]); } @@ -407,10 +407,10 @@ AcpiDmIoFlags ( UINT8 Flags) { AcpiOsPrintf ("%s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1]); + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)], + AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)], + AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)], + AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]); } @@ -432,14 +432,14 @@ AcpiDmIoFlags2 ( { AcpiOsPrintf (", %s", - AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]); + AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]); /* TRS is only used if TTP is TypeTranslation */ if (SpecificFlags & 0x10) { AcpiOsPrintf (", %s", - AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]); + AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); } } @@ -464,12 +464,12 @@ AcpiDmMemoryFlags ( { AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,", - AcpiGbl_ConsumeDecode [(Flags & 1)], - AcpiGbl_DecDecode [(Flags & 0x2) >> 1], - AcpiGbl_MinDecode [(Flags & 0x4) >> 2], - AcpiGbl_MaxDecode [(Flags & 0x8) >> 3], - AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1], - AcpiGbl_RwDecode [(SpecificFlags & 0x1)]); + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)], + AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)], + AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)], + AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)], + AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)], + AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]); } @@ -491,8 +491,8 @@ AcpiDmMemoryFlags2 ( { AcpiOsPrintf (", %s, %s", - AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3], - AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]); + AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)], + AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); } @@ -767,7 +767,7 @@ AcpiDmMemory24Descriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("Memory24 (%s,\n", - AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]); + AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]); /* Dump the 4 contiguous WORD values */ @@ -806,7 +806,7 @@ AcpiDmMemory32Descriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("Memory32 (%s,\n", - AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]); + AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]); /* Dump the 4 contiguous DWORD values */ @@ -845,7 +845,7 @@ AcpiDmFixedMemory32Descriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("Memory32Fixed (%s,\n", - AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]); + AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]); AcpiDmIndent (Level + 1); AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base"); @@ -942,10 +942,10 @@ AcpiDmInterruptDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ", - AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)], - AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1], - AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1], - AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]); + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)], + AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)], + AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)], + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]); /* * The ResourceSource fields are optional and appear after the interrupt diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index 2881ba6..a3d046d 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -201,7 +201,7 @@ AcpiDmGpioCommon ( AcpiOsPrintf (", "); AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex); AcpiOsPrintf ("%s, ", - AcpiGbl_ConsumeDecode [(Resource->Gpio.Flags & 1)]); + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]); /* Insert a descriptor name */ @@ -273,9 +273,9 @@ AcpiDmGpioIntDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("GpioInt (%s, %s, %s, ", - AcpiGbl_HeDecode [(Resource->Gpio.IntFlags & 1)], - AcpiGbl_LlDecode [(Resource->Gpio.IntFlags >> 1) & 1], - AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]); + AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)], + AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Gpio.IntFlags, 1)], + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); /* PinConfig, DebounceTimeout */ @@ -306,7 +306,7 @@ AcpiDmGpioIntDescriptor ( * * RETURN: None * - * DESCRIPTION: Decode a GPIO Interrupt descriptor + * DESCRIPTION: Decode a GPIO I/O descriptor * ******************************************************************************/ @@ -323,7 +323,7 @@ AcpiDmGpioIoDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("GpioIo (%s, ", - AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]); + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); if (Resource->Gpio.PinConfig <= 3) { @@ -340,7 +340,7 @@ AcpiDmGpioIoDescriptor ( AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout); AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength); AcpiOsPrintf ("%s,\n", - AcpiGbl_IorDecode [Resource->Gpio.IntFlags & 3]); + AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]); /* Dump the GpioInt/GpioIo common portion of the descriptor */ @@ -480,12 +480,12 @@ AcpiDmI2cSerialBusDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n", Resource->I2cSerialBus.SlaveAddress, - AcpiGbl_SmDecode [(Resource->I2cSerialBus.Flags & 1)], + AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)], Resource->I2cSerialBus.ConnectionSpeed); AcpiDmIndent (Level + 1); AcpiOsPrintf ("%s, ", - AcpiGbl_AmDecode [(Resource->I2cSerialBus.TypeSpecificFlags & 1)]); + AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]); /* ResourceSource is a required field */ @@ -503,7 +503,7 @@ AcpiDmI2cSerialBusDescriptor ( AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex); AcpiOsPrintf ("%s, ", - AcpiGbl_ConsumeDecode [(Resource->I2cSerialBus.Flags >> 1) & 1]); + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]); /* Insert a descriptor name */ @@ -546,21 +546,21 @@ AcpiDmSpiSerialBusDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n", Resource->SpiSerialBus.DeviceSelection, - AcpiGbl_DpDecode [(Resource->SpiSerialBus.TypeSpecificFlags >> 1) & 1], - AcpiGbl_WmDecode [(Resource->SpiSerialBus.TypeSpecificFlags & 1)], + AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)], + AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)], Resource->SpiSerialBus.DataBitLength); /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */ AcpiDmIndent (Level + 1); AcpiOsPrintf ("%s, 0x%8.8X, %s,\n", - AcpiGbl_SmDecode [(Resource->SpiSerialBus.Flags & 1)], + AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)], Resource->SpiSerialBus.ConnectionSpeed, - AcpiGbl_CpoDecode [(Resource->SpiSerialBus.ClockPolarity & 1)]); + AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]); AcpiDmIndent (Level + 1); AcpiOsPrintf ("%s, ", - AcpiGbl_CphDecode [(Resource->SpiSerialBus.ClockPhase & 1)]); + AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]); /* ResourceSource is a required field */ @@ -578,7 +578,7 @@ AcpiDmSpiSerialBusDescriptor ( AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex); AcpiOsPrintf ("%s, ", - AcpiGbl_ConsumeDecode [(Resource->SpiSerialBus.Flags >> 1) & 1]); + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]); /* Insert a descriptor name */ @@ -621,17 +621,17 @@ AcpiDmUartSerialBusDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n", Resource->UartSerialBus.DefaultBaudRate, - AcpiGbl_BpbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 4) & 3], - AcpiGbl_SbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 2) & 3]); + AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)], + AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]); /* LinesInUse, IsBigEndian, Parity, FlowControl */ AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n", Resource->UartSerialBus.LinesEnabled, - AcpiGbl_EdDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 7) & 1], - AcpiGbl_PtDecode [Resource->UartSerialBus.Parity & 7], - AcpiGbl_FcDecode [Resource->UartSerialBus.TypeSpecificFlags & 3]); + AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)], + AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)], + AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]); /* ReceiveBufferSize, TransmitBufferSize */ @@ -656,7 +656,7 @@ AcpiDmUartSerialBusDescriptor ( AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex); AcpiOsPrintf ("%s, ", - AcpiGbl_ConsumeDecode [(Resource->UartSerialBus.Flags >> 1) & 1]); + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]); /* Insert a descriptor name */ diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c index cdc6dc7..7957920 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c @@ -76,16 +76,16 @@ AcpiDmIrqDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("%s (", - AcpiGbl_IrqDecode [Length & 1]); + AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]); /* Decode flags byte if present */ if (Length & 1) { AcpiOsPrintf ("%s, %s, %s, ", - AcpiGbl_HeDecode [Resource->Irq.Flags & 1], - AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1], - AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]); + AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Irq.Flags)], + AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Irq.Flags, 3)], + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Irq.Flags, 4)]); } /* Insert a descriptor name */ @@ -121,9 +121,9 @@ AcpiDmDmaDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("DMA (%s, %s, %s, ", - AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3], - AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1], - AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]); + AcpiGbl_TypDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Dma.Flags, 5)], + AcpiGbl_BmDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Dma.Flags, 2)], + AcpiGbl_SizDecode [ACPI_GET_2BIT_FLAG (Resource->Dma.Flags)]); /* Insert a descriptor name */ @@ -201,7 +201,7 @@ AcpiDmIoDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("IO (%s,\n", - AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]); + AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]); AcpiDmIndent (Level + 1); AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum"); @@ -287,8 +287,8 @@ AcpiDmStartDependentDescriptor ( if (Length & 1) { AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n", - (UINT32) Resource->StartDpf.Flags & 3, - (UINT32) (Resource->StartDpf.Flags >> 2) & 3); + (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags), + (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2)); } else { diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c index e8c0d1c..b3548e9 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c @@ -409,7 +409,8 @@ AcpiDsCallControlMethod ( Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); if (!Info) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup; } Info->Parameters = &ThisWalkState->Operands[0]; diff --git a/sys/contrib/dev/acpica/components/executer/exregion.c b/sys/contrib/dev/acpica/components/executer/exregion.c index 7e4b76f..abbbd84 100644 --- a/sys/contrib/dev/acpica/components/executer/exregion.c +++ b/sys/contrib/dev/acpica/components/executer/exregion.c @@ -257,19 +257,19 @@ AcpiExSystemMemorySpaceHandler ( switch (BitWidth) { case 8: - ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value; + ACPI_SET8 (LogicalAddrPtr, *Value); break; case 16: - ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value; + ACPI_SET16 (LogicalAddrPtr, *Value); break; case 32: - ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value; + ACPI_SET32 (LogicalAddrPtr, *Value); break; case 64: - ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value; + ACPI_SET64 (LogicalAddrPtr, *Value); break; default: diff --git a/sys/contrib/dev/acpica/components/namespace/nsutils.c b/sys/contrib/dev/acpica/components/namespace/nsutils.c index 410fe28..1003098 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/components/namespace/nsutils.c @@ -777,18 +777,18 @@ UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type) { - ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type)); + ACPI_FUNCTION_ENTRY (); - if (!AcpiUtValidObjectType (Type)) + if (Type > ACPI_TYPE_LOCAL_MAX) { /* type code out of range */ ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); - return_UINT32 (ACPI_NS_NORMAL); + return (ACPI_NS_NORMAL); } - return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); + return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); } diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfname.c b/sys/contrib/dev/acpica/components/namespace/nsxfname.c index be66384..a6e502b1 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfname.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfname.c @@ -325,7 +325,7 @@ AcpiGetObjectInfo ( Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return (Status); } Node = AcpiNsValidateHandle (Handle); diff --git a/sys/contrib/dev/acpica/components/resources/rscalc.c b/sys/contrib/dev/acpica/components/resources/rscalc.c index 3fa2c0f..3820aa0 100644 --- a/sys/contrib/dev/acpica/components/resources/rscalc.c +++ b/sys/contrib/dev/acpica/components/resources/rscalc.c @@ -430,7 +430,7 @@ AcpiRsGetListLength ( { /* Validate the Resource Type and Resource Length */ - Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex); + Status = AcpiUtValidateResource (NULL, AmlBuffer, &ResourceIndex); if (ACPI_FAILURE (Status)) { /* diff --git a/sys/contrib/dev/acpica/components/resources/rscreate.c b/sys/contrib/dev/acpica/components/resources/rscreate.c index 33d8860..87a9ecf 100644 --- a/sys/contrib/dev/acpica/components/resources/rscreate.c +++ b/sys/contrib/dev/acpica/components/resources/rscreate.c @@ -106,7 +106,7 @@ AcpiBufferToResource ( /* Perform the AML-to-Resource conversion */ - Status = AcpiUtWalkAmlResources (AmlBuffer, AmlBufferLength, + Status = AcpiUtWalkAmlResources (NULL, AmlBuffer, AmlBufferLength, AcpiRsConvertAmlToResources, &CurrentResourcePtr); if (Status == AE_AML_NO_RESOURCE_END_TAG) { @@ -192,7 +192,7 @@ AcpiRsCreateResourceList ( /* Do the conversion */ Resource = OutputBuffer->Pointer; - Status = AcpiUtWalkAmlResources (AmlStart, AmlBufferLength, + Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength, AcpiRsConvertAmlToResources, &Resource); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/components/resources/rsdump.c b/sys/contrib/dev/acpica/components/resources/rsdump.c index 648e157..acccad3 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/components/resources/rsdump.c @@ -139,7 +139,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} }; @@ -278,7 +278,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} @@ -301,7 +301,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharable", AcpiGbl_ShrDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode}, diff --git a/sys/contrib/dev/acpica/components/resources/rslist.c b/sys/contrib/dev/acpica/components/resources/rslist.c index 833216a..96b8c67 100644 --- a/sys/contrib/dev/acpica/components/resources/rslist.c +++ b/sys/contrib/dev/acpica/components/resources/rslist.c @@ -241,7 +241,7 @@ AcpiRsConvertResourcesToAml ( /* Perform final sanity check on the new AML resource descriptor */ - Status = AcpiUtValidateResource ( + Status = AcpiUtValidateResource (NULL, ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/components/resources/rsmisc.c b/sys/contrib/dev/acpica/components/resources/rsmisc.c index ac8f45f..733ac8f 100644 --- a/sys/contrib/dev/acpica/components/resources/rsmisc.c +++ b/sys/contrib/dev/acpica/components/resources/rsmisc.c @@ -152,8 +152,8 @@ AcpiRsConvertAmlToResource ( /* * Mask and shift the flag bit */ - ACPI_SET8 (Destination) = (UINT8) - ((ACPI_GET8 (Source) >> Info->Value) & 0x01); + ACPI_SET8 (Destination, + ((ACPI_GET8 (Source) >> Info->Value) & 0x01)); break; @@ -161,8 +161,8 @@ AcpiRsConvertAmlToResource ( /* * Mask and shift the flag bits */ - ACPI_SET8 (Destination) = (UINT8) - ((ACPI_GET8 (Source) >> Info->Value) & 0x03); + ACPI_SET8 (Destination, + ((ACPI_GET8 (Source) >> Info->Value) & 0x03)); break; @@ -170,15 +170,15 @@ AcpiRsConvertAmlToResource ( /* * Mask and shift the flag bits */ - ACPI_SET8 (Destination) = (UINT8) - ((ACPI_GET8 (Source) >> Info->Value) & 0x07); + ACPI_SET8 (Destination, + ((ACPI_GET8 (Source) >> Info->Value) & 0x07)); break; case ACPI_RSC_COUNT: ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination) = (UINT8) ItemCount; + ACPI_SET8 (Destination, ItemCount); Resource->Length = Resource->Length + (Info->Value * (ItemCount - 1)); @@ -188,7 +188,7 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_COUNT16: ItemCount = AmlResourceLength; - ACPI_SET16 (Destination) = ItemCount; + ACPI_SET16 (Destination, ItemCount); Resource->Length = Resource->Length + (Info->Value * (ItemCount - 1)); @@ -202,14 +202,14 @@ AcpiRsConvertAmlToResource ( Resource->Length = Resource->Length + ItemCount; ItemCount = ItemCount / 2; - ACPI_SET16 (Destination) = ItemCount; + ACPI_SET16 (Destination, ItemCount); break; case ACPI_RSC_COUNT_GPIO_VEN: ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination) = (UINT8) ItemCount; + ACPI_SET8 (Destination, ItemCount); Resource->Length = Resource->Length + (Info->Value * ItemCount); @@ -240,7 +240,7 @@ AcpiRsConvertAmlToResource ( } Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination) = ItemCount; + ACPI_SET16 (Destination, ItemCount); break; @@ -249,7 +249,7 @@ AcpiRsConvertAmlToResource ( ItemCount = ACPI_GET16 (Source) - Info->Value; Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination) = ItemCount; + ACPI_SET16 (Destination, ItemCount); break; @@ -260,7 +260,7 @@ AcpiRsConvertAmlToResource ( ACPI_GET16 (Source) - Info->Value; Resource->Length = Resource->Length + ItemCount; - ACPI_SET16 (Destination) = ItemCount; + ACPI_SET16 (Destination, ItemCount); break; @@ -406,7 +406,7 @@ AcpiRsConvertAmlToResource ( } Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_SET8 (Target) = (UINT8) ItemCount; + ACPI_SET8 (Target, ItemCount); break; @@ -423,7 +423,7 @@ AcpiRsConvertAmlToResource ( } Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_SET8 (Target) = (UINT8) ItemCount; + ACPI_SET8 (Target, ItemCount); break; @@ -547,7 +547,7 @@ AcpiRsConvertResourceToAml ( /* * Clear the flag byte */ - ACPI_SET8 (Destination) = 0; + ACPI_SET8 (Destination, 0); break; @@ -555,8 +555,8 @@ AcpiRsConvertResourceToAml ( /* * Mask and shift the flag bit */ - ACPI_SET8 (Destination) |= (UINT8) - ((ACPI_GET8 (Source) & 0x01) << Info->Value); + ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) + ((ACPI_GET8 (Source) & 0x01) << Info->Value)); break; @@ -564,8 +564,8 @@ AcpiRsConvertResourceToAml ( /* * Mask and shift the flag bits */ - ACPI_SET8 (Destination) |= (UINT8) - ((ACPI_GET8 (Source) & 0x03) << Info->Value); + ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) + ((ACPI_GET8 (Source) & 0x03) << Info->Value)); break; @@ -573,15 +573,15 @@ AcpiRsConvertResourceToAml ( /* * Mask and shift the flag bits */ - ACPI_SET8 (Destination) |= (UINT8) - ((ACPI_GET8 (Source) & 0x07) << Info->Value); + ACPI_SET_BIT (*ACPI_CAST8 (Destination), (UINT8) + ((ACPI_GET8 (Source) & 0x07) << Info->Value)); break; case ACPI_RSC_COUNT: ItemCount = ACPI_GET8 (Source); - ACPI_SET8 (Destination) = (UINT8) ItemCount; + ACPI_SET8 (Destination, ItemCount); AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1))); break; @@ -598,11 +598,11 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_COUNT_GPIO_PIN: ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination) = (UINT16) AmlLength; + ACPI_SET16 (Destination, AmlLength); AmlLength = (UINT16) (AmlLength + ItemCount * 2); Target = ACPI_ADD_PTR (void, Aml, Info->Value); - ACPI_SET16 (Target) = (UINT16) AmlLength; + ACPI_SET16 (Target, AmlLength); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -610,7 +610,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_COUNT_GPIO_VEN: ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination) = (UINT16) ItemCount; + ACPI_SET16 (Destination, ItemCount); AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount)); AcpiRsSetResourceLength (AmlLength, Aml); @@ -622,7 +622,7 @@ AcpiRsConvertResourceToAml ( /* Set resource source string length */ ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination) = (UINT16) AmlLength; + ACPI_SET16 (Destination, AmlLength); /* Compute offset for the Vendor Data */ @@ -633,7 +633,7 @@ AcpiRsConvertResourceToAml ( if (Resource->Data.Gpio.VendorLength) { - ACPI_SET16 (Target) = (UINT16) AmlLength; + ACPI_SET16 (Target, AmlLength); } AcpiRsSetResourceLength (AmlLength, Aml); @@ -643,7 +643,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_COUNT_SERIAL_VEN: ItemCount = ACPI_GET16 (Source); - ACPI_SET16 (Destination) = ItemCount + Info->Value; + ACPI_SET16 (Destination, ItemCount + Info->Value); AmlLength = (UINT16) (AmlLength + ItemCount); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -746,9 +746,9 @@ AcpiRsConvertResourceToAml ( /* * 8-bit encoded bitmask (DMA macro) */ - ACPI_SET8 (Destination) = (UINT8) + ACPI_SET8 (Destination, AcpiRsEncodeBitmask (Source, - *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); + *ACPI_ADD_PTR (UINT8, Resource, Info->Value))); break; diff --git a/sys/contrib/dev/acpica/components/resources/rsxface.c b/sys/contrib/dev/acpica/components/resources/rsxface.c index 152f79d..9251aec 100644 --- a/sys/contrib/dev/acpica/components/resources/rsxface.c +++ b/sys/contrib/dev/acpica/components/resources/rsxface.c @@ -679,7 +679,7 @@ AcpiWalkResources ( /* Get the next resource descriptor */ - Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length); + Resource = ACPI_NEXT_RESOURCE (Resource); } ACPI_FREE (Buffer.Pointer); diff --git a/sys/contrib/dev/acpica/components/utilities/utdelete.c b/sys/contrib/dev/acpica/components/utilities/utdelete.c index 4a5e6ecf..77dbe1b 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/components/utilities/utdelete.c @@ -368,7 +368,7 @@ AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **InternalObj; - ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList); + ACPI_FUNCTION_NAME (UtDeleteInternalObjectList); /* Walk the null-terminated internal list */ @@ -381,7 +381,7 @@ AcpiUtDeleteInternalObjectList ( /* Free the combined parameter pointer list and object array */ ACPI_FREE (ObjList); - return_VOID; + return; } @@ -528,7 +528,7 @@ AcpiUtUpdateObjectReference ( UINT32 i; - ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object); + ACPI_FUNCTION_NAME (UtUpdateObjectReference); while (Object) @@ -539,7 +539,7 @@ AcpiUtUpdateObjectReference ( { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object)); - return_ACPI_STATUS (AE_OK); + return (AE_OK); } /* @@ -577,17 +577,43 @@ AcpiUtUpdateObjectReference ( for (i = 0; i < Object->Package.Count; i++) { /* - * Push each element onto the stack for later processing. - * Note: There can be null elements within the package, - * these are simply ignored + * Null package elements are legal and can be simply + * ignored. */ - Status = AcpiUtCreateUpdateStateAndPush ( - Object->Package.Elements[i], Action, &StateList); - if (ACPI_FAILURE (Status)) + NextObject = Object->Package.Elements[i]; + if (!NextObject) + { + continue; + } + + switch (NextObject->Common.Type) { - goto ErrorExit; + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + /* + * For these very simple sub-objects, we can just + * update the reference count here and continue. + * Greatly increases performance of this operation. + */ + AcpiUtUpdateRefCount (NextObject, Action); + break; + + default: + /* + * For complex sub-objects, push them onto the stack + * for later processing (this eliminates recursion.) + */ + Status = AcpiUtCreateUpdateStateAndPush ( + NextObject, Action, &StateList); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + break; } } + NextObject = NULL; break; case ACPI_TYPE_BUFFER_FIELD: @@ -663,7 +689,7 @@ AcpiUtUpdateObjectReference ( } } - return_ACPI_STATUS (AE_OK); + return (AE_OK); ErrorExit: @@ -679,7 +705,7 @@ ErrorExit: AcpiUtDeleteGenericState (State); } - return_ACPI_STATUS (Status); + return (Status); } @@ -701,14 +727,14 @@ AcpiUtAddReference ( ACPI_OPERAND_OBJECT *Object) { - ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object); + ACPI_FUNCTION_NAME (UtAddReference); /* Ensure that we have a valid object */ if (!AcpiUtValidInternalObject (Object)) { - return_VOID; + return; } ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, @@ -718,7 +744,7 @@ AcpiUtAddReference ( /* Increment the reference count */ (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); - return_VOID; + return; } @@ -739,7 +765,7 @@ AcpiUtRemoveReference ( ACPI_OPERAND_OBJECT *Object) { - ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object); + ACPI_FUNCTION_NAME (UtRemoveReference); /* @@ -751,14 +777,14 @@ AcpiUtRemoveReference ( (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)) { - return_VOID; + return; } /* Ensure that we have a valid object */ if (!AcpiUtValidInternalObject (Object)) { - return_VOID; + return; } ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, @@ -771,5 +797,5 @@ AcpiUtRemoveReference ( * of all subobjects!) */ (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); - return_VOID; + return; } diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c index a97863f..08b8550 100644 --- a/sys/contrib/dev/acpica/components/utilities/utresrc.c +++ b/sys/contrib/dev/acpica/components/utilities/utresrc.c @@ -148,7 +148,9 @@ const char *AcpiGbl_RwDecode[] = const char *AcpiGbl_ShrDecode[] = { "Exclusive", - "Shared" + "Shared", + "ExclusiveAndWake", /* ACPI 5.0 */ + "SharedAndWake" /* ACPI 5.0 */ }; const char *AcpiGbl_SizDecode[] = @@ -429,27 +431,17 @@ static const UINT8 AcpiGbl_ResourceTypes[] = ACPI_VARIABLE_LENGTH /* 0E *SerialBus */ }; -/* - * For the iASL compiler/disassembler, we don't want any error messages - * because the disassembler uses the resource validation code to determine - * if Buffer objects are actually Resource Templates. - */ -#ifdef ACPI_ASL_COMPILER -#define ACPI_RESOURCE_ERROR(plist) -#else -#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist) -#endif - /******************************************************************************* * * FUNCTION: AcpiUtWalkAmlResources * - * PARAMETERS: Aml - Pointer to the raw AML resource template - * AmlLength - Length of the entire template - * UserFunction - Called once for each descriptor found. If - * NULL, a pointer to the EndTag is returned - * Context - Passed to UserFunction + * PARAMETERS: WalkState - Current walk info + * PARAMETERS: Aml - Pointer to the raw AML resource template + * AmlLength - Length of the entire template + * UserFunction - Called once for each descriptor found. If + * NULL, a pointer to the EndTag is returned + * Context - Passed to UserFunction * * RETURN: Status * @@ -460,6 +452,7 @@ static const UINT8 AcpiGbl_ResourceTypes[] = ACPI_STATUS AcpiUtWalkAmlResources ( + ACPI_WALK_STATE *WalkState, UINT8 *Aml, ACPI_SIZE AmlLength, ACPI_WALK_AML_CALLBACK UserFunction, @@ -493,7 +486,7 @@ AcpiUtWalkAmlResources ( { /* Validate the Resource Type and Resource Length */ - Status = AcpiUtValidateResource (Aml, &ResourceIndex); + Status = AcpiUtValidateResource (WalkState, Aml, &ResourceIndex); if (ACPI_FAILURE (Status)) { /* @@ -553,7 +546,7 @@ AcpiUtWalkAmlResources ( { /* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */ - (void) AcpiUtValidateResource (EndTag, &ResourceIndex); + (void) AcpiUtValidateResource (WalkState, EndTag, &ResourceIndex); Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { @@ -569,9 +562,10 @@ AcpiUtWalkAmlResources ( * * FUNCTION: AcpiUtValidateResource * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * ReturnIndex - Where the resource index is returned. NULL - * if the index is not required. + * PARAMETERS: WalkState - Current walk info + * Aml - Pointer to the raw AML resource descriptor + * ReturnIndex - Where the resource index is returned. NULL + * if the index is not required. * * RETURN: Status, and optionally the Index into the global resource tables * @@ -583,6 +577,7 @@ AcpiUtWalkAmlResources ( ACPI_STATUS AcpiUtValidateResource ( + ACPI_WALK_STATE *WalkState, void *Aml, UINT8 *ReturnIndex) { @@ -696,9 +691,12 @@ AcpiUtValidateResource ( if ((AmlResource->CommonSerialBus.Type == 0) || (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) { - ACPI_RESOURCE_ERROR ((AE_INFO, - "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", - AmlResource->CommonSerialBus.Type)); + if (WalkState) + { + ACPI_ERROR ((AE_INFO, + "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", + AmlResource->CommonSerialBus.Type)); + } return (AE_AML_INVALID_RESOURCE_TYPE); } } @@ -715,17 +713,23 @@ AcpiUtValidateResource ( InvalidResource: - ACPI_RESOURCE_ERROR ((AE_INFO, - "Invalid/unsupported resource descriptor: Type 0x%2.2X", - ResourceType)); + if (WalkState) + { + ACPI_ERROR ((AE_INFO, + "Invalid/unsupported resource descriptor: Type 0x%2.2X", + ResourceType)); + } return (AE_AML_INVALID_RESOURCE_TYPE); BadResourceLength: - ACPI_RESOURCE_ERROR ((AE_INFO, - "Invalid resource descriptor length: Type " - "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", - ResourceType, ResourceLength, MinimumResourceLength)); + if (WalkState) + { + ACPI_ERROR ((AE_INFO, + "Invalid resource descriptor length: Type " + "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", + ResourceType, ResourceLength, MinimumResourceLength)); + } return (AE_AML_BAD_RESOURCE_LENGTH); } @@ -914,7 +918,7 @@ AcpiUtGetResourceEndTag ( /* Validate the template and get a pointer to the EndTag */ - Status = AcpiUtWalkAmlResources (ObjDesc->Buffer.Pointer, + Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, NULL, EndTag); return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c index 9bf74c4..8edb9cd 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstate.c +++ b/sys/contrib/dev/acpica/components/utilities/utstate.c @@ -107,15 +107,14 @@ AcpiUtPushGenericState ( ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State) { - ACPI_FUNCTION_TRACE (UtPushGenericState); + ACPI_FUNCTION_ENTRY (); /* Push the state object onto the front of the list (stack) */ State->Common.Next = *ListHead; *ListHead = State; - - return_VOID; + return; } @@ -138,7 +137,7 @@ AcpiUtPopGenericState ( ACPI_GENERIC_STATE *State; - ACPI_FUNCTION_TRACE (UtPopGenericState); + ACPI_FUNCTION_ENTRY (); /* Remove the state object at the head of the list (stack) */ @@ -151,7 +150,7 @@ AcpiUtPopGenericState ( *ListHead = State->Common.Next; } - return_PTR (State); + return (State); } @@ -209,7 +208,7 @@ AcpiUtCreateThreadState ( ACPI_GENERIC_STATE *State; - ACPI_FUNCTION_TRACE (UtCreateThreadState); + ACPI_FUNCTION_ENTRY (); /* Create the generic state object */ @@ -217,7 +216,7 @@ AcpiUtCreateThreadState ( State = AcpiUtCreateGenericState (); if (!State) { - return_PTR (NULL); + return (NULL); } /* Init fields specific to the update struct */ @@ -233,7 +232,7 @@ AcpiUtCreateThreadState ( State->Thread.ThreadId = (ACPI_THREAD_ID) 1; } - return_PTR ((ACPI_THREAD_STATE *) State); + return ((ACPI_THREAD_STATE *) State); } @@ -260,7 +259,7 @@ AcpiUtCreateUpdateState ( ACPI_GENERIC_STATE *State; - ACPI_FUNCTION_TRACE_PTR (UtCreateUpdateState, Object); + ACPI_FUNCTION_ENTRY (); /* Create the generic state object */ @@ -268,7 +267,7 @@ AcpiUtCreateUpdateState ( State = AcpiUtCreateGenericState (); if (!State) { - return_PTR (NULL); + return (NULL); } /* Init fields specific to the update struct */ @@ -276,8 +275,7 @@ AcpiUtCreateUpdateState ( State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE; State->Update.Object = Object; State->Update.Value = Action; - - return_PTR (State); + return (State); } @@ -303,7 +301,7 @@ AcpiUtCreatePkgState ( ACPI_GENERIC_STATE *State; - ACPI_FUNCTION_TRACE_PTR (UtCreatePkgState, InternalObject); + ACPI_FUNCTION_ENTRY (); /* Create the generic state object */ @@ -311,7 +309,7 @@ AcpiUtCreatePkgState ( State = AcpiUtCreateGenericState (); if (!State) { - return_PTR (NULL); + return (NULL); } /* Init fields specific to the update struct */ @@ -321,8 +319,7 @@ AcpiUtCreatePkgState ( State->Pkg.DestObject = ExternalObject; State->Pkg.Index= Index; State->Pkg.NumPackages = 1; - - return_PTR (State); + return (State); } @@ -346,7 +343,7 @@ AcpiUtCreateControlState ( ACPI_GENERIC_STATE *State; - ACPI_FUNCTION_TRACE (UtCreateControlState); + ACPI_FUNCTION_ENTRY (); /* Create the generic state object */ @@ -354,15 +351,14 @@ AcpiUtCreateControlState ( State = AcpiUtCreateGenericState (); if (!State) { - return_PTR (NULL); + return (NULL); } /* Init fields specific to the control struct */ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL; State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; - - return_PTR (State); + return (State); } @@ -383,7 +379,7 @@ void AcpiUtDeleteGenericState ( ACPI_GENERIC_STATE *State) { - ACPI_FUNCTION_TRACE (UtDeleteGenericState); + ACPI_FUNCTION_ENTRY (); /* Ignore null state */ @@ -392,5 +388,5 @@ AcpiUtDeleteGenericState ( { (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State); } - return_VOID; + return; } diff --git a/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c index d7a38ab..76b5bb3 100644 --- a/sys/contrib/dev/acpica/components/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c @@ -490,12 +490,12 @@ AcpiUtRemoveAllocation ( ACPI_STATUS Status; - ACPI_FUNCTION_TRACE (UtRemoveAllocation); + ACPI_FUNCTION_NAME (UtRemoveAllocation); if (AcpiGbl_DisableMemTracking) { - return_ACPI_STATUS (AE_OK); + return (AE_OK); } MemList = AcpiGbl_GlobalList; @@ -506,13 +506,13 @@ AcpiUtRemoveAllocation ( ACPI_ERROR ((Module, Line, "Empty allocation list, nothing to free!")); - return_ACPI_STATUS (AE_OK); + return (AE_OK); } Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + return (Status); } /* Unlink */ @@ -531,15 +531,15 @@ AcpiUtRemoveAllocation ( (Allocation->Next)->Previous = Allocation->Previous; } + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n", + &Allocation->UserSpace, Allocation->Size)); + /* Mark the segment as deleted */ ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", - Allocation->Size)); - Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (Status); + return (Status); } diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 31499b1..20e056a 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -634,9 +634,16 @@ AcpiDmIsPldBuffer ( /* - * dmextern + * dmdeferred */ +ACPI_STATUS +AcpiDmParseDeferredOps ( + ACPI_PARSE_OBJECT *Root); + +/* + * dmextern + */ ACPI_STATUS AcpiDmAddToExternalFileList ( char *PathList); @@ -701,6 +708,7 @@ AcpiDmResourceTemplate ( ACPI_STATUS AcpiDmIsResourceTemplate ( + ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op); void diff --git a/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index 8a0e384..9b44671 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -50,14 +50,18 @@ * get into potential aligment issues -- see the STORE macros below. * Use with care. */ -#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr) -#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr) -#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr) -#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr) -#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr) -#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr) -#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr) -#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr) +#define ACPI_CAST8(ptr) ACPI_CAST_PTR (UINT8, (ptr)) +#define ACPI_CAST16(ptr) ACPI_CAST_PTR (UINT16, (ptr)) +#define ACPI_CAST32(ptr) ACPI_CAST_PTR (UINT32, (ptr)) +#define ACPI_CAST64(ptr) ACPI_CAST_PTR (UINT64, (ptr)) +#define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr)) +#define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr)) +#define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr)) +#define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr)) +#define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (UINT8) (val)) +#define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (UINT16) (val)) +#define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (UINT32) (val)) +#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val)) /* * printf() format helpers @@ -296,6 +300,20 @@ #define ACPI_16BIT_MASK 0x0000FFFF #define ACPI_24BIT_MASK 0x00FFFFFF +/* Macros to extract flag bits from position zero */ + +#define ACPI_GET_1BIT_FLAG(Value) ((Value) & ACPI_1BIT_MASK) +#define ACPI_GET_2BIT_FLAG(Value) ((Value) & ACPI_2BIT_MASK) +#define ACPI_GET_3BIT_FLAG(Value) ((Value) & ACPI_3BIT_MASK) +#define ACPI_GET_4BIT_FLAG(Value) ((Value) & ACPI_4BIT_MASK) + +/* Macros to extract flag bits from position one and above */ + +#define ACPI_EXTRACT_1BIT_FLAG(Field, Position) (ACPI_GET_1BIT_FLAG ((Field) >> Position)) +#define ACPI_EXTRACT_2BIT_FLAG(Field, Position) (ACPI_GET_2BIT_FLAG ((Field) >> Position)) +#define ACPI_EXTRACT_3BIT_FLAG(Field, Position) (ACPI_GET_3BIT_FLAG ((Field) >> Position)) +#define ACPI_EXTRACT_4BIT_FLAG(Field, Position) (ACPI_GET_4BIT_FLAG ((Field) >> Position)) + /* * An object of type ACPI_NAMESPACE_NODE can appear in some contexts * where a pointer to an object of type ACPI_OPERAND_OBJECT can also diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 879e348..086e2d3 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20121018 +#define ACPI_CA_VERSION 0x20121114 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/include/actypes.h> diff --git a/sys/contrib/dev/acpica/include/acrestyp.h b/sys/contrib/dev/acpica/include/acrestyp.h index c2ce4f08..07a6076 100644 --- a/sys/contrib/dev/acpica/include/acrestyp.h +++ b/sys/contrib/dev/acpica/include/acrestyp.h @@ -675,7 +675,10 @@ typedef struct acpi_resource #define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type)) -#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length) +/* Macro for walking resource templates with multiple descriptors */ + +#define ACPI_NEXT_RESOURCE(Res) \ + ACPI_ADD_PTR (ACPI_RESOURCE, (Res), (Res)->Length) typedef struct acpi_pci_routing_table diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index 2391260..f663a1e 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -803,6 +803,7 @@ AcpiUtDisplayInitPathname ( */ ACPI_STATUS AcpiUtWalkAmlResources ( + ACPI_WALK_STATE *WalkState, UINT8 *Aml, ACPI_SIZE AmlLength, ACPI_WALK_AML_CALLBACK UserFunction, @@ -810,6 +811,7 @@ AcpiUtWalkAmlResources ( ACPI_STATUS AcpiUtValidateResource ( + ACPI_WALK_STATE *WalkState, void *Aml, UINT8 *ReturnIndex); |