linux/drivers/char/tpm/tpm_tis_core.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/dmi.h>
#include "tpm.h"
#include "tpm_tis_core.h"

#define TPM_TIS_MAX_UNHANDLED_IRQS

static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value);

static bool wait_for_tpm_stat_cond(struct tpm_chip *chip, u8 mask,
					bool check_cancel, bool *canceled)
{}

static u8 tpm_tis_filter_sts_mask(u8 int_mask, u8 sts_mask)
{}

static int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask,
		unsigned long timeout, wait_queue_head_t *queue,
		bool check_cancel)
{}

/* Before we attempt to access the TPM we must see that the valid bit is set.
 * The specification says that this bit is 0 at reset and remains 0 until the
 * 'TPM has gone through its self test and initialization and has established
 * correct values in the other bits.'
 */
static int wait_startup(struct tpm_chip *chip, int l)
{}

static bool check_locality(struct tpm_chip *chip, int l)
{}

static int __tpm_tis_relinquish_locality(struct tpm_tis_data *priv, int l)
{}

static int tpm_tis_relinquish_locality(struct tpm_chip *chip, int l)
{}

static int __tpm_tis_request_locality(struct tpm_chip *chip, int l)
{}

static int tpm_tis_request_locality(struct tpm_chip *chip, int l)
{}

static u8 tpm_tis_status(struct tpm_chip *chip)
{}

static void tpm_tis_ready(struct tpm_chip *chip)
{}

static int get_burstcount(struct tpm_chip *chip)
{}

static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
{}

static int tpm_tis_try_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{}

static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{}

/*
 * If interrupts are used (signaled by an irq set in the vendor structure)
 * tpm.c can skip polling for the data to be available as the interrupt is
 * waited for here
 */
static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
{}

static void __tpm_tis_disable_interrupts(struct tpm_chip *chip)
{}

static void tpm_tis_disable_interrupts(struct tpm_chip *chip)
{}

/*
 * If interrupts are used (signaled by an irq set in the vendor structure)
 * tpm.c can skip polling for the data to be available as the interrupt is
 * waited for here
 */
static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)
{}

static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
{}

struct tis_vendor_durations_override {};

static const struct  tis_vendor_durations_override vendor_dur_overrides[] =;

static void tpm_tis_update_durations(struct tpm_chip *chip,
				     unsigned long *duration_cap)
{}

struct tis_vendor_timeout_override {};

static const struct tis_vendor_timeout_override vendor_timeout_overrides[] =;

static void tpm_tis_update_timeouts(struct tpm_chip *chip,
				    unsigned long *timeout_cap)
{}

/*
 * Early probing for iTPM with STS_DATA_EXPECT flaw.
 * Try sending command without itpm flag set and if that
 * fails, repeat with itpm flag set.
 */
static int probe_itpm(struct tpm_chip *chip)
{}

static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status)
{}

static irqreturn_t tpm_tis_revert_interrupts(struct tpm_chip *chip)
{}

static irqreturn_t tpm_tis_update_unhandled_irqs(struct tpm_chip *chip)
{}

static irqreturn_t tis_int_handler(int dummy, void *dev_id)
{}

static void tpm_tis_gen_interrupt(struct tpm_chip *chip)
{}

static void tpm_tis_free_irq_func(struct work_struct *work)
{}

/* Register the IRQ and issue a command that will cause an interrupt. If an
 * irq is seen then leave the chip setup for IRQ operation, otherwise reverse
 * everything and leave in polling mode. Returns 0 on success.
 */
static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
				    int flags, int irq)
{}

/* Try to find the IRQ the TPM is using. This is for legacy x86 systems that
 * do not have ACPI/etc. We typically expect the interrupt to be declared if
 * present.
 */
static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask)
{}

void tpm_tis_remove(struct tpm_chip *chip)
{}
EXPORT_SYMBOL_GPL();

/**
 * tpm_tis_clkrun_enable() - Keep clkrun protocol disabled for entire duration
 *                           of a single TPM command
 * @chip:	TPM chip to use
 * @value:	1 - Disable CLKRUN protocol, so that clocks are free running
 *		0 - Enable CLKRUN protocol
 * Call this function directly in tpm_tis_remove() in error or driver removal
 * path, since the chip->ops is set to NULL in tpm_chip_unregister().
 */
static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
{}

static const struct tpm_class_ops tpm_tis =;

int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
		      const struct tpm_tis_phy_ops *phy_ops,
		      acpi_handle acpi_dev_handle)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_PM_SLEEP
static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
{}

int tpm_tis_resume(struct device *dev)
{}
EXPORT_SYMBOL_GPL();
#endif

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();