// SPDX-License-Identifier: GPL-2.0-or-later /* * ATMEL I2C TPM AT97SC3204T * * Copyright (C) 2012 V Lab Technologies * Teddy Reed <teddy@prosauce.org> * Copyright (C) 2013, Obsidian Research Corp. * Jason Gunthorpe <jgunthorpe@obsidianresearch.com> * Device driver for ATMEL I2C TPMs. * * Teddy Reed determined the basic I2C command flow, unlike other I2C TPM * devices the raw TCG formatted TPM command data is written via I2C and then * raw TCG formatted TPM command data is returned via I2C. * * TGC status/locality/etc functions seen in the LPC implementation do not * seem to be present.
*/ #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/slab.h> #include <linux/i2c.h> #include"tpm.h"
struct priv_data {
size_t len; /* This is the amount we read on the first try. 25 was chosen to fit a * fair number of read responses in the buffer so a 2nd retry can be
* avoided in small message cases. */
u8 buffer[sizeof(struct tpm_header) + 25];
};
/* Get the message size from the message header, if we didn't get the * whole message in read_status then we need to re-read the
* message. */
expected_len = be32_to_cpu(hdr->length); if (expected_len > count) return -ENOMEM;
/* The TPM fails the I2C read until it is ready, so we do the entire * transfer here and buffer it locally. This way the common code can
* properly handle the timeouts. */
priv->len = 0;
memset(priv->buffer, 0, sizeof(priv->buffer));
/* Once the TPM has completed the command the command remains readable
* until another command is issued. */
rc = i2c_master_recv(client, priv->buffer, sizeof(priv->buffer));
dev_dbg(&chip->dev, "%s: sts=%d", __func__, rc); if (rc <= 0) return 0;
/* There is no known way to probe for this device, and all version * information seems to be read via TPM commands. Thus we rely on the
* TPM startup process in the common code to detect the device. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.