aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/include/load/partition_static_load.h
blob: 70248b6e666f0fd9ec4eb2343342b9485221a00e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (c) 2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */

#ifndef __PARTITION_STATIC_LOAD_H__
#define __PARTITION_STATIC_LOAD_H__

#include "partition_defs.h"
#include "service_defs.h"

#define PARTITION_GET_PRIOR(flag)           ((flag) & PARTITION_PRI_MASK)
#define TO_THREAD_PRIORITY(x)               (x)

#define STRID_TO_STRING_PTR(strid)          (const char *)(strid)
#define STRING_PTR_TO_STRID(str)            (uintptr_t)(str)

#define ENTRY_TO_POSITION(x)                (uintptr_t)(x)
#define POSITION_TO_ENTRY(x, t)             (t)(x)

#define PTR_TO_POSITION(x)                  (uintptr_t)(x)
#define POSITION_TO_PTR(x, t)               (t)(x)

/* Length of extendable variables in partition static type */
#define STATIC_INFO_EXT_LENGTH              2
/*
 * Argument "ps_ptr" must have be a "struct partition_static_info_t *" type and
 * must be validated before using.
 */
#define STATIC_INFSZ_BYTES(ps_ptr)                                      \
    (sizeof(*(ps_ptr)) + STATIC_INFO_EXT_LENGTH * sizeof(uintptr_t) +   \
     (ps_ptr)->ndeps * sizeof(uint32_t) +                               \
     (ps_ptr)->nservices * sizeof(struct service_static_info_t))

#endif /* __PARTITION_STATIC_LOAD_H__ */