From patchwork Thu Jan 31 17:57:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 217229 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6B99F2C008E for ; Fri, 1 Feb 2013 04:58:43 +1100 (EST) Received: from localhost ([::1]:60500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0yPJ-0006Eb-Hg for incoming@patchwork.ozlabs.org; Thu, 31 Jan 2013 12:58:41 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0yOw-00061E-Aq for qemu-devel@nongnu.org; Thu, 31 Jan 2013 12:58:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0yOu-0008Ma-5w for qemu-devel@nongnu.org; Thu, 31 Jan 2013 12:58:18 -0500 Received: from cantor2.suse.de ([195.135.220.15]:50230 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0yOt-0008MJ-S8 for qemu-devel@nongnu.org; Thu, 31 Jan 2013 12:58:16 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 42928A398F; Thu, 31 Jan 2013 18:58:15 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 31 Jan 2013 18:57:59 +0100 Message-Id: <1359655080-20044-4-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359655080-20044-1-git-send-email-afaerber@suse.de> References: <1359655080-20044-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paul Brook Subject: [Qemu-devel] [PATCH qom-cpu for-next 3/4] mcf_intc: Pass M68kCPU to mcf_intc_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 Store it in mcf_intc_state. Prepares for passing it to m68k_set_irq_level(). Signed-off-by: Andreas Färber --- hw/mcf.h | 2 +- hw/mcf5208.c | 11 +++++++---- hw/mcf_intc.c | 8 ++++---- 3 Dateien geändert, 12 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-) diff --git a/hw/mcf.h b/hw/mcf.h index dc21028..fbc8dc2 100644 --- a/hw/mcf.h +++ b/hw/mcf.h @@ -17,7 +17,7 @@ void mcf_uart_mm_init(struct MemoryRegion *sysmem, /* mcf_intc.c */ qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem, hwaddr base, - CPUM68KState *env); + M68kCPU *cpu); /* mcf_fec.c */ void mcf_fec_init(struct MemoryRegion *sysmem, NICInfo *nd, diff --git a/hw/mcf5208.c b/hw/mcf5208.c index 2c9a5dc..86402d3 100644 --- a/hw/mcf5208.c +++ b/hw/mcf5208.c @@ -192,6 +192,7 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args) ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; + M68kCPU *cpu; CPUM68KState *env; int kernel_size; uint64_t elf_entry; @@ -201,13 +202,15 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args) MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); - if (!cpu_model) + if (!cpu_model) { cpu_model = "m5208"; - env = cpu_init(cpu_model); - if (!env) { + } + cpu = cpu_m68k_init(cpu_model); + if (!cpu) { fprintf(stderr, "Unable to find m68k CPU definition\n"); exit(1); } + env = &cpu->env; /* Initialize CPU registers. */ env->vbr = 0; @@ -224,7 +227,7 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args) memory_region_add_subregion(address_space_mem, 0x80000000, sram); /* Internal peripherals. */ - pic = mcf_intc_init(address_space_mem, 0xfc048000, env); + pic = mcf_intc_init(address_space_mem, 0xfc048000, cpu); mcf_uart_mm_init(address_space_mem, 0xfc060000, pic[26], serial_hds[0]); mcf_uart_mm_init(address_space_mem, 0xfc064000, pic[27], serial_hds[1]); diff --git a/hw/mcf_intc.c b/hw/mcf_intc.c index 3bed3a2..450f622 100644 --- a/hw/mcf_intc.c +++ b/hw/mcf_intc.c @@ -16,7 +16,7 @@ typedef struct { uint64_t ifr; uint64_t enabled; uint8_t icr[64]; - CPUM68KState *env; + M68kCPU *cpu; int active_vector; } mcf_intc_state; @@ -40,7 +40,7 @@ static void mcf_intc_update(mcf_intc_state *s) } } s->active_vector = ((best == 64) ? 24 : (best + 64)); - m68k_set_irq_level(s->env, best_level, s->active_vector); + m68k_set_irq_level(&s->cpu->env, best_level, s->active_vector); } static uint64_t mcf_intc_read(void *opaque, hwaddr addr, @@ -139,12 +139,12 @@ static const MemoryRegionOps mcf_intc_ops = { qemu_irq *mcf_intc_init(MemoryRegion *sysmem, hwaddr base, - CPUM68KState *env) + M68kCPU *cpu) { mcf_intc_state *s; s = g_malloc0(sizeof(mcf_intc_state)); - s->env = env; + s->cpu = cpu; mcf_intc_reset(s); memory_region_init_io(&s->iomem, &mcf_intc_ops, s, "mcf", 0x100);