qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: qemu-devel@nongnu.org
Cc: seabios@seabios.org, kraxel@redhat.com, mst@redhat.com,
	quintela@redhat.com, agraf@suse.de, marcel@redhat.com,
	alex.williamson@redhat.com, kevin@koconnor.net,
	qemu-ppc@nongnu.org, hare@suse.de, imammedo@redhat.com,
	amit.shah@redhat.com, pbonzini@redhat.com, leon.alrae@imgtec.com,
	aurelien@aurel32.net, rth@twiddle.net
Subject: [Qemu-devel] [PATCH RFC V2 01/17] acpi: added needed acpi constructs
Date: Mon, 16 Feb 2015 11:54:01 +0200	[thread overview]
Message-ID: <1424080457-13752-2-git-send-email-marcel@redhat.com> (raw)
In-Reply-To: <1424080457-13752-1-git-send-email-marcel@redhat.com>

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
 hw/acpi/acpi-build-utils.c         | 107 +++++++++++++++++++++++++++++++++++--
 include/hw/acpi/acpi-build-utils.h |  12 +++++
 2 files changed, 116 insertions(+), 3 deletions(-)

diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
index 58f88cd..19cd146 100644
--- a/hw/acpi/acpi-build-utils.c
+++ b/hw/acpi/acpi-build-utils.c
@@ -439,6 +439,26 @@ AcpiAml acpi_and(AcpiAml arg1, AcpiAml arg2)
     return var;
 }
 
+AcpiAml acpi_or(AcpiAml arg1, AcpiAml arg2)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x7D); /* AndOp */
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+    build_append_int(var.buf, 0x00); /* NullNameOp */
+    return var;
+}
+
+AcpiAml acpi_add(AcpiAml arg1, AcpiAml arg2)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x72); /* AddOp */
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+    build_append_int(var.buf, 0x00); /* NullNameOp */
+    return var;
+}
+
 /* ACPI 5.0: 20.2.5.3 Type 1 Opcodes Encoding: DefNotify */
 AcpiAml acpi_notify(AcpiAml arg1, AcpiAml arg2)
 {
@@ -518,6 +538,53 @@ AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2)
     build_append_byte(var.buf, 0x93); /* LequalOp */
     aml_append(&var, arg1);
     aml_append(&var, arg2);
+    return var;
+}
+
+AcpiAml acpi_increment(AcpiAml arg1)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x75); /* LequalOp */
+    aml_append(&var, arg1);
+    return var;
+}
+
+AcpiAml acpi_lless(AcpiAml arg1, AcpiAml arg2)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x95); /* LequalOp */
+    aml_append(&var, arg1);
+    aml_append(&var, arg2);
+//    build_append_int(var.buf, 0x00); /* NullNameOp */
+    return var;
+}
+
+AcpiAml acpi_shiftright(AcpiAml arg1, int count)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x7A); /* RightShiftOp */
+    aml_append(&var, arg1);
+    aml_append(&var, acpi_int(count));
+    build_append_int(var.buf, 0x00); /* NullNameOp */
+    return var;
+}
+
+AcpiAml acpi_shiftleft(AcpiAml arg1, int count)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x79); /* RightLeftOp */
+    aml_append(&var, arg1);
+    aml_append(&var, acpi_int(count));
+    build_append_int(var.buf, 0x00); /* NullNameOp */
+    return var;
+}
+
+AcpiAml acpi_index(AcpiAml arg1, AcpiAml idx)
+{
+    AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+    build_append_byte(var.buf, 0x88); /* IndexOp */
+    aml_append(&var, arg1);
+    aml_append(&var, idx);
     build_append_int(var.buf, 0x00); /* NullNameOp */
     return var;
 }
@@ -530,6 +597,13 @@ AcpiAml acpi_if(AcpiAml predicate)
     return var;
 }
 
+AcpiAml acpi_while(AcpiAml predicate)
+{
+    AcpiAml var = aml_allocate_internal(0xA2 /* WhileOp */, PACKAGE);
+    aml_append(&var, predicate);
+    return var;
+}
+
 /* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefMethod */
 AcpiAml acpi_method(const char *name, int arg_count)
 {
@@ -652,14 +726,41 @@ AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...)
     return var;
 }
 
-/* ACPI 5.0: 20.2.6.2 Local Objects Encoding: Local0Op */
-AcpiAml acpi_local0(void)
+/* ACPI 5.0: 20.2.6.2 Local Objects Encoding: LocalXOp */
+static AcpiAml acpi_local(uint8_t index)
 {
     AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
-    build_append_byte(var.buf, 0x60); /* Local0Op */
+
+    assert(index < 8);
+    build_append_byte(var.buf, 0x60 + index); /* Local0Op */
     return var;
 }
 
