[Feature][task-view-998]merge P56U10 version, ZXW code
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: No
Doc Update: No
Change-Id: I466f2ab935c5ede0be1803c75518b2cc4f939c15
diff --git a/ap/os/linux/linux-3.4.x/kernel/tracker.c b/ap/os/linux/linux-3.4.x/kernel/tracker.c
index 0b5e76b..3518dee 100755
--- a/ap/os/linux/linux-3.4.x/kernel/tracker.c
+++ b/ap/os/linux/linux-3.4.x/kernel/tracker.c
@@ -60,6 +60,7 @@
#define OS_IRAM_SOFTIRQ_END (OS_IRAM_SOFTIRQ_START + sizeof(t_os_iram_statistic))
#define OS_IRAM_TIMER_START (OS_IRAM_SOFTIRQ_END + sizeof(t_os_iram_statistic))
#define OS_IRAM_TIMER_END (OS_IRAM_TIMER_START + sizeof(t_os_iram_statistic))
+#define OS_IRAM_RESET_REASON_START (OS_STATISTIC_IRAM_BASE + 0x400 - sizeof(T_Reset_Reason))
#endif
#define os_statistic_check() *((volatile unsigned long *)OS_STATISTIC_IRAM_BASE)
@@ -108,6 +109,12 @@
}T_LogIram_Record;
#endif
+typedef struct
+{
+ char ramdump_reason[32]; //±ÈÈ磺ramdump_ap_appname
+ char kernel_reboot[32]; //±ÈÈ磺reboot_ap_appname
+} T_Reset_Reason;
+
/*******************************************************************************
* È«¾Ö±äÁ¿ *
*******************************************************************************/
@@ -144,6 +151,7 @@
static t_os_ddr_statistic *g_os_ddr_softirq_end_statistic;
static t_os_ddr_statistic *g_os_ddr_timer_start_statistic;
static t_os_ddr_statistic *g_os_ddr_timer_end_statistic;
+volatile T_Reset_Reason *g_os_reset_reason;
#endif
#ifndef CONFIG_SYSTEM_CAP
@@ -461,6 +469,32 @@
os_statistic_in_ddr(g_os_ddr_timer_end_statistic, func, time);
os_statistic_info_update();
}
+/*
+reason: 1 for ramdump, 2 for kernel reboot
+cpu: ap/cap/rpm/phy
+app: current->comm
+*/
+/* Started by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
+void zxic_reset_reason(int reason, const char *cpu, const char *app)
+{
+ char buffer[32];
+
+ memset(buffer, 0, sizeof(buffer));
+ switch (reason)
+ {
+ case 1:
+ snprintf(buffer, 32, "reset_ramdump_%s_%s", cpu, app);
+ memcpy(g_os_reset_reason->ramdump_reason, buffer, sizeof(buffer));
+ break;
+ case 2:
+ snprintf(buffer, 32, "reset_kreboot_%s_%s", cpu, app);
+ memcpy(g_os_reset_reason->kernel_reboot, buffer, sizeof(buffer));
+ break;
+ default:
+ break;
+ }
+}
+/* Ended by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
#ifndef CONFIG_SYSTEM_CAP
@@ -558,6 +592,8 @@
#ifndef CONFIG_SYSTEM_CAP
proc_create("kernel_log_tracker", 0, NULL, &kernel_log_tracker_proc_fops);
#endif
+
+ g_os_reset_reason = (T_Reset_Reason *)OS_IRAM_RESET_REASON_START;
/*
init_timer(&timer);
timer.expires = jiffies + 40*HZ;//msecs_to_jiffies(40*1000);//ÑÓ³Ù40Ãë