19 #ifndef _COBALT_ASM_GENERIC_WRAPPERS_H 21 #include <linux/xenomai/wrappers.h> 23 #ifdef CONFIG_IPIPE_LEGACY 24 #error "CONFIG_IPIPE_LEGACY must be switched off" 27 #define COBALT_BACKPORT(__sym) __cobalt_backport_ ##__sym 41 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0) 42 #define get_compat_sigset(set, compat) \ 44 compat_sigset_t set32; \ 47 ret = cobalt_copy_from_user(&set32, compat, sizeof(compat_sigset_t)); \ 49 sigset_from_compat(set, &set32); \ 53 #define put_compat_sigset(compat, set, size) \ 55 compat_sigset_t set32; \ 57 sigset_to_compat(&set32, set); \ 58 cobalt_copy_to_user(compat, &set32, size); \ 62 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) 63 #define raw_copy_to_user(__to, __from, __n) __copy_to_user_inatomic(__to, __from, __n) 64 #define raw_copy_from_user(__to, __from, __n) __copy_from_user_inatomic(__to, __from, __n) 65 #define raw_put_user(__from, __to) __put_user_inatomic(__from, __to) 66 #define raw_get_user(__to, __from) __get_user_inatomic(__to, __from) 69 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) 70 #define in_ia32_syscall() (current_thread_info()->status & TS_COMPAT) 73 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) 74 #define cobalt_gpiochip_dev(__gc) ((__gc)->dev) 76 #define cobalt_gpiochip_dev(__gc) ((__gc)->parent) 79 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) 80 #define cobalt_get_restart_block(p) (&task_thread_info(p)->restart_block) 82 #define cobalt_get_restart_block(p) (&(p)->restart_block) 85 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) 86 #define user_msghdr msghdr 89 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0) 90 #include <linux/netdevice.h> 93 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ 94 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 96 #include <linux/trace_seq.h> 98 static inline unsigned char *
99 trace_seq_buffer_ptr(
struct trace_seq *s)
101 return s->buffer + s->len;
106 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) 107 #define smp_mb__before_atomic() smp_mb() 108 #define smp_mb__after_atomic() smp_mb() 111 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) 112 #define raw_cpu_ptr(v) __this_cpu_ptr(v) 115 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) 116 #include <linux/pci.h> 119 #define pci_enable_msix_range COBALT_BACKPORT(pci_enable_msix_range) 120 #ifdef CONFIG_PCI_MSI 121 int pci_enable_msix_range(
struct pci_dev *dev,
122 struct msix_entry *entries,
123 int minvec,
int maxvec);
126 int pci_enable_msix_range(
struct pci_dev *dev,
127 struct msix_entry *entries,
128 int minvec,
int maxvec)
136 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) 137 #include <linux/dma-mapping.h> 138 #include <linux/hwmon.h> 140 #define dma_set_mask_and_coherent COBALT_BACKPORT(dma_set_mask_and_coherent) 142 int dma_set_mask_and_coherent(
struct device *dev, u64 mask)
144 int rc = dma_set_mask(dev, mask);
146 dma_set_coherent_mask(dev, mask);
151 #define hwmon_device_register_with_groups \ 152 COBALT_BACKPORT(hwmon_device_register_with_groups) 154 hwmon_device_register_with_groups(
struct device *dev,
const char *name,
156 const struct attribute_group **groups);
158 #define devm_hwmon_device_register_with_groups \ 159 COBALT_BACKPORT(devm_hwmon_device_register_with_groups) 161 devm_hwmon_device_register_with_groups(
struct device *dev,
const char *name,
163 const struct attribute_group **groups);
166 #define reinit_completion(__x) INIT_COMPLETION(*(__x)) 170 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) 171 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name) 172 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name) 173 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name) 176 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 177 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"