62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
/*
|
|
* 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 <linux/sched.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/smc.h>
|
|
|
|
#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)
|
|
{
|
|
#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
|
|
|
|
return __exynos_smc(cmd, arg1, arg2, arg3);
|
|
}
|