From patchwork Tue Oct 25 10:32:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Canet X-Patchwork-Id: 121662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DD4E91007D9 for ; Tue, 25 Oct 2011 23:58:28 +1100 (EST) Received: from localhost ([::1]:34246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeKV-0003Bf-L9 for incoming@patchwork.ozlabs.org; Tue, 25 Oct 2011 06:33:59 -0400 Received: from eggs.gnu.org ([140.186.70.92]:35479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeKA-00030S-9h for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:33:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIeK8-0004gy-3e for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:33:37 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:61444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeK7-0004go-VZ for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:33:36 -0400 Received: by wwe32 with SMTP id 32so4934376wwe.4 for ; Tue, 25 Oct 2011 03:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=69Lc7rFDoFBpq19afKJgrr8FF5C0hHz/QNrvzrsyOow=; b=CLjrRzq168eWJ6gtLgeX3lvvibRKcPc3/xKra34MSvhrIe6wsIunoSHNEKux1Ww+S6 wuSe7FyUiBGeHeqWIQp7gP1DU3f4c7G1gDwM3q7JqEWzC2krcxQK16l09OABKIYSvNAb 16Yt6qtL2w/3nsCSFrYhyfSou7WcmMkFyHCDM= Received: by 10.216.168.200 with SMTP id k50mr3289090wel.22.1319538814961; Tue, 25 Oct 2011 03:33:34 -0700 (PDT) Received: from localhost.localdomain ([78.250.84.36]) by mx.google.com with ESMTPS id ei16sm44226592wbb.21.2011.10.25.03.33.25 (version=SSLv3 cipher=OTHER); Tue, 25 Oct 2011 03:33:34 -0700 (PDT) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2011 12:32:38 +0200 Message-Id: <1319538764-3954-6-git-send-email-benoit.canet@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1319538764-3954-1-git-send-email-benoit.canet@gmail.com> References: <1319538764-3954-1-git-send-email-benoit.canet@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.41 Cc: peter.maydell@linaro.org, =?UTF-8?q?Beno=C3=AEt=20Canet?= , avi@redhat.com Subject: [Qemu-devel] [PATCH 05/11] syborg_interrupt: convert to memory API 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Benoit Canet --- hw/syborg_interrupt.c | 29 ++++++++++++----------------- 1 files changed, 12 insertions(+), 17 deletions(-) diff --git a/hw/syborg_interrupt.c b/hw/syborg_interrupt.c index 1b0f3bb..512910a 100644 --- a/hw/syborg_interrupt.c +++ b/hw/syborg_interrupt.c @@ -55,6 +55,7 @@ typedef struct { typedef struct { SysBusDevice busdev; + MemoryRegion iomem; int pending_count; uint32_t num_irqs; syborg_int_flags *flags; @@ -84,7 +85,8 @@ static void syborg_int_set_irq(void *opaque, int irq, int level) } } -static uint32_t syborg_int_read(void *opaque, target_phys_addr_t offset) +static uint64_t syborg_int_read(void *opaque, target_phys_addr_t offset, + unsigned size) { SyborgIntState *s = (SyborgIntState *)opaque; int i; @@ -114,7 +116,8 @@ static uint32_t syborg_int_read(void *opaque, target_phys_addr_t offset) } } -static void syborg_int_write(void *opaque, target_phys_addr_t offset, uint32_t value) +static void syborg_int_write(void *opaque, target_phys_addr_t offset, + uint64_t value, unsigned size) { SyborgIntState *s = (SyborgIntState *)opaque; int i; @@ -156,16 +159,10 @@ static void syborg_int_write(void *opaque, target_phys_addr_t offset, uint32_t v syborg_int_update(s); } -static CPUReadMemoryFunc * const syborg_int_readfn[] = { - syborg_int_read, - syborg_int_read, - syborg_int_read -}; - -static CPUWriteMemoryFunc * const syborg_int_writefn[] = { - syborg_int_write, - syborg_int_write, - syborg_int_write +static const MemoryRegionOps syborg_int_ops = { + .read = syborg_int_read, + .write = syborg_int_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static void syborg_int_save(QEMUFile *f, void *opaque) @@ -205,14 +202,12 @@ static int syborg_int_load(QEMUFile *f, void *opaque, int version_id) static int syborg_int_init(SysBusDevice *dev) { SyborgIntState *s = FROM_SYSBUS(SyborgIntState, dev); - int iomemtype; sysbus_init_irq(dev, &s->parent_irq); qdev_init_gpio_in(&dev->qdev, syborg_int_set_irq, s->num_irqs); - iomemtype = cpu_register_io_memory(syborg_int_readfn, - syborg_int_writefn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x1000, iomemtype); + memory_region_init_io(&s->iomem, &syborg_int_ops, s, + "interrupt", 0x1000); + sysbus_init_mmio_region(dev, &s->iomem); s->flags = g_malloc0(s->num_irqs * sizeof(syborg_int_flags)); register_savevm(&dev->qdev, "syborg_int", -1, 1, syborg_int_save,