[Feature][T106_eSDK]update from T106-V2.01.01.02P56U06.AP.15.11_CAP.15.11.01 to T106-V2.01.01.02P56U06.AP.17.02_CAP.17.02.02 -- code

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Ib96b45ce27a9cc1e8e774c42334dfb86aa0da634
diff --git a/upstream/linux-5.10/arch/arm/kernel/svc_s.S b/upstream/linux-5.10/arch/arm/kernel/svc_s.S
index a52abb7..f249292 100755
--- a/upstream/linux-5.10/arch/arm/kernel/svc_s.S
+++ b/upstream/linux-5.10/arch/arm/kernel/svc_s.S
@@ -1,9 +1,12 @@
 
+#define _USE_VEHICLE_DC
+#include "ram_base_config_7520v3.h"
+
 #define	GIC_DIST_BASE			(0xF2000000)
 #define	GIC_RDIST_BASE			(0xF2040000)
 
 #define	REAL_TXT_ADDR			(CONFIG_PHYS_OFFSET + 0x8000)
-#define	DTB_ADDR			(CONFIG_DTB_ADDR)	
+#define	DTB_ADDR			(DDR_BASE_CAP_DTB_ADDR)	
 
 secure_init:
 
diff --git a/upstream/linux-5.10/drivers/dma/sc/zx297520v3_dma.c b/upstream/linux-5.10/drivers/dma/sc/zx297520v3_dma.c
index 6ef00d8..6eb68fa 100755
--- a/upstream/linux-5.10/drivers/dma/sc/zx297520v3_dma.c
+++ b/upstream/linux-5.10/drivers/dma/sc/zx297520v3_dma.c
@@ -1090,7 +1090,7 @@
 					/* schedule tasklet on this channel */
 			/* yu.dong@20240617 [T106BUG-641] SPI packet loss issue, increase kernel buffer and read all cached data away, no data loss start */
 			#ifdef _USE_VEHICLE_DC || _USE_VEHICLE_DC_REF
-					if((channel_id == DMA_CH_UART0_RX) || (channel_id == DMA_CH_UART2_RX) || (channel_id == DMA_CH_SSP0_RX)){
+					if((channel_id == DMA_CH_UART0_RX) || (channel_id == DMA_CH_UART2_RX)||(channel_id == DMA_CH_SSP0_RX)||(channel_id == DMA_CH_SSP1_RX)){
 						if (dmac_ptr->dma_chan[channel_id].desc.callback)
 							dmac_ptr->dma_chan[channel_id].desc.callback(dmac_ptr->dma_chan[channel_id].desc.callback_param);
 					}else
diff --git a/upstream/linux-5.10/drivers/misc/zcat/debug_info.c b/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
index d23e340..52a2146 100755
--- a/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
+++ b/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
@@ -5,10 +5,7 @@
 #include <linux/cdev.h>
 #include <linux/semaphore.h>
 #include <linux/timer.h>
-
-// #include <linux/fs.h>
 #include <linux/ioport.h>
-// #include <linux/serial_reg.h>
 #include <linux/poll.h>
 #include <linux/delay.h>
 #include <linux/wait.h>
@@ -18,88 +15,94 @@
 #include <linux/types.h>
 #include <linux/device.h>
 #include <linux/miscdevice.h>
-// #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
-// #include <linux/kthread.h>
 #include <asm/io.h>
-
 #include <linux/vmalloc.h>
 #include <linux/soc/zte/rpmsg.h>
-// #include <linux/syscalls.h>
-
-// #include "debuginfo.h"
 #include "pub_debug_info.h"
 #include "ringbuf.h"
+#include "ram_config.h"
+#include "ZspTrace.h"
+#include <linux/proc_fs.h>
+#include <asm/barrier.h>
+#include <asm/cache.h>
+#include <asm/cacheflush.h>
+#include <linux/seq_file.h>
+#include <linux/ktime.h>
+#include <linux/time.h>
 
-
-#if defined(_USE_ZXIC_DEBUG_INFO) && !defined(CONFIG_SYSTEM_RECOVERY)
+#if defined(_USE_ZXIC_DEBUG_INFO)
 /*******************************************************************************
  *                                   宏定义                                     *
  *******************************************************************************/
-#define DEBUG_INFO_SHARE_MEM_LEN    (0x2000)
+#define DEBUG_INFO_AP_MEM_LEN       (0x2000)
 #define DEBUG_INFO_READABLE_LEN     (0x1400)
-#define DEBUG_INFO_MAX_DATA_LEN     (128)
-#define DEBUG_INFO_MAX_TOTAL_LEN    (140) // 8 + 128 + 4
 #define DEBUG_INFO_READ_TIME_MSECS  (10000)
 
-#define DEBUG_INFO_CHANNEL          (9)
-#define DEBUG_INFO_MSG_CAP_SIZE     (2 * 1024)
-
 #define DEBUG_INFO_OK               (0)
 #define DEBUG_INFO_ERROR            (-1)
+#define DEBUG_READ_NOBLOCK          (11)
 
-#define DEBUG_INFO_IOCTL_SET_DISABLE  (0x1001)
+#define DEBUG_INFO_MAX_ID_LEN       (16+3)
+#define DEBUG_INFO_MAX_DATA_LEN     (128)
+#define DEBUG_INFO_MAX_TIME_LEN     (0)//(20+3)
+#define DEBUG_INFO_MAX_DATE_LEN     (19+3)
+#define DEBUG_INFO_MAX_TOTAL_LEN    (DEBUG_INFO_MAX_ID_LEN + DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_TIME_LEN)
+
+#define DEBUG_INFO_CORE_NUM          (2)
 
 /*******************************************************************************
  *                                结构体定义                                     *
  *******************************************************************************/
-typedef unsigned int UINT32;
+typedef unsigned int   UINT32;
 typedef unsigned short UINT16;
-typedef unsigned char UINT8;
-
-typedef struct
-{
-    UINT16 module_id; // 模块id
-    UINT16 sub_len;   // 用户数据长度
-    UINT32 time;
-    char sub_data[]; // 用户数据
-} T_SHARED_MEM_DATA;
-
-typedef struct
-{
-    UINT32 head;                  // 0x010a0a0a
-    UINT32 total_len;             // 数据内容长度
-    long long time;               // time()函数获取
+typedef unsigned char  UINT8;
+typedef unsigned long  UINT64; 
+typedef struct{
+    unsigned int head;                               /* 0x010a0a0a */
+    unsigned int datalen[DEBUG_INFO_CORE_NUM];       /* 数据内容长度 */ 
 } T_SAVE_FILE_DATA;
 
 /*******************************************************************************
  *                                  全局变量                                     *
  *******************************************************************************/
-volatile T_RINGBUFFER *g_debug_info_buf = NULL;
 static struct semaphore debug_sem;
-static DEFINE_RAW_SPINLOCK(debugWr_lock);
 static int g_init_flag = 0;
+UINT32 *g_ps_debug_write_cnt;
+UINT32 *g_ps_debug_full_cnt;
+UINT32 g_ps_debug_read_cnt;
+UINT32 g_ps_debug_read_full_cnt;
+unsigned long  g_debug_read_cnt;
+unsigned long  g_ap_debug_write_cnt;
+unsigned long  g_ap_debug_read_cnt;
+UINT8 *g_ap_debug_buffer_start;
+UINT8 *g_ap_debug_buffer_read;
+UINT8 *g_ap_debug_buffer_write;
+UINT8 *g_ap_debug_buffer_end;
+UINT8 *g_ps_debug_buffer_start;
+UINT8 *g_ps_debug_buffer_end;
+UINT8 *g_ps_debug_buffer_read;
+static DEFINE_SPINLOCK(debug_info_lock);
+static char  g_ap_debug_buffer[DEBUG_INFO_AP_MEM_LEN];
+unsigned long  g_debug_read_state = 0; 
 
 /*******************************************************************************
  *                              内部函数定义                                     *
  *******************************************************************************/
-static int sc_debug_info_read_to_user(char *buf, unsigned short count);
-static int sc_debug_info_record_from_user(const char *info, unsigned short count);
-static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len);
-static void sc_debug_info_from_ap(void *buf, unsigned int len);
-
+static int sc_debug_info_read_to_user(char *buf, size_t count);
+static int sc_debug_info_record_from_user(const char *info, size_t count);
+static void sc_debug_info_from_ps(void *buf, unsigned int len);
 static void kernel_timer_timeout(struct timer_list *t);
 static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos);
 static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos);
 static int debug_info_open(struct inode *ip, struct file *fp);
 static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 static int debug_info_release(struct inode *ip, struct file *fp);
-
-//初始化timer
+extern u64 cop_time_get_value64(void);
+extern int seq_write(struct seq_file *seq, const void *data, size_t len); 
 static DEFINE_TIMER(timer, kernel_timer_timeout);
-
 static const struct file_operations debug_info_fops = {
     .owner = THIS_MODULE,
     .read = debug_info_read,
@@ -114,35 +117,36 @@
     .name = "debug_info",
     .fops = &debug_info_fops,
 };
-
 static void kernel_timer_timeout(struct timer_list *t)
-{
+{    
     if (debug_sem.count == 0)
-    {
+    {        
         up(&debug_sem);
     }
-    /* 因为内核定时器是一个单次的定时器,所以如果想要多次重复定时需要在定时器绑定的函数结尾重新装载时间,并启动定时 */
     /* Kernel Timer restart */
-    mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));    
+    mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));
 }
 
