
Migrate MSM Adreno Governor TZ interface to upstream SCM driver. Change-Id: I1c4347d33b6be835f04422918c29e9c627e02874 Signed-off-by: Elliot Berman <eberman@codeaurora.org> Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
184 lines
8.3 KiB
C
184 lines
8.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright (c) 2010-2015, 2018-2019 The Linux Foundation. All rights reserved.
|
|
* Copyright (C) 2015 Linaro Ltd.
|
|
*/
|
|
#ifndef __QCOM_SCM_H
|
|
#define __QCOM_SCM_H
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/types.h>
|
|
#include <linux/cpumask.h>
|
|
|
|
#define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
|
|
#define QCOM_SCM_CPU_PWR_DOWN_L2_ON 0x0
|
|
#define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1
|
|
#define QCOM_SCM_HDCP_MAX_REQ_CNT 5
|
|
|
|
struct qcom_scm_hdcp_req {
|
|
u32 addr;
|
|
u32 val;
|
|
};
|
|
|
|
struct qcom_scm_vmperm {
|
|
int vmid;
|
|
int perm;
|
|
};
|
|
|
|
#define QCOM_SCM_VMID_HLOS 0x3
|
|
#define QCOM_SCM_VMID_MSS_MSA 0xF
|
|
#define QCOM_SCM_VMID_WLAN 0x18
|
|
#define QCOM_SCM_VMID_WLAN_CE 0x19
|
|
#define QCOM_SCM_PERM_READ 0x4
|
|
#define QCOM_SCM_PERM_WRITE 0x2
|
|
#define QCOM_SCM_PERM_EXEC 0x1
|
|
#define QCOM_SCM_PERM_RW (QCOM_SCM_PERM_READ | QCOM_SCM_PERM_WRITE)
|
|
#define QCOM_SCM_PERM_RWX (QCOM_SCM_PERM_RW | QCOM_SCM_PERM_EXEC)
|
|
|
|
#if IS_ENABLED(CONFIG_QCOM_SCM)
|
|
extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);
|
|
extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus);
|
|
extern void qcom_scm_cpu_power_down(u32 flags);
|
|
extern int qcom_scm_sec_wdog_deactivate(void);
|
|
extern int qcom_scm_set_remote_state(u32 state, u32 id);
|
|
extern bool qcom_scm_pas_supported(u32 peripheral);
|
|
extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata,
|
|
size_t size);
|
|
extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr,
|
|
phys_addr_t size);
|
|
extern int qcom_scm_pas_auth_and_reset(u32 peripheral);
|
|
extern int qcom_scm_pas_shutdown(u32 peripheral);
|
|
extern int qcom_scm_get_sec_dump_state(u32 *dump_state);
|
|
extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val);
|
|
extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val);
|
|
extern int qcom_scm_io_reset(void);
|
|
extern int qcom_scm_get_jtag_etm_feat_id(u64 *version);
|
|
extern void qcom_scm_mmu_sync(bool sync);
|
|
extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
|
|
extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size);
|
|
extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare);
|
|
extern int qcom_scm_mem_protect_region_id(phys_addr_t paddr, size_t size);
|
|
extern int qcom_scm_mem_protect_lock_id2_flat(phys_addr_t list_addr,
|
|
size_t list_size, size_t chunk_size,
|
|
size_t memory_usage, int lock);
|
|
extern int qcom_scm_iommu_secure_map(phys_addr_t sg_list_addr, size_t num_sg,
|
|
size_t sg_block_size, u64 sec_id, int cbndx,
|
|
unsigned long iova, size_t total_len);
|
|
extern int qcom_scm_iommu_secure_unmap(u64 sec_id, int cbndx,
|
|
unsigned long iova, size_t total_len);
|
|
extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|
unsigned int *src,
|
|
const struct qcom_scm_vmperm *newvm,
|
|
unsigned int dest_cnt);
|
|
extern bool qcom_scm_kgsl_set_smmu_aperture_available(void);
|
|
extern int qcom_scm_kgsl_set_smmu_aperture(
|
|
unsigned int num_context_bank);
|
|
extern int qcom_scm_smmu_prepare_atos_id(u64 dev_id, int cb_num, int operation);
|
|
extern bool qcom_scm_dcvs_core_available(void);
|
|
extern bool qcom_scm_dcvs_ca_available(void);
|
|
extern int qcom_scm_dcvs_reset(void);
|
|
extern int qcom_scm_dcvs_init_v2(phys_addr_t addr, size_t size, int *version);
|
|
extern int qcom_scm_dcvs_init_ca_v2(phys_addr_t addr, size_t size);
|
|
extern int qcom_scm_dcvs_update(int level, s64 total_time, s64 busy_time);
|
|
extern int qcom_scm_dcvs_update_v2(int level, s64 total_time, s64 busy_time);
|
|
extern int qcom_scm_dcvs_update_ca_v2(int level, s64 total_time, s64 busy_time,
|
|
int context_count);
|
|
extern bool qcom_scm_hdcp_available(void);
|
|
extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
|
|
u32 *resp);
|
|
extern int qcom_scm_enable_shm_bridge(void);
|
|
extern int qcom_scm_delete_shm_bridge(u64 handle);
|
|
extern int qcom_scm_create_shm_bridge(u64 pfn_and_ns_perm_flags,
|
|
u64 ipfn_and_s_perm_flags, u64 size_and_flags,
|
|
u64 ns_vmids, u64 *handle);
|
|
extern int qcom_scm_smmu_change_pgtbl_format(u64 dev_id, int cbndx);
|
|
extern int qcom_scm_qsmmu500_wait_safe_toggle(bool en);
|
|
extern int qcom_scm_ice_restore_cfg(void);
|
|
extern bool qcom_scm_is_available(void);
|
|
#else
|
|
|
|
#include <linux/errno.h>
|
|
|
|
static inline
|
|
int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
|
|
{ return -ENODEV; }
|
|
static inline
|
|
int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
|
|
{ return -ENODEV; }
|
|
static inline void qcom_scm_cpu_power_down(u32 flags) {}
|
|
static inline int qcom_scm_sec_wdog_deactivate(void) { return -ENODEV; }
|
|
static inline u32 qcom_scm_set_remote_state(u32 state, u32 id)
|
|
{ return -ENODEV; }
|
|
static inline bool qcom_scm_pas_supported(u32 peripheral) { return false; }
|
|
static inline int qcom_scm_pas_init_image(u32 peripheral, const void *metadata,
|
|
size_t size) { return -ENODEV; }
|
|
static inline int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr,
|
|
phys_addr_t size) { return -ENODEV; }
|
|
static inline int qcom_scm_pas_auth_and_reset(u32 peripheral)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; }
|
|
static inline int qcom_scm_get_sec_dump_state(u32 *dump_state)
|
|
{return -ENODEV; }
|
|
static inline int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_io_writel(phys_addr_t addr, unsigned int val)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_io_reset(void)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_get_jtag_etm_feat_id(u64 *version)
|
|
{ return -ENODEV; }
|
|
static inline void qcom_scm_mmu_sync(bool sync) {}
|
|
static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_mem_protect_region_id(phys_addr_t paddr, size_t size)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_mem_protect_lock_id2_flat(phys_addr_t list_addr,
|
|
size_t list_size, size_t chunk_size, size_t memory_usage,
|
|
int lock) { return -ENODEV; }
|
|
static inline int qcom_scm_iommu_secure_map(phys_addr_t sg_list_addr,
|
|
size_t num_sg, size_t sg_block_size, u64 sec_id, int cbndx,
|
|
unsigned long iova, size_t total_len) { return -ENODEV; }
|
|
static inline int qcom_scm_iommu_secure_unmap(u64 sec_id, int cbndx,
|
|
unsigned long iova, size_t total_len) { return -ENODEV; }
|
|
static inline int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|
unsigned int *src,
|
|
const struct qcom_scm_vmperm *newvm,
|
|
unsigned int dest_cnt) { return -ENODEV; }
|
|
static inline bool qcom_scm_kgsl_set_smmu_aperture_available(void)
|
|
{ return false; }
|
|
static inline int qcom_scm_kgsl_set_smmu_aperture(
|
|
unsigned int num_context_bank) { return -ENODEV; }
|
|
static inline int qcom_scm_smmu_prepare_atos_id(u64 dev_id, int cb_num,
|
|
int operation) { return -ENODEV; }
|
|
static inline bool qcom_scm_dcvs_core_available(void) { return false; }
|
|
static inline bool qcom_scm_dcvs_ca_available(void) { return false; }
|
|
static inline int qcom_scm_dcvs_init_v2(phys_addr_t addr, size_t size,
|
|
int *version) { return -ENODEV; }
|
|
static inline int qcom_scm_dcvs_init_ca_v2(phys_addr_t addr, size_t size)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_dcvs_update(int level, s64 total_time, s64 busy_time)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_dcvs_update_v2(int level, s64 total_time,
|
|
s64 busy_time) { return -ENODEV; }
|
|
static inline int qcom_scm_dcvs_update_ca_v2(int level, s64 total_time,
|
|
s64 busy_time, int context_count) { return -ENODEV; }
|
|
static inline bool qcom_scm_hdcp_available(void) { return false; }
|
|
static inline int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
|
|
u32 *resp) { return -ENODEV; }
|
|
static inline int qcom_scm_enable_shm_bridge(void) { return -ENODEV; }
|
|
static inline int qcom_scm_delete_shm_bridge(u64 handle) { return -ENODEV; }
|
|
static inline int qcom_scm_create_shm_bridge(u64 pfn_and_ns_perm_flags,
|
|
u64 ipfn_and_s_perm_flags, u64 size_and_flags,
|
|
u64 ns_vmids, u64 *handle) { return -ENODEV; }
|
|
static inline int qcom_scm_smmu_change_pgtbl_format(u64 dev_id, int cbndx)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_qsmmu500_wait_safe_toggle(bool en)
|
|
{ return -ENODEV; }
|
|
static inline int qcom_scm_ice_restore_cfg(void) { return -ENODEV; }
|
|
static inline bool qcom_scm_is_available(void) { return false; }
|
|
#endif
|
|
#endif
|