1#
2# SPDX-License-Identifier: BSD-3-Clause
3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4#
5
6#
7# This cmake file is meant to be included from plat CMakelists.txt
8#
9add_library(rmm-plat-common)
10
11target_link_libraries(rmm-plat-common
12    PRIVATE rmm-lib
13            rmm-el2-stub)
14
15#
16# PLAT_CMN_CTX_MAX_XLAT_TABLES is allowed to be 0, and in case when there are
17# not enough tables the xlat tables creation will fail.
18#
19arm_config_option(
20    NAME PLAT_CMN_CTX_MAX_XLAT_TABLES
21    HELP "Maximum number of translation tables to be allocated for the static xlat tables"
22    DEFAULT 0x0
23    TYPE STRING)
24
25#
26# Number of extra mmap regions to be allocated for a given platform.
27# This is allowed to be 0. If the number of platform memory regions
28# needed by a given platform is lower than PLAT_CMN_EXTRA_MMAP_REGIONS,
29# the xlat library should fail when trying to initialize the context.
30#
31arm_config_option(
32    NAME PLAT_CMN_EXTRA_MMAP_REGIONS
33    HELP "Extra platform mmap regions that need to be mapped in S1 xlat tables"
34    DEFAULT 0
35    TYPE STRING)
36
37#
38# Default Stage 1 virtual address space width for a given platform.
39#
40arm_config_option(
41    NAME PLAT_CMN_VIRT_ADDR_SPACE_WIDTH
42    HELP "Size in bits of the virtual address space."
43    DEFAULT 38
44    TYPE STRING
45    ADVANCED)
46
47if(PLAT_CMN_VIRT_ADDR_SPACE_WIDTH EQUAL 0x0)
48    message(FATAL_ERROR "PLAT_CMN_VIRT_ADDR_SPACE_WIDTH is not initialized")
49endif()
50
51target_compile_definitions(rmm-plat-common
52    PRIVATE "PLAT_CMN_CTX_MAX_XLAT_TABLES=U(${PLAT_CMN_CTX_MAX_XLAT_TABLES})")
53
54target_compile_definitions(rmm-plat-common
55    PRIVATE "PLAT_CMN_EXTRA_MMAP_REGIONS=U(${PLAT_CMN_EXTRA_MMAP_REGIONS})")
56
57target_compile_definitions(rmm-plat-common
58    PRIVATE "PLAT_CMN_VIRT_ADDR_SPACE_SIZE=(1ULL << ULL(${PLAT_CMN_VIRT_ADDR_SPACE_WIDTH}))")
59
60target_include_directories(rmm-plat-common
61    PUBLIC "include"
62    PRIVATE "src/${RMM_ARCH}")
63
64target_sources(rmm-plat-common
65    PRIVATE "src/plat_common_init.c")
66