diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-18 23:17:59 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-08-01 18:05:24 +0300 |
commit | f9143c12003aabbad3a2485f8ad305f5dff5fae9 (patch) | |
tree | 022b47f8b13fe5bb488a3a853ed68850db5a038b /drivers/tpm/tpm_tis_sandbox.c | |
parent | 1db235a186c001a50e5f5db9b587bbaa4e397ee7 (diff) | |
download | u-boot-f9143c12003aabbad3a2485f8ad305f5dff5fae9.tar.xz |
sandbox: tpm: Support the define-space command
Add support for this command, moving away from the previous approach of
hard-coding the initial data in the driver, now that the kernel-space data
has to be set up by the higher-level vboot code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/tpm/tpm_tis_sandbox.c')
-rw-r--r-- | drivers/tpm/tpm_tis_sandbox.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c index f22ed846f0..85b22afa4d 100644 --- a/drivers/tpm/tpm_tis_sandbox.c +++ b/drivers/tpm/tpm_tis_sandbox.c @@ -210,6 +210,17 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, memset(recvbuf, '\0', *recv_len); break; case TPM_CMD_NV_DEFINE_SPACE: + index = get_unaligned_be32(sendbuf + 12); + length = get_unaligned_be32(sendbuf + 77); + seq = sb_tpm_index_to_seq(index); + if (seq < 0) + return -EINVAL; + printf("tpm: define_space index=%#02x, len=%#02x, seq=%#02x\n", + index, length, seq); + sb_tpm_define_data(tpm->nvdata, seq, length); + *recv_len = 12; + memset(recvbuf, '\0', *recv_len); + break; case 0x15: /* pcr read */ case 0x5d: /* force clear */ case 0x6f: /* physical enable */ |