19 #ifndef _COBALT_ASM_GENERIC_WRAPPERS_H
21 #include <linux/version.h>
23 #ifdef CONFIG_IPIPE_LEGACY
24 #error "CONFIG_IPIPE_LEGACY must be switched off"
27 #define COBALT_BACKPORT(__sym) __cobalt_backport_ ##__sym
42 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
43 #include <linux/netdevice.h>
46 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
47 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
50 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
51 #define smp_mb__before_atomic() smp_mb()
52 #define smp_mb__after_atomic() smp_mb()
55 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
56 #define raw_cpu_ptr(v) __this_cpu_ptr(v)
59 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
60 #include <linux/pci.h>
63 #define pci_enable_msix_range \
64 COBALT_BACKPORT(pci_enable_msix_range)
66 int pci_enable_msix_range(
struct pci_dev *dev,
67 struct msix_entry *entries,
68 int minvec,
int maxvec);
70 static inline int pci_enable_msix_range(
struct pci_dev *dev,
71 struct msix_entry *entries,
72 int minvec,
int maxvec)
78 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
79 #include <linux/dma-mapping.h>
80 #include <linux/hwmon.h>
82 #define dma_set_mask_and_coherent \
83 COBALT_BACKPORT(dma_set_mask_and_coherent)
84 static inline int dma_set_mask_and_coherent(
struct device *dev, u64 mask)
86 int rc = dma_set_mask(dev, mask);
88 dma_set_coherent_mask(dev, mask);
93 #define hwmon_device_register_with_groups \
94 COBALT_BACKPORT(hwmon_device_register_with_groups)
96 hwmon_device_register_with_groups(
struct device *dev,
const char *name,
98 const struct attribute_group **groups);
100 #define devm_hwmon_device_register_with_groups \
101 COBALT_BACKPORT(devm_hwmon_device_register_with_groups)
103 devm_hwmon_device_register_with_groups(
struct device *dev,
const char *name,
105 const struct attribute_group **groups);
109 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
110 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name)
111 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name)
112 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name)
115 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
116 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
119 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
120 #include <linux/trace_seq.h>
122 static inline unsigned char *
123 trace_seq_buffer_ptr(
struct trace_seq *s)
125 return s->buffer + s->len;
129 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
130 #define user_msghdr msghdr
133 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
134 #define user_msghdr msghdr