[Feature][ZXW-41] merged 0601 version
Change-Id: I667af6bb09d65581d455b73f8984c160b2c67ad8
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/Makefile b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/Makefile
index 745b37c..e9d2669 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/Makefile
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/Makefile
@@ -26,6 +26,11 @@
ifeq ($(USE_BTRUNK_SUPPORT),yes)
obj-y += hal_xp2xp.o
+else
+ifeq ($(USE_VEHICLE_DC),yes)
+obj-y += hal_xp2xp.o
+endif
+
endif
ifeq ($(CONFIG_ARCH_ZX297520V3),y)
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/hal_xp2xp.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/hal_xp2xp.c
index 09e219a..d526f1e 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/hal_xp2xp.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/hal_xp2xp.c
@@ -27,6 +27,7 @@
#include <linux/types.h>
#include <linux/suspend.h>
#include <linux/tick.h>
+#include <linux/slab.h>
#include <mach/irqs.h>
#include <mach/gpio.h>
@@ -37,6 +38,8 @@
#include <linux/wakelock.h>
#include <linux/soc/zte/pm/drv_idle.h>
+#include <linux/sysfs.h>
+#include <linux/kobject.h>
/****************************************************************************
* Local Macros
****************************************************************************/
@@ -76,8 +79,7 @@
#define xp2xp_debug(fmt, args...)
#endif
-
-
+#define XP2XP_STATE "xp2xp_state"
/****************************************************************************
* Local Types
****************************************************************************/
@@ -88,6 +90,17 @@
unsigned int func_int;
};
+typedef enum{
+ SLEEP_NOTIFY,
+ WAKEUP_NOTIFY
+} notify_type;
+
+typedef enum{
+ SET_EDGE_RISING,
+ SET_EDGE_FALLING
+} interrupt_type;
+
+
#define GPIO_CONFIG(gpio_num, func_gpio , func_int) {gpio_num, func_gpio, func_int}
static struct zx29_pin_table pin_table[] =
@@ -230,17 +243,6 @@
GPIO_CONFIG(ZX29_GPIO_135, GPIO135_GPIO135 , 0),
};
-/****************************************************************************
-* Local Constants
-****************************************************************************/
-
-/****************************************************************************
-* Local Function Prototypes
-****************************************************************************/
-
-/****************************************************************************
-* Global Constants
-****************************************************************************/
/****************************************************************************
* Global Variables
@@ -251,17 +253,161 @@
static int irq_num = 0;
static int nWakeupCount=0;
+static int currState = 1;
+
/****************************************************************************
-* Function Definitions
+* Local Constants
****************************************************************************/
-#if 1
+
+struct kset *kset_xp2xp;
+//struct kset kset_c;
+struct kobject *xp2xpkobj = NULL;
+
+
+static struct attribute xp2xp_state_attr =
+{
+ .name = "xp2xp_state",
+ //.mode = S_IRUGO|S_IWUSR,
+ .mode = S_IRUGO,
+};
+
+
+static struct attribute *xp2xp_status_attrs[] =
+{
+ &xp2xp_state_attr,
+ NULL,
+};
+
+ssize_t xp2xp_obj_show(struct kobject *kobject,struct attribute *attr,char *buf)
+{
+
+ if(!strcmp(attr->name, XP2XP_STATE)){
+ sprintf(buf, "nWakeupCount:%d, currState:%s\n",nWakeupCount, (currState == 1 ? "work" : "sleep"));
+ }
+ return strlen(buf);
+}
+
+
+ssize_t xp2xp_obj_store(struct kobject *kobject,struct attribute *attr, const char *buf,size_t size)
+{
+ unsigned int value = 0;
+
+ return size;
+}
+static struct sysfs_ops xp2xp_obj_sysops =
+{
+ .show = xp2xp_obj_show,
+ .store = xp2xp_obj_store,
+};
+
+
+void xp2xp_obj_release(struct kobject *kobject)
+{
+ printk("[kobj_test: release!]\n");
+}
+static struct kobj_type xp2xp_ktype =
+
+{ .release = xp2xp_obj_release,
+ .sysfs_ops = &xp2xp_obj_sysops,
+ .default_attrs = xp2xp_status_attrs,
+};
+
+static int xp2xp_kset_filter(struct kset *kset,struct kobject *kobj)
+{
+ printk("Filter: kobj %s.\n",kobj->name);
+ return 1;
+}
+
+static const char *xp2xp_kset_name(struct kset *kset,struct kobject *kobj)
+{
+ static char buf[20];
+
+ printk("Name kobj %s.\n",kobj->name);
+ sprintf(buf,"%s","xp2xp");
+
+ return buf;
+}
+
+static int xp2xp_kset_uevent(struct kset *kset,struct kobject *kobj, struct kobj_uevent_env *env)
+{
+ int i = 0;
+ printk("uevent: kobj %s.\n",kobj->name);
+
+ while(i < env->envp_idx)
+ {
+ printk("%s.\n",env->envp[i]);
+ i ++;
+ }
+
+ return 0;
+}
+
+
+static struct kset_uevent_ops xp2xp_uevent_ops =
+{
+ .filter = xp2xp_kset_filter,
+ .name = xp2xp_kset_name,
+ .uevent = xp2xp_kset_uevent,
+};
+
+
+/****************************************************************************
+* Local Function Prototypes
+****************************************************************************/
+
+static ATOMIC_NOTIFIER_HEAD(wakeup_notifier);
+int xp2xp_Wakeup_notifier_register(struct notifier_block *nb);
+int xp2xp_Wakeup_notifier_unregister(struct notifier_block *nb);
+
static irqreturn_t xp2xp_Ap2CpWakeCpHisr(int irq, void *id);
bool xp2xp_Ap2CpIsApWakeup(void);
int xp2xp_Cp2ApWakeApSignal(void);
int xp2xp_Cp2ApCpSleepStats(bool isCpWake);
int zDrvXp2xp_Cp2ApWakeupAp(void);
int zDrvXp2xp_Initiate(void);
-#endif
+
+/****************************************************************************
+* Global Constants
+****************************************************************************/
+
+/****************************************************************************
+* Function Definitions
+****************************************************************************/
+
+
+
+int xp2xp_Wakeup_notifier_register(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_register(&wakeup_notifier, nb);
+}
+EXPORT_SYMBOL_GPL(xp2xp_Wakeup_notifier_register);
+
+int xp2xp_Wakeup_notifier_unregister(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_unregister(&wakeup_notifier, nb);
+}
+EXPORT_SYMBOL_GPL(xp2xp_Wakeup_notifier_unregister);
+
+
+
+/*******************************************************************************
+* Function: xp2xp_wakeup_notifier_call_chain.
+* Description: xp2xp_wakeup_notifier_call_chain.
+* Parameters:
+* Input:wake_or_sleep:means wakeup or sleep notify to other device
+*
+* Output:call_result:means devices been called return result
+*
+* Returns:
+*
+* Others:the callback shall not block or sleep
+********************************************************************************/
+int xp2xp_wakeup_notifier_call_chain(unsigned long wake_or_sleep, void *call_result)
+{
+// printk("xp2xp_wakeup_notifier_call_chain,val=%ld\n", val);
+ return atomic_notifier_call_chain(&wakeup_notifier, wake_or_sleep, call_result);
+}
+EXPORT_SYMBOL_GPL(xp2xp_wakeup_notifier_call_chain);
/*******************************************************************************
@@ -320,6 +466,36 @@
return -1;
}
+void xp2xp_change_irq_setting(interrupt_type set_type)
+{
+ irq_num = gpio_to_irq(AP2CP_WAKE_GPIO);
+
+ if(set_type == SET_EDGE_RISING){//waiting wakeup int
+ zx29_gpio_set_inttype(AP2CP_WAKE_GPIO, IRQ_TYPE_EDGE_RISING);
+
+ } else{
+ //enter waiting sleep int
+ zx29_gpio_set_inttype(AP2CP_WAKE_GPIO, IRQ_TYPE_EDGE_FALLING);
+ }
+ pcu_clr_irq_pending(irq_num);
+
+}
+
+
+
+void xp2xp_notify_up(notify_type isWakeup)
+{
+ unsigned char buf[100];
+ int rtv = -1;
+ enum kobject_action action =KOBJ_MAX;
+ char*envp_ext[] = {NULL,NULL};
+ strcpy(buf,"USBEVENT=xp2xp_notify");
+ action = ((isWakeup == WAKEUP_NOTIFY)? KOBJ_ONLINE : KOBJ_OFFLINE);
+ envp_ext[0] = buf;
+ rtv = kobject_uevent_env(xp2xpkobj, action,envp_ext);
+ printk("xp2xp_notify_up isWakeup:%d, result:%d\n", isWakeup, rtv);
+}
+
/*******************************************************************************
* Function: xp2xp_Ap2CpWakeCpHisr
* Description: ap2cp wake up int isr
@@ -334,10 +510,49 @@
********************************************************************************/
static irqreturn_t xp2xp_Ap2CpWakeCpHisr(int irq, void *id)
{
-
+ int call_state = 0;
+ int v_gpio = 0;
pcu_clr_irq_pending(irq_num);
nWakeupCount++;
-
+ //change pinmux to gpio
+ zx29_gpio_config(AP2CP_WAKE_GPIO,func_gpio_value_get(AP2CP_WAKE_GPIO));
+ //gpio_direction_input(USB_GPIO);
+ //msleep(5);
+ v_gpio = gpio_get_value(AP2CP_WAKE_GPIO);
+ printk("%s,value:%d\n", __func__,v_gpio);
+ zx29_gpio_config(AP2CP_WAKE_GPIO,func_int_value_get(AP2CP_WAKE_GPIO));
+
+
+#if 1
+ if(v_gpio){//now is wakeup
+ zx_cpuidle_set_busy(IDLE_FLAG_XP2XP);
+ wake_lock(&xp2xp_wake_lock);
+ //tell application
+ xp2xp_notify_up(WAKEUP_NOTIFY);
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ xp2xp_wakeup_notifier_call_chain(WAKEUP_NOTIFY, &call_state);
+ if(call_state == 0){//check device wakeup result
+ xp2xp_Cp2ApCpSleepStats(TRUE);
+ }
+#endif
+ currState = 1;//means working
+ xp2xp_change_irq_setting(SET_EDGE_FALLING);
+ } else{//this is sleep
+ xp2xp_change_irq_setting(SET_EDGE_RISING);
+ xp2xp_Cp2ApCpSleepStats(FALSE);
+ xp2xp_notify_up(SLEEP_NOTIFY);
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ xp2xp_wakeup_notifier_call_chain(SLEEP_NOTIFY, &call_state);
+ if(call_state){//check device sleep result
+ //to do
+ }
+#endif
+ currState = 0;//means sleep
+
+ wake_unlock(&xp2xp_wake_lock);
+ zx_cpuidle_set_free(IDLE_FLAG_XP2XP);
+ }
+ #else
xp2xp_Cp2ApCpSleepStats(TRUE);
zx_cpuidle_set_busy(IDLE_FLAG_XP2XP);
wake_lock(&xp2xp_wake_lock);
@@ -345,7 +560,7 @@
xp2xp_Cp2ApCpSleepStats(FALSE);
wake_unlock(&xp2xp_wake_lock);
zx_cpuidle_set_free(IDLE_FLAG_XP2XP);
-
+#endif
return IRQ_HANDLED;
}
/*******************************************************************************
@@ -372,6 +587,7 @@
return FALSE;
}
+EXPORT_SYMBOL_GPL(xp2xp_Ap2CpIsApWakeup);
/*******************************************************************************
* Function:
@@ -507,6 +723,66 @@
return -1;
}
+
+/*******************************************************************************
+* Function:
+* Description:
+* Parameters:
+* Input:
+*
+* Output:
+*
+* Returns:
+*
+* Others: 4 line sleep enable check
+********************************************************************************/
+int xp2xp_enable_4line(void)
+{
+ #ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ return 1;
+ #endif
+ return 0;
+}
+EXPORT_SYMBOL_GPL(xp2xp_enable_4line);
+
+int kset_xp2xp_init(void)
+{
+ int ret = 0;
+
+ printk("kset test init!\n");
+
+ /* ´´½¨²¢×¢²á kset_p */
+ kset_xp2xp = kset_create_and_add("xp2xp", &xp2xp_uevent_ops, NULL);
+
+
+ /* ¶ÔÓÚ½Ïа汾µÄÄںˣ¬ÔÚ×¢²á kset ֮ǰ£¬ÐèÒª
+ * Ìî³ä kset.kobj µÄ ktype ³ÉÔ±£¬·ñÔò×¢²á²»»á³É¹¦ */
+ // kset_c.kobj.ktype = &ktype;
+ //ret = kset_register(&kset_c);
+
+ // if(ret)
+ // kset_unregister(kset_p);
+ xp2xpkobj = kzalloc(sizeof(*xp2xpkobj),GFP_KERNEL);
+ if(!xp2xpkobj){
+ printk(KERN_WARNING "mallock xp2xpkobj failed \n");
+ return 0;
+ }
+ kobject_init(xp2xpkobj, &xp2xp_ktype);
+ kobject_add(xp2xpkobj,&kset_xp2xp->kobj,"%s","xp2xp_notify");
+ xp2xpkobj->kset = kset_xp2xp;
+
+
+ return ret;
+}
+
+
+void kset_xp2xp_exit(void)
+{
+ printk("kset_xp2xp_exit exit!\n");
+
+ kset_unregister(kset_xp2xp);
+}
+
/*******************************************************************************
* Function: zDrvAp2cp_Initiate
* Description:
@@ -523,20 +799,27 @@
{
int ret=0;
int errCode = -1;
-
+ printk("------------zDrvXp2xp_Initiate, enter\n");
ret=gpio_request(AP2CP_WAKE_GPIO,"ap2cp_wake");
if(ret)
BUG();
- ret=gpio_request(AP2CP_SLEEP_GPIO,"ap2cp_sleep");
- if(ret)
- BUG();
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+//app need requst these gpio,so using macro
ret=gpio_request(CP2AP_WAKE_GPIO,"cp2ap_wake");
if(ret)
BUG();
ret=gpio_request(CP2AP_SLEEP_GPIO,"cp2ap_sleep");
if(ret)
BUG();
-
+ ret=gpio_request(AP2CP_SLEEP_GPIO,"ap2cp_sleep");
+ if(ret)
+ BUG();
+#endif
+
+ /*ap2cp wake interrupt, input*/
+ zx29_gpio_config(AP2CP_WAKE_GPIO, func_int_value_get(AP2CP_WAKE_GPIO));
+
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
/*cp2ap wake gpio, output*/
zx29_gpio_config(CP2AP_WAKE_GPIO, func_gpio_value_get(CP2AP_WAKE_GPIO));
gpio_direction_output(CP2AP_WAKE_GPIO, CP_WAKE_AP_INT_CLEAR);//keep level
@@ -545,16 +828,14 @@
zx29_gpio_config(CP2AP_SLEEP_GPIO, func_gpio_value_get(CP2AP_SLEEP_GPIO));
gpio_direction_output(CP2AP_SLEEP_GPIO, CP_SLEEP_STATUS);
- /*ap2cp wake interrupt, input*/
- zx29_gpio_config(AP2CP_WAKE_GPIO, func_int_value_get(AP2CP_WAKE_GPIO));
-
/*ap2cp sleep status, input*/
zx29_gpio_config(AP2CP_SLEEP_GPIO, func_gpio_value_get(AP2CP_SLEEP_GPIO));
gpio_direction_input(AP2CP_SLEEP_GPIO);
-
+#endif
wake_lock_init(&xp2xp_wake_lock, WAKE_LOCK_SUSPEND, "xp2xp");
irq_num = gpio_to_irq(AP2CP_WAKE_GPIO);
+ printk("------------zDrvXp2xp_Initiate, irq_num:%d\n", irq_num);
zx29_gpio_set_inttype(AP2CP_WAKE_GPIO, IRQ_TYPE_EDGE_RISING);
pcu_clr_irq_pending(irq_num);
@@ -566,15 +847,27 @@
}
irq_set_irq_wake(irq_num, 1);
-
+ kset_xp2xp_init();
xp2xp_init_flag = 1;
xp2xp_debug("XP2XP: init ok!\n");
return 0;
}
+int zDrvXp2xp_Release(void)
+{
+ kset_xp2xp_exit();
+ gpio_free(AP2CP_WAKE_GPIO);
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ gpio_free(AP2CP_SLEEP_GPIO);
+ gpio_free(CP2AP_WAKE_GPIO);
+ gpio_free(CP2AP_SLEEP_GPIO);
+#endif
+ return 0;
+}
late_initcall(zDrvXp2xp_Initiate);
+module_exit(zDrvXp2xp_Release);
#endif
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cap-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cap-devices.c
index d432979..67ee0df 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cap-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cap-devices.c
@@ -1185,8 +1185,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1197,7 +1206,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cpe-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cpe-devices.c
index 04554ed..06536b9 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cpe-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-cpe-devices.c
@@ -1468,8 +1468,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1480,7 +1489,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-evb-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-evb-devices.c
index b41f79c..d97b1e8 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-evb-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-evb-devices.c
@@ -1176,8 +1176,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1188,7 +1197,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fpga-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fpga-devices.c
index e1d748a..c9c2ffd 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fpga-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fpga-devices.c
@@ -1174,8 +1174,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1186,7 +1195,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fwp-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fwp-devices.c
index 92fa73a..fa0e5c3 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fwp-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-fwp-devices.c
@@ -1249,8 +1249,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1262,6 +1271,14 @@
120,121,122,123,124,125},
{
+1732,1729,1725,1722,1719,
+1715,1711,1707,1703,1699,1694,1689,1683,1678,1672,
+1665,1658,1651,1644,1636,1628,1619,1611,1602,1593,
+1583,1573,1563,1553,1542,1531,1519,1507,1495,1483,
+1470,1457,1444,1431,1417,1403,1388,1374,1359,1343,
+1328,1312,1297,1280,1264,1248,1231,1214,1197,1180,
+1163,1145,1128,1111,1093,1075,1058,1040,1022,1005,
+987,970,952,935,917,900,883,866,849,832,
815,799,782,766,750,734,719,703,688,673,
659,644,630,615,602,588,574,561,548,535,
523,511,498,487,476,465,454,443,432,422,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
index 8729990..7134e18 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mdl-devices.c
@@ -1328,8 +1328,17 @@
#ifdef CONFIG_TSC_ZX29
#ifdef RFC_DCXO_EN
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1341,6 +1350,14 @@
120,121,122,123,124,125},
{
+7598,7592,7586,7579,7572,
+7564,7556,7547,7537,7527,7516,7505,7493,7480,7466,
+7451,7436,7420,7402,7384,7365,7344,7323,7300,7277,
+7252,7225,7198,7169,7139,7107,7074,7040,7004,6967,
+6928,6888,6846,6803,6758,6712,6664,6615,6564,6512,
+6458,6403,6347,6290,6231,6171,6110,6048,5984,5920,
+5855,5790,5723,5656,5588,5520,5452,5383,5314,5245,
+5176,5107,5038,4969,4901,4833,4765,4698,4632,4566,
4501,4438,4376,4313,4251,4188,4131,4073,4016,3958,
3901,3849,3797,3745,3693,3641,3595,3549,3502,3456,
3410,3370,3330,3289,3249,3209,3174,3139,3104,3069,
@@ -1353,8 +1370,17 @@
2173,2169,2164,2160,2155,2151 }
};
#else
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1366,6 +1392,14 @@
120,121,122,123,124,125},
{
+5812,5807,5801,5796,5790,
+5785,5778,5770,5763,5755,5748,5739,5729,5720,5710,
+5701,5688,5675,5663,5650,5637,5621,5604,5588,5571,
+5555,5534,5513,5492,5471,5450,5425,5400,5374,5349,
+5324,5295,5266,5236,5207,5178,5143,5109,5074,5040,
+5005,4967,4930,4892,4855,4817,4776,4735,4694,4653,
+4612,4569,4526,4484,4441,4398,4354,4310,4266,4222,
+4178,4129,4080,4030,3981,3932,3886,3839,3793,3746,
3700,3656,3613,3569,3526,3482,3441,3401,3360,3320,
3279,3241,3204,3166,3129,3091,3056,3021,2987,2952,
2917,2885,2853,2822,2790,2758,2727,2696,2664,2633,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mifi-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mifi-devices.c
index b409344..d0a102b 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mifi-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-mifi-devices.c
@@ -1263,8 +1263,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1276,6 +1285,14 @@
120,121,122,123,124,125},
{
+ 1796,1795,1794,1793,1792,
+ 1791,1790,1789,1788,1787,1786,1785,1784,1783,1782,
+ 1781,1779,1778,1777,1775,1773,1772,1770,1768,1766,
+ 1764,1762,1760,1757,1755,1752,1749,1747,1744,1740,
+ 1737,1733,1730,1726,1722,1718,1713,1709,1704,1699,
+ 1694,1689,1683,1677,1671,1665,1658,1652,1645,1637,
+ 1630,1622,1614,1606,1597,1588,1579,1570,1560,1550,
+ 1540,1529,1518,1507,1496,1484,1472,1460,1448,1435,
1422,1408,1395,1381,1367,1353,1338,1323,1308,1293,
1278,1262,1247,1231,1215,1199,1183,1166,1149,1133,
1116,1100,1083,1066,1049,1032,1015,998,981,965,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-phone-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-phone-devices.c
index 2e5d5bf..ef7f2bd 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-phone-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-phone-devices.c
@@ -1261,8 +1261,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1274,6 +1283,14 @@
120,121,122,123,124,125},
{
+1732,1729,1725,1722,1719,
+1715,1711,1707,1703,1699,1694,1689,1683,1678,1672,
+1665,1658,1651,1644,1636,1628,1619,1611,1602,1593,
+1583,1573,1563,1553,1542,1531,1519,1507,1495,1483,
+1470,1457,1444,1431,1417,1403,1388,1374,1359,1343,
+1328,1312,1297,1280,1264,1248,1231,1214,1197,1180,
+1163,1145,1128,1111,1093,1075,1058,1040,1022,1005,
+987,970,952,935,917,900,883,866,849,832,
815,799,782,766,750,734,719,703,688,673,
659,644,630,615,602,588,574,561,548,535,
523,511,498,487,476,465,454,443,432,422,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-poc-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-poc-devices.c
index d9df3a9..30bb505 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-poc-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-poc-devices.c
@@ -1324,8 +1324,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1336,7 +1345,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-ufi-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-ufi-devices.c
index b3eb6ff..8f6bf8e 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-ufi-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-ufi-devices.c
@@ -1266,8 +1266,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1279,6 +1288,14 @@
120,121,122,123,124,125},
{
+ 1796,1795,1794,1793,1792,
+ 1791,1790,1789,1788,1787,1786,1785,1784,1783,1782,
+ 1781,1779,1778,1777,1775,1773,1772,1770,1768,1766,
+ 1764,1762,1760,1757,1755,1752,1749,1747,1744,1740,
+ 1737,1733,1730,1726,1722,1718,1713,1709,1704,1699,
+ 1694,1689,1683,1677,1671,1665,1658,1652,1645,1637,
+ 1630,1622,1614,1606,1597,1588,1579,1570,1560,1550,
+ 1540,1529,1518,1507,1496,1484,1472,1460,1448,1435,
1422,1408,1395,1381,1367,1353,1338,1323,1308,1293,
1278,1262,1247,1231,1215,1199,1183,1166,1149,1133,
1116,1100,1083,1066,1049,1032,1015,998,981,965,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-watch-devices.c b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-watch-devices.c
index f106b62..b2e0b1b 100644
--- a/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-watch-devices.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mach-zx297520v3/zx297520v3-watch-devices.c
@@ -1144,8 +1144,17 @@
#endif
#ifdef CONFIG_TSC_ZX29
-u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
-{30,31,32,33,34,35,36,37,38,39,
+int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER]={
+{
+ -45,-44,-43,-42,-41,
+ -40,-39,-38,-37,-36, -35,-34,-33,-32,-31,
+ -30,-29,-28,-27,-26, -25,-24,-23,-22,-21,
+ -20,-19,-18,-17,-16, -15,-14,-13,-12,-11,
+ -10,-9,-8,-7,-6, -5,-4,-3,-2,-1,
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,21,22,23,24,25,26,27,28,29,
+ 30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
@@ -1156,7 +1165,15 @@
110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125},
-{802,783,764,746,727,709,692,674,657,640,
+{1769,1767,1765,1762,1759,
+ 1756,1753,1750,1746,1742,1738,1734,1729,1725,1720,
+ 1714,1709,1703,1697,1690,1683,1676,1669,1661,1653,
+ 1644,1635,1626,1616,1606,1595,1584,1573,1561,1549,
+ 1536,1523,1510,1496,1482,1467,1452,1436,1420,1404,
+ 1387,1370,1353,1335,1317,1299,1280,1262,1242,1223,
+ 1203,1184,1164,1144,1124,1103,1083,1063,1042,1022,
+ 1001,981,960,940,920,900,880,860,841,821,
+ 802,783,764,746,727,709,692,674,657,640,
624,607,591,576,561,545,531,516,502,489,
475,462,449,437,425,413,402,390,379,369,
358,348,338,329,320,311,302,293,285,277,
diff --git a/ap/os/linux/linux-3.4.x/arch/arm/mm/fault.c b/ap/os/linux/linux-3.4.x/arch/arm/mm/fault.c
index 422ffdc..f4821ea 100755
--- a/ap/os/linux/linux-3.4.x/arch/arm/mm/fault.c
+++ b/ap/os/linux/linux-3.4.x/arch/arm/mm/fault.c
@@ -21,12 +21,12 @@
#ifdef CONFIG_MMU
#ifdef CONFIG_KPROBES
static inline int notify_page_fault(struct pt_regs*regs,unsigned int fsr){int
-ret=(0x5fb+1574-0xc21);if(!user_mode(regs)){preempt_disable();if(kprobe_running(
-)&&kprobe_fault_handler(regs,fsr))ret=(0x8e0+274-0x9f1);preempt_enable();}return
- ret;}
+ret=(0xfe0+3369-0x1d09);if(!user_mode(regs)){preempt_disable();if(kprobe_running
+()&&kprobe_fault_handler(regs,fsr))ret=(0xe57+1779-0x1549);preempt_enable();}
+return ret;}
#else
static inline int notify_page_fault(struct pt_regs*regs,unsigned int fsr){return
-(0xc2d+4365-0x1d3a);}
+(0x1899+41-0x18c2);}
#endif
void show_pte(struct mm_struct*mm,unsigned long addr){pgd_t*pgd;if(!mm)mm=&
init_mm;printk(KERN_ALERT"\x70\x67\x64\x20\x3d\x20\x25\x70" "\n",mm->pgd);pgd=
@@ -34,10 +34,10 @@
"\x5b\x25\x30\x38\x6c\x78\x5d\x20\x2a\x70\x67\x64\x3d\x25\x30\x38\x6c\x6c\x78",
addr,(long long)pgd_val(*pgd));do{pud_t*pud;pmd_t*pmd;pte_t*pte;if(pgd_none(*pgd
))break;if(pgd_bad(*pgd)){printk("\x28\x62\x61\x64\x29");break;}pud=pud_offset(
-pgd,addr);if(PTRS_PER_PUD!=(0xe2a+2894-0x1977))printk(
+pgd,addr);if(PTRS_PER_PUD!=(0x713+6770-0x2184))printk(
"\x2c\x20\x2a\x70\x75\x64\x3d\x25\x30\x38\x6c\x6c\x78",(long long)pud_val(*pud))
;if(pud_none(*pud))break;if(pud_bad(*pud)){printk("\x28\x62\x61\x64\x29");break;
-}pmd=pmd_offset(pud,addr);if(PTRS_PER_PMD!=(0x1c82+165-0x1d26))printk(
+}pmd=pmd_offset(pud,addr);if(PTRS_PER_PMD!=(0x1819+1979-0x1fd3))printk(
"\x2c\x20\x2a\x70\x6d\x64\x3d\x25\x30\x38\x6c\x6c\x78",(long long)pmd_val(*pmd))
;if(pmd_none(*pmd))break;if(pmd_bad(*pmd)){printk("\x28\x62\x61\x64\x29");break;
}if(PageHighMem(pfn_to_page(pmd_val(*pmd)>>PAGE_SHIFT)))break;pte=pte_offset_map
@@ -47,18 +47,18 @@
printk("\x2c\x20\x2a\x70\x70\x74\x65\x3d\x25\x30\x38\x6c\x6c\x78",(long long)
pte_val(pte[PTE_HWTABLE_PTRS]));
#endif
-pte_unmap(pte);}while((0x19c5+3009-0x2586));printk("\n");}
+pte_unmap(pte);}while((0xa31+3906-0x1973));printk("\n");}
#else
void show_pte(struct mm_struct*mm,unsigned long addr){}
#endif
static void __do_kernel_fault(struct mm_struct*mm,unsigned long addr,unsigned
int fsr,struct pt_regs*regs){if(fixup_exception(regs))return;bust_spinlocks(
-(0xca2+3899-0x1bdc));printk(KERN_ALERT
+(0xa61+1566-0x107e));printk(KERN_ALERT
"\x55\x6e\x61\x62\x6c\x65\x20\x74\x6f\x20\x68\x61\x6e\x64\x6c\x65\x20\x6b\x65\x72\x6e\x65\x6c\x20\x25\x73\x20\x61\x74\x20\x76\x69\x72\x74\x75\x61\x6c\x20\x61\x64\x64\x72\x65\x73\x73\x20\x25\x30\x38\x6c\x78" "\n"
,(addr<PAGE_SIZE)?
"\x4e\x55\x4c\x4c\x20\x70\x6f\x69\x6e\x74\x65\x72\x20\x64\x65\x72\x65\x66\x65\x72\x65\x6e\x63\x65"
:"\x70\x61\x67\x69\x6e\x67\x20\x72\x65\x71\x75\x65\x73\x74",addr);show_pte(mm,
-addr);die("\x4f\x6f\x70\x73",regs,fsr);bust_spinlocks((0xe23+530-0x1035));
+addr);die("\x4f\x6f\x70\x73",regs,fsr);bust_spinlocks((0x1c7c+2291-0x256f));
do_exit(SIGKILL);}static void __do_user_fault(struct task_struct*tsk,unsigned
long addr,unsigned int fsr,unsigned int sig,int code,struct pt_regs*regs){struct
siginfo si;
@@ -69,7 +69,7 @@
,tsk->comm,sig,addr,fsr);show_pte(tsk->mm,addr);show_regs(regs);}
#endif
tsk->thread.address=addr;tsk->thread.error_code=fsr;tsk->thread.trap_no=
-(0x18d9+1862-0x2011);si.si_signo=sig;si.si_errno=(0xc1a+1664-0x129a);si.si_code=
+(0x2c0+1319-0x7d9);si.si_signo=sig;si.si_errno=(0x2054+1247-0x2533);si.si_code=
code;si.si_addr=(void __user*)addr;force_sig_info(sig,&si,tsk);}void do_bad_area
(unsigned long addr,unsigned int fsr,struct pt_regs*regs){struct task_struct*tsk
=current;struct mm_struct*mm=tsk->active_mm;if(user_mode(regs))__do_user_fault(
@@ -91,9 +91,9 @@
static int __kprobes do_page_fault(unsigned long addr,unsigned int fsr,struct
pt_regs*regs){struct task_struct*tsk;struct mm_struct*mm;int fault,sig,code;int
write=fsr&FSR_WRITE;unsigned int flags=FAULT_FLAG_ALLOW_RETRY|
-FAULT_FLAG_KILLABLE|(write?FAULT_FLAG_WRITE:(0x14b5+1588-0x1ae9));if(
-notify_page_fault(regs,fsr))return(0x107a+1447-0x1621);tsk=current;mm=tsk->mm;if
-(interrupts_enabled(regs))local_irq_enable();if(!mm||pagefault_disabled())goto
+FAULT_FLAG_KILLABLE|(write?FAULT_FLAG_WRITE:(0x6a+1294-0x578));if(
+notify_page_fault(regs,fsr))return(0xf5+924-0x491);tsk=current;mm=tsk->mm;if(
+interrupts_enabled(regs))local_irq_enable();if(!mm||pagefault_disabled())goto
no_context;if(!down_read_trylock(&mm->mmap_sem)){if(!user_mode(regs)&&!
search_exception_tables(regs->ARM_pc))goto no_context;retry:down_read(&mm->
mmap_sem);}else{might_sleep();
@@ -101,22 +101,22 @@
if(!user_mode(regs)&&!search_exception_tables(regs->ARM_pc))goto no_context;
#endif
}fault=__do_page_fault(mm,addr,fsr,flags,tsk);if((fault&VM_FAULT_RETRY)&&
-fatal_signal_pending(current))return(0xf29+3942-0x1e8f);perf_sw_event(
-PERF_COUNT_SW_PAGE_FAULTS,(0x1b1d+937-0x1ec5),regs,addr);if(!(fault&
-VM_FAULT_ERROR)&&flags&FAULT_FLAG_ALLOW_RETRY){if(fault&VM_FAULT_MAJOR){tsk->
-maj_flt++;perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,(0x2321+522-0x252a),regs,
-addr);}else{tsk->min_flt++;perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
-(0x20b+2927-0xd79),regs,addr);}if(fault&VM_FAULT_RETRY){flags&=~
-FAULT_FLAG_ALLOW_RETRY;goto retry;}}up_read(&mm->mmap_sem);if(likely(!(fault&(
-VM_FAULT_ERROR|VM_FAULT_BADMAP|VM_FAULT_BADACCESS))))return(0x1ab7+2658-0x2519);
-if(fault&VM_FAULT_OOM){pagefault_out_of_memory();return(0x491+7010-0x1ff3);}if(!
-user_mode(regs))goto no_context;if(fault&VM_FAULT_SIGBUS){sig=SIGBUS;code=
-BUS_ADRERR;}else{sig=SIGSEGV;code=fault==VM_FAULT_BADACCESS?SEGV_ACCERR:
-SEGV_MAPERR;}__do_user_fault(tsk,addr,fsr,sig,code,regs);return(0xb1+2894-0xbff)
-;no_context:__do_kernel_fault(mm,addr,fsr,regs);return(0xaa3+5725-0x2100);}
+fatal_signal_pending(current))return(0xff1+632-0x1269);perf_sw_event(
+PERF_COUNT_SW_PAGE_FAULTS,(0x4d9+791-0x7ef),regs,addr);if(!(fault&VM_FAULT_ERROR
+)&&flags&FAULT_FLAG_ALLOW_RETRY){if(fault&VM_FAULT_MAJOR){tsk->maj_flt++;
+perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,(0x231+5463-0x1787),regs,addr);}else
+{tsk->min_flt++;perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,(0x1a3+1319-0x6c9),
+regs,addr);}if(fault&VM_FAULT_RETRY){flags&=~FAULT_FLAG_ALLOW_RETRY;goto retry;}
+}up_read(&mm->mmap_sem);if(likely(!(fault&(VM_FAULT_ERROR|VM_FAULT_BADMAP|
+VM_FAULT_BADACCESS))))return(0x575+5730-0x1bd7);if(fault&VM_FAULT_OOM){
+pagefault_out_of_memory();return(0xc1a+632-0xe92);}if(!user_mode(regs))goto
+no_context;if(fault&VM_FAULT_SIGBUS){sig=SIGBUS;code=BUS_ADRERR;}else{sig=
+SIGSEGV;code=fault==VM_FAULT_BADACCESS?SEGV_ACCERR:SEGV_MAPERR;}__do_user_fault(
+tsk,addr,fsr,sig,code,regs);return(0x52+5873-0x1743);no_context:
+__do_kernel_fault(mm,addr,fsr,regs);return(0xc9d+5546-0x2247);}
#else
static int do_page_fault(unsigned long addr,unsigned int fsr,struct pt_regs*regs
-){return(0x10ca+456-0x1292);}
+){return(0x56d+5422-0x1a9b);}
#endif
#ifdef CONFIG_MMU
static int __kprobes do_translation_fault(unsigned long addr,unsigned int fsr,
@@ -129,21 +129,21 @@
bad_area;if(!pud_present(*pud))set_pud(pud,*pud_k);pmd=pmd_offset(pud,addr);
pmd_k=pmd_offset(pud_k,addr);
#ifdef CONFIG_ARM_LPAE
-index=(0x1a6c+1601-0x20ad);
+index=(0x152+7215-0x1d81);
#else
-index=(addr>>SECTION_SHIFT)&(0x999+5880-0x2090);
+index=(addr>>SECTION_SHIFT)&(0x936+7173-0x253a);
#endif
if(pmd_none(pmd_k[index]))goto bad_area;copy_pmd(pmd,pmd_k);return
-(0x92f+1968-0x10df);bad_area:do_bad_area(addr,fsr,regs);return(0x358+3012-0xf1c)
-;}
+(0x28a+6674-0x1c9c);bad_area:do_bad_area(addr,fsr,regs);return
+(0x40f+6581-0x1dc4);}
#else
static int do_translation_fault(unsigned long addr,unsigned int fsr,struct
-pt_regs*regs){return(0x19e0+1414-0x1f66);}
+pt_regs*regs){return(0x3c2+7140-0x1fa6);}
#endif
static int do_sect_fault(unsigned long addr,unsigned int fsr,struct pt_regs*regs
){if(interrupts_enabled(regs))local_irq_enable();do_bad_area(addr,fsr,regs);
-return(0xc88+3680-0x1ae8);}static int do_bad(unsigned long addr,unsigned int fsr
-,struct pt_regs*regs){return(0x2054+1263-0x2542);}struct fsr_info{int(*fn)(
+return(0x18ba+2768-0x238a);}static int do_bad(unsigned long addr,unsigned int
+fsr,struct pt_regs*regs){return(0x222+7784-0x2089);}struct fsr_info{int(*fn)(
unsigned long addr,unsigned int fsr,struct pt_regs*regs);int sig;int code;const
char*name;};
#ifdef CONFIG_ARM_LPAE
@@ -152,21 +152,21 @@
#include "fsr-2level.c"
#endif
void __init hook_fault_code(int nr,int(*fn)(unsigned long,unsigned int,struct
-pt_regs*),int sig,int code,const char*name){if(nr<(0x1b92+2269-0x246f)||nr>=
+pt_regs*),int sig,int code,const char*name){if(nr<(0x7e5+3376-0x1515)||nr>=
ARRAY_SIZE(fsr_info))BUG();fsr_info[nr].fn=fn;fsr_info[nr].sig=sig;fsr_info[nr].
code=code;fsr_info[nr].name=name;}
#ifdef CONFIG_MODEM_CODE_IS_MAPPING
static DECLARE_RWSEM(shrinker_rwsem);atomic_t _code_page_count=ATOMIC_INIT(
-(0x609+6953-0x2132));struct addr_info{struct list_head node;unsigned long vaddr;
+(0xb56+5619-0x2149));struct addr_info{struct list_head node;unsigned long vaddr;
unsigned long kaddr;unsigned long page_index;};enum modem_access_technology{GSM=
-(0xb3b+406-0xcd1),UTRAN=(0x11a+6077-0x18d6),LTE=(0xaf1+2083-0x1312),COM=
-(0x1cc+4358-0x12cf),NR_MODEM_ACCESS=(0x1499+3867-0x23b0)};struct list_head
+(0xa82+6623-0x2461),UTRAN=(0x19a+294-0x2bf),LTE=(0x102c+3798-0x1f00),COM=
+(0xf7c+1460-0x152d),NR_MODEM_ACCESS=(0x882+5823-0x1f3d)};struct list_head
modem_page_list[NR_MODEM_ACCESS]={LIST_HEAD_INIT(modem_page_list[
-(0x10df+1475-0x16a2)]),LIST_HEAD_INIT(modem_page_list[(0x362+2472-0xd09)]),
-LIST_HEAD_INIT(modem_page_list[(0x429+3914-0x1371)]),LIST_HEAD_INIT(
-modem_page_list[(0xb55+6407-0x2459)]),};unsigned int page_used[
-(0x1886+1788-0x1f5a)];struct completion page_completion[(0x1123+4555-0x22c6)*
-(0x113a+1671-0x17a1)];static void unmap_pte_range(pmd_t*pmd,unsigned long addr,
+(0x2141+685-0x23ee)]),LIST_HEAD_INIT(modem_page_list[(0x260+5072-0x162f)]),
+LIST_HEAD_INIT(modem_page_list[(0xcab+2899-0x17fc)]),LIST_HEAD_INIT(
+modem_page_list[(0x562+2250-0xe29)]),};unsigned int page_used[
+(0x339+4597-0x1506)];struct completion page_completion[(0x942+128-0x99a)*
+(0x6f2+5322-0x1b9c)];static void unmap_pte_range(pmd_t*pmd,unsigned long addr,
unsigned long end){pte_t*pte;pte=pte_offset_kernel(pmd,addr);do{pte_t ptent=
ptep_get_and_clear(&init_mm,addr,pte);WARN_ON(!pte_none(ptent)&&!pte_present(
ptent));}while(pte++,addr+=PAGE_SIZE,addr!=end);}static void unmap_pmd_range(
@@ -180,14 +180,14 @@
addr,unsigned long end){pgd_t*pgd;unsigned long next;BUG_ON(addr>=end);pgd=
pgd_offset_k(addr);do{next=pgd_addr_end(addr,end);if(pgd_none_or_clear_bad(pgd))
continue;unmap_pud_range(pgd,addr,next);}while(pgd++,addr=next,addr!=end);}void
-shrink_modem_mem(unsigned int access_type){int i=(0x87+3934-0xfe5);unsigned long
- vaddr;struct addr_info*addr,*tmp_addr;struct list_head tmp_page_list;for(i=
-(0x735+6474-0x207f);i<NR_MODEM_ACCESS;i++){if(i==access_type)continue;down_write
+shrink_modem_mem(unsigned int access_type){int i=(0x13cf+2895-0x1f1e);unsigned
+long vaddr;struct addr_info*addr,*tmp_addr;struct list_head tmp_page_list;for(i=
+(0xe58+2447-0x17e7);i<NR_MODEM_ACCESS;i++){if(i==access_type)continue;down_write
(&shrinker_rwsem);list_replace_init(&modem_page_list[i],&tmp_page_list);up_write
(&shrinker_rwsem);list_for_each_entry_safe(addr,tmp_addr,&tmp_page_list,node){
list_del_init(&addr->node);page_completion[addr->page_index].done=
-(0x56d+8088-0x2505);page_used[addr->page_index/BITS_PER_LONG]&=~(
-(0x602+5850-0x1cdb)<<(addr->page_index%BITS_PER_LONG));vaddr=addr->vaddr&
+(0x764+741-0xa49);page_used[addr->page_index/BITS_PER_LONG]&=~(
+(0x8a1+5030-0x1c46)<<(addr->page_index%BITS_PER_LONG));vaddr=addr->vaddr&
PAGE_MASK;if(vaddr<cpps_global_var.cpko_text_start||vaddr>cpps_global_var.
modem_text_end){panic(
"\x61\x64\x64\x72\x5f\x69\x6e\x66\x6f\x3a\x20\x25\x30\x38\x78\x20\x69\x73\x20\x20\x64\x65\x73\x74\x72\x6f\x79"
@@ -195,28 +195,28 @@
PAGE_SIZE);flush_tlb_kernel_range(vaddr,vaddr+PAGE_SIZE);
#ifdef CONFIG_DEBUG_RODATA
unsigned int flags;local_irq_save(flags);set_memory_rw(addr->kaddr,
-(0x1882+2136-0x20d9));local_irq_restore(flags);
+(0x1abf+1188-0x1f62));local_irq_restore(flags);
#endif
free_page(addr->kaddr);kfree(addr);atomic_dec(&_code_page_count);};}}
EXPORT_SYMBOL(shrink_modem_mem);phys_addr_t virt_is_mapping(unsigned long addr){
pgd_t*pgd;pmd_t*pmd;pte_t*ptep,pte;unsigned long pfn;pgd=pgd_offset_k(addr);if(!
pgd_none(*pgd)){pmd=pmd_offset(pgd,addr);if(!pmd_none(*pmd)){ptep=pte_offset_map
(pmd,addr);pte=*ptep;if(pte_present(pte)){pfn=pte_pfn(pte);return __pfn_to_phys(
-pfn);}}}return(0x222d+104-0x2295);}static int sync_pgd(unsigned long addr,
-unsigned int fsr,struct pt_regs*regs){unsigned int index;pgd_t*pgd,*pgd_k;pud_t*
-pud,*pud_k;pmd_t*pmd,*pmd_k;index=pgd_index(addr);pgd=cpu_get_pgd()+index;pgd_k=
+pfn);}}}return(0x292+547-0x4b5);}static int sync_pgd(unsigned long addr,unsigned
+ int fsr,struct pt_regs*regs){unsigned int index;pgd_t*pgd,*pgd_k;pud_t*pud,*
+pud_k;pmd_t*pmd,*pmd_k;index=pgd_index(addr);pgd=cpu_get_pgd()+index;pgd_k=
init_mm.pgd+index;if(pgd_none(*pgd_k))goto bad_area;if(!pgd_present(*pgd))
set_pgd(pgd,*pgd_k);pud=pud_offset(pgd,addr);pud_k=pud_offset(pgd_k,addr);if(
pud_none(*pud_k))goto bad_area;if(!pud_present(*pud))set_pud(pud,*pud_k);pmd=
pmd_offset(pud,addr);pmd_k=pmd_offset(pud_k,addr);
#ifdef CONFIG_ARM_LPAE
-index=(0x1c7b+37-0x1ca0);
+index=(0x13d8+743-0x16bf);
#else
-index=(addr>>SECTION_SHIFT)&(0x21e6+876-0x2551);
+index=(addr>>SECTION_SHIFT)&(0x1714+778-0x1a1d);
#endif
if(pmd_none(pmd_k[index]))goto bad_area;copy_pmd(pmd,pmd_k);return
-(0x1da1+1736-0x2469);bad_area:do_bad_area(addr,fsr,regs);return
-(0x4c0+2321-0xdd1);}unsigned long*read_code_file(unsigned long page_index){
+(0x113d+306-0x126f);bad_area:do_bad_area(addr,fsr,regs);return
+(0x7c5+4314-0x189f);}unsigned long*read_code_file(unsigned long page_index){
unsigned long*code_buf;ssize_t result;code_buf=get_zeroed_page(GFP_ATOMIC);if(!
code_buf)panic(
"\x6d\x65\x6d\x65\x6f\x72\x79\x20\x6e\x6f\x74\x20\x65\x6e\x6f\x75\x67\x68\x21\x21"
@@ -225,23 +225,23 @@
"\x6f\x70\x65\x6e\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n");}
mm_segment_t old_fs;old_fs=get_fs();set_fs(KERNEL_DS);loff_t pos;pos=page_index*
PAGE_SIZE+cpps_global_var.modem_offset;result=vfs_read(cpps_global_var.fp_code,(
-char*)code_buf,PAGE_SIZE,&pos);if(result<(0x49+6729-0x1a92)){panic(
+char*)code_buf,PAGE_SIZE,&pos);if(result<(0x52a+4323-0x160d)){panic(
"\x72\x65\x61\x64\x20\x63\x6f\x64\x65\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n"
);}
#ifdef CONFIG_DEBUG_RODATA
unsigned int flags;local_irq_save(flags);set_memory_ro((unsigned long)code_buf,
-(0x2e5+1761-0x9c5));local_irq_restore(flags);
+(0x239f+4-0x23a2));local_irq_restore(flags);
#endif
set_fs(old_fs);return code_buf;}void read_code_mapping(unsigned long addr,
unsigned int fsr,struct pt_regs*regs){unsigned long offset;unsigned long vaddr;
const struct mem_type*mtype;unsigned long*vir_codebuf;unsigned long page_index;
-unsigned long page_shift;if(virt_is_mapping(addr&PAGE_MASK)!=(0x29+8410-0x2103))
-{sync_pgd(addr&PAGE_MASK,fsr,regs);return;}vaddr=addr&PAGE_MASK;offset=vaddr&(~
+unsigned long page_shift;if(virt_is_mapping(addr&PAGE_MASK)!=(0x539+3633-0x136a)
+){sync_pgd(addr&PAGE_MASK,fsr,regs);return;}vaddr=addr&PAGE_MASK;offset=vaddr&(~
cpps_global_var.cpko_text_start);page_index=offset>>PAGE_SHIFT;page_shift=
page_index%BITS_PER_LONG;if((page_used[page_index/BITS_PER_LONG]>>page_shift)&
-(0xa1f+1461-0xfd3)){wait_for_completion(&page_completion[page_index]);sync_pgd(
+(0x53+2746-0xb0c)){wait_for_completion(&page_completion[page_index]);sync_pgd(
vaddr,fsr,regs);return;}else page_used[page_index/BITS_PER_LONG]|=(
-(0x14b1+170-0x155a)<<page_shift);local_irq_enable();vir_codebuf=read_code_file(
+(0x7cb+4993-0x1b4b)<<page_shift);local_irq_enable();vir_codebuf=read_code_file(
page_index);struct addr_info*addr_info;addr_info=kzalloc(sizeof(struct addr_info
),GFP_KERNEL);addr_info->kaddr=vir_codebuf;addr_info->vaddr=addr;addr_info->
page_index=page_index;down_write(&shrinker_rwsem);if(vaddr<cpps_global_var.
@@ -259,46 +259,46 @@
struct pt_regs*regs){const struct fsr_info*inf=fsr_info+fsr_fs(fsr);struct
siginfo info;
#ifdef CONFIG_MODEM_CODE_IS_MAPPING
-if(addr!=(0xf54+4843-0x223f)&&addr>=cpps_global_var.cpko_text_start&&addr<=
+if(addr!=(0xa26+1881-0x117f)&&addr>=cpps_global_var.cpko_text_start&&addr<=
cpps_global_var.modem_text_end){read_code_mapping(addr,fsr&~FSR_LNX_PF,regs);
return;}
#endif
if(!inf->fn(addr,fsr&~FSR_LNX_PF,regs))return;printk(KERN_ALERT
"\x55\x6e\x68\x61\x6e\x64\x6c\x65\x64\x20\x66\x61\x75\x6c\x74\x3a\x20\x25\x73\x20\x28\x30\x78\x25\x30\x33\x78\x29\x20\x61\x74\x20\x30\x78\x25\x30\x38\x6c\x78" "\n"
-,inf->name,fsr,addr);info.si_signo=inf->sig;info.si_errno=(0x1ef3+402-0x2085);
+,inf->name,fsr,addr);info.si_signo=inf->sig;info.si_errno=(0x1791+761-0x1a8a);
info.si_code=inf->code;info.si_addr=(void __user*)addr;arm_notify_die("",regs,&
-info,fsr,(0xa68+6882-0x254a));}void __init hook_ifault_code(int nr,int(*fn)(
+info,fsr,(0xd40+2877-0x187d));}void __init hook_ifault_code(int nr,int(*fn)(
unsigned long,unsigned int,struct pt_regs*),int sig,int code,const char*name){if
-(nr<(0x7a9+6738-0x21fb)||nr>=ARRAY_SIZE(ifsr_info))BUG();ifsr_info[nr].fn=fn;
+(nr<(0x12dc+4844-0x25c8)||nr>=ARRAY_SIZE(ifsr_info))BUG();ifsr_info[nr].fn=fn;
ifsr_info[nr].sig=sig;ifsr_info[nr].code=code;ifsr_info[nr].name=name;}
asmlinkage void __exception do_PrefetchAbort(unsigned long addr,unsigned int
ifsr,struct pt_regs*regs){const struct fsr_info*inf=ifsr_info+fsr_fs(ifsr);
struct siginfo info;
#ifdef CONFIG_MODEM_CODE_IS_MAPPING
-if(addr!=(0x14b+8615-0x22f2)&&addr>=cpps_global_var.cpko_text_start&&addr<=
+if(addr!=(0xfb3+4972-0x231f)&&addr>=cpps_global_var.cpko_text_start&&addr<=
cpps_global_var.modem_text_end){read_code_mapping(addr,ifsr|FSR_LNX_PF,regs);
return;}
#endif
if(!inf->fn(addr,ifsr|FSR_LNX_PF,regs))return;printk(KERN_ALERT
"\x55\x6e\x68\x61\x6e\x64\x6c\x65\x64\x20\x70\x72\x65\x66\x65\x74\x63\x68\x20\x61\x62\x6f\x72\x74\x3a\x20\x25\x73\x20\x28\x30\x78\x25\x30\x33\x78\x29\x20\x61\x74\x20\x30\x78\x25\x30\x38\x6c\x78" "\n"
-,inf->name,ifsr,addr);info.si_signo=inf->sig;info.si_errno=(0x1c76+118-0x1cec);
+,inf->name,ifsr,addr);info.si_signo=inf->sig;info.si_errno=(0x1979+745-0x1c62);
info.si_code=inf->code;info.si_addr=(void __user*)addr;arm_notify_die("",regs,&
-info,ifsr,(0x161b+3857-0x252c));}
+info,ifsr,(0x4c7+5661-0x1ae4));}
#ifndef CONFIG_ARM_LPAE
static int __init exceptions_init(void){if(cpu_architecture()>=CPU_ARCH_ARMv6){
-hook_fault_code((0x3e9+7168-0x1fe5),do_translation_fault,SIGSEGV,SEGV_MAPERR,
+hook_fault_code((0x155+3694-0xfbf),do_translation_fault,SIGSEGV,SEGV_MAPERR,
"\x49\x2d\x63\x61\x63\x68\x65\x20\x6d\x61\x69\x6e\x74\x65\x6e\x61\x6e\x63\x65\x20\x66\x61\x75\x6c\x74"
-);}if(cpu_architecture()>=CPU_ARCH_ARMv7){hook_fault_code((0x174d+3791-0x2619),
+);}if(cpu_architecture()>=CPU_ARCH_ARMv7){hook_fault_code((0x559+5769-0x1bdf),
do_bad,SIGSEGV,SEGV_MAPERR,
"\x73\x65\x63\x74\x69\x6f\x6e\x20\x61\x63\x63\x65\x73\x73\x20\x66\x6c\x61\x67\x20\x66\x61\x75\x6c\x74"
-);hook_fault_code((0x321+7617-0x20dc),do_bad,SIGSEGV,SEGV_MAPERR,
+);hook_fault_code((0xf74+4680-0x21b6),do_bad,SIGSEGV,SEGV_MAPERR,
"\x73\x65\x63\x74\x69\x6f\x6e\x20\x61\x63\x63\x65\x73\x73\x20\x66\x6c\x61\x67\x20\x66\x61\x75\x6c\x74"
);}
#ifdef CONFIG_MODEM_CODE_IS_MAPPING
-int index=(0x16ca+2290-0x1fbc);for(index=(0x19bb+720-0x1c8b);index<
-(0xad9+83-0xb04)*(0x168+2590-0xb66);index++)init_completion(&page_completion[
-index]);
+int index=(0x26f+2998-0xe25);for(index=(0xc84+4770-0x1f26);index<
+(0x1aea+2741-0x2577)*(0x432+2795-0xefd);index++)init_completion(&page_completion
+[index]);
#endif
-return(0xa38+837-0xd7d);}arch_initcall(exceptions_init);
+return(0x114a+827-0x1485);}arch_initcall(exceptions_init);
#endif
diff --git a/ap/os/linux/linux-3.4.x/drivers/cpko/cpko_main.c b/ap/os/linux/linux-3.4.x/drivers/cpko/cpko_main.c
index fcafeb4..dffcb04 100755
--- a/ap/os/linux/linux-3.4.x/drivers/cpko/cpko_main.c
+++ b/ap/os/linux/linux-3.4.x/drivers/cpko/cpko_main.c
@@ -81,30 +81,30 @@
unsigned int __comm_modem_text_start;unsigned int modem_text_end;unsigned int
cpko_data_start;unsigned int cpko_bss_start;unsigned int cpko_text_offset;}
cpko_section_layout;cpko_section_layout cpko_ps_section;int raise(int signo){
-return(0x183+1225-0x64c);}extern unsigned int SysEntry(void);static int
+return(0x11fa+11-0x1205);}extern unsigned int SysEntry(void);static int
ko_Main_Thread(void*data){struct sched_param param={.sched_priority=
-MAX_USER_RT_PRIO/(0xaf5+6062-0x22a1)-(0x1bab+1765-0x228d)};int ret=
-(0x633+3121-0x1264);sched_setscheduler(current,SCHED_FIFO,¶m);ret=SysEntry()
-;if(ret!=(0x509+7685-0x230e))panic("Main_Thread\n");param.sched_priority=
-MAX_USER_RT_PRIO-(0xbb9+1067-0xfb6);sched_setscheduler(kthreadd_task,SCHED_FIFO,
-¶m);return(0x10df+2732-0x1b8b);}int zte_modem_ko_start(void){kthread_run(
+MAX_USER_RT_PRIO/(0xded+2359-0x1722)-(0x11e3+270-0x12ee)};int ret=
+(0xf8b+2482-0x193d);sched_setscheduler(current,SCHED_FIFO,¶m);ret=SysEntry()
+;if(ret!=(0xbd2+2713-0x166b))panic("Main_Thread\n");param.sched_priority=
+MAX_USER_RT_PRIO-(0x755+66-0x769);sched_setscheduler(kthreadd_task,SCHED_FIFO,&
+param);return(0xfd4+33-0xff5);}int zte_modem_ko_start(void){kthread_run(
ko_Main_Thread,NULL,"\x5a\x54\x45\x4d\x61\x69\x6e\x54\x68\x72\x65\x61\x64");
-return(0x767+1319-0xc8e);}static void cpko_sectioninfo_set(void){int ret;struct
-file*fp;mm_segment_t old_fs;loff_t cpko_pos=(0xd8c+3134-0x19ca);struct
+return(0x81b+4816-0x1aeb);}static void cpko_sectioninfo_set(void){int ret;struct
+ file*fp;mm_segment_t old_fs;loff_t cpko_pos=(0x2024+1215-0x24e3);struct
cpps_globalModem globalVar;fp=filp_open(
"\x2f\x6c\x69\x62\x2f\x63\x70\x6b\x6f\x2f\x63\x70\x6b\x6f\x5f\x73\x65\x63\x69\x6e\x66\x6f\x2e\x62\x69\x6e"
-,(0x19aa+718-0x1c78),(0x1099+282-0x11b3));if(IS_ERR(fp)||fp==NULL)panic(
+,(0x1d5+6034-0x1967),(0x5d9+3622-0x13ff));if(IS_ERR(fp)||fp==NULL)panic(
"\x6f\x70\x65\x6e\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n");old_fs=
get_fs();set_fs(KERNEL_DS);ret=vfs_read(fp,(char*)&cpko_ps_section,sizeof(
-cpko_section_layout),&cpko_pos);if(ret<=(0xc0+7829-0x1f55))panic(
+cpko_section_layout),&cpko_pos);if(ret<=(0x5a5+4030-0x1563))panic(
"\x72\x65\x61\x64\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n");filp_close(
fp,NULL);
#ifdef CONFIG_MODEM_CODE_IS_MAPPING
fp=filp_open(
"\x2f\x6c\x69\x62\x2f\x63\x70\x6b\x6f\x2f\x63\x70\x6b\x6f\x2e\x6b\x6f",
-(0x10f0+205-0x11bd),(0x830+3075-0x1433));if(IS_ERR(fp)||fp==NULL)panic(
+(0x8d3+2653-0x1330),(0xab6+4007-0x1a5d));if(IS_ERR(fp)||fp==NULL)panic(
"\x6f\x70\x65\x6e\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n");fp->f_ra.
-ra_pages=(0x544+4239-0x15d3);
+ra_pages=(0x4b1+8568-0x2629);
#endif
if(cpko_ps_section.cpko_text_start){globalVar.cpko_text_start=(unsigned long)
cpko_ps_section.cpko_text_start;globalVar.cpko_rodata_start=(unsigned long)
@@ -124,7 +124,7 @@
vfree_modem_section(globalVar.cpko_text_start,globalVar.modem_text_end);
#endif
}else panic("\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72" "\n");}static int
-cpko_start(void){struct cpps_callbacks callback={(0x22b3+1037-0x26c0)};callback.
+cpko_start(void){struct cpps_callbacks callback={(0x2ec+4566-0x14c2)};callback.
zOss_ResetNVFactory=zOss_ResetNVFactory;callback.zOss_NvramFlush=zOss_NvramFlush
;callback.zOss_NvItemWrite=zOss_NvItemWrite;callback.zOss_NvItemWriteFactory=
zOss_NvItemWriteFactory;callback.zOss_NvItemRead=zOss_NvItemRead;callback.
@@ -193,5 +193,5 @@
psm_GetModemSleepFlagStatus=psm_GetModemSleepFlagStatus;
#endif
cpps_callbacks_register(&callback);cpko_sectioninfo_set();zte_modem_ko_start();
-return(0x3a0+2165-0xc15);}static int cpko_stop(void){return(0xc1+7397-0x1da6);}
+return(0x1c55+1612-0x22a1);}static int cpko_stop(void){return(0x193+979-0x566);}
module_init(cpko_start);module_exit(cpko_stop);
diff --git a/ap/os/linux/linux-3.4.x/drivers/mfd/zx234290-adc.c b/ap/os/linux/linux-3.4.x/drivers/mfd/zx234290-adc.c
index 453cbb8..af82c3d 100644
--- a/ap/os/linux/linux-3.4.x/drivers/mfd/zx234290-adc.c
+++ b/ap/os/linux/linux-3.4.x/drivers/mfd/zx234290-adc.c
@@ -354,6 +354,10 @@
int index=0;
int tmpValue=0,totalValue=0;
uint avgValue;
+#ifdef _USE_VEHICLE_DC
+ printk("%s adc not support in ap\n",__func__);
+ return 0;
+#endif
for(index = 0; index < counter; index++)
{
zx234290_adc_read(ADC_CHANNEL_VBAT_ADC, &tmpValue);
@@ -383,6 +387,10 @@
int index=0;
int tmpValue=0,totalValue=0;
uint avgValue;
+#ifdef _USE_VEHICLE_DC
+ printk("%s adc not support in ap\n",__func__);
+ return 0;
+#endif
for(index = 0; index < counter; index++)
{
zx234290_adc_read(ADC_CHANNEL_VADC1, &tmpValue);
@@ -413,6 +421,10 @@
int index=0;
int tmpValue=0,totalValue=0;
uint avgValue;
+#ifdef _USE_VEHICLE_DC
+ printk("%s adc not support in ap\n",__func__);
+ return 0;
+#endif
//wake_lock(&adc_wake_lock);
for(index = 0; index < counter; index++)
{
diff --git a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/debug_info.c b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/debug_info.c
index de0e6d9..00b5cbe 100755
--- a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/debug_info.c
+++ b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/debug_info.c
@@ -67,13 +67,6 @@
char sub_data[]; // 用户数据
} T_SHARED_MEM_DATA;
-typedef struct
-{
- UINT32 head; // 0x010a0a0a
- UINT32 time; // time()函数获取
- UINT32 total_len; // 数据内容长度
-} T_SAVE_FILE_DATA;
-
/*******************************************************************************
* 全局变量 *
*******************************************************************************/
diff --git a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_cp.c b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_cp.c
index 5a3d876..eefaa76 100755
--- a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_cp.c
+++ b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_cp.c
@@ -58,7 +58,12 @@
/**
* ºê¶¨Òå
*/
-#define ZCAT_MODE_ADDR (int *)IRAM_BASE_ADDR_ZCAT_MODE
+#define ZCAT_MODE_ADDR (int *)IRAM_BASE_ADDR_ZCAT_MODE
+
+#ifdef _USE_VEHICLE_DC
+#define RINGBUF_CAP_TO_AP_OFFSET (ICP_CAP_BUF_LEN + TOOL_CAP_BUF_LEN)
+#define RINGBUF_AP_TO_CAP_OFFSET (RINGBUF_CAP_TO_AP_OFFSET + RINGBUF_CAP_TO_AP_LEN + ADB_CAP_BUF_LEN + RAMDUMP_CAP_CMM_BUF_LEN)
+#endif
/**
* Íⲿº¯ÊýÉùÃ÷
@@ -229,7 +234,7 @@
{
if(g_AP_CapToApBuffer == NULL)
{
- UINT8 *buf = (UINT8 *)(ZX_DDR_CAPBUF_BASE + RINGBUF_CAP_BASE_OFFSET);
+ UINT8 *buf = (UINT8 *)(ZX_DDR_CAPBUF_BASE + RINGBUF_CAP_TO_AP_OFFSET);
g_AP_CapToApBuffer = CreateRingBufferWithSymbol(buf, RINGBUF_CAP_TO_AP_LEN, ZCAT_IPC_ESTABLISHED);
if(!g_AP_CapToApBuffer)
@@ -240,7 +245,7 @@
}
if(g_AP_ApToCapBuffer == NULL)
{
- UINT8 *buf = (UINT8 *)(ZX_DDR_CAPBUF_BASE + RINGBUF_CAP_BASE_OFFSET + RINGBUF_CAP_TO_AP_LEN);
+ UINT8 *buf = (UINT8 *)(ZX_DDR_CAPBUF_BASE + RINGBUF_AP_TO_CAP_OFFSET);
g_AP_ApToCapBuffer = CreateRingBufferWithSymbol(buf, RINGBUF_AP_TO_CAP_LEN, ZCAT_IPC_ESTABLISHED);
if(!g_AP_ApToCapBuffer)
{
diff --git a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_printf.c b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_printf.c
index 6cdf45b..db4271a 100755
--- a/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_printf.c
+++ b/ap/os/linux/linux-3.4.x/drivers/misc/zcat/logcat_drv_printf.c
@@ -326,7 +326,7 @@
#endif
#endif
-
+
return ret;
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c b/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
index e692d2a..ca1e0f2 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/psnet/psnet_io.c
@@ -359,7 +359,7 @@
return 0;
}
-
+extern int atio_is_scaning(void);
int psnet_transIPdataToPS(unsigned int index, struct sk_buff * skb, unsigned int length)
{
@@ -384,18 +384,24 @@
//if(!((unsigned long)buffer%MAC4BYTE_ASSERT != 0) || !((unsigned long)buffer % MAC2BYTE_ASSERT == 0))
// panic("wrong skb data");
-
- if ((((unsigned)buffer[0]) & 0xF0) == 0x40 && (s_pschid_info[index].stat == 1))
- {
- ret = psnet_write(skb, length, IP_V4, chid);
- }
- else if ((((unsigned)buffer[0]) & 0xF0) == 0x60 && (s_pschid_info[index].stat == 1))
- {
- ret = psnet_write(skb, length, IP_V6, chid);
+
+ if((s_pschid_info[index].stat == 1)
+#ifdef USE_DSDS_VSIM
+ && (atio_is_scaning() == 0)
+#endif
+ ){
+ if ((((unsigned)buffer[0]) & 0xF0) == 0x40){
+ ret = psnet_write(skb, length, IP_V4, chid);
+ }else if ((((unsigned)buffer[0]) & 0xF0) == 0x60){
+ ret = psnet_write(skb, length, IP_V6, chid);
+ }else{
+ //err("%s:: IP type of data is wrong!!!", __func__);
+ return PSNET_IO_ERROR;
+ }
}
else
{
- //err("%s:: IP type of data is wrong!!!", __func__);
+ //err("%s:: wan%d not ready!!!", __func__, index+1);
return PSNET_IO_ERROR;
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800/rwnx_cmds.c b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800/rwnx_cmds.c
index f4efc0e..eec2fb0 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800/rwnx_cmds.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800/rwnx_cmds.c
@@ -463,6 +463,7 @@
if(skb_queue_len(&sdiodev->rwnx_hw->txq[i].sk_list) != 0)
rwnx_txq_flush(sdiodev->rwnx_hw, &sdiodev->rwnx_hw->txq[i]);
}
+ tasklet_kill(&sdiodev->rwnx_hw->task);
spin_unlock_bh(&sdiodev->rwnx_hw->tx_lock);
#endif
spin_lock_bh(&sdiodev->tx_priv->txqlock);
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/wireless/ssv6x5x/ssv6x5x-wifi.cfg b/ap/os/linux/linux-3.4.x/drivers/net/wireless/ssv6x5x/ssv6x5x-wifi.cfg
index f876f3c..4c4a80b 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/wireless/ssv6x5x/ssv6x5x-wifi.cfg
+++ b/ap/os/linux/linux-3.4.x/drivers/net/wireless/ssv6x5x/ssv6x5x-wifi.cfg
@@ -73,3 +73,4 @@
##################################################
#ble_replace_scan_win = 0x30
#ble_replace_scan_interval = 0x0140
+ap_force_tim_always_high = 1
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
index 0209dfe..723810d 100644
--- a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.c
@@ -286,17 +286,17 @@
skb->len = pbuf_temp->len;
skb->end = skb->head + pbuf_temp->end_off;
skb->dev = zvnet_dev[pbuf_temp->dev].net;
- if(IFF_NOARP & skb->dev->flags)
- memcpy(skb->data, skb->dev->dev_addr, 6);
if(skb->len == 0 || skb->len > 2000)
panic("len ERR!!!!!!!!!!\n");
/* make sure we initialize shinfo sequentially */
dma_cache_maint(skb->head, pbuf_temp->head, pbuf_temp->end_off + sizeof(struct skb_shared_info), DMA_FROM_DEVICE);
+ if(IFF_NOARP & skb->dev->flags)
+ memcpy(skb->data, skb->dev->dev_addr, 6);
skb_reset_network_header(skb);
- //shinfo = skb_shinfo(skb);
+ shinfo = skb_shinfo(skb);
//memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
- //atomic_set(&shinfo->dataref, 1);
- kmemcheck_annotate_variable(shinfo->destructor_arg);
+ atomic_set(&shinfo->dataref, 1);
+ //kmemcheck_annotate_variable(shinfo->destructor_arg);
return skb;
}
@@ -379,7 +379,7 @@
buff[i].dev = zvnet_get_index_by_netdev(skb->dev);
i++;
zv_info("xmit skb=0x%x i=%d", skb, i);
- if(i >= ZVNET_XMIT_MAX_QUEUE_NUM){
+ if(i > ZVNET_XMIT_MAX_QUEUE_NUM){
panic("qlen:%d!", i);
}
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.h b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.h
index be937d6..ab3cda3 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.h
+++ b/ap/os/linux/linux-3.4.x/drivers/net/zvnet/zvnet_dev.h
@@ -27,7 +27,7 @@
__func__ , ## arg)
//zvnetÉ豸×î´óÊý
-#define DDR_ZVNET_DEV_MAX 9
+#define DDR_ZVNET_DEV_MAX 10
#define ZVNET_IFNAME_PREFIX "zvnet"
#define ICP_CHN_ZVNET1 channel_20
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/at_io.c b/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/at_io.c
index 5e8683d..13f1884 100755
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/at_io.c
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/at_io.c
@@ -16,7 +16,7 @@
#define VSIM_CHID_BASE 90
#define VSIM_MAX_MSG_LEN 1024
-#define VSIM_APDU_TIMEOUT 6
+#define VSIM_APDU_TIMEOUT 8//Сˮ»Øµ÷³¬Ê±Ê±¼ä6Ã룬Ҫ±ÈСˮ´ó
enum{
MSG_CMD_VSIM_GET_SWITCH = 1,
@@ -31,6 +31,8 @@
MSG_CMD_VSIM_APDU,
MSG_CMD_VSIM_GET_FLOW_STATISTIC,//»ñÈ¡µ±Ç°Á÷Á¿Í³¼Æ
MSG_CMD_VSIM_RESET_FLOW_STATISTIC,//ÖØÖõ±Ç°Á÷Á¿Í³¼Æ
+ MSG_CMD_VSIM_GET_SCANING,
+ MSG_CMD_VSIM_SET_SCANING,
MSG_CMD_VSIM_MAX,
};
typedef struct {
@@ -61,6 +63,7 @@
atomic_t g_vsim_standby = ATOMIC_INIT(0);
atomic_t g_vsim_tauing = ATOMIC_INIT(0);
atomic_t g_vsim_authing = ATOMIC_INIT(0);
+atomic_t g_vsim_scaning = ATOMIC_INIT(0);
unsigned char g_vsim_psnet_stat = 0;
unsigned char g_vsim_cid_reserved = 0;
@@ -251,6 +254,19 @@
return 0;
}
break;
+ case MSG_CMD_VSIM_GET_SCANING:
+ out_buf->usMsgCmd = MSG_CMD_VSIM_GET_SCANING;
+ out_buf->aucDataBuf[0] = atomic_read(&g_vsim_scaning);
+ out_buf->usDataLen = 1;
+ break;
+ case MSG_CMD_VSIM_SET_SCANING:
+ if(default_param == 0 || default_param == 1 || default_param == 2) {
+ atomic_set(&g_vsim_scaning, default_param);
+ }else{
+ printk("vsim_app_proc SET_SCANING=%d fail!\n",default_param);
+ return 0;
+ }
+ break;
default:
printk("vsim_app_proc fail msgid=%d!\n",msg_buf->usMsgCmd);
return 0;
@@ -280,9 +296,9 @@
static int vsim_switch_seq_show(struct seq_file *s, void *v)
{
- seq_printf(s, "vsim state:%d standby:%d tauing:%d authing:%d datastat:%d msgflg:%d cid:%d-%d\n",
- atomic_read(&g_vsim_switch), atomic_read(&g_vsim_standby), atomic_read(&g_vsim_tauing),
- atomic_read(&g_vsim_authing), g_vsim_psnet_stat, g_vsim_msg_flag, g_vsim_cid_reserved, cid_reserved);
+ seq_printf(s, "vsim state:%d standby:%d tauing:%d authing:%d scaning:%d datastat:%d msgflg:%d cid:%d-%d\n",
+ atomic_read(&g_vsim_switch), atomic_read(&g_vsim_standby), atomic_read(&g_vsim_tauing), atomic_read(&g_vsim_authing),
+ atomic_read(&g_vsim_scaning), g_vsim_psnet_stat, g_vsim_msg_flag, g_vsim_cid_reserved, cid_reserved);
return 0;
}
@@ -326,6 +342,11 @@
.write = vsim_switch_set,
};
+int atio_is_scaning(void)
+{
+ return atomic_read(&g_vsim_scaning);
+}
+
int atio_vsim_apdu_cfg(unsigned char*apdu_req, unsigned short apdu_req_len, unsigned char *apdu_rsp, unsigned short *apdu_rsp_len, unsigned char slot,unsigned char is_auth)
{
VSIM_MSG_BUF in_msg = {0};
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/icp_rpmsg.c b/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/icp_rpmsg.c
index b4645a8..a1570ff 100644
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/icp_rpmsg.c
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/rpm/icp_rpmsg.c
@@ -208,7 +208,7 @@
if (icp_rpmsg_get_buffer_type(actorID, chID) == CH_IRAM)
return (pa+iram_base_offset);
else
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
return (pa + ddr_base_offset);
#else
return (pa-ZX_RPMSG_DDR_BASE+ddr_base_offset);
@@ -702,6 +702,7 @@
pMsg->actorID,
pMsg->chID);
+ dsb();
channel_send->SendPos = rpmsg_resource[pMsg->actorID].sendPos[pMsg->chID];
#else
RpMsg = (T_HalRpMsg_RpMsg *)(channel_send->SendPos + SendBase_remap);
@@ -794,6 +795,7 @@
pMsg->len,
pMsg->actorID,
pMsg->chID);
+ dsb();
channel_send->SendPos = rpmsg_resource[pMsg->actorID].sendPos[pMsg->chID];
#else
RpMsg = (T_HalRpMsg_RpMsg *)(channel_send->SendPos + SendBase_remap);
@@ -946,6 +948,41 @@
#define RPMSG_BUFFER_LEN 512
static unsigned char rpmsg_cache_buffer[RPMSG_BUFFER_LEN];
#endif
+#ifdef _USE_VEHICLE_DC
+struct trace_rpmsg {
+ T_HalRpMsg_ChInfo channel_record;
+ T_HalRpMsg_MsgHeader msg_header;
+ unsigned int remap;
+ T_ZDrvRpMsg_ChID chID;
+};
+#define TRACE_RPMSG_COUNT 1000
+static struct trace_rpmsg trace_rpmsg_info[TRACE_RPMSG_COUNT+2];
+volatile unsigned int trace_rpmsg_index = 0;
+
+#define rpmsg_trace_index_inc() \
+do{ \
+ trace_rpmsg_index++;\
+ if(trace_rpmsg_index>=TRACE_RPMSG_COUNT)\
+ trace_rpmsg_index=0;\
+}while(0)
+
+static void dma_trace_record(T_ZDrvRpMsg_ChID chID, T_HalRpMsg_ChInfo *chan,
+ T_HalRpMsg_MsgHeader *header, unsigned int remap)
+{
+ if (chan)
+ trace_rpmsg_info[trace_rpmsg_index].channel_record = *chan;
+
+ if (header)
+ trace_rpmsg_info[trace_rpmsg_index].msg_header = *header;
+
+ trace_rpmsg_info[trace_rpmsg_index].remap = remap;
+ trace_rpmsg_info[trace_rpmsg_index].chID = chID;
+
+ rpmsg_trace_index_inc();
+}
+#else
+static void dma_trace_record(T_ZDrvRpMsg_ChID chID, T_HalRpMsg_ChInfo *chan, T_HalRpMsg_MsgHeader *header, unsigned int remap){}
+#endif
int RpMsg_Dispatch(struct work_struct *work)
{
unsigned int RecvBase_remap = 0;
@@ -1009,9 +1046,12 @@
(unsigned char *)RecvBase_remap,
sizeof(T_HalRpMsg_MsgHeader));
- if (tmpMsgHeader.flag != RPMSG_MSGHEAD_FLAG)
+ dma_trace_record(chID, channel_recv, &tmpMsgHeader, RecvBase_remap);
+
+ if (tmpMsgHeader.flag != RPMSG_MSGHEAD_FLAG) {
// return RPMSG_CHANNEL_MSG_ERR;
BUG();
+ }
if(RPMSG_BUFFER_LEN < tmpMsgHeader.len)
BUG();
@@ -1021,6 +1061,8 @@
(unsigned char *)RecvBase_remap,
tmpMsgHeader.len);
+ dma_trace_record(chID, channel_recv, &tmpMsgHeader, RecvBase_remap);
+
(*callback)(rpmsg_cache_buffer, tmpMsgHeader.len);
#else
RpMsg = (T_HalRpMsg_RpMsg *)(channel_recv->RecvPos + RecvBase_remap);
@@ -1211,7 +1253,7 @@
icp_rpmsg_drv->actorID = pdev->id;
icp_rpmsg_drv->channel_cnt = pdata->max_channel_cnt;
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
if(icp_rpmsg_drv->actorID == CAP_ID) {
ddr_base_offset = ZX_DDR_CAPBUF_BASE - ZX29_DDR_CAPBUF_PHYS;
@@ -1227,7 +1269,7 @@
icp_rpmsg_drv->Channel_config.CurIramSpace_Size = pdata->iram_send_size - icp_rpmsg_drv->channel_cnt * sizeof(T_HalRpMsg_ChInfo);
icp_rpmsg_drv->Channel_config.CurDdrAddr = (unsigned int)(pdata->ddr_send_base);
icp_rpmsg_drv->Channel_config.CurDdrSpace_Size = pdata->ddr_send_size;
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
}
#endif
@@ -1271,7 +1313,7 @@
if(ret < 0)
printk("rpmsg_zx29 register failed! \n");
-#ifndef _USE_CAP_SYS
+#ifndef _USE_VEHICLE_DC
ddr_base_offset = (unsigned int)ioremap(ZX_RPMSG_DDR_BASE, ICP_DDR_APPS_SIZE+ICP_DDR_PSAP_SIZE);
#endif
@@ -1359,7 +1401,7 @@
#endif
#ifdef ICP_TEST_PS2AP
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
static T_ZDrvRpMsg_ActorID test_actorID = CAP_ID; /* test ps-->ap*/
#else
static T_ZDrvRpMsg_ActorID test_actorID = PS_ID; /* test ps-->ap*/
@@ -1369,7 +1411,7 @@
static T_ZDrvRpMsg_ActorID test_actorID = M0_ID; /* test M0-->ap*/
static T_ZDrvRpMsg_ChID test_chID = ICP_CHANNEL_PSM;
#endif
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
#define ZX297520V2_ICP_PSAP_REG (ZX_ICP_BASE + 0xf8) /* ap-->ps */
#else
#define ZX297520V2_ICP_PSAP_REG (ZX_ICP_BASE + 0xc8)
@@ -1402,7 +1444,7 @@
Icp_Msg.flag = RPMSG_WRITE_INT; /* 1- means send an icp interrupt> */
Icp_Msg.buf = tmp_buf;
Icp_Msg.len = len;
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
ret = zDrvRpMsg_Write_Cap(&Icp_Msg);
#else
ret = zDrvRpMsg_Write(&Icp_Msg);
@@ -1442,7 +1484,7 @@
Icp_Msg.buf = test_rcv_buf;
Icp_Msg.len = len;
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
ret = zDrvRpMsg_Write_Cap(&Icp_Msg);
#else
ret = zDrvRpMsg_Write(&Icp_Msg);
@@ -1472,7 +1514,7 @@
Icp_Msg.buf = test_rcv_buf;
Icp_Msg.len = len;
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
ret = zDrvRpMsg_Write_Cap(&Icp_Msg);
#else
ret = zDrvRpMsg_Write(&Icp_Msg);
@@ -1498,7 +1540,7 @@
#ifdef ICP_TEST_SELF_TXRX
T_HalRpMsg_ChInfo *channel = icp_rpmsg_get_channel_recv(test_actorID, test_chID);
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
channel->Base_Addr = Icp_rpmsg_drvs[test_actorID]->Channel_config.CurDdrAddr - ICP_DDR_APPS_SIZE;//(u32)(Icp_rpmsg_drvs[test_actorID]->Channel_config.ChInfo_Recv_Base) + Icp_rpmsg_drvs[test_actorID]->channel_cnt*sizeof(T_HalRpMsg_ChInfo);
#else
channel->Base_Addr = Icp_rpmsg_drvs[test_actorID]->Channel_config.CurDdrAddr + ICP_DDR_APPS_SIZE;//(u32)(Icp_rpmsg_drvs[test_actorID]->Channel_config.ChInfo_Recv_Base) + Icp_rpmsg_drvs[test_actorID]->channel_cnt*sizeof(T_HalRpMsg_ChInfo);
@@ -1600,6 +1642,7 @@
pMsg->len,
pMsg->actorID,
pMsg->chID);
+ dsb();
channel_send->SendPos = rpmsg_resource[pMsg->actorID].sendPos[pMsg->chID];
#else
RpMsg = (T_HalRpMsg_RpMsg *)(channel_send->SendPos + SendBase_remap);
@@ -1654,7 +1697,7 @@
if(icp_test_cnt == 0)
{
/* create channel */
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
if(zDrvRpMsg_CreateChannel_Cap(test_actorID, test_chID, 0x30))
#else
if(zDrvRpMsg_CreateChannel(test_actorID, test_chID, 0x30))
@@ -1665,7 +1708,7 @@
}
pr_info("[ICP_TEST] Success create psm icp channel!!! \n");
-#ifdef _USE_CAP_SYS
+#ifdef _USE_VEHICLE_DC
zDrvRpMsg_RegCallBack_Cap(test_actorID, test_chID, icp_test_cb);
#else
zDrvRpMsg_RegCallBack(test_actorID, test_chID, icp_test_cb);
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc-strategy.c b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc-strategy.c
index c259d6b..5d74c58 100644
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc-strategy.c
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc-strategy.c
@@ -62,11 +62,11 @@
static volatile u32 ps_freq_flag=0;
struct timer_list timer_tsctrl;
-static u32 temp_percent = 0;
+static int temp_percent = 0;
T_TsCtrl_CallbackFunction s_tsctrl_callback[MAX_TSCTRL_STRATEGY_ID] = {NULL};
-typedef void (*T_Probe_Strategy)(u32 probe_num,u32 temperature );
+typedef void (*T_Probe_Strategy)(u32 probe_num,int temperature );
T_Probe_Strategy g_probe_strategy[PROBE_MAX]={0,};
T_TscP_Strategy g_phy_Strategy[STRATEGY_PHY_NUM]={
@@ -137,11 +137,11 @@
* Others: //not use
********************************************************************************/
-void tsctrl_probe_adc1_strategy(u32 probe_num,u32 temperature )
+void tsctrl_probe_adc1_strategy(u32 probe_num,int temperature )
{
#if 1
- u32 temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
- u32 temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
if(temperature<=TsNvData.Threshods[probe_num].THROSHOLD_3){
temp_percent=0;
@@ -246,11 +246,11 @@
* Others: //not use
********************************************************************************/
-void tsctrl_probe_adc2_strategy(u32 probe_num,u32 temperature )
+void tsctrl_probe_adc2_strategy(u32 probe_num,int temperature )
{
#if 1
- u32 temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
- u32 temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
if(temperature<=TsNvData.Threshods[probe_num].THROSHOLD_3){
temp_percent=0;
@@ -355,11 +355,11 @@
* Others: //not use
********************************************************************************/
-void tsctrl_probe_adcRf_strategy(u32 probe_num,u32 temperature )
+void tsctrl_probe_adcRf_strategy(u32 probe_num,int temperature )
{
#if 1
- u32 temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
- u32 temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp1=(temperature-TsNvData.Threshods[probe_num].THROSHOLD_3);
+ int temp2=(TsNvData.Threshods[probe_num].THROSHOLD_6-TsNvData.Threshods[probe_num].THROSHOLD_3);
if(temperature<=TsNvData.Threshods[probe_num].THROSHOLD_3){
temp_percent=0;
@@ -464,7 +464,7 @@
* Others: //not use
********************************************************************************/
-static void tsctrl_set_probe_strategy(u32 probe_num,u32 temperature )
+static void tsctrl_set_probe_strategy(u32 probe_num,int temperature )
{
if(PROBE_MAX!=probe_num && 0xFF!=temperature) {
g_probe_strategy[probe_num](probe_num, temperature);
@@ -690,6 +690,7 @@
if(zx_getspeed(0) != 624000 )
zx29_set_frequency(1,0); //zDrvPow_SetArmPsCoreFreq(CLK624M);
+ tsc_set_reg_bits(TSCTRL_PS,BIT_PS_FREQ, BITS_FOR_PSIRAM,STRTEGY_STOP);
sc_debug_info_record(MODULE_ID_AP_TSC, "ps freq 624M start\n" );
tsc_print_log("ps freq 624M start\n");
ps_freq_flag=0;
@@ -698,6 +699,7 @@
if(!ps_freq_flag){
//tsc_print_log("CPU_FREQ1:zx_getspeed(0)=%d\n",zx_getspeed(0));
zx29_set_frequency(0,1); //zDrvPow_SetArmPsCoreFreq(CLK312M);
+ tsc_set_reg_bits(TSCTRL_PS,BIT_PS_FREQ, BITS_FOR_PSIRAM,STRTEGY_START);
sc_debug_info_record(MODULE_ID_AP_TSC, "ps freq 312M start\n" );
tsc_print_log("ps freq 312M start\n");
ps_freq_flag=1;
@@ -799,9 +801,9 @@
{
u32 probe_num ;
- u32 temperature ;
+ int temperature ;
- u32 TsDataValue[PROBE_NUM][PROBE_INFO] = {0};
+ int TsDataValue[PROBE_NUM][PROBE_INFO] = {0};
while(1)
{
@@ -934,7 +936,7 @@
* Others: //not use
********************************************************************************/
-VOID zDrvTsc_GetTscTempPercent(UINT32 *percent)
+VOID zDrvTsc_GetTscTempPercent(int *percent)
{
*percent=temp_percent;
tsc_write_reg(TSCTRL_TEMP_PERCENT,temp_percent);
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.c b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.c
index 144748c..e695587 100644
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.c
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.c
@@ -52,16 +52,16 @@
unsigned int tsc_record_flag= 0;
module_param(tsc_record_flag, uint, 0644);
-extern u32 ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER];
+extern int ts_temp_value_table[TS_ADC_TEMP_NUMBER][TS_ADC_TEMP_VOLTAGE_NUMBER];
extern volatile u32 ts_adc_flag;
-u32 g_ts_data_info[PROBE_NUM][PROBE_INFO] = {0};
+int g_ts_data_info[PROBE_NUM][PROBE_INFO] = {0};
static struct mutex tsc_mutexId;
struct semaphore s_tsc_adc_semaphore;
T_SYS_NV_TSC_CONFIG TsNvData = {0};
-unsigned int tsc_tempValue[PROBE_MAX]={0};
+int tsc_tempValue[PROBE_MAX]={0};
struct kobject *zx_tsc_kobj;
@@ -100,7 +100,7 @@
#ifndef USE_CPPS_KO
extern UINT32 zOss_NvItemRead(UINT32 NvItemID, UINT8 * NvItemData, UINT32 NvItemLen);
#endif
-static u32 tsc_adcRf_read(void);
+static int tsc_adcRf_read(void);
void tsc_get_tempPercent(unsigned int *percent)
{
@@ -171,7 +171,7 @@
zte_tsc_attr(tsc_ptscCtrlEn);
- unsigned int *tsc_get_probe_temperature(void)
+ static int *tsc_get_probe_temperature(void)
{
unsigned int i;
@@ -186,17 +186,17 @@
char *buf)
{
char *s = buf;
- unsigned int *tsc_val = 0;
+ int *tsc_val = 0;
unsigned int i;
tsc_val = tsc_get_probe_temperature();
- memcpy((unsigned char *)buf, (unsigned char *)tsc_val, PROBE_MAX*sizeof(unsigned int));
+ memcpy((unsigned char *)buf, (unsigned char *)tsc_val, PROBE_MAX*sizeof(int));
for(i=0; i<PROBE_MAX;i++){
sprintf(s, "%d\n ", tsc_val[i]);
s+=4;
}
- return PROBE_MAX*sizeof(unsigned int);
+ return PROBE_MAX*sizeof(int);
}
static ssize_t tsc_value_store(struct kobject *kobj, struct kobj_attribute *attr,
@@ -290,7 +290,7 @@
* Others: //not use
********************************************************************************/
-u32 tsc_nearest(u32 b[],u32 searchKey,u32 low,u32 high)
+u32 tsc_nearest(int b[],u32 searchKey,u32 low,u32 high)
{
u32 middle = (u32)(low+high)/2;
u32 index;
@@ -316,7 +316,7 @@
* Others: //not use
********************************************************************************/
-static void tsc_get_probe_adcvalue(u32 adcValue, u32 *temp)
+static void tsc_get_probe_adcvalue(u32 adcValue, int *temp)
{
u32 index = 0;
@@ -339,9 +339,10 @@
return dac;
}
-static u32 tsc_adcRf_read(void)
+static int tsc_adcRf_read(void)
{
- u32 adcRfValue, tempRf;
+ u32 adcRfValue;
+ int tempRf;
adcRfValue = tsc_dac_read(IRAM_TEMPCOMP_DAC);
tsc_get_probe_adcvalue(adcRfValue,&tempRf);
@@ -354,12 +355,12 @@
u32 adc1Value = 0;
u32 adc2Value = 0;
- u32 temp1 = 0;
- u32 temp2 = 0;
+ int temp1 = 0;
+ int temp2 = 0;
#if ADCRF_SEARCH_TEMP
u32 adcRfValue = 0;
- u32 tempRf = 0;
+ int tempRf = 0;
#endif
while(1) {
@@ -400,7 +401,7 @@
tsc_unlock();
if(g_tsc_print_log_debug)
- tsc_print_log("adc1/adc2 value adc1Value=%d,adc2Value=%d,temp1 = %d.temp2 = %d.temprf = %d.\n",adc1Value,adc2Value,temp1,temp2, g_ts_data_info[PROBE_ADCRF][TS_MEMBER_TEMP]);
+ tsc_print_log("adc1/adc2 value adc1Value=%d,adc2Value=%d,adcRfValue=%d,temp1 = %d.temp2 = %d.temprf = %d.\n",adc1Value,adc2Value,adcRfValue,temp1,temp2, g_ts_data_info[PROBE_ADCRF][TS_MEMBER_TEMP]);
if((((tsc_record_time_cnt*TS_POLLING_TIME_S)%tsc_record_time)==0) && tsc_record_flag)
{
@@ -416,9 +417,9 @@
sc_debug_info_record(MODULE_ID_AP_TSC, "tempRf:%d\n", zx_read_reg(TSCTRL_TEMPADCRF) );
printk( "tempRf:%d\n", zx_read_reg(TSCTRL_TEMPADCRF));
}
- tsc_record_time_cnt++;
}
-
+ tsc_record_time_cnt++;
+
if(TsNvData.DetectEn == 0xB2)
up(&s_tsc_adc_semaphore);
@@ -615,7 +616,7 @@
}
/*get buffer first address*/
-void tsc_get_temp_data_info(u32 TsDataInfo[][PROBE_INFO])
+void tsc_get_temp_data_info(int TsDataInfo[][PROBE_INFO])
{
int i,j;
tsc_lock();
diff --git a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
index f9651f6..2495258 100644
--- a/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
+++ b/ap/os/linux/linux-3.4.x/drivers/soc/zte/tsc/zx-tsc.h
@@ -94,7 +94,8 @@
/*TSCTRL_PS iram ÿËÄbit±íʾPSµÄÒ»¸ö²ßÂÔÊÇ·ñÖ´ÐÐ*/
#define BIT_PS_RATE 0
#define BIT_PS_ANYRESIDENT 4
-#define BIT_SHUTDOWN 8
+#define BIT_PS_FREQ 8
+#define BIT_SHUTDOWN 12
/**/
//#define STRATEGY_PERIP_NUM 2
#define BITS_FOR_PEPIPIRAM 4
@@ -173,7 +174,7 @@
//#define TS_ADC_TEMP_NUMBER 2
//#define TS_ADC_TEMP_VOLTAGE_NUMBER 110
#define TS_TEMP_NUMBER_SMALLEST 0
-#define TS_TEMP_NUMBER_BIGGEST 96
+#define TS_TEMP_NUMBER_BIGGEST 171
#define TEMP_PERCENT_INTERVAL (10) //ζȰٷֱȼä¸ô
@@ -201,7 +202,7 @@
* fuction extern
****************************************************************************/
void tsctrl_init(void);
-void tsc_get_temp_data_info(u32 TsDataInfo[][PROBE_INFO]);
+void tsc_get_temp_data_info(int TsDataInfo[][PROBE_INFO]);
typedef void (* T_TsCtrl_CallbackFunction)( u8 en ); /*en: 1,Æô¶¯²ßÂÔ£¬0,Í£Ö¹²ßÂÔ; 2: hold ²ßÂÔ*/
s32 zDrvTsCtrl_RegCallback(T_TsCtrl_Strategy_ModuleId module,T_TsCtrl_CallbackFunction callback);
s32 zDrvTsc_SetTscEn(u8 val); //val:0xB2,οشò¿ª£» ÆäËûֵοعرÕ
diff --git a/ap/os/linux/linux-3.4.x/drivers/tty/serial/zx29_uart.c b/ap/os/linux/linux-3.4.x/drivers/tty/serial/zx29_uart.c
index c5f8d45..efe89a3 100755
--- a/ap/os/linux/linux-3.4.x/drivers/tty/serial/zx29_uart.c
+++ b/ap/os/linux/linux-3.4.x/drivers/tty/serial/zx29_uart.c
@@ -45,6 +45,7 @@
#include <linux/wakelock.h>
#include <linux/kthread.h>
#include <linux/semaphore.h>
+#include <linux/notifier.h>
#include "mach/zx29_uart_def.h"
@@ -59,7 +60,12 @@
#pragma GCC optimize("O0")
#endif
+extern bool xp2xp_Ap2CpIsApWakeup(void);
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+extern int xp2xp_enable_4line(void);
+#endif
#define CONFIG_SERIAL_ZX29_DMA 1
+#define __UART_TIME_ (cpu_clock(0)>>10)
char uart_names[4][12] = {
@@ -71,7 +77,7 @@
#if CONFIG_SERIAL_ZX29_DMA
#define ZX29_DMA_BUFFER_SIZE PAGE_SIZE
#define UART_DMA_RX_MAX_COUNT 2
-#define RX_DMA_TIMEOUT (HZ / 10)//60
+#define RX_DMA_TIMEOUT (HZ / 100)//60
#define RX_DMA_WORK 1
struct zx29_sgbuf {
struct scatterlist sg;
@@ -200,8 +206,14 @@
size_t sg2tty_len;
struct zx29_sgbuf *curr_sg;
+ struct notifier_block wakeup_notifier;
#endif
+ //means application decide close and release DMA &wakelock
+ int app_ctrl;
+ int sleep_state;
+ //if app_ctrl is set or using kernel control sleep,set this flag
+ int uart_power_mode;
};
@@ -209,6 +221,102 @@
static struct zx29_uart_port zx29_uart_ports[UART_NUM];
#define zx29_MAXPORTS ARRAY_SIZE(zx29_uart_ports)
+void zx29_uart_stop_rx(struct uart_port *port);
+
+#if CONFIG_SERIAL_ZX29_DMA
+static inline bool zx29_dma_tx_start(struct zx29_uart_port *zup);
+static inline void zx29_dma_tx_stop(struct zx29_uart_port *zup);
+static bool zx29_dma_tx_irq(struct zx29_uart_port *zup);
+static int zx29_uart_dma_tx_chars(struct zx29_uart_port *zup);
+void uart_dma_rx_callback(void *data);
+static void zx29_uart_dma_rx_chars(struct zx29_uart_port *zup,
+ //u32 pending, bool use_buf_b,
+ u32 pending, struct zx29_sgbuf *sgbuf,
+ bool readfifo, unsigned long *flags);
+static inline void zx29_dma_rx_stop(struct zx29_uart_port *zup);
+static inline bool zx29_dma_rx_available(struct zx29_uart_port *zup);
+static inline bool zx29_dma_rx_running(struct zx29_uart_port *zup);
+static int zx29_dma_rx_trigger_dma(struct zx29_uart_port *zup);
+
+static void zx29_uart_rx_dma_chars(struct zx29_uart_port *zup, unsigned long *flags);
+dma_peripheral_id uart_get_rx_dma_peripheral_id(struct zx29_uart_port *zup);
+
+#if RX_DMA_WORK
+static void zx29_uart_rx_timeout_chars(struct zx29_uart_port *zup, unsigned long *flags);
+static inline bool zx29_dma_rx_work_scheduled(struct zx29_uart_port *zup);
+
+static void zx29_uart_rt_dma(struct zx29_uart_port *zup, unsigned long *flags);
+#endif
+#endif
+
+typedef struct __UART_STATIC{
+ int cnt;
+ char head[16];
+ unsigned long long s_time;
+ int func_step;
+ int ris;
+}uart_static;
+
+uart_static g_uart_static[256] = {0};
+int g_uart_static_cnt = 0;
+void test_uart_static(char *buf, int cnt, int steps, int index)
+{
+ if(index != UART0)
+ return;
+
+ if(buf){
+ if(cnt >= 16){
+ strncpy(g_uart_static[g_uart_static_cnt].head, buf, 16);
+ }else{
+ memcpy(g_uart_static[g_uart_static_cnt].head, buf, cnt);
+ }
+ }
+ g_uart_static[g_uart_static_cnt].cnt = cnt;
+ g_uart_static[g_uart_static_cnt].s_time = __UART_TIME_;
+ g_uart_static[g_uart_static_cnt].func_step = steps;
+ g_uart_static[g_uart_static_cnt].ris = UART_GET_RIS(&zx29_uart_ports[0].port);
+
+ if(++g_uart_static_cnt >= 256)
+ g_uart_static_cnt = 0;
+
+}
+
+
+/*******************************************************************************
+* Function: uart_wakeup_callback.
+* Description: uart_wakeup_callback.
+* Parameters:
+* Input:val:means wakeup or sleep notify to other device
+*
+* Output:v:means devices been called return result
+*
+* Returns:
+*
+* Others:
+********************************************************************************/
+int uart_wakeup_callback(struct notifier_block * nb, unsigned long val, void * v)
+{
+ int *call_result = (int *)v;
+ unsigned long flags = 0;
+ struct zx29_uart_port *zup = container_of(nb, struct zx29_uart_port, wakeup_notifier);
+ if(!zup || zup->port_close){
+ *call_result |= 0;
+ return 0;
+ }
+ raw_spin_lock_irqsave(&zup->port.lock, flags);
+ if(val == 1){//wakeup
+ zup->sleep_state = 0;
+ zx29_uart_rx_dma_chars(zup, &flags);
+
+ }else{//sleep
+ zup->sleep_state = 1;
+ zx29_uart_stop_rx(&zup->port);
+
+ }
+ *call_result |= 0;
+ raw_spin_unlock_irqrestore(&zup->port.lock, flags);
+ return 0;
+}
#ifdef _USE_VEHICLE_DC
static void zx29_uart_console_putc(struct uart_port *port, const char c);
@@ -222,6 +330,54 @@
raw_spin_lock_irqsave(&zup->port.lock, *flags);
}
+
+int zx29_get_sleep_state(int uart_index)
+{
+ if(uart_index < 0 || uart_index > 2){
+ printk("invalid uart index\n");
+ return -1;
+ }
+
+ return zx29_uart_ports[uart_index].sleep_state;
+}
+EXPORT_SYMBOL_GPL(zx29_get_sleep_state);
+
+void zx29_set_sleep_state(int state, int uart_index)
+{
+ if(uart_index < 0 || uart_index > 2){
+ printk("invalid uart index\n");
+ return ;
+ }
+ printk(" uart %d, state change to:%d\n", uart_index, state);
+ zx29_uart_ports[uart_index].sleep_state = (state ? 1: 0);
+}
+EXPORT_SYMBOL_GPL(zx29_set_sleep_state);
+
+static ssize_t sleep_state_show(struct device *_dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+ struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+
+ return sprintf(buf, "\n wakeup_enable = %d\n",pdata->uart_wakeup_enable);
+}
+
+static ssize_t sleep_state_store(struct device *_dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ uint32_t flag = 0;
+ struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+ struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+ flag = simple_strtoul(buf, NULL, 16);
+ //pdata->uart_wakeup_enable = flag;
+ zx29_uart_ports[pdev->id].sleep_state = (flag ? 1: 0);
+ return count;
+}
+
+DEVICE_ATTR(sleep_state, S_IRUGO | S_IWUSR, sleep_state_show,
+ sleep_state_store);
+
/**
* Show the console_input attribute.
*/
@@ -299,6 +455,32 @@
DEVICE_ATTR(wakeup_enable, S_IRUGO | S_IWUSR, wakeup_enable_show,
wakeup_enable_store);
+
+static ssize_t app_ctrl_show(struct device *_dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+ //struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+
+ return sprintf(buf, "%d\n",zx29_uart_ports[pdev->id].app_ctrl);
+}
+
+static ssize_t app_ctrl_store(struct device *_dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ uint32_t flag = 0;
+ struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+ //struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+ flag = simple_strtoul(buf, NULL, 16);
+ // pdata->uart_wakeup_enable = flag;
+ zx29_uart_ports[pdev->id].app_ctrl = (flag == 0) ? 0 : 1;
+
+ return count;
+}
+DEVICE_ATTR(app_ctrl, S_IRUGO | S_IWUSR, app_ctrl_show,
+ app_ctrl_store);
+
int rxd_wake_cnt = 0;
static ssize_t statics_show(struct device *_dev,
struct device_attribute *attr, char *buf)
@@ -460,32 +642,6 @@
coreid_occupy_uart_store);
#endif
-#if CONFIG_SERIAL_ZX29_DMA
-static inline bool zx29_dma_tx_start(struct zx29_uart_port *zup);
-static inline void zx29_dma_tx_stop(struct zx29_uart_port *zup);
-static bool zx29_dma_tx_irq(struct zx29_uart_port *zup);
-static int zx29_uart_dma_tx_chars(struct zx29_uart_port *zup);
-void uart_dma_rx_callback(void *data);
-static void zx29_uart_dma_rx_chars(struct zx29_uart_port *zup,
- //u32 pending, bool use_buf_b,
- u32 pending, struct zx29_sgbuf *sgbuf,
- bool readfifo, unsigned long *flags);
-static inline void zx29_dma_rx_stop(struct zx29_uart_port *zup);
-static inline bool zx29_dma_rx_available(struct zx29_uart_port *zup);
-static inline bool zx29_dma_rx_running(struct zx29_uart_port *zup);
-static int zx29_dma_rx_trigger_dma(struct zx29_uart_port *zup);
-
-static void zx29_uart_rx_dma_chars(struct zx29_uart_port *zup, unsigned long *flags);
-dma_peripheral_id uart_get_rx_dma_peripheral_id(struct zx29_uart_port *zup);
-
-#if RX_DMA_WORK
-static void zx29_uart_rx_timeout_chars(struct zx29_uart_port *zup, unsigned long *flags);
-static inline bool zx29_dma_rx_work_scheduled(struct zx29_uart_port *zup);
-
-static void zx29_uart_rt_dma(struct zx29_uart_port *zup, unsigned long *flags);
-#endif
-
-
//extern int (*pm_callback_fn)(void);
#ifdef CONFIG_CPU_IDLE
typedef int (*pm_callback_fn)(void);
@@ -523,6 +679,8 @@
return 0;
}
#endif
+
+#if CONFIG_SERIAL_ZX29_DMA
/****************************************************************************/
#define ALIGN_DMA(size,align) (((unsigned int)(size)+align-1)&(~(align-1)))
@@ -777,7 +935,7 @@
pending = zup->sg2tty_len;
if(zx29_dma_rx_running(zup)){
-
+ test_uart_static(NULL, 0, 10, zup->port.line);
uart_mod_timer(zup, &flags);
}
/* Pick everything from the DMA first */
@@ -789,7 +947,7 @@
raw_spin_unlock_irqrestore(&zup->port.lock, flags);
dma_count = tty_insert_flip_string(tty,
zup->sg2tty->buf, pending);
-
+ test_uart_static(zup->sg2tty->buf, pending, 11, zup->port.line);
tty_flip_buffer_push(tty);
raw_spin_lock_irqsave(&zup->port.lock, flags);
@@ -842,7 +1000,7 @@
}
/****************************************************************************/
-static void zx29_uart_stop_rx(struct uart_port *port)
+void zx29_uart_stop_rx(struct uart_port *port)
{
struct zx29_uart_port *zup = container_of(port, struct zx29_uart_port, port);
@@ -889,7 +1047,7 @@
u32 status, ch, i = 0;
unsigned int flag, max_count = 256;
int fifotaken = 0;
- u32 uart_poll_char[6] ={0};
+ char uart_poll_char[16] ={0};
while (max_count--) {
status = UART_GET_FR(port);
@@ -946,6 +1104,9 @@
zup->port.icount.rx++;
if(zup->autobaud_state == UART_PORT_AUTOBAUD_OFF)
{
+ if(fifotaken < 16){
+ uart_poll_char[fifotaken] = ch & 0xFF;
+ }
fifotaken++;
if (unlikely(ch & UART_DR_ERROR)) {
@@ -980,7 +1141,7 @@
}
}
}
-
+ test_uart_static(uart_poll_char, fifotaken, 6, zup->port.line);
return fifotaken;
}
@@ -1234,15 +1395,7 @@
sgbuf = zup->dmarx.use_buf_b ?
&zup->dmarx.sgbuf_b : &zup->dmarx.sgbuf_a;
- /*
-
- sgbuf = zup->dmarx.use_buf_b ?
- &zup->dmarx.sgbuf_a : &zup->dmarx.sgbuf_b;
- */
-#if 0
- if(sgbuf == zup->curr_sg)
- panic("commit the same sg\n");
-#endif
+
zup->dmarx.rx_def[zup->dmarx.rx_index].link_addr=0;
zup->dmarx.rx_def[zup->dmarx.rx_index].dest_addr=(unsigned int)(sgbuf->sg.dma_address);
zup->dmarx.rx_def[zup->dmarx.rx_index].count=ZX29_DMA_BUFFER_SIZE;//fifo or max buffer?
@@ -1274,7 +1427,8 @@
zup->dmacr |= UART_RXDMAE;
UART_PUT_DMACR(&zup->port, zup->dmacr);
zup->dmarx.running = true;
- zup->imr &= ~UART_RXIM;
+ zup->dmarx.used = true;
+ zup->imr &= ~(UART_RXIM | UART_RTIM);
UART_PUT_IMSC(&zup->port,zup->imr);
return 0;
}
@@ -1291,119 +1445,37 @@
bool lastbuf;
int dma_count = 0;
-#if 0
-
- struct zx29_sgbuf *sgbuf = dmarx->use_buf_b ?
-
- &dmarx->sgbuf_b : &dmarx->sgbuf_a;
-
-#else
-
struct zx29_sgbuf *sgbuf = zup->curr_sg;
-#endif
-
size_t pending;
dma_peripheral_id rx_id = uart_get_rx_dma_peripheral_id(zup);
- zx29_dma_stop(rx_id);
+ zx29_dma_stop(rx_id);
- dev = zup->dmarx.chan->device->dev;
- zup->dmacr &= ~UART_RXDMAE;
- UART_PUT_DMACR(&zup->port,zup->dmacr);
-
-#if 1
- raw_spin_lock_irqsave(&zup->port.lock, flags);
-
-
-
- zup->sg2tty = sgbuf;
-
-
-
- zup->sg2tty_len = zup->sg2tty->sg.length - zx29_dma_get_transfer_num(rx_id);
-
- dmarx->use_buf_b = ! dmarx->use_buf_b;
-
- wmb();
-
- //BUG_ON(pending > ZX29_DMA_BUFFER_SIZE);
- /* Then we terminate the transfer - we now know our residue */
- //dmaengine_terminate_all(rxchan);
-
- zup->dmarx.running = false;
- zup->dmarx.used = false;
+ dev = zup->dmarx.chan->device->dev;
+ zup->dmacr &= ~UART_RXDMAE;
+ UART_PUT_DMACR(&zup->port,zup->dmacr);
- if (zx29_dma_rx_trigger_dma(zup)) {
- printk("rx_dma_chars RXDMA start fail\n");
- zup->imr |= UART_RXIM;
- UART_PUT_IMSC(&zup->port,zup->imr);
- }else{
- zup->pre_pending = 0;
- zup->dmarx.used = true;
- zup->work_state = true;
- }
- raw_spin_unlock_irqrestore(&zup->port.lock, flags);
-
-#endif
-#if 1
- up(&zup->sema);
-#else
- struct zx29_dmarx_data *dmarx = &zup->dmarx;
- struct dma_chan *rxchan = dmarx->chan;
- bool lastbuf = dmarx->use_buf_b;
- struct zx29_sgbuf *sgbuf = dmarx->use_buf_b ?
- &dmarx->sgbuf_b : &dmarx->sgbuf_a;
- size_t pending;
- struct dma_tx_state state;
- int ret;
- unsigned long flags;
- /*
- * This completion interrupt occurs typically when the
- * RX buffer is totally stuffed but no timeout has yet
- * occurred. When that happens, we just want the RX
- * routine to flush out the secondary DMA buffer while
- * we immediately trigger the next DMA job.
- */
raw_spin_lock_irqsave(&zup->port.lock, flags);
- /*
- * Rx data can be taken by the UART interrupts during
- * the DMA irq handler. So we check the residue here.
- */
- rxchan->device->device_tx_status(rxchan, dmarx->cookie, &state);
-
-
- pending = sgbuf->sg.length - state.residue;
- BUG_ON(pending > ZX29_DMA_BUFFER_SIZE);
- /* Then we terminate the transfer - we now know our residue */
- //dmaengine_terminate_all(rxchan);
-
+ zup->sg2tty = sgbuf;
+ zup->sg2tty_len = zup->sg2tty->sg.length - zx29_dma_get_transfer_num(rx_id);
+ dmarx->use_buf_b = ! dmarx->use_buf_b;
+ wmb();
zup->dmarx.running = false;
zup->dmarx.used = false;
- dmarx->use_buf_b = !lastbuf;
- //ret = zx29_dma_rx_trigger_dma(zup);
-
- zx29_uart_dma_rx_chars(zup, pending, lastbuf, false, &flags);
- zup->work_state = false;
- zup->pre_pending = 0;
- zup->imr |= UART_RXIM;
- UART_PUT_IMSC(&zup->port, zup->imr);
-
- raw_spin_unlock_irqrestore(&zup->port.lock, flags);
-#endif
- /*
- * Do this check after we picked the DMA chars so we don't
- * get some IRQ immediately from RX.
- */
- /*
- if (ret) {
- dev_dbg(zup->port.dev, "could not retrigger RX DMA job "
- "fall back to interrupt mode\n");
+ test_uart_static(NULL, 0, 9, zup->port.line);
+ if (zx29_dma_rx_trigger_dma(zup)) {
+ printk("rx_dma_chars RXDMA start fail\n");
zup->imr |= UART_RXIM;
- UART_PUT_IMSC(&zup->port, zup->imr);
- //writew(uap->im, uap->port.membase + UART011_IMSC);
+ UART_PUT_IMSC(&zup->port,zup->imr);
+ }else{
+ zup->pre_pending = 0;
+ zup->dmarx.used = true;
+ zup->work_state = true;
}
- */
+ raw_spin_unlock_irqrestore(&zup->port.lock, flags);
+
+ up(&zup->sema);
}
static inline void zx29_dma_rx_stop(struct zx29_uart_port *zup)
@@ -1413,6 +1485,12 @@
zup->dmacr &= ~UART_RXDMAE;
UART_PUT_DMACR(&zup->port,zup->dmacr);
zx29_dma_stop(rx_id);
+#if 0
+ //do we need check data received?
+ if(zup->pre_pending){
+ printk("pre_pending :%d\n ", zup->pre_pending);
+ }
+#endif
zup->curr_sg = NULL;
}
@@ -1680,38 +1758,20 @@
dma_count = tty_insert_flip_string(zup->port.state->port.tty,
sgbuf->buf, pending);
+ test_uart_static(sgbuf->buf, pending, 4, zup->port.line);
raw_spin_lock_irqsave(&zup->port.lock, *flags);
/* Return buffer to device */
dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
zup->port.icount.rx += dma_count;
-
- //if(zup->port.line == 0)
- // printk("yanming uart_dma_rx_chars, dma2tty:%d\n", dma_count);
+
if (dma_count < pending)
dev_info(zup->port.dev,
"couldn't insert all characters (TTY is full?)\n");
}
- /*
- * Only continue with trying to read the FIFO if all DMA chars have
- * been taken first.
- */
- //if (dma_count == pending && readfifo) {
- if ((pending > 0) && readfifo) {
- /* Clear any error flags */
- //UART_PUT_ICR(&zup->port,UART_OEIC | UART_BEIC | UART_PEIC | UART_FEIC);
- /*
- * If we read all the DMA'd characters, and we had an
- * incomplete buffer, that could be due to an rx error, or
- * maybe we just timed out. Read any pending chars and check
- * the error status.
- *
- * Error conditions will only occur in the FIFO, these will
- * trigger an immediate interrupt and stop the DMA job, so we
- * will always find the error in the FIFO, never in the DMA
- * buffer.
- */
+ if (readfifo) {
+ test_uart_static(NULL, 0, 5, zup->port.line);
fifotaken = zx29_uart_fifo_to_tty(zup);
//if(zup->port.line == 0)
// printk("yanming uart_dma_rx_chars, fifo2tty:%d\n", fifotaken);
@@ -1723,6 +1783,51 @@
}
}
+static void zx29_uart_deal_dma_fifo_rx_chars(struct zx29_uart_port *zup,
+ u32 pending, struct zx29_sgbuf *sgbuf,
+ unsigned long *flags, char *fifo_buf, int fifo_len)
+{
+ struct tty_struct *tty = zup->port.state->port.tty;
+
+ struct device *dev = zup->dmarx.chan->device->dev;
+ int dma_count = 0;
+ int fifo_count = 0;
+ u32 fifotaken = 0; /* only used for vdbg() */
+ if (pending) {
+ dma_sync_sg_for_cpu(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
+ raw_spin_unlock_irqrestore(&zup->port.lock, *flags);
+ dma_count = tty_insert_flip_string(&zup->port.state->port,
+ sgbuf->buf, pending);
+ test_uart_static(sgbuf->buf, pending, 6, zup->port.line);
+ raw_spin_lock_irqsave(&zup->port.lock, *flags);
+ dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
+ zup->port.icount.rx += dma_count;
+ if (dma_count < pending)
+ dev_info(zup->port.dev,
+ "couldn't insert all characters (TTY is full?)\n");
+ }
+
+ if(fifo_len){
+ printk("qq >> fifo len %d.\n",fifo_len);
+ fifo_count = tty_insert_flip_string(&zup->port.state->port,
+ fifo_buf, fifo_len);
+ printk("qq >>fifo count %d,buf is %x %x %x .\n",fifo_count, fifo_buf[0],fifo_buf[1],fifo_buf[2]);
+ fifo_buf[0] = '\0';
+ fifo_buf[1] = '\0';
+ fifo_buf[2] = '\0';
+ //memset(fifo_buf, '\0', 4);
+ }
+
+ zup->port.icount.rx += fifo_count;
+ test_uart_static(fifo_buf, fifo_count, 18,zup->port.line);
+ if(pending > 0 || (fifo_len > 0)){
+ raw_spin_unlock(&zup->port.lock);
+ tty_flip_buffer_push(&zup->port.state->port);
+ raw_spin_lock(&zup->port.lock);
+ }
+}
+
+
static void zx29_dma_rx_irq(struct zx29_uart_port *zup, unsigned long *flags)
{
struct zx29_dmarx_data *dmarx = &zup->dmarx;
@@ -1809,7 +1914,7 @@
if (zx29_dma_rx_available(zup)) {
if (zx29_dma_rx_trigger_dma(zup)) {
printk("rx_dma_chars RXDMA start fail\n");
- zup->imr |= UART_RXIM;
+ zup->imr |= UART_RXIM | UART_RTIM;
UART_PUT_IMSC(&zup->port,zup->imr);
}
#if RX_DMA_WORK
@@ -1838,20 +1943,8 @@
int fr = UART_GET_FR(&zup->port);
//printk("rx_timeout_chars\n");
-#if 0
- if((fr & UART_FR_RXBUSY) || ((fr & UART_FR_RXFE) == 0)){
- zx29_uart_rx_dma_chars(zup, flags);
- zup->dmarx.used = true;
- return;
- }
-#endif
+
rt_cnt = zx29_uart_fifo_to_tty(zup);
-#if 0
- //if(rt_cnt >= zup->port.fifosize){
- zx29_uart_rx_dma_chars(zup, flags);
- zup->dmarx.used = true;
- //}
-#endif
if(rt_cnt){
if(g_console_open_flag == 1 || zup->port.line != DEBUG_CONSOLE){
raw_spin_unlock(&zup->port.lock);
@@ -1865,18 +1958,7 @@
{
struct zx29_dmarx_data *dmarx = &zup->dmarx;
struct dma_chan *rxchan = dmarx->chan;
-
-#if 0
-
- struct zx29_sgbuf *sgbuf = dmarx->use_buf_b ?
- &dmarx->sgbuf_b : &dmarx->sgbuf_a;
-
-#else
-
struct zx29_sgbuf *sgbuf = zup->curr_sg;
-
-#endif
-
size_t pending;
struct dma_tx_state state;
enum dma_status dmastat;
@@ -1933,6 +2015,7 @@
* This will take the chars we have so far and insert
* into the framework.
*/
+ test_uart_static(NULL, 0, 3, zup->port.line);
zx29_uart_dma_rx_chars(zup, pending, sgbuf, true, flags);
}
@@ -1958,16 +2041,16 @@
#endif
}
+char g_fifo_residue_buf[4] = {'\0','\0','\0','\0'};
+char g_fifo_residue_all[20] = {0};
+unsigned char g_fifo_cnt = 0;
static void zx29_uart_rx_dma_timeout(struct zx29_uart_port *zup)
{
struct zx29_dmarx_data *dmarx = &zup->dmarx;
-
-
-
static bool dma_timeout_flag = false;
-
- size_t pending;
+ size_t pending, tmp_len;
uint32_t ris_status = 0;
+ int cancel_timer = 0;
int sg_idx = (dmarx->use_buf_b ? 1 : 0);
unsigned long flags;
@@ -1975,94 +2058,131 @@
if(!zx29_dma_rx_running(zup))
return;
+
raw_spin_lock_irqsave(&zup->port.lock, flags);
if(zup->port_close || (zup->curr_sg == NULL)){
raw_spin_unlock_irqrestore(&zup->port.lock, flags);
return;
}
-
+ if(zup->sg2tty) {//dma complete now, later check again
+ raw_spin_unlock_irqrestore(&zup->port.lock, flags);
+ //zup->pre_pending = pending;
+ test_uart_static(NULL, 0, 14, zup->port.line);
+ mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
+ return;
+ }
+
sgbuf = zup->curr_sg;
dma_peripheral_id rx_id = uart_get_rx_dma_peripheral_id(zup);
pending = sgbuf->sg.length - zx29_dma_get_transfer_num(rx_id);
- if(pending == zup->pre_pending){
-
- int fr = UART_GET_FR(&zup->port);
- //if RXBUSY,means data come again
-
- if((fr & UART_FR_RXBUSY)){// || (( fr & UART_FR_RXFE) == 0)){
-
- printk("RXBUSY, data come again\n");
-
- uart_mod_timer(zup, &flags);
-
- goto deal_end;
-
- }
- zup->imr &= ~UART_RXIM;
- UART_PUT_IMSC(&zup->port, zup->imr);
-
- ris_status = UART_GET_RIS(&zup->port);
-
- if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
- if(ris_status & UART_OEIS){
- zup->port.icount.overrun++;
- //if(!uart_console(&zup->port))
- //BUG_ON(1);
- }
- if(ris_status & UART_BEIS)
- zup->port.icount.brk++;
- if(ris_status & UART_PEIS)
- zup->port.icount.parity++;
- if(ris_status & UART_FEIS)
- zup->port.icount.frame++;
+ if(pending == zup->pre_pending){
+ int fr = UART_GET_FR(&zup->port);
+ //RXBUSY,means data come again
+ if((fr & UART_FR_RXBUSY)){// || (( fr & UART_FR_RXFE) == 0)){
+ uart_mod_timer(zup, &flags);
+ test_uart_static(NULL, 0, 12, zup->port.line);
+ goto deal_end;
+ }
- UART_PUT_ICR(&zup->port, (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS));
- }
+ zup->imr &= ~UART_RXIM;
+ UART_PUT_IMSC(&zup->port, zup->imr);
+ ris_status = UART_GET_RIS(&zup->port);
+ if(ris_status & (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS)){
+ if(ris_status & UART_OEIS){
+ zup->port.icount.overrun++;
+ //if(!uart_console(&zup->port))
+ //BUG_ON(1);
+ }
+ if(ris_status & UART_BEIS)
+ zup->port.icount.brk++;
+ if(ris_status & UART_PEIS)
+ zup->port.icount.parity++;
+ if(ris_status & UART_FEIS)
+ zup->port.icount.frame++;
+
+ UART_PUT_ICR(&zup->port, (UART_OEIS | UART_BEIS | UART_PEIS | UART_FEIS));
+ }
-
-
-
- //if(zx29_dma_stop(rx_id))
- // printk("unable to pause DMA transfer\n");
- /* Disable RX DMA - incoming data will wait in the FIFO */
zup->dmacr &= ~UART_RXDMAE;
UART_PUT_DMACR(&zup->port,zup->dmacr);
zx29_dma_stop(rx_id);
zup->dmarx.running = false;
zup->dmarx.used = false;
-
- zup->imr |= (UART_RTIM|UART_RXIM);
- UART_PUT_IMSC(&zup->port, zup->imr);
- pending = sgbuf->sg.length - zx29_dma_get_transfer_num(rx_id);
- dmarx->use_buf_b = !dmarx->use_buf_b;
- wmb();
- if(pending){
- zx29_uart_dma_rx_chars(zup, pending, sgbuf, false, &flags);
- }
- zup->pre_pending = 0;
- zup->work_state = false;
- if((UART_GET_RIS(&zup->port) & (UART_RXIS | UART_RTIS)) ||
- (UART_GET_FR(&zup->port) & UART_FR_RXBUSY)){
- zup->imr &= ~(UART_RXIM);
- UART_PUT_IMSC(&zup->port, zup->imr);
- // zx29_dma_rx_irq(zup, &flags);
+ int i;
- if (zx29_dma_rx_trigger_dma(zup)) {
- printk("uart%d could not retrigger RX DMA job\n",zup->port.line);
- zup->imr |= UART_RXIM;
- UART_PUT_IMSC(&zup->port, zup->imr);
-#if RX_DMA_WORK
+
+ for(i= 0;i < 3;i++){
+ fr = UART_GET_FR(&zup->port);
+ if((fr & UART_FR_RXFE) == 0){
+ g_fifo_residue_buf[i] = UART_GET_CHAR(&zup->port) | UART_DUMMY_DR_RX;
+ g_fifo_residue_all[g_fifo_cnt++] = g_fifo_residue_buf[i];
+ if(g_fifo_cnt >= 20) g_fifo_cnt = 0;
+ }
+ else
+ break;
+ }
+ if(i){
+ g_fifo_residue_all[g_fifo_cnt++]=i;
+ if(g_fifo_cnt >= 20) g_fifo_cnt = 0;
+ }
+
+ //zup->sg2tty = sgbuf;
+ tmp_len = sgbuf->sg.length - zx29_dma_get_transfer_num(rx_id);
+
+ if(tmp_len != pending){
+ pending = tmp_len;
+ }
+
+ dmarx->use_buf_b = !dmarx->use_buf_b;
+ wmb();
+ //when app ctrl sleep ,always start dma receive
+ if(zup->uart_power_mode){
+ if(zup->sleep_state == 0){
+ //now start dma again
+ if (zx29_dma_rx_trigger_dma(zup)) {
+ printk("rx_dma_chars RXDMA start fail\n");
+ zup->imr |= UART_RXIM;
+ UART_PUT_IMSC(&zup->port,zup->imr);
+ }else{
+ uart_mod_timer(zup, &flags);
+ zup->pre_pending = 0;
+ zup->dmarx.used = true;
+ zup->work_state = true;
+ }
+
+ if(pending || (i > 0)){
+ test_uart_static(zup->port.line, NULL, 0, 13);
+ zx29_uart_deal_dma_fifo_rx_chars(zup, pending, sgbuf, &flags, g_fifo_residue_buf,i);
+ }
}
- else{
- // mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
- uart_mod_timer(zup, &flags);
- zup->pre_pending = 0;
- zup->work_state = true;
- zup->dmarx.used = true;
- UART_PUT_ICR(&zup->port,(UART_RTIS|UART_RXIS));
-#endif
+ }else{
+ //for normal mode, dma start only on rx busy after timeout came
+ if(pending || (( fr & UART_FR_RXFE) == 0)){
+ test_uart_static(NULL, 0, 13, zup->port.line);
+ zx29_uart_dma_rx_chars(zup, pending, sgbuf, true, &flags);
+ }
+ zup->imr |= (UART_RTIM|UART_RXIM);
+ UART_PUT_IMSC(&zup->port, zup->imr);
+ zup->pre_pending = 0;
+ zup->work_state = false;
+ if((UART_GET_RIS(&zup->port) & (UART_RXIS | UART_RTIS)) ||
+ (UART_GET_FR(&zup->port) & UART_FR_RXBUSY)){
+ zup->imr &= ~(UART_RXIM);
+ UART_PUT_IMSC(&zup->port, zup->imr);
+
+ if (zx29_dma_rx_trigger_dma(zup)) {
+ printk("rx_dma_chars RXDMA start fail\n");
+ zup->imr |= (UART_RTIM|UART_RXIM);
+ UART_PUT_IMSC(&zup->port,zup->imr);
+ }else{
+ uart_mod_timer(zup, &flags);
+ zup->pre_pending = 0;
+ zup->dmarx.used = true;
+ zup->work_state = true;
+ UART_PUT_ICR(&zup->port,(UART_RTIS|UART_RXIS));
+ }
}
}
@@ -2134,9 +2254,12 @@
zup->imr |= UART_RTIM;
UART_PUT_IMSC(port,zup->imr);
}
+
+ test_uart_static(NULL, 0, 8, zup->port.line);
uart_mod_timer(zup, &flags);
}else{
+ test_uart_static(NULL, 0, 1, zup->port.line);
zx29_uart_rx_dma_chars(zup, &flags);
zup->dmarx.used = true;
//when RX&RT comes both, we trigger dma and add timer,so clear RT,waiting the timer
@@ -2150,9 +2273,11 @@
if (status & (UART_RTIS)){
#if CONFIG_SERIAL_ZX29_DMA
if(!zx29_dma_rx_running(zup)){
+ test_uart_static(NULL, 0, 2, zup->port.line);
zx29_uart_rx_timeout_chars(zup, &flags);
}else{
- UART_PUT_ICR(port, UART_RTIS);
+ UART_PUT_ICR(port, UART_RTIS);
+ test_uart_static(NULL, 0, 7, zup->port.line);
zx29_uart_rt_dma(zup, &flags);
}
#else
@@ -2345,18 +2470,23 @@
/* Turn on DMA error (RX/TX will be enabled on demand) */
- //zup->dmacr &= ~UART_DMAONERR;
- zup->dmacr |= UART_DMAONERR;
+ zup->dmacr &= ~UART_DMAONERR;
+ //zup->dmacr |= UART_DMAONERR;
UART_PUT_DMACR(&zup->port, zup->dmacr);
-/*
- if (zup->using_rx_dma) {
-
- printk(KERN_INFO "[%s][%d]\n",__func__,__LINE__);
- if (zx29_dma_rx_trigger_dma(zup))
- dev_dbg(zup->port.dev, "could not trigger initial "
- "RX DMA job, fall back to interrupt mode\n");
+ if(zup->uart_power_mode){
+ if (zup->using_rx_dma) {
+ //printk(KERN_INFO "[%s][%d]\n",__func__,__LINE__);
+ if (zx29_dma_rx_trigger_dma(zup)){
+ dev_dbg(zup->port.dev, "could not trigger initial "
+ "RX DMA job, fall back to interrupt mode\n");
+ }else{
+ mod_timer(&(zup->rx_dma_timer), jiffies + RX_DMA_TIMEOUT);
+ zup->pre_pending = 0;
+ zup->work_state = true;
+ }
+ }
}
-*/
+
}
@@ -2405,6 +2535,15 @@
wmb();
#endif
+ if(DEBUG_CONSOLE != pdev->id){
+ //app ctrl or kernel ctrl set this
+ int kernel_ctrl = 0;
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ kernel_ctrl = xp2xp_enable_4line();
+#endif
+ zup->uart_power_mode = (kernel_ctrl | zup->app_ctrl);
+
+ }
//when open, clear last statistic info
port->icount.brk = port->icount.buf_overrun = port->icount.frame = 0;
port->icount.overrun = port->icount.parity = port->icount.rng = 0;
@@ -2600,83 +2739,19 @@
raw_spin_lock_irqsave(&zup->port.lock, flags);
/* Clear out any spuriously appearing RX interrupts */
UART_PUT_ICR(port, (UART_RTIS | UART_RXIS));
-
- zup->imr = UART_RTIM | UART_RXIM;
- UART_PUT_IMSC(port, zup->imr);
-
+ //when dma not running,set UART_RTIM | UART_RXIM
+ if(!zx29_dma_rx_running(zup)){
+ zup->imr = UART_RTIM | UART_RXIM;
+ UART_PUT_IMSC(port, zup->imr);
+ }
+#if 0
+ if(port->line == 2){
+ zup->imr = UART_RTIM;
+ UART_PUT_IMSC(port, zup->imr);
+ }
+#endif
zup->port_close = false;
raw_spin_unlock_irqrestore(&zup->port.lock, flags);
-#if 0
- if(zup->autobaud)
- {
- //printk("enter autobaud \n");
- zup->autobaud_state = UART_PORT_AUTOBAUD_ON;
-
- if(pdev->id == UART1)
- zup->baudrate = UART1_AUTOBAUD_RATE;
- else
- zup->baudrate = UART_AUTOBAUD_RATE;
-
- ibrd = port->uartclk / (zup->baudrate <<4);
- fbrd = ((port->uartclk % (zup->baudrate <<4) )*8 + zup->baudrate )/(2*zup->baudrate );
- UART_PUT_FBRD(port, fbrd);
- UART_PUT_IBRD(port, ibrd);
- lcr_h = UART_LCRH_WLEN_8 | UART_LCRH_FEN ;
- old_cr = UART_GET_CR(port);
- UART_PUT_CR(port, 0);
- UART_PUT_LCRH(port, lcr_h);
- UART_PUT_CR(port, old_cr);
- msleep(1);
-
- while(!uart_port_autobaud_suflag)
- {
- while(!uart_port_autobaud_gtflag)
- {
- msleep(2);
- }
-
- for(i=0;i<UART_AUTOBAUD_LEVEL;i++)
- {
- for(j=0;j<UART_AUTOBAUD_CHECKBYTE;j++)
- {
- if((j ==0)&&(uart_port_autobaud_buffer[0] == UART_baud_check[i][j]))
- {
- j++;
- if(uart_port_autobaud_buffer[1] == UART_baud_check[i][j])
- {
- zup->baudrate = UART_baud[i];
- iflag = i;
- uart_port_autobaud_suflag = 1;
- break;
- }
- }
- if((j ==2 )&&(uart_port_autobaud_buffer[0] == UART_baud_check[i][j]))
- {
- j++;
- if(uart_port_autobaud_buffer[1] == UART_baud_check[i][j])
- {
- zup->baudrate = UART_baud[i];
- iflag = i;
- uart_port_autobaud_suflag = 1;
- break;
- }
- }
- }
- if(uart_port_autobaud_suflag)
- break;
- }
-
- zup->port.icount.rx = 0;
- uart_port_autobaud_gtflag = 0;
-
- }
- uart_port_autobaud_suflag = 0;
- tty->termios->c_cflag &= ~CBAUD;
- tty->termios->c_cflag |= UART_termios_cflag[iflag];
- tty->termios->c_ispeed = zup->baudrate;
- tty->termios->c_ospeed = zup->baudrate;
- }
-#endif
return 0;
}
@@ -2695,7 +2770,7 @@
raw_spin_lock_irqsave(&port->lock, flags);
#if RX_DMA_WORK
if(zx29_dma_rx_work_scheduled(zup)){
- del_timer(&(zup->rx_dma_timer));
+ del_timer_sync(&(zup->rx_dma_timer));
zup->work_state = 0;
}
#endif
@@ -2995,44 +3070,25 @@
unsigned int offset=(unsigned int)(pdev->id);
struct clk *pclk=NULL;
struct clk *wclk=NULL;
-#if 0
-//following code just a demo,may be we should use NEW_LINUX_FRAME
-#ifdef CONSOLE_UART0
- /* config uart apb_clk */
- if(pdev->id == DEBUG_CONSOLE)
- {
-#if NEW_LINUX_FRAME
- pclk = clk_get(CONSOLE_NAME, "uart0_pclk");
- wclk = clk_get(CONSOLE_NAME, "uart0_wclk");
-#else
- pclk = clk_get_sys(CONSOLE_NAME, "apb_clk");
- wclk = clk_get_sys(CONSOLE_NAME, "work_clk");
-#endif
- }
- else if(pdev->id == UART1)
- {
- pclk=clk_get_sys(UART1_NAME, "apb_clk");
- wclk=clk_get_sys(UART1_NAME, "work_clk");
- }else if(pdev->id == UART2)
- {
- pclk = clk_get_sys(UART2_NAME, "apb_clk");
- wclk = clk_get_sys(UART2_NAME, "work_clk");
- }
-#endif
-
-#else
+ int ret = 0;
pclk = clk_get_sys(uart_names[pdev->id], "apb_clk");
wclk = clk_get_sys(uart_names[pdev->id], "work_clk");
-#endif
if (IS_ERR(pclk))
panic("failed to get uart_pclk.\n");
zx29_port->busclk=pclk; /*get apb clock*/
if (IS_ERR(wclk))
panic("failed to get uart_wclk.\n");
zx29_port->wclk=wclk; /*get work clock*/
-
+#if 0
+ if(pdev->id == 0){
+ ret = clk_set_rate(wclk, 104 *1000 * 1000);
+ if(ret){
+ printk("change uart0 to 104M fail,%d\n", ret);
+ }
+ }
+#endif
port->line = offset;
port->type = PORT_ZX29;
port->fifosize = UART_TXFIFO_SIZE;
@@ -3065,6 +3121,9 @@
/* enable uart work clock */
clk_prepare_enable(zx29_port->wclk);
}
+#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
+ zx29_port->wakeup_notifier.notifier_call = uart_wakeup_callback;
+#endif
}
@@ -3086,6 +3145,10 @@
/****************************************************************************/
static void zx29_uart_console_write(struct console *co, const char *s, unsigned int count)
{
+#ifdef CONFIG_PREEMPT_RT_FULL
+ if(current->prio <= 62)
+ return;
+#endif
struct uart_port *port = &zx29_uart_ports[co->index].port;
#if 0
if(!g_console_open_flag)
@@ -3103,7 +3166,7 @@
#else
static void zx29_uart_console_putc_share(struct uart_port *port, const char c)
{
- if(g_core_id_occupy_uart == SYMB_CAP_CORE_ID)
+ if((g_core_id_occupy_uart == SYMB_CAP_CORE_ID) && (g_up_init_done == 1))
return;
int ret = soft_spin_lock_printf(UART_SFLOCK);
if(ret)
@@ -3311,6 +3374,9 @@
if(pdev->id != DEBUG_CONSOLE){
error = device_create_file(&pdev->dev, &dev_attr_ctsrts_input);
error = device_create_file(&pdev->dev, &dev_attr_wakeup_enable);
+ error = device_create_file(&pdev->dev, &dev_attr_sleep_state);
+ error = device_create_file(&pdev->dev, &dev_attr_app_ctrl);
+
}
error = device_create_file(&pdev->dev, &dev_attr_statics);
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c b/ap/os/linux/linux-3.4.x/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c
index 7c5c9e8..bb2f91f 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c
@@ -618,6 +618,11 @@
dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts);
USBHAL_DBG("usb suspend");
+ /* Clear interrupt */
+ gintsts.d32 = 0;
+ gintsts.b.usbsuspend = 1;
+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32);
+
#if 1
//copy from dwc2
if(!dsts.b.suspsts){
@@ -634,11 +639,6 @@
Ep_Reset_InEndpoint(core_if,i);
}
#endif
- /* Clear interrupt */
- gintsts.d32 = 0;
- gintsts.b.usbsuspend = 1;
- DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32);
-
/* PCD callback for suspend. Release the lock inside of callback function */
cil_pcd_suspend(core_if);
dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg);
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/adb_server.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/adb_server.c
index 832c5e8..8bd460f 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/adb_server.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/adb_server.c
@@ -28,6 +28,7 @@
#include <linux/miscdevice.h>
#include <linux/soc/zte/rpm/rpmsg.h>
#include <linux/soc/zte/rpm/icp.h>
+#include <linux/android_notify.h>
#define ADB_BULK_BUFFER_SIZE 4096
#define ADB_AGENT_BUF_SIZE 640
@@ -36,6 +37,7 @@
struct adb_dev *g_adb_agent;
ssize_t adb_server_write2usb( const char *buf,size_t count);
+extern void usb_rpmsg_notify_ap(usb_rpmsg_cmd *notify, int has_param);
void adb_recv_from_ap(void *buf, unsigned int len)
{
@@ -341,7 +343,17 @@
return 0;
}
#endif
-static int adb_agent_close(void)
+
+void adb_agent_dequeue_rx(struct adb_dev *dev)
+{
+
+ if (dev->agent_start){
+ printk("adb_agent_dequeue_rx agent_start dequeue\n");
+ usb_ep_dequeue(dev->ep_out, dev->rx_req);
+
+ }
+}
+int adb_agent_close(void)
{
int ret;
//pr_info("adb_release\n");
@@ -390,7 +402,8 @@
WARN_ON(1);
}
}
- //adb_unlock(&g_adb_agent->open_excl);
+ if(atomic_read(&g_adb_agent->open_excl))
+ adb_unlock(&g_adb_agent->open_excl);
return 0;
}
@@ -419,16 +432,19 @@
USBSTACK_DBG("adb_agent_monitor_thread,got, agent_switch:%d, agent_state:%d\n",
atomic_read(&dev->agent_switch), dev->agent_state);
atomic_set(&dev->agent_switch, 0);
- if(dev->agent_state){//enable agent
+ if(dev->agent_state){//enable agent
+ adb_server_plug_notify(USB_RPMSG_NOTIFY_ADB_ONLINE);
dev->agent_start = 1;
dev->agt_error = 0;
//wake_up(&dev->agt_start_wait);
//wakeup adb read and return
- dev->rx_done = 1;
- wake_up(&dev->read_wq);
+ //dev->rx_done = 1;
+ //wake_up(&dev->read_wq);
+ adb_agent_dequeue_rx(dev);
}else{
//dev->agent_start = 0;
//disable agent
+ adb_server_plug_notify(USB_RPMSG_NOTIFY_ADB_OFFLINE);
adb_agent_close();
}
@@ -453,10 +469,11 @@
{
if(!g_adb_agent){
printk("adb_enable_rpmsg_agent, adb is NULL, fail\n");
+ return -1;
}
g_adb_agent->agent_state = ((flag != 0) ? 1 : 0);
atomic_set(&g_adb_agent->agent_switch, 1);
- USBSTACK_DBG("adb_enable_rpmsg_agent,now %s adb agent\n", (g_adb_agent->agent_state == 1) ? "start" : "stop");
+ printk("adb_enable_rpmsg_agent,now %s adb agent\n", (g_adb_agent->agent_state == 1) ? "start" : "stop");
//do switch agent in monitor thread
wake_up(&g_adb_agent->agent_monitor_wq);
return 0;
@@ -518,7 +535,7 @@
printk("rpmsg_recv ep-queue fail ret:%d", r);
goto done;
} else {
- pr_debug("rx %p queue\n", req);
+ USBSTACK_DBG("rx %p queue\n", req);
}
atomic_set(&dev->agt_read_flag, 1);
@@ -533,7 +550,7 @@
dev->agt_error = 1;
r = ret;
usb_ep_dequeue(dev->ep_out, req);
- printk("rpmsg_recv stop ret: 0x%x", ret);
+ USBSTACK_DBG("rpmsg_recv stop ret: 0x%x", ret);
goto done;
}
if (!dev->agt_error) {
@@ -547,7 +564,7 @@
printk("rpmsg_recv actual is 0, requeue_req again\n");
goto requeue_req;
}
- USBSTACK_DBG("rpmsg_recv rx %p actual:%d\n", req, req->actual);
+ printk("rpmsg_recv rx %p actual:%d\n", req, req->actual);
xfer = req->actual;
r = adb_rpmsg_write2ap(req->buf, xfer);
@@ -562,7 +579,7 @@
r = -EIO;
dev->rx_done = 0;
}else{
- USBSTACK_DBG("adb_rpmsg_write wake_up agt_read_wq, len:%d, status:%d\n", req->actual, req->status);
+ printk("adb_rpmsg_write wake_up agt_read_wq, len:%d, status:%d\n", req->actual, req->status);
wake_up(&dev->agt_read_wq);
}
@@ -577,7 +594,13 @@
}
}
-
+void adb_server_plug_notify(e_usb_rpmsg_cmd_type plug_type)
+{
+ usb_rpmsg_cmd notify;
+ memset(¬ify, 0, sizeof(notify));
+ notify.cmd = plug_type;
+ usb_rpmsg_notify_ap(¬ify, 0);
+}
int adb_server_init(struct adb_dev *dev)
{
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/android.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/android.c
index 1ec687f..4a2e122 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/android.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/android.c
@@ -265,6 +265,7 @@
zDrvNand_WriteBootflag(1);
#endif
usb_notify_up(USB_SWITCH_DEBUG,NULL);
+ usb_record_dbginfo(USB_SWITCH_TO_DEBUG, 0, 0);
}
break;
@@ -287,14 +288,17 @@
zDrvNand_WriteBootflag(1);
#endif
usb_notify_up(USB_SWITCH_USER, NULL);
+ usb_record_dbginfo(USB_SWITCH_TO_USER, 0, 0);
break;
case USB_SWITCH_to_FACTORY:
usb_notify_up(USB_SWITCH_FACTORY, NULL);
+ usb_record_dbginfo(USB_SWITCH_TO_FACTORY, 0, 0);
break;
case USB_SWITCH_to_AMT:
usb_notify_up(USB_SWITCH_AMT, NULL);
+ usb_record_dbginfo(USB_SWITCH_TO_AMT, 0, 0);
break;
case USB_SWITCH_to_EYE_DIAGRAM:
usb_notify_up(USB_SWITCH_EYE_DIAGRAM, NULL);
@@ -3132,7 +3136,39 @@
break;
//usb_set_rpmsg_resp(t_cmd->cmd, usb_resp);
- //case:
+ case USB_RPMSG_GET_USB_ENUM_MODE:
+ t_resp->cmd = USB_RPMSG_GET_USB_ENUM_MODE;
+ switch(usb_cur_enum_mode){
+ case USB_ENUM_MODE_DEBUG:
+ sprintf(t_resp->param, "%s\n","debug mode");
+
+ break;
+ case USB_ENUM_MODE_USER:
+ sprintf(t_resp->param, "%s\n","user mode");
+
+ break;
+ case USB_ENUM_MODE_FACTORY:
+ sprintf(t_resp->param, "%s\n","factory mode");
+
+ break;
+ case USB_ENUM_MODE_AMT:
+ sprintf(t_resp->param, "%s\n","amt mode");
+ break;
+ case USB_ENUM_MODE_EYE_DIAGRAM:
+ sprintf(t_resp->param, "%s\n","eye test mode");
+ break;
+ default:
+ sprintf(t_resp->param, "%s\n","invalid mode");
+ break;
+
+ }
+
+ break;
+ //case :
+ // break;
+ //case :
+ // break;
+ //case :
// break;
default:
break;
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_adb.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_adb.c
index 0a0bb6d..4c263e6 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_adb.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_adb.c
@@ -28,6 +28,7 @@
#include <linux/miscdevice.h>
#ifdef _USE_VEHICLE_DC
#include <linux/soc/zte/rpm/rpmsg.h>
+#include <linux/android_notify.h>
#endif
#define ADB_BULK_BUFFER_SIZE 4096
@@ -35,6 +36,9 @@
#define TX_REQ_MAX 4
#ifdef _USE_VEHICLE_DC
extern int adb_rpmsg_write2ap(void *buf, unsigned int len);
+extern int adb_agent_close(void);
+extern void adb_server_plug_notify(e_usb_rpmsg_cmd_type plug_type);
+
#endif
static const char adb_shortname[] = "android_adb";
@@ -350,7 +354,7 @@
if (ret < 0) {
if (ret != -ERESTARTSYS)
dev->error = 1;
- printk("adb_read wait agt_read_wq fail ret: 0x%x", ret);
+ USBSTACK_DBG("adb_read wait agt_read_wq fail ret: 0x%x", ret);
goto done;
}
@@ -369,7 +373,7 @@
req->length = count;
dev->rx_done = 0;
if(!dev->online){
- printk("adb_read dev is offline\n");
+ USBSTACK_DBG("adb_read dev is offline\n");
r = -EIO;
goto done;
}
@@ -379,7 +383,7 @@
pr_debug("adb_read: failed to queue req %p (%d)\n", req, ret);
r = -EIO;
dev->error = 1;
- printk("adb_read ep-queue fail ret:%d", r);
+ USBSTACK_DBG("adb_read ep-queue fail ret:%d", r);
goto done;
} else {
pr_debug("rx %p queue\n", req);
@@ -396,7 +400,7 @@
dev->error = 1;
r = ret;
usb_ep_dequeue(dev->ep_out, req);
- printk("adb_read stop ret: 0x%x", ret);
+ USBSTACK_DBG("adb_read stop ret: 0x%x", ret);
goto done;
}
@@ -405,7 +409,7 @@
#endif
if (!dev->error) {
if(!dev->online){
- printk("adb_read dev is offline cannot requeue req\n");
+ USBSTACK_DBG("adb_read dev is offline cannot requeue req\n");
r = -EIO;
goto done;
}
@@ -420,6 +424,7 @@
goto requeue_req;
}
USBSTACK_DBG("adb_read rx %p len:%d\n", req, req->actual);
+
xfer = (req->actual < count) ? req->actual : count;
#ifdef _USE_VEHICLE_DC
r = xfer;
@@ -432,7 +437,7 @@
r = -EFAULT;
} else{
- printk("adb_read fail %d", r);
+ USBSTACK_DBG("adb_read fail %d", r);
r = -EIO;
}
@@ -490,7 +495,7 @@
break;
}
if(dev->error){
- printk("get an err, break write\n");
+ USBSTACK_DBG("get an err, break write\n");
r = -EIO;
break;
}
@@ -543,9 +548,10 @@
}
#endif
USBSTACK_DBG("%s", __func__);
- if (adb_lock(&_adb_dev->open_excl))
+ if (adb_lock(&_adb_dev->open_excl)){
+ printk("\n adb_open,open_excl:%d\n", atomic_read(&_adb_dev->open_excl));
return -EBUSY;
-
+ }
fp->private_data = _adb_dev;
/* clear the error latch */
@@ -557,7 +563,9 @@
_adb_dev->online = 1;
wake_up(&_adb_dev->read_wq);
}
+ usb_record_dbginfo(USB_DEV_OPEN, 0, 3);
+ printk("\n adb_open--ok--exit\n");
return 0;
}
@@ -583,7 +591,8 @@
WARN_ON(1);
}
}
- //if(atomic_read(&_adb_dev->read_excl)){
+ if(atomic_read(&_adb_dev->read_excl)){
+ //if(_adb_dev->ep_out){
printk("adb_release, disable and reenable ep_out\n");
ret = usb_ep_disable(_adb_dev->ep_out);
if(ret){
@@ -596,8 +605,10 @@
WARN_ON(1);
}
+ }
+ if(atomic_read(&_adb_dev->read_excl))
adb_unlock(&_adb_dev->open_excl);
- //}
+
#ifdef _USE_VEHICLE_DC
if(_adb_dev->agent_state){
wake_up(&_adb_dev->agt_start_wait);
@@ -606,6 +617,7 @@
}
#endif
+ usb_record_dbginfo(USB_DEV_CLOSE, 0, 3);
return 0;
}
@@ -711,6 +723,11 @@
usb_ep_disable(dev->ep_in);
return ret;
}
+#ifdef _USE_VEHICLE_DC
+ //maybe need clear adb server state
+ adb_agent_close();
+#endif
+ schedule_work(&dev->online_inform);
if(adb_lock(&dev->enable_excl))
return 0;
@@ -748,6 +765,15 @@
usb_ep_disable(dev->ep_in);
usb_ep_disable(dev->ep_out);
+
+#ifdef _USE_VEHICLE_DC
+ adb_server_plug_notify(USB_RPMSG_NOTIFY_ADB_OFFLINE);
+ dev->agent_start = 0;
+ dev->agent_state = 0;
+ dev->agt_error = 0;
+#endif
+
+ schedule_work(&dev->offline_inform);
/* readers may be blocked waiting for us to go online */
wake_up(&dev->read_wq);
@@ -766,6 +792,7 @@
dev->suspend_state = 1;
// adb_function_disable(f);
usb_ep_disable(dev->ep_in);
+ usb_record_dbginfo(USB_DEV_SUSPEND, 0, 3);
// usb_ep_disable(dev->ep_out);
}
static void adb_function_resume(struct usb_function *f)
@@ -780,6 +807,7 @@
usb_ep_resume_enable(dev->ep_in);
// usb_ep_enable(dev->ep_out);
dev->suspend_state = 0;
+ usb_record_dbginfo(USB_DEV_RESUME, 0, 3);
}
#endif
static int adb_bind_config(struct usb_configuration *c)
@@ -807,15 +835,18 @@
void adb_online_inform_work(struct work_struct *work)
{
struct adb_dev *dev = container_of(work, struct adb_dev, online_inform);
-
+ printk("adb_online_inform_work\n");
kobject_uevent(&adb_device.this_device->kobj, KOBJ_ONLINE);
+ usb_record_dbginfo(USB_DEV_ONLINE, 0, 3);
}
void adb_offline_inform_work(struct work_struct *work)
{
struct adb_dev *dev = container_of(work, struct adb_dev, offline_inform);
+ printk("adb_offline_inform_work\n");
kobject_uevent(&adb_device.this_device->kobj, KOBJ_OFFLINE);
+ usb_record_dbginfo(USB_DEV_OFFLINE, 0, 3);
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_ecm.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_ecm.c
index bd0914d..cef826d 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_ecm.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_ecm.c
@@ -696,6 +696,7 @@
// usb_ep_disable((&ecm->port)->out_ep);
usb_ep_disable(ecm->notify);
gether_uevent_eth_ecm(&ecm->port,0);
+ usb_record_dbginfo(USB_DEV_SUSPEND, 0, 1);
}
static void ecm_resume(struct usb_function *f)
@@ -714,6 +715,7 @@
// usb_ep_enable((&ecm->port)->out_ep);
ecm->port.suspend_state = 0;
gether_uevent_eth_ecm(&ecm->port,1);
+ usb_record_dbginfo(USB_DEV_RESUME, 0, 1);
}
#endif
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_rndis.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_rndis.c
index d58b4c6..0cfd7b3 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_rndis.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_rndis.c
@@ -691,6 +691,7 @@
// usb_ep_disable((&rndis->port)->out_ep);
usb_ep_disable(rndis->notify);
gether_uevent_eth_rndis(&rndis->port);
+ usb_record_dbginfo(USB_DEV_SUSPEND, 0, 1);
}
static void rndis_resume(struct usb_function *f)
{
@@ -709,6 +710,7 @@
usb_ep_resume_enable((&rndis->port)->in_ep);
// usb_ep_enable((&rndis->port)->out_ep);
rndis->port.suspend_state = 0;
+ usb_record_dbginfo(USB_DEV_RESUME, 0, 1);
}
#endif
/*-------------------------------------------------------------------------*/
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_serial.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_serial.c
index bdabc1f..27d2e71 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_serial.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/f_serial.c
@@ -214,6 +214,7 @@
gser->port.suspend_state = 1;
// usb_ep_disable((&gser->port)->out);
usb_ep_disable((&gser->port)->in);
+ usb_record_dbginfo(USB_DEV_SUSPEND, 0, 2);
}
static void gser_resume(struct usb_function *f)
{
@@ -229,6 +230,7 @@
// usb_ep_enable((&gser->port)->out);
gserial_connect_ext(&gser->port);
gser->port.suspend_state = 0;
+ usb_record_dbginfo(USB_DEV_RESUME, 0, 2);
}
#endif
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
index c910279..5f9d709 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_ether.c
@@ -614,10 +614,12 @@
if(dev->eth_state == 1){
kobject_uevent(&dev->net->dev.kobj, KOBJ_ONLINE);
dev->work_state = 1;
+ usb_record_dbginfo(USB_DEV_ONLINE, 0, 1);
}
else{
dev->work_state = 0;
kobject_uevent(&dev->net->dev.kobj, KOBJ_OFFLINE);
+ usb_record_dbginfo(USB_DEV_OFFLINE, 0, 1);
}
usb_printk("%s:%d Ether uevent %d %s\n", __func__, __LINE__, (dev->eth_state), (dev->eth_state) ? "ONLINE":"OFFLINE");
@@ -935,6 +937,7 @@
if (link && link->open)
link->open(link);
spin_unlock_irq(&dev->lock);
+ usb_record_dbginfo(USB_DEV_OPEN, 0, 1);
return 0;
}
@@ -992,6 +995,7 @@
}
spin_unlock_irqrestore(&dev->lock, flags);
+ usb_record_dbginfo(USB_DEV_CLOSE, 0, 1);
return 0;
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
index 978a1b0..b2ab988 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/u_serial.c
@@ -176,6 +176,7 @@
g_bUsbDevHotAdd[port->port_num] = true;
#endif
#endif
+ usb_record_dbginfo(USB_DEV_ONLINE, 0, 2);
usb_printk("%s,ttyGS%d,end\n",__func__,port->port_num);
#endif
}
@@ -193,6 +194,7 @@
#endif
#endif
usb_printk("%s,ttyGS%d,end\n",__func__,port->port_num);
+ usb_record_dbginfo(USB_DEV_OFFLINE, 0, 2);
#endif
}
@@ -1046,6 +1048,7 @@
pr_debug("gs_open: ttyGS%d (%p,%p)\n", port->port_num, tty, file);
status = 0;
+ usb_record_dbginfo(USB_DEV_OPEN, 0, 2);
exit_unlock_port:
spin_unlock_irq(&port->port_lock);
@@ -1130,6 +1133,7 @@
port->port_num, tty, file);
wake_up_interruptible(&port->close_wait);
+ usb_record_dbginfo(USB_DEV_CLOSE, 0, 2);
exit:
spin_unlock_irq(&port->port_lock);
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_netlink.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_netlink.c
index 232ca1a..9c157fe 100755
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_netlink.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_netlink.c
@@ -21,12 +21,20 @@
#include <mach/iomap.h>
#include "pub_debug_info.h"
+
+#ifndef CONFIG_SYSTEM_RECOVERY
+int zDrvNand_WriteBootflag( int flag );
+#endif
extern int detected_charger(void);
#ifdef _USE_VEHICLE_DC
extern int usb_server_init(void);
extern int adb_enable_rpmsg_agent(int flag);
extern int adb_rpmsg_agent_state(void);
+ int switch_mode = 0;
+ int simulate_plug = 0;
+ struct work_struct switch_usbmode;
+
#endif
static unsigned int charger_plug = 0;
@@ -320,6 +328,15 @@
case USB_DEV_OFFLINE:
str_info = "offline";
break;
+ case USB_OPEN_DL:
+ str_info = "dl open";
+ break;
+ case USB_CLOSE_DL:
+ str_info = "dl close";
+ break;
+ case USB_SIMULATE_PLUG:
+ str_info = "simulate plug";
+ break;
default :
break;
@@ -343,7 +360,23 @@
}
EXPORT_SYMBOL_GPL(usb_record_dbginfo);
-
+#ifdef _USE_VEHICLE_DC
+int usb_switch_mode_work(struct work_struct *data)
+{
+ if(simulate_plug){
+ //we have no simulate signal, using except reset
+ simulate_plug = 0;
+ usb_notify_up(USB_DEVICE_EXCEPT_RESET, NULL);
+ return;
+ }
+ if(switch_mode < USB_SWITCH_USER || switch_mode > USB_SWITCH_EYE_DIAGRAM){
+ printk("usb_switch_mode_work, invalid type:%d\n", switch_mode);
+ return -1;
+ }
+
+ usb_notify_up(switch_mode, NULL);
+}
+#endif
int usb_do_reject_cdrom(void)
{
if(mods.only_cdrom){
@@ -742,6 +775,9 @@
//usbkobj->ktype = &ktype;
#ifdef _USE_VEHICLE_DC
usb_server_init();
+
+ INIT_WORK(&switch_usbmode, usb_switch_mode_work);
+
#endif
return ret;
}
@@ -778,6 +814,7 @@
strcpy(buf,"USBEVENT=usb_device_in");
action = KOBJ_ADD;
usb_plug = 1;
+ usb_record_dbginfo(USB_DEV_PLUGIN, 0, 0);
break;
case USB_DEVICE_PLUGOUT:
@@ -786,6 +823,7 @@
strcpy(buf,"USBEVENT=usb_device_out");
action = KOBJ_REMOVE;
usb_plug = 0;
+ usb_record_dbginfo(USB_DEV_PLUGOUT, 0, 0);
break;
case USB_CHARGER_PLUGIN:
usb_printk("usb charger plugin \n");
@@ -928,7 +966,8 @@
//sprintf(t_resp->param, "%s", );
break;
- //usb_set_rpmsg_resp(t_cmd->cmd, usb_resp);
+ //case:
+ // break;
//case:
// break;
default:
@@ -936,6 +975,105 @@
}
}
EXPORT_SYMBOL_GPL(usb_set_rpmsg_resp);
+
+void usb_parse_cap_notify(int type)
+{
+ if(type >= USB_RPMSG_NOTIFY_MAX){
+ printk("usb_parse_cap_notify fail, invalid type:%d\n", type);
+ return ;
+ }
+
+ switch(type){
+ case USB_RPMSG_NOTIFY_ADB_TO_AP:
+ adb_agent_state = 0;
+ wmb();
+ adb_enable_rpmsg_agent(adb_agent_state);
+ break;
+ case USB_RPMSG_NOTIFY_ADB_TO_CAP:
+ adb_agent_state = 1;
+ wmb();
+ adb_enable_rpmsg_agent(adb_agent_state);
+ break;
+ case USB_RPMSG_SWITCH_DEBUG_MODE:
+ if(switch_mode == USB_SWITCH_DEBUG){
+ printk("usb_parse_cap_notify, already debug mode, don't change again\n");
+ break;
+ }
+ switch_mode = USB_SWITCH_DEBUG;
+ usb_record_dbginfo(USB_SWITCH_TO_DEBUG, 0, 0);
+ schedule_work(&switch_usbmode);
+ break;
+ case USB_RPMSG_SWITCH_USER_MODE:
+ if(switch_mode == USB_SWITCH_USER){
+ printk("usb_parse_cap_notify, already user mode, don't change again\n");
+ break;
+ }
+ switch_mode = USB_SWITCH_USER;
+ usb_record_dbginfo(USB_SWITCH_TO_USER, 0, 0);
+ schedule_work(&switch_usbmode);
+
+ break;
+ case USB_RPMSG_SWITCH_FACTORY_MODE:
+ if(switch_mode == USB_SWITCH_FACTORY){
+ printk("usb_parse_cap_notify, already factory mode, don't change again\n");
+ break;
+ }
+ switch_mode = USB_SWITCH_FACTORY;
+ usb_record_dbginfo(USB_SWITCH_TO_FACTORY, 0, 0);
+ schedule_work(&switch_usbmode);
+
+ break;
+ case USB_RPMSG_SWITCH_AMT_MODE:
+ if(switch_mode == USB_SWITCH_AMT){
+ printk("usb_parse_cap_notify, already amt mode, don't change again\n");
+ break;
+ }
+ switch_mode = USB_SWITCH_AMT;
+ usb_record_dbginfo(USB_SWITCH_TO_AMT, 0, 0);
+ schedule_work(&switch_usbmode);
+
+ break;
+ case USB_RPMSG_SWITCH_EYE_MODE:
+ if(switch_mode == USB_SWITCH_EYE_DIAGRAM){
+ printk("usb_parse_cap_notify, already eye mode, don't change again\n");
+ break;
+ }
+ switch_mode = USB_SWITCH_EYE_DIAGRAM;
+ usb_record_dbginfo(USB_SWITCH_TO_EYE_DIAGRAM, 0, 0);
+ schedule_work(&switch_usbmode);
+
+ break;
+
+ case USB_RPMSG_OPEN_DL:
+ usb_record_dbginfo(USB_OPEN_DL, 0, 0);
+#ifndef CONFIG_SYSTEM_RECOVERY
+ zDrvNand_WriteBootflag(0);
+#endif
+ break;
+ case USB_RPMSG_CLOSE_DL:
+ usb_record_dbginfo(USB_CLOSE_DL, 0, 0);
+#ifndef CONFIG_SYSTEM_RECOVERY
+ zDrvNand_WriteBootflag(1);
+#endif
+ break;
+ case USB_RPMSG_SIMULATE_PLUG:
+ simulate_plug = 1;
+ usb_record_dbginfo(USB_SIMULATE_PLUG, 0, 0);
+ schedule_work(&switch_usbmode);
+
+ break;
+ //case :
+ // break;
+ //case :
+ // break;
+ //case :
+ // break;
+ default:
+ break;
+ }
+}
+EXPORT_SYMBOL_GPL(usb_parse_cap_notify);
+
#endif
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_rpmsg_server.c b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_rpmsg_server.c
index b6a86e3..8bd048b 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_rpmsg_server.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/gadget/usb_rpmsg_server.c
@@ -35,6 +35,7 @@
extern void usb_set_rpmsg_resp(int type, char*resp);
extern void android_set_rpmsg_resp(int type, char*resp);
+extern void usb_parse_cap_notify(int type);
struct task_struct *rpmsg_thread;
wait_queue_head_t usb_agt_wq;
@@ -71,15 +72,17 @@
int usb_rpmsg2ap(void *buf, unsigned int len);
-void usb_rpmsg_notify_ap(usb_rpmsg_cmd *notify)
+void usb_rpmsg_notify_ap(usb_rpmsg_cmd *notify, int has_param)
{
usb_rpmsg_cmd *t_data = NULL;
memset(usb_resp, 0, USB_AGENT_BUF_SIZE);
t_data = (usb_rpmsg_cmd *)usb_resp;
t_data->cmd = notify->cmd;
- memcpy(t_data->param, notify->param, strlen(notify->param));
-
+ if(has_param){
+ memcpy(t_data->param, notify->param, strlen(notify->param));
+ }
+ printk("---usb_rpmsg_notify_ap, datalen:%d\n", strlen(usb_resp));
usb_rpmsg2ap(usb_resp, strlen(usb_resp));
}
EXPORT_SYMBOL_GPL(usb_rpmsg_notify_ap);
@@ -101,7 +104,7 @@
}
#if 1
- usb_set_rpmsg_resp(t_cmd->cmd, usb_resp);
+ //usb_set_rpmsg_resp(t_cmd->cmd, usb_resp);
android_set_rpmsg_resp(t_cmd->cmd, usb_resp);
#else
@@ -128,7 +131,7 @@
unsigned char *data;
char*tmp= (char*)buf;
-
+ usb_rpmsg_cmd *msg = NULL;
if (len==0){
printk("usb_rpmsg_from_ap, len 0, notify \n ", len);
@@ -150,7 +153,11 @@
#endif
memcpy(usb_msg,buf, len);
//usb_rpmsg2ap((char *)buf, len);
-
+ msg = (usb_rpmsg_cmd *)usb_msg;
+ if(msg->cmd > USB_RPMSG_CMD_MAX){
+ usb_parse_cap_notify(msg->cmd);
+ return;
+ }
atomic_set(&rpmsg_flag, 1);
wake_up(&usb_agt_wq);
}
diff --git a/ap/os/linux/linux-3.4.x/drivers/usb/mon/mon_bin.c b/ap/os/linux/linux-3.4.x/drivers/usb/mon/mon_bin.c
index 91cd850..6e33e1e 100644
--- a/ap/os/linux/linux-3.4.x/drivers/usb/mon/mon_bin.c
+++ b/ap/os/linux/linux-3.4.x/drivers/usb/mon/mon_bin.c
@@ -1247,6 +1247,11 @@
{
/* don't do anything here: "fault" will set up page table entries */
vma->vm_ops = &mon_bin_vm_ops;
+ //CVE-2022-43750
+ if (vma->vm_flags & VM_WRITE)
+ return -EPERM;
+
+ vma->vm_flags &= ~VM_MAYWRITE;
vma->vm_flags |= VM_RESERVED;
vma->vm_private_data = filp->private_data;
mon_bin_vma_open(vma);
diff --git a/ap/os/linux/linux-3.4.x/drivers/watchdog/zx_soft_wdt.c b/ap/os/linux/linux-3.4.x/drivers/watchdog/zx_soft_wdt.c
index 101048d..de12136 100644
--- a/ap/os/linux/linux-3.4.x/drivers/watchdog/zx_soft_wdt.c
+++ b/ap/os/linux/linux-3.4.x/drivers/watchdog/zx_soft_wdt.c
@@ -487,19 +487,19 @@
switch (wdt_reason)
{
case PS_WDT:
- memcpy(reason, "ps wdt reboot!\n", 20);
+ memcpy(reason, "ps wdt reboot!\n", sizeof("ps wdt reboot!\n"));
break;
case AP_WDT:
- memcpy(reason, "ap wdt reboot!\n", 20);
+ memcpy(reason, "ap wdt reboot!\n", sizeof("ap wdt reboot!\n"));
break;
case PHY_WDT:
- memcpy(reason, "phy wdt reboot!\n", 20);
+ memcpy(reason, "phy wdt reboot!\n", sizeof("phy wdt reboot!\n"));
break;
case MAX_WDT:
- memcpy(reason, "rpm wdt reboot!\n", 20);
+ memcpy(reason, "rpm wdt reboot!\n", sizeof("rpm wdt reboot!\n"));
break;
default:
- memcpy(reason, "not wdt reboot!\n", 20);
+ memcpy(reason, "not wdt reboot!\n", sizeof("not wdt reboot!\n"));
break;
}
@@ -581,8 +581,9 @@
}
/*start wdt*/
- zx_write_reg(ZX_RM_WDT_BASE + 0x1c, 0x12340001);
- while(1);
+ do{
+ zx_write_reg(ZX_RM_WDT_BASE + 0x1c, 0x12340001);
+ }while(1);
}
EXPORT_SYMBOL(wdt_restart);
#endif
diff --git a/ap/os/linux/linux-3.4.x/include/linux/android_notify.h b/ap/os/linux/linux-3.4.x/include/linux/android_notify.h
index f505c4e..85e5c52 100644
--- a/ap/os/linux/linux-3.4.x/include/linux/android_notify.h
+++ b/ap/os/linux/linux-3.4.x/include/linux/android_notify.h
@@ -39,6 +39,7 @@
USB_SWITCH_TO_DEBUG,
USB_SWITCH_TO_FACTORY,
USB_SWITCH_TO_AMT,
+ USB_SWITCH_TO_EYE_DIAGRAM,
USB_DEV_EXCEPT_RESET,
USB_DEV_SUSPEND,
USB_DEV_RESUME,
@@ -53,6 +54,9 @@
USB_DEV_CLOSE,
USB_DEV_ONLINE,
USB_DEV_OFFLINE,
+ USB_OPEN_DL,
+ USB_CLOSE_DL,
+ USB_SIMULATE_PLUG,
USB_DBGINFO_NUM,
}usb_dbginfo_type;
void usb_notify_up(usb_notify_event notify_type, void* puf);
@@ -63,8 +67,9 @@
#ifdef _USE_VEHICLE_DC
-#define USB_RPMSG_RESP 1
-#define USB_RPMSG_NOTIFY 2
+#define USB_RPMSG_RESP 0x1
+#define USB_RPMSG_NOTIFY 0x2
+#define USB_RPMSG_TYPE_NOTIFY 0x3
typedef enum __usb_rpmsg_cmd_type{
USB_RPMSG_CMD = 0,
@@ -72,10 +77,28 @@
USB_RPMSG_GET_USB_SPEED,
USB_RPMSG_GET_USB_STATE,
USB_RPMSG_GET_USB_LINK_STATE,
+ USB_RPMSG_GET_USB_ENUM_MODE,
//USB_RPMSG_GET_,
//USB_RPMSG_GET_,
- USB_RPMSG_CMD_MAX,
+ USB_RPMSG_CMD_MAX,
+ USB_RPMSG_NOTIFY_ADB_TO_AP,
+ USB_RPMSG_NOTIFY_ADB_TO_CAP,
+ USB_RPMSG_NOTIFY_NET_ONLINE,
+ USB_RPMSG_NOTIFY_NET_OFFLINE,
+ USB_RPMSG_NOTIFY_ADB_ONLINE,
+ USB_RPMSG_NOTIFY_ADB_OFFLINE,
+ USB_RPMSG_SWITCH_DEBUG_MODE,
+ USB_RPMSG_SWITCH_USER_MODE,
+ USB_RPMSG_SWITCH_FACTORY_MODE,
+ USB_RPMSG_SWITCH_AMT_MODE,
+ USB_RPMSG_SWITCH_EYE_MODE,
+ USB_RPMSG_FORCE_RNDIS,
+ USB_RPMSG_FORCE_ECM,
+ USB_RPMSG_OPEN_DL,
+ USB_RPMSG_CLOSE_DL,
+ USB_RPMSG_SIMULATE_PLUG,
+ USB_RPMSG_NOTIFY_MAX,
}e_usb_rpmsg_cmd_type;
diff --git a/ap/os/linux/linux-3.4.x/include/linux/ramdump/ramdump_oss.h b/ap/os/linux/linux-3.4.x/include/linux/ramdump/ramdump_oss.h
index d54dd6e..e4cb862 100755
--- a/ap/os/linux/linux-3.4.x/include/linux/ramdump/ramdump_oss.h
+++ b/ap/os/linux/linux-3.4.x/include/linux/ramdump/ramdump_oss.h
@@ -80,6 +80,7 @@
#define OSS_PRINTF(fmt...) zOss_Printf(SUBMDL_TEST, PRINT_LEVEL_NORMAL, fmt)
#endif //#ifdef _OS_LINUX
+#define RAMDUMP_EMMC_TRANS_FLAG_ADDR (IRAM_BASE_ADDR_ZCAT_MODE)
/*******************************************************************************
* Êý¾ÝÀàÐͶ¨Òå *
diff --git a/ap/os/linux/linux-3.4.x/include/linux/soc/zte/tsc/tsc.h b/ap/os/linux/linux-3.4.x/include/linux/soc/zte/tsc/tsc.h
index a7349d2..1a6ece9 100644
--- a/ap/os/linux/linux-3.4.x/include/linux/soc/zte/tsc/tsc.h
+++ b/ap/os/linux/linux-3.4.x/include/linux/soc/zte/tsc/tsc.h
@@ -18,7 +18,7 @@
#define __ASM_ARCH_TSC_H
#define TS_ADC_TEMP_NUMBER 2
-#define TS_ADC_TEMP_VOLTAGE_NUMBER 110
+#define TS_ADC_TEMP_VOLTAGE_NUMBER 200
#endif
diff --git a/ap/os/linux/linux-3.4.x/log b/ap/os/linux/linux-3.4.x/log
new file mode 100644
index 0000000..c4015ec
--- /dev/null
+++ b/ap/os/linux/linux-3.4.x/log
@@ -0,0 +1 @@
+bitbake:未找到命令
diff --git a/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_oss.c b/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_oss.c
index f59e646..56fd493 100755
--- a/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_oss.c
+++ b/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_oss.c
@@ -26,23 +26,39 @@
/*******************************************************************************
* Íⲿº¯ÊýÉùÃ÷ *
*******************************************************************************/
+extern unsigned long ramdump_phy_to_vir(ramdump_ram_config_t * ram_config);
/*******************************************************************************
* ºê¶¨Òå *
*******************************************************************************/
+/*¹²ÏíÄÚ´æµØÖ·*/
+#ifdef _USE_VEHICLE_DC
+#define RAMDUMP_SHARED_MEM_BASE (RAMDUMP_AP_TO_CAP_BUF_ADDR_PA)
+#define RAMDUMP_SHARED_MEM_LEN (RAMDUMP_AP_TO_CAP_BUF_LEN)
+#define RAMDUMP_SHMEM_ALIGN_SIZE (0x1000)
+#endif
/*******************************************************************************
* Êý¾ÝÀàÐͶ¨Òå *
*******************************************************************************/
+#ifdef _USE_VEHICLE_DC
+typedef struct
+{
+ volatile unsigned int core_flag;//0:cp,1:cap
+ volatile unsigned int rw_flag;//0:non,1:w,2:r
+ volatile unsigned int size;
+ char buf[];
+} ramdump_shmem_t;
/*******************************************************************************
* È«¾Ö±äÁ¿ÉùÃ÷ *
*******************************************************************************/
+unsigned char *ramdump_shared_mem_base = NULL;
+#endif
/*******************************************************************************
* È«¾Öº¯ÊýÉùÃ÷ *
*******************************************************************************/
-
#ifdef _OS_LINUX
/* icp api */
extern int zDrvRpMsg_CreateChannel(
@@ -342,11 +358,142 @@
void ramdump_oss_data_trans_init(void)
{
#ifdef _OS_LINUX
- zDrvUsbPoll_Init(); /* ³õʼ»¯USB */
- while (!zDrvUsbPoll_isConnect()) ; /* ²éѯUSBÊÇ·ñÁ¬½Ó */
+#ifdef _USE_VEHICLE_DC
+
+ if(*(unsigned int *)RAMDUMP_EMMC_TRANS_FLAG_ADDR != 1)
+ {
+#endif
+ zDrvUsbPoll_Init(); /* ³õʼ»¯USB */
+ while (!zDrvUsbPoll_isConnect()) ; /* ²éѯUSBÊÇ·ñÁ¬½Ó */
+#ifdef _USE_VEHICLE_DC
+ }
+#endif
#endif
}
+void ramdump_usb_trans_read(unsigned char *buffer, unsigned int size)
+{
+#ifdef _OS_LINUX
+ unsigned int count = 0;
+
+ do
+ {
+ zDrvUsbPoll_Isr();
+ count = (unsigned int)zDrvUsbPoll_Read(buffer, size);
+ if ( size <= count)
+ {
+ break;
+ }
+ buffer += count;
+ size -=count;
+ }
+ while (size > 0);
+#endif
+
+}
+
+void ramdump_usb_trans_write(unsigned char *buffer, unsigned int size)
+{
+#ifdef _OS_LINUX
+ unsigned int count = 0;
+
+ while (size > 0)
+ {
+ zDrvUsbPoll_Isr();
+ count = (unsigned int)zDrvUsbPoll_Write(buffer, size);
+ if ( size <= count)
+ {
+ break;
+ }
+
+ buffer += count;
+ size -=count;
+ }
+#endif
+
+}
+static inline void ramdump_wait_delay( unsigned long ms)
+{
+ volatile int j = 0;
+ for (j = 0; j < 50000; j++);
+}
+
+#ifdef _USE_VEHICLE_DC
+
+void ramdump_shared_mem_init(void)
+{
+ ramdump_shared_mem_base = OSS_MMAP(RAMDUMP_SHARED_MEM_BASE, RAMDUMP_SHARED_MEM_LEN);
+}
+
+/*******************************************************************************
+* ¹¦ÄÜÃèÊö: ramdump_shm_trans_write
+* ²ÎÊý˵Ã÷:
+* (´«Èë²ÎÊý) void
+* (´«³ö²ÎÊý) void
+* ·µ »Ø Öµ: void
+* ÆäËü˵Ã÷: This function is used for ramdump to trans dump data to PC
+*******************************************************************************/
+int ramdump_shm_trans_write(unsigned char *buffer, unsigned int size)
+{
+ int ret;
+ ramdump_shmem_t tmp_msg;
+ ramdump_shmem_t *msg = (ramdump_shmem_t *)ramdump_shared_mem_base;
+
+ if (size > (RAMDUMP_SHARED_MEM_LEN - roundup(sizeof(ramdump_shmem_t), RAMDUMP_SHMEM_ALIGN_SIZE)))
+ ret = -1;
+
+ while(1){
+ if ((msg->core_flag == 0) && (msg->rw_flag == 1)){
+ _memcpy_toio(msg->buf, buffer, size);
+ tmp_msg.size = size;
+ tmp_msg.core_flag = 1;
+ tmp_msg.rw_flag = 2;
+ _memcpy_toio(msg, &tmp_msg, sizeof(ramdump_shmem_t));
+ ret = size;
+ break;
+ }
+ else
+ ramdump_wait_delay(0);
+ }
+ return ret;
+}
+
+
+/*******************************************************************************
+* ¹¦ÄÜÃèÊö: ramdump_shm_trans_read
+* ²ÎÊý˵Ã÷:
+* (´«Èë²ÎÊý) void
+* (´«³ö²ÎÊý) void
+* ·µ »Ø Öµ: void
+* ÆäËü˵Ã÷: This function is used for ramdump to trans dump data to PC
+*******************************************************************************/
+int ramdump_shm_trans_read(unsigned char *buffer, unsigned int size)
+{
+ int ret;
+ ramdump_shmem_t tmp_msg;
+ ramdump_shmem_t *msg = (ramdump_shmem_t *)ramdump_shared_mem_base;
+
+ if (size > (RAMDUMP_SHARED_MEM_LEN - roundup(sizeof(ramdump_shmem_t), RAMDUMP_SHMEM_ALIGN_SIZE)))
+ ret = -1;
+
+ while(1){
+ if ((msg->core_flag == 0) && (msg->rw_flag == 2)){
+ if (size < msg->size)
+ return -1;
+ _memcpy_fromio(buffer, msg->buf, msg->size);
+ tmp_msg.size = msg->size;
+ tmp_msg.core_flag = 0;
+ tmp_msg.rw_flag = 1;
+ _memcpy_toio(msg, &tmp_msg, sizeof(ramdump_shmem_t));
+ ret = size;
+ break;
+ }
+ else
+ ramdump_wait_delay(0);
+ }
+ return ret;
+}
+#endif
/*******************************************************************************
* ¹¦ÄÜÃèÊö: ramdump_oss_data_trans_read
* ²ÎÊý˵Ã÷:
@@ -358,22 +505,13 @@
*******************************************************************************/
void ramdump_oss_data_trans_read(unsigned char *buffer, unsigned int size)
{
-#ifdef _OS_LINUX
- unsigned int count = 0;
+#ifdef _USE_VEHICLE_DC
- do
- {
- zDrvUsbPoll_Isr();
- count = (unsigned int)zDrvUsbPoll_Read(buffer, size);
- if ( size <= count)
- {
- break;
- }
- buffer += count;
- size -=count;
- }
- while (size > 0);
+ if(*(unsigned int *)RAMDUMP_EMMC_TRANS_FLAG_ADDR == 1)
+ ramdump_shm_trans_read(buffer, size);
+ else
#endif
+ ramdump_usb_trans_read(buffer, size);
}
/*******************************************************************************
@@ -387,22 +525,14 @@
*******************************************************************************/
void ramdump_oss_data_trans_write(unsigned char *buffer, unsigned int size)
{
-#ifdef _OS_LINUX
- unsigned int count = 0;
+#ifdef _USE_VEHICLE_DC
- while (size > 0)
- {
- zDrvUsbPoll_Isr();
- count = (unsigned int)zDrvUsbPoll_Write(buffer, size);
- if ( size <= count)
- {
- break;
- }
-
- buffer += count;
- size -=count;
- }
+ if(*(unsigned int *)RAMDUMP_EMMC_TRANS_FLAG_ADDR == 1)
+ ramdump_shm_trans_write(buffer, size);
+ else
#endif
+ ramdump_usb_trans_write(buffer, size);
+
}
/*******************************************************************************
@@ -417,7 +547,10 @@
{
#ifdef _OS_LINUX
/* µÈ´ýÊý¾Ý·¢ËÍÍêºó£¬ÔÙÖØÆô */
- zDrvUsbPoll_Isr();
+#ifdef _USE_VEHICLE_DC
+ if(*(unsigned int *)RAMDUMP_EMMC_TRANS_FLAG_ADDR != 1)
+#endif
+ zDrvUsbPoll_Isr();
#endif
}
diff --git a/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_trans_server.c b/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_trans_server.c
index b112efd..df85705 100755
--- a/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_trans_server.c
+++ b/ap/os/linux/linux-3.4.x/mm/ramdump/ramdump_trans_server.c
@@ -91,40 +91,40 @@
/* trans_server rsp pc, interactive msg struct */
typedef struct
{
- unsigned long cmd;
- unsigned long file_num;
+ unsigned int cmd;
+ unsigned int file_num;
} ramdump_trans_server_interactive_rsp;
/* trans_server rsp pc, file info msg struct */
typedef struct
{
- unsigned long cmd;
+ unsigned int cmd;
char file_name[RAMDUMP_RAMCONF_FILENAME_MAXLEN];
- unsigned long file_size;
+ unsigned int file_size;
} ramdump_trans_server_file_info_rsp;
/* pc req trans_server, file info msg struct */
typedef struct
{
- unsigned long cmd;
- unsigned long file_id;
+ unsigned int cmd;
+ unsigned int file_id;
} ramdump_pc_file_info_req;
/* trans_server rsp pc, trans data msg struct */
typedef struct
{
- unsigned long cmd;
- unsigned long buf_addr;
- unsigned long buf_left_size;
+ unsigned int cmd;
+ unsigned int buf_addr;
+ unsigned int buf_left_size;
} ramdump_trans_server_data_trans_rsp;
/* pc req trans_server, trans data msg struct */
typedef struct
{
- unsigned long cmd;
- unsigned long file_id; /* Îļþ±àºÅ */
- unsigned long offset; /* offsetΪÊý¾ÝÆ«ÒÆ */
- unsigned long length; /* lengthΪÊý¾Ý³¤¶È */
+ unsigned int cmd;
+ unsigned int file_id; /* Îļþ±àºÅ */
+ unsigned int offset; /* offsetΪÊý¾ÝÆ«ÒÆ */
+ unsigned int length; /* lengthΪÊý¾Ý³¤¶È */
} ramdump_pc_trans_data_req;
@@ -140,7 +140,9 @@
extern void zx_wdt_m0_stop(void);
extern struct meminfo meminfo;
-
+#ifdef _USE_VEHICLE_DC
+extern void ramdump_shared_mem_init(void);
+#endif
/*******************************************************************************
* ¾Ö²¿¾²Ì¬±äÁ¿¶¨Òå *
*******************************************************************************/
@@ -148,7 +150,7 @@
static int ramdump_count;
static int ramdump_file_num;
-static DEFINE_MUTEX(ramdump_mutex);
+static DEFINE_MUTEX(ramdump_mutex);
/* Cmm file content */
static unsigned char ramdump_server_cmm_buf[RAMDUMP_CMM_SIZE];
@@ -156,7 +158,7 @@
static char ramdump_server_error_log[RAMDUMP_ERROR_LOG_SIZE];
/* trans server ram conf table */
-static ramdump_ram_config_t ramdump_trans_server_ram_conf[RAMDUMP_RAMCONF_TABLE_MAX_ENTRYS];
+ramdump_ram_config_t ramdump_trans_server_ram_conf[RAMDUMP_RAMCONF_TABLE_MAX_ENTRYS];
static unsigned int ddr_ap_size;
#ifndef __USE_TRANS_WITH_COLLECT__
@@ -181,6 +183,22 @@
/* diff server crash or client crash */
int ramdump_trans_server_force_panic_flag = RAMDUMP_FALSE;
+char ramdump_shm_export_file[][RAMDUMP_RAMCONF_FILENAME_MAXLEN] =
+{
+ "ap_log_buf",
+ "zsp.cmm",
+ "phy_iddr.bin",
+ "DDDR.bin",
+ "phy_itcm.bin",
+ "DTCM.bin",
+ "shared_ram.bin",
+ "iram_icp.bin"
+};
+
+unsigned int ramdump_shm_file_num = 0;
+unsigned int ramdump_exprot_file_num = 0;
+unsigned int ramdump_export_file_index[RAMDUMP_RAMCONF_TABLE_MAX_ENTRYS] = {0};
+
/*******************************************************************************
* ¾Ö²¿º¯ÊýʵÏÖ *
*******************************************************************************/
@@ -193,7 +211,7 @@
* ·µ »Ø Öµ: void
* ÆäËü˵Ã÷: This function is used to collect server ram conf before client mmap
*******************************************************************************/
-static unsigned long ramdump_phy_to_vir(ramdump_ram_config_t * ram_config)
+unsigned long ramdump_phy_to_vir(ramdump_ram_config_t * ram_config)
{
unsigned long pfn = 0;
unsigned long vir_addr = 0;
@@ -806,6 +824,34 @@
0);
}
+unsigned int ramdump_calc_total_regions(void)
+{
+ unsigned int index;
+ unsigned int cnt;
+
+ ramdump_shm_file_num = sizeof(ramdump_shm_export_file)/sizeof(ramdump_shm_export_file[0]);
+
+ for (index = 0; index < ramdump_file_num; index++){
+#ifdef _USE_VEHICLE_DC
+ if(*(unsigned int *)RAMDUMP_EMMC_TRANS_FLAG_ADDR == 1){
+ for (cnt = 0; cnt < ramdump_shm_file_num; cnt++)
+ {
+ if(!strcmp(ramdump_trans_server_ram_conf[index].name, ramdump_shm_export_file[cnt])){
+ ramdump_export_file_index[ramdump_exprot_file_num] = index;
+ ramdump_exprot_file_num++;
+ }
+ }
+ }else{
+#endif
+ ramdump_export_file_index[ramdump_exprot_file_num] = index;
+ ramdump_exprot_file_num++;
+#ifdef _USE_VEHICLE_DC
+ }
+#endif
+ }
+ return ramdump_exprot_file_num;
+}
+
/*******************************************************************************
* ¹¦ÄÜÃèÊö: ramdump_data_transfer_to_pc
* ²ÎÊý˵Ã÷:
@@ -816,21 +862,25 @@
*******************************************************************************/
static void ramdump_data_transfer_to_pc(void)
{
+ int file_id = 0;
+ unsigned int ramdump_file_nr = 0;
char req_buf[RAMDUMP_INTERACTIVE_DATA_LEN] = {0};
/* interactive begin */
ramdump_oss_data_trans_init();
+ ramdump_file_nr = ramdump_calc_total_regions();
+
for(;;)
{
ramdump_oss_data_trans_read((unsigned char *)req_buf, RAMDUMP_INTERACTIVE_DATA_LEN);
- switch (*(unsigned long *)req_buf)
+ switch (*(unsigned int *)req_buf)
{
case RAMDUMP_PC_INTERACTIVE_REQ:
{
ramdump_trans_server_interactive_rsp server_to_pc_msg = {0};
server_to_pc_msg.cmd = RAMDUMP_TRANS_SERVER_INTERACTIVE_RSP;
- server_to_pc_msg.file_num = ramdump_file_num;
+ server_to_pc_msg.file_num = ramdump_file_nr;
ramdump_oss_data_trans_write(
(unsigned char*)(&server_to_pc_msg),
@@ -843,16 +893,16 @@
ramdump_trans_server_file_info_rsp server_to_pc_msg = {0};
/* data from pc to server */
ramdump_pc_file_info_req *pc_to_server_msg = (ramdump_pc_file_info_req *)req_buf;
-
+ file_id = pc_to_server_msg->file_id;
/* data respond pc from server */
server_to_pc_msg.cmd = RAMDUMP_TRANS_SERVER_FILE_INFO_READ_RSP;
strncpy(server_to_pc_msg.file_name,
- ramdump_trans_server_ram_conf[pc_to_server_msg->file_id].name,
+ ramdump_trans_server_ram_conf[ramdump_export_file_index[file_id]].name,
RAMDUMP_RAMCONF_FILENAME_MAXLEN - 1);
- server_to_pc_msg.file_name[RAMDUMP_RAMCONF_FILENAME_MAXLEN - 1] = '\0';
- server_to_pc_msg.file_size = ramdump_trans_server_ram_conf[pc_to_server_msg->file_id].size;
- if (ramdump_trans_server_ram_conf[pc_to_server_msg->file_id].callback != NULL &&
- (ramdump_trans_server_ram_conf[pc_to_server_msg->file_id].callback)() == RAMDUMP_FALSE)
+ server_to_pc_msg.file_name[RAMDUMP_RAMCONF_FILENAME_MAXLEN - 1] = '\0';
+ server_to_pc_msg.file_size = ramdump_trans_server_ram_conf[ramdump_export_file_index[file_id]].size;
+ if (ramdump_trans_server_ram_conf[ramdump_export_file_index[file_id]].callback != NULL &&
+ (ramdump_trans_server_ram_conf[ramdump_export_file_index[file_id]].callback)() == RAMDUMP_FALSE)
server_to_pc_msg.file_size = 0;
/* interactive data trans */
ramdump_oss_data_trans_write(
@@ -866,11 +916,11 @@
ramdump_trans_server_data_trans_rsp server_to_pc_msg = {0};
/* data from pc to server */
ramdump_pc_trans_data_req *pc_to_server_msg = (ramdump_pc_trans_data_req *)req_buf;
-
+ file_id = pc_to_server_msg->file_id;
/* data respond pc from server */
server_to_pc_msg.cmd = RAMDUMP_TRANS_SERVER_FILE_DATA_TRANS_RSP;
server_to_pc_msg.buf_addr =
- (ramdump_trans_server_ram_conf[pc_to_server_msg->file_id].vir +
+ (ramdump_trans_server_ram_conf[ramdump_export_file_index[file_id]].vir +
pc_to_server_msg->offset);
server_to_pc_msg.buf_left_size = pc_to_server_msg->length;
/* interactive data trans */
@@ -1105,7 +1155,19 @@
0,
RAMDUMP_FLAG_NONE,
0);
+ ramdump_ram_conf_table_add(
+ "rpmsg_cap.bin",
+ ICP_CAP_BUF_ADDR_PA,
+ ICP_CAP_BUF_LEN,
+ 0,
+ RAMDUMP_FLAG_NONE,
+ 0);
#endif
+
+#ifdef _USE_VEHICLE_DC
+ ramdump_shared_mem_init();
+#endif
+
/* set trans ram data done flag */
// ramdump_trans_server_data_done_flag = RAMDUMP_SYNC_RAM_CONTENT_DONE;
diff --git a/ap/os/linux/linux-3.4.x/net/core/speed_pool_dl.c b/ap/os/linux/linux-3.4.x/net/core/speed_pool_dl.c
index e7db4e7..d761b6a 100755
--- a/ap/os/linux/linux-3.4.x/net/core/speed_pool_dl.c
+++ b/ap/os/linux/linux-3.4.x/net/core/speed_pool_dl.c
@@ -134,7 +134,9 @@
struct skb_pool_node_impl_t
{
skb_pool_node_impl_t *free_next;
-
+#if _USE_VEHICLE_DC
+ u32 padding[15];//for cacheline
+#endif
#ifdef SKB_DBG_POOL
struct list_head alloc_node;
const char *file;
diff --git a/ap/os/linux/linux-3.4.x/net/sched/Kconfig b/ap/os/linux/linux-3.4.x/net/sched/Kconfig
index 75b58f8..3705081 100644
--- a/ap/os/linux/linux-3.4.x/net/sched/Kconfig
+++ b/ap/os/linux/linux-3.4.x/net/sched/Kconfig
@@ -301,17 +301,6 @@
To compile this code as a module, choose M here: the
module will be called cls_basic.
-config NET_CLS_TCINDEX
- tristate "Traffic-Control Index (TCINDEX)"
- select NET_CLS
- ---help---
- Say Y here if you want to be able to classify packets based on
- traffic control indices. You will want this feature if you want
- to implement Differentiated Services together with DSMARK.
-
- To compile this code as a module, choose M here: the
- module will be called cls_tcindex.
-
config NET_CLS_ROUTE4
tristate "Routing decision (ROUTE)"
depends on INET
diff --git a/ap/os/linux/linux-3.4.x/net/sched/Makefile b/ap/os/linux/linux-3.4.x/net/sched/Makefile
index 8cdf4e2..d8178ae 100644
--- a/ap/os/linux/linux-3.4.x/net/sched/Makefile
+++ b/ap/os/linux/linux-3.4.x/net/sched/Makefile
@@ -42,7 +42,6 @@
obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o
obj-$(CONFIG_NET_CLS_FW) += cls_fw.o
obj-$(CONFIG_NET_CLS_RSVP) += cls_rsvp.o
-obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o
obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o
obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o
obj-$(CONFIG_NET_CLS_FLOW) += cls_flow.o
diff --git a/ap/os/linux/linux-3.4.x/net/sched/cls_tcindex.c b/ap/os/linux/linux-3.4.x/net/sched/cls_tcindex.c
deleted file mode 100644
index dbe1992..0000000
--- a/ap/os/linux/linux-3.4.x/net/sched/cls_tcindex.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * net/sched/cls_tcindex.c Packet classifier for skb->tc_index
- *
- * Written 1998,1999 by Werner Almesberger, EPFL ICA
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <net/act_api.h>
-#include <net/netlink.h>
-#include <net/pkt_cls.h>
-
-/*
- * Passing parameters to the root seems to be done more awkwardly than really
- * necessary. At least, u32 doesn't seem to use such dirty hacks. To be
- * verified. FIXME.
- */
-
-#define PERFECT_HASH_THRESHOLD 64 /* use perfect hash if not bigger */
-#define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */
-
-
-#define PRIV(tp) ((struct tcindex_data *) (tp)->root)
-
-
-struct tcindex_filter_result {
- struct tcf_exts exts;
- struct tcf_result res;
-};
-
-struct tcindex_filter {
- u16 key;
- struct tcindex_filter_result result;
- struct tcindex_filter *next;
-};
-
-
-struct tcindex_data {
- struct tcindex_filter_result *perfect; /* perfect hash; NULL if none */
- struct tcindex_filter **h; /* imperfect hash; only used if !perfect;
- NULL if unused */
- u16 mask; /* AND key with mask */
- int shift; /* shift ANDed key to the right */
- int hash; /* hash table size; 0 if undefined */
- int alloc_hash; /* allocated size */
- int fall_through; /* 0: only classify if explicit match */
-};
-
-static const struct tcf_ext_map tcindex_ext_map = {
- .police = TCA_TCINDEX_POLICE,
- .action = TCA_TCINDEX_ACT
-};
-
-static inline int
-tcindex_filter_is_set(struct tcindex_filter_result *r)
-{
- return tcf_exts_is_predicative(&r->exts) || r->res.classid;
-}
-
-static struct tcindex_filter_result *
-tcindex_lookup(struct tcindex_data *p, u16 key)
-{
- struct tcindex_filter *f;
-
- if (p->perfect)
- return tcindex_filter_is_set(p->perfect + key) ?
- p->perfect + key : NULL;
- else if (p->h) {
- for (f = p->h[key % p->hash]; f; f = f->next)
- if (f->key == key)
- return &f->result;
- }
-
- return NULL;
-}
-
-
-static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp,
- struct tcf_result *res)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter_result *f;
- int key = (skb->tc_index & p->mask) >> p->shift;
-
- pr_debug("tcindex_classify(skb %p,tp %p,res %p),p %p\n",
- skb, tp, res, p);
-
- f = tcindex_lookup(p, key);
- if (!f) {
- if (!p->fall_through)
- return -1;
- res->classid = TC_H_MAKE(TC_H_MAJ(tp->q->handle), key);
- res->class = 0;
- pr_debug("alg 0x%x\n", res->classid);
- return 0;
- }
- *res = f->res;
- pr_debug("map 0x%x\n", res->classid);
-
- return tcf_exts_exec(skb, &f->exts, res);
-}
-
-
-static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter_result *r;
-
- pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle);
- if (p->perfect && handle >= p->alloc_hash)
- return 0;
- r = tcindex_lookup(p, handle);
- return r && tcindex_filter_is_set(r) ? (unsigned long) r : 0UL;
-}
-
-
-static void tcindex_put(struct tcf_proto *tp, unsigned long f)
-{
- pr_debug("tcindex_put(tp %p,f 0x%lx)\n", tp, f);
-}
-
-
-static int tcindex_init(struct tcf_proto *tp)
-{
- struct tcindex_data *p;
-
- pr_debug("tcindex_init(tp %p)\n", tp);
- p = kzalloc(sizeof(struct tcindex_data), GFP_KERNEL);
- if (!p)
- return -ENOMEM;
-
- p->mask = 0xffff;
- p->hash = DEFAULT_HASH_SIZE;
- p->fall_through = 1;
-
- tp->root = p;
- return 0;
-}
-
-
-static int
-__tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg;
- struct tcindex_filter *f = NULL;
-
- pr_debug("tcindex_delete(tp %p,arg 0x%lx),p %p,f %p\n", tp, arg, p, f);
- if (p->perfect) {
- if (!r->res.class)
- return -ENOENT;
- } else {
- int i;
- struct tcindex_filter **walk = NULL;
-
- for (i = 0; i < p->hash; i++)
- for (walk = p->h+i; *walk; walk = &(*walk)->next)
- if (&(*walk)->result == r)
- goto found;
- return -ENOENT;
-
-found:
- f = *walk;
- if (lock)
- tcf_tree_lock(tp);
- *walk = f->next;
- if (lock)
- tcf_tree_unlock(tp);
- }
- tcf_unbind_filter(tp, &r->res);
- tcf_exts_destroy(tp, &r->exts);
- kfree(f);
- return 0;
-}
-
-static int tcindex_delete(struct tcf_proto *tp, unsigned long arg)
-{
- return __tcindex_delete(tp, arg, 1);
-}
-
-static inline int
-valid_perfect_hash(struct tcindex_data *p)
-{
- return p->hash > (p->mask >> p->shift);
-}
-
-static const struct nla_policy tcindex_policy[TCA_TCINDEX_MAX + 1] = {
- [TCA_TCINDEX_HASH] = { .type = NLA_U32 },
- [TCA_TCINDEX_MASK] = { .type = NLA_U16 },
- [TCA_TCINDEX_SHIFT] = { .type = NLA_U32 },
- [TCA_TCINDEX_FALL_THROUGH] = { .type = NLA_U32 },
- [TCA_TCINDEX_CLASSID] = { .type = NLA_U32 },
-};
-
-static int
-tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
- struct tcindex_data *p, struct tcindex_filter_result *r,
- struct nlattr **tb, struct nlattr *est)
-{
- int err, balloc = 0;
- struct tcindex_filter_result new_filter_result, *old_r = r;
- struct tcindex_filter_result cr;
- struct tcindex_data cp;
- struct tcindex_filter *f = NULL; /* make gcc behave */
- struct tcf_exts e;
-
- err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map);
- if (err < 0)
- return err;
-
- memcpy(&cp, p, sizeof(cp));
- memset(&new_filter_result, 0, sizeof(new_filter_result));
-
- if (old_r)
- memcpy(&cr, r, sizeof(cr));
- else
- memset(&cr, 0, sizeof(cr));
-
- if (tb[TCA_TCINDEX_HASH])
- cp.hash = nla_get_u32(tb[TCA_TCINDEX_HASH]);
-
- if (tb[TCA_TCINDEX_MASK])
- cp.mask = nla_get_u16(tb[TCA_TCINDEX_MASK]);
-
- if (tb[TCA_TCINDEX_SHIFT])
- cp.shift = nla_get_u32(tb[TCA_TCINDEX_SHIFT]);
-
- err = -EBUSY;
- /* Hash already allocated, make sure that we still meet the
- * requirements for the allocated hash.
- */
- if (cp.perfect) {
- if (!valid_perfect_hash(&cp) ||
- cp.hash > cp.alloc_hash)
- goto errout;
- } else if (cp.h && cp.hash != cp.alloc_hash)
- goto errout;
-
- err = -EINVAL;
- if (tb[TCA_TCINDEX_FALL_THROUGH])
- cp.fall_through = nla_get_u32(tb[TCA_TCINDEX_FALL_THROUGH]);
-
- if (!cp.hash) {
- /* Hash not specified, use perfect hash if the upper limit
- * of the hashing index is below the threshold.
- */
- if ((cp.mask >> cp.shift) < PERFECT_HASH_THRESHOLD)
- cp.hash = (cp.mask >> cp.shift) + 1;
- else
- cp.hash = DEFAULT_HASH_SIZE;
- }
-
- if (!cp.perfect && !cp.h)
- cp.alloc_hash = cp.hash;
-
- /* Note: this could be as restrictive as if (handle & ~(mask >> shift))
- * but then, we'd fail handles that may become valid after some future
- * mask change. While this is extremely unlikely to ever matter,
- * the check below is safer (and also more backwards-compatible).
- */
- if (cp.perfect || valid_perfect_hash(&cp))
- if (handle >= cp.alloc_hash)
- goto errout;
-
-
- err = -ENOMEM;
- if (!cp.perfect && !cp.h) {
- if (valid_perfect_hash(&cp)) {
- cp.perfect = kcalloc(cp.hash, sizeof(*r), GFP_KERNEL);
- if (!cp.perfect)
- goto errout;
- balloc = 1;
- } else {
- cp.h = kcalloc(cp.hash, sizeof(f), GFP_KERNEL);
- if (!cp.h)
- goto errout;
- balloc = 2;
- }
- }
-
- if (cp.perfect)
- r = cp.perfect + handle;
- else
- r = tcindex_lookup(&cp, handle) ? : &new_filter_result;
-
- if (r == &new_filter_result) {
- f = kzalloc(sizeof(*f), GFP_KERNEL);
- if (!f)
- goto errout_alloc;
- }
-
- if (tb[TCA_TCINDEX_CLASSID]) {
- cr.res.classid = nla_get_u32(tb[TCA_TCINDEX_CLASSID]);
- tcf_bind_filter(tp, &cr.res, base);
- }
-
- tcf_exts_change(tp, &cr.exts, &e);
-
- tcf_tree_lock(tp);
- if (old_r && old_r != r)
- memset(old_r, 0, sizeof(*old_r));
-
- memcpy(p, &cp, sizeof(cp));
- memcpy(r, &cr, sizeof(cr));
-
- if (r == &new_filter_result) {
- struct tcindex_filter **fp;
-
- f->key = handle;
- f->result = new_filter_result;
- f->next = NULL;
- for (fp = p->h+(handle % p->hash); *fp; fp = &(*fp)->next)
- /* nothing */;
- *fp = f;
- }
- tcf_tree_unlock(tp);
-
- return 0;
-
-errout_alloc:
- if (balloc == 1)
- kfree(cp.perfect);
- else if (balloc == 2)
- kfree(cp.h);
-errout:
- tcf_exts_destroy(tp, &e);
- return err;
-}
-
-static int
-tcindex_change(struct tcf_proto *tp, unsigned long base, u32 handle,
- struct nlattr **tca, unsigned long *arg)
-{
- struct nlattr *opt = tca[TCA_OPTIONS];
- struct nlattr *tb[TCA_TCINDEX_MAX + 1];
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg;
- int err;
-
- pr_debug("tcindex_change(tp %p,handle 0x%08x,tca %p,arg %p),opt %p,"
- "p %p,r %p,*arg 0x%lx\n",
- tp, handle, tca, arg, opt, p, r, arg ? *arg : 0L);
-
- if (!opt)
- return 0;
-
- err = nla_parse_nested(tb, TCA_TCINDEX_MAX, opt, tcindex_policy);
- if (err < 0)
- return err;
-
- return tcindex_set_parms(tp, base, handle, p, r, tb, tca[TCA_RATE]);
-}
-
-
-static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter *f, *next;
- int i;
-
- pr_debug("tcindex_walk(tp %p,walker %p),p %p\n", tp, walker, p);
- if (p->perfect) {
- for (i = 0; i < p->hash; i++) {
- if (!p->perfect[i].res.class)
- continue;
- if (walker->count >= walker->skip) {
- if (walker->fn(tp,
- (unsigned long) (p->perfect+i), walker)
- < 0) {
- walker->stop = 1;
- return;
- }
- }
- walker->count++;
- }
- }
- if (!p->h)
- return;
- for (i = 0; i < p->hash; i++) {
- for (f = p->h[i]; f; f = next) {
- next = f->next;
- if (walker->count >= walker->skip) {
- if (walker->fn(tp, (unsigned long) &f->result,
- walker) < 0) {
- walker->stop = 1;
- return;
- }
- }
- walker->count++;
- }
- }
-}
-
-
-static int tcindex_destroy_element(struct tcf_proto *tp,
- unsigned long arg, struct tcf_walker *walker)
-{
- return __tcindex_delete(tp, arg, 0);
-}
-
-
-static void tcindex_destroy(struct tcf_proto *tp)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcf_walker walker;
-
- pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p);
- walker.count = 0;
- walker.skip = 0;
- walker.fn = &tcindex_destroy_element;
- tcindex_walk(tp, &walker);
- kfree(p->perfect);
- kfree(p->h);
- kfree(p);
- tp->root = NULL;
-}
-
-
-static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
- struct sk_buff *skb, struct tcmsg *t)
-{
- struct tcindex_data *p = PRIV(tp);
- struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
- unsigned char *b = skb_tail_pointer(skb);
- struct nlattr *nest;
-
- pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n",
- tp, fh, skb, t, p, r, b);
- pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h);
-
- nest = nla_nest_start(skb, TCA_OPTIONS);
- if (nest == NULL)
- goto nla_put_failure;
-
- if (!fh) {
- t->tcm_handle = ~0; /* whatever ... */
- NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash);
- NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask);
- NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift);
- NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through);
- nla_nest_end(skb, nest);
- } else {
- if (p->perfect) {
- t->tcm_handle = r-p->perfect;
- } else {
- struct tcindex_filter *f;
- int i;
-
- t->tcm_handle = 0;
- for (i = 0; !t->tcm_handle && i < p->hash; i++) {
- for (f = p->h[i]; !t->tcm_handle && f;
- f = f->next) {
- if (&f->result == r)
- t->tcm_handle = f->key;
- }
- }
- }
- pr_debug("handle = %d\n", t->tcm_handle);
- if (r->res.class)
- NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid);
-
- if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
- goto nla_put_failure;
- nla_nest_end(skb, nest);
-
- if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
- goto nla_put_failure;
- }
-
- return skb->len;
-
-nla_put_failure:
- nlmsg_trim(skb, b);
- return -1;
-}
-
-static struct tcf_proto_ops cls_tcindex_ops __read_mostly = {
- .kind = "tcindex",
- .classify = tcindex_classify,
- .init = tcindex_init,
- .destroy = tcindex_destroy,
- .get = tcindex_get,
- .put = tcindex_put,
- .change = tcindex_change,
- .delete = tcindex_delete,
- .walk = tcindex_walk,
- .dump = tcindex_dump,
- .owner = THIS_MODULE,
-};
-
-static int __init init_tcindex(void)
-{
- return register_tcf_proto_ops(&cls_tcindex_ops);
-}
-
-static void __exit exit_tcindex(void)
-{
- unregister_tcf_proto_ops(&cls_tcindex_ops);
-}
-
-module_init(init_tcindex)
-module_exit(exit_tcindex)
-MODULE_LICENSE("GPL");