| .. | .. |
|---|
| 50 | 50 | return container_of(data, struct tpm_tis_tcg_phy, priv); |
|---|
| 51 | 51 | } |
|---|
| 52 | 52 | |
|---|
| 53 | | -#ifdef CONFIG_PREEMPT_RT |
|---|
| 54 | | -/* |
|---|
| 55 | | - * Flushes previous write operations to chip so that a subsequent |
|---|
| 56 | | - * ioread*()s won't stall a cpu. |
|---|
| 57 | | - */ |
|---|
| 58 | | -static inline void tpm_tis_flush(void __iomem *iobase) |
|---|
| 59 | | -{ |
|---|
| 60 | | - ioread8(iobase + TPM_ACCESS(0)); |
|---|
| 61 | | -} |
|---|
| 62 | | -#else |
|---|
| 63 | | -#define tpm_tis_flush(iobase) do { } while (0) |
|---|
| 64 | | -#endif |
|---|
| 65 | | - |
|---|
| 66 | | -static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr) |
|---|
| 67 | | -{ |
|---|
| 68 | | - iowrite8(b, iobase + addr); |
|---|
| 69 | | - tpm_tis_flush(iobase); |
|---|
| 70 | | -} |
|---|
| 71 | | - |
|---|
| 72 | | -static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr) |
|---|
| 73 | | -{ |
|---|
| 74 | | - iowrite32(b, iobase + addr); |
|---|
| 75 | | - tpm_tis_flush(iobase); |
|---|
| 76 | | -} |
|---|
| 77 | | - |
|---|
| 78 | 53 | static int interrupts = -1; |
|---|
| 79 | 54 | module_param(interrupts, int, 0444); |
|---|
| 80 | 55 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
|---|
| .. | .. |
|---|
| 106 | 81 | .matches = { |
|---|
| 107 | 82 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 108 | 83 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"), |
|---|
| 84 | + }, |
|---|
| 85 | + }, |
|---|
| 86 | + { |
|---|
| 87 | + .callback = tpm_tis_disable_irq, |
|---|
| 88 | + .ident = "ThinkStation P360 Tiny", |
|---|
| 89 | + .matches = { |
|---|
| 90 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 91 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkStation P360 Tiny"), |
|---|
| 92 | + }, |
|---|
| 93 | + }, |
|---|
| 94 | + { |
|---|
| 95 | + .callback = tpm_tis_disable_irq, |
|---|
| 96 | + .ident = "ThinkPad L490", |
|---|
| 97 | + .matches = { |
|---|
| 98 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 99 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L490"), |
|---|
| 109 | 100 | }, |
|---|
| 110 | 101 | }, |
|---|
| 111 | 102 | {} |
|---|
| .. | .. |
|---|
| 150 | 141 | const struct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev); |
|---|
| 151 | 142 | struct acpi_table_tpm2 *tbl; |
|---|
| 152 | 143 | acpi_status st; |
|---|
| 144 | + int ret = 0; |
|---|
| 153 | 145 | |
|---|
| 154 | 146 | if (!aid || aid->driver_data != DEVICE_IS_TPM2) |
|---|
| 155 | 147 | return 0; |
|---|
| .. | .. |
|---|
| 157 | 149 | /* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2 |
|---|
| 158 | 150 | * table is mandatory |
|---|
| 159 | 151 | */ |
|---|
| 160 | | - st = |
|---|
| 161 | | - acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); |
|---|
| 152 | + st = acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); |
|---|
| 162 | 153 | if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) { |
|---|
| 163 | 154 | dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n"); |
|---|
| 164 | 155 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 166 | 157 | |
|---|
| 167 | 158 | /* The tpm2_crb driver handles this device */ |
|---|
| 168 | 159 | if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED) |
|---|
| 169 | | - return -ENODEV; |
|---|
| 160 | + ret = -ENODEV; |
|---|
| 170 | 161 | |
|---|
| 171 | | - return 0; |
|---|
| 162 | + acpi_put_table((struct acpi_table_header *)tbl); |
|---|
| 163 | + return ret; |
|---|
| 172 | 164 | } |
|---|
| 173 | 165 | #else |
|---|
| 174 | 166 | static int check_acpi_tpm2(struct device *dev) |
|---|
| .. | .. |
|---|
| 194 | 186 | struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); |
|---|
| 195 | 187 | |
|---|
| 196 | 188 | while (len--) |
|---|
| 197 | | - tpm_tis_iowrite8(*value++, phy->iobase, addr); |
|---|
| 189 | + iowrite8(*value++, phy->iobase + addr); |
|---|
| 198 | 190 | |
|---|
| 199 | 191 | return 0; |
|---|
| 200 | 192 | } |
|---|
| .. | .. |
|---|
| 221 | 213 | { |
|---|
| 222 | 214 | struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); |
|---|
| 223 | 215 | |
|---|
| 224 | | - tpm_tis_iowrite32(value, phy->iobase, addr); |
|---|
| 216 | + iowrite32(value, phy->iobase + addr); |
|---|
| 225 | 217 | |
|---|
| 226 | 218 | return 0; |
|---|
| 227 | 219 | } |
|---|