On Wed, Dec 02, 2009 at 01:04:09PM +0100, Juan Quintela wrote:
>
> Signed-off-by: Juan Quintela <[email protected]>
Let's just use binding for this.
> ---
> hw/syborg_virtio.c | 1 +
> hw/virtio-pci.c | 2 +-
> hw/virtio.h | 6 ++++++
> 3 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
> index 6cf5a15..46ac192 100644
> --- a/hw/syborg_virtio.c
> +++ b/hw/syborg_virtio.c
> @@ -275,6 +275,7 @@ static int syborg_virtio_net_init(SysBusDevice *dev)
> SyborgVirtIOProxy *proxy = FROM_SYSBUS(SyborgVirtIOProxy, dev);
>
> vdev = virtio_net_init(&dev->qdev, &proxy->nic);
> + vdev->type = VIRTIO_SYBORG;
> return syborg_virtio_init(proxy, vdev);
> }
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 25b6380..a2179de 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -433,7 +433,7 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy,
> VirtIODevice *vdev,
>
> pci_register_bar(&proxy->pci_dev, 0, size, PCI_BASE_ADDRESS_SPACE_IO,
> virtio_map);
> -
> + vdev->type = VIRTIO_PCI;
> virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
> }
>
> diff --git a/hw/virtio.h b/hw/virtio.h
> index 15ad910..ec1ff4d 100644
> --- a/hw/virtio.h
> +++ b/hw/virtio.h
> @@ -88,6 +88,11 @@ typedef struct {
>
> #define VIRTIO_NO_VECTOR 0xffff
>
> +typedef enum VirtIOType {
> + VIRTIO_PCI,
> + VIRTIO_SYBORG,
> +} VirtIOType;
> +
> struct VirtIODevice
> {
> const char *name;
> @@ -106,6 +111,7 @@ struct VirtIODevice
> void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
> void (*reset)(VirtIODevice *vdev);
> VirtQueue *vq;
> + VirtIOType type;
> const VirtIOBindings *binding;
> void *binding_opaque;
> uint16_t device_id;
> --
> 1.6.5.2