optee_private.h 1.7 KB

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