qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [RFC PATCH 1/4] acpi: aml: add aml_register()
Date: Wed,  8 Aug 2018 17:15:46 +0200	[thread overview]
Message-ID: <1533741349-199141-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1533741349-199141-1-git-send-email-imammedo@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>

Based on a patch by Igor Mammedov.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/acpi/aml-build.h |  5 +++++
 hw/acpi/aml-build.c         | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 6c36903..10c7946 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -346,6 +346,11 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                       uint64_t len);
 Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz,
              uint8_t channel);
+Aml *aml_register(AmlAddressSpace as,
+                  uint8_t bit_width,
+                  uint8_t bit_offset,
+                  uint64_t address,
+                  uint8_t access_size);
 Aml *aml_sleep(uint64_t msec);
 
 /* Block AML object primitives */
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 1e43cd7..def62b3 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -874,6 +874,27 @@ Aml *aml_irq_no_flags(uint8_t irq)
     return var;
 }
 
+/*
+ * ACPI: 2.0: 16.2.4.16 ASL Macro for Generic Register Descriptor
+ *
+ * access_size comes from:
+ *     ACPI 3.0: 17.5.98 Register (Generic Register Resource Descriptor Macro)
+ */
+Aml *aml_register(AmlAddressSpace as,
+                  uint8_t bit_width,
+                  uint8_t bit_offset,
+                  uint64_t address,
+                  uint8_t access_size)
+{
+    Aml *var = aml_alloc();
+
+    build_append_byte(var->buf, 0x82);        /* Generic Register Descriptor */
+    build_append_byte(var->buf, 0x0C);        /* Length, bits[7:0] */
+    build_append_byte(var->buf, 0x0);         /* Length, bits[15:8] */
+    build_append_gas(var->buf, as, bit_width, bit_offset, access_size, address);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLNot */
 Aml *aml_lnot(Aml *arg)
 {
-- 
2.7.4

  reply	other threads:[~2018-08-08 15:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 15:15 [Qemu-devel] [RFC PATCH 0/4] "pc: acpi: _CST support" Igor Mammedov
2018-08-08 15:15 ` Igor Mammedov [this message]
2018-08-08 15:15 ` [Qemu-devel] [RFC PATCH 2/4] acpi: add aml_create_byte_field() Igor Mammedov
2018-08-08 15:15 ` [Qemu-devel] [RFC PATCH 3/4] pc: acpi: add _CST support Igor Mammedov
2018-08-08 20:17   ` Michael S. Tsirkin
2018-08-09 10:00     ` Igor Mammedov
2018-08-09 23:01       ` Michael S. Tsirkin
2018-08-15 13:25         ` Igor Mammedov
2018-08-15 13:25         ` [Qemu-devel] [PATCH " Igor Mammedov
2018-08-08 15:15 ` [Qemu-devel] [RFC PATCH 4/4] acpi: add support for CST update notification Igor Mammedov
2018-08-08 20:20 ` [Qemu-devel] [RFC PATCH 0/4] "pc: acpi: _CST support" Michael S. Tsirkin
2018-08-09 10:13   ` Igor Mammedov
2018-08-09 23:09     ` Michael S. Tsirkin
2018-08-15 13:21       ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533741349-199141-2-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).