diff options
Diffstat (limited to 'source/components')
43 files changed, 2494 insertions, 818 deletions
diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 83af8896598ae..0a00be81e0ba0 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -314,6 +314,18 @@ AcpiDbExecuteMethod ( if (ACPI_FAILURE (Status)) { + if ((Status == AE_ABORT_METHOD) || AcpiGbl_AbortMethod) + { + /* Clear the abort and fall back to the debugger prompt */ + + ACPI_EXCEPTION ((AE_INFO, Status, + "Aborting top-level method")); + + AcpiGbl_AbortMethod = FALSE; + Status = AE_OK; + goto Cleanup; + } + ACPI_EXCEPTION ((AE_INFO, Status, "while executing %s from debugger", Info->Pathname)); diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index 81f6b6e86e08c..66906ef84196b 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -588,7 +588,7 @@ AcpiDbDecodeLocals ( if (DisplayLocals) { - AcpiOsPrintf ("\nInitialized Local Variables for method [%4.4s]:\n", + AcpiOsPrintf ("\nInitialized Local Variables for Method [%4.4s]:\n", AcpiUtGetNodeName (Node)); for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) @@ -604,7 +604,7 @@ AcpiDbDecodeLocals ( else { AcpiOsPrintf ( - "No Local Variables are initialized for method [%4.4s]\n", + "No Local Variables are initialized for Method [%4.4s]\n", AcpiUtGetNodeName (Node)); } } @@ -667,7 +667,7 @@ AcpiDbDecodeArguments ( AcpiOsPrintf ( "Initialized Arguments for Method [%4.4s]: " "(%X arguments defined for method invocation)\n", - AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount); + AcpiUtGetNodeName (Node), Node->Object->Method.ParamCount); for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 02c4e5dbb9d2e..bfa7d7c7882d4 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -379,7 +379,7 @@ AcpiDbSingleStep ( if ((AcpiGbl_DbOutputToFile) || (AcpiDbgLevel & ACPI_LV_PARSE)) { - AcpiOsPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n"); + AcpiOsPrintf ("\nAML Debug: Next AML Opcode to execute:\n"); } /* diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 75cc09632134c..27ea16b46e952 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -261,7 +261,7 @@ AcpiDmDisasmByteList ( /* Dump the ASCII equivalents within a comment */ - AcpiOsPrintf (" /* "); + AcpiOsPrintf (" // "); for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++) { CurrentIndex = i + j; @@ -283,7 +283,7 @@ AcpiDmDisasmByteList ( /* Finished with this line */ - AcpiOsPrintf (" */\n"); + AcpiOsPrintf ("\n"); } } diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c index 8123e2524a776..0368b0a6c8eda 100644 --- a/source/components/disassembler/dmdeferred.c +++ b/source/components/disassembler/dmdeferred.c @@ -190,7 +190,7 @@ AcpiDmParseDeferredOps ( ACPI_STATUS Status; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_TRACE (DmParseDeferredOps); /* Traverse the entire parse tree */ @@ -217,7 +217,7 @@ AcpiDmParseDeferredOps ( Op, Op->Named.Data, Op->Named.Length); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } break; @@ -245,7 +245,7 @@ AcpiDmParseDeferredOps ( Op = AcpiPsGetDepthNext (Root, Op); } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index af1f96447c481..8d9b532a795e7 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -177,15 +177,6 @@ static void AcpiDmPromoteSubtree ( ACPI_PARSE_OBJECT *StartOp); -static BOOLEAN -AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op, - char *Temp); - -static BOOLEAN -AcpiDmIsCaseBlock ( - ACPI_PARSE_OBJECT *Op); - /******************************************************************************* * * FUNCTION: AcpiDmDisplayTargetPathname @@ -1127,9 +1118,7 @@ AcpiDmDisassembleOneOp ( if (AcpiGbl_DmEmitExternalOpcodes) { - AcpiDmEmitExternal (AcpiPsGetArg(Op, 0), - AcpiPsGetArg(Op, 1)); - break; + AcpiDmEmitExternal (Op, AcpiPsGetArg(Op, 0)); } break; @@ -1367,414 +1356,3 @@ AcpiDmPromoteSubtree ( Op = Op->Common.Next; } } - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsTempName - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: TRUE if object is a temporary (_T_x) name for a matching While - * loop that can be converted to a Switch. - * - * DESCRIPTION: _T_X objects are only used for Switch statements. If a temporary - * name exists, search the siblings for a matching While (One) loop - * that can be converted to a Switch. Return TRUE if a match was - * found, FALSE otherwise. - * - ******************************************************************************/ - -BOOLEAN -AcpiDmIsTempName ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *CurrentOp; - char *Temp; - - if (Op->Common.AmlOpcode != AML_NAME_OP) - { - return (FALSE); - } - - Temp = (char *)(Op->Common.Aml); - ++Temp; - - if (strncmp(Temp, "_T_", 3)) - { - return (FALSE); - } - - CurrentOp = Op->Common.Next; - while (CurrentOp) - { - if (CurrentOp->Common.AmlOpcode == AML_WHILE_OP && - AcpiDmIsSwitchBlock(CurrentOp, Temp)) - { - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - CurrentOp->Common.DisasmOpcode = ACPI_DASM_SWITCH; - - return (TRUE); - } - CurrentOp = CurrentOp->Common.Next; - } - - return (FALSE); -} - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsSwitchBlock - * - * PARAMETERS: Op - While Object - * - * RETURN: TRUE if While block can be converted to a Switch/Case block - * - * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies - * parse tree to allow for Switch/Case disassembly during walk. - * - * EXAMPLE: Example of parse tree to be converted - * - * While - * One - * Store - * ByteConst - * -NamePath- - * If - * LEqual - * -NamePath- - * Zero - * Return - * One - * Else - * Return - * WordConst - * Break - * - ******************************************************************************/ - -static BOOLEAN -AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op, - char *Temp) -{ - ACPI_PARSE_OBJECT *OneOp; - ACPI_PARSE_OBJECT *StoreOp; - ACPI_PARSE_OBJECT *NamePathOp; - ACPI_PARSE_OBJECT *PredicateOp; - ACPI_PARSE_OBJECT *CurrentOp; - ACPI_PARSE_OBJECT *TempOp; - - /* Check for One Op Predicate */ - - OneOp = AcpiPsGetArg (Op, 0); - if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP)) - { - return (FALSE); - } - - /* Check for Store Op */ - - StoreOp = OneOp->Common.Next; - if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP)) - { - return (FALSE); - } - - /* Check for Name Op with _T_ string */ - - NamePathOp = AcpiPsGetArg (StoreOp, 1); - if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) - { - return (FALSE); - } - - if (strncmp((char *)(NamePathOp->Common.Aml), Temp, 4)) - { - return (FALSE); - } - - /* This is a Switch/Case control block */ - - /* Ignore the One Op Predicate */ - - OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - /* Ignore the Store Op, but not the children */ - - StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; - - /* - * First arg of Store Op is the Switch condition. - * Mark it as a Switch predicate and as a parameter list for paren - * closing and correct indentation. - */ - PredicateOp = AcpiPsGetArg (StoreOp, 0); - PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - /* Ignore the Name Op */ - - NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; - - /* Remaining opcodes are the Case statements (If/ElseIf's) */ - - CurrentOp = StoreOp->Common.Next; - while (AcpiDmIsCaseBlock (CurrentOp)) - { - /* Block is a Case structure */ - - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - /* ElseIf */ - - CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - } - - /* If */ - - CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; - - /* - * Mark the parse tree for Case disassembly. There are two - * types of Case statements. The first type of statement begins with - * an LEqual. The second starts with an LNot and uses a Match statement - * on a Package of constants. - */ - TempOp = AcpiPsGetArg (CurrentOp, 0); - switch (TempOp->Common.AmlOpcode) - { - case (AML_LOGICAL_EQUAL_OP): - - /* Ignore just the LEqual Op */ - - TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; - - /* Ignore the NamePath Op */ - - TempOp = AcpiPsGetArg (TempOp, 0); - TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; - - /* - * Second arg of LEqual will be the Case predicate. - * Mark it as a predicate and also as a parameter list for paren - * closing and correct indentation. - */ - PredicateOp = TempOp->Common.Next; - PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - break; - - case (AML_LOGICAL_NOT_OP): - - /* - * The Package will be the predicate of the Case statement. - * It's under: - * LNOT - * LEQUAL - * MATCH - * PACKAGE - */ - - /* Get the LEqual Op from LNot */ - - TempOp = AcpiPsGetArg (TempOp, 0); - - /* Get the Match Op from LEqual */ - - TempOp = AcpiPsGetArg (TempOp, 0); - - /* Get the Package Op from Match */ - - PredicateOp = AcpiPsGetArg (TempOp, 0); - - /* Mark as parameter list for paren closing */ - - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - /* - * The Package list would be too deeply indented if we - * chose to simply ignore the all the parent opcodes, so - * we rearrange the parse tree instead. - */ - - /* - * Save the second arg of the If/Else Op which is the - * block code of code for this Case statement. - */ - TempOp = AcpiPsGetArg (CurrentOp, 1); - - /* - * Move the Package Op to the child (predicate) of the - * Case statement. - */ - CurrentOp->Common.Value.Arg = PredicateOp; - PredicateOp->Common.Parent = CurrentOp; - - /* Add the block code */ - - PredicateOp->Common.Next = TempOp; - - break; - - default: - - /* Should never get here */ - - break; - } - - /* Advance to next Case block */ - - CurrentOp = CurrentOp->Common.Next; - } - - /* If CurrentOp is now an Else, then this is a Default block */ - - if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT; - } - - /* - * From the first If advance to the Break op. It's possible to - * have an Else (Default) op here when there is only one Case - * statement, so check for it. - */ - CurrentOp = StoreOp->Common.Next->Common.Next; - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp = CurrentOp->Common.Next; - } - - /* Ignore the Break Op */ - - CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsCaseBlock - * - * PARAMETERS: Op - Object to test - * - * RETURN: TRUE if Object is beginning of a Case block. - * - * DESCRIPTION: Determines if an Object is the beginning of a Case block for a - * Switch/Case statement. Parse tree must be one of the following - * forms: - * - * Else (Optional) - * If - * LEqual - * -NamePath- _T_x - * - * Else (Optional) - * If - * LNot - * LEqual - * Match - * Package - * ByteConst - * -NamePath- _T_x - * - ******************************************************************************/ - -static BOOLEAN -AcpiDmIsCaseBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *CurrentOp; - - if (!Op) - { - return (FALSE); - } - - /* Look for an If or ElseIf */ - - CurrentOp = Op; - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp) - { - return (FALSE); - } - } - - if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP) - { - return (FALSE); - } - - /* Child must be LEqual or LNot */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp) - { - return (FALSE); - } - - switch (CurrentOp->Common.AmlOpcode) - { - case (AML_LOGICAL_EQUAL_OP): - - /* Next child must be NamePath with string _T_ */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || !CurrentOp->Common.Value.Name || - strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) - { - return (FALSE); - } - - break; - - case (AML_LOGICAL_NOT_OP): - - /* Child of LNot must be LEqual op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LOGICAL_EQUAL_OP)) - { - return (FALSE); - } - - /* Child of LNot must be Match op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP)) - { - return (FALSE); - } - - /* First child of Match must be Package op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP)) - { - return (FALSE); - } - - /* Third child of Match must be NamePath with string _T_ */ - - CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2); - if (!CurrentOp || !CurrentOp->Common.Value.Name || - strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) - { - return (FALSE); - } - - break; - - default: - - return (FALSE); - } - - return (TRUE); -} diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index bd8aa2dc62d3b..3c24855f97713 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -197,8 +197,12 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ AcpiDmExtendedDescriptor, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ AcpiDmGpioDescriptor, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ - NULL, /* 0x0D, Reserved */ - AcpiDmSerialBusDescriptor /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */ + AcpiDmPinFunctionDescriptor, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ + AcpiDmSerialBusDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */ + AcpiDmPinConfigDescriptor, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ + AcpiDmPinGroupDescriptor, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ + AcpiDmPinGroupFunctionDescriptor, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ + AcpiDmPinGroupConfigDescriptor, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ }; @@ -540,6 +544,15 @@ AcpiDmIsResourceTemplate ( * intialization byte list. Because the resource macros will create * a buffer of the exact required length (buffer length will be equal * to the actual length). + * + * NOTE (April 2017): Resource templates with this issue have been + * seen in the field. We still don't want to attempt to disassemble + * a buffer like this to a resource template because this output + * would not match the original input buffer (it would be shorter + * than the original when the disassembled code is recompiled). + * Basically, a buffer like this appears to be hand crafted in the + * first place, so just emitting a buffer object instead of a + * resource template more closely resembles the original ASL code. */ if (DeclaredBufferLength != BufferLength) { diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index 0c2c3360c2142..68737545c34c1 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -515,6 +515,112 @@ AcpiDmGpioDescriptor ( } } +/******************************************************************************* + * + * FUNCTION: AcpiDmPinFunctionDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinFunction descriptor + * + ******************************************************************************/ + +void +AcpiDmPinFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT16 *PinList; + UINT8 *VendorData; + char *DeviceName = NULL; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinFunction (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]); + + if (Resource->PinFunction.PinConfig <= 3) + { + AcpiOsPrintf ("%s, ", + AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]); + } + else + { + AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig); + } + + /* FunctionNumber */ + + AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber); + + if (Resource->PinFunction.ResSourceOffset) + { + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinFunction.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + } + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex); + + AcpiDmIndent (Level + 1); + + /* Always ResourceConsumer */ + AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinFunction.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinFunction.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinFunction.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset - + Resource->PinFunction.PinTableOffset)) / + sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinFunction.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + /******************************************************************************* * @@ -848,3 +954,363 @@ AcpiDmSerialBusDescriptor ( SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( Info, Resource, Length, Level); } + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinConfig + * + * PARAMETERS: PinConfigType - Pin configuration type + * PinConfigValue - Pin configuration value + * + * RETURN: None + * + * DESCRIPTION: Pretty prints PinConfig type and value. + * + ******************************************************************************/ + +static void +AcpiDmPinConfig( + UINT8 PinConfigType, + UINT32 PinConfigValue) +{ + if (PinConfigType <= 13) + { + AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType, + AcpiGbl_PtypDecode[PinConfigType]); + } + else + { + AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType); + } + + /* PinConfigValue */ + + AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinConfigDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinConfig descriptor + * + ******************************************************************************/ + +void +AcpiDmPinConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT16 *PinList; + UINT8 *VendorData; + char *DeviceName = NULL; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinConfig (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]); + + AcpiDmPinConfig (Resource->PinConfig.PinConfigType, + Resource->PinConfig.PinConfigValue); + + AcpiDmIndent (Level + 1); + + if (Resource->PinConfig.ResSourceOffset) + { + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinConfig.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + } + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinConfig.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinConfig.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinConfig.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset - + Resource->PinConfig.PinTableOffset)) / + sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinConfig.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroup descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + char *Label; + UINT16 *PinList; + UINT8 *VendorData; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + /* Always producer */ + AcpiOsPrintf ("PinGroup ("); + + Label = ACPI_ADD_PTR (char, + Resource, Resource->PinGroup.LabelOffset), + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroup.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroup.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroup.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = (Resource->PinGroup.LabelOffset - + Resource->PinGroup.PinTableOffset) / sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinGroup.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupFunctionDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroupFunction descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT8 *VendorData; + char *DeviceName = NULL; + char *Label = NULL; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinGroupFunction (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]); + + /* FunctionNumber */ + + AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber); + + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinGroupFunction.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex); + + AcpiDmIndent (Level + 1); + + Label = ACPI_ADD_PTR (char, Resource, + Resource->PinGroupFunction.ResSourceLabelOffset); + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroupFunction.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroupFunction.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroupFunction.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupConfigDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroupConfig descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT8 *VendorData; + char *DeviceName = NULL; + char *Label = NULL; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinGroupConfig (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]); + + AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType, + Resource->PinGroupConfig.PinConfigValue); + + AcpiDmIndent (Level + 1); + + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinGroupConfig.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex); + + Label = ACPI_ADD_PTR (char, Resource, + Resource->PinGroupConfig.ResSourceLabelOffset); + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroupConfig.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroupConfig.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroupConfig.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); +} diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 77d24a18e99cf..750e639898aa1 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -161,8 +161,6 @@ ACPI_MODULE_NAME ("dmwalk") -#define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: " - /* Stub for non-compiler code */ #ifndef ACPI_ASL_COMPILER @@ -584,13 +582,6 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } - if (AcpiDmIsTempName(Op)) - { - /* Ignore compiler generated temporary names */ - - return (AE_CTRL_DEPTH); - } - if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE) { /* Ignore this op, but not it's children */ @@ -642,10 +633,16 @@ AcpiDmDescendingOp ( Info->WalkState->ParserState.AmlStart); if (AcpiGbl_DmOpt_Verbose) { - AcpiOsPrintf (DB_FULL_OP_INFO, - (Info->WalkState->MethodNode ? - Info->WalkState->MethodNode->Name.Ascii : " "), - AmlOffset, (UINT32) Op->Common.AmlOpcode); + if (AcpiGbl_CmSingleStep) + { + AcpiOsPrintf ("%5.5X/%4.4X: ", + AmlOffset, (UINT32) Op->Common.AmlOpcode); + } + else + { + AcpiOsPrintf ("AML Offset %5.5X, Opcode %4.4X: ", + AmlOffset, (UINT32) Op->Common.AmlOpcode); + } } } @@ -782,7 +779,7 @@ AcpiDmDescendingOp ( Name = AcpiPsGetName (Op); if (Op->Named.Path) { - AcpiDmNamestring ((char *) Op->Named.Path); + AcpiDmNamestring (Op->Named.Path); } else { diff --git a/source/components/dispatcher/dsargs.c b/source/components/dispatcher/dsargs.c index 6a79c7cb09b2b..504005b30aca3 100644 --- a/source/components/dispatcher/dsargs.c +++ b/source/components/dispatcher/dsargs.c @@ -197,7 +197,7 @@ AcpiDsExecuteArguments ( ACPI_WALK_STATE *WalkState; - ACPI_FUNCTION_TRACE (DsExecuteArguments); + ACPI_FUNCTION_TRACE_PTR (DsExecuteArguments, AmlStart); /* Allocate a new parser op to be the root of the parsed tree */ @@ -474,7 +474,8 @@ AcpiDsGetPackageArguments ( return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n", + ObjDesc->Package.AmlStart)); /* Execute the AML code for the TermArg arguments */ diff --git a/source/components/dispatcher/dsdebug.c b/source/components/dispatcher/dsdebug.c index ceb6b8a51b70a..4a0696a3632b7 100644 --- a/source/components/dispatcher/dsdebug.c +++ b/source/components/dispatcher/dsdebug.c @@ -320,6 +320,7 @@ AcpiDsDumpMethodStack ( Op->Common.Next = NULL; #ifdef ACPI_DISASSEMBLER + AcpiOsPrintf ("Failed at "); AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); #endif Op->Common.Next = Next; diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index d3588f5aaf164..79dff2c766cbe 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -333,6 +333,7 @@ AcpiDsMethodError ( ACPI_WALK_STATE *WalkState) { UINT32 AmlOffset; + ACPI_NAME Name = 0; ACPI_FUNCTION_ENTRY (); @@ -361,9 +362,16 @@ AcpiDsMethodError ( AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, WalkState->ParserState.AmlStart); - Status = AcpiGbl_ExceptionHandler (Status, - WalkState->MethodNode ? - WalkState->MethodNode->Name.Integer : 0, + if (WalkState->MethodNode) + { + Name = WalkState->MethodNode->Name.Integer; + } + else if (WalkState->DeferredNode) + { + Name = WalkState->DeferredNode->Name.Integer; + } + + Status = AcpiGbl_ExceptionHandler (Status, Name, WalkState->Opcode, AmlOffset, NULL); AcpiExEnterInterpreter (); } diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index 6a4f5bf255518..3ceec94b17e2a 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -353,10 +353,9 @@ AcpiDsInitBufferField ( (8 * (UINT32) BufferDesc->Buffer.Length)) { ACPI_ERROR ((AE_INFO, - "Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)", - AcpiUtGetNodeName (ResultDesc), - BitOffset + BitCount, - AcpiUtGetNodeName (BufferDesc->Buffer.Node), + "Field [%4.4s] at bit offset/length %u/%u " + "exceeds size of target Buffer (%u bits)", + AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount, 8 * (UINT32) BufferDesc->Buffer.Length)); Status = AE_AML_BUFFER_LIMIT; goto Cleanup; diff --git a/source/components/dispatcher/dspkginit.c b/source/components/dispatcher/dspkginit.c new file mode 100755 index 0000000000000..efbc0f3a80433 --- /dev/null +++ b/source/components/dispatcher/dspkginit.c @@ -0,0 +1,638 @@ +/****************************************************************************** + * + * Module Name: dspkginit - Completion of deferred package initialization + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * 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. + * + * 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 MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * 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 DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("dspkginit") + + +/* Local prototypes */ + +static void +AcpiDsResolvePackageElement ( + ACPI_OPERAND_OBJECT **Element); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsBuildInternalPackageObj + * + * PARAMETERS: WalkState - Current walk state + * Op - Parser object to be translated + * ElementCount - Number of elements in the package - this is + * the NumElements argument to Package() + * ObjDescPtr - Where the ACPI internal object is returned + * + * RETURN: Status + * + * DESCRIPTION: Translate a parser Op package object to the equivalent + * namespace object + * + * NOTE: The number of elements in the package will be always be the NumElements + * count, regardless of the number of elements in the package list. If + * NumElements is smaller, only that many package list elements are used. + * if NumElements is larger, the Package object is padded out with + * objects of type Uninitialized (as per ACPI spec.) + * + * Even though the ASL compilers do not allow NumElements to be smaller + * than the Package list length (for the fixed length package opcode), some + * BIOS code modifies the AML on the fly to adjust the NumElements, and + * this code compensates for that. This also provides compatibility with + * other AML interpreters. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsBuildInternalPackageObj ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + UINT32 ElementCount, + ACPI_OPERAND_OBJECT **ObjDescPtr) +{ + ACPI_PARSE_OBJECT *Arg; + ACPI_PARSE_OBJECT *Parent; + ACPI_OPERAND_OBJECT *ObjDesc = NULL; + ACPI_STATUS Status = AE_OK; + UINT16 Index; + UINT16 ReferenceCount; + UINT32 i; + + + ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); + + + /* Find the parent of a possibly nested package */ + + Parent = Op->Common.Parent; + while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) + { + Parent = Parent->Common.Parent; + } + + /* + * If we are evaluating a Named package object of the form: + * Name (xxxx, Package) + * the package object already exists, otherwise it must be created. + */ + ObjDesc = *ObjDescPtr; + if (!ObjDesc) + { + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + *ObjDescPtr = ObjDesc; + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + +printf ("****DS: BuildPkg - Create package object %p\n", ObjDesc); + + ObjDesc->Package.Node = Parent->Common.Node; + } + +// +printf ("****DS: BuildPkg, from DsEvalDataObjectOperands - Valid: %X, Pass %u, %p\n", + ObjDesc->Package.Flags & AOPOBJ_DATA_VALID, + WalkState->PassNumber, ObjDesc); + +// just in case +if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) +{ + return_ACPI_STATUS (AE_OK); +} + + /* + * Allocate the element array (array of pointers to the individual + * objects) based on the NumElements parameter. Add an extra pointer slot + * so that the list is always null terminated. + */ + ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED ( + ((ACPI_SIZE) ElementCount + 1) * sizeof (void *)); + + if (!ObjDesc->Package.Elements) + { + AcpiUtDeleteObjectDesc (ObjDesc); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + ObjDesc->Package.Count = ElementCount; + + /* + * Initialize the elements of the package, up to the NumElements count. + * Package is automatically padded with uninitialized (NULL) elements + * if NumElements is greater than the package list length. Likewise, + * Package is truncated if NumElements is less than the list length. + */ + Arg = Op->Common.Value.Arg; + Arg = Arg->Common.Next; + + if (Arg) + { + printf ("****DS: Mark package evaluated\n"); + ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; + } + + for (i = 0; Arg && (i < ElementCount); i++) + { +printf ("****DS: Eval package element\n"); + + if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) + { +// Maybe this is just temp code: +/* +if (!Arg->Common.Node) +{ + printf ("****DS: No attached NS node\n"); + return_ACPI_STATUS (AE_AML_INTERNAL); +} +else */ if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) + { + + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); + } + else + { + /* This package element is already built, just get it */ + + ObjDesc->Package.Elements[i] = + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + } + } + else + { + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); + if (Status == AE_NOT_FOUND) + { +// remove or fix + ACPI_ERROR ((AE_INFO, "%-48s", "****DS namepath not found")); + } + + /* + * Initialize this package element. This function handles the + * resolution of named references within the package. + */ + AcpiDsInitPackageElement (0, ObjDesc->Package.Elements[i], + NULL, &ObjDesc->Package.Elements[i]); + } + + if (*ObjDescPtr) + { + /* Existing package, get existing reference count */ + + ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; + if (ReferenceCount > 1) + { + /* Make new element ref count match original ref count */ + + for (Index = 0; Index < (ReferenceCount - 1); Index++) + { + AcpiUtAddReference ((ObjDesc->Package.Elements[i])); + } + } + } + + Arg = Arg->Common.Next; + } + + /* Check for match between NumElements and actual length of PackageList */ + + if (Arg) + { + //ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; + + + /* + * NumElements was exhausted, but there are remaining elements in the + * PackageList. Truncate the package to NumElements. + * + * Note: technically, this is an error, from ACPI spec: "It is an error + * for NumElements to be less than the number of elements in the + * PackageList". However, we just print a message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the NumElements on the fly, creating this type + * of ill-formed package object. + */ + while (Arg) + { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (Arg->Common.Node) + { + AcpiUtRemoveReference ( + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); + Arg->Common.Node = NULL; + } + + /* Find out how many elements there really are */ + + i++; + Arg = Arg->Common.Next; + } + + ACPI_INFO (( + "Actual Package length (%u) is larger than " + "NumElements field (%u), truncated", + i, ElementCount)); + } + else if (i < ElementCount) + { + /* + * Arg list (elements) was exhausted, but we did not reach + * NumElements count. + * + * Note: this is not an error, the package is padded out + * with NULLs. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Package List length (%u) smaller than NumElements " + "count (%u), padded with null elements\n", + i, ElementCount)); + } + + Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsInitPackageElement + * + * PARAMETERS: ACPI_PKG_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Resolve a named reference element within a package object + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsInitPackageElement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context) +{ + ACPI_OPERAND_OBJECT **ElementPtr; + + + if (!SourceObject) + { + return (AE_OK); + } + + /* + * The following code is a bit of a hack to workaround a (current) + * limitation of the ACPI_PKG_CALLBACK interface. We need a pointer + * to the location within the element array because a new object + * may be created and stored there. + */ + if (Context) + { + /* A direct call was made to this function */ + + ElementPtr = (ACPI_OPERAND_OBJECT **) Context; + } + else + { + /* Call came from AcpiUtWalkPackageTree */ + + ElementPtr = State->Pkg.ThisTargetObj; + } + + /* We are only interested in reference objects/elements */ + + if (SourceObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) + { + /* Resolve the (named) reference to a namespace node */ + + AcpiDsResolvePackageElement (ElementPtr); + } + else if (SourceObject->Common.Type == ACPI_TYPE_PACKAGE) + { + SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsResolvePackageElement + * + * PARAMETERS: ElementPtr - Pointer to a reference object + * + * RETURN: Status + * + * DESCRIPTION: Resolve a package element that is a reference to a named + * object. + * + ******************************************************************************/ + +static void +AcpiDsResolvePackageElement ( + ACPI_OPERAND_OBJECT **ElementPtr) +{ + ACPI_STATUS Status; + ACPI_GENERIC_STATE ScopeInfo; + ACPI_OPERAND_OBJECT *Element = *ElementPtr; + ACPI_NAMESPACE_NODE *ResolvedNode; + ACPI_OBJECT_TYPE Type; + + + ACPI_FUNCTION_TRACE (DsResolvePackageElement); + + + /* Check if reference element is already resolved */ + + if (Element->Reference.Resolved) + { + return_VOID; + } + + /* Element must be a reference object of correct type */ + + ScopeInfo.Scope.Node = Element->Reference.Node; /* Prefix node */ + + Status = AcpiNsLookup (&ScopeInfo, + (char *) Element->Reference.Aml, /* Pointer to AML path */ + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &ResolvedNode); + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not resolve package element")); + return_VOID; + } + + else if (ResolvedNode->Type == ACPI_TYPE_ANY) + { + /* Named reference not resolved, return a NULL package element */ + + ACPI_ERROR ((AE_INFO, + "Could not resolve package element [%4.4s] in [%4.4s]", + ResolvedNode->Name.Ascii, ScopeInfo.Scope.Node->Name.Ascii)); + *ElementPtr = NULL; + return_VOID; + } + + else if (ResolvedNode->Flags & ANOBJ_TEMPORARY) + { + /* + * A temporary node found here indicates that the reference is + * to a node that was created within this method. We are not + * going to allow it (especially if the package is returned + * from the method) -- the temporary node will be deleted out + * from under the method. (05/2017). + */ + ACPI_ERROR ((AE_INFO, + "Package element is a temporary name [%4.4s], " + "returning NULL element", + ResolvedNode->Name.Ascii)); + *ElementPtr = NULL; + return_VOID; + } + + /* Update the reference object */ + + Element->Reference.Resolved = TRUE; + Element->Reference.Node = ResolvedNode; + Type = Element->Reference.Node->Type; + + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + +#if 0 + /* + * Special handling for Alias objects. We need to setup the type + * and the Op->Common.Node to point to the Alias target. Note, + * Alias has at most one level of indirection internally. + */ + Type = Op->Common.Node->Type; + if (Type == ACPI_TYPE_LOCAL_ALIAS) + { + Type = ObjDesc->Common.Type; + Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, + Op->Common.Node->Object); + } +#endif + + switch (Type) + { + /* + * These object types are a result of named references, so we will + * leave them as reference objects. In other words, these types + * have no intrinsic "value". + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* TBD: This may not be necesssary */ + + AcpiUtAddReference (ResolvedNode->Object); + break; + + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + + break; + + default: + /* + * For all other types - the node was resolved to an actual + * operand object with a value, return the object + */ + *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; + break; + } + + return_VOID; +} diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 77dff895f54d1..4688e16ec8f05 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -791,12 +791,6 @@ AcpiDsCreateOperand ( if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Argument previously created, already stacked\n")); - - AcpiDbDisplayArgumentObject ( - WalkState->Operands [WalkState->NumOperands - 1], WalkState); - /* * Use value that was already previously returned * by the evaluation of this argument diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 4df147138def6..dfdfeaa036605 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -723,7 +723,8 @@ AcpiDsExecEndOp ( case AML_TYPE_CREATE_OBJECT: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing CreateObject (Buffer/Package) Op=%p\n", Op)); + "Executing CreateObject (Buffer/Package) Op=%p AMLPtr=%p\n", + Op, Op->Named.Data)); switch (Op->Common.Parent->Common.AmlOpcode) { diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index f3f99ea1b914a..8793c0ed1cf51 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -518,7 +518,7 @@ AcpiDsLoad1BeginOp ( /* Initialize the op */ #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) - Op->Named.Path = ACPI_CAST_PTR (UINT8, Path); + Op->Named.Path = Path; #endif if (Node) @@ -558,6 +558,10 @@ AcpiDsLoad1EndOp ( ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status = AE_OK; +#ifdef ACPI_ASL_COMPILER + UINT8 ParamCount; +#endif + ACPI_FUNCTION_TRACE (DsLoad1EndOp); @@ -642,6 +646,37 @@ AcpiDsLoad1EndOp ( } } +#ifdef ACPI_ASL_COMPILER + /* + * For external opcode, get the object type from the argument and + * get the parameter count from the argument's next. + */ + if (AcpiGbl_DisasmFlag && + Op->Common.Node && + Op->Common.AmlOpcode == AML_EXTERNAL_OP) + { + /* + * Note, if this external is not a method + * Op->Common.Value.Arg->Common.Next->Common.Value.Integer == 0 + * Therefore, ParamCount will be 0. + */ + ParamCount = (UINT8) Op->Common.Value.Arg->Common.Next->Common.Value.Integer; + ObjectType = (UINT8) Op->Common.Value.Arg->Common.Value.Integer; + Op->Common.Node->Flags |= ANOBJ_IS_EXTERNAL; + Op->Common.Node->Type = (UINT8) ObjectType; + + AcpiDmCreateSubobjectForExternal ((UINT8)ObjectType, + &Op->Common.Node, ParamCount); + + /* + * Add the external to the external list because we may be + * emitting code based off of the items within the external list. + */ + AcpiDmAddOpToExternalList (Op, Op->Named.Path, (UINT8)ObjectType, ParamCount, + ACPI_EXT_ORIGIN_FROM_OPCODE | ACPI_EXT_RESOLVED_REFERENCE); + } +#endif + /* * If we are executing a method, do not create any namespace objects * during the load phase, only during execution. @@ -689,6 +724,7 @@ AcpiDsLoad1EndOp ( /* Pop the scope stack (only if loading a table) */ if (!WalkState->MethodNode && + Op->Common.AmlOpcode != AML_EXTERNAL_OP && AcpiNsOpensScope (ObjectType)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 46870830f44bc..184f6aa367d21 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -428,6 +428,24 @@ AcpiDsLoad2BeginOp ( } } +#ifdef ACPI_ASL_COMPILER + + /* + * Do not open a scope for AML_EXTERNAL_OP + * AcpiNsLookup can open a new scope based on the object type + * of this op. AML_EXTERNAL_OP is a declaration rather than a + * definition. In the case that this external is a method object, + * AcpiNsLookup will open a new scope. However, an AML_EXTERNAL_OP + * associated with the ACPI_TYPE_METHOD is a declaration, rather than + * a definition. Flags is set to avoid opening a scope for any + * AML_EXTERNAL_OP. + */ + if (WalkState->Opcode == AML_EXTERNAL_OP) + { + Flags |= ACPI_NS_DONT_OPEN_SCOPE; + } +#endif + /* Add new entry or lookup existing entry */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index f781f3e0ee7b1..0466273685bec 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -306,6 +306,13 @@ AcpiEnableEvent ( ACPI_FUNCTION_TRACE (AcpiEnableEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) @@ -372,6 +379,13 @@ AcpiDisableEvent ( ACPI_FUNCTION_TRACE (AcpiDisableEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) @@ -433,6 +447,13 @@ AcpiClearEvent ( ACPI_FUNCTION_TRACE (AcpiClearEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index cdc678719c7ad..155f2c0d48dd8 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -237,11 +237,11 @@ AcpiExDoDebugObject ( Timer = ((UINT32) AcpiOsGetTimer () / 10); Timer &= 0x03FFFFFF; - AcpiOsPrintf ("[ACPI Debug T=0x%8.8X] %*s", Timer, Level, " "); + AcpiOsPrintf ("ACPI Debug: T=0x%8.8X %*s", Timer, Level, " "); } else { - AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + AcpiOsPrintf ("ACPI Debug: %*s", Level, " "); } } diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index 82b34038e3268..2b23881f16cd6 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -775,12 +775,13 @@ AcpiExDumpOperand ( if (Depth > 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", - Depth, " ", Depth, ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ", + Depth, " ", Depth, ObjDesc, ObjDesc->Common.ReferenceCount)); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Refs=%u ", + ObjDesc, ObjDesc->Common.ReferenceCount)); } /* Decode object type */ @@ -818,8 +819,10 @@ AcpiExDumpOperand ( case ACPI_REFCLASS_NAME: - AcpiOsPrintf ("- [%4.4s]\n", - ObjDesc->Reference.Node->Name.Ascii); + AcpiUtRepairName (ObjDesc->Reference.Node->Name.Ascii); + AcpiOsPrintf ("- [%4.4s] (Node %p)\n", + ObjDesc->Reference.Node->Name.Ascii, + ObjDesc->Reference.Node); break; case ACPI_REFCLASS_ARG: @@ -1158,12 +1161,15 @@ AcpiExDumpReferenceObj ( &RetBuf, TRUE); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf (" Could not convert name to pathname\n"); + AcpiOsPrintf (" Could not convert name to pathname: %s\n", + AcpiFormatException (Status)); } else { - AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer); - ACPI_FREE (RetBuf.Pointer); + AcpiOsPrintf ("%s: %s\n", + AcpiUtGetTypeName (ObjDesc->Reference.Node->Type), + (char *) RetBuf.Pointer); + ACPI_FREE (RetBuf.Pointer); } } else if (ObjDesc->Reference.Object) @@ -1281,9 +1287,8 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X", - AcpiUtGetReferenceName (ObjDesc), - ObjDesc->Reference.Class); + AcpiOsPrintf ("[Object Reference] Class [%s]", + AcpiUtGetReferenceName (ObjDesc)); AcpiExDumpReferenceObj (ObjDesc); break; diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c index a0efb25ece224..5d59276be8c19 100644 --- a/source/components/executer/exoparg1.c +++ b/source/components/executer/exoparg1.c @@ -959,7 +959,7 @@ AcpiExOpcode_1A_0T_1R ( if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED) { TempDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); + (ACPI_NAMESPACE_NODE *) Operand[0]); if (TempDesc && ((TempDesc->Common.Type == ACPI_TYPE_STRING) || (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE))) @@ -1072,11 +1072,27 @@ AcpiExOpcode_1A_0T_1R ( * This is a DerefOf (ObjectReference) * Get the actual object from the Node (This is the dereference). * This case may only happen when a LocalX or ArgX is - * dereferenced above. + * dereferenced above, or for references to device and + * thermal objects. */ - ReturnDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); - AcpiUtAddReference (ReturnDesc); + switch (((ACPI_NAMESPACE_NODE *) Operand[0])->Type) + { + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* These types have no node subobject, return the NS node */ + + ReturnDesc = Operand[0]; + break; + + default: + /* For most types, get the object attached to the node */ + + ReturnDesc = AcpiNsGetAttachedObject ( + (ACPI_NAMESPACE_NODE *) Operand[0]); + AcpiUtAddReference (ReturnDesc); + break; + } } else { diff --git a/source/components/executer/exresolv.c b/source/components/executer/exresolv.c index d0c8c8a8daf48..64771922d9199 100644 --- a/source/components/executer/exresolv.c +++ b/source/components/executer/exresolv.c @@ -493,12 +493,26 @@ AcpiExResolveMultiple ( (ACPI_NAMESPACE_NODE *) ObjDesc); } - if (!ObjDesc) + switch (Type) { - ACPI_ERROR ((AE_INFO, - "[%4.4s] Node is unresolved or uninitialized", - AcpiUtGetNodeName (Node))); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* These types have no attached subobject */ + break; + + default: + + /* All other types require a subobject */ + + if (!ObjDesc) + { + ACPI_ERROR ((AE_INFO, + "[%4.4s] Node is unresolved or uninitialized", + AcpiUtGetNodeName (Node))); + return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); + } + break; } break; diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 401015753219c..1404eabf67ad3 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -155,6 +155,9 @@ #include "acnamesp.h" #include "acdispat.h" +#ifdef ACPI_ASL_COMPILER + #include "acdisasm.h" +#endif #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsaccess") @@ -710,6 +713,30 @@ AcpiNsLookup ( CurrentNode)); } +#ifdef ACPI_ASL_COMPILER + /* + * If this ACPI name already exists within the namespace as an + * external declaration, then mark the external as a conflicting + * declaration and proceed to process the current node as if it did + * not exist in the namespace. If this node is not processed as + * normal, then it could cause improper namespace resolution + * by failing to open a new scope. + */ + if (AcpiGbl_DisasmFlag && + (Status == AE_ALREADY_EXISTS) && + ((ThisNode->Flags & ANOBJ_IS_EXTERNAL) || + (WalkState && WalkState->Opcode == AML_EXTERNAL_OP))) + { + ThisNode->Flags &= ~ANOBJ_IS_EXTERNAL; + ThisNode->Type = (UINT8)ThisSearchType; + if (WalkState->Opcode != AML_EXTERNAL_OP) + { + AcpiDmMarkExternalConflict (ThisNode); + } + break; + } +#endif + *ReturnNode = ThisNode; return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index 1dc536101e0b8..f68fbc1ed5472 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -324,10 +324,6 @@ AcpiNsHandleToPathname ( (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, RequiredSize, NoTrailing); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 3ab7a0ebdcbf8..2b6f6fb8e4355 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -206,7 +206,7 @@ AcpiNsPrintNodePathname ( AcpiOsPrintf ("%s ", Message); } - AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node); + AcpiOsPrintf ("%s", (char *) Buffer.Pointer); ACPI_FREE (Buffer.Pointer); } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 4dd8ff1d2fe4b..ab3ad59885491 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -199,6 +199,8 @@ AcpiEvaluateObjectTyped ( { ACPI_STATUS Status; BOOLEAN FreeBufferOnError = FALSE; + ACPI_HANDLE TargetHandle; + char *FullPathname; ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped); @@ -216,41 +218,56 @@ AcpiEvaluateObjectTyped ( FreeBufferOnError = TRUE; } + Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + FullPathname = AcpiNsGetExternalPathname (TargetHandle); + if (!FullPathname) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + /* Evaluate the object */ - Status = AcpiEvaluateObject (Handle, Pathname, - ExternalParams, ReturnBuffer); + Status = AcpiEvaluateObject (TargetHandle, NULL, ExternalParams, + ReturnBuffer); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } - /* Type ANY means "don't care" */ + /* Type ANY means "don't care about return value type" */ if (ReturnType == ACPI_TYPE_ANY) { - return_ACPI_STATUS (AE_OK); + goto Exit; } if (ReturnBuffer->Length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_ERROR ((AE_INFO, "No return value")); - return_ACPI_STATUS (AE_NULL_OBJECT); + ACPI_ERROR ((AE_INFO, "%s did not return any object", + FullPathname)); + Status = AE_NULL_OBJECT; + goto Exit; } /* Examine the object type returned from EvaluateObject */ if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) { - return_ACPI_STATUS (AE_OK); + goto Exit; } /* Return object type does not match requested type */ ACPI_ERROR ((AE_INFO, - "Incorrect return type [%s] requested [%s]", + "Incorrect return type from %s - received [%s], requested [%s]", + FullPathname, AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), AcpiUtGetTypeName (ReturnType))); @@ -268,7 +285,11 @@ AcpiEvaluateObjectTyped ( } ReturnBuffer->Length = 0; - return_ACPI_STATUS (AE_TYPE); + Status = AE_TYPE; + +Exit: + ACPI_FREE (FullPathname); + return_ACPI_STATUS (Status); } ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped) diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c index 8d2448bd8d411..5d59492a7ba8f 100644 --- a/source/components/parser/psobject.c +++ b/source/components/parser/psobject.c @@ -237,12 +237,23 @@ AcpiPsGetAmlOpcode ( WalkState->Opcode, (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); + ACPI_ERROR ((AE_INFO, + "Aborting disassembly, AML byte code is corrupt")); + /* Dump the context surrounding the invalid opcode */ AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), 48, DB_BYTE_DISPLAY, (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); AcpiOsPrintf (" */\n"); + + /* + * Just abort the disassembly, cannot continue because the + * parser is essentially lost. The disassembler can then + * randomly fail because an ill-constructed parse tree + * can result. + */ + return_ACPI_STATUS (AE_AML_BAD_OPCODE); #endif } @@ -458,6 +469,10 @@ AcpiPsCreateOp ( { return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); } + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Create Op structure and append to parent's argument list */ diff --git a/source/components/parser/psopcode.c b/source/components/parser/psopcode.c index 2ad29f19535f3..97a32544998d4 100644 --- a/source/components/parser/psopcode.c +++ b/source/components/parser/psopcode.c @@ -445,7 +445,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* ACPI 6.0 opcodes */ -/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE,/* ? */ AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), +/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 82 */ ACPI_OP ("Comment", ARGP_COMMENT_OP, ARGI_COMMENT_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT) /*! [End] no source code translation !*/ diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 1a3a5345ccc59..854f054711f51 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -164,6 +164,7 @@ #include "acdispat.h" #include "amlcode.h" #include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psparse") @@ -664,8 +665,17 @@ AcpiPsParseAml ( /* Either the method parse or actual execution failed */ AcpiExExitInterpreter (); - ACPI_ERROR_METHOD ("Method parse/execution failed", - WalkState->MethodNode, NULL, Status); + if (Status == AE_ABORT_METHOD) + { + AcpiNsPrintNodePathname ( + WalkState->MethodNode, "Method aborted:"); + AcpiOsPrintf ("\n"); + } + else + { + ACPI_ERROR_METHOD ("Method parse/execution failed", + WalkState->MethodNode, NULL, Status); + } AcpiExEnterInterpreter (); /* Check for possible multi-thread reentrancy problem */ diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 2c3d09eb6d005..492dde4779613 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -471,6 +471,15 @@ AcpiRsGetAmlLength ( break; + case ACPI_RESOURCE_TYPE_PIN_FUNCTION: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinFunction.PinTableLength * 2) + + Resource->Data.PinFunction.ResourceSource.StringLength + + Resource->Data.PinFunction.VendorLength); + + break; + case ACPI_RESOURCE_TYPE_SERIAL_BUS: @@ -483,6 +492,42 @@ AcpiRsGetAmlLength ( break; + case ACPI_RESOURCE_TYPE_PIN_CONFIG: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinConfig.PinTableLength * 2) + + Resource->Data.PinConfig.ResourceSource.StringLength + + Resource->Data.PinConfig.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinGroup.PinTableLength * 2) + + Resource->Data.PinGroup.ResourceLabel.StringLength + + Resource->Data.PinGroup.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.PinGroupFunction.ResourceSource.StringLength + + Resource->Data.PinGroupFunction.ResourceSourceLabel.StringLength + + Resource->Data.PinGroupFunction.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.PinGroupConfig.ResourceSource.StringLength + + Resource->Data.PinGroupConfig.ResourceSourceLabel.StringLength + + Resource->Data.PinGroupConfig.VendorLength); + + break; + default: break; @@ -668,6 +713,26 @@ AcpiRsGetListLength ( } break; + case ACPI_RESOURCE_NAME_PIN_FUNCTION: + + /* Vendor data is optional */ + + if (AmlResource->PinFunction.VendorLength) + { + ExtraStructBytes += + AmlResource->PinFunction.VendorOffset - + AmlResource->PinFunction.PinTableOffset + + AmlResource->PinFunction.VendorLength; + } + else + { + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->PinFunction.PinTableOffset; + } + break; + case ACPI_RESOURCE_NAME_SERIAL_BUS: MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ @@ -677,6 +742,53 @@ AcpiRsGetListLength ( MinimumAmlResourceLength; break; + case ACPI_RESOURCE_NAME_PIN_CONFIG: + + /* Vendor data is optional */ + + if (AmlResource->PinConfig.VendorLength) + { + ExtraStructBytes += + AmlResource->PinConfig.VendorOffset - + AmlResource->PinConfig.PinTableOffset + + AmlResource->PinConfig.VendorLength; + } + else + { + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->PinConfig.PinTableOffset; + } + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP: + + ExtraStructBytes += + AmlResource->PinGroup.VendorOffset - + AmlResource->PinGroup.PinTableOffset + + AmlResource->PinGroup.VendorLength; + + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION: + + ExtraStructBytes += + AmlResource->PinGroupFunction.VendorOffset - + AmlResource->PinGroupFunction.ResSourceOffset + + AmlResource->PinGroupFunction.VendorLength; + + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG: + + ExtraStructBytes += + AmlResource->PinGroupConfig.VendorOffset - + AmlResource->PinGroupConfig.ResSourceOffset + + AmlResource->PinGroupConfig.VendorLength; + + break; + default: break; diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 9a980781239df..7cafdcf970fbf 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -216,6 +216,11 @@ AcpiRsDumpResourceSource ( ACPI_RESOURCE_SOURCE *ResourceSource); static void +AcpiRsDumpResourceLabel ( + char *Title, + ACPI_RESOURCE_LABEL *ResourceLabel); + +static void AcpiRsDumpAddressCommon ( ACPI_RESOURCE_DATA *Resource); @@ -531,6 +536,22 @@ AcpiRsDumpDescriptor ( ACPI_RESOURCE_SOURCE, Target)); break; + case ACPI_RSD_LABEL: + /* + * ResourceLabel + */ + AcpiRsDumpResourceLabel ("Resource Label", ACPI_CAST_PTR ( + ACPI_RESOURCE_LABEL, Target)); + break; + + case ACPI_RSD_SOURCE_LABEL: + /* + * ResourceSourceLabel + */ + AcpiRsDumpResourceLabel ("Resource Source Label", ACPI_CAST_PTR ( + ACPI_RESOURCE_LABEL, Target)); + break; + default: AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", @@ -580,6 +601,32 @@ AcpiRsDumpResourceSource ( /******************************************************************************* * + * FUNCTION: AcpiRsDumpResourceLabel + * + * PARAMETERS: Title - Title of the dumped resource field + * ResourceLabel - Pointer to a Resource Label struct + * + * RETURN: None + * + * DESCRIPTION: Common routine for dumping the ResourceLabel + * + ******************************************************************************/ + +static void +AcpiRsDumpResourceLabel ( + char *Title, + ACPI_RESOURCE_LABEL *ResourceLabel) +{ + ACPI_FUNCTION_ENTRY (); + + AcpiRsOutString (Title, + ResourceLabel->StringPtr ? + ResourceLabel->StringPtr : "[Not Specified]"); +} + + +/******************************************************************************* + * * FUNCTION: AcpiRsDumpAddressCommon * * PARAMETERS: Resource - Pointer to an internal resource descriptor diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index ba0f37ddcff9b..cd9ae4d3500d1 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -360,6 +360,74 @@ ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL}, }; +ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[10] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinFunction), "PinFunction", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinFunction.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.FunctionNumber), "FunctionNumber", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinFunction.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinFunction.PinTable), "PinTable", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinFunction.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[11] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinConfig), "PinConfig", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.PinConfigType), "PinConfigType", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinConfig.PinConfigValue), "PinConfigValue", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinConfig.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinConfig.PinTable), "PinTable", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinConfig.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[8] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroup), "PinGroup", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroup.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroup.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinGroup.PinTable), "PinTable", NULL}, + {ACPI_RSD_LABEL, ACPI_RSD_OFFSET (PinGroup.ResourceLabel), "ResourceLabel", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroup.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[9] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupFunction), "PinGroupFunction", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupFunction.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.FunctionNumber), "FunctionNumber", NULL}, + {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSourceLabel), "ResourceSourceLabel", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupFunction.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[10] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupConfig), "PinGroupConfig", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigType), "PinConfigType", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigValue), "PinConfigValue", NULL}, + {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSourceLabel), "ResourceSourceLabel", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupConfig.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupConfig.VendorData), "VendorData", NULL}, +}; + ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL}, diff --git a/source/components/resources/rsinfo.c b/source/components/resources/rsinfo.c index 499aff655ef29..581891297a522 100644 --- a/source/components/resources/rsinfo.c +++ b/source/components/resources/rsinfo.c @@ -192,6 +192,11 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] = AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ + AcpiRsConvertPinFunction, /* 0x14, ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + AcpiRsConvertPinConfig, /* 0x15, ACPI_RESOURCE_TYPE_PIN_CONFIG */ + AcpiRsConvertPinGroup, /* 0x16, ACPI_RESOURCE_TYPE_PIN_GROUP */ + AcpiRsConvertPinGroupFunction, /* 0x17, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + AcpiRsConvertPinGroupConfig, /* 0x18, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ @@ -232,8 +237,12 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ - NULL, /* 0x0D, Reserved */ + AcpiRsConvertPinFunction, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ + AcpiRsConvertPinConfig, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ + AcpiRsConvertPinGroup, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ + AcpiRsConvertPinGroupFunction, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ + AcpiRsConvertPinGroupConfig, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ }; /* Subtype table for SerialBus -- I2C, SPI, and UART */ @@ -273,6 +282,11 @@ ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ + AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ + AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */ + AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = @@ -312,6 +326,11 @@ const UINT8 AcpiGbl_AmlResourceSizes[] = sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ + sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ + sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */ + sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; @@ -351,7 +370,12 @@ const UINT8 AcpiGbl_ResourceStructSizes[] = ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), - ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS) + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), + ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), }; const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 6a5dfd78c1106..16db6fae794ad 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -705,10 +705,7 @@ AcpiRsConvertResourceToAml ( /* Set vendor offset only if there is vendor data */ - if (Resource->Data.Gpio.VendorLength) - { - ACPI_SET16 (Target, AmlLength); - } + ACPI_SET16 (Target, AmlLength); AcpiRsSetResourceLength (AmlLength, Aml); break; diff --git a/source/components/resources/rsserial.c b/source/components/resources/rsserial.c index 30ddf522bce76..5395382d31c17 100644 --- a/source/components/resources/rsserial.c +++ b/source/components/resources/rsserial.c @@ -254,6 +254,78 @@ ACPI_RSCONVERT_INFO AcpiRsConvertGpio[18] = 0}, }; +/******************************************************************************* + * + * AcpiRsConvertPinfunction + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[13] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinFunction)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION, + sizeof (AML_RESOURCE_PIN_FUNCTION), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.RevisionId), + AML_OFFSET (PinFunction.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinFunction.Sharable), + AML_OFFSET (PinFunction.Flags), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.PinConfig), + AML_OFFSET (PinFunction.PinConfig), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinFunction.FunctionNumber), + AML_OFFSET (PinFunction.FunctionNumber), + 2}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTableLength), + AML_OFFSET (PinFunction.PinTableOffset), + AML_OFFSET (PinFunction.ResSourceOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTable), + AML_OFFSET (PinFunction.PinTableOffset), + 0}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.Index), + AML_OFFSET (PinFunction.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringLength), + AML_OFFSET (PinFunction.ResSourceOffset), + AML_OFFSET (PinFunction.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringPtr), + AML_OFFSET (PinFunction.ResSourceOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinFunction.VendorLength), + AML_OFFSET (PinFunction.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.VendorData), + AML_OFFSET (PinFunction.VendorOffset), + 0}, +}; + /******************************************************************************* * @@ -545,3 +617,278 @@ ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[23] = AML_OFFSET (UartSerialBus.DefaultBaudRate), 1}, }; + + +/******************************************************************************* + * + * AcpiRsConvertPinConfig + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[14] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinConfig)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG, + sizeof (AML_RESOURCE_PIN_CONFIG), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.RevisionId), + AML_OFFSET (PinConfig.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.Sharable), + AML_OFFSET (PinConfig.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.ProducerConsumer), + AML_OFFSET (PinConfig.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.PinConfigType), + AML_OFFSET (PinConfig.PinConfigType), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinConfig.PinConfigValue), + AML_OFFSET (PinConfig.PinConfigValue), + 1}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTableLength), + AML_OFFSET (PinConfig.PinTableOffset), + AML_OFFSET (PinConfig.ResSourceOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTable), + AML_OFFSET (PinConfig.PinTableOffset), + 0}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.Index), + AML_OFFSET (PinConfig.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringLength), + AML_OFFSET (PinConfig.ResSourceOffset), + AML_OFFSET (PinConfig.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringPtr), + AML_OFFSET (PinConfig.ResSourceOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinConfig.VendorLength), + AML_OFFSET (PinConfig.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.VendorData), + AML_OFFSET (PinConfig.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroup + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[10] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroup)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP, + sizeof (AML_RESOURCE_PIN_GROUP), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroup.RevisionId), + AML_OFFSET (PinGroup.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroup.ProducerConsumer), + AML_OFFSET (PinGroup.Flags), + 0}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTableLength), + AML_OFFSET (PinGroup.PinTableOffset), + AML_OFFSET (PinGroup.LabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTable), + AML_OFFSET (PinGroup.PinTableOffset), + 0}, + + /* Resource Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringLength), + AML_OFFSET (PinGroup.LabelOffset), + AML_OFFSET (PinGroup.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringPtr), + AML_OFFSET (PinGroup.LabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroup.VendorLength), + AML_OFFSET (PinGroup.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.VendorData), + AML_OFFSET (PinGroup.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroupFunction + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[13] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupFunction)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION, + sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.RevisionId), + AML_OFFSET (PinGroupFunction.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.Sharable), + AML_OFFSET (PinGroupFunction.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.ProducerConsumer), + AML_OFFSET (PinGroupFunction.Flags), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinGroupFunction.FunctionNumber), + AML_OFFSET (PinGroupFunction.FunctionNumber), + 1}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.Index), + AML_OFFSET (PinGroupFunction.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringLength), + AML_OFFSET (PinGroupFunction.ResSourceOffset), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringPtr), + AML_OFFSET (PinGroupFunction.ResSourceOffset), + 0}, + + /* Resource Source Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringLength), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), + AML_OFFSET (PinGroupFunction.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringPtr), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorLength), + AML_OFFSET (PinGroupFunction.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorData), + AML_OFFSET (PinGroupFunction.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroupConfig + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[14] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupConfig)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG, + sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.RevisionId), + AML_OFFSET (PinGroupConfig.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.Sharable), + AML_OFFSET (PinGroupConfig.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.ProducerConsumer), + AML_OFFSET (PinGroupConfig.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigType), + AML_OFFSET (PinGroupConfig.PinConfigType), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigValue), + AML_OFFSET (PinGroupConfig.PinConfigValue), + 1}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.Index), + AML_OFFSET (PinGroupConfig.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringLength), + AML_OFFSET (PinGroupConfig.ResSourceOffset), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringPtr), + AML_OFFSET (PinGroupConfig.ResSourceOffset), + 0}, + + /* Resource Source Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringLength), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), + AML_OFFSET (PinGroupConfig.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringPtr), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorLength), + AML_OFFSET (PinGroupConfig.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorData), + AML_OFFSET (PinGroupConfig.VendorOffset), + 0}, +}; diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 42d40a4af4d9e..3e4e522998176 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -597,8 +597,8 @@ AcpiTbCreateLocalFadt ( * The 64-bit X fields are optional extensions to the original 32-bit FADT * V1.0 fields. Even if they are present in the FADT, they are optional and * are unused if the BIOS sets them to zero. Therefore, we must copy/expand - * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is - * originally zero. + * 32-bit V1.0 fields to the 64-bit X fields if the 64-bit X field is originally + * zero. * * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address * fields are expanded to the corresponding 64-bit X fields in the internal diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 046add5f02e73..c7e0ee75372e6 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -257,9 +257,9 @@ AcpiTbCheckDsdtHeader ( * * FUNCTION: AcpiTbCopyDsdt * - * PARAMETERS: TableDesc - Installed table to copy + * PARAMETERS: TableIndex - Index of installed table to copy * - * RETURN: None + * RETURN: The copied DSDT * * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory. * Some very bad BIOSs are known to either corrupt the DSDT or @@ -368,7 +368,7 @@ AcpiTbGetRootTableEntry ( * * FUNCTION: AcpiTbParseRootTable * - * PARAMETERS: Rsdp - Pointer to the RSDP + * PARAMETERS: RsdpAddress - Pointer to the RSDP * * RETURN: Status * diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index a0abe49cff987..7cb171bccecf7 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -629,8 +629,9 @@ static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */ - /* 0D */ "System Resource Affinity Update" + /* 0C */ "Reserved (was previously Shutdown Request)", /* Reserved in ACPI 6.0 */ + /* 0D */ "System Resource Affinity Update", + /* 0E */ "Heterogeneous Memory Attributes Update" /* ACPI 6.2 */ }; static const char *AcpiGbl_DeviceNotify[5] = diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index fba1d7adb0842..a54513f65ae0c 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -225,14 +225,20 @@ AcpiUtAllocateOwnerId ( break; } - if (!(AcpiGbl_OwnerIdMask[j] & (1 << k))) + /* + * Note: the UINT32 cast ensures that 1 is stored as a unsigned + * integer. Omitting the cast may result in 1 being stored as an + * int. Some compilers or runtime error detection may flag this as + * an error. + */ + if (!(AcpiGbl_OwnerIdMask[j] & ((UINT32) 1 << k))) { /* * Found a free ID. The actual ID is the bit index plus one, * making zero an invalid Owner ID. Save this as the last ID * allocated and update the global ID mask. */ - AcpiGbl_OwnerIdMask[j] |= (1 << k); + AcpiGbl_OwnerIdMask[j] |= ((UINT32) 1 << k); AcpiGbl_LastOwnerIdIndex = (UINT8) j; AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1); @@ -328,7 +334,7 @@ AcpiUtReleaseOwnerId ( /* Decode ID to index/offset pair */ Index = ACPI_DIV_32 (OwnerId); - Bit = 1 << ACPI_MOD_32 (OwnerId); + Bit = (UINT32) 1 << ACPI_MOD_32 (OwnerId); /* Free the owner ID only if it is valid */ diff --git a/source/components/utilities/utresdecode.c b/source/components/utilities/utresdecode.c new file mode 100644 index 0000000000000..10d848742c48f --- /dev/null +++ b/source/components/utilities/utresdecode.c @@ -0,0 +1,461 @@ +/******************************************************************************* + * + * Module Name: utresdecode - Resource descriptor keyword strings + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * 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. + * + * 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 MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * 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 DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utresdecode") + + +#if defined (ACPI_DEBUG_OUTPUT) || \ + defined (ACPI_DISASSEMBLER) || \ + defined (ACPI_DEBUGGER) + +/* + * Strings used to decode resource descriptors. + * Used by both the disassembler and the debugger resource dump routines + */ +const char *AcpiGbl_BmDecode[] = +{ + "NotBusMaster", + "BusMaster" +}; + +const char *AcpiGbl_ConfigDecode[] = +{ + "0 - Good Configuration", + "1 - Acceptable Configuration", + "2 - Suboptimal Configuration", + "3 - ***Invalid Configuration***", +}; + +const char *AcpiGbl_ConsumeDecode[] = +{ + "ResourceProducer", + "ResourceConsumer" +}; + +const char *AcpiGbl_DecDecode[] = +{ + "PosDecode", + "SubDecode" +}; + +const char *AcpiGbl_HeDecode[] = +{ + "Level", + "Edge" +}; + +const char *AcpiGbl_IoDecode[] = +{ + "Decode10", + "Decode16" +}; + +const char *AcpiGbl_LlDecode[] = +{ + "ActiveHigh", + "ActiveLow", + "ActiveBoth", + "Reserved" +}; + +const char *AcpiGbl_MaxDecode[] = +{ + "MaxNotFixed", + "MaxFixed" +}; + +const char *AcpiGbl_MemDecode[] = +{ + "NonCacheable", + "Cacheable", + "WriteCombining", + "Prefetchable" +}; + +const char *AcpiGbl_MinDecode[] = +{ + "MinNotFixed", + "MinFixed" +}; + +const char *AcpiGbl_MtpDecode[] = +{ + "AddressRangeMemory", + "AddressRangeReserved", + "AddressRangeACPI", + "AddressRangeNVS" +}; + +const char *AcpiGbl_RngDecode[] = +{ + "InvalidRanges", + "NonISAOnlyRanges", + "ISAOnlyRanges", + "EntireRange" +}; + +const char *AcpiGbl_RwDecode[] = +{ + "ReadOnly", + "ReadWrite" +}; + +const char *AcpiGbl_ShrDecode[] = +{ + "Exclusive", + "Shared", + "ExclusiveAndWake", /* ACPI 5.0 */ + "SharedAndWake" /* ACPI 5.0 */ +}; + +const char *AcpiGbl_SizDecode[] = +{ + "Transfer8", + "Transfer8_16", + "Transfer16", + "InvalidSize" +}; + +const char *AcpiGbl_TrsDecode[] = +{ + "DenseTranslation", + "SparseTranslation" +}; + +const char *AcpiGbl_TtpDecode[] = +{ + "TypeStatic", + "TypeTranslation" +}; + +const char *AcpiGbl_TypDecode[] = +{ + "Compatibility", + "TypeA", + "TypeB", + "TypeF" +}; + +const char *AcpiGbl_PpcDecode[] = +{ + "PullDefault", + "PullUp", + "PullDown", + "PullNone" +}; + +const char *AcpiGbl_IorDecode[] = +{ + "IoRestrictionNone", + "IoRestrictionInputOnly", + "IoRestrictionOutputOnly", + "IoRestrictionNoneAndPreserve" +}; + +const char *AcpiGbl_DtsDecode[] = +{ + "Width8bit", + "Width16bit", + "Width32bit", + "Width64bit", + "Width128bit", + "Width256bit", +}; + +/* GPIO connection type */ + +const char *AcpiGbl_CtDecode[] = +{ + "Interrupt", + "I/O" +}; + +/* Serial bus type */ + +const char *AcpiGbl_SbtDecode[] = +{ + "/* UNKNOWN serial bus type */", + "I2C", + "SPI", + "UART" +}; + +/* I2C serial bus access mode */ + +const char *AcpiGbl_AmDecode[] = +{ + "AddressingMode7Bit", + "AddressingMode10Bit" +}; + +/* I2C serial bus slave mode */ + +const char *AcpiGbl_SmDecode[] = +{ + "ControllerInitiated", + "DeviceInitiated" +}; + +/* SPI serial bus wire mode */ + +const char *AcpiGbl_WmDecode[] = +{ + "FourWireMode", + "ThreeWireMode" +}; + +/* SPI serial clock phase */ + +const char *AcpiGbl_CphDecode[] = +{ + "ClockPhaseFirst", + "ClockPhaseSecond" +}; + +/* SPI serial bus clock polarity */ + +const char *AcpiGbl_CpoDecode[] = +{ + "ClockPolarityLow", + "ClockPolarityHigh" +}; + +/* SPI serial bus device polarity */ + +const char *AcpiGbl_DpDecode[] = +{ + "PolarityLow", + "PolarityHigh" +}; + +/* UART serial bus endian */ + +const char *AcpiGbl_EdDecode[] = +{ + "LittleEndian", + "BigEndian" +}; + +/* UART serial bus bits per byte */ + +const char *AcpiGbl_BpbDecode[] = +{ + "DataBitsFive", + "DataBitsSix", + "DataBitsSeven", + "DataBitsEight", + "DataBitsNine", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */" +}; + +/* UART serial bus stop bits */ + +const char *AcpiGbl_SbDecode[] = +{ + "StopBitsZero", + "StopBitsOne", + "StopBitsOnePlusHalf", + "StopBitsTwo" +}; + +/* UART serial bus flow control */ + +const char *AcpiGbl_FcDecode[] = +{ + "FlowControlNone", + "FlowControlHardware", + "FlowControlXON", + "/* UNKNOWN flow control keyword */" +}; + +/* UART serial bus parity type */ + +const char *AcpiGbl_PtDecode[] = +{ + "ParityTypeNone", + "ParityTypeEven", + "ParityTypeOdd", + "ParityTypeMark", + "ParityTypeSpace", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */" +}; + +/* PinConfig type */ + +const char *AcpiGbl_PtypDecode[] = +{ + "Default", + "Bias Pull-up", + "Bias Pull-down", + "Bias Default", + "Bias Disable", + "Bias High Impedance", + "Bias Bus Hold", + "Drive Open Drain", + "Drive Open Source", + "Drive Push Pull", + "Drive Strength", + "Slew Rate", + "Input Debounce", + "Input Schmitt Trigger", +}; + +#endif diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index 978711a557ab5..8131cde2f834c 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -158,287 +158,6 @@ ACPI_MODULE_NAME ("utresrc") -#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) - -/* - * Strings used to decode resource descriptors. - * Used by both the disassembler and the debugger resource dump routines - */ -const char *AcpiGbl_BmDecode[] = -{ - "NotBusMaster", - "BusMaster" -}; - -const char *AcpiGbl_ConfigDecode[] = -{ - "0 - Good Configuration", - "1 - Acceptable Configuration", - "2 - Suboptimal Configuration", - "3 - ***Invalid Configuration***", -}; - -const char *AcpiGbl_ConsumeDecode[] = -{ - "ResourceProducer", - "ResourceConsumer" -}; - -const char *AcpiGbl_DecDecode[] = -{ - "PosDecode", - "SubDecode" -}; - -const char *AcpiGbl_HeDecode[] = -{ - "Level", - "Edge" -}; - -const char *AcpiGbl_IoDecode[] = -{ - "Decode10", - "Decode16" -}; - -const char *AcpiGbl_LlDecode[] = -{ - "ActiveHigh", - "ActiveLow", - "ActiveBoth", - "Reserved" -}; - -const char *AcpiGbl_MaxDecode[] = -{ - "MaxNotFixed", - "MaxFixed" -}; - -const char *AcpiGbl_MemDecode[] = -{ - "NonCacheable", - "Cacheable", - "WriteCombining", - "Prefetchable" -}; - -const char *AcpiGbl_MinDecode[] = -{ - "MinNotFixed", - "MinFixed" -}; - -const char *AcpiGbl_MtpDecode[] = -{ - "AddressRangeMemory", - "AddressRangeReserved", - "AddressRangeACPI", - "AddressRangeNVS" -}; - -const char *AcpiGbl_RngDecode[] = -{ - "InvalidRanges", - "NonISAOnlyRanges", - "ISAOnlyRanges", - "EntireRange" -}; - -const char *AcpiGbl_RwDecode[] = -{ - "ReadOnly", - "ReadWrite" -}; - -const char *AcpiGbl_ShrDecode[] = -{ - "Exclusive", - "Shared", - "ExclusiveAndWake", /* ACPI 5.0 */ - "SharedAndWake" /* ACPI 5.0 */ -}; - -const char *AcpiGbl_SizDecode[] = -{ - "Transfer8", - "Transfer8_16", - "Transfer16", - "InvalidSize" -}; - -const char *AcpiGbl_TrsDecode[] = -{ - "DenseTranslation", - "SparseTranslation" -}; - -const char *AcpiGbl_TtpDecode[] = -{ - "TypeStatic", - "TypeTranslation" -}; - -const char *AcpiGbl_TypDecode[] = -{ - "Compatibility", - "TypeA", - "TypeB", - "TypeF" -}; - -const char *AcpiGbl_PpcDecode[] = -{ - "PullDefault", - "PullUp", - "PullDown", - "PullNone" -}; - -const char *AcpiGbl_IorDecode[] = -{ - "IoRestrictionNone", - "IoRestrictionInputOnly", - "IoRestrictionOutputOnly", - "IoRestrictionNoneAndPreserve" -}; - -const char *AcpiGbl_DtsDecode[] = -{ - "Width8bit", - "Width16bit", - "Width32bit", - "Width64bit", - "Width128bit", - "Width256bit", -}; - -/* GPIO connection type */ - -const char *AcpiGbl_CtDecode[] = -{ - "Interrupt", - "I/O" -}; - -/* Serial bus type */ - -const char *AcpiGbl_SbtDecode[] = -{ - "/* UNKNOWN serial bus type */", - "I2C", - "SPI", - "UART" -}; - -/* I2C serial bus access mode */ - -const char *AcpiGbl_AmDecode[] = -{ - "AddressingMode7Bit", - "AddressingMode10Bit" -}; - -/* I2C serial bus slave mode */ - -const char *AcpiGbl_SmDecode[] = -{ - "ControllerInitiated", - "DeviceInitiated" -}; - -/* SPI serial bus wire mode */ - -const char *AcpiGbl_WmDecode[] = -{ - "FourWireMode", - "ThreeWireMode" -}; - -/* SPI serial clock phase */ - -const char *AcpiGbl_CphDecode[] = -{ - "ClockPhaseFirst", - "ClockPhaseSecond" -}; - -/* SPI serial bus clock polarity */ - -const char *AcpiGbl_CpoDecode[] = -{ - "ClockPolarityLow", - "ClockPolarityHigh" -}; - -/* SPI serial bus device polarity */ - -const char *AcpiGbl_DpDecode[] = -{ - "PolarityLow", - "PolarityHigh" -}; - -/* UART serial bus endian */ - -const char *AcpiGbl_EdDecode[] = -{ - "LittleEndian", - "BigEndian" -}; - -/* UART serial bus bits per byte */ - -const char *AcpiGbl_BpbDecode[] = -{ - "DataBitsFive", - "DataBitsSix", - "DataBitsSeven", - "DataBitsEight", - "DataBitsNine", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */" -}; - -/* UART serial bus stop bits */ - -const char *AcpiGbl_SbDecode[] = -{ - "StopBitsZero", - "StopBitsOne", - "StopBitsOnePlusHalf", - "StopBitsTwo" -}; - -/* UART serial bus flow control */ - -const char *AcpiGbl_FcDecode[] = -{ - "FlowControlNone", - "FlowControlHardware", - "FlowControlXON", - "/* UNKNOWN flow control keyword */" -}; - -/* UART serial bus parity type */ - -const char *AcpiGbl_PtDecode[] = -{ - "ParityTypeNone", - "ParityTypeEven", - "ParityTypeOdd", - "ParityTypeMark", - "ParityTypeSpace", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */" -}; - -#endif - - /* * Base sizes of the raw AML resource descriptors, indexed by resource type. * Zero indicates a reserved (and therefore invalid) resource type. @@ -479,8 +198,12 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] = ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64), ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64), ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO), - 0, + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION), ACPI_AML_SIZE_LARGE (AML_RESOURCE_COMMON_SERIALBUS), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG), }; const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[] = @@ -534,8 +257,12 @@ static const UINT8 AcpiGbl_ResourceTypes[] = ACPI_VARIABLE_LENGTH, /* 0A Qword* address */ ACPI_FIXED_LENGTH, /* 0B Extended* address */ ACPI_VARIABLE_LENGTH, /* 0C Gpio* */ - 0, - ACPI_VARIABLE_LENGTH /* 0E *SerialBus */ + ACPI_VARIABLE_LENGTH, /* 0D PinFunction */ + ACPI_VARIABLE_LENGTH, /* 0E *SerialBus */ + ACPI_VARIABLE_LENGTH, /* 0F PinConfig */ + ACPI_VARIABLE_LENGTH, /* 10 PinGroup */ + ACPI_VARIABLE_LENGTH, /* 11 PinGroupFunction */ + ACPI_VARIABLE_LENGTH, /* 12 PinGroupConfig */ }; @@ -580,7 +307,7 @@ AcpiUtWalkAmlResources ( * The absolute minimum resource template is one EndTag descriptor. * However, we will treat a lone EndTag as just a simple buffer. */ - if (AmlLength < sizeof (AML_RESOURCE_END_TAG)) + if (AmlLength <= sizeof (AML_RESOURCE_END_TAG)) { return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } @@ -613,8 +340,8 @@ AcpiUtWalkAmlResources ( if (UserFunction) { - Status = UserFunction (Aml, Length, Offset, - ResourceIndex, Context); + Status = UserFunction ( + Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -651,15 +378,10 @@ AcpiUtWalkAmlResources ( *Context = Aml; } - /* Check if buffer is defined to be longer than the resource length */ - - if (AmlLength > (Offset + Length)) - { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); - } - - /* Normal exit */ - + /* + * Normal exit. Note: We allow the buffer to be larger than + * the resource template, as long as the END_TAG exists. + */ return_ACPI_STATUS (AE_OK); } diff --git a/source/components/utilities/utxfmutex.c b/source/components/utilities/utxfmutex.c index 7a46452a885b2..2f93b108214c4 100644 --- a/source/components/utilities/utxfmutex.c +++ b/source/components/utilities/utxfmutex.c @@ -277,6 +277,8 @@ AcpiAcquireMutex ( return (Status); } +ACPI_EXPORT_SYMBOL (AcpiAcquireMutex) + /******************************************************************************* * @@ -317,3 +319,5 @@ AcpiReleaseMutex ( AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex); return (AE_OK); } + +ACPI_EXPORT_SYMBOL (AcpiReleaseMutex) |