acpi: extend aml_add() to accept target argument
authorIgor Mammedov <imammedo@redhat.com>
Wed, 9 Dec 2015 23:41:02 +0000 (00:41 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 22 Dec 2015 16:39:21 +0000 (18:39 +0200)
it allows to express following ASL expression:
 Add(arg1, arg2, result)

usecases that do not need to store result
should pass NULL as 3rd arg that would express
 Add(arg1, arg2,)
construct.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
hw/acpi/aml-build.c
hw/i386/acpi-build.c
include/hw/acpi/aml-build.h

index c661d587180fcb66a964d3cafa401af2fb1ac0ed..15bb5bdafe9a3cde130cca97e8070f230ede9564 100644 (file)
@@ -497,9 +497,9 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
-Aml *aml_add(Aml *arg1, Aml *arg2)
+Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst)
 {
-    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
+    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, dst);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
index 479b11ec4d7ddeece6c649e98960e3c925aa133d..16fb16861134a0237e1f4028a9ad110fdf18ae81 100644 (file)
@@ -670,7 +670,7 @@ static Aml *build_prt(void)
                    aml_store(aml_shiftright(pin, aml_int(2)), slot));
         /* lnk_idx = (slot + pin) & 3 */
         aml_append(while_ctx,
-                   aml_store(aml_and(aml_add(pin, slot), aml_int(3)), lnk_idx));
+            aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
 
         /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
         aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
index 4acc4d01a44b66080b703eefabd5f807a8a3944a..0769b35d911ed260d11bcf9692da366955fc373c 100644 (file)
@@ -230,7 +230,7 @@ Aml *aml_or(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
 Aml *aml_shiftright(Aml *arg1, Aml *count);
 Aml *aml_lless(Aml *arg1, Aml *arg2);
-Aml *aml_add(Aml *arg1, Aml *arg2);
+Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_increment(Aml *arg);
 Aml *aml_index(Aml *arg1, Aml *idx);
 Aml *aml_notify(Aml *arg1, Aml *arg2);