From patchwork Sun Oct 2 14:26:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 117300 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 E8C47B6F77 for ; Mon, 3 Oct 2011 01:29:32 +1100 (EST) Received: from localhost ([::1]:59095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAN2o-0004AR-GS for incoming@patchwork.ozlabs.org; Sun, 02 Oct 2011 10:29:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAN0m-0007DW-GB for qemu-devel@nongnu.org; Sun, 02 Oct 2011 10:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAN0d-0008BQ-7M for qemu-devel@nongnu.org; Sun, 02 Oct 2011 10:27:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAN0c-0008B5-Tc for qemu-devel@nongnu.org; Sun, 02 Oct 2011 10:27:15 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p92ERDxn019412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Oct 2011 10:27:13 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p92ER9I1021101; Sun, 2 Oct 2011 10:27:12 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 0F617250B6E; Sun, 2 Oct 2011 16:27:05 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org, Anthony Liguori Date: Sun, 2 Oct 2011 16:26:44 +0200 Message-Id: <1317565616-12997-14-git-send-email-avi@redhat.com> In-Reply-To: <1317565616-12997-1-git-send-email-avi@redhat.com> References: <1317565616-12997-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/25] sm501: Pass address_space_mem to sm501_init 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 From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Avi Kivity --- hw/devices.h | 6 +++++- hw/r2d.c | 5 ++++- hw/sm501.c | 7 +++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/devices.h b/hw/devices.h index 07fda83..8ac384f 100644 --- a/hw/devices.h +++ b/hw/devices.h @@ -1,6 +1,9 @@ #ifndef QEMU_DEVICES_H #define QEMU_DEVICES_H +/* ??? Not all users of this file can include cpu-common.h. */ +struct MemoryRegion; + /* Devices that have nowhere better to go. */ /* smc91c111.c */ @@ -57,7 +60,8 @@ qemu_irq *tc6393xb_gpio_in_get(TC6393xbState *s); qemu_irq tc6393xb_l3v_get(TC6393xbState *s); /* sm501.c */ -void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq, +void sm501_init(struct MemoryRegion *address_space_mem, uint32_t base, + uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr); #endif diff --git a/hw/r2d.c b/hw/r2d.c index b8b0df3..82377a0 100644 --- a/hw/r2d.c +++ b/hw/r2d.c @@ -37,6 +37,7 @@ #include "usb.h" #include "flash.h" #include "blockdev.h" +#include "exec-memory.h" #define FLASH_BASE 0x00000000 #define FLASH_SIZE 0x02000000 @@ -235,6 +236,7 @@ static void r2d_init(ram_addr_t ram_size, qemu_irq *irq; DriveInfo *dinfo; int i; + MemoryRegion *address_space_mem = get_system_memory(); if (!cpu_model) cpu_model = "SH7751R"; @@ -258,7 +260,8 @@ static void r2d_init(ram_addr_t ram_size, sysbus_create_varargs("sh_pci", 0x1e200000, irq[PCI_INTA], irq[PCI_INTB], irq[PCI_INTC], irq[PCI_INTD], NULL); - sm501_init(0x10000000, SM501_VRAM_SIZE, irq[SM501], serial_hds[2]); + sm501_init(address_space_mem, 0x10000000, SM501_VRAM_SIZE, + irq[SM501], serial_hds[2]); /* onboard CF (True IDE mode, Master only). */ dinfo = drive_get(IF_IDE, 0, 0); diff --git a/hw/sm501.c b/hw/sm501.c index 6b54717..a7ed6fa 100644 --- a/hw/sm501.c +++ b/hw/sm501.c @@ -30,7 +30,6 @@ #include "sysbus.h" #include "qdev-addr.h" #include "range.h" -#include "exec-memory.h" /* * Status: 2010/05/07 @@ -1386,8 +1385,8 @@ static void sm501_update_display(void *opaque) sm501_draw_crt(s); } -void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq, - CharDriverState *chr) +void sm501_init(MemoryRegion *address_space_mem, uint32_t base, + uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr) { SM501State * s; DeviceState *dev; @@ -1441,7 +1440,7 @@ void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq, /* bridge to serial emulation module */ if (chr) { - serial_mm_init(get_system_memory(), + serial_mm_init(address_space_mem, base + MMIO_BASE_OFFSET + SM501_UART0, 2, NULL, /* TODO : chain irq to IRL */ 115200, chr, DEVICE_NATIVE_ENDIAN);