1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (c) 2020-2022, ARM Limited. All rights reserved.
4  */
5 
6 #ifndef __KERNEL_TPM_H__
7 #define __KERNEL_TPM_H__
8 
9 #include <tee_api_types.h>
10 
11 #ifdef CFG_CORE_TPM_EVENT_LOG
12 
13 /*
14  * Returns the TPM Event Log information previously retrieved
15  * by @tpm_map_log_area.
16  *
17  * @buf Pointer to a buffer where to store a copy of the TPM Event log.
18  */
19 TEE_Result tpm_get_event_log(void *buf, size_t *size);
20 
21 TEE_Result tpm_get_event_log_size(size_t *size);
22 
23 /*
24  * Reads the TPM Event log information and store it internally.
25  * If support for DTB is enabled, it will read the parameters there.
26  * Otherwise, it will use the constant parameters hardcoded in conf.mk.
27  *
28  * @fdt Pointer to the DTB blob where the TPM Event log information
29  * is expected to be.
30  */
31 void tpm_map_log_area(void *fdt);
32 
33 #else
34 
tpm_get_event_log(void * buf __unused,size_t * size __unused)35 static inline TEE_Result tpm_get_event_log(void *buf __unused,
36 					   size_t *size __unused)
37 {
38 	return TEE_ERROR_NOT_SUPPORTED;
39 }
40 
tpm_get_event_log_size(size_t * size __unused)41 static inline TEE_Result tpm_get_event_log_size(size_t *size __unused)
42 {
43 	return TEE_ERROR_NOT_SUPPORTED;
44 }
45 
tpm_map_log_area(void * fdt __unused)46 static inline void tpm_map_log_area(void *fdt __unused)
47 {}
48 
49 #endif /* CFG_CORE_TPM_EVENT_LOG */
50 
51 #endif /* __KERNEL_TPM_H__ */
52