blob: 941a84b504766de544ce5e54324e35c52fbbcd1b [file] [log] [blame]
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +02001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __PLATFORM_DEF_H__
8#define __PLATFORM_DEF_H__
9
10#include <arch.h>
11#include <common_def.h>
Jeenu Viswambharan0345fc32017-09-29 11:14:02 +010012#include <gic_common.h>
13#include <interrupt_props.h>
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020014#include <tbbr/tbbr_img_def.h>
Victor Chong539408d2018-01-03 01:53:08 +090015#include <utils_def.h>
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020016#include "hi3798cv200.h"
17#include "poplar_layout.h" /* BL memory region sizes, etc */
18
19#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
20#define PLATFORM_LINKER_ARCH aarch64
21
22#define PLAT_ARM_CRASH_UART_BASE PL011_UART0_BASE
23#define PLAT_ARM_CRASH_UART_CLK_IN_HZ PL011_UART0_CLK_IN_HZ
24#define ARM_CONSOLE_BAUDRATE PL011_BAUDRATE
25
26/* Generic platform constants */
27#define PLATFORM_STACK_SIZE (0x800)
28
29#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
30#define BOOT_EMMC_NAME "l-loader.bin"
31
32#define PLATFORM_CACHE_LINE_SIZE (64)
33#define PLATFORM_CLUSTER_COUNT (1)
34#define PLATFORM_CORE_COUNT (4)
35#define PLATFORM_MAX_CPUS_PER_CLUSTER (4)
36
37/* IO framework user */
38#define MAX_IO_DEVICES (4)
39#define MAX_IO_HANDLES (4)
40#define MAX_IO_BLOCK_DEVICES (2)
41
Victor Chong50d695d2018-01-29 18:11:02 +090042/* Memory size options */
43#define POPLAR_DRAM_SIZE_1G 0
44#define POPLAR_DRAM_SIZE_2G 1
45
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020046/* Memory map related constants */
47#define DDR_BASE (0x00000000)
Victor Chong50d695d2018-01-29 18:11:02 +090048
49#if (POPLAR_DRAM_SIZE_ID == POPLAR_DRAM_SIZE_2G)
50#define DDR_SIZE (0x80000000)
51#elif (POPLAR_DRAM_SIZE_ID == POPLAR_DRAM_SIZE_1G)
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020052#define DDR_SIZE (0x40000000)
Victor Chong50d695d2018-01-29 18:11:02 +090053#else
54#error "Currently unsupported POPLAR_DRAM_SIZE_ID value"
55#endif
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020056
57#define DEVICE_BASE (0xF0000000)
58#define DEVICE_SIZE (0x0F000000)
59
60#define TEE_SEC_MEM_BASE (0x70000000)
61#define TEE_SEC_MEM_SIZE (0x10000000)
62
Victor Chong662556a2017-10-28 01:59:41 +090063/* Memory location options for TSP */
64#define POPLAR_SRAM_ID 0
65#define POPLAR_DRAM_ID 1
66
67/*
Victor Chong539408d2018-01-03 01:53:08 +090068 * DDR for OP-TEE (26MB from 0x02400000 -0x04000000) is divided in several
Victor Chong662556a2017-10-28 01:59:41 +090069 * regions:
70 * - Secure DDR (default is the top 16MB) used by OP-TEE
71 * - Non-secure DDR (4MB) reserved for OP-TEE's future use
72 * - Secure DDR (4MB aligned on 4MB) for OP-TEE's "Secure Data Path" feature
73 * - Non-secure DDR used by OP-TEE (shared memory and padding) (4MB)
Victor Chong662556a2017-10-28 01:59:41 +090074 */
75#define DDR_SEC_SIZE 0x01000000
76#define DDR_SEC_BASE 0x03000000
77
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +020078#define BL_MEM_BASE (BL1_RO_BASE)
79#define BL_MEM_LIMIT (BL31_LIMIT)
80#define BL_MEM_SIZE (BL_MEM_LIMIT - BL_MEM_BASE)
81
Victor Chong662556a2017-10-28 01:59:41 +090082/*
83 * BL3-2 specific defines.
84 */
85
86/*
87 * The TSP currently executes from TZC secured area of DRAM.
88 */
89#define BL32_DRAM_BASE 0x03000000
90#define BL32_DRAM_LIMIT 0x04000000
91
92#if (POPLAR_TSP_RAM_LOCATION_ID == POPLAR_DRAM_ID)
93#define TSP_SEC_MEM_BASE BL32_DRAM_BASE
94#define TSP_SEC_MEM_SIZE (BL32_DRAM_LIMIT - BL32_DRAM_BASE)
95#define BL32_BASE BL32_DRAM_BASE
96#define BL32_LIMIT BL32_DRAM_LIMIT
97#elif (POPLAR_TSP_RAM_LOCATION_ID == POPLAR_SRAM_ID)
98#error "SRAM storage of TSP payload is currently unsupported"
99#else
100#error "Currently unsupported POPLAR_TSP_LOCATION_ID value"
101#endif
102
103/* BL32 is mandatory in AArch32 */
104#ifndef AARCH32
105#ifdef SPD_none
106#undef BL32_BASE
107#endif /* SPD_none */
108#endif
109
Victor Chong539408d2018-01-03 01:53:08 +0900110#define POPLAR_EMMC_DATA_BASE U(0x02200000)
111#define POPLAR_EMMC_DATA_SIZE EMMC_DESC_SIZE
112#define POPLAR_EMMC_DESC_BASE (POPLAR_EMMC_DATA_BASE + POPLAR_EMMC_DATA_SIZE)
113#define POPLAR_EMMC_DESC_SIZE EMMC_DESC_SIZE
114
Victor Chong6df271c2017-10-27 00:09:14 +0900115#define PLAT_POPLAR_NS_IMAGE_OFFSET 0x37000000
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +0200116
117/* Page table and MMU setup constants */
118#define ADDR_SPACE_SIZE (1ull << 32)
119#define MAX_XLAT_TABLES (4)
120#define MAX_MMAP_REGIONS (16)
121
122#define CACHE_WRITEBACK_SHIFT (6)
123#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
124
125/* Power states */
126#define PLAT_MAX_PWR_LVL (MPIDR_AFFLVL1)
127#define PLAT_MAX_OFF_STATE 2
128#define PLAT_MAX_RET_STATE 1
129
130/* Interrupt controller */
131#define PLAT_ARM_GICD_BASE GICD_BASE
132#define PLAT_ARM_GICC_BASE GICC_BASE
133
Jeenu Viswambharan0345fc32017-09-29 11:14:02 +0100134#define PLAT_ARM_G1S_IRQ_PROPS(grp) \
135 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
136 GIC_INTR_CFG_LEVEL), \
137 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
138 GIC_INTR_CFG_LEVEL), \
139 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
140 GIC_INTR_CFG_LEVEL), \
141 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
142 GIC_INTR_CFG_LEVEL), \
143 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
144 GIC_INTR_CFG_LEVEL), \
145 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
146 GIC_INTR_CFG_LEVEL), \
147 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
148 GIC_INTR_CFG_LEVEL), \
149 INTR_PROP_DESC(HISI_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
150 GIC_INTR_CFG_LEVEL), \
151 INTR_PROP_DESC(HISI_IRQ_SEC_TIMER0, GIC_HIGHEST_SEC_PRIORITY, grp, \
152 GIC_INTR_CFG_LEVEL), \
153 INTR_PROP_DESC(HISI_IRQ_SEC_TIMER1, GIC_HIGHEST_SEC_PRIORITY, grp, \
154 GIC_INTR_CFG_LEVEL), \
155 INTR_PROP_DESC(HISI_IRQ_SEC_TIMER2, GIC_HIGHEST_SEC_PRIORITY, grp, \
156 GIC_INTR_CFG_LEVEL), \
157 INTR_PROP_DESC(HISI_IRQ_SEC_TIMER3, GIC_HIGHEST_SEC_PRIORITY, grp, \
158 GIC_INTR_CFG_LEVEL), \
159 INTR_PROP_DESC(HISI_IRQ_SEC_AXI, GIC_HIGHEST_SEC_PRIORITY, grp, \
160 GIC_INTR_CFG_LEVEL)
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +0200161
Jeenu Viswambharan0345fc32017-09-29 11:14:02 +0100162#define PLAT_ARM_G0_IRQ_PROPS(grp)
Jorge Ramirez-Ortiza29d9a62017-06-28 10:11:31 +0200163
164#endif /* __PLATFORM_DEF_H__ */