summaryrefslogtreecommitdiff
path: root/hw/tpm/tpm_tis.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-10 00:56:02 +0200
committerStefan Berger <stefanb@linux.vnet.ibm.com>2017-10-19 11:42:33 -0400
commit05a699985c001927a50f8f276251f2af1e0c5b58 (patch)
tree6ceaf9311f014cf2be96a4194d98f593bc399184 /hw/tpm/tpm_tis.c
parent698f5daa4a81984490612a6143b46f5da7392510 (diff)
downloadqemu-05a699985c001927a50f8f276251f2af1e0c5b58.zip
tpm: move recv_data_callback to TPM interface
Simplify the TPM backend setup, move callback to TPM interface. 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.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index dbb50043ac..8c5cac5fa5 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -430,11 +430,10 @@ static void tpm_tis_receive_bh(void *opaque)
TPM_TIS_INT_DATA_AVAILABLE | TPM_TIS_INT_STS_VALID);
}
-/*
- * Callback from the TPM to indicate that the response was received.
- */
-static void tpm_tis_receive_cb(TPMState *s)
+static void tpm_tis_request_completed(TPMIf *ti)
{
+ TPMState *s = TPM(ti);
+
bool is_selftest_done = s->cmd.selftest_done;
uint8_t locty = s->cmd.locty;
uint8_t l;
@@ -1078,7 +1077,7 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
s->be_driver->fe_model = TPM_MODEL_TPM_TIS;
- if (tpm_backend_init(s->be_driver, s, tpm_tis_receive_cb)) {
+ if (tpm_backend_init(s->be_driver, s)) {
error_setg(errp, "tpm_tis: backend driver with id %s could not be "
"initialized", s->backend);
return;
@@ -1110,11 +1109,13 @@ static void tpm_tis_initfn(Object *obj)
static void tpm_tis_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ TPMIfClass *tc = TPM_IF_CLASS(klass);
dc->realize = tpm_tis_realizefn;
dc->props = tpm_tis_properties;
dc->reset = tpm_tis_reset;
dc->vmsd = &vmstate_tpm_tis;
+ tc->request_completed = tpm_tis_request_completed;
}
static const TypeInfo tpm_tis_info = {