virtio.h (0175409df42c20257171df87657dd705558aa94d) | virtio.h (95129d6fc9ead97155627a4ca0cfd37282883658) |
---|---|
1/* 2 * Virtio Support 3 * 4 * Copyright IBM, Corp. 2007 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 247 unchanged lines hidden (view full) --- 256} 257 258static inline void virtio_clear_feature(uint64_t *features, unsigned int fbit) 259{ 260 assert(fbit < 64); 261 *features &= ~(1ULL << fbit); 262} 263 | 1/* 2 * Virtio Support 3 * 4 * Copyright IBM, Corp. 2007 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 247 unchanged lines hidden (view full) --- 256} 257 258static inline void virtio_clear_feature(uint64_t *features, unsigned int fbit) 259{ 260 assert(fbit < 64); 261 *features &= ~(1ULL << fbit); 262} 263 |
264static inline bool __virtio_has_feature(uint64_t features, unsigned int fbit) | 264static inline bool virtio_has_feature(uint64_t features, unsigned int fbit) |
265{ 266 assert(fbit < 64); 267 return !!(features & (1ULL << fbit)); 268} 269 | 265{ 266 assert(fbit < 64); 267 return !!(features & (1ULL << fbit)); 268} 269 |
270static inline bool virtio_has_feature(VirtIODevice *vdev, unsigned int fbit) | 270static inline bool virtio_vdev_has_feature(VirtIODevice *vdev, 271 unsigned int fbit) |
271{ | 272{ |
272 return __virtio_has_feature(vdev->guest_features, fbit); | 273 return virtio_has_feature(vdev->guest_features, fbit); |
273} 274 275static inline bool virtio_host_has_feature(VirtIODevice *vdev, 276 unsigned int fbit) 277{ | 274} 275 276static inline bool virtio_host_has_feature(VirtIODevice *vdev, 277 unsigned int fbit) 278{ |
278 return __virtio_has_feature(vdev->host_features, fbit); | 279 return virtio_has_feature(vdev->host_features, fbit); |
279} 280 281static inline bool virtio_is_big_endian(VirtIODevice *vdev) 282{ | 280} 281 282static inline bool virtio_is_big_endian(VirtIODevice *vdev) 283{ |
283 if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { | 284 if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { |
284 assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); 285 return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG; 286 } 287 /* Devices conforming to VIRTIO 1.0 or later are always LE. */ 288 return false; 289} 290#endif | 285 assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); 286 return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG; 287 } 288 /* Devices conforming to VIRTIO 1.0 or later are always LE. */ 289 return false; 290} 291#endif |