static char *virtio_mmio_bus_get_dev_path(DeviceState *dev) { BusState *virtio_mmio_bus; VirtIOMMIOProxy *virtio_mmio_proxy; char *proxy_path; SysBusDevice *proxy_sbd; char *path; virtio_mmio_bus = qdev_get_parent_bus(dev); virtio_mmio_proxy = VIRTIO_MMIO(virtio_mmio_bus->parent); proxy_path = qdev_get_dev_path(DEVICE(virtio_mmio_proxy)); /* * If @format_transport_address is false, then we just perform the same as * virtio_bus_get_dev_path(): we delegate the address formatting for the * device on the virtio-mmio bus to the bus that the virtio-mmio proxy * (i.e., the device that implements the virtio-mmio bus) resides on. In * this case the base address of the virtio-mmio transport will be * invisible. */ if (!virtio_mmio_proxy->format_transport_address) { return proxy_path; } /* Otherwise, we append the base address of the transport. */ proxy_sbd = SYS_BUS_DEVICE(virtio_mmio_proxy); assert(proxy_sbd->num_mmio == 1); assert(proxy_sbd->mmio[0].memory == &virtio_mmio_proxy->iomem); if (proxy_path) { path = g_strdup_printf("%s/virtio-mmio@" TARGET_FMT_plx, proxy_path, proxy_sbd->mmio[0].addr); } else { path = g_strdup_printf("virtio-mmio@" TARGET_FMT_plx, proxy_sbd->mmio[0].addr); } g_free(proxy_path); return path; }
static char *virtio_bus_get_dev_path(DeviceState *dev) { BusState *bus = qdev_get_parent_bus(dev); DeviceState *proxy = DEVICE(bus->parent); return qdev_get_dev_path(proxy); }