blob: 390f0d7d1553fc237052a1e138452a10c82f4ebf [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * ex_item.h
41 *
42 * Project:
43 * --------
44 * Maui_Software
45 *
46 * Description:
47 * ------------
48 * Header file for exception handling
49 *
50 *
51 * Author:
52 * -------
53 * -------
54 *
55 *============================================================================
56 * HISTORY
57 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
58 *------------------------------------------------------------------------------
59 * removed!
60 * removed!
61 * removed!
62 *
63 * removed!
64 * removed!
65 * removed!
66 *
67 * removed!
68 * removed!
69 * removed!
70 * removed!
71 *
72 * removed!
73 * removed!
74 * removed!
75 * removed!
76 * removed!
77 *
78 * removed!
79 * removed!
80 * removed!
81 *
82 * removed!
83 * removed!
84 * removed!
85 *
86 * removed!
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 * removed!
93 *
94 * removed!
95 * removed!
96 * removed!
97 * removed!
98 * removed!
99 * removed!
100 * removed!
101 * removed!
102 * removed!
103 * removed!
104 * removed!
105 * removed!
106 *
107 * removed!
108 * removed!
109 * removed!
110 *
111 * removed!
112 * removed!
113 * removed!
114 * removed!
115 *
116 * removed!
117 * removed!
118 * removed!
119 * removed!
120 *
121 * removed!
122 * removed!
123 * removed!
124 *
125 * removed!
126 * removed!
127 * removed!
128 *
129 * removed!
130 * removed!
131 *
132 * removed!
133 *
134 * removed!
135 * removed!
136 * removed!
137 *
138 * removed!
139 * removed!
140 * removed!
141 *
142 * removed!
143 * removed!
144 * removed!
145 * removed!
146 * removed!
147 * removed!
148 * removed!
149 * removed!
150 * removed!
151 * removed!
152 *
153 * removed!
154 * removed!
155 * removed!
156 *
157 * removed!
158 * removed!
159 * removed!
160 *
161 * removed!
162 * removed!
163 * removed!
164 *
165 * removed!
166 * removed!
167 * removed!
168 *
169 * removed!
170 * removed!
171 * removed!
172 *
173 * removed!
174 * removed!
175 *
176 * removed!
177 * removed!
178 *
179 * removed!
180 * removed!
181 *
182 * removed!
183 * removed!
184 * removed!
185 * removed!
186 *
187 * removed!
188 * removed!
189 * removed!
190 *
191 * removed!
192 * removed!
193 *
194 * removed!
195 *
196 * removed!
197 * removed!
198 * removed!
199 * removed!
200 *
201 * removed!
202 * removed!
203 * removed!
204 *
205 * removed!
206 * removed!
207 * removed!
208 * removed!
209 * removed!
210 * removed!
211 * removed!
212 *
213 * removed!
214 * removed!
215 *
216 * removed!
217 *
218 * removed!
219 * removed!
220 * removed!
221 *
222 * removed!
223 * removed!
224 * removed!
225 *
226 * removed!
227 * removed!
228 *
229 * removed!
230 * removed!
231 * removed!
232 *
233 * removed!
234 * removed!
235 * removed!
236 *
237 * removed!
238 * removed!
239 * removed!
240 *
241 * removed!
242 * removed!
243 * removed!
244 *
245 * removed!
246 * removed!
247 * removed!
248 *
249 * removed!
250 * removed!
251 * removed!
252 *
253 * removed!
254 * removed!
255 * removed!
256 *
257 * removed!
258 * removed!
259 * removed!
260 *
261 * removed!
262 * removed!
263 * removed!
264 *
265 * removed!
266 * removed!
267 * removed!
268 *
269 * removed!
270 * removed!
271 * removed!
272 *
273 * removed!
274 * removed!
275 * removed!
276 *
277 * removed!
278 * removed!
279 * removed!
280 *
281 * removed!
282 * removed!
283 * removed!
284 *
285 * removed!
286 * removed!
287 * removed!
288 *
289 * removed!
290 * removed!
291 *
292 * removed!
293 *
294 * removed!
295 * removed!
296 *
297 * removed!
298 * removed!
299 * removed!
300 *
301 * removed!
302 * removed!
303 *
304 * removed!
305 *
306 * removed!
307 * removed!
308 * removed!
309 *
310 * removed!
311 * removed!
312 *
313 * removed!
314 *
315 * removed!
316 * removed!
317 * removed!
318 *
319 * removed!
320 * removed!
321 *
322 * removed!
323 *
324 * removed!
325 * removed!
326 * removed!
327 *
328 * removed!
329 * removed!
330 * removed!
331 *
332 * removed!
333 * removed!
334 * removed!
335 *
336 * removed!
337 * removed!
338 * removed!
339 *
340 * removed!
341 * removed!
342 * removed!
343 * removed!
344 *
345 * removed!
346 * removed!
347 *
348 * removed!
349 *
350 * removed!
351 * removed!
352 * removed!
353 *
354 * removed!
355 * removed!
356 * removed!
357 * removed!
358 *
359 * removed!
360 * removed!
361 * removed!
362 *
363 * removed!
364 * removed!
365 * removed!
366 *
367 * removed!
368 * removed!
369 * removed!
370 *
371 * removed!
372 * removed!
373 * removed!
374 *
375 * removed!
376 * removed!
377 * removed!
378 *
379 * removed!
380 * removed!
381 * removed!
382 *
383 * removed!
384 * removed!
385 * removed!
386 *
387 * removed!
388 * removed!
389 * removed!
390 *
391 * removed!
392 * removed!
393 * removed!
394 *
395 * removed!
396 * removed!
397 * removed!
398 * removed!
399 * removed!
400 *
401 * removed!
402 * removed!
403 * removed!
404 *
405 * removed!
406 * removed!
407 * removed!
408 *
409 * removed!
410 * removed!
411 * removed!
412 * removed!
413 * removed!
414 *
415 * removed!
416 * removed!
417 * removed!
418 * removed!
419 *
420 * removed!
421 * removed!
422 * removed!
423 *
424 * removed!
425 * removed!
426 * removed!
427 *
428 * removed!
429 * removed!
430 * removed!
431 *
432 * removed!
433 * removed!
434 * removed!
435 *
436 * removed!
437 * removed!
438 * removed!
439 *
440 * removed!
441 * removed!
442 * removed!
443 *
444 * removed!
445 * removed!
446 * removed!
447 *
448 * removed!
449 * removed!
450 * removed!
451 *
452 * removed!
453 * removed!
454 * removed!
455 *
456 * removed!
457 * removed!
458 * removed!
459 *
460 * removed!
461 * removed!
462 * removed!
463 * removed!
464 * removed!
465 *
466 * removed!
467 * removed!
468 * removed!
469 *
470 * removed!
471 * removed!
472 * removed!
473 *
474 * removed!
475 * removed!
476 * removed!
477 *
478 * removed!
479 * removed!
480 * removed!
481 *
482 * removed!
483 * removed!
484 * removed!
485 *
486 * removed!
487 * removed!
488 * removed!
489 *
490 * removed!
491 * removed!
492 * removed!
493 *
494 *
495 *------------------------------------------------------------------------------
496 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
497 *============================================================================
498 ****************************************************************************/
499
500#ifndef _EX_ITEM_H
501#define _EX_ITEM_H
502
503#if !defined(__OFFLINE_EX_LOG_PARSER__)
504#include "kal_general_types.h"
505#include "reg_base.h"
506#include "intrCtrl.h"
507#include "kal_public_defs.h"
508#include "ex_public.h"
509#include "SST_mem_utility.h"
510#if defined(__MIPS_MMU_EXIST__)
511#include "mips_mmu.h"
512#endif
513#include "mpu_public.h"
514#else
515#include "ex_item_types.h"
516#include "cpu_info.h"
517#endif /*__OFFLINE_EX_LOG_PARSER__*/
518
519/*******************************************************************************
520 * Enum Type Definition
521 *******************************************************************************/
522
523
524/* exception enter category */
525typedef enum
526{
527 EXCEPTION_ENTER_CATEGORY_NO_EXCEPTION = 0,
528 EXCEPTION_ENTER_CATEGORY_TLBREFILL,
529 EXCEPTION_ENTER_CATEGORY_CACHEERR,
530 EXCEPTION_ENTER_CATEGORY_GENERAL,
531 EXCEPTION_ENTER_CATEGORY_NMI,
532 EXCEPTION_ENTER_CATEGORY_CTI,
533 EXCEPTION_ENTER_CATEGORY_DORMANT,
534 EXCEPTION_ENTER_CATEGORY_EXCEPTION_IN_ASM_BOOT,
535#if !defined(__OFFLINE_EX_LOG_PARSER__) && !defined(_MSC_VER)
536} exception_enter_category;
537#else
538} exception_enter_category_format;
539typedef kal_uint8 exception_enter_category;
540#endif
541
542typedef enum
543{
544 /* mips exception codes in cause[exccode] */
545 INTERRUPT_EXCEPTION = 0x0,
546 TLB_MOD_EXCEPTION = 0x1,
547 TLB_MISS_LOAD_EXCEPTION = 0x2,
548 TLB_MISS_STORE_EXCEPTION = 0x3,
549 ADDRESS_ERROR_LOAD_EXCEPTION = 0x4,
550 ADDRESS_ERROR_STORE_EXCEPTION = 0x5,
551 INSTR_BUS_ERROR = 0x6,
552 DATA_BUS_ERROR = 0x7,
553 SYSTEM_CALL_EXCEPTION = 0x8,
554 BREAKPOINT_EXCEPTION = 0x9,
555 RESERVED_INSTRUCTION_EXCEPTION = 0xA,
556 COPROCESSORS_UNUSABLE_EXCEPTION = 0xB,
557 INTEGER_OVERFLOW_EXCEPTION = 0xC,
558 TRAP_EXCEPTION = 0xD,
559 MSA_FLOATING_POINT_EXCEPTION = 0xE,
560 FLOATING_POINT_EXCEPTION = 0xF,
561 COPROCESSOR_2_IS_1_EXCEPTION = 0x10,
562 COR_EXTEND_UNUSABLE_EXCEPTION = 0x11,
563 COPROCESSOR_2_EXCEPTION = 0x12,
564 TLB_READ_INHIBIT_EXCEPTION = 0x13,
565 TLB_EXECUTE_INHIBIT_EXCEPTION = 0x14,
566 MSA_UNUSABLE_EXCEPTION = 0x15,
567 MDMX_EXCEPTION = 0x16,
568 WATCH_EXCEPTION = 0x17,
569 MCHECK_EXCEPTION = 0x18,
570 THREAD_EXCEPTION = 0x19,
571 DSP_UNUSABLE_EXCEPTION = 0x1A,
572 RESERVED_27_EXCEPTION = 0x1B,
573 RESERVED_28_EXCEPTION = 0x1C,
574 MPU_NOT_ALLOW_EXCEPTION = 0x1D,
575 CACHE_ERROR_EXCEPTION_DBG_MODE = 0x1E,
576 RESERVED_31_EXCEPTION = 0x1F,
577
578 /* exception types for nmi and cache error exception vectors */
579 NMI_EXCEPTION = 0x20,
580 CACHE_ERROR_EXCEPTION = 0x21,
581
582 /* These are used to replace TLB_MISS_LOAD/STORE_EXCEPTION
583 * codes when using tlb refill exception vector.
584 * TLB_MISS_LOAD/STORE_EXCEPTION code is used for tlb invalid */
585 TLB_REFILL_LOAD_EXCEPTION = 0x22,
586 TLB_REFILL_STORE_EXCEPTION = 0x23,
587
588 END_CPU_EXCEPTION_TYPE = 0x2F,
589
590 STACKACCESS_EXCEPTION = 0x30,
591 SYS_FATALERR_EXT_TASK_EXCEPTION = 0x31,
592 SYS_FATALERR_EXT_BUF_EXCEPTION = 0x32,
593 /* Assertion */
594 ASSERT_FAIL_EXCEPTION = 0x50,
595 ASSERT_DUMP_EXTENDED_RECORD = 0x51,
596 ASSERT_FAIL_NATIVE = 0x52,
597 ASSERT_CUSTOM_ADDR = 0x53,
598 ASSERT_CUSTOM_MODID = 0x54,
599 ASSERT_CUSTOM_MOFID = 0x55,
600 /* cross core triggered */
601 CC_INVALID_EXCEPTION = 0x60,
602// CC_CS_EXCEPTION = 0x61,
603 CC_MD32_EXCEPTION = 0x62,
604// CC_C2K_EXCEPTION = 0x63,
605// CC_VC_EXCEPTION = 0x64,
606 CC_USIP_EXCEPTION = 0x65,
607 CC_SCQ_EXCEPTION = 0x66,
608 CC_SONIC_EXCEPTION = 0x67,
609 /* HW triggered */
610 EMI_MPU_VIOLATION_EXCEPTION = 0x70,
611
612 AP_EXCEPTION = 0x80,
613
614 NUM_EXCEPTION,
615 END_EXCEPTION_TYPE = 0xFFFF
616#if !defined(__OFFLINE_EX_LOG_PARSER__) && !defined(_MSC_VER)
617} exception_type;
618#else
619} exception_type_format;
620typedef kal_uint16 exception_type;
621#endif
622
623typedef enum ex_maincontent_type_t
624{
625 EX_MAINCONTENT_TYPE_ASSERT = 0,
626 EX_MAINCONTENT_TYPE_FATAL,
627 EX_MAINCONTENT_TYPE_CUSTOM_ASSERT
628#if !defined(__OFFLINE_EX_LOG_PARSER__) && !defined(_MSC_VER)
629} EX_MAINCONTENT_TYPE_T;
630#else
631} EX_MAINCONTENT_TYPE_T_FORMAT;
632typedef kal_uint8 EX_MAINCONTENT_TYPE_T;
633#endif /*__OFFLINE_EX_LOG_PARSER__*/
634
635
636
637#define INTSRAM_CODE_CORRUPT "ISPRAM"
638#define DYNINTSRAM_CODE_CORRUPT "DYNISPRAM"
639#define VECTOR_TABLE_CORRUPT "INTVECT"
640#define L2SRAM_C_CODE_CORRUPT "C_L2SRAM"
641#define L2SRAM_NC_CODE_CORRUPT "NC_L2SRAM"
642#define LOCK_WAITED_TOO_LONG_CORRUPT "WAITLOCK"
643#define POSSIBLE_DEADLOCK_CORRUPT "DEADLOCK"
644#define LOCK_HELD_TOO_LONG_CORRUPT "HELDLOCK"
645#define CACHE_CORRUPT "CACHECOR"
646#define L2CACHE_LOCK_CORRUPT "L2$LOCK"
647#define DYNL2CACHE_LOCK_CORRUPT "DYNL2$L"
648#define MPU_CORRUPT "MPU"
649typedef enum
650{
651 Healthy = 0,
652 ISPRAMCorrupted = 1,
653 ISPRAMDynamicRegionCorrupted = 2,
654 SystemStackCorrupted = 3,
655 TaskStackCorrupted = 4,
656 HISRStackCorrupted = 5,
657 VectorTableCorrupted = 6,
658 L2SRAMCachedCorrupted = 7,
659 L2SRAMNonCachedCorrupted = 8,
660 SharedInternalSRAMCorrupted = 9,
661 LockWaitedTooLongCorrupted = 10,
662 PossibleDeadlockCorrupted = 11,
663 LockHeldTooLongCorrupted = 12,
664 CacheCorrupted = 13,
665 L2CacheLockCorrupted = 14,
666 DynamicL2CacheLockCorrupted = 15,
667 MPUCorrupted = 16,
668 StackFrameCorrupted = 17,
669#if !defined(__OFFLINE_EX_LOG_PARSER__) && !defined(_MSC_VER)
670} EX_DIAGNOSIS_T;
671#else
672} EX_DIAGNOSIS_T_FORMAT;
673typedef kal_uint8 EX_DIAGNOSIS_T;
674#endif
675
676typedef enum
677{
678 EX_AUTO_STEP = 0,
679 EX_BEGIN = 0,
680
681 // exception enter part
682 EX_SAVE_MDCIRQ_STATUS_BEFORE_CTI = 0x1,
683 EX_TRIGGER_CTI = 0x2,
684 EX_SAVE_MDCIRQ_STATUS_AFTER_CTI = 0x3,
685 EX_BACKUP_EX_REGISTERS = 0x4,
686 EX_STOP_SLA = 0x5,
687 EX_SSS_PF_EXCP = 0x6,
688 EX_RESTORE_IRQ_MASK_BACKUP = 0x7,
689 EX_SWITCH_WDT_PHASE1 = 0x8,
690 EX_SAVE_CORE_CONTEXT = 0x9,
691 EX_UPDATE_NON_OFFENDING_CONTEXT = 0xA,
692 EX_KICK_WDT = 0xB,
693 EX_DUMP_MPU = 0xC,
694 EX_SET_EX_MPU = 0xD,
695 EX_WAIT_FOR_OTHER_CORES = 0xE,
696 EX_MDCIRQ_MASK_ALL = 0xF,
697 EX_HANDLE_WATCH_REG = 0x10,
698 EX_CHANGE_DI_TC = 0x11,
699 EX_HALT_OTHER_TC_CLEAR_EXL = 0x12,
700 EX_RELEASE_OS_LOCKS = 0x13,
701 EX_BACKUP_EX_COUNT = 0x14,
702 EX_ENTER_EXCEPTION_SETUP_DONE = 0x15,
703 EX_ENTER_EXCEPTION_PHASE2 = 0x16,
704 EX_SAVE_OFFENDING_CACHE_LINES = 0x17,
705 EX_CM2_REGION_DUMP = 0x18,
706 EX_ENTER_EXCEPTION_PHASE3 = 0x19,
707 EX_GET_BREAK_CODE = 0x1A,
708
709 //exception handling part
710 EX_KAL_ASSERT_HANDLER = 0x30,
711 EX_KAL_FATAL_ERROR_HANDLER_INT = 0x31,
712 EX_KAL_EXCEPTION_HANDLER = 0x32,
713 EX_KAL_ECT_QUERY = 0x33,
714 EX_KAL_CTI_HANDLER = 0x34,
715 EX_EXCEPTION_HANDLER = 0x35,
716
717 //system data collection part
718 EX_INIT_PCMON = 0x40,
719 EX_KICK_WDT2 = 0x41,
720 EX_GET_PDAMON = 0x42,
721 EX_WRITE_OFFENDING_PCMON_TO_EMM = 0x43,
722 EX_KICK_WDT16 = 0x44,
723 EX_INIT_BUSMON = 0x45,
724 EX_START_PDAMON = 0x46,
725 EX_INIT_EX_OVERVIEW = 0x47,
726 EX_PREPARE_PARAM = 0x48,
727 EX_INIT_LOG = 0x49,
728 EX_KICK_WDT3 = 0x4A,
729 EX_INIT_MCU_SYSINFO = 0x4B,
730 EX_BUSDRV_GET_DUMP_INFO = 0x4C,
731 EX_KICK_WDT4 = 0x4D,
732 EX_DUMP_BUSMPU_ERR = 0x4E,
733 EX_DUMP_BUSMPU_IRQ_STS = 0x4F,
734 EX_KICK_WDT5 = 0x50,
735 EX_INIT_DSM = 0x51,
736 EX_KICK_WDT6 = 0x52,
737 EX_INIT_MPU = 0x53,
738 EX_KICK_WDT7 = 0x54,
739 EX_WAIT_USIP = 0x55,
740 EX_WAIT_MD32 = 0x56,
741 EX_WAIT_SONIC = 0x57,
742 EX_WAIT_SAP = 0x58,
743 EX_INIT_DONE = 0x59,
744
745 //writing data to exrecord & shm
746 EX_POST_INIT_EXRECORD = 0x70,
747 //autosteps
748 EX_DEFINE_MAIN_REASON_DONE = 0x7A,
749 EX_COPY_DVFS_EX_DATA = 0x7B,
750 EX_HW_DATA_SAVE_DONE = 0x7C,
751 EX_POST_INIT_EXRECORD_DONE = 0x7D,
752
753 // external communication
754 EX_CC_EXT_COMM = 0x100,
755 EX_CC_EXT_COMM_OPEN_PORT = 0x110,
756 EX_CC_EXT_COMM_OPEN_PORT_DONE = 0x13F,
757 EX_CC_EXT_COMM_CCCI_HANDSHAKE = 0x140,
758 //autosteps
759 EX_CC_EXT_COMM_CCCI_HANDSHAKE_DONE = 0x16F,
760 EX_CC_EXT_COMM_OUTPUT_META = 0x170,
761 //autosteps
762 EX_CC_EXT_COMM_OUTPUT_META_DONE = 0x180,
763 EX_CC_EXT_COMM_FLUSH_PORT = 0x181,
764 //autosteps
765 EX_CC_EXT_COMM_FLUSH_PORT_PART1 = 0x190,
766 EX_CC_EXT_COMM_FLUSH_PORT_PART2 = 0x1A0,
767 EX_CC_EXT_COMM_FLUSH_PORT_PART3 = 0x1B0,
768 EX_CC_EXT_COMM_FLUSH_PORT_PART4 = 0x1C0,
769 EX_CC_EXT_COMM_FLUSH_PORT_PART5 = 0x1D0,
770 //autosteps
771 EX_CC_EXT_COMM_FLUSH_PORT_DONE = 0x1E0,
772 EX_CC_EXT_COMM_DONE = 0x1FF,
773
774 // process
775 EX_PROCESS = 0x200,
776 EX_L1_AUDIO_RESET_DEVICE = 0x201,
777 EX_L1D_PAUSE_DSP = 0x202,
778 EX_KICK_WDT14 = 0x203,
779 EX_TL1_FORCE_STALL = 0x204,
780 EX_KICK_WDT15 = 0x205,
781 EX_MSG_OUTPUT = 0x206,
782 EX_OUTPUT_LOG = 0x207,
783 EX_USIP_CADEFA = 0x208,
784 EX_MD32_CADEFA = 0x209,
785 EX_SONIC_CADEFA = 0x20A,
786 EX_SONIC_CADEFA_DONE = 0x20B,
787 EX_OUTPUT_USIP_LOG = 0x20C,
788 EX_OUTPUT_MD32_LOG = 0x20D,
789 EX_OUTPUT_SONIC_LOG = 0x20E,
790 EX_OUTPUT_SONIC_LOG_DONE = 0x20F,
791 EX_FLC2DEBUG_ASSERT_CALLBACK = 0x210,
792 EX_FLC2DEBUG_ASSERT_CALLBACK_DONE = 0x211,
793 EX_DHL_CALL_EXCEPTION_CUSTOM_LOGGING = 0x212,
794 EX_DHL_CALL_EXCEPTION_CUSTOM_LOGGING_DONE = 0x213,
795 EX_INFO_SAVE = 0x214,
796 INITIALIZE_FDD_TABLES = 0x215,
797 INITIALIZE_FDD_TABLES_DONE = 0x216,
798 EX_SAVE_LOG = 0x217,
799 EX_SAVE_LOG_DONE = 0x218,
800 EX_PROCESS_DONE = 0x240,
801
802
803 // 1st non-offending vpe
804 EX_START_DSP_COMMUNICATION = 0x300,
805 EX_INIT_DSP = 0x301,
806 EX_INIT_USIP = 0x302,
807 //autosteps
808 EX_KICK_WDT8 = 0x30C,
809 EX_INIT_USIP_DONE = 0x30D,
810 EX_INIT_MD32 = 0x30E,
811 //autosteps
812 EX_KICK_WDT9 = 0x318,
813 EX_INIT_MD32_DONE = 0x319,
814 EX_INIT_SONIC = 0x31A,
815 //autosteps
816 EX_KICK_WDT10 = 0x324,
817 EX_INIT_SONIC_DONE = 0x325,
818 EX_INIT_DSP_DONE = 0x326,
819
820 // 2nd non-offending vpe
821 EX_START_HW_COMMUNICATION = 0x400,
822 EX_INIT_STOP_HW = 0x401,
823 EX_ASM_STOP = 0x402,
824 EX_ASM_STOP_DONE = 0x403,
825 EX_DIGIRF_MIPI_PATH_STOP = 0x404,
826 EX_DIGIRF_MIPI_PATH_STOP_DONE = 0x405,
827 EX_SCC_STOP = 0x406,
828 EX_SCC_STOP_DONE = 0x407,
829 EX_HW_DUMP = 0x408,
830 EX_DVFS_EX_DATA_READ = 0x409,
831 EX_HW_DUMP_DONE = 0x40A,
832 EX_DSP_EX_INIT = 0x40B,
833 EX_DSP_EX_INIT_DONE = 0x40C,
834 EX_INIT_STOP_HW_DONE = 0x40B,
835
836 // rest of the non-offending vpe
837 EX_START_INT_OFFSHOOT = 0x450,
838
839 // nested exception specific steps
840 EX_NESTED_LOG_INIT = 0x500,
841 EX_NESTED_PDAMON_INIT = 0x501,
842 EX_START_NESTED_PDAMON = 0x502,
843 EX_START_NESTED_PDAMON_DONE = 0x503,
844 EX_NESTED_PROCESS = 0x504,
845 EX_NESTED_PROCESS_DONE = 0x505,
846
847 // reboot
848 EX_EX_REBOOT = 0x600,
849 EX_REMOVE_SENSITIVE_FOR_DUMP = 0x601,
850 EX_KICK_WDT11 = 0x602,
851 EX_SSF_DEINIT = 0x603,
852 EX_RESET_EXCP_SP = 0x604,
853 EX_WRITE_EXRECORD = 0x605,
854
855 // reboot mp (silent reboot)
856 EX_EX_REBOOT_MP = 0x700,
857 EX_CCCI_INFO_PASSED_4MP = 0x780,
858 //autosteps
859 EX_CCCI_INFO_PASSED_4MP_DONE = 0x790,
860
861
862 EX_EX_REBOOT_MP_DONE = 0x606,
863 EX_INIT_DUMP = 0x607,
864 EX_KICK_WDT12 = 0x608,
865 EX_CCCI_INFO_PASSED = 0x609,
866 //autosteps
867 EX_CCCI_INFO_PASSED_DONE = 0x619,
868 EX_KICK_WDT13 = 0x61A,
869 EX_SWITCH_WDT_PHASE2 = 0x61B,
870 EX_CHECK_ELT_TRACES = 0x61C,
871#if defined(CHIP10992)
872 EX_CLEAN_CACHE_BEFORE_HANDOVER = 0x61D,
873 EX_CLEAN_CACHE_BEFORE_ON_DEMAND = 0x61E,
874#endif
875 //Ex flow complete step for silent reboot
876 EX_HANDOVER_MP = 0x7EF,
877
878 //Ex flow complete step for memdump
879 EX_HANDOVER = 0x7FF,
880
881 //Ex flow complete step for non-offending vpes
882 EX_ON_DEMAND = 0x7FF,
883
884 EX_RESET_HANDOVER = 0x8EF,
885
886#if !defined(__OFFLINE_EX_LOG_PARSER__) && !defined(_MSC_VER)
887} exception_flow_index;
888#else
889} exception_flow_index_format;
890typedef kal_uint16 exception_flow_index;
891#endif
892
893typedef enum {
894 AFOUND_NO_OUTPUT = 0x0,
895 AFOUND_TO_TRACE = 0x1,
896 AFOUND_TO_EXRECORD = 0x2
897} afound_output_types;
898
899/*******************************************************************************
900 * Constant Definition - Common
901 *******************************************************************************/
902/* structure usage */
903#define EX_UNIT_NAME_LEN 8
904#define NBR_TC_PER_CORE (SYS_MCU_NUM_TC/SYS_MCU_NUM_CORE)
905#define NBR_VPE_PER_CORE (SYS_MCU_NUM_VPE/SYS_MCU_NUM_CORE)
906#define NBR_CORE (SYS_MCU_NUM_CORE)
907#define TOTAL_VPE_COUNT (SYS_MCU_NUM_VPE)
908#define TOTAL_VICTIM_VPE_COUNT (TOTAL_VPE_COUNT - 1)
909
910#define SST_GET_VPE_ID(core,tc) ((core)*NBR_VPE_PER_CORE + (tc)/(NBR_TC_PER_CORE/NBR_VPE_PER_CORE))
911
912/* Use real vpe count for these*/
913#define EX_WAIT_VPE_MASK ((1 << SYS_MCU_NUM_VPE) - 1)
914#define EXCEPTION_ENTER_MASK ((1 << SYS_MCU_NUM_VPE) - 1)
915/* This is hardcoded to max nbr of tlbs in interaptiv.
916 * Can be reduced to match correct count of tlbs in hw if we know tlbs wont increase after that */
917#define NUMBER_OF_TLBS 64
918
919#if defined(__MIPS_I7200__)
920#define NBR_OF_WATCH_REGS 8
921#define NBR_OF_KSCRATCH_REGS 6
922#else
923#define NBR_OF_WATCH_REGS 4
924#define NBR_OF_KSCRATCH_REGS 3
925#endif
926
927
928/*******************************************************************************
929 * Data Structure Definition - Common
930 *******************************************************************************/
931/*******************************************************************************
932 * Macro API Definition - Common
933 *******************************************************************************/
934#define EX_GET_COREID_BY_VPEID(VPEID) (VPEID/NBR_VPE_PER_CORE)
935#define EX_GET_COREVPEID_BY_VPEID(VPEID) (VPEID % NBR_VPE_PER_CORE)
936#if defined(__MD97__) || defined(__MD97P__)
937/* For Gen97 Shaolin Configuration: 6 TCs per Core. (2:2:2) */
938#define EX_GET_MAINTC_BY_VPEID(VPEID) (EX_GET_COREVPEID_BY_VPEID(VPEID) * 2)
939#else
940#error No config yet
941#endif
942/***************************** -structure start- *******************************/
943//PRAGMA_BEGIN_PACK_STRUCT
944/* Exception header, used to track the exception type */
945typedef struct ex_exception_record_header_t
946{
947 exception_type ex_type; /* offset: 0x, length: 2 */
948 kal_uint8 ex_offending_vpe_id; /* offset: 0x, length: 1 */
949 kal_uint8 ex_offending_tc_id; /* offset: 0x, length: 1 */
950 kal_uint8 ex_nvram; /* offset: +0x, length: 1 - for nvram */
951 kal_uint8 ex_serial_num; /* offset: +0x, length: 1 - for nvram */
952 boot_mode_type boot_mode; /* offset: +0x, length: 1 - normal mode/meta mode... */
953 kal_uint8 boot_status; /* offset: +0x, length: 1 - early stage or not */
954 kal_uint32 ex_total_core; /* offset: 0x, length: 4 - how many cores in mcu */
955} EX_HEADER_T;
956
957/* SW load information */
958#define EX_SWLABEL_LEN 32
959#define EX_SWPRJ_LEN 32
960#define EX_SWFLAVOR_LEN 32
961#define EX_SWBUILDTIME_LEN 16
962typedef struct ex_sw_loadinfo_t
963{
964 kal_char sw_label[EX_SWLABEL_LEN];
965 kal_char sw_project_name[EX_SWPRJ_LEN];
966 kal_char sw_flavor[EX_SWFLAVOR_LEN];
967 kal_char sw_buildtime[EX_SWBUILDTIME_LEN];
968} EX_LOADINFO_T;
969
970
971/* First Offender information */
972typedef struct _ex_timestamp_struct
973{
974 kal_uint32 USCNT; /* offset: +0x, length: 4 */ /* us counter saved exception occuring time */
975 kal_uint32 frameno; /* offset: +0x, length: 4 */ /* frameno saved exception occuring time */
976} ex_timestamp_struct;
977typedef struct _ex_basic_offending_info_t
978{
979 ex_timestamp_struct ex_timestamp; /* offset: +0x, length: */
980 kal_char execution_unit[EX_UNIT_NAME_LEN]; /* offset: +0x, length: */
981 kal_uint32 processing_lisr; /* offset: +0x, length: */
982 kal_uint32 stack_ptr; /* offset: +0x, length: */
983 kal_uint32 lr; /* offset: +0x, length: */
984 kal_uint32 pc; /* offset: +0x, length: */
985 kal_uint8 tc_status; /* offset: +0x, length: */
986 kal_uint8 pad[3]; /* offset: +0x, length: */
987} EX_BASIC_OFFENDING_INFO_T;
988
989/* Environment information */
990typedef struct ex_diagnosis_info_t
991{ /* Diagnosis information for Healthy Check */
992 kal_char healthy_check_owner[EX_UNIT_NAME_LEN]; /* offset: +0x, length: 8 */
993 EX_DIAGNOSIS_T corrupted_owner; /* offset: +0x, length: 1 */
994 kal_uint8 ELM_status; /* offset: +0x, length: 1 */
995 kal_uint8 pad[2]; /* offset: +0x, length: 2 */
996} EX_DIAGNOSISINFO_T;
997typedef struct ex_environment_info_t
998{
999 kal_uint32 interrupt_mask[2]; /* offset: +0x, length: 8 */
1000 EX_DIAGNOSISINFO_T diagnosis; /* offset: +0x, length: 12 */
1001 kal_uint32 force_dump; /* offset: +0x, length: 4 */
1002} EX_ENVINFO_T;
1003
1004
1005/*******************************************************************************
1006 * Data Structure Definition - general cpu info
1007 *******************************************************************************/
1008typedef struct _ex_gpr_reg_t
1009{
1010 kal_uint32 ZERO;
1011 kal_uint32 AT;
1012 kal_uint32 V0;
1013 kal_uint32 V1;
1014 kal_uint32 A0;
1015 kal_uint32 A1;
1016 kal_uint32 A2;
1017 kal_uint32 A3;
1018 kal_uint32 T0;
1019 kal_uint32 T1;
1020 kal_uint32 T2;
1021 kal_uint32 T3;
1022 kal_uint32 T4;
1023 kal_uint32 T5;
1024 kal_uint32 T6;
1025 kal_uint32 T7;
1026 kal_uint32 S0;
1027 kal_uint32 S1;
1028 kal_uint32 S2;
1029 kal_uint32 S3;
1030 kal_uint32 S4;
1031 kal_uint32 S5;
1032 kal_uint32 S6;
1033 kal_uint32 S7;
1034 kal_uint32 T8;
1035 kal_uint32 T9;
1036 kal_uint32 K0;
1037 kal_uint32 K1;
1038 kal_uint32 GP;
1039 kal_uint32 SP;
1040 kal_uint32 FP_OR_S8;
1041 kal_uint32 RA;
1042} EX_GPR_REG_T;
1043
1044/* NOTE: if changing this struct, please chagne SAVE_EX_CPU_REG_T @ ex_hdlr_gcc.S macro as well */
1045typedef struct _ex_cpu_reg_t
1046{
1047 EX_GPR_REG_T GPR;
1048 kal_uint32 hi;
1049 kal_uint32 lo;
1050 kal_uint32 status;
1051 kal_uint32 cause;
1052 kal_uint32 EPC;
1053 kal_uint32 ErrorEPC;
1054 kal_uint32 BadVAddr;
1055 kal_uint32 Count;
1056 kal_uint32 VPEControl;
1057 kal_uint32 Context;
1058 kal_uint32 ContextConfig;
1059 kal_uint32 EntryHi;
1060 kal_uint32 ErrCtl;
1061#if defined(__MIPS_I7200__)
1062 kal_uint32 BadInstr;
1063 kal_uint32 BadInstrX;
1064#endif
1065} EX_CPU_REG_T;
1066
1067// Dormant Save
1068typedef struct _ex_min_cpu_reg_t
1069{
1070 kal_uint32 RA;
1071 kal_uint32 status;
1072 kal_uint32 EPC;
1073 kal_uint32 cause;
1074 kal_uint32 SP;
1075 kal_uint32 BadVAddr;
1076 kal_uint32 reserved0;
1077 kal_uint32 reserved1;
1078} EX_CPU_MIN_REG_T;
1079
1080typedef struct _ex_tc_reg_t
1081{
1082 EX_GPR_REG_T GPR;
1083 kal_uint32 hi;
1084 kal_uint32 lo;
1085 /* Thread Context per-TC */
1086 kal_uint32 TCStatus;
1087 kal_uint32 TCBind;
1088 kal_uint32 TCRestart;
1089 kal_uint32 TCHalt;
1090 kal_uint32 TCContext;
1091 kal_uint32 TCSchedule;
1092#if defined(__MIPS_IA__)
1093 kal_uint32 TCScheFBack;
1094 kal_uint32 TCOpt;
1095#endif
1096 kal_uint32 UserLocal;
1097 kal_uint32 LLAddr;
1098 kal_uint32 EntryHi;
1099 kal_uint32 Status;
1100#if defined(__MIPS_I7200__)
1101 kal_uint32 BatchCacheOpStatus;
1102#endif
1103#if defined(__MIPS_IA__)
1104 kal_uint32 PerfCtl0;
1105 kal_uint32 PerfCtl1;
1106
1107#endif
1108 kal_uint32 PerfCnt0;
1109 kal_uint32 PerfCnt1;
1110#if defined(__MIPS_I7200__)
1111 kal_uint32 PerfCnt2;
1112 kal_uint32 PerfCnt3;
1113#endif
1114} EX_TC_REG_T;
1115
1116typedef struct _ex_vpe_reg_t
1117{
1118 /* Thread Context per-VPE */
1119 kal_uint32 SRSConf0;
1120 kal_uint32 SRSCtl;
1121 kal_uint32 SRSMap;
1122
1123 /* Configuration and Status */
1124 kal_uint32 Config;
1125 kal_uint32 Config2;
1126 kal_uint32 Config5;
1127 kal_uint32 Config7;
1128 kal_uint32 EBase;
1129 kal_uint32 IntCtl;
1130
1131 /*TLB Management */
1132 kal_uint32 Index;
1133 kal_uint32 EntryLo0;
1134 kal_uint32 EntryLo1;
1135 kal_uint32 Context;
1136 kal_uint32 ContextConfig;
1137 kal_uint32 PageMask;
1138 kal_uint32 PageGrain;
1139 kal_uint32 Wired;
1140 kal_uint32 BadVAddr;
1141
1142 /* Memory Segmentation */
1143 kal_uint32 SegCtl0;
1144 kal_uint32 SegCtl1;
1145 kal_uint32 SegCtl2;
1146
1147 /* Exception Control */
1148 kal_uint32 Cause;
1149 kal_uint32 EPC;
1150 kal_uint32 ErrorEPC;
1151#if defined(__MIPS_I7200__)
1152 kal_uint32 BadInstr;
1153 kal_uint32 BadInstrX;
1154 kal_uint32 BEVVA;
1155#endif
1156
1157 /* Timer */
1158 kal_uint32 Count;
1159 kal_uint32 Compare;
1160
1161 /* Cache Management */
1162 kal_uint32 ITagLo;
1163 kal_uint32 IDataLo;
1164 kal_uint32 IDataHi;
1165 kal_uint32 DTagLo;
1166 kal_uint32 DTagHi;
1167 kal_uint32 DDataLo;
1168#if defined(__MIPS_IA__)
1169 kal_uint32 L23TagLo;
1170 kal_uint32 L23DataLo;
1171 kal_uint32 L23DataHi;
1172#endif
1173 kal_uint32 ErrCtl;
1174 kal_uint32 CacheErr;
1175
1176 /* VPE Management per-VPE */
1177 kal_uint32 VPEControl;
1178 kal_uint32 VPEConf0;
1179 kal_uint32 VPEConf1;
1180#if defined(__MIPS_IA__)
1181 kal_uint32 VPESchedule;
1182 kal_uint32 VPEScheFBack;
1183#endif
1184 kal_uint32 VPEOpt;
1185
1186
1187 /* Performance Monitoring */
1188 /* Debug and Trace */
1189 kal_uint32 Debug;
1190 kal_uint32 DEPC;
1191 kal_uint32 WatchLo[NBR_OF_WATCH_REGS];
1192 kal_uint32 WatchHi[NBR_OF_WATCH_REGS];
1193 kal_uint32 YQMask;
1194#if defined(__MIPS_I7200__)
1195 kal_uint32 KScratch[NBR_OF_KSCRATCH_REGS];
1196#endif
1197}EX_VPE_REG_T;
1198
1199typedef struct _ex_cm2_error_info_t
1200{
1201 kal_uint32 ErrorMask;
1202 kal_uint32 ErrorCause;
1203 kal_uint32 ErrorAddr;
1204 kal_uint32 ErrorMult;
1205} EX_CM2_ERROR_INFO_T;
1206
1207typedef struct _ex_core_reg_t
1208{
1209 /* VPE Management per-CORE */
1210 kal_uint32 MVPControl;
1211 kal_uint32 MVPConf0;
1212 kal_uint32 MVPConf1;
1213 kal_uint32 CDMMBase;
1214#if defined(__MIPS_I7200__)
1215 kal_uint32 BatchCacheOpControl;
1216 kal_uint32 SRAMCoreControl;
1217#endif
1218 EX_VPE_REG_T vperegs[NBR_VPE_PER_CORE];
1219 EX_TC_REG_T tcregs[NBR_TC_PER_CORE];
1220} EX_CORE_REG_T;
1221
1222typedef struct _ex_core_info_t
1223{
1224 /* VPE Management per-CORE */
1225 kal_uint32 MVPControl;
1226 kal_uint32 MVPConf0;
1227 kal_uint32 MVPConf1;
1228 kal_uint32 CDMMBase;
1229#if defined(__MIPS_I7200__)
1230 kal_uint32 BatchCacheOpControl;
1231 kal_uint32 SRAMCoreControl;
1232#endif
1233} EX_CORE_INFO_T;
1234
1235#if !defined(__OFFLINE_EX_LOG_PARSER__)
1236#define EX_CACHE_LINES_SAVED 4
1237typedef struct _ex_interaptiv_t
1238{
1239 EX_CORE_REG_T coreregs[NBR_CORE];
1240 EX_CM2_ERROR_INFO_T cm2_error_info;
1241 void *cm2_reg_dump;
1242 /* struct CPC_State? */
1243 /* struct GIC_State? */
1244 /* struct ITC_State? */
1245
1246 struct l1_icache_line offending_l1_icache_data[EX_CACHE_LINES_SAVED];
1247 struct l2_cache_line offending_l2_icache_data[EX_CACHE_LINES_SAVED];
1248#if defined(__MIPS_MMU_EXIST__)
1249 MIPS_MMU_INFO_T tlbs[SYS_MCU_NUM_VPE][NUMBER_OF_TLBS];
1250#endif
1251} EX_INTERAPTIV_T;
1252#endif /* !__OFFLINE_EX_LOG_PARSER__ */
1253
1254typedef struct _ex_info_t
1255{
1256 EX_CPU_REG_T *SST_Exception_Regs;
1257 kal_uint32 SST_Exception_Timestamp;
1258 kal_uint32 SST_Exception_GLB_Timestamp;
1259 exception_enter_category ExceptionEnterCategory;
1260 kal_uint16 global_exception_flag;
1261 kal_uint8 vpeid;
1262 kal_uint8 tcid;
1263} EX_INFO_T;
1264
1265
1266/*******************************************************************************
1267 * Data Structure Definition - FULL_OFFENDING_INFO for the 1st offender
1268 *******************************************************************************/
1269#define EX_STACK_DUMP_LEN 7
1270typedef struct _ex_full_offending_info_t
1271{
1272 EX_TC_REG_T tc_info;
1273 EX_VPE_REG_T vpe_info;
1274 EX_CORE_INFO_T core_info;
1275 exception_enter_category ex_enter_category;
1276 kal_uint8 pad[3];
1277 kal_uint32 stack_dump[EX_STACK_DUMP_LEN];
1278} EX_FULL_OFFENDING_INFO_T;
1279
1280/*******************************************************************************
1281 * Data Structure Definition - VICTIM_INFO
1282 *******************************************************************************/
1283typedef struct _ex_victim_info_t
1284{
1285 kal_uint8 vpeid;
1286 kal_uint8 tcid;
1287 exception_enter_category ex_enter_category;
1288 kal_uint16 global_exception_flag;
1289 kal_uint32 sst_exception_timestamp;
1290 kal_uint32 offendingPC;
1291 EX_CPU_REG_T cpu_info;
1292} EX_VICTIM_INFO_T;
1293
1294typedef struct _ex_ne_info_t
1295{
1296 exception_enter_category ex_enter_category;
1297 kal_uint16 global_exception_flag;
1298 kal_uint32 sst_exception_timestamp;
1299 kal_uint32 offendingPC;
1300 EX_CPU_REG_T cpu_info;
1301} EX_NE_INFO_T;
1302
1303/*******************************************************************************
1304 * Data Structure Definition - Fatal Error in general
1305 *******************************************************************************/
1306
1307#define EX_FATALERR_ANALYSIS_OWNER_LEN 8
1308#define EX_FATALERR_ANALYSIS_CORE_LEN 7
1309#define EX_FATALERR_DESCRIPTION_PARAM_LEN 16
1310#define EX_FATALERR_ANALYSIS_PARAM_LEN 40
1311#define EX_FATALERR_GUIDELINE_PARAM_LEN 16
1312
1313typedef struct ex_fatalerror_code_t
1314{
1315 kal_uint32 code1;
1316 kal_uint32 code2;
1317 kal_uint32 code3;
1318} EX_FATALERR_CODE_T;
1319
1320typedef struct ex_analysis_t
1321{
1322 kal_char offender[EX_UNIT_NAME_LEN];
1323 kal_bool is_cadefa_supported;
1324 kal_uint8 pad[7];
1325
1326 // TODO: remove
1327 kal_uint32 trace;
1328 kal_uint8 param[EX_FATALERR_ANALYSIS_PARAM_LEN];
1329} EX_ANALYSIS_T;
1330
1331typedef struct ex_description_t
1332{
1333 kal_uint32 trace;
1334 kal_uint8 param[EX_FATALERR_DESCRIPTION_PARAM_LEN];
1335} EX_DESCRIPTION_T;
1336
1337typedef struct ex_guideline_t
1338{
1339 kal_uint32 trace;
1340 kal_uint8 param[EX_FATALERR_GUIDELINE_PARAM_LEN];
1341} EX_GUIDELINE_T;
1342
1343
1344/*******************************************************************************
1345 * Data Structure Definition - Fatal Error extended
1346 *******************************************************************************/
1347
1348#define EX_CTRLBUFF_SRCFILE_LEN 32 /* filename */
1349typedef struct
1350{
1351 kal_char ex_his_owner[EX_UNIT_NAME_LEN]; /* control buffer owner */
1352 kal_char ex_his_source[EX_CTRLBUFF_SRCFILE_LEN]; /* source file */
1353 kal_uint32 ex_his_line; /* line number */
1354 kal_uint32 ex_his_count; /* number of identical entries */
1355} EX_CTRLBUFF_HISTORY_T;
1356
1357typedef struct
1358{
1359 kal_uint32 ex_buf_RTOS_header1; /* RTOS overhead 1, 0: allocated, else next pointer */
1360 kal_uint32 ex_buf_RTOS_header2; /* RTOS overhead 2, pointer to its control block */
1361 kal_uint32 ex_buf_KAL_header1; /* KAL overhead 1, header (0xF1F1F1F1) */
1362 kal_uint32 ex_buf_KAL_header2; /* KAL overhead 2, task ID */
1363 kal_uint32 ex_buf_KAL_header3; /* KAL overhead 3, pointer to its control block) */
1364 kal_uint32 ex_buf_poolID; /* Buffer pointer */
1365 kal_uint32 ex_buf_KAL_footer1; /* KAL footer: 0xF2F2F2F2 */
1366 kal_uint32 ex_buf_KAL_footer2; /* KAL footer appended after size requested */
1367} EX_CTRLBUFF_COMMON_T;
1368
1369typedef struct
1370{
1371 kal_char ex_buf_source[EX_CTRLBUFF_SRCFILE_LEN]; /* Source file name */
1372 kal_uint32 ex_buf_line; /* line number */
1373} EX_CTRLBUFF_OWNER_T;
1374
1375typedef union
1376{
1377 EX_CTRLBUFF_HISTORY_T history; /* length: 32 */
1378 EX_CTRLBUFF_COMMON_T common; /* length: 32 */
1379} EX_CTRLBUFF_INFO_T;
1380
1381typedef struct
1382{
1383 kal_uint32 ex_ctrlbuf_size; /* offset: +0x13C, length: 4 */ /* control buffer size per entry */
1384 kal_uint32 ex_ctrlbuf_num; /* offset: +0x140, length: 4 */ /* total number of entries */
1385 EX_CTRLBUFF_INFO_T ex_ctrlbuf_top; /* offset: +0x144, length: 32 */ /* top occupation history node */
1386 EX_CTRLBUFF_INFO_T ex_ctrlbuf_second; /* offset: +0x164, length: 32 */ /* second occupation history node */
1387 EX_CTRLBUFF_INFO_T ex_ctrlbuf_third; /* offset: +0x184, length: 32 */ /* third occupation history node */
1388 EX_CTRLBUFF_OWNER_T ex_monitor[3]; /* offset: +0x1A4, length: 48 */
1389 kal_uint32 ex_reserved[2]; /* offset: +0x1D4, length: 16 */ /* reserved */
1390} EX_CTRLBUFF_T;
1391
1392typedef struct
1393{
1394 module_type ex_his_module; /* module ID */
1395 kal_uint8 ex_his_source[EX_UNIT_NAME_LEN]; /* timer name */
1396 kal_uint32 ex_his_hf; /* es buffer handling function */
1397 kal_uint32 ex_his_count; /* number of identical entries */
1398} EX_ESBUFF_HISTORY_T;
1399
1400typedef struct
1401{
1402 kal_uint32 ex_esbuf_size; /* offset: +0x13C, length: 4 */ /* event scheduler buffer size per entry */
1403 kal_uint32 ex_esbuf_num; /* offset: +0x140, length: 4 */ /* total number of entries */
1404 EX_ESBUFF_HISTORY_T ex_esbuf_top; /* offset: +0x144, length: 20 */ /* top occupation history node */
1405 EX_ESBUFF_HISTORY_T ex_esbuf_second; /* offset: +0x158, length: 20 */ /* second occupation history node */
1406 EX_ESBUFF_HISTORY_T ex_esbuf_third; /* offset: +0x16C, length: 20 */ /* third occupation history node */
1407} EX_ESBUFF_T;
1408
1409typedef struct
1410{
1411 kal_uint16 ex_q_src_mod; /* source module ID */
1412 kal_uint8 ex_q_count; /* total number of identical message */
1413 kal_uint8 ex_q_config_entry; /* total number of entries */
1414 kal_uint16 ex_q_msg_id; /* message ID */
1415 kal_uint16 ex_q_cur_mes_no; /* tatal number of messages left in queue */
1416} EX_QUEUE_T;
1417
1418typedef struct
1419{
1420 kal_char ex_task_name[EX_UNIT_NAME_LEN]; /* task name */
1421 kal_char ex_task_stack_gp[8]; /* guard pattern:STACK_END */
1422 kal_uint32 ex_task_cur_status; /* task current status, eg. RUNNING, READY etc */
1423 EX_QUEUE_T ex_task_external_q; /* task external queue */
1424 EX_QUEUE_T ex_task_internal_q; /* task internal queue */
1425 kal_uint32 ex_reserved; /* reserved */
1426} EX_TASKINFO_T;
1427
1428
1429
1430/*******************************************************************************
1431 * Constant Definition and Exported Type - Fatal Error
1432 *******************************************************************************/
1433
1434#define EX_MAX_TASK_DUMP 4
1435#define EX_QUEUE_TRACK 20
1436typedef struct ex_fatalerror_t
1437{
1438 EX_FATALERR_CODE_T error_code; /* offset: +0x, length: */
1439 EX_ANALYSIS_T analysis; /* offset: +0x, length: */
1440
1441 union
1442 {
1443 EX_CTRLBUFF_T ctrl_buff; /* offset: +0x, length: */
1444 EX_ESBUFF_T es_buff; /* offset: +0x, length: */
1445 EX_TASKINFO_T task_info[EX_MAX_TASK_DUMP]; /* offset: +0x, length: */
1446 } info;
1447
1448 kal_uint32 ext_queue_pending_cnt;
1449 kal_uint32 ext_queue_pending[EX_QUEUE_TRACK];
1450 EX_DESCRIPTION_T description; /* offset: +0x, length: */
1451 EX_GUIDELINE_T guideline; /* offset: +0x, length: */
1452} EX_FATALERR_T;
1453
1454typedef struct ex_nested_fatalerror_t
1455{
1456 EX_FATALERR_CODE_T error_code; /* offset: +0x, length: */
1457} EX_NE_FATALERR_T;
1458
1459
1460/*******************************************************************************
1461 * Constant Definition and Exported Type - Assert Failure
1462 *******************************************************************************/
1463#define EX_HEADER_SIZE sizeof(EX_HEADER_T)
1464#define EX_SWVER_LEN sizeof(EX_LOADINFO_T)
1465#define EX_ENVINFO_SIZE sizeof(EX_ENVINFO_T)
1466#define EX_BASIC_OFFENDING_INFO_SIZE sizeof(EX_BASIC_OFFENDING_INFO_T)
1467#define EX_FULL_OFFENDING_INFO_SIZE sizeof(EX_FULL_OFFENDING_INFO_T)
1468#define EX_TOTAL_VICTIM_INFO_SIZE ((sizeof(EX_VICTIM_INFO_T))*TOTAL_VICTIM_VPE_COUNT)
1469
1470#define EX_ASSERTFAIL_FILEPATH_LEN 256
1471#define EX_ASSERTFAIL_FILENAME_LEN 64
1472#define EX_GUARD_LEN 4
1473#define EX_ASSERTFAIL_SIZE EX_ASSERTFAIL_FILEPATH_LEN + \
1474 EX_ASSERTFAIL_FILENAME_LEN + \
1475 sizeof(kal_uint32) * 4 + \
1476 EX_GUARD_LEN
1477
1478
1479#define EX_ASSERTFAIL_DUMP_LEN ((EX_LOG_SIZE - (EX_HEADER_SIZE + EX_SWVER_LEN + \
1480 EX_BASIC_OFFENDING_INFO_SIZE + EX_ENVINFO_SIZE + \
1481 EX_FULL_OFFENDING_INFO_SIZE + \
1482 EX_ASSERTFAIL_SIZE + EX_TOTAL_VICTIM_INFO_SIZE)) & ~(4-1))
1483
1484
1485typedef struct ex_assert_fail_t
1486{
1487 kal_char filepath[EX_ASSERTFAIL_FILEPATH_LEN];
1488 kal_char filename[EX_ASSERTFAIL_FILENAME_LEN]; /* offset: +0xD8, length: 64 */
1489 kal_uint32 linenumber; /* offset: +0xF0, length: 4 */
1490 kal_uint32 parameters[3]; /* offset: +0xF4, length: 12 */
1491 kal_uint8 dump[EX_ASSERTFAIL_DUMP_LEN]; /* offset: +0x100, length: 244 */
1492 kal_uint32 custom_param; /* offset: +0x1FC, length: 4 */
1493} EX_ASSERTFAIL_T;
1494
1495typedef struct ex_nested_assert_fail_t
1496{
1497 kal_char filename[EX_ASSERTFAIL_FILENAME_LEN]; /* length: 64 */
1498 kal_uint32 linenumber; /* length: 4 */
1499} EX_NE_ASSERTFAIL_T;
1500
1501
1502/*******************************************************************************
1503 * Globally Exported Data Structure
1504 *******************************************************************************/
1505typedef union
1506{
1507 EX_FATALERR_T fatalerr;
1508 EX_ASSERTFAIL_T assert;
1509} EX_CONTENT_T;
1510
1511typedef union
1512{
1513 EX_NE_FATALERR_T fatalerr;
1514 EX_NE_ASSERTFAIL_T assert;
1515} EX_NE_CONTENT_T;
1516
1517/* Standard strutcure of an exception log */
1518typedef struct ex_exception_log_t
1519{
1520 EX_HEADER_T header; /* offset: +0x0 length: */
1521 EX_LOADINFO_T load_info; /* offset: +0x, length: */
1522 EX_BASIC_OFFENDING_INFO_T basic_info;
1523 EX_ENVINFO_T envinfo; /* offset: , length: */
1524 EX_FULL_OFFENDING_INFO_T full_info;
1525 EX_CONTENT_T content; /* offset: , length: */
1526 EX_VICTIM_INFO_T victim_info[TOTAL_VICTIM_VPE_COUNT];
1527} EX_LOG_T;
1528
1529typedef struct ex_nested_exception_log_t
1530{
1531 exception_type ex_type;
1532 EX_NE_INFO_T info;
1533 EX_NE_CONTENT_T content;
1534} EX_NE_LOG_T;
1535
1536/* parameter to ex_init_log */
1537typedef struct
1538{
1539 exception_type type;
1540 kal_bool ext;
1541 kal_uint32 *code1;
1542 kal_uint32 *code2;
1543 kal_uint32 *code3;
1544 kal_uint32 e1;
1545 kal_uint32 e2;
1546 kal_uint32 e3;
1547 ASSERT_DUMP_PARAM_T *dump_param;
1548 kal_uint32 custom_param;
1549} EX_INIT_LOG_PARAM_T;
1550
1551/*******************************************************************************
1552 * ELT nvram reading format
1553 *******************************************************************************/
1554/*==========================================*/
1555/* NOTE: The structure is frozen; offset of content should be FIXED. */
1556/*==========================================*/
1557/* TODO */
1558
1559
1560/***************************** -structure end- *******************************/
1561//PRAGMA_END_PACK_STRUCT
1562/*******************************************************************************
1563 * Globally Exported macro
1564 *******************************************************************************/
1565#define EX_LOG_DESCRIPTION_PARAM ex_log_ptr->content.fatalerr.description.param
1566#define EX_LOG_ANALYSIS_PARAM ex_log_ptr->content.fatalerr.analysis.param
1567#define EX_LOG_ANALYSIS_OWNER ex_log_ptr->content.fatalerr.analysis.offender
1568#define EX_LOG_ANALYSIS_CADEFA ex_log_ptr->content.fatalerr.analysis.is_cadefa_supported
1569#define EX_LOG_GUIDELINE_PARAM ex_log_ptr->content.fatalerr.guideline.param
1570#if !defined(__MTK_TARGET__) || (defined(__MTK_TARGET__) && defined(DRV_DEBUG))
1571#define SET_EX_STEP(x)
1572#define GET_EX_STEP()
1573#define GET_NE_STEP()
1574#define GET_EX_STEP_BY_VPE(vpe)
1575#define GET_NE_STEP_BY_VPE(vpe)
1576#define SET_HS(core, status)
1577#define GET_HS(core)
1578#else
1579#define SET_EX_STEP(x) ex_set_step_logging(x)
1580#define GET_EX_STEP() ex_get_step_logging(kal_get_current_vpe_id(), KAL_FALSE)
1581#define GET_NE_STEP() ex_get_step_logging(kal_get_current_vpe_id(), KAL_TRUE)
1582#define GET_EX_STEP_BY_VPE(vpe) ex_get_step_logging((kal_uint32)vpe, KAL_FALSE)
1583#define GET_NE_STEP_BY_VPE(vpe) ex_get_step_logging((kal_uint32)vpe, KAL_TRUE)
1584#define SET_HS(core, status) ex_set_value((kal_uint32*)ex_##core##_hs_ptr, status)
1585#define GET_HS(core) ex_get_value((kal_uint32*)ex_##core##_hs_ptr)
1586#endif /* !defined(__MTK_TARGET__) || (defined(__MTK_TARGET__) && defined(DRV_DEBUG)) */
1587
1588
1589/*******************************************************************************
1590 * Globally Exported Function Prorotype
1591 *******************************************************************************/
1592
1593extern void ex_init_log();
1594extern kal_uint32 ex_get_corenum();
1595extern void ex_init_nested_log(kal_uint32 ex_category);
1596extern void ex_post_init_log();
1597extern void ex_define_main_reason();
1598extern void ex_save_log();
1599extern void ex_output_log(void);
1600extern kal_int8 ex_init_ctrl_buff_log(kal_uint32 *target_ptr, kal_uint32 code1, kal_uint32 code2, kal_char **offender_source_file_full_name);
1601extern kal_int8 ex_init_es_buff_log(kal_uint32 *target_ptr);
1602extern void ex_memory_dump_init(void);
1603extern void ex_output_loadinfo(kal_bool is_meta);
1604extern kal_bool ex_isNested(void);
1605extern kal_uint32* INT_GetExlog(void);
1606extern kal_bool ex_IsSupport_OnlineSST_For_GAT(kal_int32 code1);
1607extern void ex_output_afound(afound_output_types output_types);
1608
1609#ifdef __MTK_TARGET__
1610extern void ex_reset_hw(void);
1611extern void ex_reboot(void);
1612
1613extern void ex_init_step_logging(void);
1614extern void ex_set_step_logging(kal_uint16 start_step);
1615extern void ex_fire_extern_step_logging(kal_uint32 info);
1616extern kal_bool INT_IsAnyCore_Enter_Exception();
1617extern void INT_EnterExceptionForOtherCore();
1618extern kal_uint32 sst_get_main_exception_vpe(void);
1619extern kal_uint32 sst_get_main_exception_core(void);
1620
1621extern kal_bool ex_init_pcmon();
1622extern kal_bool ex_init_nested_pcmon();
1623extern void ex_init_dsm();
1624extern void ex_hw_dump();
1625extern void ex_hw_data_save();
1626extern void KickWDT();
1627extern void ex_switchWDT_phase1();
1628
1629#if defined(__TST_MODULE__)
1630extern void ex_reappear_log(void);
1631extern void ex_cadefa(kal_bool bypass_nested, kal_bool is_meta);
1632extern void ex_cadefa_common(kal_bool bypass_nested, kal_bool bLocalCore, EX_LOG_T * log_ptr);
1633extern void ex_output_for_meta(void);
1634#else
1635#define ex_reappear_log()
1636#define ex_cadefa(bypass_nested, kal_meta)
1637#define ex_cadefa_common(bypass_nested, bLocalCore, log_ptr)
1638#define ex_output_for_meta()
1639#endif /* __TST_MODULE__ */
1640
1641#endif /* __MTK_TARGET__ */
1642
1643#ifdef __STACK_ALIGN_MPU__
1644kal_uint32 ex_stack_overflow_check_by_mpu(void);
1645#endif
1646
1647extern kal_uint8 sst_increment_exception_count();
1648extern void ex_backup_exception_count();
1649/*******************************************************************************
1650 * Globally Exported variables
1651 *******************************************************************************/
1652extern EX_LOG_T *ex_log_ptr;
1653#if defined(__MTK_TARGET__)
1654extern kal_atomic_int32 SST_occupied_core_op_atomic[];
1655extern kal_uint32 sst_dc_offshoot_vpeid;
1656extern kal_uint32 sst_hw_offshoot_vpeid;
1657extern kal_uint32 INT_Exception_Type;
1658extern kal_uint32 sst_offending_coreid;
1659extern kal_uint32 sst_offending_vpeid;
1660extern kal_uint32 sst_offending_tcid;
1661extern kal_uint32 INT_Exception_GLBTS;
1662
1663extern void sst_snprintf(char *s, kal_uint32 size, const char *template, ...);
1664#else
1665#define sst_snprintf kal_snprintf
1666#endif /* __MTK_TARGET__ */
1667
1668
1669#endif /* _EX_ITEM_H */
1670
1671