Skip to content

Commit

Permalink
virtio: follow virtio 1.2 spec, add more virtio status and device
Browse files Browse the repository at this point in the history
Signed-off-by: Wang Bowen <[email protected]>
  • Loading branch information
CV-Bowen committed May 12, 2023
1 parent accac4d commit ea14a9d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
37 changes: 27 additions & 10 deletions lib/include/openamp/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,37 @@ extern "C" {
#endif

/* VirtIO device IDs. */
#define VIRTIO_ID_NETWORK 0x01UL
#define VIRTIO_ID_BLOCK 0x02UL
#define VIRTIO_ID_CONSOLE 0x03UL
#define VIRTIO_ID_ENTROPY 0x04UL
#define VIRTIO_ID_BALLOON 0x05UL
#define VIRTIO_ID_IOMEMORY 0x06UL
#define VIRTIO_ID_RPMSG 0x07UL /* remote processor messaging */
#define VIRTIO_ID_SCSI 0x08UL
#define VIRTIO_ID_9P 0x09UL
#define VIRTIO_DEV_ANY_ID (-1)UL
#define VIRTIO_ID_NETWORK 1UL
#define VIRTIO_ID_BLOCK 2UL
#define VIRTIO_ID_CONSOLE 3UL
#define VIRTIO_ID_ENTROPY 4UL
#define VIRTIO_ID_BALLOON 5UL
#define VIRTIO_ID_IOMEMORY 6UL
#define VIRTIO_ID_RPMSG 7UL /* remote processor messaging */
#define VIRTIO_ID_SCSI 8UL
#define VIRTIO_ID_9P 9UL
#define VIRTIO_ID_GPU 16UL
#define VIRTIO_ID_INPUT 18UL
#define VIRTIO_ID_VSOCK 19UL
#define VIRTIO_ID_CRYPTO 20UL
#define VIRTIO_ID_IOMMU 23UL
#define VIRTIO_ID_MEM 24UL
#define VIRTIO_ID_SOUND 25UL
#define VIRTIO_ID_FS 26UL
#define VIRTIO_ID_PMEM 27UL
#define VIRTIO_ID_RPMB 28UL
#define VIRTIO_ID_SCMI 32UL
#define VIRTIO_ID_I2C_ADAPTER 34UL
#define VIRTIO_ID_BT 40UL
#define VIRTIO_ID_GPIO 41UL
#define VIRTIO_DEV_ANY_ID -1UL

/* Status byte for guest to report progress. */
#define VIRTIO_CONFIG_STATUS_RESET 0x00
#define VIRTIO_CONFIG_STATUS_ACK 0x01
#define VIRTIO_CONFIG_STATUS_DRIVER 0x02
#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
#define VIRTIO_CONFIG_FEATURES_OK 0x08
#define VIRTIO_CONFIG_STATUS_NEEDS_RESET 0x40
#define VIRTIO_CONFIG_STATUS_FAILED 0x80

Expand Down Expand Up @@ -65,6 +81,7 @@ __deprecated static inline int deprecated_virtio_dev_slave(void)
struct virtio_device_id {
uint32_t device;
uint32_t vendor;
uint32_t version;
};

/*
Expand Down
14 changes: 14 additions & 0 deletions lib/virtio/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ static const struct virtio_ident {
VIRTIO_ID_IOMEMORY, "IOMemory"}, {
VIRTIO_ID_SCSI, "SCSI"}, {
VIRTIO_ID_9P, "9P Transport"}, {
VIRTIO_ID_GPU, "GPU"}, {
VIRTIO_ID_INPUT, "Input"}, {
VIRTIO_ID_VSOCK, "Vsock Transport"}, {
VIRTIO_ID_CRYPTO, "Crypto"}, {
VIRTIO_ID_IOMMU, "IOMMU"}, {
VIRTIO_ID_MEM, "Memory"}, {
VIRTIO_ID_SOUND, "Sound"}, {
VIRTIO_ID_FS, "File System"}, {
VIRTIO_ID_PMEM, "Pmem"}, {
VIRTIO_ID_RPMB, "RPMB"}, {
VIRTIO_ID_SCMI, "SCMI"}, {
VIRTIO_ID_I2C_ADAPTER, "I2C Adapter"}, {
VIRTIO_ID_BT, "Bluetooth"}, {
VIRTIO_ID_GPIO, "GPIO" }, {
0, NULL}
};

Expand Down

0 comments on commit ea14a9d

Please sign in to comment.