linux/drivers/char/tpm/tpm_tis.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2005, 2006 IBM Corporation
 * Copyright (C) 2014, 2015 Intel Corporation
 *
 * Authors:
 * Leendert van Doorn <[email protected]>
 * Kylene Hall <[email protected]>
 *
 * Maintained by: <[email protected]>
 *
 * Device driver for TCG/TCPA TPM (trusted platform module).
 * Specifications at www.trustedcomputinggroup.org
 *
 * This device driver implements the TPM interface as defined in
 * the TCG TPM Interface Spec version 1.2, revision 1.0.
 */
#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
/*
 * Flush previous write operations with a dummy read operation to the
 * TPM MMIO base address.
 */
static inline void tpm_tis_flush(void __iomem *iobase)
{
	ioread8(iobase + TPM_ACCESS(0));
}
#else
#define tpm_tis_flush(iobase)
#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.
 */
static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr)
{}

/*
 * 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.
 */
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)
{}

/*
 * 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.
 */

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();