blob: 66074ac17c9c277d59e93408c5b09dcdfe212257 [file] [log] [blame]
Dan Handleyb4315302015-03-19 18:58:55 +00001/*
Joel Hutton9f85f9e2018-03-21 11:40:57 +00002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Dan Handleyb4315302015-03-19 18:58:55 +00003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Dan Handleyb4315302015-03-19 18:58:55 +00005 */
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00006#ifndef COMMON_DEF_H
7#define COMMON_DEF_H
Dan Handleyb4315302015-03-19 18:58:55 +00008
Yatharth Kochar7baff112015-10-09 18:06:13 +01009#include <bl_common.h>
10#include <platform_def.h>
Antonio Nino Diaz81542c02018-10-04 09:55:23 +010011#include <utils_def.h>
Antonio Nino Diaz93c78ed2018-08-16 16:52:57 +010012#include <xlat_tables_defs.h>
Yatharth Kochar7baff112015-10-09 18:06:13 +010013
Dan Handleyb4315302015-03-19 18:58:55 +000014/******************************************************************************
15 * Required platform porting definitions that are expected to be common to
16 * all platforms
17 *****************************************************************************/
18
19/*
20 * Platform binary types for linking
21 */
Yatharth Kochar1a0a3f02016-06-28 16:58:26 +010022#ifdef AARCH32
23#define PLATFORM_LINKER_FORMAT "elf32-littlearm"
24#define PLATFORM_LINKER_ARCH arm
25#else
Dan Handleyb4315302015-03-19 18:58:55 +000026#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
27#define PLATFORM_LINKER_ARCH aarch64
Yatharth Kochar1a0a3f02016-06-28 16:58:26 +010028#endif /* AARCH32 */
Dan Handleyb4315302015-03-19 18:58:55 +000029
30/*
31 * Generic platform constants
32 */
33#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
34
Yatharth Kochar42019bf2016-09-12 16:10:33 +010035#define BL2_IMAGE_DESC { \
36 .image_id = BL2_IMAGE_ID, \
37 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, \
38 VERSION_2, image_info_t, 0), \
39 .image_info.image_base = BL2_BASE, \
40 .image_info.image_max_size = BL2_LIMIT - BL2_BASE,\
41 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, \
42 VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),\
43 .ep_info.pc = BL2_BASE, \
44}
Yatharth Kochar7baff112015-10-09 18:06:13 +010045
Sandrine Bailleux0af559a2016-07-08 14:38:16 +010046/*
47 * The following constants identify the extents of the code & read-only data
48 * regions. These addresses are used by the MMU setup code and therefore they
49 * must be page-aligned.
50 *
51 * When the code and read-only data are mapped as a single atomic section
52 * (i.e. when SEPARATE_CODE_AND_RODATA=0) then we treat the whole section as
53 * code by specifying the read-only data section as empty.
54 *
55 * BL1 is different than the other images in the sense that its read-write data
56 * originally lives in Trusted ROM and needs to be relocated in Trusted SRAM at
57 * run-time. Therefore, the read-write data in ROM can be mapped with the same
58 * memory attributes as the read-only data region. For this reason, BL1 uses
59 * different macros.
60 *
61 * Note that BL1_ROM_END is not necessarily aligned on a page boundary as it
62 * just points to the end of BL1's actual content in Trusted ROM. Therefore it
63 * needs to be rounded up to the next page size in order to map the whole last
64 * page of it with the right memory attributes.
65 */
66#if SEPARATE_CODE_AND_RODATA
Dan Handleyb4315302015-03-19 18:58:55 +000067
Masahiro Yamadaecdc8982017-01-18 02:10:08 +090068#define BL1_CODE_END BL_CODE_END
Joel Hutton9f85f9e2018-03-21 11:40:57 +000069#define BL1_RO_DATA_BASE BL_RO_DATA_BASE
Masahiro Yamadaecdc8982017-01-18 02:10:08 +090070#define BL1_RO_DATA_END round_up(BL1_ROM_END, PAGE_SIZE)
Jiafei Pan7d173fc2018-03-21 07:20:09 +000071#if BL2_IN_XIP_MEM
72#define BL2_CODE_END BL_CODE_END
73#define BL2_RO_DATA_BASE BL_RO_DATA_BASE
74#define BL2_RO_DATA_END round_up(BL2_ROM_END, PAGE_SIZE)
75#endif /* BL2_IN_XIP_MEM */
Sandrine Bailleux0af559a2016-07-08 14:38:16 +010076#else
Antonio Nino Diaz81542c02018-10-04 09:55:23 +010077#define BL_RO_DATA_BASE UL(0)
78#define BL_RO_DATA_END UL(0)
Masahiro Yamadaecdc8982017-01-18 02:10:08 +090079#define BL1_CODE_END round_up(BL1_ROM_END, PAGE_SIZE)
Jiafei Pan7d173fc2018-03-21 07:20:09 +000080#if BL2_IN_XIP_MEM
Antonio Nino Diaz81542c02018-10-04 09:55:23 +010081#define BL2_RO_DATA_BASE UL(0)
82#define BL2_RO_DATA_END UL(0)
Jiafei Pan7d173fc2018-03-21 07:20:09 +000083#define BL2_CODE_END round_up(BL2_ROM_END, PAGE_SIZE)
84#endif /* BL2_IN_XIP_MEM */
Sandrine Bailleux0af559a2016-07-08 14:38:16 +010085#endif /* SEPARATE_CODE_AND_RODATA */
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000086
87#endif /* COMMON_DEF_H */