lib/smbios: Improve Type9
[coreboot2.git] / src / drivers / spi / tpm / tpm.h
blobd6e0e7422785a26f50f5f0cd8f826726987c6d4e
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef __COREBOOT_SRC_DRIVERS_SPI_TPM_TPM_H
4 #define __COREBOOT_SRC_DRIVERS_SPI_TPM_TPM_H
6 #include <drivers/tpm/cr50.h>
7 #include <security/tpm/tis.h>
8 #include <security/tpm/tss_errors.h>
9 #include <stddef.h>
10 #include <spi-generic.h>
12 #define TPM_LOCALITY_0_SPI_BASE 0x00d40000
15 * A TPM device descriptor, values read from the appropriate device registers
16 * are cached here.
18 struct tpm2_info {
19 uint16_t vendor_id;
20 uint16_t device_id;
21 uint16_t revision;
25 * Initialize a TPM2 device: read its id, claim locality of zero, verify that
26 * this indeed is a TPM2 device. Use the passed in handle to access the right
27 * SPI port.
29 * Return 0 on success, non-zero on failure.
31 tpm_result_t tpm2_init(struct spi_slave *spi_if);
34 * Each command processing consists of sending the command to the TPM, by
35 * writing it into the FIFO register, then polling the status register until
36 * the TPM is ready to respond, then reading the response from the FIFO
37 * register. The size of the response can be gleaned from the 6 byte header.
39 * This function places the response into the tpm2_response buffer and returns
40 * the size of the response.
42 size_t tpm2_process_command(const void *tpm2_command, size_t command_size,
43 void *tpm2_response, size_t max_response);
45 /* Get information about previously initialized TPM device. */
46 void tpm2_get_info(struct tpm2_info *info);
48 tis_sendrecv_fn spi_tis_probe(enum tpm_family *family);
50 #endif /* ! __COREBOOT_SRC_DRIVERS_SPI_TPM_TPM_H */