#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pnp.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/acpi.h>
#include <linux/freezer.h>
#include <linux/of.h>
#include <linux/kernel.h>
#include "tpm.h"
#include "tpm_tis_core.h"
struct tpm_info { … };
struct tpm_tis_tcg_phy { … };
static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *data)
{ … }
#ifdef CONFIG_PREEMPT_RT
static inline void tpm_tis_flush(void __iomem *iobase)
{
ioread8(iobase + TPM_ACCESS(0));
}
#else
#define tpm_tis_flush(iobase) …
#endif
static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr)
{ … }
static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr)
{ … }
static bool interrupts;
module_param(interrupts, bool, 0444);
MODULE_PARM_DESC(…) …;
static bool itpm;
module_param(itpm, bool, 0444);
MODULE_PARM_DESC(…) …;
static bool force;
#ifdef CONFIG_X86
module_param(force, bool, 0444);
MODULE_PARM_DESC(…) …;
#endif
#if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
static int has_hid(struct acpi_device *dev, const char *hid)
{ … }
static inline int is_itpm(struct acpi_device *dev)
{ … }
#else
static inline int is_itpm(struct acpi_device *dev)
{
return 0;
}
#endif
#if defined(CONFIG_ACPI)
#define DEVICE_IS_TPM2 …
static const struct acpi_device_id tpm_acpi_tbl[] = …;
MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
static int check_acpi_tpm2(struct device *dev)
{ … }
#else
static int check_acpi_tpm2(struct device *dev)
{
return 0;
}
#endif
static int tpm_tcg_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
u8 *result, enum tpm_tis_io_mode io_mode)
{ … }
static int tpm_tcg_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
const u8 *value, enum tpm_tis_io_mode io_mode)
{ … }
static const struct tpm_tis_phy_ops tpm_tcg = …;
static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
{ … }
static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume);
static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
const struct pnp_device_id *pnp_id)
{ … }
static struct pnp_device_id tpm_pnp_tbl[] = …;
MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl);
static void tpm_tis_pnp_remove(struct pnp_dev *dev)
{ … }
static struct pnp_driver tis_pnp_driver = …;
#define TIS_HID_USR_IDX …
module_param_string(…);
MODULE_PARM_DESC(…) …;
static struct platform_device *force_pdev;
static int tpm_tis_plat_probe(struct platform_device *pdev)
{ … }
static void tpm_tis_plat_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id tis_of_platform_match[] = …;
MODULE_DEVICE_TABLE(of, tis_of_platform_match);
#endif
static struct platform_driver tis_drv = …;
static int tpm_tis_force_device(void)
{ … }
static int __init init_tis(void)
{ … }
static void __exit cleanup_tis(void)
{ … }
module_init(…) …;
module_exit(cleanup_tis);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_VERSION(…) …;
MODULE_LICENSE(…) …;