18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) Microsoft Corporation 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __TPM_FTPM_TEE_H__ 78c2ecf20Sopenharmony_ci#define __TPM_FTPM_TEE_H__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/tee_drv.h> 108c2ecf20Sopenharmony_ci#include <linux/tpm.h> 118c2ecf20Sopenharmony_ci#include <linux/uuid.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* The TAFs ID implemented in this TA */ 148c2ecf20Sopenharmony_ci#define FTPM_OPTEE_TA_SUBMIT_COMMAND (0) 158c2ecf20Sopenharmony_ci#define FTPM_OPTEE_TA_EMULATE_PPI (1) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* max. buffer size supported by fTPM */ 188c2ecf20Sopenharmony_ci#define MAX_COMMAND_SIZE 4096 198c2ecf20Sopenharmony_ci#define MAX_RESPONSE_SIZE 4096 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/** 228c2ecf20Sopenharmony_ci * struct ftpm_tee_private - fTPM's private data 238c2ecf20Sopenharmony_ci * @chip: struct tpm_chip instance registered with tpm framework. 248c2ecf20Sopenharmony_ci * @state: internal state 258c2ecf20Sopenharmony_ci * @session: fTPM TA session identifier. 268c2ecf20Sopenharmony_ci * @resp_len: cached response buffer length. 278c2ecf20Sopenharmony_ci * @resp_buf: cached response buffer. 288c2ecf20Sopenharmony_ci * @ctx: TEE context handler. 298c2ecf20Sopenharmony_ci * @shm: Memory pool shared with fTPM TA in TEE. 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_cistruct ftpm_tee_private { 328c2ecf20Sopenharmony_ci struct tpm_chip *chip; 338c2ecf20Sopenharmony_ci u32 session; 348c2ecf20Sopenharmony_ci size_t resp_len; 358c2ecf20Sopenharmony_ci u8 resp_buf[MAX_RESPONSE_SIZE]; 368c2ecf20Sopenharmony_ci struct tee_context *ctx; 378c2ecf20Sopenharmony_ci struct tee_shm *shm; 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#endif /* __TPM_FTPM_TEE_H__ */ 41