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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
#ifndef __aed_h
#define __aed_h
#include <generated/autoconf.h>
#include <linux/types.h>
#include <linux/bug.h>
#include <linux/aee.h>
#include <linux/kallsyms.h>
#include <linux/ptrace.h>
#define LOGD(fmt, msg...) pr_notice(fmt, ##msg)
#define LOGV(fmt, msg...)
#define LOGI LOGD
#define LOGE(fmt, msg...) pr_err(fmt, ##msg)
#define LOGW LOGE
#define IPANIC_MODULE_TAG "KERNEL-PANIC"
#define AE_INVALID 0xAEEFF000
#define AE_NOT_AVAILABLE 0xAEE00000
#define AE_DEFAULT 0xAEE00001
typedef enum {
AEE_MODE_MTK_ENG = 1,
AEE_MODE_MTK_USER,
AEE_MODE_CUSTOMER_ENG,
AEE_MODE_CUSTOMER_USER,
AEE_MODE_NOT_INIT
} AEE_MODE;
typedef enum {
AEE_FORCE_DISABLE_RED_SCREEN = 0,
AEE_FORCE_RED_SCREEN,
AEE_FORCE_NOT_SET
} AEE_FORCE_RED_SCREEN_VALUE;
typedef enum {
AE_SUCC,
AE_FAIL
} AE_ERR;
typedef enum {
AE_PASS_BY_MEM,
AE_PASS_BY_FILE,
AE_PASS_METHOD_END
} AE_PASS_METHOD;
typedef enum { AE_REQ, AE_RSP, AE_IND, AE_CMD_TYPE_END } AE_CMD_TYPE;
typedef enum {
AE_REQ_IDX,
AE_REQ_CLASS,
AE_REQ_TYPE,
AE_REQ_PROCESS,
AE_REQ_MODULE,
AE_REQ_BACKTRACE,
AE_REQ_DETAIL, /* Content of response message rule:
* if msg.arg1==AE_PASS_BY_FILE => msg->data=file path
*/
AE_REQ_ROOT_LOG_DIR,
AE_REQ_CURR_LOG_DIR,
AE_REQ_DFLT_LOG_DIR,
AE_REQ_MAIN_LOG_FILE_PATH,
AE_IND_FATAL_RAISED, /* fatal event raised, indicate AED to notify users */
AE_IND_EXP_RAISED, /* exception event raised, indicate AED to notify users */
AE_IND_WRN_RAISED, /* warning event raised, indicate AED to notify users */
AE_IND_REM_RAISED, /* reminding event raised, indicate AED to notify users */
AE_IND_LOG_STATUS, /* arg = AE_ERR */
AE_IND_LOG_CLOSE, /* arg = AE_ERR */
AE_REQ_SWITCH_DAL_BEEP, /* arg: dal on|off, seq: beep on|off */
AE_REQ_DB_COUNT, /* arg: db count */
AE_REQ_DB_FORCE_PATH, /* arg: force db path yes\no */
AE_REQ_SWITCH_EXP_LEVEL,
AE_REQ_IS_AED_READY, /* query if AED is ready for service */
AE_REQ_COREDUMP, /* msg->data=file path */
AE_REQ_SET_READFLAG, /* set read flag msg */
AE_REQ_E2S_INIT, /* Init notification of client side(application layer) of Exp2Server */
AE_REQ_USERSPACEBACKTRACE=40,
AE_REQ_USER_REG,
AE_REQ_USER_MAPS,
AE_CMD_ID_END
} AE_CMD_ID;
typedef struct {
AE_CMD_TYPE cmdType; /* command type */
AE_CMD_ID cmdId; /* command Id */
union {
unsigned int seq; /* sequence number for error checking */
int pid; /* process id */
};
union {
unsigned int arg; /* simple argument */
AE_EXP_CLASS cls; /* exception/error/defect class */
};
union {
unsigned int len; /* dynamic length argument */
int id; /* desired id */
};
unsigned int dbOption; /* DB dump option */
} AE_Msg;
/* Kernel IOCTL interface */
struct aee_dal_show {
char msg[1024];
};
struct aee_dal_setcolor {
unsigned int foreground;
unsigned int background;
unsigned int screencolor;
};
#define MAX_AEE_KERNEL_BT 16 /* we use MAX_NR_FRAME to control max unwind layer */
#define AEE_NR_FRAME 32
struct aee_ioctl {
__u32 pid;
__u32 detail;
__u32 size;
__u32 pad;
__u64 in;
__u64 out;
};
struct aee_thread_user_stack {
pid_t tid;
int StackLength;
unsigned char Userspace_Stack[8192]; //8k stack ,define to char only for match 64bit/32bit
};
#define AEEIOCTL_DAL_SHOW _IOW('p', 0x01, struct aee_dal_show) /* Show string on DAL layer */
#define AEEIOCTL_DAL_CLEAN _IO('p', 0x02) /* Clear DAL layer */
#define AEEIOCTL_SETCOLOR _IOW('p', 0x03, struct aee_dal_setcolor) /* RGB color 0x00RRGGBB */
/*#define AEEIOCTL_GET_PROCESS_BT _IOW('p', 0x04, struct aee_process_bt) *//*change new ID for KK */
#define AEEIOCTL_GET_PROCESS_BT _IOW('p', 0x04, struct aee_ioctl)
#define AEEIOCTL_GET_SMP_INFO _IOR('p', 0x05, int)
#define AEEIOCTL_SET_AEE_MODE _IOR('p', 0x06, int)
#define AEEIOCTL_GET_THREAD_REG _IOW('p', 0x07, struct aee_thread_reg)
#define AEEIOCTL_CHECK_SUID_DUMPABLE _IOR('p', 0x08, int)
/* AED debug support */
#define AEEIOCTL_WDT_KICK_POWERKEY _IOR('p', 0x09, int)
#define AEEIOCTL_RT_MON_Kick _IOR('p', 0x0A, int)
#define AEEIOCTL_SET_FORECE_RED_SCREEN _IOR('p', 0x0B, int)
#define AEEIOCTL_SET_SF_STATE _IOR('p', 0x0C, long long)
#define AEEIOCTL_GET_SF_STATE _IOW('p', 0x0D, long long)
#define AEEIOCTL_USER_IOCTL_TO_KERNEL_WANING _IOR('p', 0x0E, int)
#define AED_FILE_OPS(entry) \
static const struct file_operations proc_##entry##_fops = { \
.read = proc_##entry##_read, \
.write = proc_##entry##_write, \
}
#define AED_FILE_OPS_RO(entry) \
static const struct file_operations proc_##entry##_fops = { \
.read = proc_##entry##_read, \
}
#define AED_PROC_ENTRY(name, entry, mode)\
if (!proc_create(#name, S_IFREG | mode, aed_proc_dir, &proc_##entry##_fops)) \
LOGE("proc_create %s failed\n", #name)
struct proc_dir_entry;
int aed_proc_debug_init(struct proc_dir_entry *aed_proc_dir);
int aed_proc_debug_done(struct proc_dir_entry *aed_proc_dir);
int aed_get_process_bt(struct aee_process_bt *bt);
void aee_rr_proc_init(struct proc_dir_entry *aed_proc_dir);
void aee_rr_proc_done(struct proc_dir_entry *aed_proc_dir);
void dram_console_init(struct proc_dir_entry *aed_proc_dir);
void dram_console_done(struct proc_dir_entry *aed_proc_dir);
struct aee_oops *ipanic_oops_copy(void);
void ipanic_oops_free(struct aee_oops *oops, int erase);
#endif
|