blob: 9442d1c176bc9065e84216c7b44ea1f04923c34d [file] [log] [blame]
Jens Wiklander2b7216b2018-09-25 16:40:11 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (c) 2018 Linaro Limited
4 */
5
6#ifndef __OPTEE_PRIVATE_H
7#define __OPTEE_PRIVATE_H
8
Jens Wiklanderf1420dd2018-09-25 16:40:14 +02009#include <tee.h>
10#include <log.h>
11
12/**
13 * struct optee_private - OP-TEE driver private data
14 * @rpmb_mmc: mmc device for the RPMB partition
15 * @rpmb_dev_id: mmc device id matching @rpmb_mmc
16 * @rpmb_original_part: the previosly active partition on the mmc device,
17 * used to restore active the partition when the RPMB
18 * accesses are finished
19 */
20struct optee_private {
21 struct mmc *rpmb_mmc;
22 int rpmb_dev_id;
23 int rpmb_original_part;
24};
25
26struct optee_msg_arg;
27
28void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,
29 void **page_list);
30
31#ifdef CONFIG_SUPPORT_EMMC_RPMB
32/**
33 * optee_suppl_cmd_rpmb() - route RPMB frames to mmc
34 * @dev: device with the selected RPMB partition
35 * @arg: OP-TEE message holding the frames to transmit to the mmc
36 * and space for the response frames.
37 *
38 * Routes signed (MACed) RPMB frames from OP-TEE Secure OS to MMC and vice
39 * versa to manipulate the RPMB partition.
40 */
41void optee_suppl_cmd_rpmb(struct udevice *dev, struct optee_msg_arg *arg);
42
43/**
44 * optee_suppl_rpmb_release() - release mmc device
45 * @dev: mmc device
46 *
47 * Releases the mmc device and restores the previously selected partition.
48 */
49void optee_suppl_rpmb_release(struct udevice *dev);
50#else
51static inline void optee_suppl_cmd_rpmb(struct udevice *dev,
52 struct optee_msg_arg *arg)
53{
54 debug("OPTEE_MSG_RPC_CMD_RPMB not implemented\n");
55 arg->ret = TEE_ERROR_NOT_IMPLEMENTED;
56}
57
58static inline void optee_suppl_rpmb_release(struct udevice *dev)
59{
60}
61#endif
62
Jens Wiklander2b7216b2018-09-25 16:40:11 +020063void *optee_alloc_and_init_page_list(void *buf, ulong len, u64 *phys_buf_ptr);
Jens Wiklander2b7216b2018-09-25 16:40:11 +020064
65#endif /* __OPTEE_PRIVATE_H */