+/* Started by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
 static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos)
 {
     int ret;
     int rd_len;
 
-    ret = down_interruptible(&debug_sem);
-    if(ret < 0)
+    if (g_debug_read_state != DEBUG_READ_NOBLOCK)
     {
-        return ret;
+        ret = down_interruptible(&debug_sem);
+        if (ret < 0)
+        {
+            return ret;
+        }
     }
-    else
-    {
-        rd_len = sc_debug_info_read_to_user(buf, count);
-    }
+
+    rd_len = sc_debug_info_read_to_user(buf, count);
 
     return rd_len;
 }
+/* Ended by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
 
 static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
 {
@@ -156,241 +160,425 @@
     return 0;
 }
 
-static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
-{
-    switch(cmd)
-    {
-        case DEBUG_INFO_IOCTL_SET_DISABLE:
-            *(volatile UINT32 *)ZCAT_DEBUG_INFO_DISABLE = arg;
-            break;
-
-        default:
-            break;
+/* Started by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
+static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) {
+    if (cmd == DEBUG_READ_NOBLOCK) {
+        g_debug_read_state = DEBUG_READ_NOBLOCK;
+    } else {
+        // 如果命令不匹配,返回错误码
+        return -EINVAL;
     }
+
+    // 记录调试信息
+    sc_debug_info_record("debug_info", "read noblock!\n");
+
     return 0;
 }
+/* Ended by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
 
 static int debug_info_release(struct inode *ip, struct file *fp)
 {
     return 0;
 }
 
-static void sc_debug_info_from_ap(void *buf, unsigned int len)
+static int ap_log_proc_show(struct seq_file *m, void *v)
 {
-    T_SHARED_MEM_DATA *debug_msg = (T_SHARED_MEM_DATA *)buf;
-    debug_msg->time = jiffies;
+    unsigned long writecnt = g_ap_debug_write_cnt;
 
-    sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, buf, len);
+    if (writecnt > DEBUG_INFO_AP_MEM_LEN)
+    {
+        writecnt = DEBUG_INFO_AP_MEM_LEN;
+    }
+   
+    seq_write(m, g_ap_debug_buffer_start, writecnt);
+
+	return 0;
+}
+
+static int ps_log_proc_show(struct seq_file *m, void *v)
+{
+    unsigned long writecnt = 0;
+    unsigned long fulllcnt = 0;
+    
+    writecnt = *(UINT32 *)g_ps_debug_write_cnt;
+    fulllcnt = *(UINT32 *)g_ps_debug_full_cnt;
+
+    if (fulllcnt > 0)
+    {
+       writecnt = PS_DEBUG_INFO_SIZE;
+    }
+
+    //__inval_dcache_area((void *)g_ps_debug_buffer_start, writecnt);
+    seq_write(m, g_ps_debug_buffer_start, writecnt);
+
+	return 0;
+}
+
+UINT32 skip_end_null(char *buf, size_t count)
+{
+    UINT32 len   = 0;
+    char *tmpbuf = buf;
+ 
+    while (count > 0)
+    {
+        if (*tmpbuf == '\0')
+        {
+            ++len;
+            tmpbuf -= 1;
+            count  -= 1;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    return len;
+}
+
+int sc_debug_info_read_ap(char *buf, size_t count)
+{
+    UINT32 readLen       = 0;
+    UINT32 updatelen     = 0;
+    UINT32 readremainLen = 0;
+    UINT8 *readbuffaddr  = 0;
+    UINT32 nullLen       = 0;
+    char *tmpbuf         = buf;
+
+    updatelen = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+    if (updatelen > DEBUG_INFO_AP_MEM_LEN)
+        updatelen = DEBUG_INFO_AP_MEM_LEN;
+
+    if(g_ap_debug_buffer_end - g_ap_debug_buffer_read >= updatelen)
+    {
+        readbuffaddr = g_ap_debug_buffer_read;
+        readLen      = updatelen;
+        if (copy_to_user(tmpbuf , readbuffaddr, readLen))
+        {
+            return -EFAULT;
+        }
+        g_ap_debug_buffer_read += readLen;
+    }
+    else if(g_ap_debug_buffer_end - g_ap_debug_buffer_read < updatelen)
+    {
+        readbuffaddr  = g_ap_debug_buffer_read;
+        readLen       = g_ap_debug_buffer_end - readbuffaddr;
+        readremainLen = updatelen - readLen;
+        nullLen = skip_end_null(g_ap_debug_buffer_end - 1, readLen);
+        readLen = readLen - nullLen;
+        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+        {
+            return -EFAULT;
+        }
+        if (copy_to_user(tmpbuf + readLen, g_ap_debug_buffer_start, readremainLen))
+        {
+            return -EFAULT;
+        }
+        g_ap_debug_buffer_read = g_ap_debug_buffer_start + readremainLen;
+    }
+    else
+    {
+        panic("gaohf sc_debug_info_read_to_user error");
+    }
+    g_ap_debug_read_cnt  = g_ap_debug_write_cnt;
+
+    return (readLen + readremainLen);
+}
+
+int sc_debug_info_read_ps(char *buf, size_t count)
+{
+    UINT32 readLen         = 0;
+    UINT32 readremainLen   = 0;
+    UINT8 *readbuffaddr    = 0;      
+    UINT32 fulllcnt        = 0;
+    UINT32 fulllcntdiff    = 0;
+    unsigned long writecnt = 0;
+    UINT32 nullLen         = 0;
+    char *tmpbuf           = buf;
+
+    writecnt  = *(volatile UINT32 *)g_ps_debug_write_cnt;
+    fulllcnt  = *(volatile UINT32 *)g_ps_debug_full_cnt;
+   
+    if (fulllcnt >= g_ps_debug_read_full_cnt)
+    {
+        fulllcntdiff  = fulllcnt - g_ps_debug_read_full_cnt;
+    }
+    else
+    {
+        fulllcntdiff  = 0xFFFFFFFF - g_ps_debug_read_full_cnt + fulllcnt;
+    }
+    if(fulllcntdiff >= 2)
+    {
+        readbuffaddr  = g_ps_debug_buffer_start + writecnt;
+        readLen       = g_ps_debug_buffer_end - readbuffaddr;
+        readremainLen = writecnt;
+        nullLen       = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
+        readLen = readLen - nullLen;
+        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+        {
+            return -EFAULT;
+        }
+        if (copy_to_user(tmpbuf + readLen, g_ps_debug_buffer_start, readremainLen))
+        {
+            return -EFAULT;
+        }
+        g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
+    }
+    else if(fulllcntdiff == 0)
+    {
+        readbuffaddr = g_ps_debug_buffer_read;
+        readLen      = writecnt - g_ps_debug_read_cnt;;
+        if (copy_to_user(tmpbuf , readbuffaddr, readLen))
+        {
+            return -EFAULT;
+        }    
+        g_ps_debug_buffer_read += readLen;
+    }
+    else if(fulllcntdiff == 1)
+    {
+        readLen  = writecnt >=  g_ps_debug_read_cnt ? writecnt : g_ps_debug_read_cnt;
+        readLen  = PS_DEBUG_INFO_SIZE - readLen;
+        readbuffaddr  = g_ps_debug_buffer_read;
+        nullLen       = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
+        readLen = readLen - nullLen;
+        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
+        {
+            return -EFAULT;
+        }    
+        readremainLen = writecnt;
+        if (copy_to_user(tmpbuf + readLen , g_ps_debug_buffer_start, readremainLen))
+        {
+            return -EFAULT;
+        } 
+        g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
+    }
+    else
+    {
+        panic("gaohf sc_debug_info_read_to_user error");
+    }
+    g_ps_debug_read_cnt      = writecnt;
+    g_ps_debug_read_full_cnt = fulllcnt;
+
+    return (readLen + readremainLen);
+}
+
+int sc_debug_info_read_to_user(char *buf, size_t count)
+{
+    char *tmpbuf = 0;
+    int ret      = 0;
+    int ap_len   = 0;
+    int ps_len   = 0;
+    T_SAVE_FILE_DATA fileDataHead;
+    
+    if (g_init_flag == 0)
+    {
+        printk("debug_info not init.\n");
+        return DEBUG_INFO_ERROR;
+    }
+    
+    if (count == 0 || buf == NULL )
+    {
+        printk("sc_debug_info_read_to_user count == 0 || buf == NULL \n");
+        return DEBUG_INFO_ERROR;
+    }
+    tmpbuf = buf + sizeof(T_SAVE_FILE_DATA);
+    ap_len = sc_debug_info_read_ap(tmpbuf, DEBUG_INFO_AP_MEM_LEN);
+    tmpbuf += ap_len;
+    ps_len = sc_debug_info_read_ps(tmpbuf, PS_DEBUG_INFO_SIZE);
+
+    fileDataHead.head       = 0x010a0a0a; 
+    fileDataHead.datalen[0] = ap_len;
+    fileDataHead.datalen[1] = ps_len;
+    
+    if (copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA)))
+    {        
+        printk("sc_debug_info_read_to_user  copy_to_user error \n");
+        return -EFAULT;
+    }
+    return  sizeof(T_SAVE_FILE_DATA) + ap_len + ps_len;
+}
+
+static int sc_debug_info_record_from_user(const char *info, size_t count)
+{
+    UINT32 cnt = 0;
+    int spacelen;
+    int msg_len =  0;
+    struct tm tm;
+    time64_t time;
+    unsigned long used_space;
+    char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
+    unsigned long flags;
+    UINT8 *tmp_write_addr = buffer;
+ 
+    if (g_init_flag == 0 || info == NULL)
+    {
+        printk("debug_info not init or sc_debug_info_record_from_user info is NULL\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    if(count > DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_ID_LEN)
+    {
+        printk("debug_info data too long\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    time = ktime_get_real_seconds();
+    time64_to_tm(time, 0, &tm);
+    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", \
+          tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+    tmp_write_addr += cnt;
+    msg_len = cnt;
+
+    spin_lock_irqsave(&debug_info_lock, flags);
+    spacelen = g_ap_debug_buffer_end - g_ap_debug_buffer_write;
+    if (spacelen < msg_len + count)
+    {
+        g_ap_debug_write_cnt += spacelen;
+        memset(g_ap_debug_buffer_write, '\0', spacelen);
+        g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+    }
+    memcpy(g_ap_debug_buffer_write, buffer, msg_len);
+    if (copy_from_user(g_ap_debug_buffer_write + msg_len, info, count))
+        return -EFAULT;
+    msg_len += count;
+    g_ap_debug_buffer_write += msg_len;
+    g_ap_debug_write_cnt  += msg_len;
+    used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+    spin_unlock_irqrestore(&debug_info_lock, flags);
+    if (used_space > DEBUG_INFO_READABLE_LEN)
+    {        
+        if (debug_sem.count == 0)
+        {
+            up(&debug_sem);
+        }
+    }
+    return msg_len;
+}
+
+int sc_debug_info_vrecord(char *id, const char *format, va_list args)
+{
+    int spacelen;
+    int msg_len =  0;
+    int cnt =  0;
+    unsigned long used_space;
+    struct tm tm;
+    time64_t time;
+    char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
+    unsigned long flags;
+    UINT8 *tmp_write_addr = buffer;
+
+    time = ktime_get_real_seconds();
+    time64_to_tm(time, 0, &tm);
+    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+    tmp_write_addr += cnt;
+    msg_len = cnt; 
+
+    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_ID_LEN, "[%s]",id);
+    tmp_write_addr += cnt;
+    msg_len += cnt;
+    msg_len += vsnprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATA_LEN, format, args);
+
+    spin_lock_irqsave(&debug_info_lock, flags);
+    spacelen = g_ap_debug_buffer_end  - g_ap_debug_buffer_write;
+    if (spacelen <  DEBUG_INFO_MAX_TOTAL_LEN)
+    {
+        g_ap_debug_write_cnt += spacelen;
+        memset(g_ap_debug_buffer_write, '\0', spacelen);
+        g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+    }
+
+    memcpy(g_ap_debug_buffer_write, buffer, msg_len);
+    g_ap_debug_buffer_write += msg_len;
+    g_ap_debug_write_cnt    += msg_len;
+    used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
+    spin_unlock_irqrestore(&debug_info_lock, flags);
+    if (used_space > DEBUG_INFO_READABLE_LEN)     
+    {        
+        if (debug_sem.count == 0)
+        {
+            up(&debug_sem);
+        }
+    }
+    return msg_len;
+}
+EXPORT_SYMBOL(sc_debug_info_vrecord);
+
+int sc_debug_info_record(char *id, const char *format, ...)
+{
+    va_list args;
+    int r;
+    
+    if (g_init_flag == 0)
+    {
+        printk("debug_info not init.\n");
+        return DEBUG_INFO_ERROR;
+    }
+    
+    va_start(args, format);
+    r = sc_debug_info_vrecord(id, format, args);
+    va_end(args);
+
+    return r;
+}
+EXPORT_SYMBOL(sc_debug_info_record);
+
+void  early_debug_info_init(void)
+{
+    g_ap_debug_buffer_start = g_ap_debug_buffer;
+    g_ap_debug_buffer_write = g_ap_debug_buffer_start;
+    g_ap_debug_buffer_read  = g_ap_debug_buffer_start;
+    g_ap_debug_buffer_end   = g_ap_debug_buffer + DEBUG_INFO_AP_MEM_LEN;
+    g_ap_debug_read_cnt     = 0;
+    g_ap_debug_write_cnt    = 0;
+
+    g_init_flag = 1;
+    printk("cap early_debug_info_init  success \n");
 }
 
 static int __init debug_info_init(void)
 {
-    int ret = misc_register(&debug_info_device);
+    int ret;
+
+    ret = misc_register(&debug_info_device);
     if (ret)
     {
-        printk("debug_info_device init.\n");
+        printk("debug_info_init init.\n");
         return DEBUG_INFO_ERROR;
     }
 
-    void *mem;
-    mem = vmalloc(DEBUG_INFO_SHARE_MEM_LEN);
-    if (!mem)
-    {
-        printk("vmalloc failed.\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    g_debug_info_buf = CreateRingBuffer((UINT8 *)mem, DEBUG_INFO_SHARE_MEM_LEN);
-    if (g_debug_info_buf == NULL)
-    {
-        printk("CreateRingBuffer failed.\n");
-        return DEBUG_INFO_ERROR;
-    }
-#if 1
-    ret = rpmsgCreateChannel(
-        CORE_PS0, 
-        DEBUG_INFO_CHANNEL,
-        DEBUG_INFO_MSG_CAP_SIZE);
-    if (ret != DEBUG_INFO_OK) 
-    {
-        printk("rpmsgCreateChannel failed, ret = %d\n", ret);
-        return DEBUG_INFO_ERROR;
-    }  
-    
-    ret = rpmsgRegCallBack(
-            CORE_PS0,
-            DEBUG_INFO_CHANNEL, 
-            sc_debug_info_from_ap);
-    if (ret != DEBUG_INFO_OK) 
-    {
-        printk("rpmsgRegCallBack failed,ret = %d\n", ret);
-        return DEBUG_INFO_ERROR;
-    } 
-#endif
+    g_ps_debug_write_cnt     = (UINT32 *)ioremap(PS_DEBUG_INFO_LEN_ADDR_PA, PS_DEBUG_INFO_LEN_SIZE);
+   // printf("PS_DEBUG_INFO_LEN_ADDR_PA \n",)
+    g_ps_debug_full_cnt      = (UINT32 *)((char *)g_ps_debug_write_cnt + 4);
+    g_ps_debug_buffer_start  = (unsigned long)ioremap(PS_DEBUG_INFO_ADDR_PA, PS_DEBUG_INFO_SIZE);
+    g_ps_debug_buffer_read   = g_ps_debug_buffer_start;
+    g_ps_debug_buffer_end    = g_ps_debug_buffer_start + PS_DEBUG_INFO_SIZE;
+    g_ps_debug_read_cnt      = 0;
+    g_ps_debug_read_full_cnt = 0;
     sema_init(&debug_sem, 0);
-    /* 添加并启动定时器, 10ms */
-    mod_timer(&timer, jiffies + 1);    
-
-    g_init_flag = 1;
-
+    proc_create_single("debug_info_cap", 0, NULL, ap_log_proc_show);
+    proc_create_single("debug_info_ap", 0, NULL,  ps_log_proc_show);
+    mod_timer(&timer, jiffies + 1); 
+    printk("cap debug_info_init success \n");
+ //   g_init_flag = 1;
     return 0;
 }
 
 static void __exit debug_info_exit(void)
 {
     misc_deregister(&debug_info_device);
-
     del_timer(&timer);
 }
 
-static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len)
-{
-    UINT32 writelen;
-    UINT32 used_space;
-    unsigned long flags;
-
-    if (len == 0 || g_debug_info_buf == NULL)
-    {
-        printk("sc_debug_info_write:: (len == 0 || g_debug_info_buf == NULL).\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    raw_spin_lock_irqsave(&debugWr_lock, flags);
-    writelen = WriteRingBuffer(g_debug_info_buf, buf, len, flag);
-    raw_spin_unlock_irqrestore(&debugWr_lock, flags);
-    used_space = GetRingBufferSize(g_debug_info_buf);
-    if (used_space > DEBUG_INFO_READABLE_LEN)
-    {
-        if (debug_sem.count == 0)
-        {
-            up(&debug_sem);
-        }
-    }
-
-    return writelen;
-}
-
-static int sc_debug_info_read_to_user(char *buf, unsigned short count)
-{
-    unsigned int bufSize_used = 0;
-    unsigned int readLen = 0;
-    unsigned int bufLen = 0;
-    T_SAVE_FILE_DATA fileDataHead;
-
-    if (g_init_flag == 0)
-    {
-        printk("debug_info not init.\n");
-        return DEBUG_INFO_ERROR;
-    }
-    if (count == 0 || buf == NULL || g_debug_info_buf == NULL)
-    {
-        printk("sc_debug_info_read_to_user:: (count == 0 || buf == NULL || g_debug_info_buf == NULL).\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    bufSize_used = GetRingBufferSize(g_debug_info_buf);
-    if (bufSize_used == 0)
-    {
-        // printk("sc_debug_info_read_to_user:: ringBuf is empty.\n");
-        return 0;
-    }
-
-    fileDataHead.head = 0x010a0a0a;
-    fileDataHead.time = 0;
-    fileDataHead.total_len = bufSize_used;
-
-    copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA));
-
-    readLen = ReadRingBuffer(g_debug_info_buf, (buf + sizeof(T_SAVE_FILE_DATA)), bufSize_used, ZCAT_MEM_TYPE_USER);
-    if (readLen == 0)
-    {
-        // printk("ReadRingBuffer failed.\n");
-        return 0;
-    }
-
-    return (readLen + sizeof(T_SAVE_FILE_DATA));
-}
-
-static int sc_debug_info_record_from_user(const char *info, unsigned short count)
-{
-    unsigned int cnt = 0;
-    unsigned int my_jiffies = jiffies;
-
-    if (g_init_flag == 0)
-    {
-        printk("debug_info not init.\n");
-        return DEBUG_INFO_ERROR;
-    }
-    if (info == NULL)
-    {
-        printk("sc_debug_info_record_from_user:: info is NULL.\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    copy_to_user(info + 4, &my_jiffies, sizeof(my_jiffies));
-    cnt = sc_debug_info_write(ZCAT_MEM_TYPE_USER, (UINT8 *)info, count);
-
-    return cnt;
-}
-
 module_init(debug_info_init);
 module_exit(debug_info_exit);
-
-MODULE_AUTHOR("jcw");
 MODULE_DESCRIPTION("debug_info driver");
 MODULE_LICENSE("GPL");
 
-
-int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args)
-{
-    int len;
-    UINT32 writelen;
-    // va_list args;
-    char str_buf[DEBUG_INFO_MAX_TOTAL_LEN] __attribute__((aligned(4)));
-    T_SHARED_MEM_DATA *shareMemData = (T_SHARED_MEM_DATA *)str_buf;
-
-    if (g_init_flag == 0)
-    {
-        printk("debug_info not init.\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    /* args是一个char*类型指针,指向format之后的第一个参数*/
-    // va_start(args, format);
-    len = vsnprintf(shareMemData->sub_data, DEBUG_INFO_MAX_DATA_LEN, format, args);
-    // va_end(args);
-    if (len < 0)
-    {
-        printk("vsnprintf format error.\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    shareMemData->module_id = (UINT16)(id & 0xFFFF);
-    shareMemData->sub_len = len;
-    shareMemData->time = jiffies;
-
-    writelen = sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, (UINT8 *)shareMemData, len + sizeof(T_SHARED_MEM_DATA));
-    return writelen;
-}
-EXPORT_SYMBOL(sc_debug_info_vrecord);
-
-int sc_debug_info_record(unsigned int id, const char *format, ...)
-{
-    va_list args;
-	int r;
-
-	va_start(args, format);
-	r = sc_debug_info_vrecord(id, format, args);
-	va_end(args);
-
-
-    return r;
-}
-EXPORT_SYMBOL(sc_debug_info_record);
 #else
-int sc_debug_info_record(unsigned int id, const char *format, ...)
+int sc_debug_info_record(char *id, const char *format, ...)
 {
-	return 0;
+    return 0;
 }
 #endif   /*  _USE_ZXIC_DEBUG_INFO */
 
+
diff --git a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
index f72860e..be7309c 100755
--- a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
+++ b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
@@ -20,7 +20,7 @@
 #define MMC1_REG_BASE			0x1211000
 #define MATRIX_CRM_REG_BASE		0x1306000
 #define CFG_EMMC_CLK_ENUM		400000
-#define CFG_EMMC_CLK_WORK		26000000
+#define CFG_EMMC_CLK_WORK		50000000
 #define CFG_EMMC_CLK_REF		50000000
 
 #define ZXMCI_FIFO_DEPTH		128
diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index 2a8fcc3..c7da7a4 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -8,7 +8,7 @@
 #include "zvnet_dev.h"

 #include "ram_config.h"

 #include <net/netfilter/nf_conntrack.h>

-

+#include <net/SI/fast_common.h>

 /*******************************************************************************

  *                             Macro definitions                               *

  ******************************************************************************/

@@ -72,10 +72,8 @@
 module_param(g_wrap_num, int, 0644);

 unsigned int g_wrap_timeout = 10;

 module_param(g_wrap_timeout, int, 0644);

-/*jb.qi add for debug network package on 20240806 start*/

 unsigned int g_trace_limit = 0;

 module_param(g_trace_limit, int, 0644);

-/*jb.qi add for debug network package on 20240806 end*/

 #endif

 

 /*******************************************************************************

@@ -85,7 +83,6 @@
 extern void v7_dma_map_area(const void *, size_t, int);

 extern void *get_ct_for_ap(struct sk_buff *skb);

 extern void put_ct_for_ap(void *ct);

-extern spinlock_t fast_fw_spinlock;

 /*******************************************************************************

  *					   Local function declarations						*

  ******************************************************************************/

@@ -128,38 +125,41 @@
 	return NULL;

 }

 

+/* Started by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */

 void check_skb_test(struct sk_buff *skb)

 {

-	if(skb && vir_addr_ap){

-		struct sk_buff *tmp_skb;

-		if((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))

-		|| ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))){

-			dump_stack();

-			msleep(1000);

-			panic("capHead err");

-		}

-		skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {

-			if(tmp_skb == skb){

-				dump_stack();

-				msleep(1000);

-				panic("dup free");

-			}

-		}

-	}

+    if (skb && vir_addr_ap) {

+        struct sk_buff *tmp_skb;

+        if ((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))

+        || ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))) {

+            dump_stack();

+            panic("capHead err");

+        }

+        skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {

+            if (tmp_skb == skb) {

+                dump_stack();

+                panic("dup free");

+            }

+        }

+    }

 }

-/*jb.qi add for debug network package on 20240806 start*/

+/* Ended by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */

+

+/* Started by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */

 void zvnet_dump_packet(unsigned char * data, int len, int limit_len)

 {

     int i = 0;

-

-    for(i = 0; i < len && i < limit_len; i=i+16)

+    unsigned char *p = data;

+    for(i = 0; i < len && i < limit_len; i+=16)

     {

-        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

-            *(data+i),*(data+i+1),*(data+i+2),*(data+i+3),*(data+i+4),*(data+i+5),*(data+i+6),*(data+i+7),

-            *(data+i+8),*(data+i+9),*(data+i+10),*(data+i+11),*(data+i+12),*(data+i+13),*(data+i+14),*(data+i+15));

+        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

+            p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],

+            p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);

+        p += 16;

     }

 }

-/*jb.qi add for debug network package on 20240806 end*/

+/* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */

+

 int zvnet_get_index_by_netdev(struct net_device *net)

 {

     int i;

@@ -304,13 +304,11 @@
 	/* make sure we initialize shinfo sequentially */

 	skb_reset_network_header(skb);

 	skb_set_kcov_handle(skb, kcov_common_handle());

-	/*jb.qi add for debug network package on 20240806 start*/

 	if(unlikely(g_trace_limit > 0)){

-        	printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);

-        	zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

-        	printk("-%s-dump_packet-end-\n", skb->dev->name);

-        }

-	/*jb.qi add for debug network package on 20240806 end*/

