SHA256
1
0
forked from pool/qemu
qemu/0044-pseries-Populate-chosen-linux-stdout-path-in-the.patch

120 lines
3.6 KiB
Diff
Raw Normal View History

From cdec03dc7bb33b4ebf5bd286338e5c50be77a055 Mon Sep 17 00:00:00 2001
From: David Gibson <david@gibson.dropbear.id.au>
Date: Tue, 13 Dec 2011 15:24:34 +1100
Subject: [PATCH] pseries: Populate "/chosen/linux,stdout-path" in the FDT
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>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 68f3a94c64bbaaf8c7f2daa70de1b5d87a432f86)
---
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 2b901f1..5a98d86 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -351,6 +351,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
}
+ 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 8bd00ca..464fe87 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -806,4 +806,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 a325a5f..9fcd304 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -83,6 +83,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);
@@ -108,6 +109,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 e2fec58..386ccf7 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -156,7 +156,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.6.0.2