blob: 573043e337c8b91bc12cd242abd9ca5ecc325103 [file] [log] [blame]
Mingyang Sun00df2352021-04-15 15:46:08 +08001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __PARTITION_DEFS_H__
9#define __PARTITION_DEFS_H__
10
11#include <stddef.h>
12#include <stdint.h>
13
14/* Encode a magic number into version for validating partition info */
15#define PARTITION_INFO_VERSION_MASK (0x0000FFFF)
16#define PARTITION_INFO_MAGIC_MASK (0xFFFF0000)
17#define PARTITION_INFO_MAGIC (0x5F5F0000)
18
19/* Privileged definitions for partition thread mode */
20#define TFM_PARTITION_UNPRIVILEGED_MODE (0U)
21#define TFM_PARTITION_PRIVILEGED_MODE (1U)
22
23/*
24 * Partition static data - flags
25 * bit 7-0: priority
26 * bit 8: 1 - PSA_ROT, 0 - APP_ROT
27 * bit 9: 1 - IPC model, 0 - SFN model
28 */
29#define PARTITION_PRI_HIGHEST (0x0)
30#define PARTITION_PRI_HIGH (0xF)
31#define PARTITION_PRI_NORMAL (0x1F)
32#define PARTITION_PRI_LOW (0x7F)
33#define PARTITION_PRI_LOWEST (0xFF)
34#define PARTITION_PRI_MASK (0xFF)
35
36#define SPM_PART_FLAG_PSA_ROT (1U << 8)
37#define SPM_PART_FLAG_IPC (1U << 9)
38
39#if TFM_LVL == 3
40/**
41 * Holds isolation memory regions used by a partition. Could be extended if
42 * more isolation regions are required.
43 */
44struct private_data_t {
45 uintptr_t start;
46 uintptr_t limit;
47};
48#endif
49
50/* Common partition structure type */
51struct partition_static_info_t {
52 uint32_t psa_ff_ver; /* Encode the version with magic */
53 uint32_t pid; /* Partition ID */
54 uint32_t flags; /* ARoT/PRoT, SFN/IPC, priority */
55 uintptr_t entry; /* Entry point */
56 size_t stack_size; /* Stack size */
57 size_t heap_size; /* Heap size */
58 uint32_t ndeps; /* Dependency number */
59 uint32_t nservices; /* Service number */
60 uintptr_t plat_cookie; /* A cookie for platform binding */
61#if TFM_LVL == 3
62 struct private_data_t mems; /* Partition isolation memory data */
63#endif
64 uintptr_t vars[]; /* Struct extendable indicator */
65} __attribute__((aligned(4)));
66
67#endif /* __PARTITION_DEFS_H__ */