On Wed, Nov 26, 2014 at 09:06:57AM -0500, Stefan Berger wrote:[...]
On 11/11/2014 08:45 AM, Jarkko Sakkinen wrote:
tpm_crb is a driver for TPM 2.0 Command Response Buffer (CRB) Interface
as defined in PC Client Platform TPM Profile (PTP) Specification.
Only polling and single locality is supported as these are the limitations
of the available hardware, Platform Trust Techonlogy (PTT) in Haswell
CPUs.
The driver always applies CRB with ACPI start because PTT reports using
only ACPI start as start method but as a result of my testing it requires
also CRB start.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
---
Virtual address might be different where CCA is ioremapped.+static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len)cca = priv->cca per statement above -> cmd = cca + x - cca = x
+{
+ struct crb_priv *priv = chip->vendor.priv;
+ struct crb_control_area *cca;
+ u8 *cmd;
+ int rc = 0;
+
+ cca = priv->cca;
+
+ if (len > le32_to_cpu(cca->cmd_size)) {
+ dev_err(&chip->dev,
+ "invalid command count value %x %zx\n",
+ (unsigned int) len,
+ (size_t) le32_to_cpu(cca->cmd_size));
+ return -E2BIG;
+ }
+
+ cmd = (u8 *) ((unsigned long) cca + le64_to_cpu(cca->cmd_pa) -
+ priv->cca_pa);
-> cmd = le64_to_cpu(cca->cmd_pa);
Should do the trick, no ?
+ memcpy(cmd, buf, len);
+
+ /* Make sure that cmd is populated before issuing start. */
+ wmb();
+
+ cca->start = cpu_to_le32(1);
+ rc = crb_do_acpi_start(chip);