diff options
author | msmith <msmith@FreeBSD.org> | 2000-10-28 07:32:13 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2000-10-28 07:32:13 +0000 |
commit | 430258152b8601480680cc4d82944ed03c5904de (patch) | |
tree | e9823e6db0e03f1c65a64d4e1fe9c661478e6ed9 /sys/contrib/dev | |
parent | e170b01108793ca1debcd3fea81f88832987d7a6 (diff) | |
download | FreeBSD-src-430258152b8601480680cc4d82944ed03c5904de.zip FreeBSD-src-430258152b8601480680cc4d82944ed03c5904de.tar.gz |
Some AML code assumes that a function without an explicit ReturnOp will
return the last value returned by a nested method call. This violates
the ACPI spec, but is implemented by the Microsoft interpreter, and thus
vendors can (and do) get away with it.
Intel's stance is that this is illegal and should not be supported.
As they put it, however, we have to live in the real world. So go ahead
and implement it.
Submitted by: Mitsaru IWASAKI <iwasaki@jp.freebsd.org>
Diffstat (limited to 'sys/contrib/dev')
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Parser/psparse.c | 19 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/psparse.c | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Parser/psparse.c b/sys/contrib/dev/acpica/Subsystem/Parser/psparse.c index 4951b7a..74a8cb6 100644 --- a/sys/contrib/dev/acpica/Subsystem/Parser/psparse.c +++ b/sys/contrib/dev/acpica/Subsystem/Parser/psparse.c @@ -1280,6 +1280,7 @@ AcpiPsParseAml ( ACPI_NAMESPACE_NODE *Node = NULL; ACPI_WALK_LIST *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_OPERAND_OBJECT *ReturnDesc; + ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL; ACPI_OPERAND_OBJECT *MthDesc = NULL; ACPI_NAMESPACE_NODE *StartNode; @@ -1424,6 +1425,14 @@ AcpiPsParseAml ( ReturnDesc = WalkState->ReturnDesc; + /* Save the last effective return value */ + + if (CallerReturnDesc && ReturnDesc) + { + EffectiveReturnDesc = ReturnDesc; + AcpiCmAddReference (EffectiveReturnDesc); + } + DEBUG_PRINT (TRACE_PARSE, ("PsParseAml: ReturnValue=%p, State=%p\n", WalkState->ReturnDesc, WalkState)); @@ -1472,6 +1481,16 @@ AcpiPsParseAml ( else if (CallerReturnDesc) { + /* + * Some AML code expects return value w/o ReturnOp. + * Return the saved effective return value instead. + */ + + if (ReturnDesc == NULL && EffectiveReturnDesc != NULL) + { + AcpiCmRemoveReference (ReturnDesc); + ReturnDesc = EffectiveReturnDesc; + } *CallerReturnDesc = ReturnDesc; /* NULL if no return value */ } diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 4951b7a..74a8cb6 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1280,6 +1280,7 @@ AcpiPsParseAml ( ACPI_NAMESPACE_NODE *Node = NULL; ACPI_WALK_LIST *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_OPERAND_OBJECT *ReturnDesc; + ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL; ACPI_OPERAND_OBJECT *MthDesc = NULL; ACPI_NAMESPACE_NODE *StartNode; @@ -1424,6 +1425,14 @@ AcpiPsParseAml ( ReturnDesc = WalkState->ReturnDesc; + /* Save the last effective return value */ + + if (CallerReturnDesc && ReturnDesc) + { + EffectiveReturnDesc = ReturnDesc; + AcpiCmAddReference (EffectiveReturnDesc); + } + DEBUG_PRINT (TRACE_PARSE, ("PsParseAml: ReturnValue=%p, State=%p\n", WalkState->ReturnDesc, WalkState)); @@ -1472,6 +1481,16 @@ AcpiPsParseAml ( else if (CallerReturnDesc) { + /* + * Some AML code expects return value w/o ReturnOp. + * Return the saved effective return value instead. + */ + + if (ReturnDesc == NULL && EffectiveReturnDesc != NULL) + { + AcpiCmRemoveReference (ReturnDesc); + ReturnDesc = EffectiveReturnDesc; + } *CallerReturnDesc = ReturnDesc; /* NULL if no return value */ } |