These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / roms / SLOF / lib / libvirtio / virtio-internal.h
1 /******************************************************************************
2  * Copyright (c) 2016 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12
13 #ifndef _LIBVIRTIO_INTERNAL_H
14 #define _LIBVIRTIO_INTERNAL_H
15
16 #include <byteorder.h>
17
18 static inline uint16_t virtio_cpu_to_modern16(struct virtio_device *dev, uint16_t val)
19 {
20         return dev->is_modern ? cpu_to_le16(val) : val;
21 }
22
23 static inline uint32_t virtio_cpu_to_modern32(struct virtio_device *dev, uint32_t val)
24 {
25         return dev->is_modern ? cpu_to_le32(val) : val;
26 }
27
28 static inline uint64_t virtio_cpu_to_modern64(struct virtio_device *dev, uint64_t val)
29 {
30         return dev->is_modern ? cpu_to_le64(val) : val;
31 }
32
33 static inline uint16_t virtio_modern16_to_cpu(struct virtio_device *dev, uint16_t val)
34 {
35         return dev->is_modern ? le16_to_cpu(val) : val;
36 }
37
38 static inline uint32_t virtio_modern32_to_cpu(struct virtio_device *dev, uint32_t val)
39 {
40         return dev->is_modern ? le32_to_cpu(val) : val;
41 }
42
43 static inline uint64_t virtio_modern64_to_cpu(struct virtio_device *dev, uint64_t val)
44 {
45         return dev->is_modern ? le64_to_cpu(val) : val;
46 }
47
48 #endif /* _LIBVIRTIO_INTERNAL_H */