tpm: Allow reporting the internal state

It is useful to read information about the current TPM state, where
supported, e.g. for debugging purposes when verified boot fails.

Add support for this to the TPM interface as well as Cr50. Add a simple
sandbox test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Simon Glass 2022-08-30 21:05:36 -06:00 committed by Ilias Apalodimas
parent 6694c997b2
commit 3bb4db4c38
8 changed files with 101 additions and 0 deletions

View file

@ -119,6 +119,16 @@ struct tpm_ops {
*/
int (*get_desc)(struct udevice *dev, char *buf, int size);
/**
* report_state() - Collect information about the current TPM state
*
* @dev: Device to check
* @buf: Buffer to put the string
* @size: Maximum size of buffer
* Return: return code of the operation (0 = success)
*/
int (*report_state)(struct udevice *dev, char *buf, int size);
/**
* send() - send data to the TPM
*
@ -234,6 +244,16 @@ u32 tpm_clear_and_reenable(struct udevice *dev);
*/
int tpm_get_desc(struct udevice *dev, char *buf, int size);
/**
* tpm_report_state() - Collect information about the current TPM state
*
* @dev: Device to check
* @buf: Buffer to put the string
* @size: Maximum size of buffer
* Return: return code of the operation (0 = success)
*/
int tpm_report_state(struct udevice *dev, char *buf, int size);
/**
* tpm_xfer() - send data to the TPM and get response
*