+		printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);

+		zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

+		printk("-%s-dump_packet-end-\n", skb->dev->name);

+	}

 	return skb;

 }

 

@@ -321,33 +319,38 @@
     return 0;

 }

 

+/* Started by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */

 static void skb_debug_test(struct sk_buff *skb)

 {

     int i;

-    int vcount = skb->len/10;

-    int rcount = skb->len%10;

+    int vcount = skb->len / 10;

+    int rcount = skb->len % 10;

     char tmp[64] = {0};

     char strbuf[64] = {0};

+    const unsigned char *data = skb->data;

 

     zv_info("\n");

-    for(i=0; i<vcount; i++) {

-        zv_info("%d---0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x\n",i,skb->data[0+10*i],skb->data[1+10*i],skb->data[2+10*i],

-                skb->data[3+10*i],skb->data[4+10*i],skb->data[5+10*i],skb->data[6+10*i],skb->data[7+10*i],skb->data[8+10*i],skb->data[9+10*i]);

+    for (i = 0; i < vcount; i++) {

+        zv_info("%d---%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", i,

+                data[0 + 10 * i], data[1 + 10 * i], data[2 + 10 * i], data[3 + 10 * i],

+                data[4 + 10 * i], data[5 + 10 * i], data[6 + 10 * i], data[7 + 10 * i],

+                data[8 + 10 * i], data[9 + 10 * i]);

     }

-    if(vcount > 0) {

-        memset(tmp,0,sizeof(tmp));

-        memset(strbuf,0,sizeof(strbuf));

-        sprintf(strbuf,"%d---",vcount);

+    if (vcount > 0) {

+        memset(tmp, 0, sizeof(tmp));

+        sprintf(strbuf, "%d---", vcount);

+        char *p = strbuf + strlen(strbuf);

 

-        for(i=0; i<rcount; i++)

-        {

-            sprintf(tmp,"0x%x,",skb->data[10*vcount + i]);

-            strcat(strbuf,tmp);

+        for (i = 0; i < rcount; i++) {

+            sprintf(p, "%02x,", data[10 * vcount + i]);

+            p += strlen(p);

         }

-        zv_info("%s ",strbuf);

+        *(p - 1) = '\0'; // ÒÆ³ý×îºóÒ»¸ö¶ººÅ

+        zv_info("%s ", strbuf);

     }

     zv_info("\n");

 }

+/* Ended by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */

 

 static int zvnet_open(struct net_device *net)

 {

@@ -473,8 +476,8 @@
 		return NET_XMIT_SUCCESS;

 	}

 		

-	if(unlikely(skb_headroom(skb) < NET_SKB_PAD || skb->next//|| skb->capHead

-		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL) 

+	if(unlikely(skb->next//|| skb->capHead || skb_headroom(skb) < NET_SKB_PAD

+		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL)

 		|| (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) || (skb_has_frag_list(skb)))){

 		int ret_len = skb->len;

 

@@ -632,6 +635,7 @@
     .ndo_get_stats  = zvnet_get_stats,

     .ndo_change_mtu = eth_change_mtu,

     .ndo_validate_addr = eth_validate_addr,

+    .ndo_set_mac_address = eth_mac_addr,

 };

 

 static void v2xnet_init_netdev(struct net_device *net)

@@ -802,30 +806,32 @@
 {

     struct sk_buff *skb;

 #if 0

-    char skb_data[ZVNET_TMP_BUFF_LEN];

-    int ret_len = 0;

+/* Started by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */

+int ret_len = 0;

+struct sk_buff *skb;

 

-    if(NULL == chninfo || NULL == dev) {

-        zv_err("zvnet_channel_read null.\n");

-        return NULL;

-    }

+ret_len = zvnet_channel_read(chninfo, NULL, 0); // »ñÈ¡ÐèÒª¶ÁÈ¡µÄÊý¾Ý³¤¶È

+if(ret_len <= 0) {

+    zv_err("zvnet_channel_read fail.\n");

+    return NULL;

+}

 

-    ret_len = zvnet_channel_read(chninfo, (void *)skb_data, sizeof(skb_data));

+skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);

+if (unlikely(!skb)) {

+    zv_err("netdev_alloc_skb fail,len %d",ret_len);

+    return NULL;

+}

 

-    if(ret_len <= 0) {

-        zv_err("zvnet_channel_read fail.\n");

-        return NULL;

-    }

+ret_len = zvnet_channel_read(chninfo, skb->data, ret_len); // ¶ÁÈ¡Êý¾Ýµ½skb->data

+if(ret_len <= 0) {

+    kfree_skb(skb); // Èç¹û¶Áȡʧ°Ü£¬ÊÍ·ÅÒÑ·ÖÅäµÄskb

+    zv_err("zvnet_channel_read fail.\n");

+    return NULL;

+}

 

-    skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);

-    if (unlikely(!skb)) {

-        zv_err("netdev_alloc_skb fail,len %d",ret_len);

-        return NULL;

-    }

-

-    skb_put(skb,ret_len);

-    skb_reserve(skb, ZVNET_SKB_PAD);

-    memcpy(skb->data, &skb_data[0], ret_len);

+skb_put(skb,ret_len);

+skb_reserve(skb, ZVNET_SKB_PAD);

+/* Ended by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */

 #else

 	struct T_zvnet_rpmsg buff = {0};

 	int ret_len = 0;

@@ -1099,6 +1105,9 @@
 							.flag = 0};

 	int ret_len = 0;

 	struct nf_conn *ct;

+	fast_entry_t *entry;

+	struct net_device *in;

+	struct net_device *out;

 	

 	while(1) {

 		struct T_zvnet_rpmsg_ctstat buff = {0};

@@ -1115,33 +1124,104 @@
 			panic("err, ret:%d!!!!!!", ret_len);	

 		}

 		ct = (struct nf_conn *)buff.cap_nfct;

-		

 		WARN_ON(atomic_read(&ct->ct_general.use) == 0);

 		if(buff.flag){

+			if(!(buff.pkt[0].pkt || buff.pkt[0].len || buff.pkt[1].pkt || buff.pkt[1].len))

+				continue;

 			BUG_ON(buff.in <= 0 || buff.out <= 0);

+			in = zvnet_dev[buff.in-1].net;

+			out = zvnet_dev[buff.out-1].net;

 			if(buff.pkt[0].pkt && buff.pkt[0].len){

 				zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[0]->name, ct->outdev[0]->name, buff.in, buff.out);

-				zvnet_dev[buff.in-1].net->stats.rx_packets += buff.pkt[0].pkt;

-				zvnet_dev[buff.in-1].net->stats.rx_bytes += buff.pkt[0].len;

-				zvnet_dev[buff.out-1].net->stats.tx_packets += buff.pkt[0].pkt;

-				zvnet_dev[buff.out-1].net->stats.tx_bytes += buff.pkt[0].len;

+				in->stats.rx_packets += buff.pkt[0].pkt;

+				in->stats.rx_bytes += buff.pkt[0].len;

+				out->stats.tx_packets += buff.pkt[0].pkt;

+				out->stats.tx_bytes += buff.pkt[0].len;

 			}

 			if(buff.pkt[1].pkt && buff.pkt[1].len){

 				zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[1]->name, ct->outdev[1]->name, buff.out, buff.in);

-				zvnet_dev[buff.out-1].net->stats.rx_packets += buff.pkt[1].pkt;

-				zvnet_dev[buff.out-1].net->stats.rx_bytes += buff.pkt[1].len;

-				zvnet_dev[buff.in-1].net->stats.tx_packets += buff.pkt[1].pkt;

-				zvnet_dev[buff.in-1].net->stats.tx_bytes += buff.pkt[1].len;

+				out->stats.rx_packets += buff.pkt[1].pkt;

+				out->stats.rx_bytes += buff.pkt[1].len;

+				in->stats.tx_packets += buff.pkt[1].pkt;

+				in->stats.tx_bytes += buff.pkt[1].len;

 			}

 			spin_lock_bh(&fast_fw_spinlock);

+			/*¸üÐÂÁ´½Ó³¬Ê±*/

+			if (IPPROTO_TCP == nf_ct_protonum(ct))

+			{

+				ct->timeout = jiffies + tcp_timeouts[ct->proto.tcp.state];

+			}else if (IPPROTO_UDP == nf_ct_protonum(ct)){

+				/*udp*/

+				if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)){

+					ct->timeout = jiffies + fast_udp_timeout_stream;

+				}else{

+					ct->timeout = jiffies + fast_udp_timeout;

+				}

+			}

+			entry = (fast_entry_t *)ct->fast_entry;

+			if(entry){

+				WARN_ON(entry->ct != ct);

+				mod_timer(&entry->timeout, ct->timeout);

+			}

 			ct->packet_info[IP_CT_DIR_ORIGINAL].bytes += buff.pkt[IP_CT_DIR_ORIGINAL].len;

 			ct->packet_info[IP_CT_DIR_ORIGINAL].packets += buff.pkt[IP_CT_DIR_ORIGINAL].pkt;

 			ct->packet_info[IP_CT_DIR_REPLY].bytes += buff.pkt[IP_CT_DIR_REPLY].len;

 			ct->packet_info[IP_CT_DIR_REPLY].packets += buff.pkt[IP_CT_DIR_REPLY].pkt;

+			if(ct->indev[0] && is_vlan_dev(ct->indev[0])){

+				struct net_device *tmp = vlan_dev_real_dev(ct->indev[0]);

+				struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[0])->vlan_pcpu_stats);

+

+				if(tmp == in){

+/* Started by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */

+u64_stats_update_begin(&stats->syncp);

+stats->rx_packets += buff.pkt[0].pkt;

+stats->rx_bytes += buff.pkt[0].len;

+stats->tx_packets += buff.pkt[1].pkt;

+stats->tx_bytes += buff.pkt[1].len;

+u64_stats_update_end(&stats->syncp);

+/* Ended by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */

+				}else if(tmp == out){

+/* Started by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */

+u64_stats_update_begin(&stats->syncp);

+stats->tx_packets += buff.pkt[0].pkt;

+stats->tx_bytes += buff.pkt[0].len;

+stats->rx_packets += buff.pkt[1].pkt;

+stats->rx_bytes += buff.pkt[1].len;

+u64_stats_update_end(&stats->syncp);

+/* Ended by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */

+				}else

+					zv_err("nf_update0 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[0]->name);

+			}

+			if(ct->indev[1] && is_vlan_dev(ct->indev[1])){

+				struct net_device *tmp = vlan_dev_real_dev(ct->indev[1]);

+				struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[1])->vlan_pcpu_stats);

+

+				if(tmp == in){

+/* Started by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */

+u64_stats_update_begin(&stats->syncp);

+stats->rx_packets += buff.pkt[0].pkt;

+stats->rx_bytes += buff.pkt[0].len;

+stats->tx_packets += buff.pkt[1].pkt;

+stats->tx_bytes += buff.pkt[1].len;

+u64_stats_update_end(&stats->syncp);

+/* Ended by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */

+				}else if(tmp == out){

+/* Started by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */

+u64_stats_update_begin(&stats->syncp);

+stats->tx_packets += buff.pkt[0].pkt;

+stats->tx_bytes += buff.pkt[0].len;

+stats->rx_packets += buff.pkt[1].pkt;

+stats->rx_bytes += buff.pkt[1].len;

+u64_stats_update_end(&stats->syncp);

+/* Ended by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */

+				}else

+					zv_err("nf_update1 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[1]->name);

+			}

 			spin_unlock_bh(&fast_fw_spinlock);

 			zv_info("nf_update %x %d %d %d %d", buff.cap_nfct, buff.pkt[0].pkt, buff.pkt[0].len, buff.pkt[1].pkt, buff.pkt[1].len);

 		}else{

 			zv_info("nf_put %x", buff.cap_nfct);

+			WRITE_ONCE(ct->timeout, nfct_time_stamp);

 			nf_conntrack_put(buff.cap_nfct);

 		}

 	}

@@ -1179,11 +1259,11 @@
             return err;

         }

 

-        net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;

+        //net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;

         sprintf(net->name, "%s%d", ZVNET_IFNAME_PREFIX, i);

         dev = v2xnet_dev_init(net, zvnetdev);

         v2xnet_init_netdev(net);

