xref: /openbmc/qemu/include/hw/arm/xlnx-zynqmp.h (revision 1946809ece906d517e96fdcb0b39c5e63916fb5a)
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
19f0a902f7SPeter Crosthwaite 
20f0a902f7SPeter Crosthwaite #include "qemu-common.h"
21f0a902f7SPeter Crosthwaite #include "hw/arm/arm.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"
256fdf3282SAlistair Francis #include "hw/ide/pci.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"
30b93dbcddSKONRAD Frederic #include "hw/display/xlnx_dp.h"
31f0a902f7SPeter Crosthwaite 
32f0a902f7SPeter Crosthwaite #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"
33f0a902f7SPeter Crosthwaite #define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
34f0a902f7SPeter Crosthwaite                                        TYPE_XLNX_ZYNQMP)
35f0a902f7SPeter Crosthwaite 
362e5577bcSPeter Crosthwaite #define XLNX_ZYNQMP_NUM_APU_CPUS 4
37b58850e7SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_RPU_CPUS 2
3814ca2e46SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_GEMS 4
393bade2a9SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_UARTS 2
4033108e9fSSai Pavan Boddu #define XLNX_ZYNQMP_NUM_SDHCI 2
4102d07eb4SAlistair Francis #define XLNX_ZYNQMP_NUM_SPIS 2
42f0a902f7SPeter Crosthwaite 
436675d719SAlistair Francis #define XLNX_ZYNQMP_NUM_OCM_BANKS 4
446675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_0_ADDRESS 0xFFFC0000
456675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_SIZE 0x10000
466675d719SAlistair Francis 
477729e1f4SPeter Crosthwaite #define XLNX_ZYNQMP_GIC_REGIONS 2
487729e1f4SPeter Crosthwaite 
497729e1f4SPeter Crosthwaite /* ZynqMP maps the ARM GIC regions (GICC, GICD ...) at consecutive 64k offsets
507729e1f4SPeter Crosthwaite  * and under-decodes the 64k region. This mirrors the 4k regions to every 4k
517729e1f4SPeter Crosthwaite  * aligned address in the 64k region. To implement each GIC region needs a
527729e1f4SPeter Crosthwaite  * number of memory region aliases.
537729e1f4SPeter Crosthwaite  */
547729e1f4SPeter Crosthwaite 
5552c16b45SNathan Rossi #define XLNX_ZYNQMP_GIC_REGION_SIZE 0x1000
567729e1f4SPeter Crosthwaite #define XLNX_ZYNQMP_GIC_ALIASES     (0x10000 / XLNX_ZYNQMP_GIC_REGION_SIZE - 1)
577729e1f4SPeter Crosthwaite 
58dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_LOW_RAM_SIZE    0x80000000ull
59dc3b89efSAlistair Francis 
60dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE   0x800000000ull
61dc3b89efSAlistair Francis #define XLNX_ZYNQMP_HIGH_RAM_START      0x800000000ull
62dc3b89efSAlistair Francis 
63dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \
64dc3b89efSAlistair Francis                                   XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE)
65dc3b89efSAlistair Francis 
66f0a902f7SPeter Crosthwaite typedef struct XlnxZynqMPState {
67f0a902f7SPeter Crosthwaite     /*< private >*/
68f0a902f7SPeter Crosthwaite     DeviceState parent_obj;
69f0a902f7SPeter Crosthwaite 
70f0a902f7SPeter Crosthwaite     /*< public >*/
712e5577bcSPeter Crosthwaite     ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS];
72b58850e7SPeter Crosthwaite     ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS];
737729e1f4SPeter Crosthwaite     GICState gic;
747729e1f4SPeter Crosthwaite     MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES];
75dc3b89efSAlistair Francis 
766675d719SAlistair Francis     MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS];
776675d719SAlistair Francis 
78dc3b89efSAlistair Francis     MemoryRegion *ddr_ram;
79dc3b89efSAlistair Francis     MemoryRegion ddr_ram_low, ddr_ram_high;
80dc3b89efSAlistair Francis 
8114ca2e46SPeter Crosthwaite     CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
823bade2a9SPeter Crosthwaite     CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
836fdf3282SAlistair Francis     SysbusAHCIState sata;
8433108e9fSSai Pavan Boddu     SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI];
8502d07eb4SAlistair Francis     XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS];
86b93dbcddSKONRAD Frederic     XlnxDPState dp;
87b93dbcddSKONRAD Frederic     XlnxDPDMAState dpdma;
886396a193SPeter Crosthwaite 
896396a193SPeter Crosthwaite     char *boot_cpu;
906396a193SPeter Crosthwaite     ARMCPU *boot_cpu_ptr;
9137d42473SEdgar E. Iglesias 
9237d42473SEdgar E. Iglesias     /* Has the ARM Security extensions?  */
9337d42473SEdgar E. Iglesias     bool secure;
94*1946809eSAlistair Francis     /* Has the ARM Virtualization extensions?  */
95*1946809eSAlistair Francis     bool virt;
966ed92b14SEdgar E. Iglesias     /* Has the RPU subsystem?  */
976ed92b14SEdgar E. Iglesias     bool has_rpu;
98f0a902f7SPeter Crosthwaite }  XlnxZynqMPState;
99f0a902f7SPeter Crosthwaite 
100f0a902f7SPeter Crosthwaite #define XLNX_ZYNQMP_H
101f0a902f7SPeter Crosthwaite #endif
102