@@ -29,6 +29,8 @@ struct TPMState {
char *backend;
TPMBackend *be_driver;
+
+ BlockDriverState *bdrv;
};
#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
@@ -27,6 +27,7 @@
#include "hw/i386/pc.h"
#include "hw/pci/pci_ids.h"
#include "tpm_tis.h"
+#include "tpm_nvram.h"
#include "qemu-common.h"
/*#define DEBUG_TIS */
@@ -849,6 +850,7 @@ static Property tpm_tis_properties[] = {
DEFINE_PROP_UINT32("irq", TPMState,
s.tis.irq_num, TPM_TIS_IRQ),
DEFINE_PROP_STRING("tpmdev", TPMState, backend),
+ DEFINE_PROP_DRIVE("drive", TPMState, bdrv),
DEFINE_PROP_END_OF_LIST(),
};
@@ -864,6 +866,12 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
return;
}
+ if (s->bdrv && tpm_nvram_init(s->bdrv)) {
+ error_setg(errp, "tpm_tis: backend drive with id %s could not "
+ "initialize TPM NVRAM drive", s->backend);
+ return;
+ }
+
s->be_driver->fe_model = TPM_MODEL_TPM_TIS;
if (tpm_backend_init(s->be_driver, s, tpm_tis_receive_cb)) {
Add a drive property to the tpm-tis device and initialize the TPM NVRAM if a drive is specified. Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com> --- v2 -No changes v3 -No changes --- hw/tpm/tpm_int.h | 2 ++ hw/tpm/tpm_tis.c | 8 ++++++++ 2 files changed, 10 insertions(+), 0 deletions(-)