xref: /openbmc/qemu/include/hw/arm/xlnx-zynqmp.h (revision 02d07eb49436aec8bd13b4ac7c63d9ca3f1c6e6c)
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"
28*02d07eb4SAlistair Francis #include "hw/ssi/xilinx_spips.h"
29f0a902f7SPeter Crosthwaite 
30f0a902f7SPeter Crosthwaite #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"
31f0a902f7SPeter Crosthwaite #define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
32f0a902f7SPeter Crosthwaite                                        TYPE_XLNX_ZYNQMP)
33f0a902f7SPeter Crosthwaite 
342e5577bcSPeter Crosthwaite #define XLNX_ZYNQMP_NUM_APU_CPUS 4
35b58850e7SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_RPU_CPUS 2
3614ca2e46SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_GEMS 4
373bade2a9SPeter Crosthwaite #define XLNX_ZYNQMP_NUM_UARTS 2
3833108e9fSSai Pavan Boddu #define XLNX_ZYNQMP_NUM_SDHCI 2
39*02d07eb4SAlistair Francis #define XLNX_ZYNQMP_NUM_SPIS 2
40f0a902f7SPeter Crosthwaite 
416675d719SAlistair Francis #define XLNX_ZYNQMP_NUM_OCM_BANKS 4
426675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_0_ADDRESS 0xFFFC0000
436675d719SAlistair Francis #define XLNX_ZYNQMP_OCM_RAM_SIZE 0x10000
446675d719SAlistair Francis 
457729e1f4SPeter Crosthwaite #define XLNX_ZYNQMP_GIC_REGIONS 2
467729e1f4SPeter Crosthwaite 
477729e1f4SPeter Crosthwaite /* ZynqMP maps the ARM GIC regions (GICC, GICD ...) at consecutive 64k offsets
487729e1f4SPeter Crosthwaite  * and under-decodes the 64k region. This mirrors the 4k regions to every 4k
497729e1f4SPeter Crosthwaite  * aligned address in the 64k region. To implement each GIC region needs a
507729e1f4SPeter Crosthwaite  * number of memory region aliases.
517729e1f4SPeter Crosthwaite  */
527729e1f4SPeter Crosthwaite 
5352c16b45SNathan Rossi #define XLNX_ZYNQMP_GIC_REGION_SIZE 0x1000
547729e1f4SPeter Crosthwaite #define XLNX_ZYNQMP_GIC_ALIASES     (0x10000 / XLNX_ZYNQMP_GIC_REGION_SIZE - 1)
557729e1f4SPeter Crosthwaite 
56dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_LOW_RAM_SIZE    0x80000000ull
57dc3b89efSAlistair Francis 
58dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE   0x800000000ull
59dc3b89efSAlistair Francis #define XLNX_ZYNQMP_HIGH_RAM_START      0x800000000ull
60dc3b89efSAlistair Francis 
61dc3b89efSAlistair Francis #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \
62dc3b89efSAlistair Francis                                   XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE)
63dc3b89efSAlistair Francis 
64f0a902f7SPeter Crosthwaite typedef struct XlnxZynqMPState {
65f0a902f7SPeter Crosthwaite     /*< private >*/
66f0a902f7SPeter Crosthwaite     DeviceState parent_obj;
67f0a902f7SPeter Crosthwaite 
68f0a902f7SPeter Crosthwaite     /*< public >*/
692e5577bcSPeter Crosthwaite     ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS];
70b58850e7SPeter Crosthwaite     ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS];
717729e1f4SPeter Crosthwaite     GICState gic;
727729e1f4SPeter Crosthwaite     MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES];
73dc3b89efSAlistair Francis 
746675d719SAlistair Francis     MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS];
756675d719SAlistair Francis 
76dc3b89efSAlistair Francis     MemoryRegion *ddr_ram;
77dc3b89efSAlistair Francis     MemoryRegion ddr_ram_low, ddr_ram_high;
78dc3b89efSAlistair Francis 
7914ca2e46SPeter Crosthwaite     CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
803bade2a9SPeter Crosthwaite     CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
816fdf3282SAlistair Francis     SysbusAHCIState sata;
8233108e9fSSai Pavan Boddu     SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI];
83*02d07eb4SAlistair Francis     XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS];
846396a193SPeter Crosthwaite 
856396a193SPeter Crosthwaite     char *boot_cpu;
866396a193SPeter Crosthwaite     ARMCPU *boot_cpu_ptr;
87f0a902f7SPeter Crosthwaite }  XlnxZynqMPState;
88f0a902f7SPeter Crosthwaite 
89f0a902f7SPeter Crosthwaite #define XLNX_ZYNQMP_H
90f0a902f7SPeter Crosthwaite #endif
91