28#include <l4/sys/utcb.h>
29#include <l4/sys/ipc.h>
35 L4VIRTIO_PROTOCOL = 0,
40 L4VIRTIO_MAGIC = 0x74726976
45 L4VIRTIO_VENDOR_KK = 0x44
262 return (
void *)(((
l4_addr_t)cfg) + 0x100);
271 unsigned idx = feat / 32;
274 feature_map[idx] |= 1UL << (feat % 32);
283 unsigned idx = feat / 32;
286 feature_map[idx] &= ~(1UL << (feat % 32));
295 unsigned idx = feat / 32;
300 return feature_map[idx] & (1UL << (feat % 32));
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_addr_t
Address type.
unsigned int l4_uint32_t
Unsigned 32bit value.
unsigned short int l4_uint16_t
Unsigned 16bit value.
unsigned long long l4_uint64_t
Unsigned 64bit value.
unsigned long l4_cap_idx_t
Capability selector type.
#define L4_CV
Define calling convention.
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
#define L4_INLINE
L4 Inline function attribute.
#define EXTERN_C_BEGIN
Start section with C types and functions.
#define EXTERN_C_END
End section with C types and functions.
L4virtio_feature_bits
L4virtio-specific feature bits.
L4virtio_device_status
Virtio device status bits.
int l4virtio_set_status(l4_cap_idx_t cap, unsigned status) L4_NOTHROW
int l4virtio_device_notification_irq(l4_cap_idx_t cap, unsigned index, l4_cap_idx_t irq) L4_NOTHROW
L4_virtio_opcodes
Opcodes to setup and configure a device.
l4virtio_config_queue_t * l4virtio_config_queues(l4virtio_config_hdr_t const *cfg)
Get the pointer to the first queue config.
L4_virtio_cmd
Virtio commands for device configuration.
L4_virtio_protocol
L4-VIRTIO protocol number.
int l4virtio_config_queue(l4_cap_idx_t cap, unsigned queue) L4_NOTHROW
int l4virtio_device_config_ds(l4_cap_idx_t cap, l4_cap_idx_t config_ds, l4_addr_t *ds_offset) L4_NOTHROW
L4virtio_device_ids
Virtio device IDs as reported in the driver's config space.
void * l4virtio_device_config(l4virtio_config_hdr_t const *cfg)
Get the pointer to the device configuration.
void l4virtio_clear_feature(l4_uint32_t *feature_map, unsigned feat)
Clear the given feature bit in a feature map.
void l4virtio_set_feature(l4_uint32_t *feature_map, unsigned feat)
Set the given feature bit in a feature map.
int l4virtio_register_ds(l4_cap_idx_t cap, l4_cap_idx_t ds_cap, l4_uint64_t base, l4_umword_t offset, l4_umword_t size) L4_NOTHROW
unsigned l4virtio_get_feature(l4_uint32_t *feature_map, unsigned feat)
Check if the given bit in a feature map is set.
L4_virtio_irq_status
VIRTIO IRQ status codes (l4virtio_config_hdr_t::irq_status).
@ L4VIRTIO_FEATURE_CMD_CONFIG
Status and queue config are set via cmd field instead of via IPC.
@ L4VIRTIO_FEATURE_VERSION_1
Virtio protocol version 1 supported. Must be 1 for L4virtio.
@ L4VIRTIO_STATUS_DRIVER
Guest OS knows how to drive device.
@ L4VIRTIO_STATUS_FAILED
Driver detected fatal error.
@ L4VIRTIO_STATUS_ACKNOWLEDGE
Guest OS has found device.
@ L4VIRTIO_STATUS_FEATURES_OK
Driver has acknowledged feature set.
@ L4VIRTIO_STATUS_DRIVER_OK
Driver is set up.
@ L4VIRTIO_STATUS_DEVICE_NEEDS_RESET
Device detected fatal error.
@ L4VIRTIO_OP_SET_STATUS
Write device status register.
@ L4VIRTIO_OP_GET_DEVICE_IRQ
Retrieve device notification IRQ.
@ L4VIRTIO_OP_DEVICE_CONFIG
Get device config page.
@ L4VIRTIO_OP_CONFIG_QUEUE
Configure queue.
@ L4VIRTIO_OP_REGISTER_DS
Register shared memory with device.
@ L4VIRTIO_CMD_NOTIFY_QUEUE
Configure a queue.
@ L4VIRTIO_CMD_NONE
No command pending.
@ L4VIRTIO_CMD_SET_STATUS
Set the status register.
@ L4VIRTIO_CMD_CFG_QUEUE
Configure a queue.
@ L4VIRTIO_CMD_MASK
Mask to get command bits.
@ L4VIRTIO_CMD_CFG_CHANGED
Device config changed.
@ L4VIRTIO_ID_SCSI
SCSI host device.
@ L4VIRTIO_ID_BLOCK
General block device.
@ L4VIRTIO_ID_BALLOON
Memory ballooning device.
@ L4VIRTIO_ID_RPMSG
Device using rpmsg protocol.
@ L4VIRTIO_ID_INPUT
Input.
@ L4VIRTIO_ID_RPROC_SERIAL
Rproc serial device.
@ L4VIRTIO_ID_CONSOLE
Simple device for data IO via ports.
@ L4VIRTIO_ID_RNG
Entropy source.
@ L4VIRTIO_ID_NET
Virtual ethernet card.
@ L4VIRTIO_ID_SOCK
Unofficial socket device.
@ L4VIRTIO_ID_CRYPTO
Crypto.
@ L4VIRTIO_ID_VSOCK
Vsock transport.
@ L4VIRTIO_ID_9P
Device using 9P transport protocol.
@ L4VIRTIO_ID_CAIF
Device using CAIF network protocol.
@ L4VIRTIO_ID_SCMI
Scmi device.
@ L4VIRTIO_IRQ_STATUS_VRING
VRING IRQ pending flag.
@ L4VIRTIO_IRQ_STATUS_CONFIG
CONFIG IRQ pending flag.
Common L4 ABI Data Types.
L4-VIRTIO config header, provided in shared data space.
l4_uint32_t vendor
vendor ID
l4_uint32_t magic
magic value (must be 'virt').
l4_uint32_t dev_features
device features windows selected by device_feature_sel
l4_uint32_t queues_offset
offset of virtqueue config array
l4_uint32_t device
device ID
l4_uint32_t num_queues
number of virtqueues
l4_uint32_t version
VIRTIO version.
Queue configuration entry.
l4_uint16_t device_notify_index
R: Event index to be used by the driver (driver to device)
l4_uint16_t driver_notify_index
W: Event index to be used for device notifications (device to driver)
l4_uint64_t avail_addr
W: address of available ring.
l4_uint64_t desc_addr
W: address of descriptor table.
l4_uint64_t used_addr
W: address of used ring.
l4_uint16_t ready
RW: queue ready flag (read-write)
l4_uint16_t num_max
R: maximum number of descriptors supported by this queue.
l4_uint16_t num
RW: number of descriptors configured for this queue.