/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2021-9-16 GuEe-GUI the first version * 2021-11-11 GuEe-GUI modify to virtio common interface */ #ifndef __VIRTIO_MMIO_H__ #define __VIRTIO_MMIO_H__ #include struct virtio_mmio_config { rt_uint32_t magic; /* [0x00] Magic value */ rt_uint32_t version; /* [0x04] Device version number */ rt_uint32_t device_id; /* [0x08] Virtio Subsystem Device ID */ rt_uint32_t vendor_id; /* [0x0c] Virtio Subsystem Vendor ID */ rt_uint32_t device_features; /* [0x10] Flags representing features the device supports */ rt_uint32_t device_features_sel; /* [0x14] Device (host) features word selection. */ rt_uint32_t res0[2]; /* [0x18] */ rt_uint32_t driver_features; /* [0x20] Device features understood and activated by the driver */ rt_uint32_t driver_features_sel; /* [0x24] Activated (guest) features word selection */ rt_uint32_t guest_page_size; /* [0x28] Guest page size, this value should be a power of 2 */ rt_uint32_t res1[1]; /* [0x2c] */ rt_uint32_t queue_sel; /* [0x30] Virtual queue index */ rt_uint32_t queue_num_max; /* [0x34] Maximum virtual queue size */ rt_uint32_t queue_num; /* [0x38] Virtual queue size */ rt_uint32_t queue_align; /* [0x3c] Used Ring alignment in the virtual queue */ rt_uint32_t queue_pfn; /* [0x40] Guest physical page number of the virtual queue */ rt_uint32_t queue_ready; /* [0x44] Virtual queue ready bit */ rt_uint32_t res2[2]; /* [0x48] */ rt_uint32_t queue_notify; /* [0x50] Queue notifier */ rt_uint32_t res3[3]; /* [0x54] */ rt_uint32_t interrupt_status; /* [0x60] Interrupt status */ rt_uint32_t interrupt_ack; /* [0x64] Interrupt acknowledge */ rt_uint32_t res4[2]; /* [0x68] */ rt_uint32_t status; /* [0x70] Device status */ rt_uint32_t res5[3]; /* [0x74] */ rt_uint32_t queue_desc_low; /* [0x80] Virtual queue’s Descriptor Area 64 bit long physical address */ rt_uint32_t queue_desc_high; /* [0x84] */ rt_uint32_t res6[2]; /* [0x88] */ rt_uint32_t queue_driver_low; /* [0x90] Virtual queue’s Driver Area 64 bit long physical address */ rt_uint32_t queue_driver_high; /* [0x94] */ rt_uint32_t res7[2]; /* [0x98] */ rt_uint32_t queue_device_low; /* [0xa0] Virtual queue’s Device Area 64 bit long physical address */ rt_uint32_t queue_device_high; /* [0xa4] */ rt_uint32_t res8[21]; /* [0xa8] */ rt_uint32_t config_generation; /* [0xfc] Configuration atomicity value */ rt_uint32_t config[]; /* [0x100+] Configuration space */ } __attribute__((packed)); #endif /* __VIRTIO_MMIO_H__ */