blob: 2b26b68c37f0374ab9e1ba654ef476607aff6f74 [file] [log] [blame]
Daniel Boulbyf3da5912022-04-01 12:31:52 +01001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SP_DEF_H
8#define SP_DEF_H
9
10#include <utils_def.h>
11#include <sp_platform_def.h>
12
13/*
14 * Layout of the Secure Partition image.
15 */
16
17/* Up to 2 MiB at an arbitrary address that doesn't overlap the devices. */
18#define SP_IMAGE_BASE ULL(0x1000)
19#define SP_IMAGE_SIZE ULL(0x200000)
20
21/* Memory reserved for stacks */
22#define SP_STACKS_SIZE ULL(0x1000)
23
24/*
25 * RX/TX buffer used by VM's in SPM for memory sharing
26 * Each VM allocated 2 pages, one for RX and one for TX buffer.
27 */
28#define SP_RX_BASE PLAT_SP_RX_BASE
29#define SP_TX_BASE SP_RX_BASE + PAGE_SIZE
30#define SP_RX_TX_SIZE PAGE_SIZE * 2
31
32/*
33 * RX/TX buffer helpers.
34 */
35#define get_sp_rx_start(sp_id) (SP_RX_BASE \
36 + (((sp_id & 0x7FFFU) - 1U) * SP_RX_TX_SIZE))
37#define get_sp_rx_end(sp_id) (SP_RX_BASE \
38 + (((sp_id & 0x7FFFU) - 1U) * SP_RX_TX_SIZE) \
39 + PAGE_SIZE)
40#define get_sp_tx_start(sp_id) (SP_TX_BASE + \
41 (((sp_id & 0x7FFFU) - 1U) * SP_RX_TX_SIZE))
42#define get_sp_tx_end(sp_id) (SP_TX_BASE \
43 + (((sp_id & 0x7FFFU) - 1U) * SP_RX_TX_SIZE) \
44 + PAGE_SIZE)
45
46#endif /* SP_DEF_H */