Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 1 | /* |
Mate Toth-Pal | 65291f3 | 2018-02-23 14:35:22 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
Mate Toth-Pal | 52674ab | 2018-02-26 09:47:56 +0100 | [diff] [blame] | 8 | #ifndef __SPM_DB_H__ |
| 9 | #define __SPM_DB_H__ |
Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 10 | |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 11 | typedef int32_t(*sp_init_function)(void); |
Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 12 | |
Mate Toth-Pal | e147533 | 2018-04-09 17:28:49 +0200 | [diff] [blame] | 13 | /** |
| 14 | * Holds the fields of the partition DB used by the SPM code. The values of |
| 15 | * these fields are calculated at compile time, and set during initialisation |
| 16 | * phase. |
| 17 | */ |
Mate Toth-Pal | 18b8392 | 2018-02-26 17:58:18 +0100 | [diff] [blame] | 18 | struct spm_partition_static_data_t { |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 19 | uint32_t partition_id; |
Mate Toth-Pal | 5939871 | 2018-02-28 17:06:40 +0100 | [diff] [blame] | 20 | uint32_t partition_flags; |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 21 | sp_init_function partition_init; |
Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 22 | }; |
Mate Toth-Pal | 18b8392 | 2018-02-26 17:58:18 +0100 | [diff] [blame] | 23 | |
Mate Toth-Pal | e147533 | 2018-04-09 17:28:49 +0200 | [diff] [blame] | 24 | /** |
| 25 | * Holds the fields that define a partition for SPM. The fields are further |
| 26 | * divided to structures, to keep the related fields close to each other. |
| 27 | */ |
Mate Toth-Pal | 936c33b | 2018-04-10 14:02:07 +0200 | [diff] [blame] | 28 | struct spm_partition_desc_t { |
Mate Toth-Pal | 18b8392 | 2018-02-26 17:58:18 +0100 | [diff] [blame] | 29 | struct spm_partition_static_data_t static_data; |
| 30 | struct spm_partition_runtime_data_t runtime_data; |
Mate Toth-Pal | 936c33b | 2018-04-10 14:02:07 +0200 | [diff] [blame] | 31 | struct tfm_spm_partition_platform_data_t *platform_data; |
| 32 | #if TFM_LVL != 1 |
| 33 | struct tfm_spm_partition_memory_data_t memory_data; |
| 34 | #endif |
Mate Toth-Pal | 18b8392 | 2018-02-26 17:58:18 +0100 | [diff] [blame] | 35 | }; |
Miklos Balint | 386b8b5 | 2017-11-29 13:12:32 +0000 | [diff] [blame] | 36 | |
Mate Toth-Pal | 936c33b | 2018-04-10 14:02:07 +0200 | [diff] [blame] | 37 | /* Macros to pick linker symbols and allow to form the partition data base */ |
| 38 | #define REGION(a, b, c) a##b##c |
| 39 | #define REGION_NAME(a, b, c) REGION(a, b, c) |
| 40 | #if TFM_LVL == 1 |
| 41 | #define REGION_DECLARE(a, b, c) |
| 42 | #else |
| 43 | #define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c) |
| 44 | #define PART_REGION_ADDR(partition, region) \ |
| 45 | (uint32_t)®ION_NAME(Image$$, partition, region) |
| 46 | #endif |
| 47 | |
Mate Toth-Pal | 52674ab | 2018-02-26 09:47:56 +0100 | [diff] [blame] | 48 | #endif /* __SPM_DB_H__ */ |