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 217729e1f4SPeter Crosthwaite #include "hw/intc/arm_gic.h" 2214ca2e46SPeter Crosthwaite #include "hw/net/cadence_gem.h" 233bade2a9SPeter Crosthwaite #include "hw/char/cadence_uart.h" 24840c22cdSVikram Garhwal #include "hw/net/xlnx-zynqmp-can.h" 25fbb5945eSPhilippe Mathieu-Daudé #include "hw/ide/ahci-sysbus.h" 2633108e9fSSai Pavan Boddu #include "hw/sd/sdhci.h" 2702d07eb4SAlistair Francis #include "hw/ssi/xilinx_spips.h" 28b93dbcddSKONRAD Frederic #include "hw/dma/xlnx_dpdma.h" 2904965bcaSFrancisco Iglesias #include "hw/dma/xlnx-zdma.h" 30b93dbcddSKONRAD Frederic #include "hw/display/xlnx_dp.h" 310ab7bbc7SAlistair Francis #include "hw/intc/xlnx-zynqmp-ipi.h" 328035f85eSPhilippe Mathieu-Daudé #include "hw/rtc/xlnx-zynqmp-rtc.h" 33816fd397SLuc Michel #include "hw/cpu/cluster.h" 34ec150c7eSMarkus Armbruster #include "target/arm/cpu.h" 35db1015e9SEduardo Habkost #include "qom/object.h" 36840c22cdSVikram Garhwal #include "net/can_emu.h" 37668351a5SXuzhou Cheng #include "hw/dma/xlnx_csu_dma.h" 387e47e15cSTong Ho #include "hw/nvram/xlnx-bbram.h" 39db1264dfSTong Ho #include "hw/nvram/xlnx-zynqmp-efuse.h" 40c74ccb5dSFrancisco Iglesias #include "hw/or-irq.h" 41eb7a38baSEdgar E. Iglesias #include "hw/misc/xlnx-zynqmp-apu-ctrl.h" 4263320bcaSEdgar E. Iglesias #include "hw/misc/xlnx-zynqmp-crf.h" 4351af6231SEdgar E. Iglesias #include "hw/timer/cadence_ttc.h" 44acc0b8b0SFrancisco Iglesias #include "hw/usb/hcd-dwc3.h" 45f0a902f7SPeter Crosthwaite 46e178113fSMarkus Armbruster #define TYPE_XLNX_ZYNQMP "xlnx-zynqmp" 478063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) 48f0a902f7SPeter Crosthwaite 492e5577bcSPeter Crosthwaite #define XLNX_ZYNQMP_NUM_APU_CPUS 4 50b58850e7SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_RPU_CPUS 2 5114ca2e46SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_GEMS 4 523bade2a9SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_UARTS 2 53840c22cdSVikram Garhwal #define XLNX_ZYNQMP_NUM_CAN 2 54840c22cdSVikram Garhwal #define XLNX_ZYNQMP_CAN_REF_CLK (24 * 1000 * 1000) 5533108e9fSSai Pavan Boddu #define XLNX_ZYNQMP_NUM_SDHCI 2 5602d07eb4SAlistair Francis #define XLNX_ZYNQMP_NUM_SPIS 2 5704965bcaSFrancisco Iglesias #define XLNX_ZYNQMP_NUM_GDMA_CH 8 5804965bcaSFrancisco Iglesias #define XLNX_ZYNQMP_NUM_ADMA_CH 8 59acc0b8b0SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_USB 2 60f0a902f7SPeter Crosthwaite 61babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_BUS 2 62babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2 63babc1f30SFrancisco Iglesias #define XLNX_ZYNQMP_NUM_QSPI_FLASH 4 64babc1f30SFrancisco Iglesias 656675d719SAlistair Francis #define XLNX_ZYNQMP_NUM_OCM_BANKS 4 666675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_0_ADDRESS 0xFFFC0000 676675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_SIZE 0x10000 686675d719SAlistair Francis 6975b749afSLuc Michel #define XLNX_ZYNQMP_GIC_REGIONS 6 707729e1f4SPeter Crosthwaite 7121bce371SXuzhou Cheng /* 7221bce371SXuzhou Cheng * ZynqMP maps the ARM GIC regions (GICC, GICD ...) at consecutive 64k offsets 737729e1f4SPeter Crosthwaite * and under-decodes the 64k region. This mirrors the 4k regions to every 4k 747729e1f4SPeter Crosthwaite * aligned address in the 64k region. To implement each GIC region needs a 757729e1f4SPeter Crosthwaite * number of memory region aliases. 767729e1f4SPeter Crosthwaite */ 777729e1f4SPeter Crosthwaite 7852c16b45SNathan Rossi #define XLNX_ZYNQMP_GIC_REGION_SIZE 0x1000 7975b749afSLuc Michel #define XLNX_ZYNQMP_GIC_ALIASES (0x10000 / XLNX_ZYNQMP_GIC_REGION_SIZE) 807729e1f4SPeter Crosthwaite 81dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_LOW_RAM_SIZE 0x80000000ull 82dc3b89efSAlistair Francis 83dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE 0x800000000ull 84dc3b89efSAlistair Francis #define XLNX_ZYNQMP_HIGH_RAM_START 0x800000000ull 85dc3b89efSAlistair Francis 86dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ 87dc3b89efSAlistair Francis XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) 88dc3b89efSAlistair Francis 8951af6231SEdgar E. Iglesias #define XLNX_ZYNQMP_NUM_TTC 4 9051af6231SEdgar E. Iglesias 91d2e6f370STong Ho /* 92d2e6f370STong Ho * Unimplemented mmio regions needed to boot some images. 93d2e6f370STong Ho */ 94eb7a38baSEdgar E. Iglesias #define XLNX_ZYNQMP_NUM_UNIMP_AREAS 1 95d2e6f370STong Ho 96db1015e9SEduardo Habkost struct XlnxZynqMPState { 97f0a902f7SPeter Crosthwaite /*< private >*/ 98f0a902f7SPeter Crosthwaite DeviceState parent_obj; 99f0a902f7SPeter Crosthwaite 100f0a902f7SPeter Crosthwaite /*< public >*/ 101816fd397SLuc Michel CPUClusterState apu_cluster; 102816fd397SLuc Michel CPUClusterState rpu_cluster; 1032e5577bcSPeter Crosthwaite ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS]; 104b58850e7SPeter Crosthwaite ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS]; 1057729e1f4SPeter Crosthwaite GICState gic; 1067729e1f4SPeter Crosthwaite MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES]; 107dc3b89efSAlistair Francis 1086675d719SAlistair Francis MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS]; 1096675d719SAlistair Francis 110dc3b89efSAlistair Francis MemoryRegion *ddr_ram; 111dc3b89efSAlistair Francis MemoryRegion ddr_ram_low, ddr_ram_high; 1127e47e15cSTong Ho XlnxBBRam bbram; 113db1264dfSTong Ho XlnxEFuse efuse; 114db1264dfSTong Ho XlnxZynqMPEFuse efuse_ctrl; 115dc3b89efSAlistair Francis 116d2e6f370STong Ho MemoryRegion mr_unimp[XLNX_ZYNQMP_NUM_UNIMP_AREAS]; 117d2e6f370STong Ho 11814ca2e46SPeter Crosthwaite CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; 119*604b72ddSKinsey Moore OrIRQState gem_irq_orgate[XLNX_ZYNQMP_NUM_GEMS]; 1203bade2a9SPeter Crosthwaite CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS]; 121840c22cdSVikram Garhwal XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN]; 1226fdf3282SAlistair Francis SysbusAHCIState sata; 12333108e9fSSai Pavan Boddu SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI]; 12402d07eb4SAlistair Francis XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS]; 125babc1f30SFrancisco Iglesias XlnxZynqMPQSPIPS qspi; 126b93dbcddSKONRAD Frederic XlnxDPState dp; 127b93dbcddSKONRAD Frederic XlnxDPDMAState dpdma; 1280ab7bbc7SAlistair Francis XlnxZynqMPIPI ipi; 12908b2f15eSAlistair Francis XlnxZynqMPRTC rtc; 13004965bcaSFrancisco Iglesias XlnxZDMA gdma[XLNX_ZYNQMP_NUM_GDMA_CH]; 13104965bcaSFrancisco Iglesias XlnxZDMA adma[XLNX_ZYNQMP_NUM_ADMA_CH]; 132668351a5SXuzhou Cheng XlnxCSUDMA qspi_dma; 133e844f0c5SPhilippe Mathieu-Daudé OrIRQState qspi_irq_orgate; 134eb7a38baSEdgar E. Iglesias XlnxZynqMPAPUCtrl apu_ctrl; 13563320bcaSEdgar E. Iglesias XlnxZynqMPCRF crf; 13651af6231SEdgar E. Iglesias CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC]; 137acc0b8b0SFrancisco Iglesias USBDWC3 usb[XLNX_ZYNQMP_NUM_USB]; 1386396a193SPeter Crosthwaite 1396396a193SPeter Crosthwaite char *boot_cpu; 1406396a193SPeter Crosthwaite ARMCPU *boot_cpu_ptr; 14137d42473SEdgar E. Iglesias 14237d42473SEdgar E. Iglesias /* Has the ARM Security extensions? */ 14337d42473SEdgar E. Iglesias bool secure; 1441946809eSAlistair Francis /* Has the ARM Virtualization extensions? */ 1451946809eSAlistair Francis bool virt; 146840c22cdSVikram Garhwal 147840c22cdSVikram Garhwal /* CAN bus. */ 148840c22cdSVikram Garhwal CanBusState *canbus[XLNX_ZYNQMP_NUM_CAN]; 149db1015e9SEduardo Habkost }; 150f0a902f7SPeter Crosthwaite 151f0a902f7SPeter Crosthwaite #endif 152