From patchwork Mon Jan 19 11:35:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 430409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 12C35140119 for ; Mon, 19 Jan 2015 22:37:00 +1100 (AEDT) Received: from localhost ([::1]:36766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDAdd-0003Ss-Sa for incoming@patchwork.ozlabs.org; Mon, 19 Jan 2015 06:36:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDAcy-0002O2-Ql for qemu-devel@nongnu.org; Mon, 19 Jan 2015 06:36:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDAcu-0008RM-4I for qemu-devel@nongnu.org; Mon, 19 Jan 2015 06:36:16 -0500 Received: from s16892447.onlinehome-server.info ([82.165.15.123]:48541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDAct-0008Qz-V8; Mon, 19 Jan 2015 06:36:12 -0500 Received: from 5ec2da75.skybroadband.com ([94.194.218.117] helo=kentang.lan) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1YDAcs-00038N-5W; Mon, 19 Jan 2015 11:36:11 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de, afaerber@suse.de, atar4qemu@gmail.com Date: Mon, 19 Jan 2015 11:35:28 +0000 Message-Id: <1421667328-11800-3-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1421667328-11800-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1421667328-11800-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 94.194.218.117 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 2/2] m48t59: add mem_base value to m48t59_init_isa() 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 Similar to m48t59_init(), add a mem_base value so that NVRAM can be mapped via MMIO rather than ioport if required. Signed-off-by: Mark Cave-Ayland --- hw/ppc/prep.c | 2 +- hw/sparc64/sun4u.c | 2 +- hw/timer/m48t59.c | 9 +++++++-- include/hw/timer/m48t59.h | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 378a368..4ed22ba 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -543,7 +543,7 @@ static void ppc_prep_init(MachineState *machine) pci_create_simple(pci_bus, -1, "pci-ohci"); } - m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 0, 59); + m48t59 = m48t59_init_isa(isa_bus, 0, 0x0074, NVRAM_SIZE, 0, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 6b46511..86f5861 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -873,7 +873,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, fd[i] = drive_get(IF_FLOPPY, 0, i); } fdctrl_init_isa(isa_bus, fd); - nvram = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 0, 59); + nvram = m48t59_init_isa(isa_bus, 0, 0x0074, NVRAM_SIZE, 0, 59); initrd_size = 0; initrd_addr = 0; diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index 0a05100..dc52ce3 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -664,8 +664,8 @@ M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base, uint32_t io_base, return state; } -M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, - uint32_t year_offset, int model) +M48t59State *m48t59_init_isa(ISABus *bus, hwaddr mem_base, uint32_t io_base, + uint16_t size, uint32_t year_offset, int model) { M48t59ISAState *d; ISADevice *isadev; @@ -686,6 +686,11 @@ M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, if (io_base != 0) { isa_register_ioport(isadev, &d->io, io_base); } + if (mem_base != 0) { + memory_region_init_io(&s->iomem, OBJECT(d), &nvram_ops, s, + "m48t59.nvram", s->size); + isa_register_ioport(isadev, &s->iomem, mem_base); + } return s; } diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h index 08252b6..4bcd8fc 100644 --- a/include/hw/timer/m48t59.h +++ b/include/hw/timer/m48t59.h @@ -29,8 +29,8 @@ typedef struct M48t59State M48t59State; void m48t59_write (void *private, uint32_t addr, uint32_t val); uint32_t m48t59_read (void *private, uint32_t addr); void m48t59_toggle_lock (void *private, int lock); -M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, - uint32_t year_offset, int type); +M48t59State *m48t59_init_isa(ISABus *bus, hwaddr mem_base, uint32_t io_base, + uint16_t size, uint32_t year_offset, int type); M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base, uint32_t io_base, uint16_t size, uint32_t year_offset, int type);