-		if(0 == i){

+		if(0 == i || i > 8){

 			net->flags = (net->flags & (~IFF_NOARP));

 		}

         err = register_netdev(net);

diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
index d1feaa5..7c46dd3 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
@@ -27,7 +27,7 @@
 	__func__ , ## arg)

 

 //zvnetÉ豸×î´óÊý

-#define DDR_ZVNET_DEV_MAX 10

+#define DDR_ZVNET_DEV_MAX 16

 #define ZVNET_IFNAME_PREFIX "zvnet"

 

 #define  ICP_CHN_ZVNET1 20 //ICP_CHANNEL_WAN1

diff --git a/upstream/linux-5.10/drivers/rtc/class.c b/upstream/linux-5.10/drivers/rtc/class.c
index 625effe..87310ce 100755
--- a/upstream/linux-5.10/drivers/rtc/class.c
+++ b/upstream/linux-5.10/drivers/rtc/class.c
@@ -19,6 +19,7 @@
 #include <linux/workqueue.h>
 
 #include "rtc-core.h"
+#include "pub_debug_info.h"
 
 static DEFINE_IDA(rtc_ida);
 struct class *rtc_class;
@@ -80,7 +81,7 @@
 #endif
 
 	err = do_settimeofday64(&tv64);
-
+	sc_debug_info_record("hctosys", "time synchronization successful!\r\n");
 	dev_info(rtc->dev.parent, "setting system clock to %ptR UTC (%lld)\n",
 		 &tm, (long long)tv64.tv_sec);
 
diff --git a/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c b/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
index 66c8cf3..f9b23d7 100755
--- a/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
+++ b/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
@@ -37,6 +37,7 @@
 #include <linux/soc/sc/rpmsg.h>
 #include <dt-bindings/soc/zx297520v3-irq.h>
 #include <uapi/linux/sc_bsp/bsp_api.h>
+#include <pub_debug_info.h>
 
 #include "pcu-common.h"
 
@@ -705,6 +706,7 @@
 	if(index_found != 0xff)
 	{
 		pm_ram_log(" wake: %d  [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
+		sc_debug_info_record(MODULE_ID_CAP_PM, " wake: %d  [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
 
 		if(zx297520v3_pcu_int_info[index_found].gic_index ==ICP_PS2AP_INT) {
 			show_icp_state(CORE_PS0);
diff --git a/upstream/linux-5.10/drivers/soc/sc/plat/plat-zx297520v3.c b/upstream/linux-5.10/drivers/soc/sc/plat/plat-zx297520v3.c
index b2da8d9..2cf9b67 100755
--- a/upstream/linux-5.10/drivers/soc/sc/plat/plat-zx297520v3.c
+++ b/upstream/linux-5.10/drivers/soc/sc/plat/plat-zx297520v3.c
@@ -80,6 +80,8 @@
 #define ZX_SPINLOCK_TEST	0
 #define ZX_PM_QOS_TEST		1
 
+#define GPIO_HIGH 1
+#define GPIO_LOW  0
 
 /* 
  * 
@@ -1898,6 +1900,10 @@
 static int zx_restart(struct notifier_block *this,
 			   unsigned long mode, void *cmd)
 {
+	/*reset spinand cs*/
+	soft_spin_lock_nand_psm(NAND_SFLOCK);
+	gpio_set_value(86,GPIO_HIGH);
+	
 	if (reboot_rst) {
 		reset_control_assert(reboot_rst);		
 	}
diff --git a/upstream/linux-5.10/drivers/soc/sc/power/zx29-cpufreq.c b/upstream/linux-5.10/drivers/soc/sc/power/zx29-cpufreq.c
index 7eacfd7..1def959 100755
--- a/upstream/linux-5.10/drivers/soc/sc/power/zx29-cpufreq.c
+++ b/upstream/linux-5.10/drivers/soc/sc/power/zx29-cpufreq.c
@@ -219,9 +219,11 @@
 		return 0;
 
 #ifdef SET_AXI_BY_HW
-	tmp = (pm_read_reg(PS_MATRIX_AXI_SEL)&(~0x7))|axi_freq;
-	pm_write_reg(PS_MATRIX_AXI_SEL,tmp);
-    pm_printk("[CPUFREQ] current_axi_freq(%d)  request_axi_freq(%d)  after_request_axi_freq(%d)  after_request_vol(%d)\n",(u32)current_axi_freq,(u32)axi_freq,get_cur_axi(),get_cur_vol());		
+/* Started by AICoder, pid:z8ed4zb53200a29148230ac670df2e16d7344ba7 */
+	tmp = (pm_read_reg(AP_MATRIX_AXI_SEL)&(~0x7))|axi_freq;
+	pm_write_reg(AP_MATRIX_AXI_SEL,tmp);
+    pm_printk("[CPUFREQ] current_axi_freq(%d)  request_axi_freq(%d)  after_request_axi_freq(%d)  after_request_vol(%d)\n",(u32)current_axi_freq,(u32)axi_freq, (pm_read_reg(AP_MATRIX_AXI_SEL)&(0x7)),get_cur_vol());
+/* Ended by AICoder, pid:z8ed4zb53200a29148230ac670df2e16d7344ba7 */
 #else
 	set_target_axi_sw(axi_freq);
 
@@ -295,13 +297,9 @@
 
 	if(cpufreq_driver_inited==0)
 			return -EPERM;
-
-	if(axifreq >= 600*1000*1000)
-		return AXI_FREQ_156M;
-	else
-		return AXI_FREQ_78M;
-
-	return request_axi_freq(axi_freq);
+/* Started by AICoder, pid:keaa857ea2211111463f0b6cf00c182e9b179920 */
+	return request_axi_freq(axifreq);
+/* Ended by AICoder, pid:keaa857ea2211111463f0b6cf00c182e9b179920 */
 }
 
 #endif
diff --git a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
index aae42a2..3c5ba58 100755
--- a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
+++ b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
@@ -15,6 +15,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/soc/sc/common.h>
 #include <linux/soc/sc/spinlock.h>
+#include <pub_debug_info.h>
 
 #include "icp_dev.h"
 #include "zx29_icp.h"
@@ -334,6 +335,7 @@
 
 	icp_get_int_info(actorID, &hw, &lw);
 	pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw);
+	sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw);
 
 	for (i=0; i<32; i++)
 		if (lw&BIT(i))
diff --git a/upstream/linux-5.10/drivers/soc/sc/spinlock/spinlock-zx297520v3.c b/upstream/linux-5.10/drivers/soc/sc/spinlock/spinlock-zx297520v3.c
index 7843e46..9e017da 100755
--- a/upstream/linux-5.10/drivers/soc/sc/spinlock/spinlock-zx297520v3.c
+++ b/upstream/linux-5.10/drivers/soc/sc/spinlock/spinlock-zx297520v3.c
@@ -300,6 +300,34 @@
 

 }

 

+void  soft_spin_lock_nand_psm(emsf_lock_id sfid)

+{

+	unsigned long lock_count = 0;

+softlock_loop:

+   	while(softlock_desc[sfid]->owner != SELF_CORE_ID && softlock_desc[sfid]->used)

+   	{

+		lock_count++;

+		udelay(1);

+		if(lock_count >= 100000)

+		{

+			return;

+		}

+   	}

+

+	_hw_spin_lock(SOFTLOCK_HWLOCK);

+	if(softlock_desc[sfid]->owner != SELF_CORE_ID && softlock_desc[sfid]->used)

+   	{

+	      _hw_spin_unlock(SOFTLOCK_HWLOCK);

+		goto softlock_loop;

+   	}

+    softlock_desc[sfid]->used ++;

+    softlock_desc[sfid]->owner = SELF_CORE_ID;

+    _hw_spin_unlock(SOFTLOCK_HWLOCK);

+    //zspinlock_debug("cpu %d releases %d software lock!/n",SELF_CORE_ID,sfid);

+

+}

+

+

 /*******************************************************************************

  * Function: soft_spin_unlock_psm

  * Description:Óësoft_spin_lock_psm¶ÔÓ¦µÄÊÍ·ÅÈí¼þËø½Ó¿Ú¡£

@@ -503,6 +531,7 @@
 void soft_spin_lock(emsf_lock_id sfid){}

 void soft_spin_unlock(emsf_lock_id sfid){}

 void  soft_spin_lock_psm(emsf_lock_id sfid){}

+void  soft_spin_lock_nand_psm(emsf_lock_id sfid){}

 void  soft_spin_unlock_psm(emsf_lock_id sfid){}

 void  hw_spin_lock(emhw_lock_id hwid){}

 void  hw_spin_unlock(emhw_lock_id hwid){}

diff --git a/upstream/linux-5.10/drivers/spi/spi-zx29.c b/upstream/linux-5.10/drivers/spi/spi-zx29.c
index fd49fd6..57600dc 100755
--- a/upstream/linux-5.10/drivers/spi/spi-zx29.c
+++ b/upstream/linux-5.10/drivers/spi/spi-zx29.c
@@ -2341,7 +2341,9 @@
 	.iface = SPI_INTERFACE_MOTOROLA_SPI,
 	.hierarchy = SPI_MASTER,
 	.slave_tx_disable = DO_NOT_DRIVE_TX,
+	/* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck start */
 	.rx_lev_trig = SPI_RX_8_OR_MORE_ELEM,
+	/* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck end */
 	.tx_lev_trig = SPI_TX_4_OR_MORE_EMPTY_LOC,
 //	.ctrl_len = SSP_BITS_8,
 //	.wait_state = SSP_MWIRE_WAIT_ZERO,
diff --git a/upstream/linux-5.10/drivers/staging/Kconfig b/upstream/linux-5.10/drivers/staging/Kconfig
index 443587b..aacc8d0 100755
--- a/upstream/linux-5.10/drivers/staging/Kconfig
+++ b/upstream/linux-5.10/drivers/staging/Kconfig
@@ -118,5 +118,7 @@
 
 source "drivers/staging/hikey9xx/Kconfig"
 
+source "drivers/staging/voicedrv/Kconfig"
+
 source "drivers/staging/voicebufferdrv/Kconfig"
 endif # STAGING
diff --git a/upstream/linux-5.10/drivers/staging/Makefile b/upstream/linux-5.10/drivers/staging/Makefile
index 0cb5246..276dea6 100755
--- a/upstream/linux-5.10/drivers/staging/Makefile
+++ b/upstream/linux-5.10/drivers/staging/Makefile
@@ -49,4 +49,5 @@
 obj-$(CONFIG_QLGE)		+= qlge/
 obj-$(CONFIG_WFX)		+= wfx/
 obj-y				+= hikey9xx/
+obj-$(CONFIG_VOICE_DRV)		+= voicedrv/
 obj-$(CONFIG_VOICE_BUFFER_DRV)		+= voicebufferdrv/
diff --git a/upstream/linux-5.10/drivers/staging/voicebufferdrv/voice_buffer_dev_multicore.c b/upstream/linux-5.10/drivers/staging/voicebufferdrv/voice_buffer_dev_multicore.c
index 9c7d0c3..3beb425 100755
--- a/upstream/linux-5.10/drivers/staging/voicebufferdrv/voice_buffer_dev_multicore.c
+++ b/upstream/linux-5.10/drivers/staging/voicebufferdrv/voice_buffer_dev_multicore.c
Binary files differ
diff --git a/upstream/linux-5.10/drivers/staging/voicedrv/Kconfig b/upstream/linux-5.10/drivers/staging/voicedrv/Kconfig
new file mode 100755
index 0000000..426928d
--- /dev/null
+++ b/upstream/linux-5.10/drivers/staging/voicedrv/Kconfig
@@ -0,0 +1,11 @@
+#
+# voice driver for voice in userspace of ZX297520
+#
+
+comment "ZX297520 voice driver"
+
+config VOICE_DRV
+	bool "Voice Drv"
+	default n
+	help
+	  Select this to make sure the build voice driver
diff --git a/upstream/linux-5.10/drivers/staging/voicedrv/Makefile b/upstream/linux-5.10/drivers/staging/voicedrv/Makefile
new file mode 100755
index 0000000..fbad610
--- /dev/null
+++ b/upstream/linux-5.10/drivers/staging/voicedrv/Makefile
@@ -0,0 +1,10 @@
+#
+# voice driver. 
+#
+
+
+ccflags-y += -Idrivers/staging/voicedrv/include
+
+
+obj-$(CONFIG_VOICE_DRV)	+= voice_drv.o
+voice_drv-$(CONFIG_VOICE_DRV) := voice_cap.o
diff --git a/upstream/linux-5.10/drivers/staging/voicedrv/include/voice.h b/upstream/linux-5.10/drivers/staging/voicedrv/include/voice.h
new file mode 100755
index 0000000..2566eb1
--- /dev/null
+++ b/upstream/linux-5.10/drivers/staging/voicedrv/include/voice.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 ZTE, China
+ *
+ * This is the header file for the voice driver.
+ *
+ */
+
+#ifndef __LINUX_VOICE_H
+#define __LINUX_VOICE_H
+
+
+
+
+
+
+
+#endif
diff --git a/upstream/linux-5.10/drivers/staging/voicedrv/voice_cap.c b/upstream/linux-5.10/drivers/staging/voicedrv/voice_cap.c
new file mode 100755
index 0000000..3da1ad3
--- /dev/null
+++ b/upstream/linux-5.10/drivers/staging/voicedrv/voice_cap.c
@@ -0,0 +1,207 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <asm/uaccess.h>
+#include <linux/slab.h>
+
+#include <linux/volte_drv.h>
+
+
+#include "include/voice.h"
+
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("xxq");
+
+static int s_voiceInfMode = 0;
+static DEFINE_MUTEX(infmode_lock);
+
+
+struct voice_dev *voicedev = NULL;
+static const char voice_shortname[] = "voice_device";
+
+
+
+
+static int voice_open(struct inode *ip, struct file *fp);
+static int voice_release(struct inode *ip, struct file *fp);
+static long voice_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
+
+
+
+
+
+
+static int voice_SetVoiceInfMode(int mode)
+{
+	int ret = 0;
+	mutex_lock(&infmode_lock);	
+	s_voiceInfMode = mode;
+	mutex_unlock(&infmode_lock);	
+	printk(KERN_INFO "%s:mode = %d\n",__func__,mode);
+
+	return ret;
+}
+
+static int voice_GetVoiceInfMode(void)
+{      
+   	int mode; 
+	mutex_lock(&infmode_lock);	
+	mode = s_voiceInfMode;
+	mutex_unlock(&infmode_lock);		
+	printk(KERN_INFO "%s:mode = %d\n",__func__,s_voiceInfMode);
+    return mode;
+}
+
+
+
+
+/* file operations for volte device /dev/volte_device */
+static const struct file_operations voice_fops = {
+	.owner = THIS_MODULE,
+	//.read = voice_read,
+	//.write = voice_write,
+	.unlocked_ioctl = voice_ioctl,
+	.open = voice_open,
+	.release = voice_release,
+};
+
+static struct miscdevice voice_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = voice_shortname,
+	.fops = &voice_fops,
+};
+
+
+#if 0
+static ssize_t voice_read(struct file *fp, char __user *buf, size_t count, loff_t *pos)
+{
+	struct adbproxy_dev *dev = fp->private_data;
+	struct usbproxy_request *req;
+	int r = count, xfer;
+	int ret;
+	return count;
+}
+
+static ssize_t voice_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
+{
+	int ret;
+
+
+	return count;
+}
+#endif
+
+
+static long voice_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
+{
+	int ret = 0;
+	void __user *argp = (void __user *) arg;
+#ifndef CONFIG_RECOVERY_SYSTEM
+
+	switch (cmd) {
+
+	
+	case VOICE_IOCTL_GET_INF_MODE: {
+
+		int mode;
+		mode = voice_GetVoiceInfMode();	
+
+		pr_info("voice_ioctl GET_VBUF,mode=%d!\n",mode);
+		
+		if (copy_to_user(argp, &mode, sizeof(mode))) {
+			pr_err("voice_ioctl GetVoiceInfMode copy_to_user err!\n");
+			return -EFAULT;
+		}
+	
+		break;
+	}
+	
+	case VOICE_IOCTL_SET_INF_MODE: {
+		int para;
+
+		if (copy_from_user(&para, argp, sizeof(para))) {
+			print_audio("voice_ioctl  SetVoiceInfMode copy_to_user err!\n");
+			return -EFAULT;
+		}
+		ret = voice_SetVoiceInfMode(para);	
+		if (ret < 0)
+			print_audio("%s  SetVoiceInfMode  ret=%d\n", __func__, ret);
+	
+		break;
+	}
+
+	
+	default: {
+		pr_info("voice_ioctl  invalid cmd!\n");
+		break;
+	}
+	}
+#endif
+
+	return ret;
+}
+
+
+
+static int voice_open(struct inode *ip, struct file *fp)
+{
+//	pr_info("volte_open\n");
+
+#ifndef CONFIG_RECOVERY_SYSTEM
+	if (voicedev == NULL) {
+		voicedev = kzalloc(sizeof(*voicedev), GFP_KERNEL);
+		if (!voicedev) {
+			pr_info("voice_init malloc error\n");
+			return -ENOMEM;
+		}
+
+
+	}
+
+#endif
+
+	return 0;
+}
+
+static int voice_release(struct inode *ip, struct file *fp)
+{
+//	pr_info("volte_release\n");
+#ifndef CONFIG_RECOVERY_SYSTEM
+	if (voicedev) {
+		kfree(voicedev);
+		voicedev = NULL;
+		print_audio("release voicedev!\n");
+
+	}
+#endif
+
+	return 0;
+}
+
+
+static int __init voice_init(void)
+{
+	int ret;
+//	pr_info("volte_init\n");
+
+	ret = misc_register(&voice_device);
+	if (ret) {
+		printk(KERN_ERR "voice driver failed to initialize\n");
+		return -EFAULT;
+	}
+//	pr_info("voice_init volte_device nodename=%s\n",volte_device.nodename);
+
+	return 0;
+}
+
+
+static void __exit voice_exit(void)
+{
+	misc_deregister(&voice_device);
+}
+
+module_init(voice_init);
+module_exit(voice_exit);
diff --git a/upstream/linux-5.10/drivers/tty/tty_io.c b/upstream/linux-5.10/drivers/tty/tty_io.c
index 669aef7..8591d06 100755
--- a/upstream/linux-5.10/drivers/tty/tty_io.c
+++ b/upstream/linux-5.10/drivers/tty/tty_io.c
@@ -771,6 +771,12 @@
 	if (tty->stopped)
 		return;
 	tty->stopped = 1;
+	
+	//l.yang add log for bug T106-134 start
+	if(tty->index == 1){
+		printk("__stop_tty got stop cmd\n");
+	}
+	//l.yang add log for bug T106-134 end
 	if (tty->ops->stop)
 		tty->ops->stop(tty);
 }
diff --git a/upstream/linux-5.10/include/linux/soc/sc/spinlock.h b/upstream/linux-5.10/include/linux/soc/sc/spinlock.h
index eb5e7b7..17faf8b 100755
--- a/upstream/linux-5.10/include/linux/soc/sc/spinlock.h
+++ b/upstream/linux-5.10/include/linux/soc/sc/spinlock.h
@@ -103,7 +103,7 @@
 void  reg_spin_unlock(void);

 void  soft_spin_lock_psm(emsf_lock_id sfid);

 void  soft_spin_unlock_psm(emsf_lock_id sfid);

-

+void  soft_spin_lock_nand_psm(emsf_lock_id sfid);

 void zx_spinlock_init(void __iomem *spinlock_base);

 int  soft_spin_lock_printf(emsf_lock_id sfid);

 

diff --git a/upstream/linux-5.10/include/linux/soc/zte/spinlock.h b/upstream/linux-5.10/include/linux/soc/zte/spinlock.h
index 1181933..e5edb44 100755
--- a/upstream/linux-5.10/include/linux/soc/zte/spinlock.h
+++ b/upstream/linux-5.10/include/linux/soc/zte/spinlock.h
@@ -107,7 +107,7 @@
 void  reg_spin_unlock(void);

 void  soft_spin_lock_psm(emsf_lock_id sfid);

 void  soft_spin_unlock_psm(emsf_lock_id sfid);

-

+void  soft_spin_lock_nand_psm(emsf_lock_id sfid);

 void zx_spinlock_init(void __iomem *spinlock_base);

 int  soft_spin_lock_printf(emsf_lock_id sfid);

 

