[PATCH v2 27/42] ACPICA: Executer: Resolve package index references used as integer operands
From: Maciej Wieczor-Retman
Date: Fri Nov 20 2026 - 12:22:38 EST
From: Leonard Lausen <leonard@xxxxxxxxx>
Resolving a Local or Arg retrieves its stored object but does not resolve
an Index reference stored there to the referenced package element. When
that reference is used as an integer operand, implicit conversion rejects
it with AE_AML_OPERAND_TYPE.
This prevents FAN0._FST on the Samsung Galaxy Book 930XDB from returning
status whenever the fan is running. The method stores an Index reference
into its fan-speed table in Local1 and then uses Add (Local1, 10, Local1).
Resolve a remaining package Index reference before integer conversion.
Release the replaced reference inside AcpiExResolveObjectToValue() - it
seems to be missing there with even a comment mentioning the
non-existant reference removal. Limit this to integer operands so Store,
CopyObject and method calls continue to preserve references. Leave
Increment and Decrement's synthetic operand resolution unchanged; their
reference-target handling requires a separate fix.
Add a standalone ASL regression covering local and argument inputs,
integer conversion, reference preservation, target replacement and invalid
operands. The extracted fan method also returns the expected status for
all defined fan states with this change.
Link: https://github.com/acpica/acpica/commit/aaa58f4b62a9
Link: https://github.com/open-acpica/acpica/issues/908
Signed-off-by: Leonard Lausen <leonard@xxxxxxxxx>
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
---
drivers/acpi/acpica/exresop.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 8127d4046d0b..87d04b74e13e 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -375,6 +375,32 @@ acpi_ex_resolve_operands(u16 opcode,
*/
case ARGI_INTEGER:
+ /*
+ * Resolving an Arg or Local can leave an Index reference to a
+ * package element. Resolve that element before integer conversion,
+ * without changing reference-preserving operands such as Store.
+ * Leave the synthetic operand resolution used by Increment and
+ * Decrement unchanged; those operators also need reference-target
+ * handling when writing their result.
+ */
+ if ((walk_state->opcode != AML_INCREMENT_OP) &&
+ (walk_state->opcode != AML_DECREMENT_OP) &&
+ (obj_desc->common.type ==
+ ACPI_TYPE_LOCAL_REFERENCE) &&
+ (obj_desc->reference.class ==
+ ACPI_REFCLASS_INDEX) &&
+ (obj_desc->reference.target_type ==
+ ACPI_TYPE_PACKAGE)) {
+ status = acpi_ex_resolve_to_value(stack_ptr,
+ walk_state);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
+ }
+
+ acpi_ut_remove_reference(obj_desc);
+ obj_desc = *stack_ptr;
+ }
+
/*
* Need an operand of type ACPI_TYPE_INTEGER, but we can
* implicitly convert from a STRING or BUFFER.
--
2.56.0