| John Powell | 7454e82 | 2022-04-07 15:43:35 -0500 | [diff] [blame] | 1 | /* |
| Boyan Karatotev | 6d144db | 2025-06-23 15:04:53 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2022-2025, Arm Limited. All rights reserved. |
| John Powell | 7454e82 | 2022-04-07 15:43:35 -0500 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | #include <arch.h> |
| 7 | |
| 8 | #ifndef PLATFORM_DEF_H |
| 9 | #define PLATFORM_DEF_H |
| 10 | |
| 11 | /* Platform binary types for linking */ |
| 12 | #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" |
| 13 | #define PLATFORM_LINKER_ARCH aarch64 |
| 14 | |
| 15 | #define N1SDP_CLUSTER_COUNT 2 |
| 16 | #define N1SDP_MAX_CPUS_PER_CLUSTER 2 |
| 17 | #define N1SDP_MAX_PE_PER_CPU 1 |
| 18 | |
| 19 | /******************************************************************************* |
| 20 | * Run-time address of the TFTF image. |
| 21 | * It has to match the location where the Trusted Firmware-A loads the BL33 |
| 22 | * image. |
| 23 | ******************************************************************************/ |
| 24 | #define TFTF_BASE 0xE0000000 |
| 25 | |
| 26 | #define N1SDP_DRAM1_BASE 0x80000000 |
| 27 | #define N1SDP_DRAM1_SIZE 0x80000000 |
| 28 | #define DRAM_BASE N1SDP_DRAM1_BASE |
| 29 | |
| 30 | /* |
| 31 | * TF-A reserves DRAM space 0xFD000000 - 0xFEFFFFFF for Trusted DRAM |
| 32 | * TF-A reserves DRAM space 0xFF000000 - 0xFFFFFFFF for TZC |
| 33 | */ |
| 34 | #define ARM_TZC_DRAM1_SIZE 0x00200000 /* 2MB */ |
| 35 | #define ARM_TRUSTED_DRAM1_SIZE 0x0E000000 /* 16MB */ |
| 36 | |
| 37 | #define DRAM_SIZE (N1SDP_DRAM1_SIZE - \ |
| 38 | ARM_TRUSTED_DRAM1_SIZE - \ |
| 39 | ARM_TZC_DRAM1_SIZE) |
| 40 | |
| 41 | /* REFCLK CNTControl, Generic Timer. Secure Access only. */ |
| 42 | #define SYS_CNT_CONTROL_BASE 0x2a430000 |
| 43 | /* REFCLK CNTRead, Generic Timer. */ |
| 44 | #define SYS_CNT_READ_BASE 0x2a800000 |
| 45 | /* AP_REFCLK CNTBase1, Generic Timer. */ |
| 46 | #define SYS_CNT_BASE1 0x2A830000 |
| 47 | |
| 48 | /* Base address of non-trusted watchdog (SP805) */ |
| 49 | #define SP805_WDOG_BASE 0x1C0F0000 |
| 50 | |
| 51 | /* Base address of trusted watchdog (SP805) */ |
| 52 | #define SP805_TWDOG_BASE 0x2A480000 |
| 53 | #define IRQ_TWDOG_INTID 86 |
| 54 | |
| 55 | /* Base address and size of external NVM flash */ |
| 56 | #define FLASH_BASE 0x08000000 |
| 57 | |
| 58 | #define NOR_FLASH_BLOCK_SIZE 0x40000 /* 256KB */ |
| 59 | #define FLASH_SIZE 0x4000000 /* 64MB */ |
| 60 | |
| 61 | /* |
| 62 | * If you want to use DRAM for non-volatile memory then the first 128MB |
| 63 | * can be used. However for tests that involve power resets this is not |
| 64 | * suitable since the state will be lost. |
| 65 | */ |
| 66 | #define TFTF_NVM_OFFSET 0x0 |
| 67 | #define TFTF_NVM_SIZE 0x8000000 /* 128 MB */ |
| 68 | |
| 69 | /* Sub-system Peripherals */ |
| 70 | #define N1SDP_DEVICE0_BASE 0x08000000 |
| 71 | #define N1SDP_DEVICE0_SIZE 0x48000000 |
| 72 | |
| 73 | /* N1SDP remote chip at 4 TB offset */ |
| 74 | #define PLAT_ARM_REMOTE_CHIP_OFFSET (ULL(1) << 42) |
| 75 | |
| 76 | /* Following covers remote n1sdp */ |
| 77 | #define N1SDP_DEVICE1_BASE (N1SDP_DEVICE0_BASE + PLAT_ARM_REMOTE_CHIP_OFFSET) |
| 78 | #define N1SDP_DEVICE1_SIZE N1SDP_DEVICE0_SIZE |
| 79 | |
| 80 | /* GIC-600 & interrupt handling related constants */ |
| 81 | #define N1SDP_GICD_BASE 0x30000000 |
| 82 | #define N1SDP_GICR_BASE 0x300C0000 |
| 83 | #define N1SDP_GICC_BASE 0x2C000000 |
| 84 | |
| 85 | /* SoC's PL011 UART0 related constants */ |
| 86 | #define PL011_UART0_BASE 0x2A400000 |
| 87 | #define PL011_UART0_CLK_IN_HZ 50000000 |
| 88 | |
| 89 | /* |
| 90 | * SoC's PL011 UART1 related constants (duplicated from UART0 since AP UART1 |
| 91 | * isn't accessible on N1SDP) |
| 92 | */ |
| 93 | #define PL011_UART1_BASE 0x2A400000 |
| 94 | #define PL011_UART1_CLK_IN_HZ 50000000 |
| 95 | |
| 96 | #define PLAT_ARM_UART_BASE PL011_UART0_BASE |
| 97 | #define PLAT_ARM_UART_CLK_IN_HZ PL011_UART0_CLK_IN_HZ |
| 98 | |
| 99 | /* Size of cacheable stacks */ |
| 100 | #define PLATFORM_STACK_SIZE 0x1400 |
| 101 | |
| 102 | /* Size of coherent stacks */ |
| 103 | #define PCPU_DV_MEM_STACK_SIZE 0x600 |
| 104 | |
| 105 | #define PLATFORM_CORE_COUNT (N1SDP_CLUSTER_COUNT * N1SDP_MAX_CPUS_PER_CLUSTER) |
| 106 | #define PLATFORM_NUM_AFFS (N1SDP_CLUSTER_COUNT + PLATFORM_CORE_COUNT) |
| 107 | #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL1 |
| 108 | |
| 109 | #define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL |
| 110 | #define PLAT_MAX_PWR_STATES_PER_LVL 2 |
| 111 | |
| 112 | /* I/O Storage NOR flash device */ |
| 113 | #define MAX_IO_DEVICES 1 |
| 114 | #define MAX_IO_HANDLES 1 |
| 115 | |
| 116 | /* Local state bit width for each level in the state-ID field of power state */ |
| 117 | #define PLAT_LOCAL_PSTATE_WIDTH 4 |
| 118 | |
| 119 | /* Platform specific page table and MMU setup constants */ |
| 120 | #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 36) |
| 121 | #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 36) |
| 122 | |
| 123 | #if IMAGE_CACTUS |
| 124 | #define MAX_XLAT_TABLES 6 |
| 125 | #else |
| 126 | #define MAX_XLAT_TABLES 5 |
| 127 | #endif |
| 128 | #define MAX_MMAP_REGIONS 16 |
| 129 | |
| 130 | /******************************************************************************* |
| 131 | * Used to align variables on the biggest cache line size in the platform. |
| 132 | * This is known only to the platform as it might have a combination of |
| 133 | * integrated and external caches. |
| 134 | ******************************************************************************/ |
| 135 | #define CACHE_WRITEBACK_SHIFT 6 |
| 136 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 137 | |
| John Powell | 7454e82 | 2022-04-07 15:43:35 -0500 | [diff] [blame] | 138 | /* |
| 139 | * AP UART1 interrupt is considered as the maximum SPI. |
| 140 | * MAX_SPI_ID = MIN_SPI_ID + PLAT_MAX_SPI_OFFSET_ID = 96 |
| 141 | */ |
| 142 | #define PLAT_MAX_SPI_OFFSET_ID 64 |
| 143 | |
| 144 | /* AP_REFCLK Generic Timer, Non-secure. */ |
| 145 | #define IRQ_CNTPSIRQ1 92 |
| 146 | |
| 147 | /* Per-CPU Hypervisor Timer Interrupt ID */ |
| 148 | #define IRQ_PCPU_HP_TIMER 26 |
| 149 | |
| 150 | /* Times(in ms) used by test code for completion of different events */ |
| 151 | #define PLAT_SUSPEND_ENTRY_TIME 0x100 |
| 152 | #define PLAT_SUSPEND_ENTRY_EXIT_TIME 0x200 |
| 153 | |
| 154 | #endif /* PLATFORM_DEF_H */ |