Changeset 1c53d93 in mainline for uspace/lib/virtio/virtio-pci.h


Ignore:
Timestamp:
2018-05-22T19:06:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cbcb34c
Parents:
659bd24
git-author:
Jakub Jermar <jakub@…> (2018-05-03 18:50:49)
git-committer:
Jakub Jermar <jakub@…> (2018-05-22 19:06:50)
Message:

Add Virtqueue definitions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/virtio/virtio-pci.h

    r659bd24 r1c53d93  
    5858#define VIRTIO_DEV_STATUS_FAILED                128
    5959
    60 /** Common configuration structure layout according to VIRTIO v1. */
     60/** Common configuration structure layout according to VIRTIO version 1.0 */
    6161typedef struct virtio_pci_common_cfg {
    6262        ioport32_t device_feature_select;
     
    7878} virtio_pci_common_cfg_t;
    7979
     80/** The buffer continues in the next descriptor */
     81#define VIRTQ_DESC_F_NEXT       1
     82/** Device write-only buffer */
     83#define VIRTQ_DESC_F_WRITE      2
     84/** Buffer contains a list of buffer descriptors */
     85#define VIRTQ_DESC_F_INDIRECT   4
     86
     87/** Virtqueue Descriptor structure as per VIRTIO version 1.0 */
     88typedef struct virtq_desc {
     89        ioport64_t addr;        /**< Buffer physical address */
     90        ioport32_t len;         /**< Buffer length */
     91        ioport16_t flags;       /**< Buffer flags */
     92        ioport16_t next;        /**< Continuation descriptor */
     93} virtq_desc_t;
     94
     95#define VIRTQ_AVAIL_F_NO_INTERRUPT      1
     96
     97/** Virtqueue Available Ring as per VIRTIO version 1.0 */
     98typedef struct virtq_avail {
     99        ioport16_t flags;
     100        ioport16_t idx;
     101        ioport16_t ring[];
     102        /*
     103         * We do not define the optional used_event member here in order to be
     104         * able to define ring as a variable-length array.
     105         */
     106} virtq_avail_t;
     107
     108typedef struct virtq_used_elem {
     109        ioport32_t id;
     110        ioport32_t len;
     111} virtq_used_elem_t;
     112
     113#define VIRTQ_USED_F_NO_NOTIFY  1
     114
     115/** Virtqueue Used Ring as per VIRTIO version 1.0 */
     116typedef struct virtq_used {
     117        ioport16_t flags;
     118        ioport16_t idx;
     119        virtq_used_elem_t ring[];
     120        /*
     121         * We do not define the optional avail_event member here in order to be
     122         * able to define ring as a variable-length array.
     123         */
     124} virtq_used_t;
     125
     126/** VIRTIO-device specific data associated with the NIC framework nic_t */
    80127typedef struct {
    81128        struct {
Note: See TracChangeset for help on using the changeset viewer.