blob: 4b3b41388c5a4847bb983c683e9cc653b5aaa9d9 [file] [log] [blame]
Miklos Balint386b8b52017-11-29 13:12:32 +00001/*
Mate Toth-Pal65291f32018-02-23 14:35:22 +01002 * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Miklos Balint386b8b52017-11-29 13:12:32 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Mate Toth-Pal52674ab2018-02-26 09:47:56 +01008#ifndef __SPM_DB_H__
9#define __SPM_DB_H__
Miklos Balint386b8b52017-11-29 13:12:32 +000010
Mate Toth-Pal349714a2018-02-23 15:30:24 +010011typedef int32_t(*sp_init_function)(void);
Miklos Balint386b8b52017-11-29 13:12:32 +000012
Mate Toth-Pale1475332018-04-09 17:28:49 +020013/**
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-Pal18b83922018-02-26 17:58:18 +010018struct spm_partition_static_data_t {
Mate Toth-Pal349714a2018-02-23 15:30:24 +010019 uint32_t partition_id;
Mate Toth-Pal59398712018-02-28 17:06:40 +010020 uint32_t partition_flags;
Mate Toth-Pal349714a2018-02-23 15:30:24 +010021 sp_init_function partition_init;
Miklos Balint386b8b52017-11-29 13:12:32 +000022};
Mate Toth-Pal18b83922018-02-26 17:58:18 +010023
Mate Toth-Pale1475332018-04-09 17:28:49 +020024/**
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-Pal936c33b2018-04-10 14:02:07 +020028struct spm_partition_desc_t {
Mate Toth-Pal18b83922018-02-26 17:58:18 +010029 struct spm_partition_static_data_t static_data;
30 struct spm_partition_runtime_data_t runtime_data;
Mate Toth-Pal936c33b2018-04-10 14:02:07 +020031 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-Pal18b83922018-02-26 17:58:18 +010035};
Miklos Balint386b8b52017-11-29 13:12:32 +000036
Mate Toth-Pal936c33b2018-04-10 14:02:07 +020037/* 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)&REGION_NAME(Image$$, partition, region)
46#endif
47
Mate Toth-Pal52674ab2018-02-26 09:47:56 +010048#endif /* __SPM_DB_H__ */