linux/drivers/char/tpm/tpm_infineon.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Description:
 * Device Driver for the Infineon Technologies
 * SLD 9630 TT 1.1 and SLB 9635 TT 1.2 Trusted Platform Module
 * Specifications at www.trustedcomputinggroup.org
 *
 * Copyright (C) 2005, Marcel Selhorst <[email protected]>
 * Sirrix AG - security technologies <[email protected]> and
 * Applied Data Security Group, Ruhr-University Bochum, Germany
 * Project-Homepage: http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/ 
 */

#include <linux/init.h>
#include <linux/pnp.h>
#include "tpm.h"

/* Infineon specific definitions */
/* maximum number of WTX-packages */
#define TPM_MAX_WTX_PACKAGES
/* msleep-Time for WTX-packages */
#define TPM_WTX_MSLEEP_TIME
/* msleep-Time --> Interval to check status register */
#define TPM_MSLEEP_TIME
/* gives number of max. msleep()-calls before throwing timeout */
#define TPM_MAX_TRIES
#define TPM_INFINEON_DEV_VEN_VALUE

#define TPM_INF_IO_PORT
#define TPM_INF_IO_MEM

#define TPM_INF_ADDR
#define TPM_INF_DATA

struct tpm_inf_dev {};

static struct tpm_inf_dev tpm_dev;

static inline void tpm_data_out(unsigned char data, unsigned char offset)
{}

static inline unsigned char tpm_data_in(unsigned char offset)
{}

static inline void tpm_config_out(unsigned char data, unsigned char offset)
{}

static inline unsigned char tpm_config_in(unsigned char offset)
{}

/* TPM header definitions */
enum infineon_tpm_header {};

enum infineon_tpm_register {};

enum infineon_tpm_command_bits {};

enum infineon_tpm_status_bits {};

/* some outgoing values */
enum infineon_tpm_values {};

static int number_of_wtx;

static int empty_fifo(struct tpm_chip *chip, int clear_wrfifo)
{}

static int wait(struct tpm_chip *chip, int wait_for_bit)
{
	int status;
	int i;
	for (i = 0; i < TPM_MAX_TRIES; i++) {
		status = tpm_data_in(STAT);
		/* check the status-register if wait_for_bit is set */
		if (status & 1 << wait_for_bit)
			break;
		tpm_msleep(TPM_MSLEEP_TIME);
	}
	if (i == TPM_MAX_TRIES) {	/* timeout occurs */
		if (wait_for_bit == STAT_XFE)
			dev_err(&chip->dev, "Timeout in wait(STAT_XFE)\n");
		if (wait_for_bit == STAT_RDA)
			dev_err(&chip->dev, "Timeout in wait(STAT_RDA)\n");
		return -EIO;
	}
	return 0;
};

static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
{}

    /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more
       calculation time, it sends a WTX-package, which has to be acknowledged
       or aborted. This usually occurs if you are hammering the TPM with key
       creation. Set the maximum number of WTX-packages in the definitions
       above, if the number is reached, the waiting-time will be denied
       and the TPM command has to be resend.
     */

static void tpm_wtx(struct tpm_chip *chip)
{}

static void tpm_wtx_abort(struct tpm_chip *chip)
{}

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

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

static void tpm_inf_cancel(struct tpm_chip *chip)
{}

static u8 tpm_inf_status(struct tpm_chip *chip)
{}

static const struct tpm_class_ops tpm_inf =;

static const struct pnp_device_id tpm_inf_pnp_tbl[] =;

MODULE_DEVICE_TABLE(pnp, tpm_inf_pnp_tbl);

static int tpm_inf_pnp_probe(struct pnp_dev *dev,
				       const struct pnp_device_id *dev_id)
{}

static void tpm_inf_pnp_remove(struct pnp_dev *dev)
{}

#ifdef CONFIG_PM_SLEEP
static int tpm_inf_resume(struct device *dev)
{}
#endif
static SIMPLE_DEV_PM_OPS(tpm_inf_pm, tpm_pm_suspend, tpm_inf_resume);

static struct pnp_driver tpm_inf_pnp_driver =;

module_pnp_driver();

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