From patchwork Thu Jan 17 23:30:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 213407 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 341BF2C0040 for ; Fri, 18 Jan 2013 10:30:59 +1100 (EST) Received: from localhost ([::1]:47598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvyvB-0004Wx-6c for incoming@patchwork.ozlabs.org; Thu, 17 Jan 2013 18:30:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvyum-000404-EG for qemu-devel@nongnu.org; Thu, 17 Jan 2013 18:30:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvyuk-0005G5-AM for qemu-devel@nongnu.org; Thu, 17 Jan 2013 18:30:32 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42746 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvyuk-0005Fj-1r; Thu, 17 Jan 2013 18:30:30 -0500 Received: from relay1.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 8B53BA51BB; Fri, 18 Jan 2013 00:30:29 +0100 (CET) From: Alexander Graf To: qemu-devel@nongnu.org Date: Fri, 18 Jan 2013 00:30:24 +0100 Message-Id: <1358465425-5504-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1358465425-5504-1-git-send-email-agraf@suse.de> References: <1358465425-5504-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-ppc@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] openpic: export e500 epr enable into a ppc.c function 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 Enabling and disabling the EPR capability (mpic_proxy) is a system wide operation. As such, it belongs into the ppc.c file, since that's where PPC specific machine wide logic happens. Signed-off-by: Alexander Graf --- hw/openpic.c | 11 +++++------ hw/ppc.c | 11 +++++++++++ hw/ppc.h | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/openpic.c b/hw/openpic.c index bcafe0a..cc8ec35 100644 --- a/hw/openpic.c +++ b/hw/openpic.c @@ -40,6 +40,7 @@ #include "sysbus.h" #include "pci/msi.h" #include "qemu/bitops.h" +#include "ppc.h" //#define DEBUG_OPENPIC @@ -646,8 +647,7 @@ static inline void write_IRQreg_ivpr(OpenPICState *opp, int n_IRQ, uint32_t val) static void openpic_gcr_write(OpenPICState *opp, uint64_t val) { - CPUArchState *env; - int mpic_proxy = 0; + bool mpic_proxy = false; if (val & GCR_RESET) { openpic_reset(&opp->busdev.qdev); @@ -659,11 +659,10 @@ static void openpic_gcr_write(OpenPICState *opp, uint64_t val) /* Set external proxy mode */ if ((val & opp->mpic_mode_mask) == GCR_MODE_PROXY) { - mpic_proxy = 1; - } - for (env = first_cpu; env != NULL; env = env->next_cpu) { - env->mpic_proxy = mpic_proxy; + mpic_proxy = true; } + + ppce500_set_mpic_proxy(mpic_proxy); } static void openpic_gbl_write(void *opaque, hwaddr addr, uint64_t val, diff --git a/hw/ppc.c b/hw/ppc.c index e473f9e..1fce604 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -428,6 +428,17 @@ void ppce500_irq_init(CPUPPCState *env) env->irq_inputs = (void **)qemu_allocate_irqs(&ppce500_set_irq, cpu, PPCE500_INPUT_NB); } + +/* Enable or Disable the E500 EPR capability */ +void ppce500_set_mpic_proxy(bool enabled) +{ + CPUPPCState *env; + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + env->mpic_proxy = enabled; + } +} + /*****************************************************************************/ /* PowerPC time base and decrementer emulation */ diff --git a/hw/ppc.h b/hw/ppc.h index e73ae83..ee0cd16 100644 --- a/hw/ppc.h +++ b/hw/ppc.h @@ -73,6 +73,8 @@ void ppc6xx_irq_init (CPUPPCState *env); void ppc970_irq_init (CPUPPCState *env); void ppcPOWER7_irq_init (CPUPPCState *env); +void ppce500_set_mpic_proxy(bool enabled); + /* PPC machines for OpenBIOS */ enum { ARCH_PREP = 0,