1 #ifndef __EEMCS_EXPT_H__
2 #define __EEMCS_EXPT_H__
3 #include <linux/kernel.h>
4 #include <linux/skbuff.h>
5 #include <asm/atomic.h>
7 #include "eemcs_ccci.h"
8 #include "eemcs_char.h"
9 #include "lte_df_main.h"
11 /* Exception message magic number*/
12 #define MD_EX_MAGIC 0x5745444D //"MDEX"
14 /* Exception Mode Enumeration */
15 #define EEMCS_EX_MODE_MASK (0xF0000000)
17 /* Exception show string length*/
18 #define EE_BUF_LEN (256)
20 /* Exception dump flag*/
21 #define CCCI_AED_DUMP_EX_MEM (1<<0)
22 #define CCCI_AED_DUMP_MD_IMG_MEM (1<<1)
24 /* Modem boot up init stage number*/
25 #define MD_TSID_MAGIC 0x43525442 //"BTRC"
29 MD_INIT_START_BOOT
= 0x00000000,
30 MD_INIT_CHK_ID
= 0x5555FFFF,
32 MD_EX_CHK_ID
= 0x45584350,
33 MD_EX_REC_OK
= 0x00000006,
34 MD_EX_REC_OK_CHK_ID
= 0x45524543,
35 MD_EX_RESUME_CHK_ID
= 0x7,
36 CCCI_DRV_VER_ERROR
= 0x5,
37 // System channel, MD --> AP message start from 0x1000
38 MD_WDT_MONITOR
= 0x1000,
39 MD_WAKEN_UP
= 0x10000,
43 MD_EE_CASE_NORMAL
= 0,
45 MD_EE_CASE_ONLY_EX_OK
,
48 MD_EE_CASE_NO_RESPONSE
,
49 MD_EE_CASE_AP_MASK_I_BIT_TOO_LONG
,
54 MD_EX_TYPE_INVALID
= 0,
57 MD_EX_TYPE_PREF_ABT
= 3,
58 MD_EX_TYPE_DATA_ABT
= 4,
59 MD_EX_TYPE_ASSERT
= 5,
60 MD_EX_TYPE_FATALERR_TASK
= 6,
61 MD_EX_TYPE_FATALERR_BUF
= 7,
62 MD_EX_TYPE_LOCKUP
= 8,
63 MD_EX_TYPE_ASSERT_DUMP
= 9,
64 MD_EX_TYPE_ASSERT_FAIL
= 10,
65 DSP_EX_TYPE_ASSERT
= 11,
66 DSP_EX_TYPE_EXCEPTION
= 12,
67 DSP_EX_FATAL_ERROR
= 13,
71 #define MD_EX_TYPE_EMI_CHECK 99
73 /* MODEM MAUI Exception header (4 bytes)*/
74 typedef struct _exception_record_header_t
76 unsigned char ex_type
;
77 unsigned char ex_nvram
;
78 unsigned short ex_serial_num
;
81 /* MODEM MAUI Environment information (164 bytes) */
82 typedef struct _ex_environment_info_t
84 unsigned char boot_mode
;
85 unsigned char reserved1
[8];
86 unsigned char execution_unit
[8];
87 unsigned char reserved2
[147];
90 /* MODEM MAUI Special for fatal error (8 bytes)*/
91 typedef struct _ex_fatalerror_code_t
97 /* MODEM MAUI fatal error (296 bytes)*/
98 typedef struct _ex_fatalerror_t
100 EX_FATALERR_CODE_T error_code
;
101 unsigned char reserved1
[288];
104 /* MODEM MAUI Assert fail (296 bytes)*/
105 typedef struct _ex_assert_fail_t
107 unsigned char filename
[24];
108 unsigned int linenumber
;
109 unsigned int parameters
[3];
110 unsigned char reserved1
[256];
113 /* MODEM MAUI Globally exported data structure (300 bytes) */
116 EX_FATALERR_T fatalerr
;
117 EX_ASSERTFAIL_T
assert;
120 /* MODEM MAUI Standard structure of an exception log ( */
121 typedef struct _ex_exception_log_t
124 unsigned char reserved1
[12];
125 EX_ENVINFO_T envinfo
;
126 unsigned char reserved2
[36];
127 EX_CONTENT_T content
;
130 typedef struct dump_debug_info
134 unsigned int more_info
;
140 unsigned int parameters
[3];
149 unsigned char execution_unit
[9]; // 8+1
152 unsigned int parameters
[3];
155 unsigned char execution_unit
[9];
159 unsigned char execution_unit
[9];
160 unsigned int err_code
[2];
168 void (*platform_call
)(void *data
);
172 typedef enum EEMCS_EXCEPTION_STATE_e
{
173 EEMCS_EX_INVALID
= -1,
176 EEMCS_EX_DHL_DL_RDY
= 2,
177 EEMCS_EX_INIT_DONE
= 3,
179 EEMCS_EX_REC_MSG_OK
= 5,
180 } EEMCS_EXCEPTION_STATE
;
186 KAL_UINT32 expt_txq_id
;
187 KAL_UINT32 expt_rxq_id
;
190 typedef struct EEMCS_EXCEPTION_RECORD_st
{
191 KAL_UINT32 id
; // qno for Q, port id for port
192 struct sk_buff_head skb_list
;
194 } EEMCS_EXCEPTION_RECORD
;
196 typedef void (*EEMCS_CCCI_EXCEPTION_IND_CALLBACK
)(KAL_UINT32 msg_id
);
198 //#define CCCI_CDEV_NUM (END_OF_CCCI_CDEV - START_OF_CCCI_CDEV)
199 #define CCCI_CDEV_NUM (CCCI_PORT_NUM_MAX - START_OF_CCCI_CDEV)
200 #define CCCI_PORT_NUM CCCI_PORT_NUM_MAX
201 typedef struct EEMCS_EXCEPTION_SET_st
{
203 spinlock_t expt_cb_lock
;
204 struct timer_list md_ex_monitor
;
205 EEMCS_CCCI_EXCEPTION_IND_CALLBACK expt_cb
[CCCI_PORT_NUM_MAX
];
206 KAL_UINT8
*expt_info_mem
;
208 EEMCS_EXCEPTION_RECORD txq
[SDIO_TX_Q_NUM
];
209 EEMCS_EXCEPTION_RECORD rxq
[SDIO_RX_Q_NUM
];
210 EEMCS_EXCEPTION_RECORD port
[CCCI_PORT_NUM
]; // Record CHAR DEV DL PKTs
211 atomic_t ptx_blk_cnt
[CCCI_PORT_NUM
]; // Tx operation blocked in DEVICE layer
212 atomic_t prx_blk_cnt
[CCCI_PORT_NUM
]; // Rx operation blocked in DEVICE layer
213 atomic_t ptx_drp_cnt
[CCCI_PORT_NUM
]; // Tx operation dropped in DEVICE layer
214 atomic_t prx_drp_cnt
[CCCI_PORT_NUM
]; // Rx operation dropped in DEVICE layer
215 atomic_t ccci_tx_drp_cnt
[CCCI_PORT_NUM
]; // Tx operation dropped in CCCI layer
216 atomic_t ccci_rx_drp_cnt
[CCCI_PORT_NUM
]; // Rx operation dropped in CCCI layer
217 } EEMCS_EXCEPTION_SET
;
224 /*******************************************************************************
226 ********************************************************************************/
227 KAL_INT32
eemcs_expt_handshake(struct sk_buff
*skb
);
228 KAL_INT32
eemcs_bootup_trace(struct sk_buff
*skb
);
229 void eemcs_aed(unsigned int dump_flag
, char *aed_str
);
230 KAL_INT32
get_md_expt_type(void);
232 KAL_INT32
eemcs_expt_mod_init(void);
233 void eemcs_expt_exit(void);
234 KAL_UINT32
eemcs_register_expt_callback(EEMCS_CCCI_EXCEPTION_IND_CALLBACK func_ptr
);
235 KAL_UINT32
eemcs_unregister_expt_callback(KAL_UINT32 id
);
236 KAL_INT32
eemcs_expt_log_port(struct sk_buff
*skb
, KAL_UINT32 port_id
);
238 void eemcs_expt_dev_tx_block(KAL_UINT32 port_id
);
239 void eemcs_expt_dev_tx_drop(KAL_UINT32 port_id
);
240 void eemcs_expt_dev_rx_block(KAL_UINT32 port_id
);
241 void eemcs_expt_dev_rx_drop(KAL_UINT32 port_id
);
242 void eemcs_expt_ccci_tx_drop(KAL_UINT32 port_id
);
243 void eemcs_expt_ccci_rx_drop(KAL_UINT32 port_id
);
244 KAL_INT32
eemcs_expt_flush(void);
245 void eemcs_expt_reset(void);
247 kal_bool
set_exception_mode(EEMCS_EXCEPTION_STATE mode
);
248 kal_bool
is_exception_mode(EEMCS_EXCEPTION_STATE
*mode
);
249 kal_bool
is_valid_exception_port(KAL_UINT32 port_id
, kal_bool is_rx
);
250 kal_bool
is_valid_exception_tx_channel(CCCI_CHANNEL_T chn
);
251 ccci_expt_port_cfg
* get_expt_port_info(KAL_UINT32 port_id
);
253 ssize_t
eemcs_expt_show_statistics(char *buf
);
254 void eemcs_expt_reset_statistics(void);
257 #define hif_expt_dl_pkt_in_swq mtlte_df_DL_pkt_in_swq
258 #define hif_expt_dl_read_swq mtlte_df_DL_read_skb_from_swq
259 #define hif_expt_dl_pkt_handle_complete mtlte_df_DL_pkt_handle_complete
260 #define hif_expt_ul_pkt_in_swq mtlte_df_UL_pkt_in_swq
261 //#define hif_expt_ul_read_swq mtlte_df_UL_read_skb_from_swq
265 #endif // __EEMCS_EXPT_H__