From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroCO-0008DO-Ah for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZroCK-0000JP-BH for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:29:04 -0400 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:34638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroCK-0000JL-6n for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:29:00 -0400 Received: by padhk11 with SMTP id hk11so42632115pad.1 for ; Thu, 29 Oct 2015 07:28:59 -0700 (PDT) From: Shannon Zhao Date: Thu, 29 Oct 2015 22:27:30 +0800 Message-Id: <1446128855-26637-4-git-send-email-shannon.zhao@linaro.org> In-Reply-To: <1446128855-26637-1-git-send-email-shannon.zhao@linaro.org> References: <1446128855-26637-1-git-send-email-shannon.zhao@linaro.org> Subject: [Qemu-devel] [PATCH v2 3/8] hw/arm/virt-acpi-build: Add power button device in ACPI DSDT table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, imammedo@redhat.com Cc: zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Add power button device in ACPI DSDT table. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- 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 ffb9b91..80ce51c 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -339,6 +339,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) @@ -553,6 +565,7 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) guest_info->use_highmem); acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO], (irqmap[VIRT_GPIO] + ARM_SPI_BASE)); + acpi_dsdt_add_power_button(scope); aml_append(dsdt, scope); -- 2.1.0