aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm/tpm_tis.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@us.ibm.com>2015-03-10 06:34:01 -0400
committerMichael S. Tsirkin <mst@redhat.com>2015-03-11 18:24:13 +0100
commit9dfd24ed848228643293e37c36848b5ac520ab98 (patch)
tree7461a3bfa790eae8fb1ca755d8c4d40845413ed9 /hw/tpm/tpm_tis.c
parentfc079951b7a5eb799bd24d18e4098aa03a3c79dd (diff)
downloadqemu-9dfd24ed848228643293e37c36848b5ac520ab98.zip
qemu-9dfd24ed848228643293e37c36848b5ac520ab98.tar.gz
qemu-9dfd24ed848228643293e37c36848b5ac520ab98.tar.bz2
tpm: Move memory subregion function into realize function
Move the memory subregion function into the DeviceClass realize function due to isa_address_space (now) crashing if called in the instance init function. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/tpm/tpm_tis.c')
-rw-r--r--hw/tpm/tpm_tis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index d0bb97f..9084ca4 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -959,18 +959,18 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
tis->bh = qemu_bh_new(tpm_tis_receive_bh, s);
isa_init_irq(&s->busdev, &tis->irq, tis->irq_num);
+
+ memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
+ TPM_TIS_ADDR_BASE, &s->mmio);
}
static void tpm_tis_initfn(Object *obj)
{
- ISADevice *dev = ISA_DEVICE(obj);
TPMState *s = TPM(obj);
memory_region_init_io(&s->mmio, OBJECT(s), &tpm_tis_memory_ops,
s, "tpm-tis-mmio",
TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
- memory_region_add_subregion(isa_address_space(dev), TPM_TIS_ADDR_BASE,
- &s->mmio);
}
static void tpm_tis_class_init(ObjectClass *klass, void *data)