1 #if !defined(__AEE_H__)
4 #include <linux/kernel.h>
5 #include <linux/sched.h>
6 #include <linux/mtk_ram_console.h>
8 #define AEE_MODULE_NAME_LENGTH 64
9 #define AEE_PROCESS_NAME_LENGTH 256
10 #define AEE_BACKTRACE_LENGTH 3072
21 AE_KE
= 0, /* Fatal Exception */
27 AE_ANR
, /* Error or Warning or Defect */
31 AE_MANUAL
, /* Manual Raise */
34 AE_KERNEL_PROBLEM_REPORT
= 1000,
35 AE_SYSTEM_JAVA_DEFECT
,
36 AE_SYSTEM_NATIVE_DEFECT
,
37 } AE_EXP_CLASS
; /* General Program Exception Class */
40 AEE_REBOOT_MODE_NORMAL
= 0,
41 AEE_REBOOT_MODE_KERNEL_OOPS
,
42 AEE_REBOOT_MODE_KERNEL_PANIC
,
43 AEE_REBOOT_MODE_NESTED_EXCEPTION
,
45 AEE_REBOOT_MODE_MANUAL_KDUMP
,
48 #define AEE_SZ_SYMBOL_L 140
49 #define AEE_SZ_SYMBOL_S 80
54 char pc_symbol
[AEE_SZ_SYMBOL_S
]; /* Now we use different symbol length for PC &LR */
55 char lr_symbol
[AEE_SZ_SYMBOL_L
];
58 /* aee_process_info struct should strictly small than ipanic_buffer, now 4KB */
59 struct aee_process_info
{
60 char process_path
[AEE_PROCESS_NAME_LENGTH
];
61 char backtrace
[AEE_BACKTRACE_LENGTH
];
62 struct aee_bt_frame ke_frame
;
65 struct aee_process_bt
{
68 struct aee_bt_frame
*entries
;
72 struct aee_thread_reg
{
77 struct aee_user_thread_stack
{
80 unsigned char *Userthread_Stack
; //8k stack ,define to char only for match 64bit/32bit
83 struct aee_user_thread_maps
{
85 int Userthread_mapsLength
;
86 unsigned char *Userthread_maps
; //8k stack ,define to char only for match 64bit/32bit
92 struct list_head list
;
96 char module
[AEE_MODULE_NAME_LENGTH
];
97 /* consist with struct aee_process_info */
98 char process_path
[AEE_PROCESS_NAME_LENGTH
];
99 char backtrace
[AEE_BACKTRACE_LENGTH
];
100 struct aee_bt_frame ke_frame
;
109 int android_main_len
;
111 int android_radio_len
;
112 char *android_system
;
113 int android_system_len
;
115 char *userspace_info
;
116 int userspace_info_len
;
125 struct aee_user_thread_stack userthread_stack
;
126 struct aee_thread_reg userthread_reg
;
127 struct aee_user_thread_maps userthread_maps
;
132 struct aee_kernel_api
{
133 void (*kernel_reportAPI
) (const AE_DEFECT_ATTR attr
, const int db_opt
, const char *module
,
135 void (*md_exception
) (const char *assert_type
, const int *log
, int log_size
, const int *phy
,
136 int phy_size
, const char *detail
, const int db_opt
);
137 void (*md32_exception
) (const char *assert_type
, const int *log
, int log_size
,
138 const int *phy
, int phy_size
, const char *detail
, const int db_opt
);
139 void (*combo_exception
) (const char *assert_type
, const int *log
, int log_size
,
140 const int *phy
, int phy_size
, const char *detail
,
144 void aee_sram_printk(const char *fmt
, ...);
145 int aee_nested_printf(const char *fmt
, ...);
146 void aee_wdt_irq_info(void);
147 void aee_wdt_fiq_info(void *arg
, void *regs
, void *svc_sp
);
148 void aee_trigger_kdb(void);
149 struct aee_oops
*aee_oops_create(AE_DEFECT_ATTR attr
, AE_EXP_CLASS clazz
, const char *module
);
150 void aee_oops_set_backtrace(struct aee_oops
*oops
, const char *backtrace
);
151 void aee_oops_set_process_path(struct aee_oops
*oops
, const char *process_path
);
152 void aee_oops_free(struct aee_oops
*oops
);
153 /* powerkey press,modules use bits */
154 #define AE_WDT_Powerkey_DEVICE_PATH "/dev/kick_powerkey"
155 #define WDT_SETBY_DEFAULT (0)
156 #define WDT_SETBY_Backlight (1<<0)
157 #define WDT_SETBY_Display (1<<1)
158 #define WDT_SETBY_SF (1<<2)
159 #define WDT_SETBY_PM (1<<3)
160 #define WDT_SETBY_WMS_DISABLE_PWK_MONITOR (0xAEEAEE00)
161 #define WDT_SETBY_WMS_ENABLE_PWK_MONITOR (0xAEEAEE01)
162 #define WDT_PWK_HANG_FORCE_HWT (0xAEE0FFFF)
165 #define AEEIOCTL_RT_MON_Kick _IOR('p', 0x0A, int)
166 #define AE_WDT_DEVICE_PATH "/dev/RT_Monitor"
167 /* QHQ RT Monitor end */
169 /* DB dump option bits, set relative bit to 1 to include related file in db */
170 #define DB_OPT_DEFAULT (0)
171 #define DB_OPT_FTRACE (1<<0)
172 #define DB_OPT_STORAGE_LOG (1<<1)
173 #define DB_OPT_NE_JBT_TRACES (1<<2)
174 #define DB_OPT_SWT_JBT_TRACES (1<<3)
175 #define DB_OPT_VM_TRACES (1<<4)
176 #define DB_OPT_DUMPSYS_ACTIVITY (1<<5)
177 #define DB_OPT_DUMPSYS_WINDOW (1<<6)
178 #define DB_OPT_DUMPSYS_GFXINFO (1<<7)
179 #define DB_OPT_DUMPSYS_SURFACEFLINGER (1<<8)
180 #define DB_OPT_DISPLAY_HANG_DUMP (1<<9)
181 #define DB_OPT_LOW_MEMORY_KILLER (1<<10)
182 #define DB_OPT_PROC_MEM (1<<11)
183 #define DB_OPT_FS_IO_LOG (1<<12)
184 #define DB_OPT_PROCESS_COREDUMP (1<<13)
185 #define DB_OPT_VM_HPROF (1<<14)
186 #define DB_OPT_PROCMEM (1<<15)
187 #define DB_OPT_DUMPSYS_INPUT (1<<16)
188 #define DB_OPT_MMPROFILE_BUFFER (1<<17)
189 #define DB_OPT_BINDER_INFO (1<<18)
190 #define DB_OPT_WCN_ISSUE_INFO (1<<19)
191 #define DB_OPT_DUMMY_DUMP (1<<20)
192 #define DB_OPT_PID_MEMORY_INFO (1<<21)
193 #define DB_OPT_VM_OOME_HPROF (1<<22)
194 #define DB_OPT_PID_SMAPS (1<<23)
195 #define DB_OPT_PROC_CMDQ_INFO (1<<24)
196 #define DB_OPT_PROC_USKTRK (1<<25)
197 #define DB_OPT_SF_RTT_DUMP (1<<26)
198 #define DB_OPT_PAGETYPE_INFO (1<<27)
199 #define DB_OPT_DUMPSYS_PROCSTATS (1<<28)
200 #define DB_OPT_DUMP_DISPLAY (1<<29)
201 #define DB_OPT_NATIVE_BACKTRACE (1<<30)
202 #define DB_OPT_AARCH64 (1<<31)
204 #define aee_kernel_exception(module, msg...) \
205 aee_kernel_exception_api(__FILE__, __LINE__, DB_OPT_DEFAULT, module, msg)
206 #define aee_kernel_warning(module, msg...) \
207 aee_kernel_warning_api(__FILE__, __LINE__, DB_OPT_DEFAULT, module, msg)
208 #define aee_kernel_reminding(module, msg...) \
209 aee_kernel_reminding_api(__FILE__, __LINE__, DB_OPT_DEFAULT, module, msg)
210 #define aee_kernel_dal_show(msg) \
211 aee_kernel_dal_api(__FILE__, __LINE__, msg)
213 #define aed_md_exception(log, log_size, phy, phy_size, detail) \
214 aed_md_exception_api(log, log_size, phy, phy_size, detail, DB_OPT_DEFAULT)
215 #define aed_md32_exception(log, log_size, phy, phy_size, detail) \
216 aed_md32_exception_api(log, log_size, phy, phy_size, detail, DB_OPT_DEFAULT)
217 #define aed_combo_exception(log, log_size, phy, phy_size, detail) \
218 aed_combo_exception_api(log, log_size, phy, phy_size, detail, DB_OPT_DEFAULT)
220 void aee_kernel_exception_api(const char *file
, const int line
, const int db_opt
,
221 const char *module
, const char *msg
, ...);
222 void aee_kernel_warning_api(const char *file
, const int line
, const int db_opt
, const char *module
,
223 const char *msg
, ...);
224 void aee_kernel_reminding_api(const char *file
, const int line
, const int db_opt
,
225 const char *module
, const char *msg
, ...);
226 void aee_kernel_dal_api(const char *file
, const int line
, const char *msg
);
228 void aed_md_exception_api(const int *log
, int log_size
, const int *phy
, int phy_size
,
229 const char *detail
, const int db_opt
);
230 void aed_md32_exception_api(const int *log
, int log_size
, const int *phy
, int phy_size
,
231 const char *detail
, const int db_opt
);
232 void aed_combo_exception_api(const int *log
, int log_size
, const int *phy
, int phy_size
,
233 const char *detail
, const int db_opt
);
235 void aee_kernel_wdt_kick_Powkey_api(const char *module
, int msg
);
236 int aee_kernel_wdt_kick_api(int kinterval
);
237 void aee_powerkey_notify_press(unsigned long pressed
);
238 int aee_kernel_Powerkey_is_press(void);
240 void ipanic_recursive_ke(struct pt_regs
*regs
, struct pt_regs
*excp_regs
, int cpu
);
243 void aee_kernel_RT_Monitor_api(int lParam
);
244 /* QHQ RT Monitor end */
245 void mt_fiq_printf(const char *fmt
, ...);
246 void aee_register_api(struct aee_kernel_api
*aee_api
);
247 int aee_in_nested_panic(void);
248 void aee_stop_nested_panic(struct pt_regs
*regs
);
249 void aee_wdt_dump_info(void);
250 void aee_wdt_printf(const char *fmt
, ...);
252 #if defined(CONFIG_MTK_AEE_DRAM_CONSOLE)
253 void aee_dram_console_reserve_memory(void);
255 static inline void aee_dram_console_reserve_memory(void)
260 extern void *aee_excp_regs
; /* To store latest exception, in case of stack corruption */
261 #endif /* __AEE_H__ */