xref: /rk3399_ARM-atf/include/drivers/tpm/tpm2_interface.h (revision 7e848540159ba8fbb0577c76e4dc0c5bbc542489)
1 /*
2  * Copyright (c) 2025, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef TPM2_INTERFACE_H
8 #define TPM2_INTERFACE_H
9 
10 #include "tpm2_chip.h"
11 
12 typedef struct interface_ops {
13 	int (*get_info)(struct tpm_chip_data *chip_data, uint8_t locality);
14 	int (*send)(struct tpm_chip_data *chip_data, const tpm_cmd *buf);
15 	int (*receive)(struct tpm_chip_data *chip_data, tpm_cmd *buf);
16 	int (*request_access)(struct tpm_chip_data *chip_data, uint8_t locality);
17 	int (*release_locality)(struct tpm_chip_data *chip_data, uint8_t locality);
18 } interface_ops_t;
19 
20 struct interface_ops *tpm_interface_getops(struct tpm_chip_data *chip_data, uint8_t locality);
21 
22 int tpm2_fifo_write_byte(uint16_t tpm_reg, uint8_t val);
23 
24 int tpm2_fifo_read_byte(uint16_t tpm_reg, uint8_t *val);
25 
26 int tpm2_fifo_read_chunk(uint16_t tpm_reg, uint8_t len, void *val);
27 
28 #endif /* TPM2_INTERFACE_H */
29