Commit 3dfd5a2a authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Stefan Berger
Browse files

tpm: lookup the the TPM interface instead of TIS device



This will allow to introduce new devices implementing TPM.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
parent d36e7db1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
    }

    info->has_hpet = hpet_find();
    info->tpm_version = tpm_get_version();
    info->tpm_version = tpm_get_version(tpm_find());
    info->pvpanic_port = pvpanic_port();
    info->applesmc_io_base = applesmc_port();
}
+15 −10
Original line number Diff line number Diff line
@@ -44,20 +44,25 @@ typedef struct TPMIfClass {
    void (*request_completed)(TPMIf *obj);
} TPMIfClass;

TPMVersion tpm_tis_get_tpm_version(Object *obj);

#define TYPE_TPM_TIS                "tpm-tis"

static inline TPMVersion tpm_get_version(void)
/* returns NULL unless there is exactly one TPM device */
static inline TPMIf *tpm_find(void)
{
#ifdef CONFIG_TPM
    Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
    Object *obj = object_resolve_path_type("", TYPE_TPM_IF, NULL);

    if (obj) {
        return tpm_tis_get_tpm_version(obj);
    return TPM_IF(obj);
}
#endif

TPMVersion tpm_tis_get_tpm_version(Object *obj);

static inline TPMVersion tpm_get_version(TPMIf *ti)
{
    if (!ti) {
        return TPM_VERSION_UNSPEC;
    }

    return tpm_tis_get_tpm_version(OBJECT(ti));
}

#endif /* QEMU_TPM_H */