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,11,0) 42 #define raw_copy_to_user(__to, __from, __n) __copy_to_user_inatomic(__to, __from, __n) 43 #define raw_copy_from_user(__to, __from, __n) __copy_from_user_inatomic(__to, __from, __n) 44 #define raw_put_user(__from, __to) __put_user_inatomic(__from, __to) 45 #define raw_get_user(__to, __from) __get_user_inatomic(__to, __from) 48 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) 49 #define in_ia32_syscall() (current_thread_info()->status & TS_COMPAT) 52 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) 53 #define cobalt_gpiochip_dev(__gc) ((__gc)->dev) 55 #define cobalt_gpiochip_dev(__gc) ((__gc)->parent) 58 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) 59 #define cobalt_get_restart_block(p) (&task_thread_info(p)->restart_block) 61 #define cobalt_get_restart_block(p) (&(p)->restart_block) 64 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) 65 #define user_msghdr msghdr 68 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0) 69 #include <linux/netdevice.h> 72 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ 73 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 75 #include <linux/trace_seq.h> 77 static inline unsigned char *
78 trace_seq_buffer_ptr(
struct trace_seq *s)
80 return s->buffer + s->len;
85 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) 86 #define smp_mb__before_atomic() smp_mb() 87 #define smp_mb__after_atomic() smp_mb() 90 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) 91 #define raw_cpu_ptr(v) __this_cpu_ptr(v) 94 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) 95 #include <linux/pci.h> 98 #define pci_enable_msix_range COBALT_BACKPORT(pci_enable_msix_range) 100 int pci_enable_msix_range(
struct pci_dev *dev,
101 struct msix_entry *entries,
102 int minvec,
int maxvec);
105 int pci_enable_msix_range(
struct pci_dev *dev,
106 struct msix_entry *entries,
107 int minvec,
int maxvec)
115 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) 116 #include <linux/dma-mapping.h> 117 #include <linux/hwmon.h> 119 #define dma_set_mask_and_coherent COBALT_BACKPORT(dma_set_mask_and_coherent) 121 int dma_set_mask_and_coherent(
struct device *dev, u64 mask)
123 int rc = dma_set_mask(dev, mask);
125 dma_set_coherent_mask(dev, mask);
130 #define hwmon_device_register_with_groups \ 131 COBALT_BACKPORT(hwmon_device_register_with_groups) 133 hwmon_device_register_with_groups(
struct device *dev,
const char *name,
135 const struct attribute_group **groups);
137 #define devm_hwmon_device_register_with_groups \ 138 COBALT_BACKPORT(devm_hwmon_device_register_with_groups) 140 devm_hwmon_device_register_with_groups(
struct device *dev,
const char *name,
142 const struct attribute_group **groups);
145 #define reinit_completion(__x) INIT_COMPLETION(*(__x)) 149 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) 150 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name) 151 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name) 152 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name) 155 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 156 #error "Xenomai/cobalt requires Linux kernel 3.10 or above" 159 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0) 160 #define old_timex32 compat_timex 161 #define SO_RCVTIMEO_OLD SO_RCVTIMEO 162 #define SO_SNDTIMEO_OLD SO_SNDTIMEO 165 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) 166 #define mmiowb() do { } while (0)