aee_platform_debug.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2016. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #if !defined(__AEE_PLATFORM_DEBUG_H__)
  32. #define __AEE_PLATFORM_DEBUG_H__
  33. #include <sys/types.h>
  34. #include <platform/boot_mode.h>
  35. typedef unsigned long long u64;
  36. typedef unsigned long long (*CALLBACK)(void *data, unsigned long sz);
  37. /* extern global variable */
  38. extern BOOT_ARGUMENT *g_boot_arg;
  39. enum {
  40. AEE_PLAT_DFD20,
  41. AEE_PLAT_DRAM,
  42. AEE_PLAT_CPU_BUS,
  43. AEE_PLAT_SPM_DATA,
  44. AEE_PLAT_SPM_SRAM_DATA,
  45. AEE_PLAT_ATF_LAST_LOG,
  46. AEE_PLAT_ATF_CRASH_REPORT,
  47. AEE_PLAT_ATF_RAW_LOG,
  48. AEE_PLAT_ATF_RDUMP_LOG,
  49. AEE_PLAT_HVFS,
  50. #ifdef MTK_TINYSYS_SSPM_SUPPORT
  51. AEE_PLAT_SSPM_COREDUMP,
  52. AEE_PLAT_SSPM_DATA,
  53. AEE_PLAT_SSPM_XFILE,
  54. AEE_PLAT_SSPM_LAST_LOG,
  55. #endif
  56. AEE_PLAT_PLLK_LAST_LOG,
  57. AEE_PLAT_LOG_DUR_LKDUMP,
  58. AEE_PLAT_MCDI_DATA,
  59. AEE_PLAT_SCP_COREDUMP,
  60. AEE_PLAT_INFRA_CG,
  61. AEE_PLAT_ADSP_COREDUMP,
  62. #ifdef MTK_TINYSYS_MCUPM_SUPPORT
  63. AEE_PLAT_MCUPM_COREDUMP,
  64. AEE_PLAT_MCUPM_DATA,
  65. AEE_PLAT_MCUPM_XFILE,
  66. AEE_PLAT_MCUPM_LAST_LOG,
  67. #endif
  68. #ifdef MTK_PICACHU_SUPPORT
  69. AEE_PLAT_PICACHU_LOG,
  70. #endif
  71. AEE_PLAT_DEBUG_NUM,
  72. };
  73. /* function pointers */
  74. extern unsigned int (* plat_dfd20_get)(u64 offset, int *len, CALLBACK dev_write);
  75. extern unsigned int (* plat_dram_get)(u64 offset, int *len, CALLBACK dev_write);
  76. extern unsigned int (* plat_cpu_bus_get)(u64 offset, int *len, CALLBACK dev_write);
  77. extern unsigned int (* plat_spm_data_get)(u64 offset, int *len, CALLBACK dev_write);
  78. extern unsigned int (* plat_spm_sram_data_get)(u64 offset, int *len, CALLBACK dev_write);
  79. extern unsigned int (* plat_hvfs_get)(u64 offset, int *len, CALLBACK dev_write);
  80. #ifdef MTK_TINYSYS_SSPM_SUPPORT
  81. extern unsigned int (* plat_sspm_coredump_get)(u64 offset, int *len, CALLBACK dev_write);
  82. extern unsigned int (* plat_sspm_data_get)(u64 offset, int *len, CALLBACK dev_write);
  83. extern unsigned int (* plat_sspm_xfile_get)(u64 offset, int *len, CALLBACK dev_write);
  84. extern unsigned int (* plat_sspm_log_get)(u64 offset, int *len, CALLBACK dev_write);
  85. #endif
  86. extern unsigned int (* plat_pllk_last_log_get)(u64 offset, int *len, CALLBACK dev_write);
  87. extern unsigned int (* plat_dur_lkdump_get)(u64 offset, int *len, CALLBACK dev_write);
  88. extern unsigned int (* plat_mcdi_get)(u64 offset, int *len, CALLBACK dev_write);
  89. #ifdef MTK_TINYSYS_SCP_SUPPORT
  90. extern unsigned int (* plat_scp_coredump_get)(u64 offset, int *len, CALLBACK dev_write);
  91. #endif
  92. extern unsigned int (* plat_infra_cg_get)(u64 offset, int *len, CALLBACK dev_write);
  93. #ifdef MTK_AUDIODSP_SUPPORT
  94. extern unsigned int (* plat_adsp_coredump_get)(u64 offset, int *len, CALLBACK dev_write);
  95. #endif
  96. #ifdef MTK_TINYSYS_MCUPM_SUPPORT
  97. extern unsigned int (* plat_mcupm_coredump_get)(u64 offset, int *len, CALLBACK dev_write);
  98. extern unsigned int (* plat_mcupm_data_get)(u64 offset, int *len, CALLBACK dev_write);
  99. extern unsigned int (* plat_mcupm_xfile_get)(u64 offset, int *len, CALLBACK dev_write);
  100. extern unsigned int (* plat_mcupm_log_get)(u64 offset, int *len, CALLBACK dev_write);
  101. #endif
  102. #ifdef MTK_PICACHU_SUPPORT
  103. extern unsigned int (* plat_picachu_log_get)(u64 offset, int *len, CALLBACK dev_write);
  104. #endif
  105. /* DRAM KLOG at MRDUMP area of expdb, offset from bottom = 3145728 - 16384 = 3129344 */
  106. #define MRDUMP_EXPDB_BOTTOM_OFFSET 2097152
  107. #define MRDUMP_EXPDB_DRAM_KLOG_OFFSET 3129344
  108. /* common api */
  109. unsigned int kedump_plat_savelog(int condition, u64 offset, int *len, CALLBACK dev_write);
  110. extern void arch_clean_cache_range(addr_t start, size_t len);
  111. extern part_dev_t *mt_part_get_device(void);
  112. /* common interface for platform */
  113. void mrdump_write_log(u64 offset_dst, void *data, int len);
  114. void mrdump_read_log(void *data, int len, u64 offset);
  115. int lkdump_debug_init(void);
  116. /* common interface from platform */
  117. int platform_debug_init(void);
  118. void platform_lastpc_postinit(void);
  119. extern struct aee_db_file_info* get_file_info(void);
  120. /* db filename and max size */
  121. struct aee_db_file_info {
  122. char filename[32];
  123. unsigned int filesize;
  124. unsigned int step;
  125. };
  126. #endif /* __AEE_PLATFORM_DEBUG_H__ */