[Feature] add GA346 baseline version
Change-Id: Ic62933698569507dcf98240cdf5d9931ae34348f
diff --git a/src/bsp/lk/lib/aee/platform_debug.c b/src/bsp/lk/lib/aee/platform_debug.c
new file mode 100644
index 0000000..c3ffed2
--- /dev/null
+++ b/src/bsp/lk/lib/aee/platform_debug.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dev/aee_platform_debug.h>
+#include <stdlib.h>
+
+unsigned int (* plat_dfd20_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_dram_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_cpu_bus_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_spm_data_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_spm_sram_data_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_atf_log_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_atf_crash_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_atf_raw_log_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_atf_rdump_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_hvfs_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+#ifdef MTK_TINYSYS_SSPM_SUPPORT
+unsigned int (* plat_sspm_coredump_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_sspm_data_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_sspm_xfile_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_sspm_log_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+#endif
+unsigned int (* plat_pllk_last_log_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_dur_lkdump_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+unsigned int (* plat_mcdi_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+#ifdef MTK_TINYSYS_SCP_SUPPORT
+unsigned int (* plat_scp_coredump_get)(u64 offset, int *len, CALLBACK dev_write) = NULL;
+#endif
+
+/* in case that platform didn't support platform_debug_init() */
+int platform_debug_init(void) __attribute__((weak));
+int platform_debug_init(void)
+{
+ return 0;
+}
+
+int lkdump_debug_init(void)
+{
+ return platform_debug_init();
+}
+
+/* function pointer should be set after platform_debug_init() */
+unsigned int kedump_plat_savelog(int condition, u64 offset, int *len, CALLBACK dev_write)
+{
+ switch (condition) {
+ case AEE_PLAT_DFD20:
+ return (!plat_dfd20_get ? 0 : plat_dfd20_get(offset, len, dev_write));
+ case AEE_PLAT_DRAM:
+ return (!plat_dram_get ? 0 : plat_dram_get(offset, len, dev_write));
+ case AEE_PLAT_CPU_BUS:
+ return (!plat_cpu_bus_get ? 0 : plat_cpu_bus_get(offset, len, dev_write));
+ case AEE_PLAT_SPM_DATA:
+ return (!plat_spm_data_get ? 0 : plat_spm_data_get(offset, len, dev_write));
+ case AEE_PLAT_SPM_SRAM_DATA:
+ return (!plat_spm_sram_data_get ? 0 : plat_spm_sram_data_get(offset, len, dev_write));
+ case AEE_PLAT_ATF_LAST_LOG:
+ return (!plat_atf_log_get ? 0 : plat_atf_log_get(offset, len, dev_write));
+ case AEE_PLAT_ATF_CRASH_REPORT:
+ return (!plat_atf_crash_get ? 0 : plat_atf_crash_get(offset, len, dev_write));
+ case AEE_PLAT_ATF_RAW_LOG:
+ return (!plat_atf_raw_log_get ? 0 : plat_atf_raw_log_get(offset, len, dev_write));
+ case AEE_PLAT_ATF_RDUMP_LOG:
+ return (!plat_atf_rdump_get ? 0 : plat_atf_rdump_get(offset, len, dev_write));
+ case AEE_PLAT_HVFS:
+ return (!plat_hvfs_get ? 0 : plat_hvfs_get(offset, len, dev_write));
+#ifdef MTK_TINYSYS_SSPM_SUPPORT
+ case AEE_PLAT_SSPM_COREDUMP:
+ return (!plat_sspm_coredump_get ? 0 : plat_sspm_coredump_get(offset, len, dev_write));
+ case AEE_PLAT_SSPM_DATA:
+ return (!plat_sspm_data_get ? 0 : plat_sspm_data_get(offset, len, dev_write));
+ case AEE_PLAT_SSPM_XFILE:
+ return (!plat_sspm_xfile_get ? 0 : plat_sspm_xfile_get(offset, len, dev_write));
+ case AEE_PLAT_SSPM_LAST_LOG:
+ return (!plat_sspm_log_get ? 0 : plat_sspm_log_get(offset, len, dev_write));
+#endif
+ case AEE_PLAT_PLLK_LAST_LOG:
+ return (!plat_pllk_last_log_get ? 0 : plat_pllk_last_log_get(offset, len, dev_write));
+ case AEE_PLAT_LOG_DUR_LKDUMP:
+ return (!plat_dur_lkdump_get ? 0 : plat_dur_lkdump_get(offset, len, dev_write));
+ case AEE_PLAT_MCDI_DATA:
+ return (!plat_mcdi_get ? 0 : plat_mcdi_get(offset, len, dev_write));
+#ifdef MTK_TINYSYS_SCP_SUPPORT
+ case AEE_PLAT_SCP_COREDUMP:
+ return (!plat_scp_coredump_get ? 0 : plat_scp_coredump_get(offset, len, dev_write));
+#endif
+ default:
+ break;
+ }
+ return 0;
+}
\ No newline at end of file