Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | Mandatory modifications |
| 2 | ----------------------- |
| 3 | |
| 4 | File : platform_def.h [mandatory] |
| 5 | ````````````````````````````````` |
| 6 | |
| 7 | Each platform must ensure that a header file of this name is in the system |
| 8 | include path with the following constants defined. This may require updating the |
| 9 | list of ``PLAT_INCLUDES`` in the ``platform.mk`` file. In the ARM FVP port, this |
| 10 | file is found in ``plat/arm/board/fvp/include/platform_def.h``. |
| 11 | |
| 12 | - **#define : PLATFORM_LINKER_FORMAT** |
| 13 | |
| 14 | Defines the linker format used by the platform, for example |
| 15 | `elf64-littleaarch64` used by the FVP. |
| 16 | |
| 17 | - **#define : PLATFORM_LINKER_ARCH** |
| 18 | |
| 19 | Defines the processor architecture for the linker by the platform, for |
| 20 | example `aarch64` used by the FVP. |
| 21 | |
| 22 | - **#define : PLATFORM_STACK_SIZE** |
| 23 | |
| 24 | Defines the stack memory available to each CPU. This constant is used by |
| 25 | ``plat/common/aarch64/platform_mp_stack.S``. |
| 26 | |
| 27 | - **#define : PLATFORM_CLUSTER_COUNT** |
| 28 | |
| 29 | Defines the total number of clusters implemented by the platform in the |
| 30 | system. |
| 31 | |
| 32 | - **#define : PLATFORM_CORE_COUNT** |
| 33 | |
| 34 | Defines the total number of CPUs implemented by the platform across all |
| 35 | clusters in the system. |
| 36 | |
| 37 | - **#define : PLATFORM_NUM_AFFS** |
| 38 | |
| 39 | Defines the total number of nodes in the affinity hierarchy at all affinity |
| 40 | levels used by the platform. |
| 41 | |
| 42 | - **#define : PLATFORM_MAX_AFFLVL** |
| 43 | |
| 44 | Defines the maximum number of affinity levels in the system that the platform |
| 45 | implements. ARMv8-A has support for 4 affinity levels. It is likely that |
| 46 | hardware will implement fewer affinity levels. For example, the Base AEM FVP |
| 47 | implements two clusters with a configurable number of CPUs. It reports the |
| 48 | maximum affinity level as 1. |
| 49 | |
| 50 | - **#define : PLAT_MAX_SPI_OFFSET_ID** |
| 51 | |
| 52 | Defines the offset of the last Shared Peripheral Interrupt supported by the |
| 53 | TF-A Tests on this platform. SPI numbers are mapped onto GIC interrupt IDs, |
| 54 | starting from interrupt ID 32. In other words, this offset ID corresponds to |
| 55 | the last SPI number, to which 32 must be added to get the corresponding last |
| 56 | GIC IRQ ID. |
| 57 | |
| 58 | E.g. If ``PLAT_MAX_SPI_OFFSET_ID`` is 10, this means that IRQ #42 is the last |
| 59 | SPI. |
| 60 | |
| 61 | - **#define : PLAT_LOCAL_PSTATE_WIDTH** |
| 62 | |
| 63 | Defines the bit-field width of the local state in State-ID field of the |
| 64 | power-state parameter. This macro will be used to compose the State-ID field |
| 65 | given the local power state at different affinity levels. |
| 66 | |
| 67 | - **#define : PLAT_MAX_PWR_STATES_PER_LVL** |
| 68 | |
| 69 | Defines the maximum number of power states at a power domain level for the |
| 70 | platform. This macro will be used by the ``PSCI_STAT_COUNT/RESIDENCY`` tests |
| 71 | to determine the size of the array to allocate for storing the statistics. |
| 72 | |
| 73 | - **#define : TFTF_BASE** |
| 74 | |
| 75 | Defines the base address of the TFTF binary in DRAM. Used by the linker |
| 76 | script to link the image at the right address. Must be aligned on a page-size |
| 77 | boundary. |
| 78 | |
| 79 | - **#define : IRQ_PCPU_NS_TIMER** |
| 80 | |
| 81 | Defines the IRQ ID of the per-CPU Non-Secure timer of the platform. |
| 82 | |
| 83 | - **#define : IRQ_CNTPSIRQ1** |
| 84 | |
| 85 | Defines the IRQ ID of the System timer of the platform. |
| 86 | |
| 87 | - **#define : TFTF_NVM_OFFSET** |
| 88 | |
| 89 | The TFTF needs some Non-Volatile Memory to store persistent data. This |
| 90 | defines the offset from the beginning of this memory that the TFTF can use. |
| 91 | |
| 92 | - **#define : TFTF_NVM_SIZE** |
| 93 | |
| 94 | Defines the size of the Non-Volatile Memory allocated for TFTF usage. |
| 95 | |
| 96 | If the platform port uses the ARM Watchdog Module (`SP805`_) peripheral, the |
| 97 | following constant needs to be defined: |
| 98 | |
| 99 | - **#define : SP805_WDOG_BASE** |
| 100 | |
| 101 | Defines the base address of the `SP805`_ watchdog peripheral. |
| 102 | |
| 103 | If the platform port uses the IO storage framework, the following constants |
| 104 | must also be defined: |
| 105 | |
| 106 | - **#define : MAX_IO_DEVICES** |
| 107 | |
| 108 | Defines the maximum number of registered IO devices. Attempting to register |
| 109 | more devices than this value using ``io_register_device()`` will fail with |
| 110 | ``IO_RESOURCES_EXHAUSTED``. |
| 111 | |
| 112 | - **#define : MAX_IO_HANDLES** |
| 113 | |
| 114 | Defines the maximum number of open IO handles. Attempting to open more IO |
| 115 | entities than this value using ``io_open()`` will fail with |
| 116 | ``IO_RESOURCES_EXHAUSTED``. |
| 117 | |
| 118 | If the platform port uses the VExpress NOR flash driver (see |
| 119 | ``drivers/io/vexpress_nor/``), the following constants must also be defined: |
| 120 | |
| 121 | - **#define : NOR_FLASH_BLOCK_SIZE** |
| 122 | |
| 123 | Defines the largest block size as seen by the software while writing to NOR |
| 124 | flash. |
| 125 | |
| 126 | Function : tftf_plat_arch_setup() [mandatory] |
| 127 | ````````````````````````````````````````````` |
| 128 | :: |
| 129 | |
| 130 | Argument : void |
| 131 | Return : void |
| 132 | |
| 133 | This function performs any platform-specific and architectural setup that the |
| 134 | platform requires. |
| 135 | |
| 136 | In both the ARM FVP and Juno ports, this function configures and enables the |
| 137 | MMU. |
| 138 | |
| 139 | Function : tftf_early_platform_setup() [mandatory] |
| 140 | `````````````````````````````````````````````````` |
| 141 | |
| 142 | :: |
| 143 | |
| 144 | Argument : void |
| 145 | Return : void |
| 146 | |
| 147 | This function executes with the MMU and data caches disabled. It is only called |
| 148 | by the primary CPU. It is used to perform platform-specific actions very early |
| 149 | in the boot. |
| 150 | |
| 151 | In both the ARM FVP and Juno ports, this function configures the console. |
| 152 | |
| 153 | Function : tftf_platform_setup() [mandatory] |
| 154 | ```````````````````````````````````````````` |
| 155 | |
| 156 | :: |
| 157 | |
| 158 | Argument : void |
| 159 | Return : void |
| 160 | |
| 161 | This function executes with the MMU and data caches enabled. It is responsible |
| 162 | for performing any remaining platform-specific setup that can occur after the |
| 163 | MMU and data cache have been enabled. |
| 164 | |
| 165 | This function is also responsible for initializing the storage abstraction layer |
| 166 | used to access non-volatile memory for permanent storage of test results. It |
| 167 | also initialises the GIC and detects the platform topology using |
| 168 | platform-specific means. |
| 169 | |
| 170 | Function : plat_get_nvm_handle() [mandatory] |
| 171 | ```````````````````````````````````````````` |
| 172 | |
| 173 | :: |
| 174 | |
| 175 | Argument : uintptr_t * |
| 176 | Return : void |
| 177 | |
| 178 | It is needed if the platform port uses IO storage framework. This function is |
| 179 | responsible for getting the pointer to the initialised non-volatile memory |
| 180 | entity. |
| 181 | |
| 182 | Function : tftf_plat_get_pwr_domain_tree_desc() [mandatory] |
| 183 | ``````````````````````````````````````````````````````````` |
| 184 | |
| 185 | :: |
| 186 | |
| 187 | Argument : void |
| 188 | Return : const unsigned char * |
| 189 | |
| 190 | This function returns the platform topology description array in a suitable |
| 191 | format as expected by TFTF. The size of the array is expected to be |
| 192 | ``PLATFORM_NUM_AFFS - PLATFORM_CORE_COUNT + 1``. The format used to describe |
| 193 | this array is : |
| 194 | |
| 195 | 1. The first entry in the array specifies the number of power domains at the |
| 196 | highest power level implemented in the platform. This caters for platforms |
| 197 | where the power domain tree does not have a single root node e.g. the FVP |
| 198 | which has two cluster power domains at the highest level (that is, 1). |
| 199 | |
| 200 | 2. Each subsequent entry corresponds to a power domain and contains the number |
| 201 | of power domains that are its direct children. |
| 202 | |
| 203 | The array format is the same as the one used by Trusted Firmware-A and more |
| 204 | details of its description can be found in the Trusted Firmware-A documentation: |
| 205 | `docs/psci-pd-tree.rst`_. |
| 206 | |
| 207 | Function : tftf_plat_get_mpidr() [mandatory] |
| 208 | ```````````````````````````````````````````` |
| 209 | |
| 210 | :: |
| 211 | |
| 212 | Argument : unsigned int |
| 213 | Return : uint64_t |
| 214 | |
| 215 | This function converts a given `core_pos` into a valid MPIDR if the CPU is |
| 216 | present in the platform. The `core_pos` is a unique number less than the |
| 217 | ``PLATFORM_CORE_COUNT`` returned by ``platform_get_core_pos()`` for a given |
| 218 | CPU. This API is used by the topology framework in TFTF to query the presence of |
| 219 | a CPU and, if present, returns the corresponding MPIDR for it. If the CPU |
| 220 | referred to by the `core_pos` is absent, then this function returns |
| 221 | ``INVALID_MPID``. |
| 222 | |
| 223 | Function : plat_get_state_prop() [mandatory] |
| 224 | ```````````````````````````````````````````` |
| 225 | |
| 226 | :: |
| 227 | |
| 228 | Argument : unsigned int |
| 229 | Return : const plat_state_prop_t * |
| 230 | |
| 231 | This functions returns the ``plat_state_prop_t`` array for all the valid low |
| 232 | power states from platform for a specified affinity level and returns ``NULL`` |
| 233 | for an invalid affinity level. The array is expected to be NULL-terminated. |
| 234 | This function is expected to be used by tests that need to compose the power |
| 235 | state parameter for use in ``PSCI_CPU_SUSPEND`` API or ``PSCI_STAT/RESIDENCY`` |
| 236 | API. |
| 237 | |
| 238 | Function : plat_fwu_io_setup() [mandatory] |
| 239 | `````````````````````````````````````````` |
| 240 | |
| 241 | :: |
| 242 | |
| 243 | Argument : void |
| 244 | Return : void |
| 245 | |
| 246 | This function initializes the IO system used by the firmware update. |
| 247 | |
| 248 | Function : plat_arm_gic_init() [mandatory] |
| 249 | `````````````````````````````````````````` |
| 250 | |
| 251 | :: |
| 252 | |
| 253 | Argument : void |
| 254 | Return : void |
| 255 | |
| 256 | This function initializes the ARM Generic Interrupt Controller (GIC). |
| 257 | |
Antonio Nino Diaz | 1cf45c9 | 2018-10-15 09:03:43 +0100 | [diff] [blame] | 258 | Function : platform_get_core_pos() [mandatory] |
| 259 | `````````````````````````````````````````````` |
| 260 | |
| 261 | :: |
| 262 | |
| 263 | Argument : u_register_t |
| 264 | Return : unsigned int |
| 265 | |
| 266 | This function returns a linear core ID from a MPID. |
| 267 | |
| 268 | Function : plat_crash_console_init() [mandatory] |
| 269 | ```````````````````````````````````````````````` |
| 270 | |
| 271 | :: |
| 272 | |
| 273 | Argument : void |
| 274 | Return : int |
| 275 | |
| 276 | This function initializes a platform-specific console for crash reporting. |
| 277 | |
| 278 | Function : plat_crash_console_putc() [mandatory] |
| 279 | ```````````````````````````````````````````````` |
| 280 | |
| 281 | :: |
| 282 | |
| 283 | Argument : int |
| 284 | Return : int |
| 285 | |
| 286 | This function prints a character on the platform-specific crash console. |
| 287 | |
| 288 | Function : plat_crash_console_flush() [mandatory] |
| 289 | ````````````````````````````````````````````````` |
| 290 | |
| 291 | :: |
| 292 | |
| 293 | Argument : void |
| 294 | Return : int |
| 295 | |
| 296 | This function waits until all the characters of the platform-specific crash |
| 297 | console have been actually printed. |
| 298 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 299 | -------------- |
| 300 | |
Jimmy Brisson | a48f507 | 2020-04-02 15:19:16 -0500 | [diff] [blame] | 301 | *Copyright (c) 2019, Arm Limited. All rights reserved.* |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 302 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 303 | .. _SP805: https://static.docs.arm.com/ddi0270/b/DDI0270.pdf |
Jimmy Brisson | a48f507 | 2020-04-02 15:19:16 -0500 | [diff] [blame] | 304 | .. _docs/psci-pd-tree.rst: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/psci-pd-tree.rst |