diff --git a/upstream/linux-5.10/include/linux/volte_drv.h b/upstream/linux-5.10/include/linux/volte_drv.h
new file mode 100755
index 0000000..7862449
--- /dev/null
+++ b/upstream/linux-5.10/include/linux/volte_drv.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2013 ZTE, China
+ *
+ * It has the ioctl definitions for the volte driver that
+ * userspace needs to know about.
+ */
+
+#ifndef __LINUX_VOLTE_DRV_H
+#define __LINUX_VOLTE_DRV_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+
+
+typedef enum {
+    VOICE_GSM_MODE = 0,
+    VOICE_TD_MODE ,
+    VOICE_WCDMA_MODE,
+    VOICE_LTE_MODE,
+    VOICE_GSM_TD_MODE,//GSM TD share
+    VOICE_GSM_WCDMA_MODE,    //GSM WCDMA share
+    MAX_VOICE_MODE
+} T_ZDrvVoice_MODE;
+typedef struct {
+	uint32_t clock_rate;
+	uint32_t channel_count;
+	uint32_t samples_per_frame;
+	uint32_t bits_per_sample;
+	uint32_t mode;
+} T_ZDrvVoice_Cfg;
+
+typedef   T_ZDrvVoice_Cfg T_ZDrvVolte_Cfg;
+
+#ifdef __KERNEL__
+struct volte_dev {
+	T_ZDrvVoice_Cfg param;
+	void *readbuf;
+	void *writebuf;
+};
+#endif
+
+#define VOLTE_IOCTL_READ_START	_IO('v', 1)
+#define VOLTE_IOCTL_READ_STOP	_IO('v', 2)
+#define VOLTE_IOCTL_WRITE_START	_IO('v', 3)
+#define VOLTE_IOCTL_WRITE_STOP	_IO('v', 4)
+#define VOLTE_IOCTL_SET_CFG	_IOW('v', 5, T_ZDrvVoice_Cfg)
+#define VOLTE_IOCTL_GET_SLIC_USE_FLAG	_IOR ('v', 6, int)
+
+/**************voice  define****************/
+typedef enum {
+    AMR_NB_CODEC = 0,
+    AMR_WB_CODEC,
+
+    MAX_CODEC_TYPE
+} T_Codec_Type;
+
+typedef enum {
+    DSP_PATH = 0,
+    SOFT_PATH,
+    MAX_CODEC_PATH
+} T_Codec_Path;
+
+typedef enum {
+    NOR_VOICE_INF_MODE = 0,//normal
+    VB_VOICE_INF_MODE,//voice buffer
+    MAX_VOICE_INF_MODE
+} T_VoiceInfMode;
+
+
+typedef enum {
+    VOICE_STOP = 0,
+    VOICE_START,
+    MAX_VOICE_STATE
+} T_Voice_State;
+
+typedef struct {
+	uint32_t clock_rate;  //8000;16000
+	uint32_t mode; //// 0 gsm;1 td;2 wcdma;3 lte
+	uint32_t codec_type;//0 amr-nb;1 amr-wb
+	uint32_t codec_path;//0 hardware dsp;1 soft amr lib
+
+
+} T_Voice_Para;
+
+typedef struct {
+	uint32_t fs;  //8000;16000 
+	uint32_t enable; //// 0 disable;1 enable
+	uint32_t type;//0 single core;1 mult core
+
+
+} T_VoiceBuf_Para;
+
+
+#ifdef __KERNEL__
+struct voice_dev {
+	T_Voice_Para param;
+	uint32_t voice_state;
+};
+#endif
+
+#define VOICE_IOCTL_START	_IOW('v', 10, T_ZDrvVoice_Cfg)
+#define VOICE_IOCTL_STOP	_IOW('v', 11, T_ZDrvVoice_Cfg)
+#define VOICE_IOCTL_GET_SLIC_USE_FLAG	_IOR ('v', 12, int)
+#define VOICE_IOCTL_VPLOOP	_IOW('v', 13, int)
+
+#define VOICE_IOCTL_SET_VOL	_IOW('v', 14, int)
+#define VOICE_IOCTL_GET_VOL	_IOR('v', 15, int) 
+
+#define VOICE_IOCTL_SET_MUTE	_IOW('v', 16, bool)
+#define VOICE_IOCTL_GET_MUTE	_IOR('v', 17, bool)
+
+#define VOICE_IOCTL_SET_PATH	_IOW('v', 18, int)
+#define VOICE_IOCTL_GET_PATH	_IOR('v', 19, int) 
+
+#define VOICE_IOCTL_GET_FS	_IOR('v', 20, int)
+#define VOICE_IOCTL_SET_VOICE_NVRW	_IOW('v', 21, int)
+
+#define VOICE_IOCTL_SET_VP	_IOW('v', 22, int)
+#define VOICE_IOCTL_GET_VP	_IOR('v', 23, int) 
+
+#define VOICE_IOCTL_SET_VBUF	_IOW('v', 24, T_VoiceBuf_Para)
+#define VOICE_IOCTL_GET_VBUF	_IOR('v', 25, T_VoiceBuf_Para) 
+
+#define VOICE_IOCTL_SET_INF_MODE	_IOW('v', 26, int)
+#define VOICE_IOCTL_GET_INF_MODE	_IOR('v', 27, int) 
+
+
+
+#ifdef __KERNEL__
+#define  print_audio(fmt, ...)  \
+		printk(fmt, ##__VA_ARGS__)
+#endif
+
+/**************audiomix  define****************/
+typedef struct {
+    uint32_t sample_rate;
+    uint32_t audioType;
+    //uint32_t samples_per_frame;
+    //uint32_t bits_per_sample;
+} T_ZDrvAudioMix_Cfg;
+
+#ifdef __KERNEL__
+struct audio_mix_dev {
+    T_ZDrvAudioMix_Cfg param;
+    //void *readbuf;
+    void *writebuf;
+};
+#endif
+ 
+#define AUDIOMIX_IOCTL_SET_CFG _IOW('v', 7, T_ZDrvAudioMix_Cfg) 
+
+#endif
+
diff --git a/upstream/linux-5.10/include/net/SI/netioc_proc.h b/upstream/linux-5.10/include/net/SI/netioc_proc.h
index f0c8aa4..38f9bce 100755
--- a/upstream/linux-5.10/include/net/SI/netioc_proc.h
+++ b/upstream/linux-5.10/include/net/SI/netioc_proc.h
@@ -417,6 +417,9 @@
 extern  int  fast_local4_output_num;    //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
 extern  int  fast_local6_output_num;    //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
 extern  int  fast_tcpdump_num;          //fast×¥°üÊýÁ¿
+extern  int  skb_expand4;               //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV4Êý¾Ý°ü
+extern  int  skb_expand6;               //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV6Êý¾Ý°ü
+
 
 extern int double_mac; 
 
diff --git a/upstream/linux-5.10/include/net/netfilter/nf_conntrack.h b/upstream/linux-5.10/include/net/netfilter/nf_conntrack.h
index 04ab917..ff7b8ea 100755
--- a/upstream/linux-5.10/include/net/netfilter/nf_conntrack.h
+++ b/upstream/linux-5.10/include/net/netfilter/nf_conntrack.h
@@ -131,6 +131,7 @@
 	struct conn_skbinfo packet_info[IP_CT_DIR_MAX];
 	struct net_device* indev[IP_CT_DIR_MAX];
 	struct net_device* outdev[IP_CT_DIR_MAX];
+	void *fast_entry;
 };
 
 static inline struct nf_conn *
diff --git a/upstream/linux-5.10/init/main.c b/upstream/linux-5.10/init/main.c
index 83d93ea..576e168 100755
--- a/upstream/linux-5.10/init/main.c
+++ b/upstream/linux-5.10/init/main.c
@@ -852,7 +852,7 @@
 }
 
 void __weak early_drv_init(void) {}
-
+void __weak early_debug_info_init(void){}
 asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
 {
 	char *command_line;
@@ -950,7 +950,7 @@
 		initcall_debug_enable();
 
 	context_tracking_init();
-
+	early_debug_info_init();
 	early_drv_init();
 	
 	/* init some links before init_ISA_irqs() */
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
index 40c920d..f3e91e9 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
@@ -620,6 +620,8 @@
 	/* interactive begin */
 	if(ramdump_device_init() < 0)
 		return;
+
+	ramdump_device_write_logbuf();
 	data_trans_max = RAMDUMP_SHARED_MEM_LEN - roundup(sizeof(ramdump_shmem_t), RAMDUMP_SHMEM_ALIGN_SIZE) - RAMDUMP_COMPRESS_OUT_LEN;
 	cap_to_server_msg.cmd = RAMDUMP_PC_INTERACTIVE_REQ;
 	ramdump_oss_data_trans_write((unsigned char*)(&cap_to_server_msg), sizeof(cap_to_server_msg));
@@ -635,8 +637,8 @@
 				ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf;
 				/* data from server to cap */
 				ramdump_file_num = server_to_cap_msg->file_num;
-				ramdump_device_fp.file_num  = ramdump_file_num;
-				ramdump_spinand_fp.file_num = ramdump_file_num;
+				ramdump_device_fp.file_num  += ramdump_file_num;
+				ramdump_spinand_fp.file_num += ramdump_file_num;
 
 				/* data from cap to server */
 				cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ;
@@ -732,7 +734,6 @@
 			}
 			case RAMDUMP_TRANS_SERVER_FILE_TRANS_DONE_RSP:
 			{
-				ramdump_device_write_logbuf();
 				ramdump_device_close();
 				return;
 			}
diff --git a/upstream/linux-5.10/net/8021q/vlan_dev.c b/upstream/linux-5.10/net/8021q/vlan_dev.c
index 86a1c99..6117e9c 100755
--- a/upstream/linux-5.10/net/8021q/vlan_dev.c
+++ b/upstream/linux-5.10/net/8021q/vlan_dev.c
@@ -94,7 +94,7 @@
 	return NETDEV_TX_OK;
 #endif
 }
