1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <arch/cache.h>
6 #include <console/console.h>
7 #include <drivers/spi/tpm/tpm.h>
8 #include <ec/google/chromeec/ec.h>
10 #include <intelblocks/cse.h>
11 #include <security/tpm/tss.h>
14 void cse_board_reset(void)
17 struct cr50_firmware_version version
;
19 if (CONFIG(CSE_RESET_CLEAR_EC_AP_IDLE_FLAG
))
20 google_chromeec_clear_ec_ap_idle();
23 * Assuming that if particular TPM implementation is enabled at compile
24 * time, it's the one being used. This isn't generic code, so can
25 * probably get away with it.
27 if (CONFIG(TPM2
) && CONFIG(TPM_GOOGLE_CR50
)) {
28 /* Initialize TPM and get the cr50 firmware version. */
30 if (rc
!= TPM_SUCCESS
) {
31 printk(BIOS_ERR
, "tlcl_lib_init() failed: %#x\n", rc
);
35 cr50_get_firmware_version(&version
);
38 * Cr50 firmware versions 0.[3|4].20 or newer support strap
39 * config 0xe where PLTRST from AP is connected to cr50's
40 * PLTRST# signal. So return immediately and trigger a global
43 if (version
.epoch
!= 0 || version
.major
> 4 ||
44 (version
.major
>= 3 && version
.minor
>= 20))
47 if (CONFIG(TPM_GOOGLE_TI50
)) {
48 /* All versions of Ti50 firmware support the above PLTRST wiring. */
52 printk(BIOS_INFO
, "Initiating request to EC to trigger cold reset\n");
54 * Clean the data cache and set the full reset bit, so that when EC toggles
55 * SYS_RESET# pin, AP makes a trip to S5 and then to S0.
58 outb(FULL_RST
, RST_CNT
);
59 if (!google_chromeec_ap_reset())