aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-10 00:55:52 +0200
committerStefan Berger <stefanb@linux.vnet.ibm.com>2017-10-19 11:42:25 -0400
commit905e78ba25c613a9daa7adb4e8fb3aec0fa4a2c9 (patch)
tree6f4865ee0ae0f951c461269c4c4388e2e01ee449 /hw/tpm
parent76ae76bfea67ca972d1158dfdea07e27e4c0852e (diff)
tpm: remove unused TPMBackendCmd
There is only handling of request so far in both backends. 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')
-rw-r--r--hw/tpm/tpm_emulator.c42
-rw-r--r--hw/tpm/tpm_passthrough.c29
2 files changed, 26 insertions, 45 deletions
diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
index 03ea5845db..a6763e8ea2 100644
--- a/hw/tpm/tpm_emulator.c
+++ b/hw/tpm/tpm_emulator.c
@@ -172,39 +172,29 @@ static int tpm_emulator_set_locality(TPMEmulator *tpm_emu, uint8_t locty_number)
return 0;
}
-static void tpm_emulator_handle_request(TPMBackend *tb, TPMBackendCmd cmd)
+static void tpm_emulator_handle_request(TPMBackend *tb)
{
TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
TPMLocality *locty = NULL;
bool selftest_done = false;
Error *err = NULL;
- DPRINTF("processing command type %d", cmd);
-
- switch (cmd) {
- case TPM_BACKEND_CMD_PROCESS_CMD:
- locty = tb->tpm_state->locty_data;
- if (tpm_emulator_set_locality(tpm_emu,
- tb->tpm_state->locty_number) < 0 ||
- tpm_emulator_unix_tx_bufs(tpm_emu, locty->w_buffer.buffer,
- locty->w_offset, locty->r_buffer.buffer,
- locty->r_buffer.size, &selftest_done,
- &err) < 0) {
- tpm_util_write_fatal_error_response(locty->r_buffer.buffer,
- locty->r_buffer.size);
- error_report_err(err);
- }
-
- tb->recv_data_callback(tb->tpm_state, tb->tpm_state->locty_number,
- selftest_done);
-
- break;
- case TPM_BACKEND_CMD_INIT:
- case TPM_BACKEND_CMD_END:
- case TPM_BACKEND_CMD_TPM_RESET:
- /* nothing to do */
- break;
+ DPRINTF("processing TPM command");
+
+ locty = tb->tpm_state->locty_data;
+ if (tpm_emulator_set_locality(tpm_emu,
+ tb->tpm_state->locty_number) < 0 ||
+ tpm_emulator_unix_tx_bufs(tpm_emu, locty->w_buffer.buffer,
+ locty->w_offset, locty->r_buffer.buffer,
+ locty->r_buffer.size, &selftest_done,
+ &err) < 0) {
+ tpm_util_write_fatal_error_response(locty->r_buffer.buffer,
+ locty->r_buffer.size);
+ error_report_err(err);
}
+
+ tb->recv_data_callback(tb->tpm_state, tb->tpm_state->locty_number,
+ selftest_done);
}
static int tpm_emulator_probe_caps(TPMEmulator *tpm_emu)
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index d9da99bc8e..5cd988e8a4 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -149,29 +149,20 @@ static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt,
selftest_done);
}
-static void tpm_passthrough_handle_request(TPMBackend *tb, TPMBackendCmd cmd)
+static void tpm_passthrough_handle_request(TPMBackend *tb)
{
TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
bool selftest_done = false;
- DPRINTF("tpm_passthrough: processing command type %d\n", cmd);
-
- switch (cmd) {
- case TPM_BACKEND_CMD_PROCESS_CMD:
- tpm_passthrough_unix_transfer(tpm_pt,
- tb->tpm_state->locty_data,
- &selftest_done);
-
- tb->recv_data_callback(tb->tpm_state,
- tb->tpm_state->locty_number,
- selftest_done);
- break;
- case TPM_BACKEND_CMD_INIT:
- case TPM_BACKEND_CMD_END:
- case TPM_BACKEND_CMD_TPM_RESET:
- /* nothing to do */
- break;
- }
+ DPRINTF("tpm_passthrough: processing command\n");
+
+ tpm_passthrough_unix_transfer(tpm_pt,
+ tb->tpm_state->locty_data,
+ &selftest_done);
+
+ tb->recv_data_callback(tb->tpm_state,
+ tb->tpm_state->locty_number,
+ selftest_done);
}
static void tpm_passthrough_reset(TPMBackend *tb)