-
+extern void fast_update_indev(struct sk_buff *skb, struct net_device *dev);
 static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 					    struct net_device *dev)
 {
@@ -120,7 +120,7 @@
 	len = skb->len;
 	if (unlikely(netpoll_tx_running(dev)))
 		return vlan_netpoll_send_skb(vlan, skb);
-
+	fast_update_indev(skb, dev);
 	ret = dev_queue_xmit(skb);
 
 	if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
diff --git a/upstream/linux-5.10/net/bridge/br_fdb.c b/upstream/linux-5.10/net/bridge/br_fdb.c
index 65a6054..974ee5e 100755
--- a/upstream/linux-5.10/net/bridge/br_fdb.c
+++ b/upstream/linux-5.10/net/bridge/br_fdb.c
@@ -1313,7 +1313,7 @@
 	u16 vid = 0;
 	int ntl_port_id = 0xff;
 	
-	if(!skb->dev)
+	if(!skb->dev || fastbr_level != 1)
 	{
 		//print_sun(SUN_DBG, "fast_br  skb->dev err skb->dev = %x\n", skb->dev);
 		return 0;
diff --git a/upstream/linux-5.10/net/core/SI/net_other.c b/upstream/linux-5.10/net/core/SI/net_other.c
index a6748c7..816686b 100755
--- a/upstream/linux-5.10/net/core/SI/net_other.c
+++ b/upstream/linux-5.10/net/core/SI/net_other.c
@@ -1090,7 +1090,8 @@
 int  fast_local4_output_num = 0;    //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
 int  fast_local6_output_num = 0;    //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
 int  fast_tcpdump_num = 0;          //fast×¥°üÊýÁ¿
-
+int  skb_expand4 = 0;               //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV4Êý¾Ý°ü
+int  skb_expand6 = 0;               //Í·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄV6Êý¾Ý°ü
 
 int double_mac = 0; //mac¼ì²é¿ª¹Ø
 //slabÄÚ´æÊ¹ÓÃÏà¹ØÍ³¼Æ£¬Î´¿¼ÂÇͨÓÃslabµØÖ·³Ø£¬Èçkmalloc
diff --git a/upstream/linux-5.10/net/core/fastproc/fast4_fw.c b/upstream/linux-5.10/net/core/fastproc/fast4_fw.c
index 0ef32e4..a0674f9 100755
--- a/upstream/linux-5.10/net/core/fastproc/fast4_fw.c
+++ b/upstream/linux-5.10/net/core/fastproc/fast4_fw.c
@@ -67,6 +67,7 @@
 /* ******************************** º¯ÊýʵÏÖ ********************************/
 int dst_expire_count = 0;
 extern int no_neighbour;
+extern fast_list_t working_list;
 
 static inline int rt_is_expired(struct rtable *rth)
 {
@@ -555,7 +556,11 @@
 	{
 		ret = ifname_compare_aligned(ct->indev[dir]->name, ipinfo->iniface, ipinfo->iniface_mask);
 	}
-	
+	else
+	{
+		ret=1;
+	}
+
 	if(ipinfo->iniface[0] != '\0')
 		*match_filter = 1;
 		
@@ -583,6 +588,8 @@
 ip_packet_match_neg(const struct ipt_ip *ipinfo,struct nf_conn* ct,int dir, int* match_filter)
 {
 	unsigned long ret;
+	if(!(ct->status & IPS_NAT_MASK))
+		return false;
 	if (NF_INVF(ipinfo, IPT_INV_SRCIP,
 		    (ct->tuplehash[dir].tuple.dst.u3.ip & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) ||
 	    NF_INVF(ipinfo, IPT_INV_DSTIP,
@@ -595,7 +602,11 @@
 	{
 		ret = ifname_compare_aligned(ct->outdev[dir]->name, ipinfo->iniface, ipinfo->iniface_mask);
 	}
-	
+	else
+	{
+		ret = 1;
+	}
+
 	if(ipinfo->iniface[0] != '\0')
 		*match_filter = 1;
 		
@@ -675,7 +686,7 @@
 			e = get_entry(table_base, private->hook_entry[NF_INET_LOCAL_IN]);
 			break;
 		default:
-			break;
+			return;
 	}
 	while(num--)
 	{
@@ -747,8 +758,7 @@
 
 static void ct_iptables_bhfunc(unsigned long param)
 {
-	int hash = 0;
-	struct nf_conntrack_tuple_hash *h;
+	fast_entry_t *ret = NULL;
 	struct hlist_nulls_node *n;
 	struct nf_conn *ct;
 	struct xt_table_info *private;
@@ -756,13 +766,12 @@
 	unsigned int addend;
 	local_bh_disable();
 	addend = xt_write_recseq_begin();
-	for(hash = 0; hash < nf_conntrack_htable_size; hash++)
-    {
-	   	hlist_nulls_for_each_entry_rcu(h,n,&nf_conntrack_hash[hash],hnnode)
+	spin_lock_bh(&fast_fw_spinlock);
+	for (ret = (&working_list)->next; ret; ret = ret->next)
+	{
+		if(ret)
 		{
-	   		if(h)
-			{
-	   			ct = nf_ct_tuplehash_to_ctrack(h);
+	   			ct = ret->ct;
 				if(ct->fast_ct.isFast)
 				{
 					net = nf_ct_net(ct);
@@ -777,19 +786,66 @@
 				}
 				else
 					continue;
-				spin_lock_bh(&fast_fw_spinlock);
+
 				ct->packet_info[IP_CT_DIR_ORIGINAL].bytes = 0;
 				ct->packet_info[IP_CT_DIR_ORIGINAL].packets = 0;
 				ct->packet_info[IP_CT_DIR_REPLY].bytes = 0;
 				ct->packet_info[IP_CT_DIR_REPLY].packets = 0;
-				spin_unlock_bh(&fast_fw_spinlock);
-			}
-	   	}
-    }
+		}
+	}
+	spin_unlock_bh(&fast_fw_spinlock);
 	xt_write_recseq_end(addend);
 	local_bh_enable();
 }
 
+#if 0
+/*ÐÂfastÏÂiptablesͬ²½µÄ´úÂ루±£Áô£©*/
+/* Started by AICoder, pid:bc328v3b69u30bb14fea08b4d0be594808c2486b */
+static void ct_iptables_bhfunc(unsigned long param)
+{
+    unsigned int addend;
+    local_bh_disable();
+    addend = xt_write_recseq_begin();
+    spin_lock_bh(&fast_fw_spinlock);
+    for(int hash = 0; hash < nf_conntrack_htable_size; hash++)
+    {
+        struct nf_conntrack_tuple_hash *h;
+        struct hlist_nulls_node *n;
+        for_each_rcu_safe(h, n, &nf_conntrack_hash[hash])
+        {
+            if(h)
+            {
+                struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
+                if(ct->fast_ct.isFast)
+                {
+                    struct net *net = nf_ct_net(ct);
+                    struct xt_table_info *private;
+                    const char *chain_names[] = {
+                        "IPTABLE_RAW",
+                        "IPTABLE_MANGLE",
+                        "IPTABLE_NAT",
+                        "IPTABLE_FILTER"
+                    };
+                    for (int i = 0; i < 4; i++) {
+                        switch (i) {
+                            case 0: private = READ_ONCE(net->ipv4.iptable_raw->private); break;
+                            case 1: private = READ_ONCE(net->ipv4.iptable_mangle->private); break;
+                            case 2: private = READ_ONCE(net->ipv4.nat_table->private); break;
+                            case 3: private = READ_ONCE(net->ipv4.iptable_filter->private); break;
+                        }
+                        ct_iptables_syn_handle(ct, private, chain_names[i]);
+                    }
+                }
+            }
+        }
+    }
+    spin_unlock_bh(&fast_fw_spinlock);
+    xt_write_recseq_end(addend);
+    local_bh_enable();
+}
+/* Ended by AICoder, pid:bc328v3b69u30bb14fea08b4d0be594808c2486b */
+#endif
+
 
 int fast4_fw_init(void)
 {
diff --git a/upstream/linux-5.10/net/core/fastproc/fast6.c b/upstream/linux-5.10/net/core/fastproc/fast6.c
index d5fab9c..5beebba 100755
--- a/upstream/linux-5.10/net/core/fastproc/fast6.c
+++ b/upstream/linux-5.10/net/core/fastproc/fast6.c
@@ -207,7 +207,9 @@
     __u8 next_hdr = 0;
     unsigned char *l4head;
     struct ipv6hdr *ip6;
-    
+	struct sk_buff *skb2 = NULL;
+	int l4_offset = 0;
+	
     print_sun(SUN_DBG, "enter fast_6_recv \n");
 
     if (fastnat_level == FAST_CLOSE)
@@ -286,13 +288,18 @@
         print_sun(SUN_DBG, "fast_6_recv l4head is null \n");
         return 0;
     }
-
-
-
-    if (!(skb = fast_expand_headroom_v6(skb, dev))){
+	l4_offset = l4head - skb->data;
+	
+    if (!(skb2 = fast_expand_headroom_v6(skb, dev))){
 		rcu_read_unlock();
         return 1;
     }
+	
+	if(skb2 != skb){
+		l4head = skb2->data + l4_offset;
+		skb = skb2;
+		skb_expand6++;
+	}
 
     fast_tcpdump(skb);
     
@@ -316,8 +323,30 @@
     skb->isFastnat = 1;
     skb->priority = fast6_entry_data->priority;
     skb->mark = fast6_entry_data->mark;
-
-
+	if (likely(skb_get_nfct(skb) == 0)){
+		skb_set_nfct(skb, (unsigned long)fast6_entry->ct);
+		nf_conntrack_get(&fast6_entry->ct->ct_general);
+	}
+	spin_lock_bh(&fast_fw_spinlock);
+    //»ùÓÚctÁ´½ÓµÄÁ÷Á¿Í³¼Æ --- ͳ¼ÆIP°ü²»ÊÇMAC°ü
+    if (fast6_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_ORIGINAL){
+        fast6_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].packets++;
+        fast6_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].bytes += skb->len;
+		if(unlikely(fast6_entry->ct->indev[IP_CT_DIR_ORIGINAL] == NULL))
+			fast6_entry->ct->indev[IP_CT_DIR_ORIGINAL] = skb->indev;
+		if(unlikely(fast6_entry->ct->outdev[IP_CT_DIR_ORIGINAL] == NULL))
+			fast6_entry->ct->outdev[IP_CT_DIR_ORIGINAL] = dev;
+    } else if (fast6_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_REPLY){
+        fast6_entry->ct->packet_info[IP_CT_DIR_REPLY].packets++;
+        fast6_entry->ct->packet_info[IP_CT_DIR_REPLY].bytes += skb->len;
+		if(unlikely(fast6_entry->ct->indev[IP_CT_DIR_REPLY] == NULL))
+			fast6_entry->ct->indev[IP_CT_DIR_REPLY] = skb->indev;
+		if(unlikely(fast6_entry->ct->outdev[IP_CT_DIR_REPLY] == NULL))
+			fast6_entry->ct->outdev[IP_CT_DIR_REPLY] = dev;
+    } else {
+        printk("fast6 packet error\n");
+    }
+	spin_unlock_bh(&fast_fw_spinlock);
     //ÄÚºË×Ô´øµÄ»ùÓÚÁ´½ÓµÄÁ÷Á¿Í³¼Æ
     struct nf_conn_counter *acct = (struct nf_conn_counter*)nf_conn_acct_find(fast6_entry->ct);
     if (acct) {
@@ -348,7 +377,8 @@
 
     //Ö»Óе±ÓÐMACÍ·Ô¤¸³ÖµÊ±£¬²Å×¼¸³Öµ£¬·ñÔòΪIPÍ·
     skb_push(skb, ETH_HLEN);
-
+	
+    if (fast6_entry_data->hh_flag)
     memcpy(skb->data, fast6_entry_data->hh_data, ETH_HLEN);
     /*¸üÐÂÁ¬½Ó³¬Ê±*/
     if (IPPROTO_TCP == tuple.dst.protonum)
@@ -470,12 +500,12 @@
         return NF_ACCEPT;
     }
 	_neighbour = dst_neigh_lookup_skb(dst, skb);
-	if(!_neighbour)
-	{
-		return NF_ACCEPT;
+	if(_neighbour == NULL && ((ipv6_addr_type(&ipv6_hdr(skb)->daddr)) == IPV6_ADDR_ANY 
+		|| ((ipv6_addr_type(&ipv6_hdr(skb)->daddr)) & IPV6_ADDR_LOOPBACK))){
+        return NF_ACCEPT;
 	}
     
-    if (memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
+    if (_neighbour && memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
     {
         goto accept;
     }
@@ -536,9 +566,10 @@
     fast6_entry_data = &fast6_entry->data[dir];
     fast6_entry_data->tuplehash.tuple = ct->tuplehash[dir].tuple;
 
-    memcpy(fast6_entry_data->dmac, _neighbour->ha, ETH_ALEN);
+    //memcpy(fast6_entry_data->dmac, _neighbour->ha, ETH_ALEN);
     fast6_entry_data->priority = skb->priority;
     fast6_entry_data->mark = skb->mark;
+	if(fast6_entry_data->outdev == NULL){
     fast6_entry_data->outdev = out;
 
     if (!record_MAC_header(working_hash6, ct, fast6_entry, fast6_entry_data, _neighbour, out, htons(ETH_P_IPV6)))
@@ -546,7 +577,7 @@
         spin_unlock_bh(&fast6_spinlock);
         goto accept;
     }
-
+	}
     //´Ë´¦±£Ö¤Õý·´Á½¸ö±ê¼Çλ²»³åÍ»
     fast6_entry->flags = fast6_entry->flags | (1 << dir);
     
@@ -563,7 +594,7 @@
     ct->fast_ct.isFast = FAST_CT_WND6;
 
 accept:
-	
+	if(_neighbour)
 	neigh_release(_neighbour);
     return NF_ACCEPT;
 }
diff --git a/upstream/linux-5.10/net/core/fastproc/fast6_fw.c b/upstream/linux-5.10/net/core/fastproc/fast6_fw.c
index 322175b..ec21bc6 100755
--- a/upstream/linux-5.10/net/core/fastproc/fast6_fw.c
+++ b/upstream/linux-5.10/net/core/fastproc/fast6_fw.c
@@ -40,8 +40,23 @@
 #include <net/SI/net_cache.h>
 #include <net/SI/print_sun.h>
 
+#include <linux/netfilter/xt_tcpudp.h>
+#include <linux/netfilter_ipv6/ip6_tables.h>
+
+
 MODULE_LICENSE("GPL");
 
+static struct task_struct *ct_ip6tables_syn;
+static struct tasklet_struct ct_ip6tables_bh;
+extern unsigned int ct_iptables_syn_sw;
+enum table6_index {
+	IP6TABLE_RAW,
+	IP6TABLE_MANGLE,
+	IP6TABLE_NAT,
+	IP6TABLE_FILTER
+};
+
+
 /* ***************** ipv6 ¿ìËÙת·¢Ïà¹Ø±äÁ¿ ************************* */
 
 
@@ -53,6 +68,7 @@
 
 int dst_expire_count_v6 = 0;
 extern int no_neighbour;
+extern fast_list_t working_list6;
 extern void ntl_ct_set_iw(struct sk_buff *skb, struct nf_conn *ct, int ct_dir);
 int fast6_fw_recv(struct nf_conn *tmpl,
                   struct sk_buff *skb,
@@ -163,7 +179,8 @@
     skb->isFastnat = 1;
     nf_ct_set(skb, (struct nf_conn *)&ct->ct_general, ctinfo);
 
-
+	ct->packet_info[dir].packets++;
+    ct->packet_info[dir].bytes += skb->len;
     //»ùÓÚÍø¿ÚµÄÁ÷Á¿Í³¼Æ  --- ²Î¿¼linuxÔ­ÉúµÄÇý¶¯£¬Í³¼ÆµÄ¶¼ÊÇIP°ü³¤¶È
     if (fastnat_level == FAST_NET_DEVICE)
     {
@@ -203,6 +220,17 @@
         }
         skb->dev = dev;
         skb->now_location |= FASTNAT_SUCC;
+
+		if(ct->indev[dir] == NULL && skb->indev != NULL)
+		{
+			ct->indev[dir] = skb->indev;
+		}
+		
+		if(ct->outdev[dir] == NULL && skb->dev != NULL)
+		{
+			ct->outdev[dir] = skb->dev;
+		}
+
 		skb->vlan_proto = vlan_proto_raw;
 		skb->vlan_tci = vlan_tci_raw;
         __flush_dcache_area(skb->data, skb->len);
@@ -370,6 +398,372 @@
     .priority = NF_IP6_PRI_LAST,
 };
 
+static inline bool
+port_match(u_int16_t min, u_int16_t max, u_int16_t port, bool invert)
+{
+	return (port >= min && port <= max) ^ invert;
+}
+
+static bool ctable_mt(struct nf_conn* ct, struct xt_action_param *par,int dir, int* match_filter)
+{
+	const struct xt_tcp *tcpinfo = par->matchinfo;
+
+	if (!port_match(tcpinfo->spts[0], tcpinfo->spts[1],
+			ntohs(ct->tuplehash[dir].tuple.src.u.tcp.port),
+			!!(tcpinfo->invflags & XT_TCP_INV_SRCPT)))
+		return false;
+	if((tcpinfo->spts[0] || tcpinfo->spts[1]) ^ (!!(tcpinfo->invflags & XT_TCP_INV_SRCPT)))
+		*match_filter = 1;
+	if (!port_match(tcpinfo->dpts[0], tcpinfo->dpts[1],
+			ntohs(ct->tuplehash[dir].tuple.dst.u.tcp.port),
+			!!(tcpinfo->invflags & XT_TCP_INV_DSTPT)))
+		return false;
+	if((tcpinfo->dpts[0] || tcpinfo->dpts[1]) ^ (!!(tcpinfo->invflags & XT_TCP_INV_DSTPT)))
+		*match_filter = 1;
+	return true;
+}
+
+static inline bool
+ip6_packet_match(const struct ip6t_ip6 *ip6info,struct nf_conn* ct,int dir, int* match_filter)
+{
+	unsigned long ret;
+	if (NF_INVF(ip6info, IP6T_INV_SRCIP,
+		    ipv6_masked_addr_cmp((struct in6_addr *)(ct->tuplehash[dir].tuple.src.u3.ip6), &ip6info->smsk,
+					 &ip6info->src)) ||
+	    NF_INVF(ip6info, IP6T_INV_DSTIP,
+		    ipv6_masked_addr_cmp((struct in6_addr *)(ct->tuplehash[dir].tuple.dst.u3.ip6), &ip6info->dmsk,
+					 &ip6info->dst)))
+		return false;
+	if(ip6info->src.in6_u.u6_addr32[0] || ip6info->dst.in6_u.u6_addr32[0])
+	{
+		*match_filter = 1;
+	}
+
+	if(ct->indev[dir] != NULL)
+	{
+		ret = ifname_compare_aligned(ct->indev[dir]->name, ip6info->iniface, ip6info->iniface_mask);
+	}
+	else
+	{
+		ret=1;
+	}
+
+	if(ip6info->iniface[0] != '\0')
+		*match_filter = 1;
+		
+	if (NF_INVF(ip6info, IP6T_INV_VIA_IN, ret != 0))
+		return false;
+	if(ct->outdev[dir] != NULL)
+	{
+		ret = ifname_compare_aligned(ct->outdev[dir]->name, ip6info->outiface, ip6info->outiface_mask);
+	}
+
+	if(ip6info->outiface[0] != '\0')
+		*match_filter = 1;
+
+	if (NF_INVF(ip6info, IP6T_INV_VIA_OUT, ret != 0))
+		return false;
+
+	if (ip6info->flags & IP6T_F_PROTO) {
+		int protohdr;
+
+		protohdr = ct->tuplehash[dir].tuple.dst.protonum;
+
+		if (ip6info->proto == protohdr) {
+			if (ip6info->invflags & IP6T_INV_PROTO)
+				return false;
+
+			return true;
+		}
+
+		/* We need match for the '-p all', too! */
+		if ((ip6info->proto != 0) &&
+			!(ip6info->invflags & IP6T_INV_PROTO))
+			return false;
+	}
+
+	return true;
+}
+
+static inline bool
+ip6_packet_match_neg(const struct ip6t_ip6 *ip6info,struct nf_conn* ct,int dir, int* match_filter)
+{
+	unsigned long ret;
+	if(!(ct->status & IPS_NAT_MASK))
+		return false;
+	if (NF_INVF(ip6info, IP6T_INV_SRCIP,
+		    ipv6_masked_addr_cmp((struct in6_addr *)ct->tuplehash[dir].tuple.src.u3.ip6, &ip6info->smsk,
+					 &ip6info->src)) ||
+	    NF_INVF(ip6info, IP6T_INV_DSTIP,
+		    ipv6_masked_addr_cmp((struct in6_addr *)ct->tuplehash[dir].tuple.dst.u3.ip6, &ip6info->dmsk,
+					 &ip6info->dst)))
+		return false;
+	if(ip6info->src.in6_u.u6_addr32[0] || ip6info->dst.in6_u.u6_addr32[0])
+		*match_filter = 1;
+
+	if(ct->outdev[dir] != NULL)
+	{
+		ret = ifname_compare_aligned(ct->outdev[dir]->name, ip6info->iniface, ip6info->iniface_mask);
+	}
+	else
+	{
+		ret = 1;
+	}
+
+	if(ip6info->iniface[0] != '\0')
+		*match_filter = 1;
+		
+	if (NF_INVF(ip6info, IP6T_INV_VIA_IN, ret != 0))
+		return false;
+	if(ct->indev[dir] != NULL)
+	{
+		ret = ifname_compare_aligned(ct->indev[dir]->name, ip6info->outiface, ip6info->outiface_mask);
+	}
+
+	if(ip6info->outiface[0] != '\0')
+		*match_filter = 1;
+
+	if (NF_INVF(ip6info, IP6T_INV_VIA_OUT, ret != 0))
+		return false;
+
+	if (ip6info->flags & IP6T_F_PROTO) {
+		int protohdr;
+
+		protohdr = ct->tuplehash[dir].tuple.dst.protonum;
+
+		if (ip6info->proto == protohdr) {
+			if (ip6info->invflags & IP6T_INV_PROTO)
+				return false;
+
+			return true;
+		}
+
+		/* We need match for the '-p all', too! */
+		if ((ip6info->proto != 0) &&
+			!(ip6info->invflags & IP6T_INV_PROTO))
+			return false;
+	}
+
+	return true;
+}
+
+static inline struct ip6t_entry *
+get_entry(const void *base, unsigned int offset)
+{
+	return (struct ip6t_entry *)(base + offset);
+}
+
+static inline
+struct ip6t_entry *ip6t_next_entry(const struct ip6t_entry *entry)
+{
+	return (void *)entry + entry->next_offset;
+}
+
+
+
+//ͬ²½ctͳ¼ÆÐÅÏ¢µ½iptables,ͬ²½ÖÜÆÚÔݶ¨1s
+static int ct_ip6tables_syn_thread(void *param)
+{
+	while (1) 
+	{
+		if(ct_iptables_syn_sw)
+		{
+			rcu_read_lock();
+			tasklet_schedule(&ct_ip6tables_bh);
+			rcu_read_unlock();
+			//ÿ´Îͬ²½¼ä¸ôΪ1s.
+		}
+		msleep(1*1000);
+	}
+	return 0;
+}
+
+void ct_ip6tables_syn_handle(struct nf_conn *ct,struct xt_table_info *private,int table_id)
+{
+	void *table_base;
+	struct ip6t_entry *e;
+	const struct xt_entry_match *ematch;
+	struct xt_action_param acpar;
+	struct xt_counters *counter;
+	int match_flag = 0;
+	int match_filter = 0;
+	int num = 0;
+
+
+	table_base = private->entries;
+	num = private->number;
+	switch(table_id)
+	{
+		case 0:
+		case 1:
+		case 2:
+			e = get_entry(table_base, private->hook_entry[NF_INET_PRE_ROUTING]);
+			break;
+		case 3:
+			e = get_entry(table_base, private->hook_entry[NF_INET_LOCAL_IN]);
+			break;
+		default:
+			return;
+	}
+	while(num--)
+	{
+		match_flag = 0;
+		match_filter = 0;
+		if(!ip6_packet_match(&e->ipv6, ct, IP_CT_DIR_ORIGINAL,&match_filter) &&
+			!ip6_packet_match_neg(&e->ipv6, ct, IP_CT_DIR_REPLY,&match_filter))
+		{
+		}
+		else
+		{
+			xt_ematch_foreach(ematch, e) 
+			{
+				acpar.matchinfo = ematch->data;
+				if (!ctable_mt(ct, &acpar, IP_CT_DIR_ORIGINAL,&match_filter))
+				{
+					match_flag = 1;
+					break;
+				}
+				else
+				{
+				}
+			}
+			if(!match_flag)
+			{
+				if(match_filter)
+				{
+					counter = xt_get_this_cpu_counter(&e->counters);
+					ADD_COUNTER(*counter, ct->packet_info[IP_CT_DIR_ORIGINAL].bytes,ct->packet_info[IP_CT_DIR_ORIGINAL].packets);
+				}
+				e = ip6t_next_entry(e);
+				continue;
+			}
+			match_flag = 0;
+			match_filter = 0;
+		}
+		
+		if (!ip6_packet_match(&e->ipv6, ct, IP_CT_DIR_REPLY,&match_filter) &&
+			!ip6_packet_match_neg(&e->ipv6, ct, IP_CT_DIR_ORIGINAL,&match_filter))
+		{
+			e = ip6t_next_entry(e);
+			continue;
+		}
+		else
+		{
+			xt_ematch_foreach(ematch, e) 
+			{
+				acpar.matchinfo = ematch->data;
+				if (!ctable_mt(ct, &acpar, IP_CT_DIR_REPLY,&match_filter))
+				{
+					match_flag = 1;
+					break;
+				}
+			}
+			if(!match_flag)
+			{
+				if(match_filter)
+				{
+					counter = xt_get_this_cpu_counter(&e->counters);
+					ADD_COUNTER(*counter, ct->packet_info[IP_CT_DIR_REPLY].bytes,ct->packet_info[IP_CT_DIR_REPLY].packets);
+				}
+				e = ip6t_next_entry(e);
+				continue;
+			}
+		}
+	}
+
+}
+
+static void ct_ip6tables_bhfunc(unsigned long param)
+{
+	fast_entry_t *ret = NULL;
+	struct hlist_nulls_node *n;
+	struct nf_conn *ct;
+	struct xt_table_info *private;
+	struct net * net;
+	unsigned int addend;
+	local_bh_disable();
+	addend = xt_write_recseq_begin();
+	spin_lock_bh(&fast_fw_spinlock);
+	for (ret = (&working_list6)->next; ret; ret = ret->next)
+	{
+		if(ret)
+		{
+	   			ct = ret->ct;
+				if(ct->fast_ct.isFast)
+				{
+					net = nf_ct_net(ct);
+					private = READ_ONCE(net->ipv6.ip6table_raw->private);
+					ct_ip6tables_syn_handle(ct,private,IP6TABLE_RAW);
+					private = READ_ONCE(net->ipv6.ip6table_mangle->private);
+					ct_ip6tables_syn_handle(ct,private,IP6TABLE_MANGLE);
+					private = READ_ONCE(net->ipv6.ip6table_nat->private);
+					ct_ip6tables_syn_handle(ct,private,IP6TABLE_NAT);
+					private = READ_ONCE(net->ipv6.ip6table_filter->private);	
+					ct_ip6tables_syn_handle(ct,private,IP6TABLE_FILTER);
+				}
+				else
+					continue;
+
+				ct->packet_info[IP_CT_DIR_ORIGINAL].bytes = 0;
+				ct->packet_info[IP_CT_DIR_ORIGINAL].packets = 0;
+				ct->packet_info[IP_CT_DIR_REPLY].bytes = 0;
+				ct->packet_info[IP_CT_DIR_REPLY].packets = 0;
+		}
+	}
+	spin_unlock_bh(&fast_fw_spinlock);
+	xt_write_recseq_end(addend);
+	local_bh_enable();
+}
+
+#if 0
+/*ÐÂfast ip6tablesÁ÷Á¿Í¬²½´úÂë,±£Áô*/
+/* Started by AICoder, pid:b1b62d7ef7md76714807099a103c224334833109 */
+static void ct_ip6tables_bhfunc(unsigned long param)
+{
+    int hash;
+    struct nf_conn *ct;
+    struct xt_table_info *private;
+    struct net *net;
+    unsigned int addend;
+    local_bh_disable();
+    addend = xt_write_recseq_begin();
+    for(hash = 0; hash < nf_conntrack_htable_size; hash++)
+    {
+        struct nf_conntrack_tuple_hash *h;
+        struct hlist_nulls_node *n;
+        hlist_nulls_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnnode)
+        {
+            if(h)
+            {
+                ct = nf_ct_tuplehash_to_ctrack(h);
+                if(ct->fast_ct.isFast)
+                {
+                    net = nf_ct_net(ct);
+                    private = READ_ONCE(net->ipv6.ip6table_raw->private);
+                    ct_ip6tables_syn_handle(ct, private, IP6TABLE_RAW);
+                    private = READ_ONCE(net->ipv6.ip6table_mangle->private);
+                    ct_ip6tables_syn_handle(ct, private, IP6TABLE_MANGLE);
+                    private = READ_ONCE(net->ipv6.ip6table_nat->private);
+                    ct_ip6tables_syn_handle(ct, private, IP6TABLE_NAT);
+                    private = READ_ONCE(net->ipv6.ip6table_filter->private);   
+                    ct_ip6tables_syn_handle(ct, private, IP6TABLE_FILTER);
+                    spin_lock_bh(&fast_fw_spinlock);
+                    for(int i = 0; i < 4; i++)
+                    {
+                        ct->packet_info[i].bytes = 0;
+                        ct->packet_info[i].packets = 0;
+                    }
+                    spin_unlock_bh(&fast_fw_spinlock);
+                }
+            }
+        }
+    }
+    xt_write_recseq_end(addend);
+    local_bh_enable();
+}
+/* Ended by AICoder, pid:b1b62d7ef7md76714807099a103c224334833109 */
+#endif
+
 
 int fast6_fw_init(void)
 {
@@ -383,6 +777,14 @@
     }
     print_sun(SUN_DBG,"init fast6_fw_init done\n");
 
+	ct_ip6tables_bh.func = ct_ip6tables_bhfunc;
+	ct_ip6tables_syn = kthread_create(ct_ip6tables_syn_thread, (void *)0, "ct_ip6tables_syn" );
+    if (!IS_ERR(ct_ip6tables_syn))
+    {
+        printk("ntl_syn_task thread's init is succ");
+        wake_up_process(ct_ip6tables_syn);
+    }
+
     return 0;
 }
 
@@ -390,6 +792,12 @@
 {
     fast_release_all(RELEASE_ALL_DST);
     nf_unregister_net_hook(&init_net, &fast6_fw_hook);
+	if (ct_ip6tables_syn) 
+	{
+    	kthread_stop(ct_ip6tables_syn);
+    	ct_ip6tables_syn = NULL;
+	}
+	tasklet_kill(&ct_ip6tables_bh);
     return 0;
 }
 
diff --git a/upstream/linux-5.10/net/core/fastproc/fast_common.c b/upstream/linux-5.10/net/core/fastproc/fast_common.c
index 69f3761..80ad864 100755
--- a/upstream/linux-5.10/net/core/fastproc/fast_common.c
+++ b/upstream/linux-5.10/net/core/fastproc/fast_common.c
@@ -621,7 +621,7 @@
 
 //²Î¿¼ip6_xmit,À©³äskbÍ·²¿
 struct sk_buff *fast_expand_headroom_v6(struct sk_buff *skb, struct net_device *dev) {
-    unsigned int hh_len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr);
+    unsigned int hh_len = LL_RESERVED_SPACE(dev);//EC616000622279½â¾öv6ÉÏÐÐÊý¾Ý°üÓÉÓÚÍ·¿Õ¼ä²»¹»ÖØÐÂÉêÇëµÄÎÊÌâ + sizeof(struct ipv6hdr);
     struct sk_buff *skb2 = NULL;
     if (unlikely(skb_headroom(skb) < hh_len)) {
         skb2 = skb_realloc_headroom(skb, max(hh_len, NET_SKB_PAD));
@@ -726,6 +726,9 @@
 {
     tcpack_rel(entry);
     //nf_ct_put(entry->ct);
+	spin_lock_bh(&fast_fw_spinlock);
+	entry->ct->fast_entry = NULL;
+	spin_unlock_bh(&fast_fw_spinlock);
     atomic_dec(&(entry->ct->ct_general.use));
     fn_list_del(list_head, entry);
 }
@@ -810,6 +813,7 @@
     netslab_inc(FAST_SLAB);
     memset(ret, 0, sizeof(fast_entry_t));
     ret->ct = ct;
+	ct->fast_entry = ret;
     ret->list_head = list_head;
 
     //ÉèÖö¨Ê±Æ÷
@@ -897,7 +901,7 @@
         goto REL;
 
     //½ö¶ÔÒÔÌ«ÍøÀàÍø¿Ú½øÐÐMACÍ·Ô¤¸³Öµ£¬ÆäËüµÄÈçPPP¡¢PPPoEÕâЩ£¬½ÔÊǿɱäµÄ£¬²»ÄÜÔ¤¸³Öµ£»²Î¼ûalloc_netdevºÍalloc_etherdev½Ó¿Ú
-    if (out->type != ARPHRD_ETHER)
+    if (out->type != ARPHRD_ETHER || neigh == NULL)
         return 1;
 
     //¶ÔÓÚ³ö¿ÚÎªÍøÇÅbrʱ£¬Ö±½Ó»ñÈ¡L2ÍøÂçÉ豸£¬¼´usb0»òwifi0
@@ -906,7 +910,7 @@
         if(out->dev_addr == NULL)
             goto REL;
 
-        if (fastbr_level == 1)
+        if (fastbr_level)
         {
             dst_out = getbrport_bydst(out, neigh->ha);
             if (dst_out == NULL)
@@ -964,6 +968,9 @@
     //»Ö¸´ctµÄ³¬Ê±
     //add_timer(&ct->timeout);
     //nf_ct_put(ct);
+	spin_lock_bh(&fast_fw_spinlock);
+	entry->ct->fast_entry = NULL;
+	spin_unlock_bh(&fast_fw_spinlock);
     atomic_dec(&(ct->ct_general.use));
     del_timer(&entry->timeout);
     fn_list_del(entry->list_head, entry);
@@ -1079,7 +1086,9 @@
         del_timer(&entry->timeout);
 
         workinghash_del_node(entry);
-
+		spin_lock_bh(&fast_fw_spinlock);
+		entry->ct->fast_entry = NULL;
+		spin_unlock_bh(&fast_fw_spinlock);
         //»Ö¸´ctµÄ³¬Ê±
         //add_timer(&entry->ct->timeout);
         fn_list_del(list_head, entry);
@@ -1552,7 +1561,7 @@
         return 1;
     }
     //vlan
-    else if (next_pro == cpu_to_be16(ETH_P_8021Q))
+    else if (next_pro == cpu_to_be16(ETH_P_8021Q) && fastbr_level == 1)
     {
         skb->isvlan = 1;
         skb_pull(skb, VLAN_HLEN);
@@ -1591,7 +1600,7 @@
     //if (((unsigned long)skb->data)%4 != 0)
     //panic("ERR: fast from dev skb->data%4 != 0");
 
-    if (skb->indev == NULL)
+    if (skb->indev == NULL || is_vlan_dev(skb->dev))
         skb->indev = skb->dev;
     //ÐèҪ׼ȷ¶¨Î»µ½IPÍ·£¬ÆÚ¼ä¿ÉÄÜÌø¹ýppp/mac/pppoeµÈ¸÷ÖÖ²ã2Í·²¿
     if (set_skbdata_toip(skb) == 1 && fast_for_ipdata(skb))
@@ -2055,6 +2064,21 @@
     return dst;
 }
 
+void fast_update_indev(struct sk_buff *skb, struct net_device *dev)
+{
+	if(fastbr_level != 1 && skb->isFastnat == 1){
+		enum ip_conntrack_info ctinfo;
+		struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
+		
+		if(ct){
+			if(ct->indev[0] == skb->indev && ct->indev[1] == NULL)
+				ct->indev[1] = dev;
+			if(ct->indev[1] == skb->indev && ct->indev[0] == NULL)
+				ct->indev[0] = dev;
+		}
+	}
+}
+
 /*fast³õʼ»¯*/
 static int __init
 tsp_fast_init(void)
diff --git a/upstream/linux-5.10/net/core/fastproc/fast_track.c b/upstream/linux-5.10/net/core/fastproc/fast_track.c
index 37f3cfc..712ff6d 100755
--- a/upstream/linux-5.10/net/core/fastproc/fast_track.c
+++ b/upstream/linux-5.10/net/core/fastproc/fast_track.c
@@ -234,7 +234,7 @@
     if (copy_from_user(char_fastbr, buffer, 1))

         return -EFAULT;

 

-    if (char_fastbr[0] < '0' || char_fastbr[0] > '1')

+    if (char_fastbr[0] < '0' || char_fastbr[0] > '2')

         return -EINVAL;

 

     fastbr_level = (int)(char_fastbr[0] - '0');

@@ -252,8 +252,8 @@
     {

         if (*pos == 0)

         {

-            seq_printf(seq, "fastnat have %d conn!!!\nskb_num4:%d,fastnat_num:%d\n",

-                       working_list.count, skb_num4, fastnat_num);

+            seq_printf(seq, "fastnat have %d conn!!!\nskb_num4:%d,fastnat_num:%d,expand_head4:%d\n",

+                working_list.count, skb_num4, fastnat_num, skb_expand4);

             seq_printf(seq, "fastbr_sum:%d,fastbr_num:%d\n",

                        skb_num4 + skb_num6 + skb_unknown - fastnat_num - fast6_num, fastbr_num);

 

@@ -399,8 +399,8 @@
                        working_list.count,fastnat_recv_count,fastnat_real_count);

             seq_printf(seq, "send_2_ps_failed:%u, send_2_usb_failed:%u\n", send_2_ps_failed, send_2_usb_failed);

 #endif

-            seq_printf(seq, "fast6 have %d conn!!!\nskb_num6:%d,fast6_num:%d\n",

-                       working_list6.count, skb_num6, fast6_num);

+			seq_printf(seq, "fast6 have %d conn!!!\nskb_num6:%d,fast6_num:%d,expand_head6:%d\n",

+				working_list6.count, skb_num6, fast6_num, skb_expand6);

         }

         return &working_hash6[*pos];

     }

@@ -1160,6 +1160,42 @@
     .proc_write = ct_iptables_syn_set,

 };

 

+/* Started by AICoder, pid:i2747j1887i1a311479909db709e49391b4455c1 */

+static ssize_t dev_unreg_set(struct file *file, const char __user *buffer, size_t count, loff_t *pos)

+{

+    struct net_device *dev = NULL;

+    size_t size;

+    char dev_name[MAX_NET_DEVICE_NAME_LEN + 1] = {0};

+

+    // Ensure that the string is null-terminated

+    if (count == 0 || count > MAX_NET_DEVICE_NAME_LEN + 1)

+        return -EINVAL;

+

+    // Copy the device name from user space and ensure it's null terminated

+	size = min(count - 1, MAX_NET_DEVICE_NAME_LEN);

+    if (copy_from_user(dev_name, buffer, size)) {

+        return -EFAULT;

+    }

+    dev_name[size] = '\0'; // Ensure null-termination

+

+    // Try to get the network device by name

+    dev = dev_get_by_name(&init_net, dev_name);

+    if (dev) {

+        // Put the device reference

+        dev_put(dev);

+        // Unregister the network device

+        unregister_netdev(dev);

+    } else {

+        printk("dev_unreg %s not found\n", dev_name);

+    }

+

+    return count;

+}

+

+static const struct proc_ops dev_unreg_file_ops = {

+    .proc_write = dev_unreg_set,

+};

+/* Ended by AICoder, pid:i2747j1887i1a311479909db709e49391b4455c1 */

 

 //¿ìËÙת·¢procÎļþµÄ³õʼ»¯

 int fast_conntrack_init_proc(void)

@@ -1195,6 +1231,7 @@
     proc_create("dev_reset_stats", 0440, init_net.proc_net, &dev_reset_file_ops);

 

 	proc_create("ct_iptables_syn", 0440, init_net.proc_net, &ct_iptables_syn_file_ops);

+    proc_create("dev_unreg", 0440, init_net.proc_net, &dev_unreg_file_ops);

     return 1;

 }

 

diff --git a/upstream/linux-5.10/net/core/fastproc/fastnat.c b/upstream/linux-5.10/net/core/fastproc/fastnat.c
index 717454c..8d585c0 100755
--- a/upstream/linux-5.10/net/core/fastproc/fastnat.c
+++ b/upstream/linux-5.10/net/core/fastproc/fastnat.c
@@ -209,6 +209,7 @@
     {
         iph = (struct iphdr *)skb2->data;
         skb = skb2;
+		skb_expand4++;
     }
 
     fast_tcpdump(skb);
@@ -275,7 +276,8 @@
 
     skb->priority = nat_entry_data->priority;
     skb->mark = nat_entry_data->mark;
-
+	
+	spin_lock_bh(&fast_fw_spinlock);
     //»ùÓÚctÁ´½ÓµÄÁ÷Á¿Í³¼Æ --- ͳ¼ÆIP°ü²»ÊÇMAC°ü
     if (nat_entry_data->tuplehash.tuple.dst.dir == IP_CT_DIR_ORIGINAL){
         nat_entry->ct->packet_info[IP_CT_DIR_ORIGINAL].packets++;
@@ -294,6 +296,7 @@
     } else {
         printk("fastnat packet error\n");
     }
+	spin_unlock_bh(&fast_fw_spinlock);
 
     //ÄÚºË×Ô´øµÄ»ùÓÚÁ´½ÓµÄÁ÷Á¿Í³¼Æ
     struct nf_conn_counter *acct = (struct nf_conn_counter *)nf_conn_acct_find((const struct nf_conn *)nat_entry->ct);
@@ -450,7 +453,8 @@
     }
 
     //¹ã²¥¡¢×é²¥²»½¨Á´
-    if (ipv4_is_multicast(ip_hdr(skb)->daddr) || ipv4_is_lbcast(ip_hdr(skb)->daddr))
+    if (ipv4_is_multicast(ip_hdr(skb)->daddr) || ipv4_is_lbcast(ip_hdr(skb)->daddr)
+		|| ip_hdr(skb)->daddr == 0 || ip_hdr(skb)->saddr == 0)
     {
         return NF_ACCEPT;
     }
@@ -467,13 +471,10 @@
     }
 
     _neighbour = dst_neigh_lookup_skb(dst, skb);
