Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 7 | #ifndef PLATFORM_DEF_H |
| 8 | #define PLATFORM_DEF_H |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 9 | |
| 10 | #include <arm_def.h> |
Sughosh Ganu | 79b91d4 | 2018-05-16 15:13:25 +0530 | [diff] [blame] | 11 | #include <arm_spm_def.h> |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 12 | #include <board_arm_def.h> |
| 13 | #include <board_css_def.h> |
| 14 | #include <common_def.h> |
| 15 | #include <css_def.h> |
| 16 | #include <soc_css_def.h> |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 17 | #include <utils_def.h> |
Sughosh Ganu | 70661cf | 2018-05-16 17:26:40 +0530 | [diff] [blame] | 18 | #include <xlat_tables_defs.h> |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 19 | |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 20 | #define CSS_SGI_MAX_CPUS_PER_CLUSTER 4 |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 21 | |
| 22 | /* CPU topology */ |
| 23 | #define PLAT_ARM_CLUSTER_COUNT 2 |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 24 | #define CSS_SGI_MAX_PE_PER_CPU 1 |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 25 | #define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \ |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 26 | CSS_SGI_MAX_CPUS_PER_CLUSTER * \ |
| 27 | CSS_SGI_MAX_PE_PER_CPU) |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 28 | |
| 29 | #if ARM_BOARD_OPTIMISE_MEM |
| 30 | |
| 31 | #if defined(IMAGE_BL31) || defined(IMAGE_BL32) |
| 32 | # define PLAT_ARM_MMAP_ENTRIES 6 |
| 33 | # define MAX_XLAT_TABLES 4 |
| 34 | #else |
| 35 | # define PLAT_ARM_MMAP_ENTRIES 10 |
| 36 | # define MAX_XLAT_TABLES 5 |
| 37 | #endif |
| 38 | |
| 39 | #if TRUSTED_BOARD_BOOT |
| 40 | # define PLAT_ARM_MAX_BL1_RW_SIZE 0xA000 |
| 41 | #else |
| 42 | # define PLAT_ARM_MAX_BL1_RW_SIZE 0x6000 |
| 43 | #endif |
| 44 | |
| 45 | #if TRUSTED_BOARD_BOOT |
| 46 | # define PLAT_ARM_MAX_BL2_SIZE 0x1D000 |
| 47 | #else |
| 48 | # define PLAT_ARM_MAX_BL2_SIZE 0xC000 |
| 49 | #endif |
| 50 | |
| 51 | #endif /* ARM_BOARD_OPTIMISE_MEM */ |
| 52 | |
| 53 | #define PLAT_ARM_NSTIMER_FRAME_ID 0 |
| 54 | |
| 55 | #define PLAT_CSS_MHU_BASE 0x45000000 |
| 56 | |
| 57 | #define PLAT_ARM_TRUSTED_ROM_BASE 0x0 |
| 58 | #define PLAT_ARM_TRUSTED_ROM_SIZE 0x00080000 /* 512KB */ |
| 59 | |
Chris Kay | 42fbdfc | 2018-05-10 14:27:45 +0100 | [diff] [blame] | 60 | #define PLAT_ARM_NSRAM_BASE 0x06000000 |
| 61 | #define PLAT_ARM_NSRAM_SIZE 0x00080000 /* 512KB */ |
| 62 | |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 63 | #define PLAT_MAX_PWR_LVL U(1) |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 64 | |
| 65 | #define PLAT_ARM_G1S_IRQS ARM_G1S_IRQS, \ |
| 66 | CSS_IRQ_MHU |
| 67 | |
| 68 | #define PLAT_ARM_G0_IRQS ARM_G0_IRQS |
| 69 | |
| 70 | #define PLAT_ARM_G1S_IRQ_PROPS(grp) CSS_G1S_IRQ_PROPS(grp) |
| 71 | #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp) |
| 72 | |
| 73 | #define CSS_SGI_DEVICE_BASE (0x20000000) |
| 74 | #define CSS_SGI_DEVICE_SIZE (0x20000000) |
| 75 | #define CSS_SGI_MAP_DEVICE MAP_REGION_FLAT( \ |
| 76 | CSS_SGI_DEVICE_BASE, \ |
| 77 | CSS_SGI_DEVICE_SIZE, \ |
| 78 | MT_DEVICE | MT_RW | MT_SECURE) |
| 79 | |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 80 | /* GIC related constants */ |
| 81 | #define PLAT_ARM_GICD_BASE 0x30000000 |
| 82 | #define PLAT_ARM_GICC_BASE 0x2C000000 |
| 83 | #define PLAT_ARM_GICR_BASE 0x300C0000 |
| 84 | |
Sughosh Ganu | e1579e0 | 2018-05-16 17:19:56 +0530 | [diff] [blame] | 85 | /* Map the secure region for access from S-EL0 */ |
| 86 | #define PLAT_ARM_SECURE_MAP_DEVICE MAP_REGION_FLAT( \ |
| 87 | SOC_CSS_DEVICE_BASE, \ |
| 88 | SOC_CSS_DEVICE_SIZE, \ |
| 89 | MT_DEVICE | MT_RW | MT_SECURE | MT_USER) |
| 90 | |
Sughosh Ganu | 5f21294 | 2018-05-16 15:35:25 +0530 | [diff] [blame] | 91 | #if RAS_EXTENSION |
| 92 | /* Allocate 128KB for CPER buffers */ |
Sughosh Ganu | 70661cf | 2018-05-16 17:26:40 +0530 | [diff] [blame] | 93 | #define PLAT_SP_BUF_BASE ULL(0x20000) |
| 94 | |
| 95 | #define PLAT_ARM_SP_IMAGE_STACK_BASE (ARM_SP_IMAGE_NS_BUF_BASE + \ |
| 96 | ARM_SP_IMAGE_NS_BUF_SIZE + \ |
| 97 | PLAT_SP_BUF_BASE) |
| 98 | |
| 99 | /* Platform specific SMC FID's used for RAS */ |
| 100 | #define SP_DMC_ERROR_INJECT_EVENT_AARCH64 0xC4000042 |
| 101 | #define SP_DMC_ERROR_INJECT_EVENT_AARCH32 0x84000042 |
| 102 | |
| 103 | #define SP_DMC_ERROR_OVERFLOW_EVENT_AARCH64 0xC4000043 |
| 104 | #define SP_DMC_ERROR_OVERFLOW_EVENT_AARCH32 0x84000043 |
| 105 | |
| 106 | #define SP_DMC_ERROR_ECC_EVENT_AARCH64 0xC4000044 |
| 107 | #define SP_DMC_ERROR_ECC_EVENT_AARCH32 0x84000044 |
| 108 | |
| 109 | /* ARM SDEI dynamic shared event numbers */ |
| 110 | #define SGI_SDEI_DS_EVENT_0 804 |
| 111 | #define SGI_SDEI_DS_EVENT_1 805 |
| 112 | |
| 113 | #define PLAT_ARM_PRIVATE_SDEI_EVENTS \ |
| 114 | SDEI_DEFINE_EVENT_0(ARM_SDEI_SGI), \ |
| 115 | SDEI_EXPLICIT_EVENT(SGI_SDEI_DS_EVENT_0, SDEI_MAPF_CRITICAL), \ |
| 116 | SDEI_EXPLICIT_EVENT(SGI_SDEI_DS_EVENT_1, SDEI_MAPF_CRITICAL), |
| 117 | #define PLAT_ARM_SHARED_SDEI_EVENTS |
| 118 | |
| 119 | #define ARM_SP_CPER_BUF_BASE (ARM_SP_IMAGE_NS_BUF_BASE + \ |
| 120 | ARM_SP_IMAGE_NS_BUF_SIZE) |
| 121 | #define ARM_SP_CPER_BUF_SIZE ULL(0x20000) |
| 122 | #define ARM_SP_CPER_BUF_MMAP MAP_REGION2( \ |
| 123 | ARM_SP_CPER_BUF_BASE, \ |
| 124 | ARM_SP_CPER_BUF_BASE, \ |
| 125 | ARM_SP_CPER_BUF_SIZE, \ |
| 126 | MT_RW_DATA | MT_NS | MT_USER, \ |
| 127 | PAGE_SIZE) |
Sughosh Ganu | 5f21294 | 2018-05-16 15:35:25 +0530 | [diff] [blame] | 128 | |
Sughosh Ganu | 5f21294 | 2018-05-16 15:35:25 +0530 | [diff] [blame] | 129 | #else |
| 130 | #define PLAT_ARM_SP_IMAGE_STACK_BASE (ARM_SP_IMAGE_NS_BUF_BASE + \ |
| 131 | ARM_SP_IMAGE_NS_BUF_SIZE) |
| 132 | #endif /* RAS_EXTENSION */ |
| 133 | |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 134 | /* Platform ID address */ |
| 135 | #define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET) |
| 136 | #ifndef __ASSEMBLY__ |
| 137 | /* SSC_VERSION related accessors */ |
| 138 | /* Returns the part number of the platform */ |
| 139 | #define GET_SGI_PART_NUM \ |
| 140 | GET_SSC_VERSION_PART_NUM(mmio_read_32(SSC_VERSION)) |
| 141 | /* Returns the configuration number of the platform */ |
| 142 | #define GET_SGI_CONFIG_NUM \ |
| 143 | GET_SSC_VERSION_CONFIG(mmio_read_32(SSC_VERSION)) |
| 144 | #endif /* __ASSEMBLY__ */ |
| 145 | |
Roberto Vargas | bcca6c6 | 2018-06-11 16:15:35 +0100 | [diff] [blame] | 146 | /******************************************************************************* |
| 147 | * Memprotect definitions |
| 148 | ******************************************************************************/ |
| 149 | /* PSCI memory protect definitions: |
| 150 | * This variable is stored in a non-secure flash because some ARM reference |
| 151 | * platforms do not have secure NVRAM. Real systems that provided MEM_PROTECT |
| 152 | * support must use a secure NVRAM to store the PSCI MEM_PROTECT definitions. |
| 153 | */ |
| 154 | #define PLAT_ARM_MEM_PROT_ADDR (V2M_FLASH0_BASE + \ |
| 155 | V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE) |
| 156 | |
| 157 | |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 158 | #endif /* PLATFORM_DEF_H */ |