diff options
author | Kylene Hall <kjhall@us.ibm.com> | 2005-06-24 01:02:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:27 -0400 |
commit | e1a23c6671f2bfd6e5e112848f01334ca39ea2b1 (patch) | |
tree | 9eae7fac05706a63ac3b486ecf4d9c686fa7dd54 /drivers/char/tpm/tpm.c | |
parent | a6df7da8f7ee99e6fd1995fad852bacb978a6447 (diff) |
[PATCH] 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.
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index c6d985b04b6d..726d1b5b33b0 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -35,25 +35,6 @@ enum tpm_const { | |||
35 | TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int)) | 35 | TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int)) |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* PCI configuration addresses */ | ||
39 | enum tpm_pci_config_addr { | ||
40 | PCI_GEN_PMCON_1 = 0xA0, | ||
41 | PCI_GEN1_DEC = 0xE4, | ||
42 | PCI_LPC_EN = 0xE6, | ||
43 | PCI_GEN2_DEC = 0xEC | ||
44 | }; | ||
45 | |||
46 | enum tpm_config { | ||
47 | TPM_LOCK_REG = 0x0D, | ||
48 | TPM_INTERUPT_REG = 0x0A, | ||
49 | TPM_BASE_ADDR_LO = 0x08, | ||
50 | TPM_BASE_ADDR_HI = 0x09, | ||
51 | TPM_UNLOCK_VALUE = 0x55, | ||
52 | TPM_LOCK_VALUE = 0xAA, | ||
53 | TPM_DISABLE_INTERUPT_VALUE = 0x00 | ||
54 | }; | ||
55 | |||
56 | |||
57 | static LIST_HEAD(tpm_chip_list); | 38 | static LIST_HEAD(tpm_chip_list); |
58 | static DEFINE_SPINLOCK(driver_lock); | 39 | static DEFINE_SPINLOCK(driver_lock); |
59 | static int dev_mask[TPM_NUM_MASK_ENTRIES]; | 40 | static int dev_mask[TPM_NUM_MASK_ENTRIES]; |
@@ -69,73 +50,6 @@ static void user_reader_timeout(unsigned long ptr) | |||
69 | } | 50 | } |
70 | 51 | ||
71 | /* | 52 | /* |
72 | * Initialize the LPC bus and enable the TPM ports | ||
73 | */ | ||
74 | int tpm_lpc_bus_init(struct pci_dev *pci_dev, u16 base) | ||
75 | { | ||
76 | u32 lpcenable, tmp; | ||
77 | int is_lpcm = 0; | ||
78 | |||
79 | switch (pci_dev->vendor) { | ||
80 | case PCI_VENDOR_ID_INTEL: | ||
81 | switch (pci_dev->device) { | ||
82 | case PCI_DEVICE_ID_INTEL_82801CA_12: | ||
83 | case PCI_DEVICE_ID_INTEL_82801DB_12: | ||
84 | is_lpcm = 1; | ||
85 | break; | ||
86 | } | ||
87 | /* init ICH (enable LPC) */ | ||
88 | pci_read_config_dword(pci_dev, PCI_GEN1_DEC, &lpcenable); | ||
89 | lpcenable |= 0x20000000; | ||
90 | pci_write_config_dword(pci_dev, PCI_GEN1_DEC, lpcenable); | ||
91 | |||
92 | if (is_lpcm) { | ||
93 | pci_read_config_dword(pci_dev, PCI_GEN1_DEC, | ||
94 | &lpcenable); | ||
95 | if ((lpcenable & 0x20000000) == 0) { | ||
96 | dev_err(&pci_dev->dev, | ||
97 | "cannot enable LPC\n"); | ||
98 | return -ENODEV; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | /* initialize TPM registers */ | ||
103 | pci_read_config_dword(pci_dev, PCI_GEN2_DEC, &tmp); | ||
104 | |||
105 | if (!is_lpcm) | ||
106 | tmp = (tmp & 0xFFFF0000) | (base & 0xFFF0); | ||
107 | else | ||
108 | tmp = | ||
109 | (tmp & 0xFFFF0000) | (base & 0xFFF0) | | ||
110 | 0x00000001; | ||
111 | |||
112 | pci_write_config_dword(pci_dev, PCI_GEN2_DEC, tmp); | ||
113 | |||
114 | if (is_lpcm) { | ||
115 | pci_read_config_dword(pci_dev, PCI_GEN_PMCON_1, | ||
116 | &tmp); | ||
117 | tmp |= 0x00000004; /* enable CLKRUN */ | ||
118 | pci_write_config_dword(pci_dev, PCI_GEN_PMCON_1, | ||
119 | tmp); | ||
120 | } | ||
121 | break; | ||
122 | case PCI_VENDOR_ID_AMD: | ||
123 | /* nothing yet */ | ||
124 | break; | ||
125 | } | ||
126 | |||
127 | tpm_write_index(TPM_LOCK_REG, TPM_UNLOCK_VALUE); | ||
128 | tpm_write_index(TPM_INTERUPT_REG, TPM_DISABLE_INTERUPT_VALUE); | ||
129 | tpm_write_index(TPM_BASE_ADDR_LO, base); | ||
130 | tpm_write_index(TPM_BASE_ADDR_HI, (base & 0xFF00) >> 8); | ||
131 | tpm_write_index(TPM_LOCK_REG, TPM_LOCK_VALUE); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | EXPORT_SYMBOL_GPL(tpm_lpc_bus_init); | ||
137 | |||
138 | /* | ||
139 | * Internal kernel interface to transmit TPM commands | 53 | * Internal kernel interface to transmit TPM commands |
140 | */ | 54 | */ |
141 | static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | 55 | static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, |
@@ -586,10 +500,6 @@ int tpm_pm_resume(struct pci_dev *pci_dev) | |||
586 | if (chip == NULL) | 500 | if (chip == NULL) |
587 | return -ENODEV; | 501 | return -ENODEV; |
588 | 502 | ||
589 | spin_lock(&driver_lock); | ||
590 | tpm_lpc_bus_init(pci_dev, chip->vendor->base); | ||
591 | spin_unlock(&driver_lock); | ||
592 | |||
593 | return 0; | 503 | return 0; |
594 | } | 504 | } |
595 | 505 | ||