From patchwork Tue Nov 19 06:18:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 21600 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DFE5F20972 for ; Tue, 19 Nov 2013 06:17:13 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 5sf241552qeb.11 for ; Mon, 18 Nov 2013 22:17:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=dACFcLKX6uo2IKIBP74s+yGxSxN9pelgnYaNdkZKXlE=; b=BRikpNHcSlg0L3hPH3sN/xCqS9cBXCN5SrlDACdSafhUlqE1YXLriTa+q5sj4nbOsF 6sK8tNd62O2yItWhIe2n8e8RZuuv9hws/7R2urlgdMLQ1xW+TmO3Eyb2dCaeo/MLKmVz eHtAnQctSKBHUZOssLfW0KlStOG6oI4FzP2KsknvzwKjCSOO90i6v4OXNFa96GxdLbq7 aojKsrsI8HX47UHb8odVYgOybK8leOG0OGk6jH0R7Iiy6sgoyG3LJQH3Z4u/SPya/mkA SRLncMIfTi9Vsm8anmqyEQ6jJgCun9XFN+Y7DJrauG41d2B7EW3SwUL0tcoNilhLK17g oQFA== X-Gm-Message-State: ALoCoQm6OAeXwlJFoHZH2WAf+N98c/FE8Ysa9XF53lQTg/kDFtH9P+P6cvK2J0OpQtjwcNW5r+Z+ X-Received: by 10.58.128.33 with SMTP id nl1mr9825880veb.28.1384841833741; Mon, 18 Nov 2013 22:17:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.36.225 with SMTP id t1ls2101696qej.11.gmail; Mon, 18 Nov 2013 22:17:13 -0800 (PST) X-Received: by 10.220.174.200 with SMTP id u8mr19587192vcz.6.1384841833662; Mon, 18 Nov 2013 22:17:13 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id nh5si7887839vec.106.2013.11.18.22.17.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id pa12so5737771veb.41 for ; Mon, 18 Nov 2013 22:17:13 -0800 (PST) X-Received: by 10.220.17.131 with SMTP id s3mr6835461vca.20.1384841833584; Mon, 18 Nov 2013 22:17:13 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp255369vcz; Mon, 18 Nov 2013 22:17:13 -0800 (PST) X-Received: by 10.66.118.71 with SMTP id kk7mr25241888pab.14.1384841832651; Mon, 18 Nov 2013 22:17:12 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id yf2si7168510pab.85.2013.11.18.22.17.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kp14so6294659pab.37 for ; Mon, 18 Nov 2013 22:17:12 -0800 (PST) X-Received: by 10.68.203.164 with SMTP id kr4mr24965179pbc.48.1384841832229; Mon, 18 Nov 2013 22:17:12 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id rz6sm19165159pab.22.2013.11.18.22.17.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:11 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v3 05/10] arm_gic: Rename GIC_X_TRIGGER to GIC_X_EDGE_TRIGGER Date: Mon, 18 Nov 2013 22:18:11 -0800 Message-Id: <1384841896-19566-6-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> References: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , TRIGGER can really mean mean anything (e.g. was it triggered, is it level-triggered, is it edge-triggered, etc.). Rename to EDGE_TRIGGER to make the code comprehensible without looking up the data structure. Signed-off-by: Christoffer Dall Reviewed-by: Peter Maydell --- hw/intc/arm_gic.c | 12 ++++++------ hw/intc/arm_gic_common.c | 2 +- hw/intc/gic_internal.h | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 73acf62..5736b95 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -157,7 +157,7 @@ static void gic_set_irq(void *opaque, int irq, int level) DPRINTF("Set %d pending mask %x\n", irq, target); GIC_SET_PENDING(irq, target); } else { - if (!GIC_TEST_TRIGGER(irq)) { + if (!GIC_TEST_EDGE_TRIGGER(irq)) { gic_clear_pending(s, irq, target, 0); } GIC_CLEAR_LEVEL(irq, cm); @@ -225,7 +225,7 @@ void gic_complete_irq(GICState *s, int cpu, int irq) return; /* No active IRQ. */ /* Mark level triggered interrupts as pending if they are still raised. */ - if (!GIC_TEST_TRIGGER(irq) && GIC_TEST_ENABLED(irq, cm) + if (!GIC_TEST_EDGE_TRIGGER(irq) && GIC_TEST_ENABLED(irq, cm) && GIC_TEST_LEVEL(irq, cm) && (GIC_TARGET(irq) & cm) != 0) { DPRINTF("Set %d pending mask %x\n", irq, cm); GIC_SET_PENDING(irq, cm); @@ -348,7 +348,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset) for (i = 0; i < 4; i++) { if (GIC_TEST_MODEL(irq + i)) res |= (1 << (i * 2)); - if (GIC_TEST_TRIGGER(irq + i)) + if (GIC_TEST_EDGE_TRIGGER(irq + i)) res |= (2 << (i * 2)); } } else if (offset < 0xfe0) { @@ -423,7 +423,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, /* If a raised level triggered IRQ enabled then mark is as pending. */ if (GIC_TEST_LEVEL(irq + i, mask) - && !GIC_TEST_TRIGGER(irq + i)) { + && !GIC_TEST_EDGE_TRIGGER(irq + i)) { DPRINTF("Set %d pending mask %x\n", irq + i, mask); GIC_SET_PENDING(irq + i, mask); } @@ -505,9 +505,9 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, GIC_CLEAR_MODEL(irq + i); } if (value & (2 << (i * 2))) { - GIC_SET_TRIGGER(irq + i); + GIC_SET_EDGE_TRIGGER(irq + i); } else { - GIC_CLEAR_TRIGGER(irq + i); + GIC_CLEAR_EDGE_TRIGGER(irq + i); } } } else { diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 6fbdafc..41ddc9b 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -129,7 +129,7 @@ static void arm_gic_common_reset(DeviceState *dev) } for (i = 0; i < 16; i++) { GIC_SET_ENABLED(i, ALL_CPU_MASK); - GIC_SET_TRIGGER(i); + GIC_SET_EDGE_TRIGGER(i); } if (s->num_cpu == 1) { /* For uniprocessor GICs all interrupts always target the sole CPU */ diff --git a/hw/intc/gic_internal.h b/hw/intc/gic_internal.h index 3d36653..5471749 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -44,9 +44,9 @@ #define GIC_SET_LEVEL(irq, cm) s->irq_state[irq].level = (cm) #define GIC_CLEAR_LEVEL(irq, cm) s->irq_state[irq].level &= ~(cm) #define GIC_TEST_LEVEL(irq, cm) ((s->irq_state[irq].level & (cm)) != 0) -#define GIC_SET_TRIGGER(irq) s->irq_state[irq].trigger = true -#define GIC_CLEAR_TRIGGER(irq) s->irq_state[irq].trigger = false -#define GIC_TEST_TRIGGER(irq) s->irq_state[irq].trigger +#define GIC_SET_EDGE_TRIGGER(irq) s->irq_state[irq].trigger = true +#define GIC_CLEAR_EDGE_TRIGGER(irq) s->irq_state[irq].trigger = false +#define GIC_TEST_EDGE_TRIGGER(irq) (s->irq_state[irq].trigger) #define GIC_GET_PRIORITY(irq, cpu) (((irq) < GIC_INTERNAL) ? \ s->priority1[irq][cpu] : \ s->priority2[(irq) - GIC_INTERNAL])