coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tpm.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * Description:
5  * Device driver for TCG/TCPA TPM (trusted platform module).
6  * Specifications at www.trustedcomputinggroup.org
7  *
8  * It is based on the Linux kernel driver tpm.c from Leendert van
9  * Dorn, Dave Safford, Reiner Sailer, and Kyleen Hall.
10  */
11 
12 #ifndef __DRIVERS_TPM_SLB9635_I2C_TPM_H__
13 #define __DRIVERS_TPM_SLB9635_I2C_TPM_H__
14 
15 #include <stdint.h>
16 
18  TPM_TIMEOUT = 1, /* msecs */
19 };
20 
21 /* Size of external transmit buffer (used for stack buffer in tpm_sendrecv) */
22 #define TPM_BUFSIZE 1260
23 
24 /* Number of bytes in the TPM header */
25 #define TPM_HEADER_SIZE 10
26 
27 /* Index of fields in TPM command buffer */
28 #define TPM_CMD_SIZE_BYTE 2
29 #define TPM_CMD_ORDINAL_BYTE 6
30 
31 /* Index of Count field in TPM response buffer */
32 #define TPM_RSP_SIZE_BYTE 2
33 #define TPM_RSP_RC_BYTE 6
34 
35 #define TPM_ACCESS(l) (0x0000 | ((l) << 4))
36 #define TPM_STS(l) (0x0001 | ((l) << 4))
37 #define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4))
38 #define TPM_DID_VID(l) (0x0006 | ((l) << 4))
39 
40 struct tpm_chip;
41 
46  int (*recv)(struct tpm_chip *, uint8_t *, size_t);
47  int (*send)(struct tpm_chip *, uint8_t *, size_t);
48  void (*cancel)(struct tpm_chip *);
49  uint8_t (*status)(struct tpm_chip *);
50  int locality;
51 };
52 
53 struct tpm_chip {
54  int is_open;
56 };
57 
58 /* ---------- Interface for TPM vendor ------------ */
59 
60 int tpm_vendor_probe(unsigned int bus, uint32_t addr);
61 
62 int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr);
63 
64 void tpm_vendor_cleanup(struct tpm_chip *chip);
65 
66 #endif /* __DRIVERS_TPM_SLB9635_I2C_TPM_H__ */
static u32 addr
Definition: cirrus.c:14
static struct tpm_chip chip
Definition: tis.c:17
void tpm_vendor_cleanup(struct tpm_chip *chip)
Definition: cr50.c:513
int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr)
Definition: cr50.c:476
int tpm_vendor_probe(unsigned int bus, uint32_t addr)
Definition: cr50.c:436
tpm_timeout
Definition: tpm.h:17
@ TPM_TIMEOUT
Definition: tpm.h:18
__SIZE_TYPE__ size_t
Definition: stddef.h:7
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8
Definition: device.h:76
Definition: tpm.h:53
int is_open
Definition: tpm.h:54
struct tpm_vendor_specific vendor
Definition: tpm.h:55
uint8_t req_complete_mask
Definition: tpm.h:43
uint8_t req_complete_val
Definition: tpm.h:44
uint8_t(* status)(struct tpm_chip *)
Definition: tpm.h:49
void(* cancel)(struct tpm_chip *)
Definition: tpm.h:48
int(* recv)(struct tpm_chip *, uint8_t *, size_t)
Definition: tpm.h:46
int(* send)(struct tpm_chip *, uint8_t *, size_t)
Definition: tpm.h:47
uint8_t req_canceled
Definition: tpm.h:45
typedef void(X86APIP X86EMU_intrFuncs)(int num)