X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fdevices%2Flnx_virtio_pci.h;h=f0c5e3d163fe14cbd70180f8b2c2c598a5185ab3;hb=a20c07e3428f9aa55997befebca7a30721a71145;hp=d60f05d8878bad8e63d0ed711813fc6f74709c90;hpb=ec75f3ad6503e3c7996e7a445404b8813740804d;p=palacios.git diff --git a/palacios/include/devices/lnx_virtio_pci.h b/palacios/include/devices/lnx_virtio_pci.h index d60f05d..f0c5e3d 100644 --- a/palacios/include/devices/lnx_virtio_pci.h +++ b/palacios/include/devices/lnx_virtio_pci.h @@ -34,9 +34,17 @@ #define VIRTIO_BLOCK_DEV_ID 0x1001 #define VIRTIO_BALLOON_DEV_ID 0x1002 #define VIRTIO_CONSOLE_DEV_ID 0x1003 +#define VIRTIO_SYMBIOTIC_DEV_ID 0x100a +#define VIRTIO_SYMMOD_DEV_ID 0x100b +#define VIRTIO_VNET_DEV_ID 0x100c +#define VIRTIO_NET_SUBDEVICE_ID 1 #define VIRTIO_BLOCK_SUBDEVICE_ID 2 - +#define VIRTIO_CONSOLE_SUBDEVICE_ID 3 +#define VIRTIO_BALLOON_SUBDEVICE_ID 5 +#define VIRTIO_SYMBIOTIC_SUBDEVICE_ID 10 +#define VIRTIO_SYMMOD_SUBDEVICE_ID 11 +#define VIRTIO_VNET_SUBDEVICE_ID 12 #define HOST_FEATURES_PORT 0 @@ -48,6 +56,30 @@ #define VIRTIO_STATUS_PORT 18 #define VIRTIO_ISR_PORT 19 +#define VIRTIO_PAGE_SHIFT 12 + + +/* Descriptor flags */ +/* This marks a buffer as continuing via the next field. */ +#define VIRTIO_NEXT_FLAG 0x1 +/* This marks a buffer as write-only (otherwise read-only). */ +#define VIRTIO_WR_ONLY_FLAG 0x2 + + +/* Used Flags */ +/* This means don't notify other side when buffer added. */ +#define VRING_NO_NOTIFY_FLAG 0x1 + + +/* Avail Flags */ +/* This means don't interrupt guest when buffer consumed. */ +#define VIRTIO_NO_IRQ_FLAG 0x1 + + +/* ISR Flags */ +#define VIRTIO_ISR_ACTIVE 0x1 +#define VIRTIO_ISR_CFG_CHANGED 0x2 + /* The virtio configuration space is a hybrid io/memory mapped model @@ -59,14 +91,19 @@ * */ struct virtio_config { - uint32_t host_features; - uint32_t guest_features; - uint32_t vring_page_num; - uint16_t vring_ring_size; - uint16_t vring_queue_selector; - uint16_t vring_queue_notifier; - uint8_t status; - uint8_t pci_isr; + union { + uint8_t buf[20]; + struct { + uint32_t host_features; + uint32_t guest_features; + uint32_t vring_page_num; + uint16_t vring_ring_size; + uint16_t vring_queue_selector; + uint16_t vring_queue_notifier; + uint8_t status; + uint8_t pci_isr; + } __attribute__((packed)); + } __attribute__((packed)); } __attribute__((packed)); @@ -97,6 +134,22 @@ struct vring_used { +struct virtio_queue { + uint16_t queue_size; + + uint16_t cur_avail_idx; + + addr_t ring_desc_addr; + addr_t ring_avail_addr; + addr_t ring_used_addr; + + struct vring_desc * desc; // We can treat this as an array... + struct vring_avail * avail; + struct vring_used * used; + + uint32_t pfn; +}; + #endif