diff options
Diffstat (limited to 'sys/contrib/dev/acpica/psargs.c')
-rw-r--r-- | sys/contrib/dev/acpica/psargs.c | 82 |
1 files changed, 60 insertions, 22 deletions
diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c index e1e5346..1b9e1a4 100644 --- a/sys/contrib/dev/acpica/psargs.c +++ b/sys/contrib/dev/acpica/psargs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 64 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -188,6 +188,7 @@ AcpiPsGetNextPackageLength ( break; default: + /* Can't get here, only 2 bits / 4 cases */ break; } @@ -220,6 +221,8 @@ AcpiPsGetNextPackageEnd ( ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd"); + /* Function below changes ParserState->Aml */ + Length = (NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState); return_PTR (Start + Length); /* end of package */ @@ -280,21 +283,21 @@ AcpiPsGetNextNamestring ( /* Two name segments */ - End += 9; + End += 1 + (2 * ACPI_NAME_SIZE); break; case AML_MULTI_NAME_PREFIX_OP: /* Multiple name segments, 4 chars each */ - End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * 4); + End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * ACPI_NAME_SIZE); break; default: /* Single name segment */ - End += 4; + End += ACPI_NAME_SIZE; break; } @@ -311,8 +314,8 @@ AcpiPsGetNextNamestring ( * Arg - Where the namepath will be stored * ArgCount - If the namepath points to a control method * the method's argument is returned here. - * MethodCall - Whether the namepath can be the start - * of a method call + * MethodCall - Whether the namepath can possibly be the + * start of a method call * * RETURN: Status * @@ -326,9 +329,9 @@ AcpiPsGetNextNamestring ( ACPI_STATUS AcpiPsGetNextNamepath ( + ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, - UINT32 *ArgCount, BOOLEAN MethodCall) { NATIVE_CHAR *Path; @@ -365,14 +368,17 @@ AcpiPsGetNextNamepath ( * object (MUST BE mode EXECUTE to perform upsearch) */ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - &Node); + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_SUCCESS (Status) && MethodCall) { if (Node->Type == ACPI_TYPE_METHOD) { + /* + * This name is actually a control method invocation + */ MethodDesc = AcpiNsGetAttachedObject (Node); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path)); NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); @@ -384,7 +390,6 @@ AcpiPsGetNextNamepath ( /* Change arg into a METHOD CALL and attach name to it */ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); - NameOp->Common.Value.Name = Path; /* Point METHODCALL/NAME to the METHOD Node */ @@ -394,15 +399,19 @@ AcpiPsGetNextNamepath ( if (!MethodDesc) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n", + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Control Method - %p has no attached object\n", Node)); return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Control Method - %p Args %X\n", Node, MethodDesc->Method.ParamCount)); - *ArgCount = MethodDesc->Method.ParamCount; + /* Get the number of arguments to expect */ + + WalkState->ArgCount = MethodDesc->Method.ParamCount; return_ACPI_STATUS (AE_OK); } @@ -412,6 +421,32 @@ AcpiPsGetNextNamepath ( * (See code below) */ } + + if (ACPI_FAILURE (Status)) + { + /* + * 1) Any error other than NOT_FOUND is always severe + * 2) NOT_FOUND is only important if we are executing a method. + * 3) If executing a CondRefOf opcode, NOT_FOUND is ok. + */ + if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) && + (Status == AE_NOT_FOUND) && + (WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) || + + (Status != AE_NOT_FOUND)) + { + ACPI_REPORT_NSERROR (Path, Status); + } + else + { + /* + * We got a NOT_FOUND during table load or we encountered + * a CondRefOf(x) where the target does not exist. + * -- either case is ok + */ + Status = AE_OK; + } + } } /* @@ -514,6 +549,7 @@ AcpiPsGetNextSimpleArg ( default: + ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType)); break; } @@ -539,7 +575,7 @@ AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + ParserState->AmlStart); ACPI_PARSE_OBJECT *Field; UINT16 Opcode; UINT32 Name; @@ -591,7 +627,7 @@ AcpiPsGetNextField ( ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml); AcpiPsSetName (Field, Name); - ParserState->Aml += 4; + ParserState->Aml += ACPI_NAME_SIZE; /* Get the length which is encoded as a package length */ @@ -620,6 +656,7 @@ AcpiPsGetNextField ( break; default: + /* Opcode was set in previous switch */ break; } @@ -646,9 +683,9 @@ AcpiPsGetNextField ( ACPI_STATUS AcpiPsGetNextArg ( + ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, UINT32 ArgType, - UINT32 *ArgCount, ACPI_PARSE_OBJECT **ReturnArg) { ACPI_PARSE_OBJECT *Arg = NULL; @@ -736,7 +773,8 @@ AcpiPsGetNextArg ( /* Fill in bytelist data */ - Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml); + Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, + ParserState->Aml); Arg->Named.Data = ParserState->Aml; /* Skip to End of byte data */ @@ -763,13 +801,13 @@ AcpiPsGetNextArg ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiPsGetNextNamepath (ParserState, Arg, ArgCount, 0); + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); } else { /* single complex argument, nothing returned */ - *ArgCount = 1; + WalkState->ArgCount = 1; } break; @@ -779,7 +817,7 @@ AcpiPsGetNextArg ( /* single complex argument, nothing returned */ - *ArgCount = 1; + WalkState->ArgCount = 1; break; @@ -791,7 +829,7 @@ AcpiPsGetNextArg ( { /* non-empty list of variable arguments, nothing returned */ - *ArgCount = ACPI_VAR_ARGS; + WalkState->ArgCount = ACPI_VAR_ARGS; } break; |