diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-10-10 00:55:55 +0200 |
---|---|---|
committer | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2017-10-19 11:42:28 -0400 |
commit | 0e43b7e61ce677e154584523943c1651779baccf (patch) | |
tree | eeabafb7cfd3f4329350731663ad9ffca20b0c55 /hw/tpm/tpm_tis.c | |
parent | d1fd6b563d44a1132f8a5758f8f7bafba548502c (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_tis.c')
-rw-r--r-- | hw/tpm/tpm_tis.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 345a4fbee5..ffed7bfaf9 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -215,7 +215,15 @@ static void tpm_tis_tpm_send(TPMState *s, uint8_t locty) */ tis->loc[locty].state = TPM_TIS_STATE_EXECUTION; - tpm_backend_deliver_request(s->be_driver); + s->cmd = (TPMBackendCmd) { + .locty = locty, + .in = s->locty_data->w_buffer.buffer, + .in_len = s->locty_data->w_offset, + .out = s->locty_data->r_buffer.buffer, + .out_len = s->locty_data->r_buffer.size + }; + + tpm_backend_deliver_request(s->be_driver, &s->cmd); } /* raise an interrupt if allowed */ @@ -352,7 +360,7 @@ static void tpm_tis_receive_bh(void *opaque) { TPMState *s = opaque; TPMTISEmuState *tis = &s->s.tis; - uint8_t locty = s->locty_number; + uint8_t locty = s->cmd.locty; tpm_tis_sts_set(&tis->loc[locty], TPM_TIS_STS_VALID | TPM_TIS_STS_DATA_AVAILABLE); @@ -371,11 +379,11 @@ static void tpm_tis_receive_bh(void *opaque) /* * Callback from the TPM to indicate that the response was received. */ -static void tpm_tis_receive_cb(TPMState *s, - bool is_selftest_done) +static void tpm_tis_receive_cb(TPMState *s) { TPMTISEmuState *tis = &s->s.tis; - uint8_t locty = s->locty_number; + bool is_selftest_done = s->cmd.selftest_done; + uint8_t locty = s->cmd.locty; uint8_t l; if (is_selftest_done) { |