blob: 91f4cda19a900087440b6c00e53b57e86c1656ce [file] [log] [blame]
Vishnu Banavath7f660cb2022-04-06 16:30:01 +01001/*
Boyan Karatotev6d144db2025-06-23 15:04:53 +01002 * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
Vishnu Banavath7f660cb2022-04-06 16:30:01 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <utils_def.h>
9
10#include "../corstone1000_def.h"
11
12/*******************************************************************************
13 * Platform definitions used by common code
14 ******************************************************************************/
15
16#ifndef __PLATFORM_DEF_H__
17#define __PLATFORM_DEF_H__
18
19/*******************************************************************************
20 * Platform binary types for linking
21 ******************************************************************************/
22#ifdef __aarch64__
23#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
24#define PLATFORM_LINKER_ARCH aarch64
25#else
26#define PLATFORM_LINKER_FORMAT "elf32-littlearm"
27#define PLATFORM_LINKER_ARCH arm
28#endif
29
30/*******************************************************************************
31 * Run-time address of the TFTF image.
32 * It has to match the location where the Trusted Firmware-A loads the BL33
33 * image.
34 ******************************************************************************/
35#define TFTF_BASE 0x80000000
36
37/******************************************************************************
38 * Memory mapped Generic timer interfaces
39 *******************************************************************************/
40/* REFCLK CNTControl, Generic Timer. Secure Access only. */
41#define SYS_CNT_CONTROL_BASE 0x1A200000
42/* REFCLK CNTRead, Generic Timer. */
43#define SYS_CNT_READ_BASE 0x1A210000
44/* AP_REFCLK CNTBase1, Generic Timer. */
45#define SYS_CNT_BASE1 0x1A240000
46
47/*******************************************************************************
48 * Base address and size of external NVM flash
49 ******************************************************************************/
50#define FLASH_BASE 0x08000000
51
52#define NOR_FLASH_BLOCK_SIZE 0x40000
53#define NOR_FLASH_BLOCKS_COUNT 255
54#define FLASH_SIZE (NOR_FLASH_BLOCK_SIZE * NOR_FLASH_BLOCKS_COUNT)
55
56/* watchdog timer */
57#define IRQ_TWDOG_INTID 56
58
59/* Size of cacheable stacks */
60#if IMAGE_NS_BL1U
61#define PLATFORM_STACK_SIZE 0x1000
62#elif IMAGE_NS_BL2U
63#define PLATFORM_STACK_SIZE 0x1000
64#elif IMAGE_TFTF
65#define PLATFORM_STACK_SIZE 0x1400
66#endif
67
68/* Size of coherent stacks for debug and release builds */
69#if DEBUG
70#define PCPU_DV_MEM_STACK_SIZE 0x600
71#else
72#define PCPU_DV_MEM_STACK_SIZE 0x500
73#endif
74
75#define PLATFORM_SYSTEM_COUNT 1
76#define PLATFORM_CLUSTER_COUNT 1
77#define PLATFORM_CLUSTER0_CORE_COUNT 1 /* Cortex-A35 Cluster */
78#define PLATFORM_CORE_COUNT 1
79#define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
80 PLATFORM_CLUSTER_COUNT + \
81 PLATFORM_CORE_COUNT)
82#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
83#define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL
84#define PLAT_MAX_PWR_STATES_PER_LVL 2
85
86#define CORSTONE1000_MAX_CPUS_PER_CLUSTER 4
87#define CORSTONE1000_MAX_PE_PER_CPU 1
88
89/* Local state bit width for each level in the state-ID field of power state */
90#define PLAT_LOCAL_PSTATE_WIDTH 4
91
92#if IMAGE_NS_BL1U
93#define MAX_IO_DEVICES 2
94#define MAX_IO_HANDLES 2
95#else
96#define MAX_IO_DEVICES 1
97#define MAX_IO_HANDLES 1
98#endif
99
100/*
101 * USE 0x200000 DRAM offset to store TFTF data
102 *
103 * Please note that this won't be suitable for all test scenarios and
104 * for this reason some tests will be disabled in this configuration.
105 */
106#define TFTF_NVM_OFFSET 0x40000
107#define TFTF_NVM_SIZE (128 * SZ_1M) /* 128 MB */
108
109/*******************************************************************************
110 * Platform specific page table and MMU setup constants
111 ******************************************************************************/
112#ifdef __aarch64__
113#define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 34)
114#define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 34)
115#else
116#define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 32)
117#define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 32)
118#endif
119
120#if IMAGE_TFTF
121/* For testing xlat tables lib v2 */
122#define MAX_XLAT_TABLES 20
123#define MAX_MMAP_REGIONS 50
124#else
125#define MAX_XLAT_TABLES 5
126#define MAX_MMAP_REGIONS 16
127#endif
128
129/*******************************************************************************
130 * Used to align variables on the biggest cache line size in the platform.
131 * This is known only to the platform as it might have a combination of
132 * integrated and external caches.
133 ******************************************************************************/
134#define CACHE_WRITEBACK_SHIFT 6
135#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
136
Vishnu Banavath7f660cb2022-04-06 16:30:01 +0100137#define PLAT_MAX_SPI_OFFSET_ID 220
138
139/* The IRQ generated by Ethernet controller */
140#define IRQ_ETHERNET 116
141
142#define IRQ_CNTPSIRQ1 92
143/* Per-CPU Hypervisor Timer Interrupt ID */
144#define IRQ_PCPU_HP_TIMER 26
145/* Per-CPU Non-Secure Timer Interrupt ID */
146#define IRQ_PCPU_NS_TIMER 30
147
148/*
149 * Times(in ms) used by test code for completion of different events.
150 * Suspend entry time for debug build is high due to the time taken
151 * by the VERBOSE/INFO prints. The value considers the worst case scenario
152 * where all CPUs are going and coming out of suspend continuously.
153 */
154#if DEBUG
155#define PLAT_SUSPEND_ENTRY_TIME 0x100
156#define PLAT_SUSPEND_ENTRY_EXIT_TIME 0x200
157#else
158#define PLAT_SUSPEND_ENTRY_TIME 10
159#define PLAT_SUSPEND_ENTRY_EXIT_TIME 20
160#endif
161
162#endif /* __PLATFORM_DEF_H__ */