mb/google/brya: Create rull variant
[coreboot2.git] / src / vendorcode / google / chromeos / tpm2.c
blob8823978de448e5d70bba8d4ecc06eceb358b449f
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootstate.h>
4 #include <console/console.h>
5 #include <security/tpm/tss.h>
6 #include <vb2_api.h>
8 static void disable_platform_hierarchy(void *unused)
10 tpm_result_t rc;
12 if (!CONFIG(TPM2))
13 return;
15 if (!CONFIG(RESUME_PATH_SAME_AS_BOOT))
16 return;
18 rc = tlcl_lib_init();
20 if (rc != TPM_SUCCESS) {
21 printk(BIOS_ERR, "tlcl_lib_init() failed: %#x\n", rc);
22 return;
25 /* In case both families are enabled, but TPM1 is in use. */
26 if (tlcl_get_family() != TPM_2)
27 return;
29 rc = tlcl2_disable_platform_hierarchy();
30 if (rc != TPM_SUCCESS)
31 printk(BIOS_ERR, "Platform hierarchy disablement failed: %#x\n",
32 rc);
35 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, disable_platform_hierarchy,
36 NULL);