Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #ifndef __PLATFORM_DEF_H__ |
| 32 | #define __PLATFORM_DEF_H__ |
| 33 | |
| 34 | #include <arch.h> |
Dan Handley | 4fd2f5c | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 35 | #include "../fvp_def.h" |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 36 | |
| 37 | |
| 38 | /******************************************************************************* |
| 39 | * Platform binary types for linking |
| 40 | ******************************************************************************/ |
| 41 | #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" |
| 42 | #define PLATFORM_LINKER_ARCH aarch64 |
| 43 | |
| 44 | /******************************************************************************* |
| 45 | * Generic platform constants |
| 46 | ******************************************************************************/ |
| 47 | |
| 48 | /* Size of cacheable stacks */ |
Soby Mathew | 0b6c706 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 49 | #if DEBUG_XLAT_TABLE |
| 50 | #define PLATFORM_STACK_SIZE 0x800 |
| 51 | #elif IMAGE_BL1 |
| 52 | #define PLATFORM_STACK_SIZE 0x440 |
| 53 | #elif IMAGE_BL2 |
| 54 | #define PLATFORM_STACK_SIZE 0x400 |
| 55 | #elif IMAGE_BL31 |
| 56 | #define PLATFORM_STACK_SIZE 0x400 |
| 57 | #elif IMAGE_BL32 |
| 58 | #define PLATFORM_STACK_SIZE 0x440 |
| 59 | #endif |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 60 | |
Dan Handley | 91b624e | 2014-07-29 17:14:00 +0100 | [diff] [blame] | 61 | #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 62 | |
| 63 | /* Trusted Boot Firmware BL2 */ |
| 64 | #define BL2_IMAGE_NAME "bl2.bin" |
| 65 | |
| 66 | /* EL3 Runtime Firmware BL31 */ |
| 67 | #define BL31_IMAGE_NAME "bl31.bin" |
| 68 | |
| 69 | /* Secure Payload BL32 (Trusted OS) */ |
| 70 | #define BL32_IMAGE_NAME "bl32.bin" |
| 71 | |
| 72 | /* Non-Trusted Firmware BL33 */ |
| 73 | #define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */ |
| 74 | |
| 75 | #define PLATFORM_CACHE_LINE_SIZE 64 |
| 76 | #define PLATFORM_CLUSTER_COUNT 2ull |
| 77 | #define PLATFORM_CLUSTER0_CORE_COUNT 4 |
| 78 | #define PLATFORM_CLUSTER1_CORE_COUNT 4 |
| 79 | #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \ |
| 80 | PLATFORM_CLUSTER0_CORE_COUNT) |
| 81 | #define PLATFORM_MAX_CPUS_PER_CLUSTER 4 |
Andrew Thoelke | 56f4470 | 2014-06-20 00:36:14 +0100 | [diff] [blame] | 82 | #define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \ |
| 83 | PLATFORM_CORE_COUNT) |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 84 | #define MAX_IO_DEVICES 3 |
| 85 | #define MAX_IO_HANDLES 4 |
| 86 | |
| 87 | /******************************************************************************* |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 88 | * BL1 specific defines. |
| 89 | * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of |
| 90 | * addresses. |
| 91 | ******************************************************************************/ |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 92 | #define BL1_RO_BASE FVP_TRUSTED_ROM_BASE |
| 93 | #define BL1_RO_LIMIT (FVP_TRUSTED_ROM_BASE \ |
| 94 | + FVP_TRUSTED_ROM_SIZE) |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 95 | /* |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 96 | * Put BL1 RW at the top of the Trusted SRAM (just below the shared memory, if |
| 97 | * present). BL1_RW_BASE is calculated using the current BL1 RW debug size plus |
| 98 | * a little space for growth. |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 99 | */ |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 100 | #define BL1_RW_BASE (FVP_TRUSTED_SRAM_LIMIT - 0x6000) |
| 101 | #define BL1_RW_LIMIT FVP_TRUSTED_SRAM_LIMIT |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 102 | |
| 103 | /******************************************************************************* |
| 104 | * BL2 specific defines. |
| 105 | ******************************************************************************/ |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 106 | /* |
| 107 | * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug |
| 108 | * size plus a little space for growth. |
| 109 | */ |
| 110 | #define BL2_BASE (BL31_BASE - 0xC000) |
| 111 | #define BL2_LIMIT BL31_BASE |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 112 | |
| 113 | /******************************************************************************* |
| 114 | * BL31 specific defines. |
| 115 | ******************************************************************************/ |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 116 | /* |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 117 | * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if |
| 118 | * present). BL31_BASE is calculated using the current BL3-1 debug size plus a |
| 119 | * little space for growth. |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 120 | */ |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 121 | #define BL31_BASE (FVP_TRUSTED_SRAM_LIMIT - 0x1D000) |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 122 | #define BL31_PROGBITS_LIMIT BL1_RW_BASE |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 123 | #define BL31_LIMIT FVP_TRUSTED_SRAM_LIMIT |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 124 | |
| 125 | /******************************************************************************* |
| 126 | * BL32 specific defines. |
| 127 | ******************************************************************************/ |
| 128 | /* |
| 129 | * On FVP, the TSP can execute either from Trusted SRAM or Trusted DRAM. |
| 130 | */ |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 131 | #if FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_SRAM |
| 132 | # define TSP_SEC_MEM_BASE FVP_TRUSTED_SRAM_BASE |
| 133 | # define TSP_SEC_MEM_SIZE FVP_TRUSTED_SRAM_SIZE |
Dan Handley | 4fd2f5c | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 134 | # define TSP_PROGBITS_LIMIT BL2_BASE |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 135 | # define BL32_BASE FVP_TRUSTED_SRAM_BASE |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 136 | # define BL32_LIMIT BL31_BASE |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 137 | #elif FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_DRAM |
| 138 | # define TSP_SEC_MEM_BASE FVP_TRUSTED_DRAM_BASE |
| 139 | # define TSP_SEC_MEM_SIZE FVP_TRUSTED_DRAM_SIZE |
Juan Castillo | 48e84b3 | 2014-08-12 13:51:51 +0100 | [diff] [blame] | 140 | # define BL32_BASE (FVP_TRUSTED_DRAM_BASE \ |
| 141 | + FVP_SHARED_RAM_SIZE) |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 142 | # define BL32_LIMIT (FVP_TRUSTED_DRAM_BASE + (1 << 21)) |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 143 | #else |
Juan Castillo | 0c70c57 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 144 | # error "Unsupported FVP_TSP_RAM_LOCATION_ID value" |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 145 | #endif |
| 146 | |
Dan Handley | 4fd2f5c | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 147 | /* |
| 148 | * ID of the secure physical generic timer interrupt used by the TSP. |
| 149 | */ |
| 150 | #define TSP_IRQ_SEC_PHY_TIMER IRQ_SEC_PHY_TIMER |
| 151 | |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 152 | /******************************************************************************* |
| 153 | * Platform specific page table and MMU setup constants |
| 154 | ******************************************************************************/ |
| 155 | #define ADDR_SPACE_SIZE (1ull << 32) |
Andrew Thoelke | 30b04fc | 2014-06-20 12:23:20 +0100 | [diff] [blame] | 156 | #define MAX_XLAT_TABLES 2 |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 157 | #define MAX_MMAP_REGIONS 16 |
| 158 | |
| 159 | /******************************************************************************* |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 160 | * Declarations and constants to access the mailboxes safely. Each mailbox is |
| 161 | * aligned on the biggest cache line size in the platform. This is known only |
| 162 | * to the platform as it might have a combination of integrated and external |
| 163 | * caches. Such alignment ensures that two maiboxes do not sit on the same cache |
| 164 | * line at any cache level. They could belong to different cpus/clusters & |
| 165 | * get written while being protected by different locks causing corruption of |
| 166 | * a valid mailbox address. |
| 167 | ******************************************************************************/ |
| 168 | #define CACHE_WRITEBACK_SHIFT 6 |
| 169 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 170 | |
| 171 | |
| 172 | #endif /* __PLATFORM_DEF_H__ */ |