1f0a902f7SPeter Crosthwaite /* 2f0a902f7SPeter Crosthwaite * Xilinx Zynq MPSoC emulation 3f0a902f7SPeter Crosthwaite * 4f0a902f7SPeter Crosthwaite * Copyright (C) 2015 Xilinx Inc 5f0a902f7SPeter Crosthwaite * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com> 6f0a902f7SPeter Crosthwaite * 7f0a902f7SPeter Crosthwaite * This program is free software; you can redistribute it and/or modify it 8f0a902f7SPeter Crosthwaite * under the terms of the GNU General Public License as published by the 9f0a902f7SPeter Crosthwaite * Free Software Foundation; either version 2 of the License, or 10f0a902f7SPeter Crosthwaite * (at your option) any later version. 11f0a902f7SPeter Crosthwaite * 12f0a902f7SPeter Crosthwaite * This program is distributed in the hope that it will be useful, but WITHOUT 13f0a902f7SPeter Crosthwaite * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14f0a902f7SPeter Crosthwaite * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15f0a902f7SPeter Crosthwaite * for more details. 16f0a902f7SPeter Crosthwaite */ 17f0a902f7SPeter Crosthwaite 18f0a902f7SPeter Crosthwaite #ifndef XLNX_ZYNQMP_H 190553d895SMarkus Armbruster #define XLNX_ZYNQMP_H 20f0a902f7SPeter Crosthwaite 2112ec8bd5SPeter Maydell #include "hw/arm/boot.h" 227729e1f4SPeter Crosthwaite #include "hw/intc/arm_gic.h" 2314ca2e46SPeter Crosthwaite #include "hw/net/cadence_gem.h" 243bade2a9SPeter Crosthwaite #include "hw/char/cadence_uart.h" 25*840c22cdSVikram Garhwal #include "hw/net/xlnx-zynqmp-can.h" 266fdf3282SAlistair Francis #include "hw/ide/ahci.h" 2733108e9fSSai Pavan Boddu #include "hw/sd/sdhci.h" 2802d07eb4SAlistair Francis #include "hw/ssi/xilinx_spips.h" 29b93dbcddSKONRAD Frederic #include "hw/dma/xlnx_dpdma.h" 3004965bcaSFrancisco Iglesias #include "hw/dma/xlnx-zdma.h" 31b93dbcddSKONRAD Frederic #include "hw/display/xlnx_dp.h" 320ab7bbc7SAlistair Francis #include "hw/intc/xlnx-zynqmp-ipi.h" 338035f85eSPhilippe Mathieu-Daudé #include "hw/rtc/xlnx-zynqmp-rtc.h" 34816fd397SLuc Michel #include "hw/cpu/cluster.h" 35ec150c7eSMarkus Armbruster #include "target/arm/cpu.h" 36db1015e9SEduardo Habkost #include "qom/object.h" 37*840c22cdSVikram Garhwal #include "net/can_emu.h" 38f0a902f7SPeter Crosthwaite 39f0a902f7SPeter Crosthwaite #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp" 408063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) 41f0a902f7SPeter Crosthwaite 422e5577bcSPeter Crosthwaite #define XLNX_ZYNQMP_NUM_APU_CPUS 4 43b58850e7SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_RPU_CPUS 2 4414ca2e46SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_GEMS 4 453bade2a9SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_UARTS 2 46*840c22cdSVikram Garhwal #define XLNX_ZYNQMP_NUM_CAN 2 47*840c22cdSVikram Garhwal #define XLNX_ZYNQMP_CAN_REF_CLK (24 * 1000 * 1000) 4833108e9fSSai Pavan Boddu #define XLNX_ZYNQMP_NUM_SDHCI 2 4902d07eb4SAlistair Francis #define XLNX_ZYNQMP_NUM_SPIS 2 5004965bcaSFrancisco Iglesias #define XLNX_ZYNQMP_NUM_GDMA_CH 8 5104965bcaSFrancisco Iglesias #define XLNX_ZYNQMP_NUM_ADMA_CH 8 52f0a902f7SPeter Crosthwaite 53babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_BUS 2 54babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2 55babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_FLASH 4 56babc1f30SFrancisco Iglesias 576675d719SAlistair Francis #define XLNX_ZYNQMP_NUM_OCM_BANKS 4 586675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_0_ADDRESS 0xFFFC0000 596675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_SIZE 0x10000 606675d719SAlistair Francis 6175b749afSLuc Michel #define XLNX_ZYNQMP_GIC_REGIONS 6 627729e1f4SPeter Crosthwaite 637729e1f4SPeter Crosthwaite /* ZynqMP maps the ARM GIC regions (GICC, GICD ...) at consecutive 64k offsets 647729e1f4SPeter Crosthwaite * and under-decodes the 64k region. This mirrors the 4k regions to every 4k 657729e1f4SPeter Crosthwaite * aligned address in the 64k region. To implement each GIC region needs a 667729e1f4SPeter Crosthwaite * number of memory region aliases. 677729e1f4SPeter Crosthwaite */ 687729e1f4SPeter Crosthwaite 6952c16b45SNathan Rossi #define XLNX_ZYNQMP_GIC_REGION_SIZE 0x1000 7075b749afSLuc Michel #define XLNX_ZYNQMP_GIC_ALIASES (0x10000 / XLNX_ZYNQMP_GIC_REGION_SIZE) 717729e1f4SPeter Crosthwaite 72dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_LOW_RAM_SIZE 0x80000000ull 73dc3b89efSAlistair Francis 74dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE 0x800000000ull 75dc3b89efSAlistair Francis #define XLNX_ZYNQMP_HIGH_RAM_START 0x800000000ull 76dc3b89efSAlistair Francis 77dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ 78dc3b89efSAlistair Francis XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) 79dc3b89efSAlistair Francis 80db1015e9SEduardo Habkost struct XlnxZynqMPState { 81f0a902f7SPeter Crosthwaite /*< private >*/ 82f0a902f7SPeter Crosthwaite DeviceState parent_obj; 83f0a902f7SPeter Crosthwaite 84f0a902f7SPeter Crosthwaite /*< public >*/ 85816fd397SLuc Michel CPUClusterState apu_cluster; 86816fd397SLuc Michel CPUClusterState rpu_cluster; 872e5577bcSPeter Crosthwaite ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS]; 88b58850e7SPeter Crosthwaite ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS]; 897729e1f4SPeter Crosthwaite GICState gic; 907729e1f4SPeter Crosthwaite MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES]; 91dc3b89efSAlistair Francis 926675d719SAlistair Francis MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS]; 936675d719SAlistair Francis 94dc3b89efSAlistair Francis MemoryRegion *ddr_ram; 95dc3b89efSAlistair Francis MemoryRegion ddr_ram_low, ddr_ram_high; 96dc3b89efSAlistair Francis 9714ca2e46SPeter Crosthwaite CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; 983bade2a9SPeter Crosthwaite CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS]; 99*840c22cdSVikram Garhwal XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN]; 1006fdf3282SAlistair Francis SysbusAHCIState sata; 10133108e9fSSai Pavan Boddu SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI]; 10202d07eb4SAlistair Francis XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS]; 103babc1f30SFrancisco Iglesias XlnxZynqMPQSPIPS qspi; 104b93dbcddSKONRAD Frederic XlnxDPState dp; 105b93dbcddSKONRAD Frederic XlnxDPDMAState dpdma; 1060ab7bbc7SAlistair Francis XlnxZynqMPIPI ipi; 10708b2f15eSAlistair Francis XlnxZynqMPRTC rtc; 10804965bcaSFrancisco Iglesias XlnxZDMA gdma[XLNX_ZYNQMP_NUM_GDMA_CH]; 10904965bcaSFrancisco Iglesias XlnxZDMA adma[XLNX_ZYNQMP_NUM_ADMA_CH]; 1106396a193SPeter Crosthwaite 1116396a193SPeter Crosthwaite char *boot_cpu; 1126396a193SPeter Crosthwaite ARMCPU *boot_cpu_ptr; 11337d42473SEdgar E. Iglesias 11437d42473SEdgar E. Iglesias /* Has the ARM Security extensions? */ 11537d42473SEdgar E. Iglesias bool secure; 1161946809eSAlistair Francis /* Has the ARM Virtualization extensions? */ 1171946809eSAlistair Francis bool virt; 1186ed92b14SEdgar E. Iglesias /* Has the RPU subsystem? */ 1196ed92b14SEdgar E. Iglesias bool has_rpu; 120*840c22cdSVikram Garhwal 121*840c22cdSVikram Garhwal /* CAN bus. */ 122*840c22cdSVikram Garhwal CanBusState *canbus[XLNX_ZYNQMP_NUM_CAN]; 123db1015e9SEduardo Habkost }; 124f0a902f7SPeter Crosthwaite 125f0a902f7SPeter Crosthwaite #endif 126