From patchwork Sun Apr 15 18:38:50 2012 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: 152685 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 0B052B6FE9 for ; Mon, 16 Apr 2012 04:55:07 +1000 (EST) Received: from localhost ([::1]:45603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJUN1-0001u0-WA for incoming@patchwork.ozlabs.org; Sun, 15 Apr 2012 14:40:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJUMG-0008Q2-8h for qemu-devel@nongnu.org; Sun, 15 Apr 2012 14:39:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJUMD-0002r3-FF for qemu-devel@nongnu.org; Sun, 15 Apr 2012 14:39:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35621 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJUMD-0002qT-6i; Sun, 15 Apr 2012 14:39:29 -0400 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 CB9EB90182; Sun, 15 Apr 2012 20:39:27 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 15 Apr 2012 20:38:50 +0200 Message-Id: <1334515144-26485-7-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1334515144-26485-1-git-send-email-afaerber@suse.de> References: <1334515144-26485-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Michael Ellerman , Anthony Liguori , Breno Leitao , agraf@suse.de, blauwirbel@gmail.com, qemu-ppc@nongnu.org, Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson Subject: [Qemu-devel] [PATCH 06/20] pseries: Consolidate hack for RTAS display-character usage 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: David Gibson Currently the pseries machine contains not one but two somewhat ugly hacks to allow printing of early debug messages before the guest has properly read the device tree. First, we special case H_PUT_TERM_CHAR so that a vtermno of 0 (usually invalid) will look for a suitable vty and use that. This supports Linux's early debug code which will use H_PUT_TERM_CHAR with vtermno==0 before reading the device tree. Second, we support the RTAS display-character call. This takes no vtermno so we assume the address of the default first VTY. This patch makes things more consistent by folding the second hack into the first. Now, display-character uses the existing vty_lookup() function to do the same search for a suitable VTY. Signed-off-by: David Gibson Signed-off-by: Andreas Färber --- hw/spapr_rtas.c | 3 +-- hw/spapr_vio.h | 1 + hw/spapr_vty.c | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c index 480a4ae..ae18595 100644 --- a/hw/spapr_rtas.c +++ b/hw/spapr_rtas.c @@ -44,8 +44,7 @@ static void rtas_display_character(sPAPREnvironment *spapr, uint32_t nret, target_ulong rets) { uint8_t c = rtas_ld(args, 0); - VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, - SPAPR_VTY_BASE_ADDRESS); + VIOsPAPRDevice *sdev = vty_lookup(spapr, 0); if (!sdev) { rtas_st(rets, 0, -1); diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h index ae3283c..fd29c5e 100644 --- a/hw/spapr_vio.h +++ b/hw/spapr_vio.h @@ -117,6 +117,7 @@ uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr); int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq); +VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg); void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len); void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev); void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd); diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index 60e22b1..a30c040 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -70,8 +70,6 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev) } /* Forward declaration */ -static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg); - static target_ulong h_put_term_char(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { @@ -195,7 +193,7 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) return selected; } -static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) +VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) { VIOsPAPRDevice *sdev;