acpi: add aml_sleep()
authorIgor Mammedov <imammedo@redhat.com>
Wed, 9 Dec 2015 23:41:08 +0000 (00:41 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 22 Dec 2015 16:39:21 +0000 (18:39 +0200)
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
include/hw/acpi/aml-build.h

index 210588a6dfc99aba5a5cc50485278f59dd5ed936..1d49c19798117463d4c294b77fa9a415902d8b79 100644 (file)
@@ -1228,6 +1228,16 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                              addr_trans, len, flags);
 }
 
+/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */
+Aml *aml_sleep(uint64_t msec)
+{
+    Aml *var = aml_alloc();
+    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
+    build_append_byte(var->buf, 0x22); /* SleepOp */
+    aml_append(var, aml_int(msec));
+    return var;
+}
+
 static uint8_t Hex2Byte(const char *src)
 {
     int hi, lo;
index d9ec6d6a467cd0dd50088b5ea2441332402618f7..3525fe9a1793a7a4caafdefe8078e5e9a238547e 100644 (file)
@@ -296,6 +296,7 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                       uint64_t addr_gran, uint64_t addr_min,
                       uint64_t addr_max, uint64_t addr_trans,
                       uint64_t len);
+Aml *aml_sleep(uint64_t msec);
 
 /* Block AML object primitives */
 Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);