Initial commit

This commit is contained in:
domenico
2025-06-24 16:03:39 +02:00
commit f3256cdaf2
6949 changed files with 1441681 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -154,7 +154,7 @@ if KERNEL_2_6
drv_tapi_OBJS = "$(subst .c,.o, $(drv_tapi_SOURCES))"
drv_tapi.ko: $(drv_tapi_SOURCES) $(EXTRA_DIST)
- @echo -e "Making Linux 2.6.x kernel object"
+ @echo "Making Linux 2.6.x kernel object"
@for f in $(drv_tapi_SOURCES) ; do \
if test ! -e $(PWD)/$$f; then \
echo " LN $$f" ; \
@@ -162,10 +162,10 @@ drv_tapi.ko: $(drv_tapi_SOURCES) $(EXTRA
ln -s @abs_srcdir@/$$f $(PWD)/$$f; \
fi; \
done;
- @echo -e "# drv_tapi: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
- @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
- @echo -e "$(subst .ko,,$@)-y := $(drv_tapi_OBJS)" >> $(PWD)/Kbuild
- @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
+ @echo "# drv_tapi: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
+ @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
+ @echo "$(subst .ko,,$@)-y := $(drv_tapi_OBJS)" >> $(PWD)/Kbuild
+ @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
$(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
clean-generic:
--- a/configure.in
+++ b/configure.in
@@ -128,7 +128,7 @@ dnl Set kernel build path
AC_ARG_ENABLE(kernelbuild,
AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path),
[
- if test -r $enableval/include/linux/autoconf.h; then
+ if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
else
AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
--- a/src/drv_tapi_linux.h
+++ b/src/drv_tapi_linux.h
@@ -24,6 +24,7 @@
#include <linux/version.h>
#include <linux/interrupt.h> /* in_interrupt() */
#include <linux/delay.h> /* mdelay - udelay */
+#include <linux/workqueue.h> /* work_struct */
#include <asm/poll.h> /* POLLIN, POLLOUT */
#include "ifx_types.h" /* ifx type definitions */
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -47,6 +47,7 @@
#include <linux/errno.h>
#include <asm/uaccess.h> /* copy_from_user(), ... */
#include <asm/byteorder.h>
+#include <linux/smp_lock.h> /* lock_kernel() */
#include <asm/io.h>
#ifdef LINUX_2_6
@@ -55,7 +56,11 @@
#include <linux/sched.h>
#undef CONFIG_DEVFS_FS
#ifndef UTS_RELEASE
- #include "linux/utsrelease.h"
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+# include <linux/utsrelease.h>
+#else
+# include <generated/utsrelease.h>
+#endif
#endif /* UTC_RELEASE */
#else
#include <linux/tqueue.h>
@@ -3718,7 +3723,11 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre
flag and released after the down() call. */
lock_kernel();
mb();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
kill_proc(pThrCntrl->tid, SIGKILL, 1);
+#else
+ kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1);
+#endif
/* release the big kernel lock */
unlock_kernel();
wait_for_completion (&pThrCntrl->thrCompletion);

View File

@@ -0,0 +1,22 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -54,6 +54,10 @@
#include <linux/workqueue.h> /* LINUX 2.6 We need work_struct */
#include <linux/device.h>
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+ #include <linux/sched/signal.h>
+ #include <linux/sched/types.h>
+#endif
#undef CONFIG_DEVFS_FS
#ifndef UTS_RELEASE
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
@@ -184,7 +188,7 @@ MODULE_PARM_DESC(block_egress_tasklet, "
MODULE_PARM_DESC(block_ingress_tasklet, "block the execution of the ingress tasklet, i.e. force to use the RT kernel thread");
/** The driver callbacks which will be registered with the kernel*/
-static struct file_operations tapi_fops = {0};
+static struct file_operations tapi_fops;
/* ============================= */
/* Global function definition */

View File

@@ -0,0 +1,27 @@
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -122,13 +122,9 @@ endif
## flags for the driver
if USE_MODULE
-drv_tapi_CFLAGS = -DLINUX -D__KERNEL__ -DMODULE -Wno-format -DEXPORT_SYMTAB $(AM_CFLAGS)
+drv_tapi_CFLAGS = -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB $(AM_CFLAGS)
else
-drv_tapi_CFLAGS = -DLINUX -D__KERNEL__ -Wno-format -DEXPORT_SYMTAB $(AM_CFLAGS)
-endif
-
-if KERNEL_2_6
-drv_tapi_CFLAGS += -fno-common
+drv_tapi_CFLAGS = -DLINUX -D__KERNEL__ -DEXPORT_SYMTAB $(AM_CFLAGS)
endif
@@ -165,7 +161,7 @@ drv_tapi.ko: $(drv_tapi_SOURCES) $(EXTRA
@echo "# drv_tapi: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@echo "$(subst .ko,,$@)-y := $(drv_tapi_OBJS)" >> $(PWD)/Kbuild
- @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
+ @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
$(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
clean-generic:

View File

@@ -0,0 +1,96 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -556,7 +556,7 @@ static ssize_t ifx_tapi_write (struct fi
IFX_uint8_t *pData;
IFX_size_t buf_size;
#endif /* TAPI_PACKET */
- IFX_ssize_t size = 0;
+ ssize_t size = 0;
#ifdef TAPI_PACKET
if (pTapiDev->bInitialized == IFX_FALSE)
--- a/src/drv_tapi_osmap.h
+++ b/src/drv_tapi_osmap.h
@@ -17,39 +17,6 @@
*/
#include "ifx_types.h" /* ifx type definitions */
-
-#ifndef HAVE_IFX_ULONG_T
- #warning please update your ifx_types.h, using local definition of IFX_ulong_t
- /* unsigned long type - valid for 32bit systems only */
- typedef unsigned long IFX_ulong_t;
- #define HAVE_IFX_ULONG_T
-#endif /* HAVE_IFX_ULONG_T */
-
-#ifndef HAVE_IFX_LONG_T
- #warning please update your ifx_types.h, using local definition of IFX_long_t
- /* long type - valid for 32bit systems only */
- typedef long IFX_long_t;
- #define HAVE_IFX_LONG_T
-#endif /* HAVE_IFX_LONG_T */
-
-#ifndef HAVE_IFX_INTPTR_T
- #warning please update your ifx_types.h, using local definition of IFX_intptr_t
- typedef IFX_long_t IFX_intptr_t;
- #define HAVE_IFX_INTPTR_T
-#endif /* HAVE_IFX_INTPTR_T */
-
-#ifndef HAVE_IFX_SIZE_T
- #warning please update your ifx_types.h, using local definition of IFX_size_t
- typedef IFX_ulong_t IFX_size_t;
- #define HAVE_IFX_SIZE_T
-#endif /* HAVE_IFX_SIZE_T */
-
-#ifndef HAVE_IFX_SSIZE_T
- #warning please update your ifx_types.h, using local definition of IFX_ssize_t
- typedef IFX_long_t IFX_ssize_t;
- #define HAVE_IFX_SSIZE_T
-#endif /* HAVE_IFX_SSIZE_T */
-
#include "ifxos_interrupt.h"
#include "ifxos_memory_alloc.h"
#include "ifxos_copy_user_space.h"
--- a/include/drv_tapi_ll_interface.h
+++ b/include/drv_tapi_ll_interface.h
@@ -40,13 +40,6 @@
#include "ifxos_select.h"
#endif /* TAPI_PACKET */
-#ifndef HAVE_IFX_ULONG_T
- #warning please update your ifx_types.h, using local definition of IFX_ulong_t
- /* unsigned long type - valid for 32bit systems only */
- typedef unsigned long IFX_ulong_t;
- #define HAVE_IFX_ULONG_T
-#endif /* HAVE_IFX_ULONG_T */
-
/* ============================= */
/* Local Macros Definitions */
/* ============================= */
--- a/src/lib/lib_bufferpool/lib_bufferpool.c
+++ b/src/lib/lib_bufferpool/lib_bufferpool.c
@@ -85,24 +85,6 @@
#include <stdlib.h>
#endif /*VXWORKS*/
-
-/* ============================= */
-/* Extra type definitions */
-/* ============================= */
-#ifndef HAVE_IFX_ULONG_T
- #warning please update your ifx_types.h, using local definition of IFX_ulong_t
- /* unsigned long type - valid for 32bit systems only */
- typedef unsigned long IFX_ulong_t;
- #define HAVE_IFX_ULONG_T
-#endif /* HAVE_IFX_ULONG_T */
-
-#ifndef HAVE_IFX_UINTPTR_T
- #warning please update your ifx_types.h, using local definition of IFX_uintptr_t
- typedef IFX_ulong_t IFX_uintptr_t;
- #define HAVE_IFX_UINTPTR_T
-#endif /* HAVE_IFX_UINTPTR_T */
-
-
/* ============================= */
/* Local Macros & Definitions */
/* ============================= */

View File

@@ -0,0 +1,108 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -47,7 +47,9 @@
#include <linux/errno.h>
#include <asm/uaccess.h> /* copy_from_user(), ... */
#include <asm/byteorder.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/smp_lock.h> /* lock_kernel() */
+#endif
#include <asm/io.h>
#ifdef LINUX_2_6
@@ -69,7 +71,9 @@
#else
#include <linux/tqueue.h>
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/smp_lock.h> /* lock_kernel() */
+#endif
#endif /* LINUX_2_6 */
#include "drv_tapi.h"
@@ -137,8 +141,13 @@ static ssize_t ifx_tapi_write(struct fil
size_t count, loff_t * ppos);
static ssize_t ifx_tapi_read(struct file * filp, char *buf,
size_t length, loff_t * ppos);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
static int ifx_tapi_ioctl(struct inode *inode, struct file *filp,
unsigned int nCmd, unsigned long nArgument);
+#else
+static long ifx_tapi_ioctl(struct file *filp,
+ unsigned int nCmd, unsigned long nArgument);
+#endif
static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table);
#ifdef CONFIG_PROC_FS
@@ -222,7 +231,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_
IFX_char_t *pRegDrvName = IFX_NULL;
IFX_int32_t ret = 0;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
if (tapi_fops.ioctl == IFX_NULL)
+#else
+ if (tapi_fops.unlocked_ioctl == IFX_NULL)
+#endif
{
#ifdef MODULE
tapi_fops.owner = THIS_MODULE;
@@ -230,7 +243,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_
tapi_fops.read = ifx_tapi_read;
tapi_fops.write = ifx_tapi_write;
tapi_fops.poll = ifx_tapi_poll;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
tapi_fops.ioctl = ifx_tapi_ioctl;
+#else
+ tapi_fops.unlocked_ioctl = ifx_tapi_ioctl;
+#endif
tapi_fops.open = ifx_tapi_open;
tapi_fops.release = ifx_tapi_release;
}
@@ -885,8 +902,13 @@ static IFX_uint32_t ifx_tapi_poll (struc
- 0 and positive values - success
- negative value - ioctl failed
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
static int ifx_tapi_ioctl(struct inode *inode, struct file *filp,
unsigned int nCmd, unsigned long nArg)
+#else
+static long ifx_tapi_ioctl(struct file *filp,
+ unsigned int nCmd, unsigned long nArg)
+#endif
{
TAPI_FD_PRIV_DATA_t *pTapiPriv;
IFX_TAPI_ioctlCtx_t ctx;
@@ -3725,7 +3747,9 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre
kernel lock (lock_kernel()). The lock must be
grabbed before changing the terminate
flag and released after the down() call. */
- lock_kernel();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+ lock_kernel();
+#endif
mb();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
kill_proc(pThrCntrl->tid, SIGKILL, 1);
@@ -3733,8 +3757,10 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre
kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1);
#endif
/* release the big kernel lock */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
unlock_kernel();
- wait_for_completion (&pThrCntrl->thrCompletion);
+#endif
+ wait_for_completion (&pThrCntrl->thrCompletion);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
/* Now we are sure the thread is in zombie state.
--- a/src/lib/lib_fifo/lib_fifo.c
+++ b/src/lib/lib_fifo/lib_fifo.c
@@ -41,7 +41,7 @@
#ifdef LINUX
/* if linux/slab.h is not available, use the precessor linux/malloc.h */
#include <linux/slab.h>
-#elif VXWORKS
+#elif defined(VXWORKS)
#include <sys_drv_debug.h>
#endif /* LINUX */

View File

@@ -0,0 +1,11 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -97,6 +97,8 @@
#include "drv_tapi_announcements.h"
#endif /* TAPI_ANNOUNCEMENTS */
+#undef CONFIG_PROC_FS
+
#define TAPI_IOCTL_STACKSIZE 4000 /* allow some overhead 4 k */
/* ================================== */