forked from rrcarlosr/Jetpack
106 lines
2.9 KiB
C
106 lines
2.9 KiB
C
/*
|
|
* Copyright (C) 2013 Google, Inc.
|
|
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
#ifndef __LINUX_TRUSTY_TRUSTY_H
|
|
#define __LINUX_TRUSTY_TRUSTY_H
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/trusty/sm_err.h>
|
|
#include <linux/device.h>
|
|
#include <linux/pagemap.h>
|
|
#include <linux/tegra-soc.h>
|
|
|
|
enum {
|
|
TRUSTY_DEV_UNINIT = -1,
|
|
|
|
TRUSTY_DEV_DISABLED = 0,
|
|
TRUSTY_DEV_ENABLED
|
|
};
|
|
|
|
#if IS_ENABLED(CONFIG_TRUSTY)
|
|
s32 trusty_std_call32(struct device *dev, u32 smcnr, u32 a0, u32 a1, u32 a2);
|
|
s32 trusty_fast_call32(struct device *dev, u32 smcnr, u32 a0, u32 a1, u32 a2);
|
|
#ifdef CONFIG_64BIT
|
|
s64 trusty_fast_call64(struct device *dev, u64 smcnr, u64 a0, u64 a1, u64 a2);
|
|
#endif
|
|
int hyp_ipa_translate(uint64_t *ipa);
|
|
#else
|
|
static inline s32 trusty_std_call32(struct device *dev, u32 smcnr,
|
|
u32 a0, u32 a1, u32 a2)
|
|
{
|
|
return SM_ERR_UNDEFINED_SMC;
|
|
}
|
|
static inline s32 trusty_fast_call32(struct device *dev, u32 smcnr,
|
|
u32 a0, u32 a1, u32 a2)
|
|
{
|
|
return SM_ERR_UNDEFINED_SMC;
|
|
}
|
|
#ifdef CONFIG_64BIT
|
|
static inline s64 trusty_fast_call64(struct device *dev,
|
|
u64 smcnr, u64 a0, u64 a1, u64 a2)
|
|
{
|
|
return SM_ERR_UNDEFINED_SMC;
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
struct notifier_block;
|
|
enum {
|
|
TRUSTY_CALL_PREPARE,
|
|
TRUSTY_CALL_RETURNED,
|
|
#ifdef CONFIG_TEGRA_VIRTUALIZATION
|
|
TRUSTY_CALL_VQ_POLLING,
|
|
#endif
|
|
};
|
|
int trusty_call_notifier_register(struct device *dev,
|
|
struct notifier_block *n);
|
|
int trusty_call_notifier_unregister(struct device *dev,
|
|
struct notifier_block *n);
|
|
int trusty_panic_notifier_register(struct device *dev,
|
|
struct notifier_block *n);
|
|
int trusty_panic_notifier_unregister(struct device *dev,
|
|
struct notifier_block *n);
|
|
const char *trusty_version_str_get(struct device *dev);
|
|
u32 trusty_get_api_version(struct device *dev);
|
|
|
|
struct ns_mem_page_info {
|
|
uint64_t attr;
|
|
};
|
|
|
|
int trusty_encode_page_info(struct ns_mem_page_info *inf,
|
|
struct page *page, pgprot_t pgprot);
|
|
|
|
int trusty_call32_mem_buf(struct device *dev, u32 smcnr,
|
|
struct page *page, u32 size,
|
|
pgprot_t pgprot);
|
|
|
|
struct trusty_nop {
|
|
struct list_head node;
|
|
u32 args[3];
|
|
};
|
|
|
|
static inline void trusty_nop_init(struct trusty_nop *nop,
|
|
u32 arg0, u32 arg1, u32 arg2) {
|
|
INIT_LIST_HEAD(&nop->node);
|
|
nop->args[0] = arg0;
|
|
nop->args[1] = arg1;
|
|
nop->args[2] = arg2;
|
|
}
|
|
|
|
void trusty_enqueue_nop(struct device *dev, struct trusty_nop *nop);
|
|
void trusty_dequeue_nop(struct device *dev, struct trusty_nop *nop);
|
|
int is_trusty_dev_enabled(void);
|
|
|
|
#endif
|