TPM_COMMAND_NO_ARG(tpm_physical_enable)
TPM_COMMAND_NO_ARG(tpm_physical_disable)
-#ifdef CONFIG_DM_TPM
static int get_tpm(struct udevice **devp)
{
int rc;
return 0;
}
-#endif
static int do_tpm_raw_transfer(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
+ struct udevice *dev;
void *command;
uint8_t response[1024];
size_t count, response_length = sizeof(response);
return CMD_RET_FAILURE;
}
-#ifdef CONFIG_DM_TPM
- struct udevice *dev;
-
rc = get_tpm(&dev);
if (rc)
return rc;
rc = tpm_xfer(dev, command, count, response, &response_length);
-#else
- rc = tis_sendrecv(command, count, response, &response_length);
-#endif
free(command);
if (!rc) {
puts("tpm response:\n");
U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")
static cmd_tbl_t tpm_commands[] = {
-#ifdef CONFIG_DM_TPM
U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
-#endif
U_BOOT_CMD_MKENT(init, 0, 1,
do_tpm_init, "", ""),
U_BOOT_CMD_MKENT(startup, 0, 1,
"cmd args...\n"
" - Issue TPM command <cmd> with arguments <args...>.\n"
"Admin Startup and State Commands:\n"
-#ifdef CONFIG_DM_TPM
" info - Show information about the TPM\n"
-#endif
" init\n"
" - Put TPM into a state where it waits for 'startup' command.\n"
" startup mode\n"
#include <dm.h>
#include <fdtdec.h>
#include <i2c.h>
-#include <tis.h>
#include <tpm.h>
#include <asm-generic/errno.h>
#include <linux/compiler.h>
#include <common.h>
#include <dm.h>
#include <mapmem.h>
-#include <tis.h>
#include <tpm.h>
#include <asm/io.h>
+++ /dev/null
-/*
- * Copyright (c) 2011 The Chromium OS Authors.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef __TIS_H
-#define __TIS_H
-
-#ifndef CONFIG_DM_TPM
-
-#include <common.h>
-
-/* Low-level interface to access TPM */
-
-/*
- * tis_init()
- *
- * Initialize the TPM device. Returns 0 on success or -1 on
- * failure (in case device probing did not succeed).
- */
-int tis_init(void);
-
-/*
- * tis_open()
- *
- * Requests access to locality 0 for the caller. After all commands have been
- * completed the caller is supposed to call tis_close().
- *
- * Returns 0 on success, -1 on failure.
- */
-int tis_open(void);
-
-/*
- * tis_close()
- *
- * terminate the currect session with the TPM by releasing the locked
- * locality. Returns 0 on success of -1 on failure (in case lock
- * removal did not succeed).
- */
-int tis_close(void);
-
-/*
- * tis_sendrecv()
- *
- * Send the requested data to the TPM and then try to get its response
- *
- * @sendbuf - buffer of the data to send
- * @send_size size of the data to send
- * @recvbuf - memory to save the response to
- * @recv_len - pointer to the size of the response buffer
- *
- * Returns 0 on success (and places the number of response bytes at recv_len)
- * or -1 on failure.
- */
-int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
- size_t *recv_len);
-#endif
-
-#endif /* __TIS_H */
#ifndef __TPM_H
#define __TPM_H
-#include <tis.h>
-
/*
* Here is a partial implementation of TPM commands. Please consult TCG Main
* Specification for definitions of TPM commands.
u8 disable_full_da_logic_info;
} __packed;
-#ifdef CONFIG_DM_TPM
-
/* Max buffer size supported by our tpm */
#define TPM_DEV_BUFSIZE 1260
int tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, size_t send_size,
uint8_t *recvbuf, size_t *recv_size);
-#endif /* CONFIG_DM_TPM */
-
/**
* Initialize TPM device. It must be called before any TPM commands.
*
#include <common.h>
#include <dm.h>
-#include <tis.h>
#include <tpm.h>
#include <asm/unaligned.h>
#include <u-boot/sha1.h>
static uint32_t tpm_sendrecv_command(const void *command,
void *response, size_t *size_ptr)
{
+ struct udevice *dev;
+ int ret;
uint8_t response_buffer[COMMAND_BUFFER_SIZE];
size_t response_length;
uint32_t err;
response = response_buffer;
response_length = sizeof(response_buffer);
}
-#ifdef CONFIG_DM_TPM
- struct udevice *dev;
- int ret;
ret = uclass_first_device(UCLASS_TPM, &dev);
if (ret)
return ret;
err = tpm_xfer(dev, command, tpm_command_size(command),
response, &response_length);
-#else
- err = tis_sendrecv(command, tpm_command_size(command),
- response, &response_length);
-#endif
+
if (err < 0)
return TPM_LIB_ERROR;
if (size_ptr)
int tpm_init(void)
{
int err;
-
-#ifdef CONFIG_DM_TPM
struct udevice *dev;
err = uclass_first_device(UCLASS_TPM, &dev);
if (err)
return err;
return tpm_open(dev);
-#else
- err = tis_init();
- if (err)
- return err;
-
- return tis_open();
-#endif
}
uint32_t tpm_startup(enum tpm_startup_type mode)