2 * Virtio transport header
4 * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
7 * Evgeny Voevodin <e.voevodin@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef VIRTIO_TRANSPORT_H_
23 #define VIRTIO_TRANSPORT_H_
26 #include "qemu-common.h"
28 #define VIRTIO_MMIO "virtio-mmio"
29 #define VIRTIO_PCI "virtio-pci"
31 #define TYPE_VIRTIO_BUS "virtio-bus"
32 #define VIRTIO_BUS(obj) OBJECT_CHECK(virtio_bus, (obj), TYPE_VIRTIO_BUS)
34 struct VirtIOTransportLink;
36 typedef int (*virtio_backend_init_cb)(DeviceState *dev, VirtIODevice *vdev,
37 struct VirtIOTransportLink *trl);
39 typedef struct VirtIOTransportLink {
41 virtio_backend_init_cb cb;
42 uint32_t host_features;
43 QTAILQ_ENTRY(VirtIOTransportLink) sibling;
44 } VirtIOTransportLink;
47 * Find transport device by its ID.
49 VirtIOTransportLink* virtio_find_transport(const char *name);
52 * Count transport devices by ID.
54 uint32_t virtio_count_transports(const char *name);
57 * Initialize new transport device
59 char* virtio_init_transport(DeviceState *dev, VirtIOTransportLink **trl,
60 const char* name, virtio_backend_init_cb cb);
63 * Unplug back-end from system bus and plug it into transport bus.
65 void virtio_plug_into_transport(DeviceState *dev, VirtIOTransportLink *trl);
68 * Execute call-back on back-end initialization.
69 * Performs initialization of MMIO or PCI transport.
71 int virtio_call_backend_init_cb(DeviceState *dev, VirtIOTransportLink *trl,
74 #endif /* VIRTIO_TRANSPORT_H_ */