soc/intel/xeon_sp: Remove lpc_lockdown_config
[coreboot.git] / src / drivers / crb / tpm.h
blobaaf63a4a357e7f5f95d8b4896434d33398ee5301
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* This is a driver for a Command Response Buffer Interface */
4 #include <security/tpm/tis.h>
5 #include <security/tpm/tss_errors.h>
7 /* CRB driver */
8 /* address of locality 0 (CRB) */
9 #define TPM_CRB_BASE_ADDRESS CONFIG_CRB_TPM_BASE_ADDRESS
11 #define CRB_REG(LOCTY, REG) \
12 (void *)(uintptr_t)(CONFIG_CRB_TPM_BASE_ADDRESS + (LOCTY << 12) + REG)
14 /* hardware registers */
15 #define CRB_REG_LOC_STATE 0x00
16 #define CRB_REG_LOC_CTRL 0x08
17 #define CRB_REG_LOC_STS 0x0C
19 /* LOC_CTRL BIT MASKS */
20 #define LOC_CTRL_REQ_ACCESS 0x01
22 /* LOC STATE BIT MASKS */
23 #define LOC_STATE_LOC_ASSIGN 0x02
24 #define LOC_STATE_REG_VALID_STS 0x80
26 /* LOC STS BIT MASKS */
27 #define LOC_STS_GRANTED 0x01
29 #define CRB_REG_INTF_ID 0x30
30 #define CRB_REG_REQUEST 0x40
31 #define CRB_REG_STATUS 0x44
32 #define CRB_REG_CANCEL 0x48
33 #define CRB_REG_START 0x4C
34 #define CRB_REG_INT_CTRL 0x50
35 #define CRB_REG_CMD_SIZE 0x58
36 #define CRB_REG_CMD_ADDR 0x5C
37 #define CRB_REG_RESP_SIZE 0x64
38 #define CRB_REG_RESP_ADDR 0x68
39 #define CRB_REG_DATA_BUFF 0x80
41 /* CRB INTF BIT MASK */
42 #define CRB_INTF_REG_CAP_CRB (1<<14)
43 #define CRB_INTF_REG_INTF_SEL (1<<17)
44 #define CRB_INTF_REG_INTF_LOCK (1<<19)
46 /*REQUEST Register related */
47 #define CRB_REG_REQUEST_CMD_RDY 0x01
48 #define CRB_REG_REQUEST_GO_IDLE 0x02
50 /* STATUS Register related */
51 #define CRB_REG_STATUS_ERROR 0x01
52 #define CRB_REG_STATUS_IDLE 0x02
54 /* START Register related */
55 #define CRB_REG_START_START 0x01
57 /* CRB TPM Info Struct */
58 struct crb_tpm_info {
59 uint16_t vendor_id;
60 uint16_t device_id;
61 uint16_t revision;
64 tpm_result_t crb_tpm_init(void);
65 void crb_tpm_get_info(struct crb_tpm_info *crb_tpm_info);
66 size_t crb_tpm_process_command(const void *tpm2_command, size_t command_size,
67 void *tpm2_response, size_t max_response);
68 bool crb_tpm_is_active(void);
70 tis_sendrecv_fn crb_tis_probe(enum tpm_family *family);