2015-07-07 13:43:54 +00:00
|
|
|
--- a/src/linux/ifxos_linux_thread_drv.c
|
|
|
|
+++ b/src/linux/ifxos_linux_thread_drv.c
|
2015-09-14 20:09:22 +00:00
|
|
|
@@ -38,6 +38,7 @@
|
|
|
|
#include <linux/smp_lock.h>
|
|
|
|
#endif
|
2012-12-15 02:00:26 +00:00
|
|
|
#include <linux/signal.h>
|
2013-03-14 18:43:02 +00:00
|
|
|
+#include <linux/kthread.h>
|
2012-12-15 02:00:26 +00:00
|
|
|
|
|
|
|
|
2013-03-14 18:43:02 +00:00
|
|
|
#include "ifx_types.h"
|
2015-09-14 20:09:22 +00:00
|
|
|
@@ -70,10 +71,6 @@
|
2013-03-14 18:43:02 +00:00
|
|
|
#if ( defined(IFXOS_HAVE_THREAD) && (IFXOS_HAVE_THREAD == 1) )
|
|
|
|
|
|
|
|
|
|
|
|
-IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup(
|
|
|
|
- IFXOS_ThreadCtrl_t *pThrCntrl);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/* ============================================================================
|
|
|
|
IFX Linux adaptation - Kernel Thread handling
|
|
|
|
========================================================================= */
|
2015-09-14 20:09:22 +00:00
|
|
|
@@ -98,9 +95,9 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
|
2013-03-14 18:43:02 +00:00
|
|
|
- IFX_SUCCESS on success
|
|
|
|
- IFX_ERROR on error
|
|
|
|
*/
|
|
|
|
-IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup(
|
|
|
|
- IFXOS_ThreadCtrl_t *pThrCntrl)
|
|
|
|
+int IFXOS_KernelThreadStartup(void *data)
|
|
|
|
{
|
|
|
|
+ IFXOS_ThreadCtrl_t *pThrCntrl = (IFXOS_ThreadCtrl_t*) data;
|
|
|
|
IFX_int32_t retVal = IFX_ERROR;
|
|
|
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
|
|
|
|
struct task_struct *kthread = current;
|
2015-09-14 20:09:22 +00:00
|
|
|
@@ -141,7 +138,7 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
|
2013-03-14 18:43:02 +00:00
|
|
|
/* let others run */
|
|
|
|
unlock_kernel();
|
|
|
|
#else
|
|
|
|
- daemonize(pThrCntrl->thrParams.pName);
|
|
|
|
+ //daemonize(pThrCntrl->thrParams.pName);
|
|
|
|
|
|
|
|
/* Enable signals in Kernel >= 2.6 */
|
|
|
|
allow_signal(SIGKILL);
|
2015-11-24 20:39:59 +00:00
|
|
|
@@ -221,9 +218,11 @@ IFX_int32_t IFXOS_ThreadInit(
|
2013-03-14 18:43:02 +00:00
|
|
|
init_completion(&pThrCntrl->thrCompletion);
|
|
|
|
|
|
|
|
/* start kernel thread via the wrapper function */
|
|
|
|
- pThrCntrl->tid = kernel_thread( (IFXOS_KERNEL_THREAD_StartRoutine)IFXOS_KernelThreadStartup,
|
|
|
|
- (void *)pThrCntrl,
|
|
|
|
- IFXOS_DRV_THREAD_OPTIONS);
|
2015-11-24 20:39:59 +00:00
|
|
|
+ pThrCntrl->tid = kthread_run(IFXOS_KernelThreadStartup, (void *)pThrCntrl, pThrCntrl->thrParams.pName);
|
|
|
|
+ if (IS_ERR(pThrCntrl->tid)) {
|
|
|
|
+ IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
|
|
|
|
+ ("IFXOS ERROR - Problem creating thread: %li" IFXOS_CRLF, PTR_ERR(pThrCntrl->tid)));
|
|
|
|
+ }
|
2013-03-14 18:43:02 +00:00
|
|
|
|
|
|
|
pThrCntrl->bValid = IFX_TRUE;
|
|
|
|
|
2015-07-07 13:43:54 +00:00
|
|
|
--- a/src/include/linux/ifxos_linux_thread.h
|
|
|
|
+++ b/src/include/linux/ifxos_linux_thread.h
|
|
|
|
@@ -152,7 +152,7 @@ typedef struct
|
2013-03-14 18:43:02 +00:00
|
|
|
IFXOS_ThreadFunction_t pThrFct;
|
|
|
|
|
|
|
|
/** Kernel thread process ID */
|
|
|
|
- IFX_int32_t tid;
|
|
|
|
+ struct task_struct *tid;
|
|
|
|
|
|
|
|
/** requested kernel thread priority */
|
|
|
|
IFX_int32_t nPriority;
|
2015-07-07 13:43:54 +00:00
|
|
|
--- a/src/linux/ifxos_linux_socket_drv.c
|
|
|
|
+++ b/src/linux/ifxos_linux_socket_drv.c
|
|
|
|
@@ -19,6 +19,7 @@
|
|
|
|
/* ============================================================================
|
|
|
|
IFX Linux adaptation - Global Includes - Kernel
|
|
|
|
========================================================================= */
|
|
|
|
+#include <linux/version.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#ifdef MODULE
|
|
|
|
#include <linux/module.h>
|
|
|
|
@@ -166,23 +167,33 @@ IFX_int_t IFXOS_SocketSendTo(
|
|
|
|
IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR);
|
|
|
|
IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR);
|
|
|
|
|
|
|
|
+ iov.iov_base = pBuffer;
|
|
|
|
+ iov.iov_len = (unsigned int) bufSize_byte;
|
|
|
|
+
|
|
|
|
msg.msg_name = (void *) pSocAddr;
|
|
|
|
msg.msg_namelen = sizeof(IFXOS_sockAddr_t);
|
|
|
|
- msg.msg_iov = &iov;
|
|
|
|
- msg.msg_iovlen = 1;
|
|
|
|
msg.msg_control = IFX_NULL;
|
|
|
|
msg.msg_controllen = 0;
|
|
|
|
msg.msg_flags = MSG_DONTWAIT;
|
|
|
|
|
|
|
|
- msg.msg_iov->iov_base = pBuffer;
|
|
|
|
- msg.msg_iov->iov_len = (unsigned int) bufSize_byte;
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
|
|
|
|
+ msg.msg_iov = &iov;
|
|
|
|
+ msg.msg_iovlen = 1;
|
|
|
|
+#else
|
|
|
|
+ iov_iter_init(&msg.msg_iter, WRITE, &iov, 1, bufSize_byte);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Modify address limitation which is used if user space is calling
|
|
|
|
kernel space, otherwise sock_sendmsg() will fail.*/
|
|
|
|
old_fs = get_fs();
|
|
|
|
set_fs(KERNEL_DS);
|
|
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
|
|
|
|
ret = sock_sendmsg((struct socket *) socFd, &msg, bufSize_byte);
|
|
|
|
+#else
|
|
|
|
+ ret = sock_sendmsg((struct socket *) socFd, &msg);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
set_fs(old_fs);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
--- a/src/linux/ifxos_linux_memory_map_drv.c
|
|
|
|
+++ b/src/linux/ifxos_linux_memory_map_drv.c
|
|
|
|
@@ -25,6 +25,7 @@
|
|
|
|
IFX Linux adaptation - Global Includes - Kernel
|
|
|
|
========================================================================= */
|
|
|
|
|
|
|
|
+#include <linux/version.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#ifdef MODULE
|
|
|
|
#include <linux/module.h>
|
|
|
|
@@ -87,6 +88,7 @@ IFX_int32_t IFXOS_Phy2VirtMap(
|
|
|
|
IFXOS_RETURN_IF_POINTER_NOT_NULL(*ppVirtAddr, IFX_ERROR);
|
|
|
|
IFXOS_RETURN_IF_ARG_LE_ZERO(addrRangeSize_byte, IFX_ERROR);
|
|
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
|
|
|
|
if ( check_mem_region(physicalAddr, addrRangeSize_byte) )
|
|
|
|
{
|
|
|
|
IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
|
|
|
|
@@ -98,6 +100,16 @@ IFX_int32_t IFXOS_Phy2VirtMap(
|
|
|
|
|
|
|
|
/* can't fail */
|
|
|
|
request_mem_region(physicalAddr, addrRangeSize_byte, pName);
|
|
|
|
+#else
|
2015-07-24 09:09:02 +00:00
|
|
|
+ if ( !request_mem_region(physicalAddr, addrRangeSize_byte, pName) )
|
2015-07-07 13:43:54 +00:00
|
|
|
+ {
|
|
|
|
+ IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
|
|
|
|
+ ("IFXOS: ERROR Phy2Virt map, region request - addr 0x%08lX (size 0x%lX) not free" IFXOS_CRLF,
|
|
|
|
+ physicalAddr, addrRangeSize_byte));
|
|
|
|
+
|
|
|
|
+ return IFX_ERROR;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* remap memory (not cache able): physical --> virtual */
|
|
|
|
pVirtAddr = (IFX_uint8_t *)ioremap_nocache( physicalAddr,
|