1*f0a902f7SPeter Crosthwaite /* 2*f0a902f7SPeter Crosthwaite * Xilinx Zynq MPSoC emulation 3*f0a902f7SPeter Crosthwaite * 4*f0a902f7SPeter Crosthwaite * Copyright (C) 2015 Xilinx Inc 5*f0a902f7SPeter Crosthwaite * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com> 6*f0a902f7SPeter Crosthwaite * 7*f0a902f7SPeter Crosthwaite * This program is free software; you can redistribute it and/or modify it 8*f0a902f7SPeter Crosthwaite * under the terms of the GNU General Public License as published by the 9*f0a902f7SPeter Crosthwaite * Free Software Foundation; either version 2 of the License, or 10*f0a902f7SPeter Crosthwaite * (at your option) any later version. 11*f0a902f7SPeter Crosthwaite * 12*f0a902f7SPeter Crosthwaite * This program is distributed in the hope that it will be useful, but WITHOUT 13*f0a902f7SPeter Crosthwaite * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14*f0a902f7SPeter Crosthwaite * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15*f0a902f7SPeter Crosthwaite * for more details. 16*f0a902f7SPeter Crosthwaite */ 17*f0a902f7SPeter Crosthwaite 18*f0a902f7SPeter Crosthwaite #include "hw/arm/xlnx-zynqmp.h" 19*f0a902f7SPeter Crosthwaite 20*f0a902f7SPeter Crosthwaite static void xlnx_zynqmp_init(Object *obj) 21*f0a902f7SPeter Crosthwaite { 22*f0a902f7SPeter Crosthwaite XlnxZynqMPState *s = XLNX_ZYNQMP(obj); 23*f0a902f7SPeter Crosthwaite int i; 24*f0a902f7SPeter Crosthwaite 25*f0a902f7SPeter Crosthwaite for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) { 26*f0a902f7SPeter Crosthwaite object_initialize(&s->cpu[i], sizeof(s->cpu[i]), 27*f0a902f7SPeter Crosthwaite "cortex-a53-" TYPE_ARM_CPU); 28*f0a902f7SPeter Crosthwaite object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpu[i]), 29*f0a902f7SPeter Crosthwaite &error_abort); 30*f0a902f7SPeter Crosthwaite } 31*f0a902f7SPeter Crosthwaite } 32*f0a902f7SPeter Crosthwaite 33*f0a902f7SPeter Crosthwaite static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) 34*f0a902f7SPeter Crosthwaite { 35*f0a902f7SPeter Crosthwaite XlnxZynqMPState *s = XLNX_ZYNQMP(dev); 36*f0a902f7SPeter Crosthwaite uint8_t i; 37*f0a902f7SPeter Crosthwaite Error *err = NULL; 38*f0a902f7SPeter Crosthwaite 39*f0a902f7SPeter Crosthwaite for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) { 40*f0a902f7SPeter Crosthwaite object_property_set_int(OBJECT(&s->cpu[i]), QEMU_PSCI_CONDUIT_SMC, 41*f0a902f7SPeter Crosthwaite "psci-conduit", &error_abort); 42*f0a902f7SPeter Crosthwaite if (i > 0) { 43*f0a902f7SPeter Crosthwaite /* Secondary CPUs start in PSCI powered-down state */ 44*f0a902f7SPeter Crosthwaite object_property_set_bool(OBJECT(&s->cpu[i]), true, 45*f0a902f7SPeter Crosthwaite "start-powered-off", &error_abort); 46*f0a902f7SPeter Crosthwaite } 47*f0a902f7SPeter Crosthwaite 48*f0a902f7SPeter Crosthwaite object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &err); 49*f0a902f7SPeter Crosthwaite if (err) { 50*f0a902f7SPeter Crosthwaite error_propagate((errp), (err)); 51*f0a902f7SPeter Crosthwaite return; 52*f0a902f7SPeter Crosthwaite } 53*f0a902f7SPeter Crosthwaite } 54*f0a902f7SPeter Crosthwaite } 55*f0a902f7SPeter Crosthwaite 56*f0a902f7SPeter Crosthwaite static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data) 57*f0a902f7SPeter Crosthwaite { 58*f0a902f7SPeter Crosthwaite DeviceClass *dc = DEVICE_CLASS(oc); 59*f0a902f7SPeter Crosthwaite 60*f0a902f7SPeter Crosthwaite dc->realize = xlnx_zynqmp_realize; 61*f0a902f7SPeter Crosthwaite } 62*f0a902f7SPeter Crosthwaite 63*f0a902f7SPeter Crosthwaite static const TypeInfo xlnx_zynqmp_type_info = { 64*f0a902f7SPeter Crosthwaite .name = TYPE_XLNX_ZYNQMP, 65*f0a902f7SPeter Crosthwaite .parent = TYPE_DEVICE, 66*f0a902f7SPeter Crosthwaite .instance_size = sizeof(XlnxZynqMPState), 67*f0a902f7SPeter Crosthwaite .instance_init = xlnx_zynqmp_init, 68*f0a902f7SPeter Crosthwaite .class_init = xlnx_zynqmp_class_init, 69*f0a902f7SPeter Crosthwaite }; 70*f0a902f7SPeter Crosthwaite 71*f0a902f7SPeter Crosthwaite static void xlnx_zynqmp_register_types(void) 72*f0a902f7SPeter Crosthwaite { 73*f0a902f7SPeter Crosthwaite type_register_static(&xlnx_zynqmp_type_info); 74*f0a902f7SPeter Crosthwaite } 75*f0a902f7SPeter Crosthwaite 76*f0a902f7SPeter Crosthwaite type_init(xlnx_zynqmp_register_types) 77