aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm/tpm_passthrough.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-10 00:55:55 +0200
committerStefan Berger <stefanb@linux.vnet.ibm.com>2017-10-19 11:42:28 -0400
commit0e43b7e61ce677e154584523943c1651779baccf (patch)
treeeeabafb7cfd3f4329350731663ad9ffca20b0c55 /hw/tpm/tpm_passthrough.c
parentd1fd6b563d44a1132f8a5758f8f7bafba548502c (diff)
tpm: add TPMBackendCmd to hold the request state
This simplifies a bit locality handling, and argument passing, and could pave the way to queuing requests (if that makes sense). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'hw/tpm/tpm_passthrough.c')
-rw-r--r--hw/tpm/tpm_passthrough.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index 0ae4596932..93d72b8e9e 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -137,30 +137,16 @@ err_exit:
return ret;
}
-static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt,
- const TPMLocality *locty_data,
- bool *selftest_done)
-{
- return tpm_passthrough_unix_tx_bufs(tpm_pt,
- locty_data->w_buffer.buffer,
- locty_data->w_offset,
- locty_data->r_buffer.buffer,
- locty_data->r_buffer.size,
- selftest_done);
-}
-
-static void tpm_passthrough_handle_request(TPMBackend *tb)
+static void tpm_passthrough_handle_request(TPMBackend *tb, TPMBackendCmd *cmd)
{
TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
- bool selftest_done = false;
- DPRINTF("tpm_passthrough: processing command\n");
+ DPRINTF("tpm_passthrough: processing command %p\n", cmd);
- tpm_passthrough_unix_transfer(tpm_pt,
- tb->tpm_state->locty_data,
- &selftest_done);
+ tpm_passthrough_unix_tx_bufs(tpm_pt, cmd->in, cmd->in_len,
+ cmd->out, cmd->out_len, &cmd->selftest_done);
- tb->recv_data_callback(tb->tpm_state, selftest_done);
+ tb->recv_data_callback(tb->tpm_state);
}
static void tpm_passthrough_reset(TPMBackend *tb)