summaryrefslogtreecommitdiff
path: root/include/tpm_registers.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/tpm_registers.h')
-rw-r--r--include/tpm_registers.h58
1 files changed, 55 insertions, 3 deletions
diff --git a/include/tpm_registers.h b/include/tpm_registers.h
index 3416492f03..b82a355170 100644
--- a/include/tpm_registers.h
+++ b/include/tpm_registers.h
@@ -23,13 +23,44 @@ void tpm_register_put(uint32_t regaddr,
/* The SPI master is reading data from a TPM register. */
void tpm_register_get(uint32_t regaddr, uint8_t *dest, uint32_t data_size);
-/* Enable SPS TPM driver. */
-void sps_tpm_enable(void);
-
/* Get the current value of the burst size field of the status register. */
size_t tpm_get_burst_size(void);
/*
+ * Register functions to start and stop TPM communications layer. The
+ * communications layer should be kept down while TPM is being reset.
+ */
+typedef void (*interface_control_func)(void);
+void tpm_register_interface(interface_control_func interface_start,
+ interface_control_func interface_stop);
+
+/*
+ * This requests the TPM task to reset itself.
+ *
+ * If wait_until_done is false, it returns EC_SUCCESS immediately. Otherwise it
+ * returns EC_SUCCESS after the reset has completed, or an error code on
+ * failure.
+ *
+ * If wipe_nvmem_first is true, the caller is expected to keep the rest of the
+ * system in reset until TPM wipeout is completed.
+ */
+int tpm_reset_request(int wait_until_done, int wipe_nvmem_first);
+
+/*
+ * Tell the TPM task to re-enable nvmem commits.
+ *
+ * NOTE: This function is NOT to be used freely, but only meant to be used in
+ * exceptional cases such as unlocking the console following a TPM wipe.
+ */
+void tpm_reinstate_nvmem_commits(void);
+
+/*
+ * To be called by functions running on the TPM task context. Returns
+ * EC_SUCCESS on successful reset.
+ */
+int tpm_sync_reset(int wipe_first);
+
+/*
* This structure describes the header of all commands and responses sent and
* received over TPM FIFO.
*
@@ -44,9 +75,30 @@ struct tpm_cmd_header {
} __packed;
/*
+ * This function allows to process a TPM command coming from elsewhere, not
+ * from the communications interface.
+ *
+ * A common use case would be making cryptographic calculation on task
+ * contexts where stack the size is not large enough, for instance console
+ * commands. This function will block to let the TPM task a chance to run to
+ * execute the command and return the result in the same buffer.
+ *
+ * @param tpmh pointer to a buffer containing a marshalled TPM command, if it
+ * arrived over the communications channel. One of the header
+ * fields defines the command size.
+ *
+ * @param buffer_size the size of the buffer pointed to by tpmh - tells the
+ * TPM task how much room there is to store the response.
+ *
+ * Command execution result is reported in the response body.
+ */
+void tpm_alt_extension(struct tpm_cmd_header *tpmh, size_t buffer_size);
+
+/*
* The only TPM2 command we care about on the driver level, see
* crosbug.com/p/55667 for detals.
*/
#define TPM2_PCR_Read 0x0000017e
+#define TPM2_Startup 0x00000144
#endif /* __CROS_EC_TPM_REGISTERS_H */