3 @@ -64,7 +64,7 @@ dnl Set kernel build path
4 AC_ARG_ENABLE(kernelbuild,
5 AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path (only for kernel 2.6.x)),
7 - if test -e $enableval/include/linux/autoconf.h; then
8 + if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
9 AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
11 AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
12 --- a/src/linux/ifxos_linux_thread_drv.c
13 +++ b/src/linux/ifxos_linux_thread_drv.c
15 #include <linux/sched.h>
16 #include <linux/version.h>
17 #include <linux/completion.h>
18 -#include <linux/smp_lock.h>
19 #include <linux/signal.h>
20 +#include <linux/kthread.h>
23 #include "ifx_types.h"
25 #if ( defined(IFXOS_HAVE_THREAD) && (IFXOS_HAVE_THREAD == 1) )
28 -IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup(
29 - IFXOS_ThreadCtrl_t *pThrCntrl);
32 /* ============================================================================
33 IFX Linux adaptation - Kernel Thread handling
34 ========================================================================= */
35 @@ -96,9 +92,9 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
36 - IFX_SUCCESS on success
39 -IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup(
40 - IFXOS_ThreadCtrl_t *pThrCntrl)
41 +int IFXOS_KernelThreadStartup(void *data)
43 + IFXOS_ThreadCtrl_t *pThrCntrl = (IFXOS_ThreadCtrl_t*) data;
44 IFX_int32_t retVal = IFX_ERROR;
45 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
46 struct task_struct *kthread = current;
47 @@ -139,7 +135,7 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
51 - daemonize(pThrCntrl->thrParams.pName);
52 + //daemonize(pThrCntrl->thrParams.pName);
54 /* Enable signals in Kernel >= 2.6 */
55 allow_signal(SIGKILL);
56 @@ -218,9 +214,7 @@ IFX_int32_t IFXOS_ThreadInit(
57 init_completion(&pThrCntrl->thrCompletion);
59 /* start kernel thread via the wrapper function */
60 - pThrCntrl->tid = kernel_thread( (IFXOS_KERNEL_THREAD_StartRoutine)IFXOS_KernelThreadStartup,
62 - IFXOS_DRV_THREAD_OPTIONS);
63 + pThrCntrl->tid = kthread_run(IFXOS_KernelThreadStartup, (void *)pThrCntrl, "ifxos");
65 pThrCntrl->bValid = IFX_TRUE;
67 --- a/src/include/ifxos_thread.h
68 +++ b/src/include/ifxos_thread.h
69 @@ -111,7 +111,7 @@ typedef struct IFXOS_ThreadParams_s
71 Function type of the user thread/task function.
73 -typedef IFX_int32_t (*IFXOS_ThreadFunction_t)(IFXOS_ThreadParams_t *);
74 +typedef int (*IFXOS_ThreadFunction_t)(void*);
78 --- a/src/include/linux/ifxos_linux_thread.h
79 +++ b/src/include/linux/ifxos_linux_thread.h
80 @@ -152,7 +152,7 @@ typedef struct
81 IFXOS_ThreadFunction_t pThrFct;
83 /** Kernel thread process ID */
85 + struct task_struct *tid;
87 /** requested kernel thread priority */
88 IFX_int32_t nPriority;
89 --- a/src/linux/ifxos_linux_socket_drv.c
90 +++ b/src/linux/ifxos_linux_socket_drv.c
92 /* ============================================================================
93 IFX Linux adaptation - Global Includes - Kernel
94 ========================================================================= */
95 +#include <linux/version.h>
96 #include <linux/kernel.h>
98 #include <linux/module.h>
99 @@ -166,23 +167,33 @@ IFX_int_t IFXOS_SocketSendTo(
100 IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR);
101 IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR);
103 + iov.iov_base = pBuffer;
104 + iov.iov_len = (unsigned int) bufSize_byte;
106 msg.msg_name = (void *) pSocAddr;
107 msg.msg_namelen = sizeof(IFXOS_sockAddr_t);
108 - msg.msg_iov = &iov;
109 - msg.msg_iovlen = 1;
110 msg.msg_control = IFX_NULL;
111 msg.msg_controllen = 0;
112 msg.msg_flags = MSG_DONTWAIT;
114 - msg.msg_iov->iov_base = pBuffer;
115 - msg.msg_iov->iov_len = (unsigned int) bufSize_byte;
116 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
117 + msg.msg_iov = &iov;
118 + msg.msg_iovlen = 1;
120 + iov_iter_init(&msg.msg_iter, WRITE, &iov, 1, bufSize_byte);
123 /* Modify address limitation which is used if user space is calling
124 kernel space, otherwise sock_sendmsg() will fail.*/
128 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
129 ret = sock_sendmsg((struct socket *) socFd, &msg, bufSize_byte);
131 + ret = sock_sendmsg((struct socket *) socFd, &msg);
137 --- a/src/linux/ifxos_linux_memory_map_drv.c
138 +++ b/src/linux/ifxos_linux_memory_map_drv.c
140 IFX Linux adaptation - Global Includes - Kernel
141 ========================================================================= */
143 +#include <linux/version.h>
144 #include <linux/kernel.h>
146 #include <linux/module.h>
147 @@ -87,6 +88,7 @@ IFX_int32_t IFXOS_Phy2VirtMap(
148 IFXOS_RETURN_IF_POINTER_NOT_NULL(*ppVirtAddr, IFX_ERROR);
149 IFXOS_RETURN_IF_ARG_LE_ZERO(addrRangeSize_byte, IFX_ERROR);
151 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
152 if ( check_mem_region(physicalAddr, addrRangeSize_byte) )
154 IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
155 @@ -98,6 +100,16 @@ IFX_int32_t IFXOS_Phy2VirtMap(
158 request_mem_region(physicalAddr, addrRangeSize_byte, pName);
160 + if ( !request_mem_region(physicalAddr, addrRangeSize_byte, pName) )
162 + IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
163 + ("IFXOS: ERROR Phy2Virt map, region request - addr 0x%08lX (size 0x%lX) not free" IFXOS_CRLF,
164 + physicalAddr, addrRangeSize_byte));
170 /* remap memory (not cache able): physical --> virtual */
171 pVirtAddr = (IFX_uint8_t *)ioremap_nocache( physicalAddr,