summaryrefslogtreecommitdiff
path: root/drivers/tee/optee/optee_private.h
blob: 9442d1c176bc9065e84216c7b44ea1f04923c34d (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
59
60
61
62
63
64
65
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (c) 2018 Linaro Limited
 */

#ifndef __OPTEE_PRIVATE_H
#define __OPTEE_PRIVATE_H

#include <tee.h>
#include <log.h>

/**
 * struct optee_private - OP-TEE driver private data
 * @rpmb_mmc:		mmc device for the RPMB partition
 * @rpmb_dev_id:	mmc device id matching @rpmb_mmc
 * @rpmb_original_part:	the previosly active partition on the mmc device,
 *			used to restore active the partition when the RPMB
 *			accesses are finished
 */
struct optee_private {
	struct mmc *rpmb_mmc;
	int rpmb_dev_id;
	int rpmb_original_part;
};

struct optee_msg_arg;

void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,
		     void **page_list);

#ifdef CONFIG_SUPPORT_EMMC_RPMB
/**
 * optee_suppl_cmd_rpmb() - route RPMB frames to mmc
 * @dev:	device with the selected RPMB partition
 * @arg:	OP-TEE message holding the frames to transmit to the mmc
 *		and space for the response frames.
 *
 * Routes signed (MACed) RPMB frames from OP-TEE Secure OS to MMC and vice
 * versa to manipulate the RPMB partition.
 */
void optee_suppl_cmd_rpmb(struct udevice *dev, struct optee_msg_arg *arg);

/**
 * optee_suppl_rpmb_release() - release mmc device
 * @dev:	mmc device
 *
 * Releases the mmc device and restores the previously selected partition.
 */
void optee_suppl_rpmb_release(struct udevice *dev);
#else
static inline void optee_suppl_cmd_rpmb(struct udevice *dev,
					struct optee_msg_arg *arg)
{
	debug("OPTEE_MSG_RPC_CMD_RPMB not implemented\n");
	arg->ret = TEE_ERROR_NOT_IMPLEMENTED;
}

static inline void optee_suppl_rpmb_release(struct udevice *dev)
{
}
#endif

void *optee_alloc_and_init_page_list(void *buf, ulong len, u64 *phys_buf_ptr);

#endif /* __OPTEE_PRIVATE_H */