xref: /aosp_15_r20/external/coreboot/src/security/vboot/secdata_tpm_private.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 #ifndef __VBOOT_SECDATA_TPM_PRIVATE_H__
4 #define __VBOOT_SECDATA_TPM_PRIVATE_H__
5 
6 #include <console/console.h>
7 #include <security/tpm/tis.h>
8 #include <vb2_api.h>
9 
10 #define VBDEBUG(format, args...) \
11 	printk(BIOS_INFO, "%s():%d: " format, __func__, __LINE__, ## args)
12 
13 #define RETURN_ON_FAILURE(tpm_cmd) do {                                          \
14 		tpm_result_t rc_;                                                \
15 		if ((rc_ = (tpm_cmd)) != TPM_SUCCESS) {                          \
16 			VBDEBUG("Antirollback: %08x returned by " #tpm_cmd "\n", \
17 				(tpm_result_t)rc_);                              \
18 			return rc_;                                              \
19 		}                                                                \
20 	} while (0)
21 
22 tpm_result_t safe_write(uint32_t index, const void *data, uint32_t length);
23 
24 tpm_result_t factory_initialize_tpm1(struct vb2_context *ctx);
25 
26 tpm_result_t factory_initialize_tpm2(struct vb2_context *ctx);
27 
28 #endif /* __VBOOT_SECDATA_TPM_PRIVATE_H__ */
29