]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/libqos/virtio.h
2 * libqos virtio definitions
4 * Copyright (c) 2014 Marc MarĂ
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
10 #ifndef LIBQOS_VIRTIO_H
11 #define LIBQOS_VIRTIO_H
13 #define QVIRTIO_VENDOR_ID 0x1AF4
15 #define QVIRTIO_RESET 0x0
16 #define QVIRTIO_ACKNOWLEDGE 0x1
17 #define QVIRTIO_DRIVER 0x2
19 #define QVIRTIO_NET_DEVICE_ID 0x1
20 #define QVIRTIO_BLK_DEVICE_ID 0x2
22 typedef struct QVirtioDevice
{
27 typedef struct QVirtioBus
{
28 uint8_t (*config_readb
)(QVirtioDevice
*d
, void *addr
);
29 uint16_t (*config_readw
)(QVirtioDevice
*d
, void *addr
);
30 uint32_t (*config_readl
)(QVirtioDevice
*d
, void *addr
);
31 uint64_t (*config_readq
)(QVirtioDevice
*d
, void *addr
);
33 /* Get status of the device */
34 uint8_t (*get_status
)(QVirtioDevice
*d
);
36 /* Set status of the device */
37 void (*set_status
)(QVirtioDevice
*d
, uint8_t status
);
40 uint8_t qvirtio_config_readb(const QVirtioBus
*bus
, QVirtioDevice
*d
,
42 uint16_t qvirtio_config_readw(const QVirtioBus
*bus
, QVirtioDevice
*d
,
44 uint32_t qvirtio_config_readl(const QVirtioBus
*bus
, QVirtioDevice
*d
,
46 uint64_t qvirtio_config_readq(const QVirtioBus
*bus
, QVirtioDevice
*d
,
49 void qvirtio_reset(const QVirtioBus
*bus
, QVirtioDevice
*d
);
50 void qvirtio_set_acknowledge(const QVirtioBus
*bus
, QVirtioDevice
*d
);
51 void qvirtio_set_driver(const QVirtioBus
*bus
, QVirtioDevice
*d
);