Skip to contentSkip to conversation

tpm: replace odd LPC init function

PATCH New Kylene Jo Hall 1 participant 1 message May 23, 2005 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 tpm: replace odd LPC init function

Realized the tpm_lpc_init function isn't really necessary. Replaced it with vendor specific logic to find out the address the BIOS mapped the TPM to. This patch removes the tpm_lpc_init function, enums associated with it and calls to it. The patch also implements the replacement functionality.

I think this patch has been lost in the shuffle so I am resubmitting. It really is needed as it can steal i/o address from other things and break them.

Thanks,
Kylie

---

home/kylie/tcg/tpmdd/drivers/char/tpm/tpm_atmel.c renamed from drivers/char/tpm/tpm_atmel.c +9 -7
diff -uprN --exclude=CVS --exclude='*.orig' linux-2.6.12-rc4/drivers/char/tpm/tpm_atmel.c /home/kylie/tcg/tpmdd/drivers/char/tpm/tpm_atmel.c
@@ -22,8 +22,9 @@
 #include "tpm.h"
 
 /* Atmel definitions */
-enum tpm_atmel_addr{
-	TPM_ATML_BASE = 0x400
+enum tpm_atmel_addr {
+	TPM_ATMEL_BASE_ADDR_LO = 0x08,
+	TPM_ATMEL_BASE_ADDR_HI = 0x09
 };
 
 /* write status bits */
@@ -148,7 +149,6 @@ static struct tpm_vendor_specific tpm_at
 	.req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
 	.req_complete_val = ATML_STATUS_DATA_AVAIL,
 	.req_canceled = ATML_STATUS_READY,
-	.base = TPM_ATML_BASE,
 	.attr_group = &atmel_attr_grp,
 	.miscdev.fops = &atmel_ops,
 };
@@ -158,14 +158,16 @@ static int __devinit tpm_atml_init(struc
 {
 	u8 version[4];
 	int rc = 0;
+	int lo, hi;
 
 	if (pci_enable_device(pci_dev))
 		return -EIO;
 
-	if (tpm_lpc_bus_init(pci_dev, TPM_ATML_BASE)) {
-		rc = -ENODEV;
-		goto out_err;
-	}
+	lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO );
+	hi = tpm_read_index( 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'
home/kylie/tcg/tpmdd/drivers/char/tpm/tpm.c renamed from drivers/char/tpm/tpm.c +0 -90

108 lines not on this page · raw message

home/kylie/tcg/tpmdd/drivers/char/tpm/tpm.h renamed from drivers/char/tpm/tpm.h +0 -2
diff -uprN --exclude=CVS --exclude='*.orig' linux-2.6.12-rc4/drivers/char/tpm/tpm.h /home/kylie/tcg/tpmdd/drivers/char/tpm/tpm.h
@@ -88,8 +88,6 @@ static inline void tpm_write_index(int i
 	outb(value & 0xFF, TPM_DATA);
 }
 
-extern int tpm_lpc_bus_init(struct pci_dev *, u16);
-
 extern int tpm_register_hardware(struct pci_dev *,
 				 struct tpm_vendor_specific *);
 extern int tpm_open(struct inode *, struct file *);
home/kylie/tcg/tpmdd/drivers/char/tpm/tpm_nsc.c renamed from drivers/char/tpm/tpm_nsc.c +13 -9
diff -uprN --exclude=CVS --exclude='*.orig' linux-2.6.12-rc4/drivers/char/tpm/tpm_nsc.c /home/kylie/tcg/tpmdd/drivers/char/tpm/tpm_nsc.c
@@ -22,9 +22,13 @@
 #include "tpm.h"
 
 /* National definitions */
-enum tpm_nsc_addr {
+enum tpm_nsc_addr{
 	TPM_NSC_BASE = 0x360,
-	TPM_NSC_IRQ = 0x07
+	TPM_NSC_IRQ = 0x07,
+	TPM_NSC_BASE0_HI = 0x60,
+	TPM_NSC_BASE0_LO = 0x61,
+	TPM_NSC_BASE1_HI = 0x62,
+	TPM_NSC_BASE1_LO = 0x63
 };
 
 enum tpm_nsc_index {
@@ -44,7 +48,7 @@ enum tpm_nsc_status_loc {
 };
 
 /* status bits */
-enum tpm_nsc_status{
+enum tpm_nsc_status {
 	NSC_STATUS_OBF = 0x01,	/* output buffer full */
 	NSC_STATUS_IBF = 0x02,	/* input buffer full */
 	NSC_STATUS_F0 = 0x04,	/* F0 */
@@ -246,7 +250,6 @@ static struct tpm_vendor_specific tpm_ns
 	.req_complete_mask = NSC_STATUS_OBF,
 	.req_complete_val = NSC_STATUS_OBF,
 	.req_canceled = NSC_STATUS_RDY,
-	.base = TPM_NSC_BASE,
 	.attr_group = &nsc_attr_grp,
 	.miscdev.fops = &nsc_ops,
 
@@ -256,15 +259,16 @@ static int __devinit tpm_nsc_init(struct
 				  const struct pci_device_id *pci_id)
 {
 	int rc = 0;
+	int lo, hi;
+
+	hi = tpm_read_index(TPM_NSC_BASE0_HI);
+	lo = tpm_read_index(TPM_NSC_BASE0_LO);
+
+	tpm_nsc.base = (hi<<8) | lo;
 
 	if (pci_enable_device(pci_dev))
 		return -EIO;
 
-	if (tpm_lpc_bus_init(pci_dev, TPM_NSC_BASE)) {
-		rc = -ENODEV;
-		goto out_err;
-	}
-
 	/* verify that it is a National part (SID) */
 	if (tpm_read_index(NSC_SID_INDEX) != 0xEF) {
 		rc = -ENODEV;
Quoted 16 lines · Ron Forrester

Hello Kylene, I am trying to track down the patch of May 16th referenced in the following post:

	http://lkml.org/lkml/2005/5/20/55

Specifically, "the patch I submitted on May 16 to remove the unnecessary lpc initialization stuff".

I looked through the patches of May 16th and could not find it -- it maybe that I simply missed it, or, more likely, that I don't know what I am doing :-) Can you help?

Thanks much,
Ron Forrester