From 15eb58d77bf7f4d5630c0331ac46a602551931ab Mon Sep 17 00:00:00 2001 From: Joel Kitching Date: Wed, 26 Sep 2018 17:40:22 +0800 Subject: tpm/tpm_setup: fail on invalid result from tlcl_resume BUG=b:114018226 TEST=compile coreboot Change-Id: I8f5df2b0119d35e4000fe62bf1bba6ca07f925f3 Signed-off-by: Joel Kitching Reviewed-on: https://review.coreboot.org/28748 Reviewed-by: Aaron Durbin Reviewed-by: Julius Werner Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/security/tpm/tspi/tspi.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/security/tpm/tspi') diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c index fccf224519..c1779e677a 100644 --- a/src/security/tpm/tspi/tspi.c +++ b/src/security/tpm/tspi/tspi.c @@ -97,10 +97,25 @@ uint32_t tpm_setup(int s3flag) /* Handle special init for S3 resume path */ if (s3flag) { result = tlcl_resume(); - if (result == TPM_E_INVALID_POSTINIT) + switch (result) { + case TPM_SUCCESS: + break; + + case TPM_E_INVALID_POSTINIT: + /* + * We're on a platform where the TPM maintains power + * in S3, so it's already initialized. + */ printk(BIOS_INFO, "TPM: Already initialized.\n"); + result = TPM_SUCCESS; + break; - return TPM_SUCCESS; + default: + printk(BIOS_ERR, "TPM: Resume failed (%#x).\n", result); + break; + + } + goto out; } result = tlcl_startup(); -- cgit v1.2.3