Skip to contentSkip to conversation

tpm: Support new National TPMs

PATCH New Kylene Jo Hall 1 participant 1 message Jun 23, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Support new National TPMs

This patch is work to support new National TPMs that problems were reported with on Thinkpad T43 and Thinkcentre S51. Thanks to Jens and Gang for their debugging work on these issues.

---

drivers/char/tpm/tpm_atmel.c +8 -8
diff -uprN --exclude='*.ko' --exclude='*.o' --exclude='*.mod*' --exclude='.*' --exclude='*~' --exclude='*.orig' linux-2.6.12-rc6/drivers/char/tpm/tpm_atmel.c linux-2.6.12-rc5-mm2/drivers/char/tpm/tpm_atmel.c
@@ -163,24 +161,24 @@ static int __devinit tpm_atml_init(struc
 	if (pci_enable_device(pci_dev))
 		return -EIO;
 
-	lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO );
-	hi = tpm_read_index( TPM_ATMEL_BASE_ADDR_HI );
+	lo = tpm_read_index( TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO );
+	hi = tpm_read_index( TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI );
 
 	tpm_atmel.base = (hi<<8)|lo;
 	dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base);
 
 	/* verify that it is an Atmel part */
-	if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T'
-	    || tpm_read_index(6) != 'M' || tpm_read_index(7) != 'L') {
+	if (tpm_read_index(TPM_ADDR, 4) != 'A' || tpm_read_index(TPM_ADDR, 5) != 'T'
+	    || tpm_read_index(TPM_ADDR, 6) != 'M' || tpm_read_index(TPM_ADDR, 7) != 'L') {
 		rc = -ENODEV;
 		goto out_err;
 	}
 
 	/* query chip for its version number */
-	if ((version[0] = tpm_read_index(0x00)) != 0xFF) {
-		version[1] = tpm_read_index(0x01);
-		version[2] = tpm_read_index(0x02);
-		version[3] = tpm_read_index(0x03);
+	if ((version[0] = tpm_read_index(TPM_ADDR, 0x00)) != 0xFF) {
+		version[1] = tpm_read_index(TPM_ADDR, 0x01);
+		version[2] = tpm_read_index(TPM_ADDR, 0x02);
+		version[3] = tpm_read_index(TPM_ADDR, 0x03);
 	} else {
 		dev_info(&pci_dev->dev, "version query failed\n");
 		rc = -ENODEV;
drivers/char/tpm/tpm.h +7 -7
diff -uprN --exclude='*.ko' --exclude='*.o' --exclude='*.mod*' --exclude='.*' --exclude='*~' --exclude='*.orig' linux-2.6.12-rc6/drivers/char/tpm/tpm.h linux-2.6.12-rc5-mm2/drivers/char/tpm/tpm.h
@@ -31,8 +31,8 @@ enum tpm_timeout {
 
 /* TPM addresses */
 enum tpm_addr {
+	TPM_SUPERIO_ADDR = 0x2E,
 	TPM_ADDR = 0x4E,
-	TPM_DATA = 0x4F
 };
 
 extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
@@ -79,16 +79,16 @@ struct tpm_chip {
 	struct list_head list;
 };
 
-static inline int tpm_read_index(int index)
+static inline int tpm_read_index(int base, int index)
 {
-	outb(index, TPM_ADDR);
-	return inb(TPM_DATA) & 0xFF;
+	outb(index, base);
+	return inb(base+1) & 0xFF;
 }
 
-static inline void tpm_write_index(int index, int value)
+static inline void tpm_write_index(int base, int index, int value)
 {
-	outb(index, TPM_ADDR);
-	outb(value & 0xFF, TPM_DATA);
+	outb(index, base);
+	outb(value & 0xFF, base+1);
 }
 
 extern int tpm_register_hardware(struct pci_dev *,
drivers/char/tpm/tpm_nsc.c +38 -55

149 lines not on this page · raw message