diff options
Diffstat (limited to 'include/linux/virtio_config.h')
-rw-r--r-- | include/linux/virtio_config.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 50db245c81ad..bf8ec283b232 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef _LINUX_VIRTIO_CONFIG_H | 1 | #ifndef _LINUX_VIRTIO_CONFIG_H |
2 | #define _LINUX_VIRTIO_CONFIG_H | 2 | #define _LINUX_VIRTIO_CONFIG_H |
3 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | ||
4 | * anyone can use the definitions to implement compatible drivers/servers. */ | ||
5 | |||
3 | /* Virtio devices use a standardized configuration space to define their | 6 | /* Virtio devices use a standardized configuration space to define their |
4 | * features and pass configuration information, but each implementation can | 7 | * features and pass configuration information, but each implementation can |
5 | * store and access that space differently. */ | 8 | * store and access that space differently. */ |
@@ -15,6 +18,16 @@ | |||
15 | /* We've given up on this device. */ | 18 | /* We've given up on this device. */ |
16 | #define VIRTIO_CONFIG_S_FAILED 0x80 | 19 | #define VIRTIO_CONFIG_S_FAILED 0x80 |
17 | 20 | ||
21 | /* Some virtio feature bits (currently bits 28 through 31) are reserved for the | ||
22 | * transport being used (eg. virtio_ring), the rest are per-device feature | ||
23 | * bits. */ | ||
24 | #define VIRTIO_TRANSPORT_F_START 28 | ||
25 | #define VIRTIO_TRANSPORT_F_END 32 | ||
26 | |||
27 | /* Do we get callbacks when the ring is completely used, even if we've | ||
28 | * suppressed them? */ | ||
29 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 | ||
30 | |||
18 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
19 | #include <linux/virtio.h> | 32 | #include <linux/virtio.h> |
20 | 33 | ||
@@ -48,9 +61,10 @@ | |||
48 | * @get_features: get the array of feature bits for this device. | 61 | * @get_features: get the array of feature bits for this device. |
49 | * vdev: the virtio_device | 62 | * vdev: the virtio_device |
50 | * Returns the first 32 feature bits (all we currently need). | 63 | * Returns the first 32 feature bits (all we currently need). |
51 | * @set_features: confirm what device features we'll be using. | 64 | * @finalize_features: confirm what device features we'll be using. |
52 | * vdev: the virtio_device | 65 | * vdev: the virtio_device |
53 | * feature: the first 32 feature bits | 66 | * This gives the final feature bits for the device: it can change |
67 | * the dev->feature bits if it wants. | ||
54 | */ | 68 | */ |
55 | struct virtio_config_ops | 69 | struct virtio_config_ops |
56 | { | 70 | { |
@@ -66,7 +80,7 @@ struct virtio_config_ops | |||
66 | void (*callback)(struct virtqueue *)); | 80 | void (*callback)(struct virtqueue *)); |
67 | void (*del_vq)(struct virtqueue *vq); | 81 | void (*del_vq)(struct virtqueue *vq); |
68 | u32 (*get_features)(struct virtio_device *vdev); | 82 | u32 (*get_features)(struct virtio_device *vdev); |
69 | void (*set_features)(struct virtio_device *vdev, u32 features); | 83 | void (*finalize_features)(struct virtio_device *vdev); |
70 | }; | 84 | }; |
71 | 85 | ||
72 | /* If driver didn't advertise the feature, it will never appear. */ | 86 | /* If driver didn't advertise the feature, it will never appear. */ |
@@ -99,7 +113,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev, | |||
99 | * The return value is -ENOENT if the feature doesn't exist. Otherwise | 113 | * The return value is -ENOENT if the feature doesn't exist. Otherwise |
100 | * the config value is copied into whatever is pointed to by v. */ | 114 | * the config value is copied into whatever is pointed to by v. */ |
101 | #define virtio_config_val(vdev, fbit, offset, v) \ | 115 | #define virtio_config_val(vdev, fbit, offset, v) \ |
102 | virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v)) | 116 | virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(*v)) |
103 | 117 | ||
104 | static inline int virtio_config_buf(struct virtio_device *vdev, | 118 | static inline int virtio_config_buf(struct virtio_device *vdev, |
105 | unsigned int fbit, | 119 | unsigned int fbit, |