secure: tee log will be enabled via debug token
authorzhangh12 <zhangh12@motorola.com>
Fri, 22 Feb 2019 09:03:04 +0000 (17:03 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:49 +0000 (17:30 +0800)
Change-Id: I85336d9b5e9a975c7742c2484e533ca5977a4014
Signed-off-by: zhangh12 <zhangh12@motorola.com>
Reviewed-on: https://gerrit.mot.com/1313150
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/gud/gud-exynos9610/MobiCoreDriver/logging.c

index 676115283b5ac589ab53f051b25ffc6a24e211ca..ab9be820369d43e8f2545456f14082d8eac93a01 100755 (executable)
@@ -49,6 +49,9 @@
 #define LOG_CPUID_MASK            (0xF000)
 #define LOG_CPUID_SHIFT           12
 
+#define TEE_COMMANDLINE_PARAM_LENGTH   10
+static char teedebugenable[TEE_COMMANDLINE_PARAM_LENGTH];
+
 struct mc_logmsg {
        u16     ctrl;           /* Type and format of data */
        u16     source;         /* Unique value for each event source */
@@ -84,6 +87,14 @@ static struct logging_ctx {
        bool    dead;
 } log_ctx;
 
+static int __init tee_debug_enable_param(char *line)
+{
+       strlcpy(teedebugenable, line, sizeof(teedebugenable));
+       return 1;
+}
+
+__setup("androidboot.teedebugenable=", tee_debug_enable_param);
+
 static inline void log_eol(u16 source, u32 cpuid)
 {
        if (!log_ctx.line_len)
@@ -245,7 +256,10 @@ int logging_init(phys_addr_t *buffer, u32 *size)
 #ifdef CONFIG_TRUSTONIC_TEE_DEBUG
        log_ctx.enabled = true;
 #else
-       log_ctx.enabled = false;
+       if(!strncmp(teedebugenable, "enable", sizeof("enable")))
+               log_ctx.enabled = true;
+       else
+               log_ctx.enabled = false;
 #endif
        debugfs_create_bool("swd_debug", 0600, g_ctx.debug_dir,
                            &log_ctx.enabled);