#ifdef CONFIG_PREEMPT_RT /* * Flush previous write operations with a dummy read operation to the * TPM MMIO base address.
*/ staticinlinevoid tpm_tis_flush(void __iomem *iobase)
{
ioread8(iobase + TPM_ACCESS(0));
} #else #define tpm_tis_flush(iobase) do { } while (0) #endif
/* * Write a byte word to the TPM MMIO address, and flush the write queue. * The flush ensures that the data is sent immediately over the bus and not * aggregated with further requests and transferred later in a batch. The large * write requests can lead to unwanted latency spikes by blocking the CPU until * the complete batch has been transferred.
*/ staticinlinevoid tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr)
{
iowrite8(b, iobase + addr);
tpm_tis_flush(iobase);
}
/* * Write a 32-bit word to the TPM MMIO address, and flush the write queue. * The flush ensures that the data is sent immediately over the bus and not * aggregated with further requests and transferred later in a batch. The large * write requests can lead to unwanted latency spikes by blocking the CPU until * the complete batch has been transferred.
*/ staticinlinevoid tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr)
{
iowrite32(b, iobase + addr);
tpm_tis_flush(iobase);
}
staticint check_acpi_tpm2(struct device *dev)
{ conststruct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev); struct acpi_table_tpm2 *tbl;
acpi_status st; int ret = 0;
if (!aid || aid->driver_data != DEVICE_IS_TPM2) return 0;
/* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2 * table is mandatory
*/
st = acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n"); return -EINVAL;
}
/* The tpm2_crb driver handles this device */ if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
ret = -ENODEV;
/* * There is a known bug caused by 93e1b7d42e1e ("[PATCH] tpm: add HID module * parameter"). This commit added IFX0102 device ID, which is also used by * tpm_infineon but ignored to add quirks to probe which driver ought to be * used.
*/
#define TIS_HID_USR_IDX (ARRAY_SIZE(tpm_pnp_tbl) - 2)
module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
/* The driver core will match the name tpm_tis of the device to * the tpm_tis platform driver and complete the setup via * tpm_tis_plat_probe
*/
pdev = platform_device_register_simple("tpm_tis", -1, x86_resources,
ARRAY_SIZE(x86_resources)); if (IS_ERR(pdev)) return PTR_ERR(pdev);
force_pdev = pdev;
return 0;
}
staticint __init init_tis(void)
{ int rc;
rc = tpm_tis_force_device(); if (rc) goto err_force;
rc = platform_driver_register(&tis_drv); if (rc) goto err_platform;
if (IS_ENABLED(CONFIG_PNP)) {
rc = pnp_register_driver(&tis_pnp_driver); if (rc) goto err_pnp;
}
return 0;
err_pnp:
platform_driver_unregister(&tis_drv);
err_platform: if (force_pdev)
platform_device_unregister(force_pdev);
err_force: return rc;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.