From patchwork Tue Jan 3 15:08:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 134012 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 51C541007D6 for ; Wed, 4 Jan 2012 01:54:49 +1100 (EST) Received: from localhost ([::1]:43066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri5l7-0002L8-Ht for incoming@patchwork.ozlabs.org; Tue, 03 Jan 2012 09:54:37 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri5kp-00027K-My for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ri5kl-0000Zd-Lw for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:54:19 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40917 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri5kl-0000ZA-9R for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:54:15 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 7B1788FB75; Tue, 3 Jan 2012 15:54:14 +0100 (CET) From: Alexander Graf To: "qemu-devel@nongnu.org Developers" Date: Tue, 3 Jan 2012 16:08:20 +0100 Message-Id: <1325603302-12412-9-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1325603302-12412-1-git-send-email-agraf@suse.de> References: <1325603302-12412-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Blue Swirl , Michael Ellerman , Aurelien Jarno , David Gibson Subject: [Qemu-devel] [PATCH 08/10] pseries: Populate "/chosen/linux, stdout-path" in the FDT 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 There is a device tree property "/chosen/linux,stdout-path" which indicates which device should be used as stdout - ie. "the console". Currently we don't specify anything, which means both firmware and Linux choose something arbitrarily. Use the routine we added in the last patch to pick a default vty and specify it as stdout. Currently SLOF doesn't use the property, but we are hoping to update it to do so. Signed-off-by: Michael Ellerman Signed-off-by: David Gibson Signed-off-by: Alexander Graf --- hw/spapr.c | 2 ++ hw/spapr_vio.c | 34 ++++++++++++++++++++++++++++++++++ hw/spapr_vio.h | 3 +++ hw/spapr_vty.c | 2 +- 4 files changed, 40 insertions(+), 1 deletions(-) diff --git a/hw/spapr.c b/hw/spapr.c index 1883270..6a543de 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -441,6 +441,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, } } + spapr_populate_chosen_stdout(fdt, spapr->vio_bus); + _FDT((fdt_pack(fdt))); cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt)); diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 2cce421..cd03416 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -793,4 +793,38 @@ out: return ret; } + +int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus) +{ + VIOsPAPRDevice *dev; + char *name, *path; + int ret, offset; + + dev = spapr_vty_get_default(bus); + if (!dev) + return 0; + + offset = fdt_path_offset(fdt, "/chosen"); + if (offset < 0) { + return offset; + } + + name = vio_format_dev_name(dev); + if (!name) { + return -ENOMEM; + } + + if (asprintf(&path, "/vdevice/%s", name) < 0) { + path = NULL; + ret = -ENOMEM; + goto out; + } + + ret = fdt_setprop_string(fdt, offset, "linux,stdout-path", path); +out: + free(name); + free(path); + + return ret; +} #endif /* CONFIG_FDT */ diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h index 2430d45..0984d55 100644 --- a/hw/spapr_vio.h +++ b/hw/spapr_vio.h @@ -82,6 +82,7 @@ extern VIOsPAPRBus *spapr_vio_bus_init(void); extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg); extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info); extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt); +extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus); extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode); @@ -107,6 +108,8 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev); void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd); void spapr_vscsi_create(VIOsPAPRBus *bus, uint32_t reg); +VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus); + int spapr_tce_set_bypass(uint32_t unit, uint32_t enable); void spapr_vio_quiesce(void); diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index 2923ca7..c5fb096 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -149,7 +149,7 @@ static VIOsPAPRDeviceInfo spapr_vty = { }, }; -static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) +VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) { VIOsPAPRDevice *sdev, *selected; DeviceState *iter;