diff options
-rw-r--r-- | hw/spapr.c | 2 | ||||
-rw-r--r-- | hw/spapr_vio.c | 34 | ||||
-rw-r--r-- | hw/spapr_vio.h | 3 | ||||
-rw-r--r-- | hw/spapr_vty.c | 2 |
4 files changed, 40 insertions, 1 deletions
diff --git a/hw/spapr.c b/hw/spapr.c index 18832709a3..6a543de651 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 2cce421a8c..cd03416958 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 2430d45bdb..0984d559db 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 2923ca709d..c5fb0968ed 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; |