coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cr50.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef CR50_TSS_STRUCTURES_H_
3 #define CR50_TSS_STRUCTURES_H_
4 
5 #include <stdint.h>
6 
7 /* FIXME: below is not enough to differentiate between vendors commands
8  of numerous devices. However, the current tpm2 APIs aren't very amenable
9  to extending generically because the marshaling code is assuming all
10  knowledge of all commands. */
11 #define TPM2_CR50_VENDOR_COMMAND ((TPM_CC)(TPM_CC_VENDOR_BIT_MASK | 0))
12 #define TPM2_CR50_SUB_CMD_IMMEDIATE_RESET (19)
13 #define TPM2_CR50_SUB_CMD_NVMEM_ENABLE_COMMITS (21)
14 #define TPM2_CR50_SUB_CMD_TURN_UPDATE_ON (24)
15 #define TPM2_CR50_SUB_CMD_GET_REC_BTN (29)
16 #define TPM2_CR50_SUB_CMD_TPM_MODE (40)
17 #define TPM2_CR50_SUB_CMD_GET_BOOT_MODE (52)
18 #define TPM2_CR50_SUB_CMD_RESET_EC (53)
19 
20 /* Cr50 vendor-specific error codes. */
21 #define VENDOR_RC_ERR 0x00000500
26 };
27 
29  /*
30  * Default state: TPM is enabled, and may be set to either
31  * TPM_MODE_ENABLED or TPM_MODE_DISABLED.
32  */
34 
35  /* TPM is enabled, and mode may not be changed. */
37 
38  /* TPM is disabled, and mode may not be changed. */
40 
42 };
43 
44 /**
45  * CR50 specific tpm command to enable nvmem commits before internal timeout
46  * expires.
47  */
49 
50 /**
51  * CR50 specific tpm command to restore header(s) of the dormant RO/RW
52  * image(s) and in case there indeed was a dormant image, trigger reboot after
53  * the timeout milliseconds. Note that timeout of zero means "NO REBOOT", not
54  * "IMMEDIATE REBOOT".
55  *
56  * Return value indicates success or failure of accessing the TPM; in case of
57  * success the number of restored headers is saved in num_restored_headers.
58  */
60  uint8_t *num_restored_headers);
61 
62 /**
63  * CR50 specific tpm command to get the latched state of the recovery button.
64  *
65  * Return value indicates success or failure of accessing the TPM; in case of
66  * success the recovery button state is saved in recovery_button_state.
67  */
68 uint32_t tlcl_cr50_get_recovery_button(uint8_t *recovery_button_state);
69 
70 /**
71  * CR50 specific TPM command sequence to query the current TPM mode.
72  *
73  * Returns TPM_SUCCESS if TPM mode command completed, the Cr50 does not need a
74  * reboot, and the tpm_mode parameter is set to the current TPM mode.
75  * Returns TPM_E_MUST_REBOOT if TPM mode command completed, but the Cr50
76  * requires a reboot.
77  * Returns TPM_E_NO_SUCH_COMMAND if the Cr50 does not support the command.
78  * Other returns value indicate a failure accessing the TPM.
79  */
81 
82 /**
83  * CR50 specific TPM command sequence to query the current boot mode.
84  *
85  * Returns TPM_SUCCESS if boot mode is successfully retrieved.
86  * Returns TPM_E_* for errors.
87  */
89 
90 /**
91  * CR50 specific TPM command sequence to trigger an immediate reset to the Cr50
92  * device after the specified timeout in milliseconds. A timeout of zero means
93  * "IMMEDIATE REBOOT".
94  *
95  * Return value indicates success or failure of accessing the TPM.
96  */
98 
99 /**
100  * CR50 specific TPM command sequence to issue an EC reset.
101  *
102  * Returns TPM_E_* for errors.
103  * On Success, this function invokes halt() and does not return.
104  */
106 
107 #endif /* CR50_TSS_STRUCTURES_H_ */
uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode)
CR50 specific TPM command sequence to query the current TPM mode.
Definition: cr50.c:67
uint32_t tlcl_cr50_immediate_reset(uint16_t timeout_ms)
CR50 specific TPM command sequence to trigger an immediate reset to the Cr50 device after the specifi...
Definition: cr50.c:134
uint32_t tlcl_cr50_enable_update(uint16_t timeout_ms, uint8_t *num_restored_headers)
CR50 specific tpm command to restore header(s) of the dormant RO/RW image(s) and in case there indeed...
Definition: cr50.c:32
uint32_t tlcl_cr50_reset_ec(void)
CR50 specific TPM command sequence to issue an EC reset.
Definition: cr50.c:153
uint32_t tlcl_cr50_get_recovery_button(uint8_t *recovery_button_state)
CR50 specific tpm command to get the latched state of the recovery button.
Definition: cr50.c:51
uint32_t tlcl_cr50_enable_nvcommits(void)
CR50 specific tpm command to enable nvmem commits before internal timeout expires.
Definition: cr50.c:12
cr50_tpm_mode
Definition: cr50.h:28
@ TPM_MODE_ENABLED
Definition: cr50.h:36
@ TPM_MODE_DISABLED
Definition: cr50.h:39
@ TPM_MODE_INVALID
Definition: cr50.h:41
@ TPM_MODE_ENABLED_TENTATIVE
Definition: cr50.h:33
#define VENDOR_RC_ERR
Definition: cr50.h:21
uint32_t tlcl_cr50_get_boot_mode(uint8_t *boot_mode)
CR50 specific TPM command sequence to query the current boot mode.
Definition: cr50.c:108
cr50_vendor_rc
Definition: cr50.h:22
@ VENDOR_RC_INTERNAL_ERROR
Definition: cr50.h:23
@ VENDOR_RC_NO_SUCH_SUBCOMMAND
Definition: cr50.h:24
@ VENDOR_RC_NO_SUCH_COMMAND
Definition: cr50.h:25
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8