From patchwork Wed Apr 4 15:30:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 7623 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C6D2B23E5B for ; Wed, 4 Apr 2012 15:31:28 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 93358A180D2 for ; Wed, 4 Apr 2012 15:31:28 +0000 (UTC) Received: by gglu1 with SMTP id u1so272872ggl.11 for ; Wed, 04 Apr 2012 08:31:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Bx7B2LrRWzExrxMHoPJr3yO7safqOkG8te9qKEhMgRg=; b=kO+0Fbhqme3EdEQdcPaH/1RsjRP5rKGti0Kpe5uZtwkJniwxSWfqNhPhcM5cl1HbU9 1ZFiY2zCKd4jmFgBLO0vFlrYySJSD0cVyGUxC6NpPMThsvzLVqctJI9d1G6ERLaGwfE9 uZyua0WPougvcQ79UGpOKYPS+ilvkMjdas3BPqEVhIjCM7iDVHN2n6w62e9ARklWt0Fl 5o6X6K1Hj4g7xWHxAt0ge73ZNSHWuhmCRQklPmVoKz7BtpCR7mix1e6MisbnngxJY6+1 fmVFsWyy9+Wqmba+Ec1rrYw5Do28Ez5bK8eu8gqnlU/rmHbDFLU4kGIQxTj7baUEA61v gIKw== Received: by 10.50.168.67 with SMTP id zu3mr2068589igb.28.1333553487759; Wed, 04 Apr 2012 08:31:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.164.217 with SMTP id f25csp45115iby; Wed, 4 Apr 2012 08:31:27 -0700 (PDT) Received: by 10.180.107.132 with SMTP id hc4mr6283309wib.21.1333553486394; Wed, 04 Apr 2012 08:31:26 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id r3si2565723wic.47.2012.04.04.08.31.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Apr 2012 08:31:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SFSAp-0003IS-4h; Wed, 04 Apr 2012 16:31:03 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: Paul Brook , Evgeny Voevodin , patches@linaro.org Subject: [PATCH 07/13] hw/realview_gic: switch to sysbus GIC Date: Wed, 4 Apr 2012 16:30:56 +0100 Message-Id: <1333553462-12633-8-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1333553462-12633-1-git-send-email-peter.maydell@linaro.org> References: <1333553462-12633-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQnCePcQczH7XL4mbt3O8RHOYGom3HuHqHxXnCQSAmGPD7yY9+nGrBOpDTihFXdSoKt2JNhI Switch the realview_gic device to the standalone sysbus GIC. Signed-off-by: Peter Maydell --- hw/realview_gic.c | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/hw/realview_gic.c b/hw/realview_gic.c index a3b5a04..5bc37a7 100644 --- a/hw/realview_gic.c +++ b/hw/realview_gic.c @@ -9,31 +9,45 @@ #include "sysbus.h" -#define LEGACY_INCLUDED_GIC -#include "arm_gic.c" - typedef struct { - gic_state gic; + SysBusDevice busdev; + DeviceState *gic; MemoryRegion container; } RealViewGICState; -static void realview_gic_map_setup(RealViewGICState *s) +static void realview_gic_set_irq(void *opaque, int irq, int level) { - memory_region_init(&s->container, "realview-gic-container", 0x2000); - memory_region_add_subregion(&s->container, 0, &s->gic.cpuiomem[0]); - memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem); + RealViewGICState *s = (RealViewGICState *)opaque; + qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level); } static int realview_gic_init(SysBusDevice *dev) { - RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev); - + RealViewGICState *s = FROM_SYSBUS(RealViewGICState, dev); + SysBusDevice *busdev; /* The GICs on the RealView boards have a fixed nonconfigurable * number of interrupt lines, so we don't need to expose this as * a qdev property. */ - gic_init(&s->gic, 1, 96); - realview_gic_map_setup(s); + int numirq = 96; + + s->gic = qdev_create(NULL, "arm_gic"); + qdev_prop_set_uint32(s->gic, "num-cpu", 1); + qdev_prop_set_uint32(s->gic, "num-irq", numirq); + qdev_init_nofail(s->gic); + busdev = sysbus_from_qdev(s->gic); + + /* Pass through outbound IRQ lines from the GIC */ + sysbus_pass_irq(dev, busdev); + + /* Pass through inbound GPIO lines to the GIC */ + qdev_init_gpio_in(&s->busdev.qdev, realview_gic_set_irq, numirq - 32); + + memory_region_init(&s->container, "realview-gic-container", 0x2000); + memory_region_add_subregion(&s->container, 0, + sysbus_mmio_get_region(busdev, 1)); + memory_region_add_subregion(&s->container, 0x1000, + sysbus_mmio_get_region(busdev, 0)); sysbus_init_mmio(dev, &s->container); return 0; }