From patchwork Thu Oct 29 14:27:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 55783 Delivered-To: patch@linaro.org Received: by 10.202.175.130 with SMTP id y124csp455993oie; Thu, 29 Oct 2015 07:31:57 -0700 (PDT) X-Received: by 10.55.49.10 with SMTP id x10mr2715869qkx.45.1446129117215; Thu, 29 Oct 2015 07:31:57 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 65si1436590qht.109.2015.10.29.07.31.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Oct 2015 07:31:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([::1]:44408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroFA-0003ON-Px for patch@linaro.org; Thu, 29 Oct 2015 10:31:56 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JF6sHzCE2Qcgb/eni2ldMRSE4svddFfFldwUbTx031w=; b=dvRHxLtfdap9Vnr0WxnAd5iUIdeD2593Eux9iEIkenn2u59dECvImOnzUBXuSNUdkM KGckqc4KOmWRu2l9HW3UusFnEhtRXNry2ejcRWt9CaOKGg9o9HXv6jxPcxncy3iYJ4GX Hu6jMASVoDsZt11p9lQ4T7lDSO6BaQDRLoj4oeMwomC1mn8Og/SHtb/NJk5N/+pqpPsx 14gVD8cGBCwzAa8gpKEqQPl0PXWbt4e8sebFR9ps5cMSjQwi9lKA2Xhl8Fu+c/akxlUo VOCBGdRiLIwCwJ6VZQBEGTYn/Jr658KA9L5T2hhLB5CBTJiLj64UGeIVMgWox7I84N/t l4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JF6sHzCE2Qcgb/eni2ldMRSE4svddFfFldwUbTx031w=; b=bvdfDKWT8TyjwHhIYvQAkRdHXfhKV0YC4Psv/cdZnNnmlG5DlRnqW3iMbJRGA7cfoV CiI4duPSpBk6qP7+KQCa/AIYh3q3I9zDrCALAys2LgOA0xdJW/zNSv3nLkM3FeYIE4Rc vVv5ccBKnYqr4EaiMFWg2oqVxU4X6SXnnzNV1c4yyprkJyChwbGxU5g7NpyeCAPuFKRF pQWTBZ7Zr14LUdWfXEb+5aJrXK2bPjzhz5XKabN+NJBlmWHQwVHKkGA4uTctMxRUrBvY g6vA/ynSkxo8fBJ8whGJUyKGz5Z27+sEpJLyAtKNNUC/QD4q7hYR+rOdp+UjMZwtWtMm pS1A== X-Gm-Message-State: ALoCoQl1FBzlC5cuqgZHYFHHlpBL8flA2WUbTEbnFXEXovOHCVASysAr3H5mvu4Rqr/MTppII6O0 X-Received: by 10.68.221.133 with SMTP id qe5mr2220748pbc.93.1446128939756; Thu, 29 Oct 2015 07:28:59 -0700 (PDT) Received: from localhost.localdomain ([180.150.157.4]) by smtp.gmail.com with ESMTPSA id a5sm1805986pbu.55.2015.10.29.07.28.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 07:28:59 -0700 (PDT) From: Shannon Zhao To: qemu-devel@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, imammedo@redhat.com Date: Thu, 29 Oct 2015 22:27:30 +0800 Message-Id: <1446128855-26637-4-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446128855-26637-1-git-send-email-shannon.zhao@linaro.org> References: <1446128855-26637-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::232 Cc: zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v2 3/8] hw/arm/virt-acpi-build: Add power button device in ACPI DSDT table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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(+) -- 2.1.0 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);