blob: 0ce0cacb45bc1f770ea5119251b921f918227029 [file] [log] [blame]
Sandrine Bailleux090c8492017-05-19 09:59:37 +01001/*
Antonio Nino Diaz50eb3742018-07-24 10:20:53 +01002 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Sandrine Bailleux090c8492017-05-19 09:59:37 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz50eb3742018-07-24 10:20:53 +01007#ifndef XLAT_TABLES_ARCH_H
8#define XLAT_TABLES_ARCH_H
Sandrine Bailleux090c8492017-05-19 09:59:37 +01009
Julius Werner8e0ef0f2019-07-09 14:02:43 -070010#ifdef __aarch64__
Sandrine Bailleux090c8492017-05-19 09:59:37 +010011#include "aarch64/xlat_tables_aarch64.h"
Julius Werner8e0ef0f2019-07-09 14:02:43 -070012#else
13#include "aarch32/xlat_tables_aarch32.h"
Sandrine Bailleux090c8492017-05-19 09:59:37 +010014#endif
15
16/*
Sandrine Bailleux090c8492017-05-19 09:59:37 +010017 * Evaluates to 1 if the given physical address space size is a power of 2,
18 * or 0 if it's not.
19 */
20#define CHECK_PHY_ADDR_SPACE_SIZE(size) \
21 (IS_POWER_OF_TWO(size))
22
23/*
24 * Compute the number of entries required at the initial lookup level to address
25 * the whole virtual address space.
26 */
27#define GET_NUM_BASE_LEVEL_ENTRIES(addr_space_size) \
28 ((addr_space_size) >> \
29 XLAT_ADDR_SHIFT(GET_XLAT_TABLE_LEVEL_BASE(addr_space_size)))
30
Antonio Nino Diaz50eb3742018-07-24 10:20:53 +010031#endif /* XLAT_TABLES_ARCH_H */