1266951Sbryanv/*-
2266951Sbryanv * This header is BSD licensed so anyone can use the definitions to implement
3266951Sbryanv * compatible drivers/servers.
4266951Sbryanv *
5266951Sbryanv * Redistribution and use in source and binary forms, with or without
6266951Sbryanv * modification, are permitted provided that the following conditions
7266951Sbryanv * are met:
8266951Sbryanv * 1. Redistributions of source code must retain the above copyright
9266951Sbryanv *    notice, this list of conditions and the following disclaimer.
10266951Sbryanv * 2. Redistributions in binary form must reproduce the above copyright
11266951Sbryanv *    notice, this list of conditions and the following disclaimer in the
12266951Sbryanv *    documentation and/or other materials provided with the distribution.
13266951Sbryanv * 3. Neither the name of IBM nor the names of its contributors
14266951Sbryanv *    may be used to endorse or promote products derived from this software
15266951Sbryanv *    without specific prior written permission.
16266951Sbryanv * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17266951Sbryanv * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18266951Sbryanv * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19266951Sbryanv * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
20266951Sbryanv * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21266951Sbryanv * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22266951Sbryanv * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23266951Sbryanv * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24266951Sbryanv * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25266951Sbryanv * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26266951Sbryanv * SUCH DAMAGE.
27266951Sbryanv *
28266951Sbryanv * $FreeBSD$
29266951Sbryanv */
30266951Sbryanv
31266951Sbryanv#ifndef _VIRTIO_CONFIG_H_
32266951Sbryanv#define _VIRTIO_CONFIG_H_
33266951Sbryanv
34266951Sbryanv/* Status byte for guest to report progress. */
35266951Sbryanv#define VIRTIO_CONFIG_STATUS_RESET	0x00
36266951Sbryanv#define VIRTIO_CONFIG_STATUS_ACK	0x01
37266951Sbryanv#define VIRTIO_CONFIG_STATUS_DRIVER	0x03
38266951Sbryanv#define VIRTIO_CONFIG_STATUS_DRIVER_OK	0x04
39266951Sbryanv#define VIRTIO_CONFIG_STATUS_FAILED	0x80
40266951Sbryanv
41266951Sbryanv/*
42266951Sbryanv * Generate interrupt when the virtqueue ring is
43266951Sbryanv * completely used, even if we've suppressed them.
44266951Sbryanv */
45266951Sbryanv#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24)
46266951Sbryanv
47268010Sbryanv/* Support for indirect buffer descriptors. */
48268010Sbryanv#define VIRTIO_RING_F_INDIRECT_DESC	(1 << 28)
49268010Sbryanv
50268010Sbryanv/* Support to suppress interrupt until specific index is reached. */
51268010Sbryanv#define VIRTIO_RING_F_EVENT_IDX		(1 << 29)
52268010Sbryanv
53266951Sbryanv/*
54266951Sbryanv * The guest should never negotiate this feature; it
55266951Sbryanv * is used to detect faulty drivers.
56266951Sbryanv */
57266951Sbryanv#define VIRTIO_F_BAD_FEATURE (1 << 30)
58266951Sbryanv
59266951Sbryanv/*
60266951Sbryanv * Some VirtIO feature bits (currently bits 28 through 31) are
61266951Sbryanv * reserved for the transport being used (eg. virtio_ring), the
62266951Sbryanv * rest are per-device feature bits.
63266951Sbryanv */
64266951Sbryanv#define VIRTIO_TRANSPORT_F_START	28
65266951Sbryanv#define VIRTIO_TRANSPORT_F_END		32
66266951Sbryanv
67266951Sbryanv#endif /* _VIRTIO_CONFIG_H_ */
68