Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/virtio.h
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
* QNOTIFY is effectively write-only: when the guest writes a queue | * QNOTIFY is effectively write-only: when the guest writes a queue | ||||
* number to the register, the hypervisor should scan the specified | * number to the register, the hypervisor should scan the specified | ||||
* virtqueue. (Reading QNOTIFY currently always gets 0). | * virtqueue. (Reading QNOTIFY currently always gets 0). | ||||
*/ | */ | ||||
/* | /* | ||||
* PFN register shift amount | * PFN register shift amount | ||||
*/ | */ | ||||
#define VRING_PFN 12 | #define VRING_PFN 12 | ||||
/* | /* | ||||
* Virtio device types | * Virtio device types | ||||
* | * | ||||
* XXX Should really be merged with <dev/virtio/virtio.h> defines | * XXX Should really be merged with <dev/virtio/virtio.h> defines | ||||
*/ | */ | ||||
#define VIRTIO_TYPE_NET 1 | #define VIRTIO_TYPE_NET 1 | ||||
#define VIRTIO_TYPE_BLOCK 2 | #define VIRTIO_TYPE_BLOCK 2 | ||||
Show All 21 Lines | |||||
* PCI config space constants. | * PCI config space constants. | ||||
* | * | ||||
* If MSI-X is enabled, the ISR register is generally not used, | * If MSI-X is enabled, the ISR register is generally not used, | ||||
* and the configuration vector and queue vector appear at offsets | * and the configuration vector and queue vector appear at offsets | ||||
* 20 and 22 with the remaining configuration registers at 24. | * 20 and 22 with the remaining configuration registers at 24. | ||||
* If MSI-X is not enabled, those two registers disappear and | * If MSI-X is not enabled, those two registers disappear and | ||||
* the remaining configuration registers start at offset 20. | * the remaining configuration registers start at offset 20. | ||||
*/ | */ | ||||
#define VTCFG_R_HOSTCAP 0 | #define VTCFG_R_HOSTCAP 0 | ||||
#define VTCFG_R_GUESTCAP 4 | #define VTCFG_R_GUESTCAP 4 | ||||
#define VTCFG_R_PFN 8 | #define VTCFG_R_PFN 8 | ||||
#define VTCFG_R_QNUM 12 | #define VTCFG_R_QNUM 12 | ||||
#define VTCFG_R_QSEL 14 | #define VTCFG_R_QSEL 14 | ||||
#define VTCFG_R_QNOTIFY 16 | #define VTCFG_R_QNOTIFY 16 | ||||
#define VTCFG_R_STATUS 18 | #define VTCFG_R_STATUS 18 | ||||
#define VTCFG_R_ISR 19 | #define VTCFG_R_ISR 19 | ||||
#define VTCFG_R_CFGVEC 20 | #define VTCFG_R_CFGVEC 20 | ||||
#define VTCFG_R_QVEC 22 | #define VTCFG_R_QVEC 22 | ||||
#define VTCFG_R_CFG0 20 /* No MSI-X */ | #define VTCFG_R_CFG0 20 /* No MSI-X */ | ||||
#define VTCFG_R_CFG1 24 /* With MSI-X */ | #define VTCFG_R_CFG1 24 /* With MSI-X */ | ||||
#define VTCFG_R_MSIX 20 | #define VTCFG_R_MSIX 20 | ||||
/* | /* | ||||
* Bits in VTCFG_R_STATUS. Guests need not actually set any of these, | * Bits in VTCFG_R_STATUS. Guests need not actually set any of these, | ||||
* but a guest writing 0 to this register means "please reset". | * but a guest writing 0 to this register means "please reset". | ||||
*/ | */ | ||||
#define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */ | #define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */ | ||||
#define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */ | #define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */ | ||||
#define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */ | #define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */ | ||||
#define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */ | #define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */ | ||||
/* | /* | ||||
* Bits in VTCFG_R_ISR. These apply only if not using MSI-X. | * Bits in VTCFG_R_ISR. These apply only if not using MSI-X. | ||||
* | * | ||||
* (We don't [yet?] ever use CONF_CHANGED.) | * (We don't [yet?] ever use CONF_CHANGED.) | ||||
*/ | */ | ||||
#define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */ | #define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */ | ||||
#define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */ | #define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */ | ||||
#define VIRTIO_MSI_NO_VECTOR 0xFFFF | #define VIRTIO_MSI_NO_VECTOR 0xFFFF | ||||
/* | /* | ||||
* Feature flags. | * Feature flags. | ||||
* Note: bits 0 through 23 are reserved to each device type. | * Note: bits 0 through 23 are reserved to each device type. | ||||
*/ | */ | ||||
#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24) | #define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24) | ||||
#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28) | #define VIRTIO_RING_F_INDIRECT_DESC (1 << 28) | ||||
#define VIRTIO_RING_F_EVENT_IDX (1 << 29) | #define VIRTIO_RING_F_EVENT_IDX (1 << 29) | ||||
▲ Show 20 Lines • Show All 202 Lines • Show Last 20 Lines |