19a732166SBryan Venteicher /*- 29a732166SBryan Venteicher * This header is BSD licensed so anyone can use the definitions to implement 39a732166SBryan Venteicher * compatible drivers/servers. 49a732166SBryan Venteicher * 59a732166SBryan Venteicher * Redistribution and use in source and binary forms, with or without 69a732166SBryan Venteicher * modification, are permitted provided that the following conditions 79a732166SBryan Venteicher * are met: 89a732166SBryan Venteicher * 1. Redistributions of source code must retain the above copyright 99a732166SBryan Venteicher * notice, this list of conditions and the following disclaimer. 109a732166SBryan Venteicher * 2. Redistributions in binary form must reproduce the above copyright 119a732166SBryan Venteicher * notice, this list of conditions and the following disclaimer in the 129a732166SBryan Venteicher * documentation and/or other materials provided with the distribution. 139a732166SBryan Venteicher * 3. Neither the name of IBM nor the names of its contributors 149a732166SBryan Venteicher * may be used to endorse or promote products derived from this software 159a732166SBryan Venteicher * without specific prior written permission. 169a732166SBryan Venteicher * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179a732166SBryan Venteicher * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 189a732166SBryan Venteicher * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 199a732166SBryan Venteicher * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE 209a732166SBryan Venteicher * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219a732166SBryan Venteicher * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229a732166SBryan Venteicher * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239a732166SBryan Venteicher * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249a732166SBryan Venteicher * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259a732166SBryan Venteicher * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269a732166SBryan Venteicher * SUCH DAMAGE. 279a732166SBryan Venteicher */ 289a732166SBryan Venteicher 299a732166SBryan Venteicher #ifndef _VIRTIO_CONFIG_H_ 309a732166SBryan Venteicher #define _VIRTIO_CONFIG_H_ 319a732166SBryan Venteicher 329a732166SBryan Venteicher /* Status byte for guest to report progress. */ 339a732166SBryan Venteicher #define VIRTIO_CONFIG_STATUS_RESET 0x00 34*56f63b73SBryan Venteicher /* We have seen device and processed generic fields. */ 359a732166SBryan Venteicher #define VIRTIO_CONFIG_STATUS_ACK 0x01 36*56f63b73SBryan Venteicher /* We have found a driver for the device. */ 37*56f63b73SBryan Venteicher #define VIRTIO_CONFIG_STATUS_DRIVER 0x02 38*56f63b73SBryan Venteicher /* Driver has used its parts of the config, and is happy. */ 399a732166SBryan Venteicher #define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04 40*56f63b73SBryan Venteicher /* Driver has finished configuring features (modern only). */ 41*56f63b73SBryan Venteicher #define VIRTIO_CONFIG_S_FEATURES_OK 0x08 42*56f63b73SBryan Venteicher /* Device entered invalid state, driver must reset it. */ 43*56f63b73SBryan Venteicher #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40 44*56f63b73SBryan Venteicher /* We've given up on this device. */ 459a732166SBryan Venteicher #define VIRTIO_CONFIG_STATUS_FAILED 0x80 469a732166SBryan Venteicher 479a732166SBryan Venteicher /* 489a732166SBryan Venteicher * Generate interrupt when the virtqueue ring is 499a732166SBryan Venteicher * completely used, even if we've suppressed them. 509a732166SBryan Venteicher */ 51*56f63b73SBryan Venteicher #define VIRTIO_F_NOTIFY_ON_EMPTY (1UL << 24) 52*56f63b73SBryan Venteicher 53*56f63b73SBryan Venteicher /* Can the device handle any descriptor layout? */ 54*56f63b73SBryan Venteicher #define VIRTIO_F_ANY_LAYOUT (1UL << 27) 559a732166SBryan Venteicher 5645543f07SBryan Venteicher /* Support for indirect buffer descriptors. */ 57*56f63b73SBryan Venteicher #define VIRTIO_RING_F_INDIRECT_DESC (1UL << 28) 5845543f07SBryan Venteicher 5945543f07SBryan Venteicher /* Support to suppress interrupt until specific index is reached. */ 60*56f63b73SBryan Venteicher #define VIRTIO_RING_F_EVENT_IDX (1UL << 29) 6145543f07SBryan Venteicher 629a732166SBryan Venteicher /* 639a732166SBryan Venteicher * The guest should never negotiate this feature; it 649a732166SBryan Venteicher * is used to detect faulty drivers. 659a732166SBryan Venteicher */ 66*56f63b73SBryan Venteicher #define VIRTIO_F_BAD_FEATURE (1UL << 30) 67*56f63b73SBryan Venteicher 68*56f63b73SBryan Venteicher /* v1.0 compliant. */ 69*56f63b73SBryan Venteicher #define VIRTIO_F_VERSION_1 (1ULL << 32) 709a732166SBryan Venteicher 719a732166SBryan Venteicher /* 72*56f63b73SBryan Venteicher * If clear - device has the IOMMU bypass quirk feature. 73*56f63b73SBryan Venteicher * If set - use platform tools to detect the IOMMU. 74*56f63b73SBryan Venteicher * 75*56f63b73SBryan Venteicher * Note the reverse polarity (compared to most other features), 76*56f63b73SBryan Venteicher * this is for compatibility with legacy systems. 77*56f63b73SBryan Venteicher */ 78*56f63b73SBryan Venteicher #define VIRTIO_F_IOMMU_PLATFORM (1ULL << 33) 79*56f63b73SBryan Venteicher 80*56f63b73SBryan Venteicher /* 81*56f63b73SBryan Venteicher * Some VirtIO feature bits (currently bits 28 through 34) are 829a732166SBryan Venteicher * reserved for the transport being used (eg. virtio_ring), the 839a732166SBryan Venteicher * rest are per-device feature bits. 849a732166SBryan Venteicher */ 859a732166SBryan Venteicher #define VIRTIO_TRANSPORT_F_START 28 86*56f63b73SBryan Venteicher #define VIRTIO_TRANSPORT_F_END 34 879a732166SBryan Venteicher 889a732166SBryan Venteicher #endif /* _VIRTIO_CONFIG_H_ */ 89