1 /* 2 * Xilinx Zynq MPSoC emulation 3 * 4 * Copyright (C) 2015 Xilinx Inc 5 * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the 9 * Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * for more details. 16 */ 17 18 #ifndef XLNX_ZYNQMP_H 19 20 #include "qemu-common.h" 21 #include "hw/arm/arm.h" 22 #include "hw/intc/arm_gic.h" 23 #include "hw/net/cadence_gem.h" 24 #include "hw/char/cadence_uart.h" 25 #include "hw/ide/pci.h" 26 #include "hw/ide/ahci.h" 27 #include "hw/sd/sdhci.h" 28 #include "hw/ssi/xilinx_spips.h" 29 #include "hw/dma/xlnx_dpdma.h" 30 #include "hw/display/xlnx_dp.h" 31 #include "hw/intc/xlnx-zynqmp-ipi.h" 32 33 #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp" 34 #define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \ 35 TYPE_XLNX_ZYNQMP) 36 37 #define XLNX_ZYNQMP_NUM_APU_CPUS 4 38 #define XLNX_ZYNQMP_NUM_RPU_CPUS 2 39 #define XLNX_ZYNQMP_NUM_GEMS 4 40 #define XLNX_ZYNQMP_NUM_UARTS 2 41 #define XLNX_ZYNQMP_NUM_SDHCI 2 42 #define XLNX_ZYNQMP_NUM_SPIS 2 43 44 #define XLNX_ZYNQMP_NUM_QSPI_BUS 2 45 #define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2 46 #define XLNX_ZYNQMP_NUM_QSPI_FLASH 4 47 48 #define XLNX_ZYNQMP_NUM_OCM_BANKS 4 49 #define XLNX_ZYNQMP_OCM_RAM_0_ADDRESS 0xFFFC0000 50 #define XLNX_ZYNQMP_OCM_RAM_SIZE 0x10000 51 52 #define XLNX_ZYNQMP_GIC_REGIONS 2 53 54 /* ZynqMP maps the ARM GIC regions (GICC, GICD ...) at consecutive 64k offsets 55 * and under-decodes the 64k region. This mirrors the 4k regions to every 4k 56 * aligned address in the 64k region. To implement each GIC region needs a 57 * number of memory region aliases. 58 */ 59 60 #define XLNX_ZYNQMP_GIC_REGION_SIZE 0x1000 61 #define XLNX_ZYNQMP_GIC_ALIASES (0x10000 / XLNX_ZYNQMP_GIC_REGION_SIZE - 1) 62 63 #define XLNX_ZYNQMP_MAX_LOW_RAM_SIZE 0x80000000ull 64 65 #define XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE 0x800000000ull 66 #define XLNX_ZYNQMP_HIGH_RAM_START 0x800000000ull 67 68 #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ 69 XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) 70 71 typedef struct XlnxZynqMPState { 72 /*< private >*/ 73 DeviceState parent_obj; 74 75 /*< public >*/ 76 ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS]; 77 ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS]; 78 GICState gic; 79 MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES]; 80 81 MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS]; 82 83 MemoryRegion *ddr_ram; 84 MemoryRegion ddr_ram_low, ddr_ram_high; 85 86 CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; 87 CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS]; 88 SysbusAHCIState sata; 89 SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI]; 90 XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS]; 91 XlnxZynqMPQSPIPS qspi; 92 XlnxDPState dp; 93 XlnxDPDMAState dpdma; 94 XlnxZynqMPIPI ipi; 95 96 char *boot_cpu; 97 ARMCPU *boot_cpu_ptr; 98 99 /* Has the ARM Security extensions? */ 100 bool secure; 101 /* Has the ARM Virtualization extensions? */ 102 bool virt; 103 /* Has the RPU subsystem? */ 104 bool has_rpu; 105 } XlnxZynqMPState; 106 107 #define XLNX_ZYNQMP_H 108 #endif 109