+AcpiAml acpi_local0(void)
+{
+    return acpi_local(0);
+}
+
+AcpiAml acpi_local1(void)
+{
+    return acpi_local(1);
+}
+
+AcpiAml acpi_local2(void)
+{
+    return acpi_local(2);
+}
+
+AcpiAml acpi_local3(void)
+{
+    return acpi_local(3);
+}
+
+AcpiAml acpi_local4(void)
+{
+    return acpi_local(4);
+}
+
 /* ACPI 5.0: 20.2.5.4 Type 2 Opcodes Encoding: DefVarPackage */
 AcpiAml acpi_varpackage(uint32_t num_elements)
 {
diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
index 868d439..e39a82d 100644
--- a/include/hw/acpi/acpi-build-utils.h
+++ b/include/hw/acpi/acpi-build-utils.h
@@ -108,6 +108,8 @@ AcpiAml acpi_arg2(void);
 AcpiAml acpi_arg3(void);
 AcpiAml acpi_store(AcpiAml val, AcpiAml target);
 AcpiAml acpi_and(AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_or(AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_add(AcpiAml arg1, AcpiAml arg2);
 AcpiAml acpi_notify(AcpiAml arg1, AcpiAml arg2);
 AcpiAml acpi_call1(const char *method, AcpiAml arg1);
 AcpiAml acpi_call2(const char *method, AcpiAml arg1, AcpiAml arg2);
@@ -123,7 +125,16 @@ AcpiAml acpi_named_field(const char *name, unsigned length);
 AcpiAml acpi_reserved_field(unsigned length);
 AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...);
 AcpiAml acpi_local0(void);
+AcpiAml acpi_local1(void);
+AcpiAml acpi_local2(void);
+AcpiAml acpi_local3(void);
+AcpiAml acpi_local4(void);
+AcpiAml acpi_increment(AcpiAml arg1);
 AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_lless(AcpiAml arg1, AcpiAml arg2);
+AcpiAml acpi_index(AcpiAml arg1, AcpiAml idx);
+AcpiAml acpi_shiftright(AcpiAml arg1, int count);
+AcpiAml acpi_shiftleft(AcpiAml arg1, int count);
 AcpiAml GCC_FMT_ATTR(4, 5)
 acpi_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
                const char *name_format, ...);
@@ -155,6 +166,7 @@ AcpiAml acpi_def_block(const char *signature, uint8_t revision,
                        const char *oem_id, const char *oem_table_id,
                        uint32_t oem_revision);
 AcpiAml acpi_if(AcpiAml predicate);
+AcpiAml acpi_while(AcpiAml predicate);
 AcpiAml acpi_method(const char *name, int arg_count);
 AcpiAml GCC_FMT_ATTR(1, 2) acpi_scope(const char *name_format, ...);
 AcpiAml GCC_FMT_ATTR(1, 2) acpi_device(const char *name_format, ...);
-- 
2.1.0

  reply	other threads:[~2015-02-16  9:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16  9:54 [Qemu-devel] [PATCH RFC V2 00/17] hw/pc: implement multiple primary busses for pc machines Marcel Apfelbaum
2015-02-16  9:54 ` Marcel Apfelbaum [this message]
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 02/17] hw/acpi: add support for multiple root busses Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 03/17] hw/apci: add _PRT method for extra " Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 04/17] hw/acpi: add _CRS " Marcel Apfelbaum
2015-02-16 10:07   ` Igor Mammedov
2015-02-16 10:19     ` Marcel Apfelbaum
2015-02-16 11:37     ` Michael S. Tsirkin
2015-02-16 12:06   ` Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 05/17] hw/acpi: remove from root bus 0 the crs resources used by other busses Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 06/17] hw/pci: move pci bus related code to separate files Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 07/17] hw/pci: made pci_bus_is_root a PCIBusClass method Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 08/17] hw/pci: made pci_bus_num " Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 09/17] hw/pci: introduce TYPE_PCI_MAIN_HOST_BRIDGE interface Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 10/17] hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 11/17] hw/pci: implement iteration over multiple host bridges Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 12/17] hw/pci: introduce PCI Expander Bridge (PXB) Marcel Apfelbaum
2015-02-16 12:58   ` Alexander Graf
2015-02-16 13:00     ` Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 13/17] hw/pci: inform bios if the system has more than one pci bridge Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 14/17] hw/pci: piix - suport multiple host bridges Marcel Apfelbaum
2015-02-16 13:00   ` Alexander Graf
2015-02-16 13:29     ` Marcel Apfelbaum
2015-02-20 14:33       ` Alexander Graf
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 15/17] hw/pxb: add map_irq func Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 16/17] hw/pci_bus: add support for NUMA nodes Marcel Apfelbaum
2015-02-16  9:54 ` [Qemu-devel] [PATCH RFC V2 17/17] hw/pxb: add numa_node parameter Marcel Apfelbaum

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=1424080457-13752-2-git-send-email-marcel@redhat.com \
    --to=marcel@redhat.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=hare@suse.de \
    --cc=imammedo@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=kraxel@redhat.com \
    --cc=leon.alrae@imgtec.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=seabios@seabios.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).