From 698f5daa4a81984490612a6143b46f5da7392510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 10 Oct 2017 00:56:01 +0200 Subject: tpm: add a QOM TPM interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will simplify backend / interface objects relationship, so the frontend interface will simply have to implement the TPM QOM interface. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Signed-off-by: Stefan Berger --- hw/tpm/tpm_int.h | 17 +++++++++++++++++ hw/tpm/tpm_tis.c | 4 ++++ 2 files changed, 21 insertions(+) (limited to 'hw/tpm') diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h index e231d0eb4f..eb02e7760c 100644 --- a/hw/tpm/tpm_int.h +++ b/hw/tpm/tpm_int.h @@ -13,6 +13,23 @@ #define TPM_TPM_INT_H #include "qemu/osdep.h" +#include "qom/object.h" + +#define TYPE_TPM_IF "tpm-if" +#define TPM_IF_CLASS(klass) \ + OBJECT_CLASS_CHECK(TPMIfClass, (klass), TYPE_TPM_IF) +#define TPM_IF_GET_CLASS(obj) \ + OBJECT_GET_CLASS(TPMIfClass, (obj), TYPE_TPM_IF) +#define TPM_IF(obj) \ + INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF) + +typedef struct TPMIf { + Object parent_obj; +} TPMIf; + +typedef struct TPMIfClass { + InterfaceClass parent_class; +} TPMIfClass; #define TPM_STANDARD_CMDLINE_OPTS \ { \ diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index d84eec48b4..dbb50043ac 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -1123,6 +1123,10 @@ static const TypeInfo tpm_tis_info = { .instance_size = sizeof(TPMState), .instance_init = tpm_tis_initfn, .class_init = tpm_tis_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_TPM_IF }, + { } + } }; static void tpm_tis_register(void) -- cgit v1.2.1