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: BSD-3-Clause */
2
/* This is a driver for a Command Response Buffer Interface */
3
4
/* CRB driver */
5
/* address of locality 0 (CRB) */
6
#define TPM_CRB_BASE_ADDRESS CONFIG_CRB_TPM_BASE_ADDRESS
7
8
#define CRB_REG(LOCTY, REG) \
9
(void *)(uintptr_t)(CONFIG_CRB_TPM_BASE_ADDRESS + (LOCTY << 12) + REG)
10
11
/* hardware registers */
12
#define CRB_REG_LOC_STATE 0x00
13
#define CRB_REG_LOC_CTRL 0x08
14
#define CRB_REG_LOC_STS 0x0C
15
16
/* LOC_CTRL BIT MASKS */
17
#define LOC_CTRL_REQ_ACCESS 0x01
18
19
/* LOC STATE BIT MASKS */
20
#define LOC_STATE_LOC_ASSIGN 0x02
21
#define LOC_STATE_REG_VALID_STS 0x80
22
23
/* LOC STS BIT MASKS */
24
#define LOC_STS_GRANTED 0x01
25
26
#define CRB_REG_INTF_ID 0x30
27
#define CRB_REG_REQUEST 0x40
28
#define CRB_REG_STATUS 0x44
29
#define CRB_REG_CANCEL 0x48
30
#define CRB_REG_START 0x4C
31
#define CRB_REG_INT_CTRL 0x50
32
#define CRB_REG_CMD_SIZE 0x58
33
#define CRB_REG_CMD_ADDR 0x5C
34
#define CRB_REG_RESP_SIZE 0x64
35
#define CRB_REG_RESP_ADDR 0x68
36
37
/* CRB INTF BIT MASK */
38
#define CRB_INTF_REG_CAP_CRB (1<<14)
39
#define CRB_INTF_REG_INTF_SEL (1<<17)
40
#define CRB_INTF_REG_INTF_LOCK (1<<19)
41
42
/*REQUEST Register related */
43
#define CRB_REG_REQUEST_CMD_RDY 0x01
44
#define CRB_REG_REQUEST_GO_IDLE 0x02
45
46
/* STATUS Register related */
47
#define CRB_REG_STATUS_ERROR 0x01
48
#define CRB_REG_STATUS_IDLE 0x02
49
50
/* START Register related */
51
#define CRB_REG_START_START 0x01
52
53
/* TPM Info Struct */
54
struct
tpm2_info
{
55
uint16_t
vendor_id
;
56
uint16_t
device_id
;
57
uint16_t
revision
;
58
};
59
60
int
tpm2_init
(
void
);
61
void
tpm2_get_info
(
struct
tpm2_info
*
tpm2_info
);
62
size_t
tpm2_process_command
(
const
void
*tpm2_command,
size_t
command_size,
63
void
*
tpm2_response
,
size_t
max_response);
tpm2_init
int tpm2_init(void)
Definition:
tpm.c:175
tpm2_process_command
size_t tpm2_process_command(const void *tpm2_command, size_t command_size, void *tpm2_response, size_t max_response)
Definition:
tpm.c:195
tpm2_get_info
void tpm2_get_info(struct tpm2_info *tpm2_info)
Definition:
tpm.c:266
uint16_t
unsigned short uint16_t
Definition:
stdint.h:11
tpm2_info
Definition:
tpm.h:54
tpm2_info::device_id
uint16_t device_id
Definition:
tpm.h:56
tpm2_info::revision
uint16_t revision
Definition:
tpm.h:57
tpm2_info::vendor_id
uint16_t vendor_id
Definition:
tpm.h:55
tpm2_response
Definition:
tss_structures.h:379
src
drivers
crb
tpm.h
Generated by
1.9.1