From patchwork Fri Apr 3 10:03:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 46746 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A44C3216D1 for ; Fri, 3 Apr 2015 10:08:24 +0000 (UTC) Received: by lajy8 with SMTP id y8sf23439902laj.3 for ; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Ha1l3vexdyxWrFJrgqixcY/GHPFP+jqVj2mN/PKdfwo=; b=Fnz48VTR1YArS7inUWvXrvyhcVjwCSS/fmA8IssbXzAV9C3KBsIDzKJFRDruq9txkD 06apcFoEk6DPmxLJ7Sj3TCw3qTVDoxWZAbKq8XOhIqaFRN98kC4CeslFF2RzMEXwpPSv 4ciJEMj7GJRBh/AYO6OA2gXQrHtO0dMHx+l10JYC5vPWQh7t5YH4pg8RjsF7cvVac06x 86BaRy/oCeI8VBRydOLfqZ/5X9HhG9wJOwXOSCeGEuu2ZJRVnFqHsmvP5Z+9LF8p1qnG uahmHBbNg+VJTXkR1PH0muLG95YYlSOEHCDCcVLikCeTbARQ/YxTo4FrnZUjLINY8eJA 0WhA== X-Gm-Message-State: ALoCoQl8nJ7O4QqnUrE2Bj72/d37oa/qPE2+zKZB4u12nr3vrKLncyenxPu3eeKPJKyM4HRJ4ABW X-Received: by 10.112.160.197 with SMTP id xm5mr418793lbb.15.1428055703606; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.134 with SMTP id d6ls292637laf.95.gmail; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) X-Received: by 10.152.87.233 with SMTP id bb9mr1530457lab.30.1428055703496; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id un5si1500535lbc.53.2015.04.03.03.08.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 03:08:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lahf3 with SMTP id f3so76628076lah.2 for ; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr1598671lac.56.1428055703231; Fri, 03 Apr 2015 03:08:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1858922lbq; Fri, 3 Apr 2015 03:08:22 -0700 (PDT) X-Received: by 10.140.107.72 with SMTP id g66mr1697676qgf.70.1428055702070; Fri, 03 Apr 2015 03:08:22 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 11si7677121qhq.97.2015.04.03.03.08.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Apr 2015 03:08:22 -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; Received: from localhost ([::1]:33279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyWS-0004hW-RB for patch@linaro.org; Fri, 03 Apr 2015 06:08:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyUi-0002DK-Po for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:06:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdyUe-0006Ru-EG for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:06:32 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:9661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyUd-0006Nw-Pm for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:06:28 -0400 Received: from 172.24.2.119 (EHLO szxeml425-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BDZ47779; Fri, 03 Apr 2015 18:05:49 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml425-hub.china.huawei.com (10.82.67.180) with Microsoft SMTP Server id 14.3.158.1; Fri, 3 Apr 2015 18:05:41 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Fri, 3 Apr 2015 18:03:37 +0800 Message-ID: <1428055432-12120-6-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.551E65FD.0126, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 93cbc700ab0cf83aebc36877db4f8907 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: hangaohuai@huawei.com, shannon.zhao@linaro.org, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v4 05/20] hw/acpi/aml-build: Add aml_interrupt() term 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Add aml_interrupt() for describing device interrupt in resource template. These can be used to generating DSDT table for ACPI on ARM. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/acpi/aml-build.c | 18 ++++++++++++++++++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 19 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index fefe7c7..bd1713c 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -527,6 +527,24 @@ Aml *aml_memory32_fixed(uint64_t addr, uint64_t size, uint8_t rw_flag) return var; } +/* + * ACPI 1.0: 6.4.3.6 Interrupt (Interrupt Resource Descriptor Macro) + */ +Aml *aml_interrupt(uint8_t irq_flags, int irq) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x89); /* Extended irq descriptor */ + build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */ + build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */ + build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */ + build_append_byte(var->buf, 0x01); /* Interrupt table length = 1 */ + build_append_byte(var->buf, irq & 0xff); /* Interrupt Number bits[7:0] */ + build_append_byte(var->buf, (irq >> 8) & 0xff); /* Interrupt Number bits[15:8] */ + build_append_byte(var->buf, (irq >> 16) & 0xff); /* Interrupt Number bits[23:16] */ + build_append_byte(var->buf, (irq >> 24) & 0xff); /* Interrupt Number bits[31:24] */ + return var; +} + /* ACPI 1.0b: 6.4.2.5 I/O Port Descriptor */ Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, uint8_t aln, uint8_t len) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index baa0652..315c729 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -163,6 +163,7 @@ Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3); Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4); Aml *aml_memory32_fixed(uint64_t addr, uint64_t size, uint8_t rw_flag); +Aml *aml_interrupt(uint8_t irq_flags, int irq); Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, uint8_t aln, uint8_t len); Aml *aml_operation_region(const char *name, AmlRegionSpace rs,