-    if (!_neighbour)
-    {
-        print_sun(SUN_DBG,"napt_handle() _neighbour = null\n");
+	if(_neighbour == NULL && ((ip_hdr(skb)->daddr & 0xff000000) == 0xff000000 )){
         return NF_ACCEPT;
-    }
-
-    if (memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
+	}
+    if (_neighbour && memcmp(_neighbour->ha, zeromac, ETH_ALEN) == 0)
     {
         if (strncmp(out->name, ppp_name, strlen(ppp_name)) != 0)
         {
@@ -557,9 +558,10 @@
 
     entry_data = &nat_entry->data[dir];
     entry_data->tuplehash.tuple = ct->tuplehash[dir].tuple;
-    memcpy(entry_data->dmac, _neighbour->ha, ETH_ALEN);
+    //memcpy(entry_data->dmac, _neighbour->ha, ETH_ALEN);
     entry_data->priority = skb->priority;
     entry_data->mark = skb->mark;
+	if(entry_data->outdev == NULL){
     entry_data->outdev = out;
 
     /*¼Ç¼MACµØÖ·µ½entry_data->hh_data*/
@@ -568,6 +570,7 @@
         spin_unlock_bh(&fastnat_spinlock);
         goto accept;
     }
+	}
     print_sun(SUN_DBG,"napt_handle() ct->status=0x%x\n", ct->status);
     /*»ñÈ¡natת»»ÐèÒªµÄIPºÍportÐÅÏ¢*/
     if (test_bit(IPS_SRC_NAT_BIT, &ct->status))
@@ -624,6 +627,7 @@
     spin_unlock_bh(&fastnat_spinlock);
 
 accept:
+	if(_neighbour)
     neigh_release(_neighbour);
     return NF_ACCEPT;
 }
diff --git a/upstream/linux-5.10/net/netfilter/nf_conntrack_core.c b/upstream/linux-5.10/net/netfilter/nf_conntrack_core.c
index e92413e..d4ae0b7 100755
--- a/upstream/linux-5.10/net/netfilter/nf_conntrack_core.c
+++ b/upstream/linux-5.10/net/netfilter/nf_conntrack_core.c
@@ -1621,6 +1621,11 @@
     ct->packet_info[IP_CT_DIR_ORIGINAL].bytes   = 0;
     ct->packet_info[IP_CT_DIR_REPLY].packets    = 0;
     ct->packet_info[IP_CT_DIR_REPLY].bytes      = 0;
+	ct->indev[IP_CT_DIR_ORIGINAL] = NULL;
+	ct->outdev[IP_CT_DIR_ORIGINAL] = NULL;
+	ct->indev[IP_CT_DIR_REPLY] = NULL;
+	ct->outdev[IP_CT_DIR_REPLY] = NULL;
+	ct->fast_entry = NULL;
 	for(dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++)
 	{
 		ct->indev[dir] = NULL;
diff --git a/upstream/linux-5.10/sound/soc/codecs/es8311.c b/upstream/linux-5.10/sound/soc/codecs/es8311.c
index fef445f..34410ce 100755
--- a/upstream/linux-5.10/sound/soc/codecs/es8311.c
+++ b/upstream/linux-5.10/sound/soc/codecs/es8311.c
@@ -766,35 +766,38 @@
 		/* set iface */

 		snd_soc_component_write(component, ES8311_SDPOUT_REG0A, iface);

 	}

-/* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes start */
-#ifdef CONFIG_USE_TOP_TDM
+/* yu.dong@20240816[ZXW-277]Disable soft ramp, optimize playback 44.1k noise issue start */
+#if defined(CONFIG_USE_TOP_TDM)
+    snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x1a);
 #else
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x98);
+    snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x98);
+#endif
 	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x1b);
 	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x1b);
