From patchwork Thu Oct 29 14:27:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 55781 Delivered-To: patch@linaro.org Received: by 10.202.175.130 with SMTP id y124csp454934oie; Thu, 29 Oct 2015 07:29:59 -0700 (PDT) X-Received: by 10.140.219.198 with SMTP id p189mr2771198qhb.80.1446128998545; Thu, 29 Oct 2015 07:29:58 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h51si1431719qgh.97.2015.10.29.07.29.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Oct 2015 07:29:58 -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]:44390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroDG-0000UO-3P for patch@linaro.org; Thu, 29 Oct 2015 10:29:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroCG-00082e-NQ for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:28:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZroCF-0000Ga-Mw for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:28:56 -0400 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:33478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroCF-0000G0-Hr for qemu-devel@nongnu.org; Thu, 29 Oct 2015 10:28:55 -0400 Received: by padhy1 with SMTP id hy1so36658598pad.0 for ; Thu, 29 Oct 2015 07:28:54 -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=rRheGgvLYcXC1qSRhCVz5P9dMYCzGQ9yCC7lmXMYIbs=; b=AIn5jDoXVqeFFExhMknI2MH6vY0qpPgF53ryiM9BQ205M6lVGR2qavVuFedzuk9irW 5w1fAeALkvKfvYAYyJYn3H51UEtgUVdcAFyBFk+vb/bsAT1f+tMa5SM5+iq1Os+sXr0x QxVHEFL6Psewy6nK+dfu6vTwyP6JsbtqiuFMG7JR6g5uRdoGefpDZ2TDt5SY3P6EIYik fNc1kshwUOaglN9RlqrUP38VbL2o9w/KOc3ai+rlVgPEQWQ90Nz0dJka2owSfAv3nbTt I6o/AvAoVE0ua2Y1p7nP3GboMub7QbR2VQimz7OzAotkRElaCB1aX7bkuHn7zgjSfxpz KNxw== 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=rRheGgvLYcXC1qSRhCVz5P9dMYCzGQ9yCC7lmXMYIbs=; b=A74q1Ai7wwPBMD/X6ggeZW/mTCbv6uWKHQfq7QBzmkDmdAWpmy/T0w0I2s+DvAIwHG eaoi67ezfiz8s6nlSxc2zLrZrxeStidHlQ8FnctEKZUErcSE36gKVTzL8zbPVA5koCJq oUFUQCcIqWbvyrZf3gl/vwCDqkAyuoJnXVQ7jXPWyW/91upiHrbrkN8QTzlPe0o/jKN0 QquaVwcMF/e38BLz4CAKu4KAnG8a9LEsyLDJt98XW1WN+79PPF0EgsK0num5ZPuLL/0J M7hTl8LFDblH1MqHAfUrjMvPPwNgMswKP+APLDi2OWksyb2ln5KTt7+863NrZBxc0PWd xSNQ== X-Gm-Message-State: ALoCoQliW+fAItu5efy0Rvu8tG/mvl4ExsgV1SoZ6ToG3Vjk/YlGqY1Y/UIf8qPRAMjpLFkFwpef X-Received: by 10.68.139.100 with SMTP id qx4mr2204901pbb.145.1446128934825; Thu, 29 Oct 2015 07:28:54 -0700 (PDT) Received: from localhost.localdomain ([180.150.157.4]) by smtp.gmail.com with ESMTPSA id a5sm1805986pbu.55.2015.10.29.07.28.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 07:28:53 -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:29 +0800 Message-Id: <1446128855-26637-3-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::22c Cc: zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v2 2/8] hw/arm/virt-acpi-build: Add GPIO controller 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 GPIO controller in ACPI DSDT table. It can be used for gpio event. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.1.0 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 1aaff1f..ffb9b91 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -322,6 +322,23 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq, aml_append(scope, dev); } +static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap, + int gpio_irq) +{ + Aml *dev = aml_device("GPO0"); + aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0061"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(0))); + + Aml *crs = aml_resource_template(); + aml_append(crs, aml_memory32_fixed(gpio_memmap->base, gpio_memmap->size, + AML_READ_WRITE)); + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_EDGE, AML_ACTIVE_HIGH, + AML_EXCLUSIVE, gpio_irq)); + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); +} + /* RSDP */ static GArray * build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) @@ -534,6 +551,8 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE), guest_info->use_highmem); + acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO], + (irqmap[VIRT_GPIO] + ARM_SPI_BASE)); aml_append(dsdt, scope);