Skip to contentSkip to conversation

tpm: Driver for next generation TPM chips

PATCH In review Kylene Jo Hall 1 participant 1 message Apr 3, 2006 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 tpm: Driver for next generation TPM chips

This patch contains the driver for the next generation of TPM chips version 1.2 including support for interrupts. The Trusted Computing Group has written the TPM Interface Specification (TIS) which defines a common interface for all manufacturer's 1.2 TPM's thus the name tpm_tis.

---

drivers/char/tpm/Kconfig   |   11
drivers/char/tpm/Makefile  |    1
drivers/char/tpm/tpm.c     |    3
drivers/char/tpm/tpm.h     |    9
drivers/char/tpm/tpm_tis.c |  628 +++++++++++++++++++++++++++++++++++
5 files changed, 651 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm.h +9 -0
@@ -57,6 +57,8 @@ struct tpm_vendor_specific {
 	void __iomem *iobase;		/* ioremapped address */
 	unsigned long base;		/* TPM base address */
 
+	int irq;
+
 	int region_size;
 	int have_region;
 
@@ -66,8 +68,13 @@ struct tpm_vendor_specific {
 	u8 (*status) (struct tpm_chip *);
 	struct miscdevice miscdev;
 	struct attribute_group *attr_group;
+	struct list_head list;
+	int locality;
 	u32 timeout_a, timeout_b, timeout_c, timeout_d;
 	u32 duration[3];
+
+	wait_queue_head_t read_queue;
+	wait_queue_head_t int_queue;
 };
 
 struct tpm_chip {
@@ -93,6 +100,8 @@ struct tpm_chip {
 	struct list_head list;
 };
 
+#define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
+
 static inline int tpm_read_index(int base, int index)
 {
 	outb(index, base);
drivers/char/tpm/tpm.c +3 -0
@@ -391,6 +391,9 @@ static ssize_t tpm_transmit(struct tpm_c
 		goto out;
 	}
 
+	if (chip->vendor.irq)
+		goto out_recv;
+
 	stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal);
 	do {
 		u8 status = chip->vendor.status(chip);
drivers/char/tpm/tpm_tis.c +628 -0

628 lines not on this page · raw message

drivers/char/tpm/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o
 ifdef CONFIG_ACPI
 	obj-$(CONFIG_TCG_TPM) += tpm_bios.o
 endif
+obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
 obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
 obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
drivers/char/tpm/Kconfig +10 -1
@@ -20,9 +20,18 @@ config TCG_TPM
 	  Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
 	  and CONFIG_PNPACPI.
 
+config TCG_TIS
+	tristate "TPM Interface Specification 1.2 Interface"
+	depends on TCG_TPM
+	---help---
+	  If you have a TPM security chip that is compliant with the
+	  TCG TIS 1.2 TPM specification say Yes and it will be accessible
+	  from within Linux.  To compile this driver as a module, choose
+	  M here; the module will be called tpm_tis.
+
 config TCG_NSC
 	tristate "National Semiconductor TPM Interface"
-	depends on TCG_TPM
+	depends on TCG_TPM && PNPACPI
 	---help---
 	  If you have a TPM security chip from National Semicondutor 
 	  say Yes and it will be accessible from within Linux.  To