Re: [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep()

2015-12-10 Thread Marcel Apfelbaum

On 12/10/2015 01:41 AM, Igor Mammedov wrote:

Signed-off-by: Igor Mammedov 
---
  hw/acpi/aml-build.c | 10 ++
  include/hw/acpi/aml-build.h |  1 +
  2 files changed, 11 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 6a63477..e36b546 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1123,6 +1123,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;
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index cd3f3b7..944b001 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -263,6 +263,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);




Reviewed-by: Marcel Apfelbaum 



[Qemu-devel] [PATCH 14/74] acpi: add aml_sleep()

2015-12-09 Thread Igor Mammedov
Signed-off-by: Igor Mammedov 
---
 hw/acpi/aml-build.c | 10 ++
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 6a63477..e36b546 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1123,6 +1123,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;
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index cd3f3b7..944b001 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -263,6 +263,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);
-- 
1.8.3.1