blob: 51b09841bb2e7f977bbc139d3ff09b5364388721 [file] [log] [blame]
Javier Almansa Sobrino68a593a2022-07-25 09:35:32 +01001/*
2 * SPDX-License-Identifier: BSD-3-Clause
3 * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4 */
5
6#include <buffer.h>
7#include <xlat_tables.h>
8
9/*
10 * The VA space size for the high region, which maps the slot buffers,
11 * needs to be a power of two, so round NR_CPU_SLOTS up to the closest
12 * power of two.
13 */
14#define ROUNDED_NR_CPU_SLOTS (1ULL << (64ULL - \
15 __builtin_clzll((NR_CPU_SLOTS) - 1)))
16
17#define RMM_SLOT_BUF_VA_SIZE ((ROUNDED_NR_CPU_SLOTS) * (GRANULE_SIZE))
18
19#define SLOT_VIRT ((ULL(0xffffffffffffffff) - \
20 RMM_SLOT_BUF_VA_SIZE + ULL(1)))
21
22struct xlat_table_entry *get_cache_entry(void);
23uintptr_t slot_to_va(enum buffer_slot slot);