summaryrefstree
path: root/kernel/drivers/misc/tzdev/tz_common.h
blob: 872c2fff95046a2f6741513799df3309697dbb8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (C) 2015 Samsung Electronics, Inc.
 *
 * 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 __TZ_COMMON_H__
#define __TZ_COMMON_H__

#include <linux/types.h>
#include <linux/limits.h>

/*
 * CA_ID is a full basename of CA executable.
 * It can not be longer than max supported filename length defined in Linux.
 */
#define CA_ID_LEN			(256)

#define TZ_IOC_MAGIC			'c'

#define TZIO_SMC			_IOWR(TZ_IOC_MAGIC, 101, struct tzio_smc_cmd)
#define TZIO_WAIT_EVT			_IO(TZ_IOC_MAGIC, 112)
#define TZIO_GET_PIPE			_IOR(TZ_IOC_MAGIC, 113, int)
#define TZIO_GET_ACCESS_INFO		_IOWR(TZ_IOC_MAGIC, 119, struct tzio_access_info)
#define TZIO_MEM_REGISTER		_IOWR(TZ_IOC_MAGIC, 120, struct tzio_mem_register)
#define TZIO_MEM_RELEASE		_IOW(TZ_IOC_MAGIC, 121, int)
#define TZIO_MIGRATE			_IOW(TZ_IOC_MAGIC, 122, int)
#if defined(CONFIG_TZDEV_QC_CRYPTO_CLOCKS_USR_MNG)
#define TZIO_SET_QC_CLK			_IOW(TZ_IOC_MAGIC, 123, int)
#endif

struct tzio_access_info {
	__s32 pid;			/* CA PID */
	__s32 gid;			/* CA GID - to be received from TZDEV */
	char ca_name[CA_ID_LEN];	/* CA identity - to be received from TZDEV */
};

struct tzio_smc_cmd {
	__s32 args[2];			/* SMC args (in) */
	__s32 ret;			/* SMC return value (out) */
};

struct tzio_mem_register {
	__s32 pid;			/* Memory region owner's PID (in) */
	const __u64 ptr;		/* Memory region start (in) */
	__u64 size;			/* Memory region size (in) */
	__s32 id;			/* Memory region ID (out) */
	__s32 write;			/* 1 - rw, 0 - ro */
};

#endif /*!__TZ_COMMON_H__*/