From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 7/8] pseries: Populate "/chosen/linux, stdout-path" in the FDT
Date: Tue, 13 Dec 2011 15:24:34 +1100 [thread overview]
Message-ID: <1323750275-947-8-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1323750275-947-1-git-send-email-david@gibson.dropbear.id.au>
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 <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
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 339c1c3..b188a71 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -791,4 +791,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 fc8d91a..0a8016f 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;
--
1.7.7.3
next prev parent reply other threads:[~2011-12-13 4:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 4:24 [Qemu-devel] [0/8] Assorted pseries updates David Gibson
2011-12-13 4:24 ` [Qemu-devel] [PATCH 1/8] pseries: Remove hcalls callback David Gibson
2011-12-13 4:24 ` [Qemu-devel] [PATCH 2/8] monitor: add ability to dump SLB entries David Gibson
2011-12-20 15:28 ` Alexander Graf
2011-12-21 0:33 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2011-12-13 4:24 ` [Qemu-devel] [PATCH 3/8] pseries: FDT NUMA extensions to support multi-node guests David Gibson
2011-12-13 4:24 ` [Qemu-devel] [PATCH 5/8] pseries: Emit device tree nodes in reg order David Gibson
2011-12-13 4:24 ` [Qemu-devel] [PATCH 6/8] pseries: Add a routine to find a stable "default" vty and use it David Gibson
2011-12-13 4:24 ` David Gibson [this message]
2011-12-13 4:24 ` [Qemu-devel] [PATCH 8/8] pseries: Check for duplicate addresses on the spapr-vio bus David Gibson
2011-12-20 15:41 ` [Qemu-devel] [0/8] Assorted pseries updates Alexander Graf
2011-12-21 0:34 ` [Qemu-devel] [Qemu-ppc] " David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323750275-947-8-git-send-email-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).