Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
VIRTIO common definitions based on the specification. More...
Go to the source code of this file.
Macros | |
Virtio device status bits | |
Bit positions of the device status field. These are described in 2.1 Device Status Field | |
#define | DEVICE_STATUS_ACKNOWLEDGE 0 |
Indicates the guest has found and recognized the device presence. | |
#define | DEVICE_STATUS_DRIVER 1 |
Indicates the guest driver is ready to drive the device. | |
#define | DEVICE_STATUS_DRIVER_OK 2 |
Indicates the driver has successfully set up the device and is ready. | |
#define | DEVICE_STATUS_FEATURES_OK 3 |
Indicates the driver and device agreed on the negotiated feature set. | |
#define | DEVICE_STATUS_NEEDS_RESET 6 |
Indicates the device requests a reset to recover from an error. | |
#define | DEVICE_STATUS_FAILED 7 |
Indicates the device has experienced a non-recoverable error. | |
Feature Bits | |
Negotiable device-independent feature bit positions. These are described in 6 Reserved Feature Bits | |
#define | VIRTIO_RING_F_INDIRECT_DESC 28 |
Indicates descriptors can reference descriptor tables. | |
#define | VIRTIO_RING_F_EVENT_IDX 29 |
Indicates driver/device use event index for notifications. | |
#define | VIRTIO_F_VERSION_1 32 |
Indicates device complies with Virtio 1.0+ semantics. | |
#define | VIRTIO_F_ACCESS_PLATFORM 33 |
Indicates device needs platform-specific handling. | |
Ring Flag Bits | |
Available and used ring flag bit positions as described in 2.7.6 The Virtqueue Available Ring and 2.7.8 The Virtqueue Used Ring | |
#define | VIRTQ_AVAIL_F_NO_INTERRUPT 1 |
Driver requests the device to skip interrupts. | |
#define | VIRTQ_USED_F_NO_NOTIFY 1 |
Device requests the driver to suppress notifications. | |
Ranges of feature bits | |
These described in 2.2 Feature Bits | |
#define | DEV_TYPE_FEAT_RANGE_0_BEGIN 0 |
Start of the first device-specific feature range. | |
#define | DEV_TYPE_FEAT_RANGE_0_END 23 |
End of the first device-specific feature range. | |
#define | DEV_TYPE_FEAT_RANGE_1_BEGIN 50 |
Start of the second device-specific feature range. | |
#define | DEV_TYPE_FEAT_RANGE_1_END 127 |
End of the second device-specific feature range. | |
Transport interrupt bits | |
While defined separately in 4.1.4.5 ISR status capabilit for PCI and 4.2.2 MMIO Device Register Layout for MMIO the same bits are responsible for the same interrupts, so defines with them can be unified | |
#define | VIRTIO_QUEUE_INTERRUPT 1 |
A virtqueue has pending used buffers. | |
#define | VIRTIO_DEVICE_CONFIGURATION_INTERRUPT 2 |
Device configuration space has changed. | |
VIRTIO-MMIO registers | |
The details are described in 4.2.2 MMIO Device Register Layout | |
#define | VIRTIO_MMIO_MAGIC_VALUE 0x000 |
Magic value identifying the virtio MMIO device. | |
#define | VIRTIO_MMIO_VERSION 0x004 |
Virtio specification version exposed by the device. | |
#define | VIRTIO_MMIO_DEVICE_ID 0x008 |
Device type identifier register. | |
#define | VIRTIO_MMIO_VENDOR_ID 0x00c |
Vendor-specific identifier register. | |
#define | VIRTIO_MMIO_DEVICE_FEATURES 0x010 |
Lower 32 bits of the device feature bitmap. | |
#define | VIRTIO_MMIO_DEVICE_FEATURES_SEL 0x014 |
Selector choosing the device feature word. | |
#define | VIRTIO_MMIO_DRIVER_FEATURES 0x020 |
Lower 32 bits of the negotiated driver feature bitmap. | |
#define | VIRTIO_MMIO_DRIVER_FEATURES_SEL 0x024 |
Selector choosing the driver feature word. | |
#define | VIRTIO_MMIO_QUEUE_SEL 0x030 |
Virtqueue index selected for subsequent accesses. | |
#define | VIRTIO_MMIO_QUEUE_SIZE_MAX 0x034 |
Maximum queue size supported by the selected virtqueue. | |
#define | VIRTIO_MMIO_QUEUE_SIZE 0x038 |
Queue size chosen by the driver for the selected virtqueue. | |
#define | VIRTIO_MMIO_QUEUE_READY 0x044 |
Ready flag indicating driver ownership of the queue. | |
#define | VIRTIO_MMIO_QUEUE_NOTIFY 0x050 |
Doorbell register for queue notifications. | |
#define | VIRTIO_MMIO_INTERRUPT_STATUS 0x060 |
Pending interrupt summary bits. | |
#define | VIRTIO_MMIO_INTERRUPT_ACK 0x064 |
Interrupt acknowledgment register. | |
#define | VIRTIO_MMIO_STATUS 0x070 |
Device status. | |
#define | VIRTIO_MMIO_QUEUE_DESC_LOW 0x080 |
Lower 32 bits of the descriptor table address. | |
#define | VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084 |
Upper 32 bits of the descriptor table address. | |
#define | VIRTIO_MMIO_QUEUE_AVAIL_LOW 0x090 |
Lower 32 bits of the available ring address. | |
#define | VIRTIO_MMIO_QUEUE_AVAIL_HIGH 0x094 |
Upper 32 bits of the available ring address. | |
#define | VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0 |
Lower 32 bits of the used ring address. | |
#define | VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 |
Upper 32 bits of the used ring address. | |
#define | VIRTIO_MMIO_SHM_SEL 0x0ac |
Shared memory region selector. | |
#define | VIRTIO_MMIO_SHM_LEN_LOW 0x0b0 |
Lower 32 bits of the shared memory length. | |
#define | VIRTIO_MMIO_SHM_LEN_HIGH 0x0b4 |
Upper 32 bits of the shared memory length. | |
#define | VIRTIO_MMIO_SHM_BASE_LOW 0x0b8 |
Lower 32 bits of the shared memory base address. | |
#define | VIRTIO_MMIO_SHM_BASE_HIGH 0x0bc |
Upper 32 bits of the shared memory base address. | |
#define | VIRTIO_MMIO_QUEUE_RESET 0x0c0 |
Queue reset control register. | |
#define | VIRTIO_MMIO_CONFIG_GENERATION 0x0fc |
Generation counter for configuration space. | |
#define | VIRTIO_MMIO_CONFIG 0x100 |
Base offset of the device configuration structure. |
VIRTIO common definitions based on the specification.
Based on Virtual I/O Device (VIRTIO) Version 1.3 specification: https://docs.oasis-open.org/virtio/virtio/v1.3/csd01/virtio-v1.3-csd01.pdf
#define DEV_TYPE_FEAT_RANGE_0_BEGIN 0 |
Start of the first device-specific feature range.
#define DEV_TYPE_FEAT_RANGE_0_END 23 |
End of the first device-specific feature range.
#define DEV_TYPE_FEAT_RANGE_1_BEGIN 50 |
Start of the second device-specific feature range.
#define DEV_TYPE_FEAT_RANGE_1_END 127 |
End of the second device-specific feature range.
#define DEVICE_STATUS_ACKNOWLEDGE 0 |
Indicates the guest has found and recognized the device presence.
#define DEVICE_STATUS_DRIVER 1 |
Indicates the guest driver is ready to drive the device.
#define DEVICE_STATUS_DRIVER_OK 2 |
Indicates the driver has successfully set up the device and is ready.
#define DEVICE_STATUS_FAILED 7 |
Indicates the device has experienced a non-recoverable error.
#define DEVICE_STATUS_FEATURES_OK 3 |
Indicates the driver and device agreed on the negotiated feature set.
#define DEVICE_STATUS_NEEDS_RESET 6 |
Indicates the device requests a reset to recover from an error.
#define VIRTIO_DEVICE_CONFIGURATION_INTERRUPT 2 |
Device configuration space has changed.
#define VIRTIO_F_ACCESS_PLATFORM 33 |
Indicates device needs platform-specific handling.
#define VIRTIO_F_VERSION_1 32 |
Indicates device complies with Virtio 1.0+ semantics.
#define VIRTIO_MMIO_CONFIG 0x100 |
Base offset of the device configuration structure.
#define VIRTIO_MMIO_CONFIG_GENERATION 0x0fc |
Generation counter for configuration space.
#define VIRTIO_MMIO_DEVICE_FEATURES 0x010 |
Lower 32 bits of the device feature bitmap.
#define VIRTIO_MMIO_DEVICE_FEATURES_SEL 0x014 |
Selector choosing the device feature word.
#define VIRTIO_MMIO_DEVICE_ID 0x008 |
Device type identifier register.
#define VIRTIO_MMIO_DRIVER_FEATURES 0x020 |
Lower 32 bits of the negotiated driver feature bitmap.
#define VIRTIO_MMIO_DRIVER_FEATURES_SEL 0x024 |
Selector choosing the driver feature word.
#define VIRTIO_MMIO_INTERRUPT_ACK 0x064 |
Interrupt acknowledgment register.
#define VIRTIO_MMIO_INTERRUPT_STATUS 0x060 |
Pending interrupt summary bits.
#define VIRTIO_MMIO_MAGIC_VALUE 0x000 |
Magic value identifying the virtio MMIO device.
#define VIRTIO_MMIO_QUEUE_AVAIL_HIGH 0x094 |
Upper 32 bits of the available ring address.
#define VIRTIO_MMIO_QUEUE_AVAIL_LOW 0x090 |
Lower 32 bits of the available ring address.
#define VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084 |
Upper 32 bits of the descriptor table address.
#define VIRTIO_MMIO_QUEUE_DESC_LOW 0x080 |
Lower 32 bits of the descriptor table address.
#define VIRTIO_MMIO_QUEUE_NOTIFY 0x050 |
Doorbell register for queue notifications.
#define VIRTIO_MMIO_QUEUE_READY 0x044 |
Ready flag indicating driver ownership of the queue.
#define VIRTIO_MMIO_QUEUE_RESET 0x0c0 |
Queue reset control register.
#define VIRTIO_MMIO_QUEUE_SEL 0x030 |
Virtqueue index selected for subsequent accesses.
#define VIRTIO_MMIO_QUEUE_SIZE 0x038 |
Queue size chosen by the driver for the selected virtqueue.
#define VIRTIO_MMIO_QUEUE_SIZE_MAX 0x034 |
Maximum queue size supported by the selected virtqueue.
#define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 |
Upper 32 bits of the used ring address.
#define VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0 |
Lower 32 bits of the used ring address.
#define VIRTIO_MMIO_SHM_BASE_HIGH 0x0bc |
Upper 32 bits of the shared memory base address.
#define VIRTIO_MMIO_SHM_BASE_LOW 0x0b8 |
Lower 32 bits of the shared memory base address.
#define VIRTIO_MMIO_SHM_LEN_HIGH 0x0b4 |
Upper 32 bits of the shared memory length.
#define VIRTIO_MMIO_SHM_LEN_LOW 0x0b0 |
Lower 32 bits of the shared memory length.
#define VIRTIO_MMIO_SHM_SEL 0x0ac |
Shared memory region selector.
#define VIRTIO_MMIO_STATUS 0x070 |
Device status.
#define VIRTIO_MMIO_VENDOR_ID 0x00c |
Vendor-specific identifier register.
#define VIRTIO_MMIO_VERSION 0x004 |
Virtio specification version exposed by the device.
#define VIRTIO_QUEUE_INTERRUPT 1 |
A virtqueue has pending used buffers.
#define VIRTIO_RING_F_EVENT_IDX 29 |
Indicates driver/device use event index for notifications.
#define VIRTIO_RING_F_INDIRECT_DESC 28 |
Indicates descriptors can reference descriptor tables.
#define VIRTQ_AVAIL_F_NO_INTERRUPT 1 |
Driver requests the device to skip interrupts.
This is valid if VIRTIO_RING_F_EVENT_IDX negotiated.
#define VIRTQ_USED_F_NO_NOTIFY 1 |
Device requests the driver to suppress notifications.
This is valid if VIRTIO_RING_F_EVENT_IDX negotiated.