summary refs log tree commit diff stats
path: root/tpm/tpm.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2013-03-28 07:26:21 -0400
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-02 08:15:18 -0500
commit8f0605cc9caacbcc647a6df9ae541ed2da4b9bb0 (patch)
tree384017221d7b4dbf02fc246e314e0a89dcc32ca0 /tpm/tpm.c
parent684a096eafbe37ab6c9a1fdb5e0185f04098b166 (diff)
downloadfocaccia-qemu-8f0605cc9caacbcc647a6df9ae541ed2da4b9bb0.tar.gz
focaccia-qemu-8f0605cc9caacbcc647a6df9ae541ed2da4b9bb0.zip
QOM-ify the TPM support
QOM-ified the TPM support with much code borrowed from the rng implementation.

All other TPM related code moves will be provided in a subsequent patch.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Message-id: 1364469981.24703.1.camel@d941e-10
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'tpm/tpm.c')
-rw-r--r--tpm/tpm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tpm/tpm.c b/tpm/tpm.c
index ae00eae618..1f4ac8da00 100644
--- a/tpm/tpm.c
+++ b/tpm/tpm.c
@@ -15,6 +15,7 @@
 
 #include "monitor/monitor.h"
 #include "qapi/qmp/qerror.h"
+#include "backends/tpm.h"
 #include "tpm_int.h"
 #include "tpm/tpm.h"
 #include "qemu/config-file.h"
@@ -145,6 +146,7 @@ static int configure_tpm(QemuOpts *opts)
     const char *id;
     const TPMDriverOps *be;
     TPMBackend *drv;
+    Error *local_err = NULL;
 
     if (!QLIST_EMPTY(&tpm_backends)) {
         error_report("Only one TPM is allowed.\n");
@@ -177,6 +179,13 @@ static int configure_tpm(QemuOpts *opts)
         return 1;
     }
 
+    tpm_backend_open(drv, &local_err);
+    if (local_err) {
+        qerror_report_err(local_err);
+        error_free(local_err);
+        return 1;
+    }
+
     QLIST_INSERT_HEAD(&tpm_backends, drv, list);
 
     return 0;
@@ -197,7 +206,7 @@ void tpm_cleanup(void)
 
     QLIST_FOREACH_SAFE(drv, &tpm_backends, list, next) {
         QLIST_REMOVE(drv, list);
-        drv->ops->destroy(drv);
+        tpm_backend_destroy(drv);
     }
 }