From patchwork Tue Jun 25 01:55:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 253999 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 321272C0085 for ; Tue, 25 Jun 2013 11:55:54 +1000 (EST) Received: from localhost ([::1]:34146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrIU4-000637-4O for incoming@patchwork.ozlabs.org; Mon, 24 Jun 2013 21:55:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrITU-00060P-J8 for qemu-devel@nongnu.org; Mon, 24 Jun 2013 21:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrITT-0000QQ-1G for qemu-devel@nongnu.org; Mon, 24 Jun 2013 21:55:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44083 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrITS-0000Q8-Rl; Mon, 24 Jun 2013 21:55:14 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C7B46A51FF; Tue, 25 Jun 2013 03:55:13 +0200 (CEST) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Tue, 25 Jun 2013 03:55:12 +0200 Message-Id: <1372125313-18801-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372125313-18801-1-git-send-email-agraf@suse.de> References: <1372125313-18801-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/2] PPC: Newworld: Add uninorth token register 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 Mac OS X expects the uninorth control register set to contain one register that always reads back what it writes in. Expose that. This is just a temporary hack. Eventually, we want to expose the uninorth (/uni-n in device tree) as a separate QOM device. Signed-off-by: Alexander Graf --- hw/ppc/mac_newworld.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index c6889d1..bf4fc7d 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -87,6 +87,9 @@ static void unin_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { UNIN_DPRINTF("write addr " TARGET_FMT_plx " val %"PRIx64"\n", addr, value); + if (addr == 0x0) { + *(int*)opaque = value; + } } static uint64_t unin_read(void *opaque, hwaddr addr, unsigned size) @@ -94,6 +97,11 @@ static uint64_t unin_read(void *opaque, hwaddr addr, unsigned size) uint32_t value; value = 0; + switch (addr) { + case 0: + value = *(int*)opaque; + } + UNIN_DPRINTF("readl addr " TARGET_FMT_plx " val %x\n", addr, value); return value; @@ -162,6 +170,7 @@ static void ppc_core99_init(QEMUMachineInitArgs *args) int machine_arch; SysBusDevice *s; DeviceState *dev; + int *token = g_new(int, 1); linux_boot = (kernel_filename != NULL); @@ -279,8 +288,8 @@ static void ppc_core99_init(QEMUMachineInitArgs *args) /* Register 8 MB of ISA IO space */ isa_mmio_init(0xf2000000, 0x00800000); - /* UniN init */ - memory_region_init_io(unin_memory, &unin_ops, NULL, "unin", 0x1000); + /* UniN init: XXX should be a real device */ + memory_region_init_io(unin_memory, &unin_ops, &token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory); openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));