-	/*
+
 	if(rate == 8000){
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0xbb);
-		  pr_info("%s rate:%d\n",__FUNCTION__,rate);
-
-		}
-	if(rate == 16000){
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x55);
-			  pr_info("%s rate:%d\n",__FUNCTION__,rate);
-
-		}
-	*/
-	if(rate == 44100){
-
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x90);
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x1d);
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x1d);
-	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x00);
-			  pr_info("%s rate:%d\n",__FUNCTION__,rate);
-
-		}
+#if defined(CONFIG_USE_TOP_TDM)
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x00);
+#else
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0xbb);
 #endif
-/* yu.dong@20240508[ZXW-277]Modified Platform CODEC ES8311 Compatible with I2S and TDM Modes end */
+		pr_info("%s rate:%d\n",__FUNCTION__,rate);
+
+	}
+
+	if(rate == 16000){
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x55);
+        pr_info("%s rate:%d\n",__FUNCTION__,rate);
+	}
+
+	if(rate == 44100){
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x00);
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x10);
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x20);
+        snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x00);
+        pr_info("%s rate:%d\n",__FUNCTION__,rate);
+	}
+/* yu.dong@20240816[ZXW-277]Disable soft ramp, optimize playback 44.1k noise issue end */
 	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG06, 0x18);
 	snd_soc_component_write(component, ES8311_CLK_MANAGER_REG07, 0x06);
 
@@ -893,7 +896,7 @@
 		snd_soc_component_write(component, ES8311_ADC_REG15, 0x40);

 		snd_soc_component_write(component, ES8311_ADC_REG1B, 0x0A);

 		snd_soc_component_write(component, ES8311_ADC_REG1C, 0x6A);

-		snd_soc_component_write(component, ES8311_DAC_REG37, 0x48);

+		snd_soc_component_write(component, ES8311_DAC_REG37, 0x08); //0 – disable soft ramp
 /* yu.dong@20240718[ZXW-277]Optimizing Recording in CODEC 8311 TDM Mode start*/
 #if defined(CONFIG_USE_TOP_TDM)
         snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x9f);
diff --git a/upstream/pub/include/infra/pub_debug_info.h b/upstream/pub/include/infra/pub_debug_info.h
index 10357aa..95a480f 100755
--- a/upstream/pub/include/infra/pub_debug_info.h
+++ b/upstream/pub/include/infra/pub_debug_info.h
@@ -6,62 +6,43 @@
 #define DEBUG_INFO_DEV_PATH "/dev/debug_info"
 
 /* AP²àºÍCAP²àµÄPS\KERNEL\DRIVER\FS\APP  ÒÔSTART~ENDÎªÇø¼ä£¬¸÷²¿·ÖÔ¤ÁôÁË100¸öID */
-#define MODULE_ID_PS_START			(1)
-#define MODULE_ID_PS_NAS			(1)
-#define MODULE_ID_PS_RRC			(2)
-#define MODULE_ID_PS_L2				(3)
-#define MODULE_ID_PS_UICC			(99)
-#define MODULE_ID_PS_END			(100)
 
-#define MODULE_ID_AP_KERNEL_START	(101)
-#define MODULE_ID_AP_KERNEL_END		(200)
+#define MODULE_ID_PS_NAS             ("ps_nas")
+#define MODULE_ID_PS_RRC             ("ps_rrc")
+#define MODULE_ID_PS_L2              ("ps_l2")
+#define MODULE_ID_PS_UICC            ("ps_uicc")
+#define MODULE_ID_AP_USB		     ("ap_usb")
+#define MODULE_ID_AP_REBOOT	         ("ap_reboot")
+#define MODULE_ID_AP_TSC		     ("ap_tsc")
+#define MODULE_ID_AP_PSM		     ("ap_psm")
+#define MODULE_ID_AP_NAND			 ("ap_nand")
+#define MODULE_ID_AP_MMC			 ("ap_mmc")
+#define MODULE_ID_AP_WIFI			 ("ap_wifi")
 
-#define MODULE_ID_CAP_KERNEL_START	(201)
-#define MODULE_ID_CAP_KERNEL_END	(300)
 
-#define MODULE_ID_AP_DRIVES_START	(301)
-#define MODULE_ID_AP_USB			(301)
-#define MODULE_ID_AP_REBOOT			(302)
-#define MODULE_ID_AP_TSC			(303)
-#define MODULE_ID_AP_PSM			(304)
-#define MODULE_ID_AP_NAND			(305)
-#define MODULE_ID_AP_MMC			(306)
-#define MODULE_ID_AP_WIFI			(307)
-#define MODULE_ID_AP_DRIVES_END		(400)
+#define MODULE_ID_CAP_USB			 ("cap_usb")
+#define MODULE_ID_CAP_TSC			 ("cap_tsc")
+#define MODULE_ID_CAP_PSM			 ("cap_psm")
+#define MODULE_ID_CAP_NAND			 ("cap_nand")
+#define MODULE_ID_CAP_SPI			 ("cap_spi")
+#define MODULE_ID_CAP_MMC			 ("cap_mmc")
+#define MODULE_ID_CAP_UART			 ("cap_uart")
+#define MODULE_ID_CAP_PM			 ("cap_pm")
 
-#define MODULE_ID_CAP_DRIVES_START	(401)
-#define MODULE_ID_CAP_USB			(401)
-#define MODULE_ID_CAP_TSC			(402)
-#define MODULE_ID_CAP_PSM			(403)
-#define MODULE_ID_CAP_NAND			(404)
-#define MODULE_ID_CAP_SPI			(405)
-#define MODULE_ID_CAP_MMC			(406)
-#define MODULE_ID_CAP_UART			(407)
-#define MODULE_ID_CAP_DRIVES_END	(500)
 
-#define MODULE_ID_AP_FS_START		(501)
-#define MODULE_ID_AP_JFFS2			(501)
-#define MODULE_ID_AP_FS_END			(600)
+#define MODULE_ID_AP_JFFS2           ("ap_jffs2")
+#define MODULE_ID_AP_FOTA            ("ap_fota")
+#define MODULE_ID_AP_FS_CHECK        ("ap_fs_check")
 
-#define MODULE_ID_CAP_FS_START		(601)
-#define MODULE_ID_CAP_FS_END		(700)
-
-#define MODULE_ID_AP_APP_START		(701)
-#define MODULE_ID_AP_FOTA			(701)
-#define MODULE_ID_AP_FS_CHECK		(702)
-#define MODULE_ID_AP_APP_END		(800)
-
-#define MODULE_ID_CAP_APP_START		(801)
-#define MODULE_ID_CAP_FOTA			(801)
-#define MODULE_ID_CAP_FS_CHECK		(802)
-#define MODULE_ID_CAP_APP_END		(900)
-
-#if defined(_USE_ZXIC_DEBUG_INFO) && !defined(CONFIG_SYSTEM_RECOVERY)
-int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args);
-int sc_debug_info_record(unsigned int id, const char *format, ...);
+#define MODULE_ID_CAP_FOTA			 ("cap_fota")
+#define MODULE_ID_CAP_FS_CHECK		 ("cap_fs_check")
+ 
+#if defined(_USE_ZXIC_DEBUG_INFO)
+int sc_debug_info_vrecord(char *id, const char *format, va_list args);
+int sc_debug_info_record(char *id, const char *format, ...);
 #else
-static inline int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args) { return 0; }
-static inline int sc_debug_info_record(unsigned int id, const char *format, ...) { return 0; }
+static inline int sc_debug_info_vrecord(char *id, const char *format, va_list args) { return 0; }
+static inline int sc_debug_info_record(char *id, const char *format, ...) { return 0; }
 #endif
 
 #endif
\ No newline at end of file
diff --git a/upstream/pub/include/ps_phy/atipsevent.h b/upstream/pub/include/ps_phy/atipsevent.h
index 2bd5386..92e71e6 100755
--- a/upstream/pub/include/ps_phy/atipsevent.h
+++ b/upstream/pub/include/ps_phy/atipsevent.h
@@ -421,6 +421,7 @@
 #define AP_MMIA_ZCOPS_TEST_CNF_EV                (DWORD)(AP_MMIA_MM_RSP_EVENT + 25)

 #define AP_MMIA_TIMEZONE_IND_EV                  (DWORD)(AP_MMIA_MM_RSP_EVENT + 26)

 #define AP_MMIA_ZULRTIND_IND_EV                  (DWORD)(AP_MMIA_MM_RSP_EVENT + 27)

+#define AP_MMIA_ZPSABNORMAL_IND_EV               (DWORD)(AP_MMIA_MM_RSP_EVENT + 28)

 /* ========================================================================

    AP-MMIA CCÏà¹Ø²¿·ÖÏûÏ¢ºÅ

 ======================================================================== */

diff --git a/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h b/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h
index 66c6f6d..95c3158 100755
--- a/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h
+++ b/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h
@@ -214,8 +214,10 @@
 	UINT8			isUseTxDtmfDet;     

     UINT8			isUseRxMixData;

 	UINT8			isUseTxMixData;//12

-	UINT8			isUseEcall;

-    UINT8           reserved[19];//32-13

+	UINT8			isUseEcall; //13

+	UINT8 			isUseVoiceBuffer; //14  0 not use,1 use

+	UINT8 			selVoiceBufferType; //15 0 single core, 1 dual core	

+    UINT8           reserved[17];//32-15

 	

 }  T_Audio_NvFlag;

 

diff --git a/upstream/pub/project/zx297520v3/include/infra/ram_base_config_7520v3.h b/upstream/pub/project/zx297520v3/include/infra/ram_base_config_7520v3.h
index 6a1626d..edb3bfb 100755
--- a/upstream/pub/project/zx297520v3/include/infra/ram_base_config_7520v3.h
+++ b/upstream/pub/project/zx297520v3/include/infra/ram_base_config_7520v3.h
@@ -163,7 +163,7 @@
 #define DDR_BASE_OFF_CAP                (DDR_BASE_OFF_CAP_BUF + DDR_BASE_LEN_CAP_BUF)

 

 /* capºËµÄdtbµØÖ·¹©ubootºËcap kernelʹÓà */

-#define DDR_BASE_CAP_DTB_ADDR           (DDR_BASE_ADDR_CAP_BUF + (0x00100000UL>>CPU_SHIFT))

+#define DDR_BASE_CAP_DTB_ADDR           (DDR_BASE_ADDR_CAP_BUF + (0x00194000UL>>CPU_SHIFT))

 #else

 /* 42.75M£¬AP¹²ºË°æ±¾(´Ë´óСÊǰ´ÕÕº¬CAPºËµÄ64MÄÚ´æÅäÖö¨Ò壬¸Ãºê±ð´¦²»»á±»Ê¹ÓÃ) */

 #define DDR_BASE_ADDR_AP                (DDR_BASE_ADDR_RAMDUMP + DDR_BASE_LEN_RAMDUMP)

@@ -253,6 +253,13 @@
 #define TEE_SHARE_BUF_ADDR              (RAMDUMP_AP_TO_CAP_BUF_ADDR + RAMDUMP_AP_TO_CAP_BUF_LEN)

 #define TEE_SHARE_BUF_LEN               ((384 * 1024UL)>>CPU_SHIFT)

 

+/* psά²â¿Õ¼ä(Êý¾Ý + ¿ØÖÆ)¸´ÓÃAP_TO_CAPµÄramdump´æ´¢¿Õ¼ä */

+#define PS_DEBUG_INFO_LEN_ADDR          (RAMDUMP_AP_TO_CAP_BUF_ADDR + ((4 * 1024UL)>>CPU_SHIFT))

+#define PS_DEBUG_INFO_LEN_SIZE          ((4 * 1024UL)>>CPU_SHIFT)

+

+#define PS_DEBUG_INFO_ADDR              (PS_DEBUG_INFO_LEN_ADDR + PS_DEBUG_INFO_LEN_SIZE)

+#define PS_DEBUG_INFO_SIZE              ((64 * 1024UL)>>CPU_SHIFT)

+

 #define ICP_CAP_BUF_ADDR_PA             DDR_BASE_CAPBUF_ADDR_PA

 #define TOOL_CAP_BUF_ADDR_PA            (ICP_CAP_BUF_ADDR_PA + ICP_CAP_BUF_LEN)

 #define RINGBUF_CAP_TO_AP_ADDR_PA       (TOOL_CAP_BUF_ADDR_PA + TOOL_CAP_BUF_LEN)

@@ -262,6 +269,9 @@
 #define TOOL_ZSP_TO_CAP_LOG_ADDR_PA     (RINGBUF_AP_TO_CAP_ADDR_PA + RINGBUF_AP_TO_CAP_LEN)

 #define RAMDUMP_AP_TO_CAP_BUF_ADDR_PA   (TOOL_ZSP_TO_CAP_LOG_ADDR_PA + TOOL_ZSP_TO_CAP_LOG_LEN)

 #define TEE_SHARE_BUF_ADDR_PA           (RAMDUMP_AP_TO_CAP_BUF_ADDR_PA + RAMDUMP_AP_TO_CAP_BUF_LEN)

+

+#define PS_DEBUG_INFO_LEN_ADDR_PA       (RAMDUMP_AP_TO_CAP_BUF_ADDR_PA + ((4 * 1024UL)>>CPU_SHIFT))

+#define PS_DEBUG_INFO_ADDR_PA           (PS_DEBUG_INFO_LEN_ADDR_PA + PS_DEBUG_INFO_LEN_SIZE)

 #endif

 

 /* 7520V3оƬIRAM0ѹËõ£¬Ð­ÒéÕ»ÎïÀí²ã½»»¥¿Õ¼äÒÆ¶¯µ½DDR£¬¸´ÓÃRamdump¿Õ¼ä */

diff --git a/upstream/tools/SignTool/SignImage b/upstream/tools/SignTool/SignImage
index 552a4de..0b03078 100755
--- a/upstream/tools/SignTool/SignImage
+++ b/upstream/tools/SignTool/SignImage
Binary files differ
diff --git a/upstream/tools/SignTool/SignImage.exe b/upstream/tools/SignTool/SignImage.exe
index 6905638..7a58d11 100755
--- a/upstream/tools/SignTool/SignImage.exe
+++ b/upstream/tools/SignTool/SignImage.exe
Binary files differ
diff --git a/upstream/tools/SignTool/private.k b/upstream/tools/SignTool/private.k
new file mode 100755
index 0000000..9b72371
--- /dev/null
+++ b/upstream/tools/SignTool/private.k
Binary files differ