diff options
author | Leon Alrae <leon.alrae@imgtec.com> | 2016-03-15 09:59:31 +0000 |
---|---|---|
committer | Leon Alrae <leon.alrae@imgtec.com> | 2016-03-30 09:13:59 +0100 |
commit | 2edd5261fffcc8494936d353ffffe996d191da3b (patch) | |
tree | 7ebf59fda5c336be17eb6b056b99235d57520c94 /hw/mips | |
parent | 1f93a6e4f3f4da3c2ce4be1d300dcfe3e6dd0e77 (diff) | |
download | qemu-2edd5261fffcc8494936d353ffffe996d191da3b.tar.gz qemu-2edd5261fffcc8494936d353ffffe996d191da3b.tar.bz2 qemu-2edd5261fffcc8494936d353ffffe996d191da3b.zip |
hw/mips/cps: create CPC block inside CPS
Create Cluster Power Controller and add a link to the CPC MemoryRegion
in GCR. Guest can enable / map CPC to any physical address by writing to
the memory-mapped GCR_CPC_BASE register.
Set vp-start-reset property to 1 to allow only first VP to run from reset.
Others are brought up by the guest via CPC memory-mapped registers.
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Diffstat (limited to 'hw/mips')
-rw-r--r-- | hw/mips/cps.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/mips/cps.c b/hw/mips/cps.c index e77b1da507..d46547cd78 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -82,6 +82,21 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) cpu = MIPS_CPU(first_cpu); env = &cpu->env; + /* Cluster Power Controller */ + object_initialize(&s->cpc, sizeof(s->cpc), TYPE_MIPS_CPC); + qdev_set_parent_bus(DEVICE(&s->cpc), sysbus_get_default()); + + object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err); + object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running", &err); + object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err); + if (err != NULL) { + error_propagate(errp, err); + return; + } + + memory_region_add_subregion(&s->container, 0, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->cpc), 0)); + /* Global Configuration Registers */ gcr_base = env->CP0_CMGCRBase << 4; @@ -91,6 +106,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) object_property_set_int(OBJECT(&s->gcr), s->num_vp, "num-vp", &err); object_property_set_int(OBJECT(&s->gcr), 0x800, "gcr-rev", &err); object_property_set_int(OBJECT(&s->gcr), gcr_base, "gcr-base", &err); + object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->cpc.mr), "cpc", &err); object_property_set_bool(OBJECT(&s->gcr), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); |