Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
--- a/src/drv_mei_cpe_linux.c
+++ b/src/drv_mei_cpe_linux.c
@@ -1534,7 +1534,7 @@ struct proc_entry {
char name[32];
proc_rd_callback_t rd;
proc_wr_callback_t wr;
- struct file_operations ops;
+ struct proc_ops ops;
int entity;
};
@@ -2068,16 +2068,15 @@ static int mei_proc_single_open(struct i
static void mei_proc_entry_create(struct proc_dir_entry *parent_node,
struct proc_entry *proc_entry)
{
- memset(&proc_entry->ops, 0, sizeof(struct file_operations));
- proc_entry->ops.owner = THIS_MODULE;
+ memset(&proc_entry->ops, 0, sizeof(struct proc_ops));
- proc_entry->ops.open = mei_proc_single_open;
- proc_entry->ops.release = single_release;
+ proc_entry->ops.proc_open = mei_proc_single_open;
+ proc_entry->ops.proc_release = single_release;
- proc_entry->ops.read = seq_read;
- proc_entry->ops.llseek = seq_lseek;
+ proc_entry->ops.proc_read = seq_read;
+ proc_entry->ops.proc_lseek = seq_lseek;
if (proc_entry->wr)
- proc_entry->ops.write = proc_entry->wr;
+ proc_entry->ops.proc_write = proc_entry->wr;
proc_create_data(proc_entry->name,
(S_IFREG | S_IRUGO),
--- a/src/drv_mei_cpe_linux.h
+++ b/src/drv_mei_cpe_linux.h
@@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/sched.h>
+#include <linux/sched/signal.h>
#include <linux/interrupt.h>
#include <linux/version.h>
#include <linux/crc32.h>
@@ -122,7 +123,7 @@ typedef int (*MEI_RequestIrq_WrapLinux_t
/**
Function typedef for the Linux free_irq()
*/
-typedef void (*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq,
+typedef const void *(*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq,
void *usedDevId );
--- a/src/drv_mei_cpe_linux_proc_config.c
+++ b/src/drv_mei_cpe_linux_proc_config.c
@@ -1277,13 +1277,12 @@ static int mei_proc_single_open(struct i
return single_open(file, mei_seq_single_show, PDE_DATA(inode));
}
-static struct file_operations proc_ops = {
- .owner = THIS_MODULE,
- .open = mei_proc_single_open,
- .release = single_release,
- .read = seq_read,
- .llseek = seq_lseek,
- .write = MEI_ProcWriteConfig
+static struct proc_ops proc_ops = {
+ .proc_open = mei_proc_single_open,
+ .proc_release = single_release,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_write = MEI_ProcWriteConfig
};
/**
--- a/src/mei_cpe_appl_osmap.h
+++ b/src/mei_cpe_appl_osmap.h
@@ -38,10 +38,6 @@ extern "C"
#include <errno.h>
#include <ctype.h>
#include <sys/ioctl.h>
-
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- __const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
#endif
/* ==========================================================================

View File

@@ -0,0 +1,20 @@
--- a/src/drv_mei_cpe_dbg_driver.c
+++ b/src/drv_mei_cpe_dbg_driver.c
@@ -309,7 +309,7 @@ MEI_STATIC IFX_void_t MEI_DbgMsgDumpLogW
IFX_int32_t i;
unsigned short paylSize;
union {IFX_uint8_t d8[2]; IFX_uint16_t d16;} temp16;
- union {IFX_uint8_t d8[4]; IFX_uint16_t d32;} temp32;
+ union {IFX_uint8_t d8[4]; IFX_uint32_t d32;} temp32;
MEI_DbgMsgDumpLogLabel(pCmvMsg, fctOpCode);
@@ -368,7 +368,7 @@ MEI_STATIC IFX_void_t MEI_DbgMsgDumpTrcW
IFX_int32_t i;
unsigned short paylSize;
union {IFX_uint8_t d8[2]; IFX_uint16_t d16;} temp16;
- union {IFX_uint8_t d8[4]; IFX_uint16_t d32;} temp32;
+ union {IFX_uint8_t d8[4]; IFX_uint32_t d32;} temp32;
MEI_DbgMsgDumpTraceLabel(pCmvMsg, fctOpCode);

View File

@@ -0,0 +1,12 @@
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -213,8 +213,7 @@ drv_mei_cpe_common_cflags = $(AM_CFLAGS)
else
drv_mei_cpe_common_cflags = \
- $(AM_CFLAGS) -D__KERNEL__ -DLINUX -D__linux__ -DMODULE -DEXPORT_SYMTAB \
- -pipe -Wall -Wimplicit -Wunused -Wuninitialized -Wstrict-aliasing -Wno-date-time
+ -D__KERNEL__ -DLINUX -D__linux__ -DMODULE -DEXPORT_SYMTAB
endif

View File

@@ -0,0 +1,23 @@
--- a/src/drv_mei_cpe_linux.c
+++ b/src/drv_mei_cpe_linux.c
@@ -4530,7 +4530,6 @@ module_exit (MEI_module_exit);
#ifdef MODULE
MODULE_AUTHOR("www.lantiq.com");
MODULE_DESCRIPTION("MEI CPE Driver - www.lantiq.com");
-MODULE_SUPPORTED_DEVICE("MEI CPE Interface");
MODULE_LICENSE ("GPL");
#endif /* #ifdef MODULE*/
--- a/src/drv_mei_cpe_linux.h
+++ b/src/drv_mei_cpe_linux.h
@@ -110,6 +110,10 @@ typedef irqreturn_t (*usedIsrHandler_t)(
# endif
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0))
+#define PDE_DATA pde_data
+#endif
+
/**
Function typedef for the Linux request_threaded_irq()
*/

View File

@@ -0,0 +1,13 @@
--- a/src/drv_mei_cpe_linux.c
+++ b/src/drv_mei_cpe_linux.c
@@ -1556,8 +1556,8 @@ static void MEI_GetVersionProc(struct se
}
seq_printf(s, "%s" MEI_DRV_CRLF, &MEI_WHATVERSION[4]);
- seq_printf(s, "Compiled on %s, %s for Linux kernel %s (jiffies: %ld)" MEI_DRV_CRLF,
- __DATE__, __TIME__, UTS_RELEASE, jiffies);
+ seq_printf(s, "Compiled for Linux kernel %s (jiffies: %ld)" MEI_DRV_CRLF,
+ UTS_RELEASE, jiffies);
}
/**

View File

@@ -0,0 +1,12 @@
--- a/src/drv_mei_cpe_api_atm_ptm_intern.c
+++ b/src/drv_mei_cpe_api_atm_ptm_intern.c
@@ -152,6 +152,9 @@ IFX_int32_t MEI_InternalXtmSwhowtimeExit
/* Get line number*/
dslLineNum = pMeiDynCntrl->pMeiDev->meiDrvCntrl.dslLineNum;
+ g_tx_link_rate[dslLineNum][0] = 0;
+ g_tx_link_rate[dslLineNum][1] = 0;
+
#ifdef PPA_SUPPORTS_CALLBACKS
/* get NULL or function pointer */
mei_showtime_exit =

View File

@@ -0,0 +1,10 @@
--- a/src/drv_mei_cpe_mei_access_vrx.c
+++ b/src/drv_mei_cpe_mei_access_vrx.c
@@ -1691,7 +1691,6 @@ IFX_int32_t MEI_InterfaceDetect(
{
MEI_REG_ACCESS_ME_VERSION_SET(pMeiDrvCntrl, 0x00000000);
hwVers = MEI_REG_ACCESS_ME_VERSION_GET(pMeiDrvCntrl);
- printk ("hwVers=0x%08X\n", hwVers);
if (MEI_DEVICE_CFG_IS_PLATFORM(e_MEI_DEV_PLATFORM_CONFIG_VR9))
{

View File

@@ -0,0 +1,99 @@
--- a/src/drv_mei_cpe_api_intern.c
+++ b/src/drv_mei_cpe_api_intern.c
@@ -421,7 +421,9 @@ IFX_int32_t MEI_InternalMsgSend(
return retVal;
}
-static IFX_void_t MEI_Internal_DumpMessage(
+#define MEI_Internal_DumpMessage_bufSize 10
+
+static IFX_int32_t MEI_Internal_DumpMessage(
MEI_DYN_CNTRL_T *pMeiDynCntrl,
const IFX_uint16_t nMsgId,
const IFX_uint16_t *pData,
@@ -435,15 +437,20 @@ static IFX_void_t MEI_Internal_DumpMessa
IFX_uint8_t i;
const IFX_uint32_t nCommonPayloadSize = 5*nSize/2;
const IFX_uint8_t nInfoSize = 35;
- const IFX_uint8_t nBufSize = 10;
IFX_uint32_t nMsgSize = nCommonPayloadSize + nInfoSize;
IFX_uint32_t nCharsWrittenToBuf = 0;
- char msg[nMsgSize];
- char buf[nBufSize];
+ char *msg;
+ char buf[MEI_Internal_DumpMessage_bufSize];
if((pData == IFX_NULL) || (nSize < 4))
{
- return ;
+ return 0;
+ }
+
+ msg = kcalloc(nMsgSize, sizeof(*msg), GFP_KERNEL);
+ if (!msg)
+ {
+ return -ENOMEM;
}
pMsg16 = (IFX_uint16_t*)(pData+2);
@@ -464,7 +471,8 @@ static IFX_void_t MEI_Internal_DumpMessa
/* 32-bit payload elements */
for (i=0; i<((nSize-4)/4); i++)
{
- nCharsWrittenToBuf = snprintf(buf, nBufSize, " %08X", pMsg32[i]);
+ nCharsWrittenToBuf = snprintf(buf, MEI_Internal_DumpMessage_bufSize,
+ " %08X", pMsg32[i]);
strncat(msg, buf, nMsgSize);
nMsgSize -= nCharsWrittenToBuf;
}
@@ -474,7 +482,8 @@ static IFX_void_t MEI_Internal_DumpMessa
/* 16-bit payload elements */
for (i=0; i<((nSize-4)/2); i++)
{
- nCharsWrittenToBuf = snprintf(buf, nBufSize, " %04X", pMsg16[i]);
+ nCharsWrittenToBuf = snprintf(buf, MEI_Internal_DumpMessage_bufSize,
+ " %04X", pMsg16[i]);
strncat(msg, buf, nMsgSize);
nMsgSize -= nCharsWrittenToBuf;
}
@@ -482,6 +491,10 @@ static IFX_void_t MEI_Internal_DumpMessa
strncat(msg, MEI_DRV_CRLF, nMsgSize);
PRN_DBG_USR_RAW(MEI_MSG_DUMP_API, dbg_level, (msg));
+
+ kfree(msg);
+
+ return 0;
}
IFX_int32_t MEI_InternalSendMessage(
@@ -503,18 +516,25 @@ IFX_int32_t MEI_InternalSendMessage(
msg.ack_msg.pPayload = (unsigned char *)pDataAck;
msg.ack_msg.paylSize_byte = nLenAck;
- MEI_Internal_DumpMessage(pMeiDynCntrl, msg.write_msg.msgId,
+ ret = MEI_Internal_DumpMessage(pMeiDynCntrl, msg.write_msg.msgId,
(IFX_uint16_t *)msg.write_msg.pPayload, msg.write_msg.paylSize_byte,
IFX_FALSE, MEI_DRV_PRN_LEVEL_NORMAL);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
ret = MEI_InternalMsgSend(pMeiDynCntrl, &msg);
- if (ret >= 0)
+ if (ret < 0)
{
- MEI_Internal_DumpMessage(pMeiDynCntrl, msg.ack_msg.msgId,
+ return ret;
+ }
+
+ ret = MEI_Internal_DumpMessage(pMeiDynCntrl, msg.ack_msg.msgId,
(IFX_uint16_t *)msg.ack_msg.pPayload, msg.ack_msg.paylSize_byte,
IFX_TRUE, MEI_DRV_PRN_LEVEL_NORMAL);
- }
return ret;
}

View File

@@ -0,0 +1,52 @@
--- a/src/drv_mei_cpe_linux.c
+++ b/src/drv_mei_cpe_linux.c
@@ -1267,7 +1267,9 @@ static long MEI_Ioctl( struct file *filp
MEI_IOCTL_RETURN:
local_args.drv_ioctl.retCode = ret;
- copy_to_user( ((IOCTL_MEI_arg_t *)nArgument), &local_args, retSize);
+ if (copy_to_user( ((IOCTL_MEI_arg_t *)nArgument), &local_args, retSize))
+ PRN_ERR_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_ERR,
+ ("MEI_DRV[??] Error ioctl - copy_to_user failed!" MEI_DRV_CRLF));
return (ret < 0) ? -1 : 0;
}
@@ -3571,9 +3573,11 @@ static int MEI_IoctlMeiDbgAccessWr_Wrap(
ret = MEI_IoctlMeiDbgAccessWr( pMeiDynCntrl, pLocalArgument);
/* return arguments - count */
- copy_to_user( (void *)&pUserArgument->count,
+ if (copy_to_user( (void *)&pUserArgument->count,
(void *)&pLocalArgument->count,
- sizeof(pUserArgument->count) ) ;
+ sizeof(pUserArgument->count) ))
+ PRN_ERR_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_ERR,
+ ("MEI_DRV[??] Error ioctl - copy_to_user failed!" MEI_DRV_CRLF));
return ret;
}
@@ -3600,16 +3604,20 @@ static int MEI_IoctlMeiDbgAccessRd_Wrap(
if ( pLocalArgument->count )
{
/* return the buffer */
- copy_to_user( pUserBuf,
+ if (copy_to_user( pUserBuf,
pLocalArgument->pData_32,
- pLocalArgument->count * sizeof(IFX_uint32_t) ) ;
+ pLocalArgument->count * sizeof(IFX_uint32_t) ))
+ PRN_ERR_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_ERR,
+ ("MEI_DRV[??] Error ioctl - copy_to_user failed!" MEI_DRV_CRLF));
}
/* return count argument */
- copy_to_user( (void *)&pUserArgument->count,
+ if (copy_to_user( (void *)&pUserArgument->count,
(void *)&pLocalArgument->count,
- sizeof(pUserArgument->count) ) ;
+ sizeof(pUserArgument->count) ))
+ PRN_ERR_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_ERR,
+ ("MEI_DRV[??] Error ioctl - copy_to_user failed!" MEI_DRV_CRLF));
return ret;
}

View File

@@ -0,0 +1,35 @@
--- a/src/drv_mei_cpe_linux.c
+++ b/src/drv_mei_cpe_linux.c
@@ -2779,7 +2779,11 @@ static int MEI_InitModuleRegCharDev(cons
("Using major number %d" MEI_DRV_CRLF, MAJOR(mei_devt)));
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
mei_class = class_create(THIS_MODULE, devName);
+#else
+ mei_class = class_create(devName);
+#endif
if (IS_ERR(mei_class))
{
PRN_DBG_USR_NL( MEI_DRV,MEI_DRV_PRN_LEVEL_HIGH,
--- a/src/drv_mei_cpe_api_atm_ptm_intern.c
+++ b/src/drv_mei_cpe_api_atm_ptm_intern.c
@@ -223,7 +223,7 @@ IFX_int32_t MEI_TcRequest(void *data)
pMeiDynCntrl->pDfeX = NULL;
pMeiDynCntrl->pMeiDev = pMeiDev;
- argsTcRequest.request_type = request_type;
+ argsTcRequest.request_type = (MEI_TC_RequestType_t)request_type;
argsTcRequest.is_bonding = MEI_BND_EnableGet(pMeiDynCntrl);
if (MEI_DFEX_ENTITIES == 1 && argsTcRequest.is_bonding == IFX_TRUE)
@@ -398,7 +398,8 @@ IFX_int32_t MEI_InternalLineTCModeSwitch
pMeiDynCntrl->pDfeX = NULL;
pMeiDynCntrl->pMeiDev = MEIX_Cntrl[nEntity]->MeiDevice[nInstance];
- argsTcRequest.request_type = bPowerUp ? MEI_TC_REQUEST_PTM : MEI_TC_REQUEST_OFF;
+ argsTcRequest.request_type = bPowerUp ? (MEI_TC_RequestType_t)MEI_TC_REQUEST_PTM :
+ (MEI_TC_RequestType_t)MEI_TC_REQUEST_OFF;
argsTcRequest.is_bonding = pMeiDynCntrl->pMeiDev->bLastBondingStatus;
retVal = MEI_InternalTcRequest(pMeiDynCntrl, &argsTcRequest);