1*9fbe302bSMichael S. Tsirkin #ifndef _LINUX_VIRTIO_CONFIG_H
2*9fbe302bSMichael S. Tsirkin #define _LINUX_VIRTIO_CONFIG_H
3*9fbe302bSMichael S. Tsirkin /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4*9fbe302bSMichael S. Tsirkin  * anyone can use the definitions to implement compatible drivers/servers.
5*9fbe302bSMichael S. Tsirkin  *
6*9fbe302bSMichael S. Tsirkin  * Redistribution and use in source and binary forms, with or without
7*9fbe302bSMichael S. Tsirkin  * modification, are permitted provided that the following conditions
8*9fbe302bSMichael S. Tsirkin  * are met:
9*9fbe302bSMichael S. Tsirkin  * 1. Redistributions of source code must retain the above copyright
10*9fbe302bSMichael S. Tsirkin  *    notice, this list of conditions and the following disclaimer.
11*9fbe302bSMichael S. Tsirkin  * 2. Redistributions in binary form must reproduce the above copyright
12*9fbe302bSMichael S. Tsirkin  *    notice, this list of conditions and the following disclaimer in the
13*9fbe302bSMichael S. Tsirkin  *    documentation and/or other materials provided with the distribution.
14*9fbe302bSMichael S. Tsirkin  * 3. Neither the name of IBM nor the names of its contributors
15*9fbe302bSMichael S. Tsirkin  *    may be used to endorse or promote products derived from this software
16*9fbe302bSMichael S. Tsirkin  *    without specific prior written permission.
17*9fbe302bSMichael S. Tsirkin  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18*9fbe302bSMichael S. Tsirkin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*9fbe302bSMichael S. Tsirkin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*9fbe302bSMichael S. Tsirkin  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21*9fbe302bSMichael S. Tsirkin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*9fbe302bSMichael S. Tsirkin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*9fbe302bSMichael S. Tsirkin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*9fbe302bSMichael S. Tsirkin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*9fbe302bSMichael S. Tsirkin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*9fbe302bSMichael S. Tsirkin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*9fbe302bSMichael S. Tsirkin  * SUCH DAMAGE. */
28*9fbe302bSMichael S. Tsirkin 
29*9fbe302bSMichael S. Tsirkin /* Virtio devices use a standardized configuration space to define their
30*9fbe302bSMichael S. Tsirkin  * features and pass configuration information, but each implementation can
31*9fbe302bSMichael S. Tsirkin  * store and access that space differently. */
32*9fbe302bSMichael S. Tsirkin #include "standard-headers/linux/types.h"
33*9fbe302bSMichael S. Tsirkin 
34*9fbe302bSMichael S. Tsirkin /* Status byte for guest to report progress, and synchronize features. */
35*9fbe302bSMichael S. Tsirkin /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
36*9fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_ACKNOWLEDGE	1
37*9fbe302bSMichael S. Tsirkin /* We have found a driver for the device. */
38*9fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_DRIVER		2
39*9fbe302bSMichael S. Tsirkin /* Driver has used its parts of the config, and is happy */
40*9fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_DRIVER_OK	4
41*9fbe302bSMichael S. Tsirkin /* Driver has finished configuring features */
42*9fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_FEATURES_OK	8
43*9fbe302bSMichael S. Tsirkin /* We've given up on this device. */
44*9fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_FAILED		0x80
45*9fbe302bSMichael S. Tsirkin 
46*9fbe302bSMichael S. Tsirkin /* Some virtio feature bits (currently bits 28 through 32) are reserved for the
47*9fbe302bSMichael S. Tsirkin  * transport being used (eg. virtio_ring), the rest are per-device feature
48*9fbe302bSMichael S. Tsirkin  * bits. */
49*9fbe302bSMichael S. Tsirkin #define VIRTIO_TRANSPORT_F_START	28
50*9fbe302bSMichael S. Tsirkin #define VIRTIO_TRANSPORT_F_END		33
51*9fbe302bSMichael S. Tsirkin 
52*9fbe302bSMichael S. Tsirkin #ifndef VIRTIO_CONFIG_NO_LEGACY
53*9fbe302bSMichael S. Tsirkin /* Do we get callbacks when the ring is completely used, even if we've
54*9fbe302bSMichael S. Tsirkin  * suppressed them? */
55*9fbe302bSMichael S. Tsirkin #define VIRTIO_F_NOTIFY_ON_EMPTY	24
56*9fbe302bSMichael S. Tsirkin 
57*9fbe302bSMichael S. Tsirkin /* Can the device handle any descriptor layout? */
58*9fbe302bSMichael S. Tsirkin #define VIRTIO_F_ANY_LAYOUT		27
59*9fbe302bSMichael S. Tsirkin #endif /* VIRTIO_CONFIG_NO_LEGACY */
60*9fbe302bSMichael S. Tsirkin 
61*9fbe302bSMichael S. Tsirkin /* v1.0 compliant. */
62*9fbe302bSMichael S. Tsirkin #define VIRTIO_F_VERSION_1		32
63*9fbe302bSMichael S. Tsirkin 
64*9fbe302bSMichael S. Tsirkin #endif /* _LINUX_VIRTIO_CONFIG_H */
65