/* * This function is called when the machine starts, resets or due to * S3 resume. */ static void tpm_tis_reset(DeviceState *dev) { TPMState *s = TPM(dev); TPMTISEmuState *tis = &s->s.tis; int c; tpm_backend_reset(s->be_driver); tis->active_locty = TPM_TIS_NO_LOCALITY; tis->next_locty = TPM_TIS_NO_LOCALITY; tis->aborting_locty = TPM_TIS_NO_LOCALITY; for (c = 0; c < TPM_TIS_NUM_LOCALITIES; c++) { tis->loc[c].access = TPM_TIS_ACCESS_TPM_REG_VALID_STS; tis->loc[c].sts = 0; tis->loc[c].inte = TPM_TIS_INT_POLARITY_LOW_LEVEL; tis->loc[c].ints = 0; tis->loc[c].state = TPM_TIS_STATE_IDLE; tis->loc[c].w_offset = 0; tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].w_buffer); tis->loc[c].r_offset = 0; tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].r_buffer); } tpm_tis_do_startup_tpm(s); }
static void release_tpm(Object *obj, const char *name, void *opaque) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; TPMBackend **be = qdev_get_prop_ptr(dev, prop); if (*be) { tpm_backend_reset(*be); } }