diff options
author | njl <njl@FreeBSD.org> | 2003-12-09 02:55:47 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-12-09 02:55:47 +0000 |
commit | 088e0f7b51a9155a23d1a3b7074145ba2e1003f0 (patch) | |
tree | 2616229aa03aca5c7bb4fbb76ec93ea8c4324b79 | |
parent | 5171c4ac8892785ece7917adf7766e9d072d2b59 (diff) | |
download | FreeBSD-src-088e0f7b51a9155a23d1a3b7074145ba2e1003f0.zip FreeBSD-src-088e0f7b51a9155a23d1a3b7074145ba2e1003f0.tar.gz |
Local change: emulate a ReturnOp if the AML expects one but it isn't
present. Some buggy BIOSs do not have a ReturnOp even though it is
required for a function to return a value.
-rw-r--r-- | sys/contrib/dev/acpica/psparse.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index ce6f530..f7fd158 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 139 $ + * $Revision: 142 $ * *****************************************************************************/ @@ -534,7 +534,6 @@ AcpiPsParseLoop ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - ParserState = &WalkState->ParserState; WalkState->ArgTypes = 0; @@ -604,8 +603,8 @@ AcpiPsParseLoop ( { /* Get the next opcode from the AML stream */ - WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); WalkState->Opcode = AcpiPsPeekOpcode (ParserState); /* @@ -830,16 +829,15 @@ AcpiPsParseLoop ( WalkState->ArgTypes = 0; break; - default: - /* Op is not a constant or string, append each argument */ + /* Op is not a constant or string, append each argument to the Op */ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) { - WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); Status = AcpiPsGetNextArg (WalkState, ParserState, GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) @@ -855,24 +853,24 @@ AcpiPsParseLoop ( INCREMENT_ARG_LIST (WalkState->ArgTypes); } + /* Special processing for certain opcodes */ + switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: - /* For a method, save the length and address of the body */ - /* - * Skip parsing of control method or opregion body, + * Skip parsing of control method * because we don't have enough info in the first pass - * to parse them correctly. + * to parse it correctly. + * + * Save the length and address of the body */ Op->Named.Data = ParserState->Aml; Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml); - /* - * Skip body of method. For OpRegions, we must continue - * parsing because the opregion is not a standalone - * package (We don't know where the end is). - */ + + /* Skip body of method */ + ParserState->Aml = ParserState->PkgEnd; WalkState->ArgCount = 0; break; @@ -886,15 +884,15 @@ AcpiPsParseLoop ( (WalkState->DescendingCallback != AcpiDsExecBeginOp)) { /* - * Skip parsing of + * Skip parsing of Buffers and Packages * because we don't have enough info in the first pass * to parse them correctly. */ Op->Named.Data = AmlOpStart; Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart); - /* - * Skip body - */ + + /* Skip body */ + ParserState->Aml = ParserState->PkgEnd; WalkState->ArgCount = 0; } @@ -909,6 +907,7 @@ AcpiPsParseLoop ( break; default: + /* No action for all other opcodes */ break; } @@ -1212,9 +1211,10 @@ AcpiPsParseAml ( ACPI_THREAD_STATE *Thread; ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_WALK_STATE *PreviousWalkState; +#ifndef ACPICA_PEDANTIC ACPI_OPERAND_OBJECT **CallerReturnDesc = WalkState->CallerReturnDesc; ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL; - +#endif ACPI_FUNCTION_TRACE ("PsParseAml"); @@ -1290,6 +1290,8 @@ AcpiPsParseAml ( /* We are done with this walk, move on to the parent if any */ WalkState = AcpiDsPopWalkState (Thread); + +#ifndef ACPICA_PEDANTIC /* Save the last effective return value */ if (CallerReturnDesc && WalkState->ReturnDesc) @@ -1298,6 +1300,7 @@ AcpiPsParseAml ( EffectiveReturnDesc = WalkState->ReturnDesc; AcpiUtAddReference (EffectiveReturnDesc); } +#endif /* Reset the current scope to the beginning of scope stack */ @@ -1361,8 +1364,9 @@ AcpiPsParseAml ( */ else if (PreviousWalkState->CallerReturnDesc) { +#ifndef ACPICA_PEDANTIC /* - * Some AML code expects return value w/o ReturnOp. + * Some AML code expects a return value without a ReturnOp. * Return the saved effective return value instead. */ @@ -1371,6 +1375,7 @@ AcpiPsParseAml ( PreviousWalkState->ReturnDesc = EffectiveReturnDesc; AcpiUtAddReference (PreviousWalkState->ReturnDesc); } +#endif *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */ } @@ -1386,7 +1391,9 @@ AcpiPsParseAml ( /* Normal exit */ +#ifndef ACPICA_PEDANTIC AcpiUtRemoveReference (EffectiveReturnDesc); +#endif AcpiExReleaseAllMutexes (Thread); AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread)); AcpiGbl_CurrentWalkList = PrevWalkList; |