diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2012-11-14 22:20:16 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2012-11-14 22:20:16 +0000 |
commit | c2463a8709e5b3a5ce54c09d35b4820a756b0fc5 (patch) | |
tree | 2ffc551e57f0545a17c165d729c1438a26236f60 /source/components | |
parent | 31aa864e8c068201d58aad3a8f82ddb51df11015 (diff) |
Notes
Diffstat (limited to 'source/components')
23 files changed, 553 insertions, 212 deletions
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index 7b0870d1c9910..4a0fe00347027 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/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/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index a431ddcba5091..d9c01c8c4ab31 100644 --- a/source/components/debugger/dbinput.c +++ b/source/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/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index 5335611278f78..c3266c51e2599 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -345,6 +345,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 (); @@ -362,21 +369,47 @@ 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 = TRUE; + AcpiGbl_DbOpt_verbose = FALSE; AcpiDmDisassemble (NULL, Op, 0); + AcpiGbl_DbOpt_verbose = TRUE; + AcpiPsDeleteParseTree (Op); + + /* Method cleanup */ + + AcpiNsDeleteNamespaceSubtree (Method); + AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId); + AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); return (AE_OK); } diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c new file mode 100644 index 0000000000000..a3f40aee9b1ab --- /dev/null +++ b/source/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 "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "amlcode.h" +#include "acdisasm.h" +#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/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 9d61b02579063..443ef089e90b3 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/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/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index 470be9505090d..bf2a4d4da496e 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/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/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index ed78b31c707bc..dfd8e781bdaaa 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/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/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index afa1f5c400838..0615f5c399c53 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/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/source/components/disassembler/dmresrcs.c b/source/components/disassembler/dmresrcs.c index d3b1dd8dce9de..60eb558259a3e 100644 --- a/source/components/disassembler/dmresrcs.c +++ b/source/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/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 4f7901070282e..97d52b87f4ebe 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/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/source/components/executer/exregion.c b/source/components/executer/exregion.c index f3120465be492..a64645dfbba09 100644 --- a/source/components/executer/exregion.c +++ b/source/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/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 6370dab2a693c..68a3f9c2a6222 100644 --- a/source/components/namespace/nsutils.c +++ b/source/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/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 1d5aeecb940b6..8b4d686065dfc 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/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/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 12af85ea30ced..06426670e6b6e 100644 --- a/source/components/resources/rscalc.c +++ b/source/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/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 4c444cedd60d2..afac008cb4d43 100644 --- a/source/components/resources/rscreate.c +++ b/source/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/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 6e2013253e716..8ac320c781516 100644 --- a/source/components/resources/rsdump.c +++ b/source/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/source/components/resources/rslist.c b/source/components/resources/rslist.c index c5aeb1b91797a..a4f1daee1d3bb 100644 --- a/source/components/resources/rslist.c +++ b/source/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/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 673492887d70c..10afe4d0fe2fc 100644 --- a/source/components/resources/rsmisc.c +++ b/source/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/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index d8c3938b31bc7..8ff94db1ba00f 100644 --- a/source/components/resources/rsxface.c +++ b/source/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/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 4ed6297627683..d526e0d27891f 100644 --- a/source/components/utilities/utdelete.c +++ b/source/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/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index a1a6c5bfbcc3d..0caec2033d752 100644 --- a/source/components/utilities/utresrc.c +++ b/source/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/source/components/utilities/utstate.c b/source/components/utilities/utstate.c index f144bca2fde4e..7ce39e7c9b1a4 100644 --- a/source/components/utilities/utstate.c +++ b/source/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/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 2e37aebba1e21..b995db4fe24ee 100644 --- a/source/components/utilities/uttrack.c +++ b/source/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); } |