aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio-bus.c
diff options
context:
space:
mode:
authorKONRAD Frederic <fred.konrad@greensocs.com>2013-04-24 10:21:17 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-24 11:50:20 -0500
commit5d448f9dac460d0adf7d7549a9c324f50f1dd1e2 (patch)
tree1db4008ec0cfc9c29193ecd21a6277d285a52433 /hw/virtio/virtio-bus.c
parent611aa333b472c3fee5d4aed3b7e007621797e895 (diff)
virtio-bus: add new functions.
This add two functions: * virtio_bus_set_vdev_config. * virtio_bus_set_vdev_feature. Needed by virtio-ccw. Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Message-id: 1366791683-5350-2-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio/virtio-bus.c')
-rw-r--r--hw/virtio/virtio-bus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index 1596a1c92f..dd1084944a 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -124,6 +124,18 @@ uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus,
return k->get_features(bus->vdev, requested_features);
}
+/* Set the features of the plugged device. */
+void virtio_bus_set_vdev_features(VirtioBusState *bus,
+ uint32_t requested_features)
+{
+ VirtioDeviceClass *k;
+ assert(bus->vdev != NULL);
+ k = VIRTIO_DEVICE_GET_CLASS(bus->vdev);
+ if (k->set_features != NULL) {
+ k->set_features(bus->vdev, requested_features);
+ }
+}
+
/* Get bad features of the plugged device. */
uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus)
{
@@ -148,6 +160,17 @@ void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config)
}
}
+/* Set config of the plugged device. */
+void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config)
+{
+ VirtioDeviceClass *k;
+ assert(bus->vdev != NULL);
+ k = VIRTIO_DEVICE_GET_CLASS(bus->vdev);
+ if (k->set_config != NULL) {
+ k->set_config(bus->vdev, config);
+ }
+}
+
static const TypeInfo virtio_bus_info = {
.name = TYPE_VIRTIO_BUS,
.parent = TYPE_BUS,