Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 2020 20:38:22 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357386 - head/sys/dev/tpm
Message-ID:  <202002012038.011KcMtT052048@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Sat Feb  1 20:38:22 2020
New Revision: 357386
URL: https://svnweb.freebsd.org/changeset/base/357386

Log:
  tpm(4): Fix 'go ready' in TPM 2.0 TIS driver
  
  tpmtis_go_ready() read the value of the TPM_STS register, ORed
  TPM_STS_CMD_READY with it, and wrote it back.  However, the TPM Profile
  (PTP) specification states that only one bit in the write request value may
  be set to 1, or else the entire write request is ignored.
  
  Fix by just writing TPM_STS_CMD_READY.
  
  Similarly, remove the call which clears the TPM_STS_CMD_READY flag in the
  same function.  It was being ignored for the same reason.
  
  Submitted by:	Darrick Lew <darrick.freebsd AT gmail.com>
  Reviewed by:	vangyzen, myself
  MFC after:	if you care about stable, you might want to do so
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D23081

Modified:
  head/sys/dev/tpm/tpm_tis.c

Modified: head/sys/dev/tpm/tpm_tis.c
==============================================================================
--- head/sys/dev/tpm/tpm_tis.c	Sat Feb  1 20:37:11 2020	(r357385)
+++ head/sys/dev/tpm/tpm_tis.c	Sat Feb  1 20:38:22 2020	(r357386)
@@ -386,12 +386,11 @@ tpmtis_go_ready(struct tpm_sc *sc)
 	mask = TPM_STS_CMD_RDY;
 	sc->intr_type = TPM_INT_STS_CMD_RDY;
 
-	OR4(sc, TPM_STS, TPM_STS_CMD_RDY);
+	WR4(sc, TPM_STS, TPM_STS_CMD_RDY);
 	bus_barrier(sc->mem_res, TPM_STS, 4, BUS_SPACE_BARRIER_WRITE);
 	if (!tpm_wait_for_u32(sc, TPM_STS, mask, mask, TPM_TIMEOUT_B))
 		return (false);
 
-	AND4(sc, TPM_STS, ~TPM_STS_CMD_RDY);
 	return (true);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002012038.011KcMtT052048>