qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: shannon.zhao@linaro.org
To: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	imammedo@redhat.com, mst@redhat.com, pbonzini@redhat.com,
	wei@redhat.com, arnd@arndb.de, christoffer.dall@linaro.org
Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com,
	zhaoshenglong@huawei.com
Subject: [Qemu-devel] [PATCH 3/7] hw/arm/virt-acpi-build: Add power button device in ACPI DSDT table
Date: Tue, 12 May 2015 12:24:12 +0800	[thread overview]
Message-ID: <1431404656-7180-4-git-send-email-shannon.zhao@linaro.org> (raw)
In-Reply-To: <1431404656-7180-1-git-send-email-shannon.zhao@linaro.org>

From: Shannon Zhao <shannon.zhao@linaro.org>

Add power button device in ACPI DSDT table.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/arm/virt-acpi-build.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index e505c16..b582047 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -319,6 +319,18 @@ static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap,
     aml_append(scope, dev);
 }
 
+static void acpi_dsdt_add_power_button(Aml *scope)
+{
+    Aml *dev = aml_device("PWRB");
+    aml_append(dev, aml_name_decl("_HID", aml_string("PNP0C0C")));
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
+    aml_append(dev, aml_name_decl("_UID", aml_int(0)));
+    Aml *method = aml_method("_STA", 0);
+    aml_append(method, aml_return(aml_int(0x0F)));
+    aml_append(dev, method);
+    aml_append(scope, dev);
+}
+
 /* RSDP */
 static GArray *
 build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
@@ -475,6 +487,7 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
                                 irqmap[VIRT_MMIO], NUM_VIRTIO_TRANSPORTS);
     acpi_dsdt_add_pci(scope, guest_info->pcie_info, irqmap[VIRT_PCIE]);
     acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO], irqmap[VIRT_GPIO]);
+    acpi_dsdt_add_power_button(scope);
 
     aml_append(dsdt, scope);
 
-- 
2.1.0

  parent reply	other threads:[~2015-05-12  4:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12  4:24 [Qemu-devel] [PATCH 0/7] Add system_powerdown support on ARM through ACPI and DT shannon.zhao
2015-05-12  4:24 ` [Qemu-devel] [PATCH 1/7] hw/arm/virt: Add a GPIO controller shannon.zhao
2015-05-12  4:24 ` [Qemu-devel] [PATCH 2/7] hw/arm/virt-acpi-build: Add GPIO controller in ACPI DSDT table shannon.zhao
2015-05-12  4:24 ` shannon.zhao [this message]
2015-05-12  4:24 ` [Qemu-devel] [PATCH 4/7] hw/acpi/aml-build: Add aml_gpio_int() term shannon.zhao
2015-05-31 18:13   ` Michael S. Tsirkin
2015-05-31 18:21     ` Michael S. Tsirkin
2015-06-01  3:48       ` Shannon Zhao
2015-05-12  4:24 ` [Qemu-devel] [PATCH 5/7] hw/arm/virt-acpi-build: Add _E03 for Power Button shannon.zhao
2015-05-12  4:24 ` [Qemu-devel] [PATCH 6/7] hw/arm/virt: Add QEMU powerdown notifier and hook it to GPIO Pin 3 shannon.zhao
2015-05-12  4:24 ` [Qemu-devel] [PATCH 7/7] hw/arm/virt: Add gpio-keys node for Poweroff using DT shannon.zhao

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=1431404656-7180-4-git-send-email-shannon.zhao@linaro.org \
    --to=shannon.zhao@linaro.org \
    --cc=arnd@arndb.de \
    --cc=christoffer.dall@linaro.org \
    --cc=hangaohuai@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wei@redhat.com \
    --cc=zhaoshenglong@huawei.com \
    /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).