/* * Copyright (c) 2015 Samsung Electronics Co., Ltd. * http://www.samsung.com/ * * EXYNOS SMC * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include #include #include #include #define CONFIG_EXYNOS_SMC_LOGGING #ifdef CONFIG_EXYNOS_SMC_LOGGING #define EXYNOS_SMC_LOG_SIZE 1024 struct exynos_smc_log_entry { u64 cpu_clk; u32 cmd; u32 arg1; u32 arg2; u32 arg3; }; static DEFINE_SPINLOCK(drm_smc_log_lock); struct exynos_smc_log_entry drm_smc_log[EXYNOS_SMC_LOG_SIZE]; static unsigned int drm_smc_log_idx; #endif int exynos_smc(unsigned long cmd, unsigned long arg1, unsigned long arg2, unsigned long arg3) { int smc_ret; #ifdef CONFIG_EXYNOS_SMC_LOGGING unsigned long flags; #endif #ifdef CONFIG_EXYNOS_SMC_LOGGING if ((uint32_t)cmd >= SMC_PROTECTION_SET && (uint32_t)cmd < MC_FC_SET_CFW_PROT) { pr_debug("%s: cmd: 0x%x, arg1: 0x%x, arg2: 0x%x, arg3: 0x%x\n", __func__, (u32)cmd, (u32)arg1, (u32)arg2, (u32)arg3); spin_lock_irqsave(&drm_smc_log_lock, flags); drm_smc_log[drm_smc_log_idx].cpu_clk = local_clock(); drm_smc_log[drm_smc_log_idx].cmd = (u32)cmd; drm_smc_log[drm_smc_log_idx].arg1 = (u32)arg1; drm_smc_log[drm_smc_log_idx].arg2 = (u32)arg2; drm_smc_log[drm_smc_log_idx].arg3 = (u32)arg3; drm_smc_log_idx++; if (drm_smc_log_idx == EXYNOS_SMC_LOG_SIZE) drm_smc_log_idx = 0; spin_unlock_irqrestore(&drm_smc_log_lock, flags); } #endif trace_exynos_smc_in(cmd, arg1, arg2, arg3); smc_ret = __exynos_smc(cmd, arg1, arg2, arg3); trace_exynos_smc_out(cmd, arg1, arg2, arg3); return smc_ret; }