diff options
Diffstat (limited to 'include/lib')
-rw-r--r-- | include/lib/xlat_tables/aarch32/xlat_tables_aarch32.h | 17 | ||||
-rw-r--r-- | include/lib/xlat_tables/aarch64/xlat_tables_aarch64.h | 24 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_mmu_helpers.h | 7 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables.h | 8 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables_arch.h | 12 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables_defs.h | 34 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables_v2.h | 16 | ||||
-rw-r--r-- | include/lib/xlat_tables/xlat_tables_v2_helpers.h | 104 |
8 files changed, 114 insertions, 108 deletions
diff --git a/include/lib/xlat_tables/aarch32/xlat_tables_aarch32.h b/include/lib/xlat_tables/aarch32/xlat_tables_aarch32.h index 808589ac..37f3b53b 100644 --- a/include/lib/xlat_tables/aarch32/xlat_tables_aarch32.h +++ b/include/lib/xlat_tables/aarch32/xlat_tables_aarch32.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_AARCH32_H__ -#define __XLAT_TABLES_AARCH32_H__ +#ifndef XLAT_TABLES_AARCH32_H +#define XLAT_TABLES_AARCH32_H #include <arch.h> #include <utils_def.h> @@ -24,7 +24,7 @@ * The define below specifies the first table level that allows block * descriptors. */ -#if PAGE_SIZE != (4 * 1024) +#if PAGE_SIZE != PAGE_SIZE_4KB #error "Invalid granule size. AArch32 supports 4KB pages only." #endif @@ -43,8 +43,8 @@ * [1] See the ARMv8-A Architecture Reference Manual (DDI 0487A.j) for more * information, Section G4.6.5 */ -#define MIN_VIRT_ADDR_SPACE_SIZE (ULL(1) << (32 - TTBCR_TxSZ_MAX)) -#define MAX_VIRT_ADDR_SPACE_SIZE (ULL(1) << (32 - TTBCR_TxSZ_MIN)) +#define MIN_VIRT_ADDR_SPACE_SIZE (ULL(1) << (U(32) - TTBCR_TxSZ_MAX)) +#define MAX_VIRT_ADDR_SPACE_SIZE (ULL(1) << (U(32) - TTBCR_TxSZ_MIN)) /* * Here we calculate the initial lookup level from the value of the given @@ -66,7 +66,8 @@ * valid. Therefore, the caller is expected to check it is the case using the * CHECK_VIRT_ADDR_SPACE_SIZE() macro first. */ -#define GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_size) \ - (((_virt_addr_space_size) > (ULL(1) << L1_XLAT_ADDRESS_SHIFT)) ? 1 : 2) +#define GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_sz) \ + (((_virt_addr_space_sz) > (ULL(1) << L1_XLAT_ADDRESS_SHIFT)) ? \ + U(1) : U(2)) -#endif /* __XLAT_TABLES_AARCH32_H__ */ +#endif /* XLAT_TABLES_AARCH32_H */ diff --git a/include/lib/xlat_tables/aarch64/xlat_tables_aarch64.h b/include/lib/xlat_tables/aarch64/xlat_tables_aarch64.h index ad48a358..91ca8e47 100644 --- a/include/lib/xlat_tables/aarch64/xlat_tables_aarch64.h +++ b/include/lib/xlat_tables/aarch64/xlat_tables_aarch64.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_AARCH64_H__ -#define __XLAT_TABLES_AARCH64_H__ +#ifndef XLAT_TABLES_AARCH64_H +#define XLAT_TABLES_AARCH64_H #include <arch.h> #include <utils_def.h> @@ -30,9 +30,9 @@ unsigned long long tcr_physical_addr_size_bits(unsigned long long max_addr); * The define below specifies the first table level that allows block * descriptors. */ -#if PAGE_SIZE == (4 * 1024) +#if PAGE_SIZE == PAGE_SIZE_4KB # define MIN_LVL_BLOCK_DESC U(1) -#elif PAGE_SIZE == (16 * 1024) || PAGE_SIZE == (64 * 1024) +#elif (PAGE_SIZE == PAGE_SIZE_16KB) || (PAGE_SIZE == PAGE_SIZE_64KB) # define MIN_LVL_BLOCK_DESC U(2) #endif @@ -50,8 +50,8 @@ unsigned long long tcr_physical_addr_size_bits(unsigned long long max_addr); * information: * Page 1730: 'Input address size', 'For all translation stages'. */ -#define MIN_VIRT_ADDR_SPACE_SIZE (ULL(1) << (64 - TCR_TxSZ_MAX)) -#define MAX_VIRT_ADDR_SPACE_SIZE (ULL(1) << (64 - TCR_TxSZ_MIN)) +#define MIN_VIRT_ADDR_SPACE_SIZE (ULL(1) << (U(64) - TCR_TxSZ_MAX)) +#define MAX_VIRT_ADDR_SPACE_SIZE (ULL(1) << (U(64) - TCR_TxSZ_MIN)) /* * Here we calculate the initial lookup level from the value of the given @@ -74,10 +74,10 @@ unsigned long long tcr_physical_addr_size_bits(unsigned long long max_addr); * valid. Therefore, the caller is expected to check it is the case using the * CHECK_VIRT_ADDR_SPACE_SIZE() macro first. */ -#define GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_size) \ - (((_virt_addr_space_size) > (ULL(1) << L0_XLAT_ADDRESS_SHIFT)) \ - ? 0 \ - : (((_virt_addr_space_size) > (ULL(1) << L1_XLAT_ADDRESS_SHIFT)) \ - ? 1 : 2)) +#define GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_sz) \ + (((_virt_addr_space_sz) > (ULL(1) << L0_XLAT_ADDRESS_SHIFT)) \ + ? 0U \ + : (((_virt_addr_space_sz) > (ULL(1) << L1_XLAT_ADDRESS_SHIFT)) \ + ? 1U : 2U)) -#endif /* __XLAT_TABLES_AARCH64_H__ */ +#endif /* XLAT_TABLES_AARCH64_H */ diff --git a/include/lib/xlat_tables/xlat_mmu_helpers.h b/include/lib/xlat_tables/xlat_mmu_helpers.h index a290a92d..3906efb4 100644 --- a/include/lib/xlat_tables/xlat_mmu_helpers.h +++ b/include/lib/xlat_tables/xlat_mmu_helpers.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_MMU_HELPERS_H__ -#define __XLAT_MMU_HELPERS_H__ +#ifndef XLAT_MMU_HELPERS_H +#define XLAT_MMU_HELPERS_H /* * The following flags are passed to enable_mmu_xxx() to override the default @@ -52,6 +52,7 @@ #ifndef __ASSEMBLY__ +#include <stdint.h> #include <sys/types.h> /* @@ -82,4 +83,4 @@ size_t xlat_arch_get_max_supported_granule_size(void); #endif /* __ASSEMBLY__ */ -#endif /* __XLAT_MMU_HELPERS_H__ */ +#endif /* XLAT_MMU_HELPERS_H */ diff --git a/include/lib/xlat_tables/xlat_tables.h b/include/lib/xlat_tables/xlat_tables.h index c017e193..4097c76f 100644 --- a/include/lib/xlat_tables/xlat_tables.h +++ b/include/lib/xlat_tables/xlat_tables.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_H__ -#define __XLAT_TABLES_H__ +#ifndef XLAT_TABLES_H +#define XLAT_TABLES_H #include <xlat_tables_defs.h> @@ -92,4 +92,4 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, void mmap_add(const mmap_region_t *mm); #endif /*__ASSEMBLY__*/ -#endif /* __XLAT_TABLES_H__ */ +#endif /* XLAT_TABLES_H */ diff --git a/include/lib/xlat_tables/xlat_tables_arch.h b/include/lib/xlat_tables/xlat_tables_arch.h index af8c4633..251b0206 100644 --- a/include/lib/xlat_tables/xlat_tables_arch.h +++ b/include/lib/xlat_tables/xlat_tables_arch.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_ARCH_H__ -#define __XLAT_TABLES_ARCH_H__ +#ifndef XLAT_TABLES_ARCH_H +#define XLAT_TABLES_ARCH_H #ifdef AARCH32 #include "aarch32/xlat_tables_aarch32.h" @@ -21,8 +21,8 @@ * limits. Not that these limits are different for AArch32 and AArch64. */ #define CHECK_VIRT_ADDR_SPACE_SIZE(size) \ - (((unsigned long long)(size) >= MIN_VIRT_ADDR_SPACE_SIZE) && \ - ((unsigned long long)(size) <= MAX_VIRT_ADDR_SPACE_SIZE) && \ + (((unsigned long long)(size) >= MIN_VIRT_ADDR_SPACE_SIZE) && \ + ((unsigned long long)(size) <= MAX_VIRT_ADDR_SPACE_SIZE) && \ IS_POWER_OF_TWO(size)) /* @@ -40,4 +40,4 @@ ((addr_space_size) >> \ XLAT_ADDR_SHIFT(GET_XLAT_TABLE_LEVEL_BASE(addr_space_size))) -#endif /* __XLAT_TABLES_ARCH_H__ */ +#endif /* XLAT_TABLES_ARCH_H */ diff --git a/include/lib/xlat_tables/xlat_tables_defs.h b/include/lib/xlat_tables/xlat_tables_defs.h index c9d54177..d260c3ef 100644 --- a/include/lib/xlat_tables/xlat_tables_defs.h +++ b/include/lib/xlat_tables/xlat_tables_defs.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_DEFS_H__ -#define __XLAT_TABLES_DEFS_H__ +#ifndef XLAT_TABLES_DEFS_H +#define XLAT_TABLES_DEFS_H #include <arch.h> #include <utils_def.h> @@ -24,6 +24,10 @@ #define TWO_MB_INDEX(x) ((x) >> TWO_MB_SHIFT) #define FOUR_KB_INDEX(x) ((x) >> FOUR_KB_SHIFT) +#define PAGE_SIZE_4KB U(4096) +#define PAGE_SIZE_16KB U(16384) +#define PAGE_SIZE_64KB U(65536) + #define INVALID_DESC U(0x0) /* * A block descriptor points to a region of memory bigger than the granule size @@ -66,8 +70,8 @@ */ #define PAGE_SIZE_SHIFT FOUR_KB_SHIFT #define PAGE_SIZE (U(1) << PAGE_SIZE_SHIFT) -#define PAGE_SIZE_MASK (PAGE_SIZE - 1) -#define IS_PAGE_ALIGNED(addr) (((addr) & PAGE_SIZE_MASK) == 0) +#define PAGE_SIZE_MASK (PAGE_SIZE - U(1)) +#define IS_PAGE_ALIGNED(addr) (((addr) & PAGE_SIZE_MASK) == U(0)) #define XLAT_ENTRY_SIZE_SHIFT U(3) /* Each MMU table entry is 8 bytes (1 << 3) */ #define XLAT_ENTRY_SIZE (U(1) << XLAT_ENTRY_SIZE_SHIFT) @@ -80,7 +84,7 @@ /* Values for number of entries in each MMU translation table */ #define XLAT_TABLE_ENTRIES_SHIFT (XLAT_TABLE_SIZE_SHIFT - XLAT_ENTRY_SIZE_SHIFT) #define XLAT_TABLE_ENTRIES (U(1) << XLAT_TABLE_ENTRIES_SHIFT) -#define XLAT_TABLE_ENTRIES_MASK (XLAT_TABLE_ENTRIES - 1) +#define XLAT_TABLE_ENTRIES_MASK (XLAT_TABLE_ENTRIES - U(1)) /* Values to convert a memory address to an index into a translation table */ #define L3_XLAT_ADDRESS_SHIFT PAGE_SIZE_SHIFT @@ -90,9 +94,9 @@ #define XLAT_ADDR_SHIFT(level) (PAGE_SIZE_SHIFT + \ ((XLAT_TABLE_LEVEL_MAX - (level)) * XLAT_TABLE_ENTRIES_SHIFT)) -#define XLAT_BLOCK_SIZE(level) ((u_register_t)1 << XLAT_ADDR_SHIFT(level)) +#define XLAT_BLOCK_SIZE(level) (UL(1) << XLAT_ADDR_SHIFT(level)) /* Mask to get the bits used to index inside a block of a certain level */ -#define XLAT_BLOCK_MASK(level) (XLAT_BLOCK_SIZE(level) - 1) +#define XLAT_BLOCK_MASK(level) (XLAT_BLOCK_SIZE(level) - UL(1)) /* Mask to get the address bits common to a block of a certain table level*/ #define XLAT_ADDR_MASK(level) (~XLAT_BLOCK_MASK(level)) /* @@ -111,13 +115,13 @@ * when stage 1 translations can only support one VA range. */ #define AP2_SHIFT U(0x7) -#define AP2_RO U(0x1) -#define AP2_RW U(0x0) +#define AP2_RO ULL(0x1) +#define AP2_RW ULL(0x0) #define AP1_SHIFT U(0x6) -#define AP1_ACCESS_UNPRIVILEGED U(0x1) -#define AP1_NO_ACCESS_UNPRIVILEGED U(0x0) -#define AP1_RES1 U(0x1) +#define AP1_ACCESS_UNPRIVILEGED ULL(0x1) +#define AP1_NO_ACCESS_UNPRIVILEGED ULL(0x0) +#define AP1_RES1 ULL(0x1) /* * The following definitions must all be passed to the LOWER_ATTRS() macro to @@ -129,9 +133,9 @@ #define AP_NO_ACCESS_UNPRIVILEGED (AP1_NO_ACCESS_UNPRIVILEGED << 4) #define AP_ONE_VA_RANGE_RES1 (AP1_RES1 << 4) #define NS (U(0x1) << 3) -#define ATTR_NON_CACHEABLE_INDEX U(0x2) -#define ATTR_DEVICE_INDEX U(0x1) -#define ATTR_IWBWA_OWBWA_NTR_INDEX U(0x0) +#define ATTR_NON_CACHEABLE_INDEX ULL(0x2) +#define ATTR_DEVICE_INDEX ULL(0x1) +#define ATTR_IWBWA_OWBWA_NTR_INDEX ULL(0x0) #define LOWER_ATTRS(x) (((x) & U(0xfff)) << 2) /* Normal Memory, Outer Write-Through non-transient, Inner Non-cacheable */ diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h index 2e5aba52..fd61fc40 100644 --- a/include/lib/xlat_tables/xlat_tables_v2.h +++ b/include/lib/xlat_tables/xlat_tables_v2.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __XLAT_TABLES_V2_H__ -#define __XLAT_TABLES_V2_H__ +#ifndef XLAT_TABLES_V2_H +#define XLAT_TABLES_V2_H #include <xlat_tables_defs.h> #include <xlat_tables_v2_helpers.h> @@ -27,7 +27,7 @@ /* Helper macro to define an mmap_region_t. */ #define MAP_REGION(_pa, _va, _sz, _attr) \ - _MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, REGION_DEFAULT_GRANULARITY) + MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, REGION_DEFAULT_GRANULARITY) /* Helper macro to define an mmap_region_t with an identity mapping. */ #define MAP_REGION_FLAT(_adr, _sz, _attr) \ @@ -44,7 +44,7 @@ * equivalent to the MAP_REGION() macro. */ #define MAP_REGION2(_pa, _va, _sz, _attr, _gr) \ - _MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, _gr) + MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, _gr) /* * Shifts and masks to access fields of an mmap attribute @@ -163,7 +163,7 @@ typedef struct xlat_ctx xlat_ctx_t; */ #define REGISTER_XLAT_CONTEXT(_ctx_name, _mmap_count, _xlat_tables_count, \ _virt_addr_space_size, _phy_addr_space_size) \ - _REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ + REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ (_xlat_tables_count), \ (_virt_addr_space_size), \ (_phy_addr_space_size), \ @@ -183,7 +183,7 @@ typedef struct xlat_ctx xlat_ctx_t; #define REGISTER_XLAT_CONTEXT2(_ctx_name, _mmap_count, _xlat_tables_count, \ _virt_addr_space_size, _phy_addr_space_size, \ _xlat_regime, _section_name) \ - _REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ + REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ (_xlat_tables_count), \ (_virt_addr_space_size), \ (_phy_addr_space_size), \ @@ -296,7 +296,7 @@ int mmap_remove_dynamic_region_ctx(xlat_ctx_t *ctx, * translation tables are not modified by any other code while this function is * executing. */ -int change_mem_attributes(xlat_ctx_t *ctx, uintptr_t base_va, size_t size, +int change_mem_attributes(const xlat_ctx_t *ctx, uintptr_t base_va, size_t size, uint32_t attr); /* @@ -318,4 +318,4 @@ int get_mem_attributes(const xlat_ctx_t *ctx, uintptr_t base_va, uint32_t *attributes); #endif /*__ASSEMBLY__*/ -#endif /* __XLAT_TABLES_V2_H__ */ +#endif /* XLAT_TABLES_V2_H */ diff --git a/include/lib/xlat_tables/xlat_tables_v2_helpers.h b/include/lib/xlat_tables/xlat_tables_v2_helpers.h index 82d96e7d..d3d2fc4e 100644 --- a/include/lib/xlat_tables/xlat_tables_v2_helpers.h +++ b/include/lib/xlat_tables/xlat_tables_v2_helpers.h @@ -9,10 +9,10 @@ * used outside of this library code. */ -#ifndef __XLAT_TABLES_V2_HELPERS_H__ -#define __XLAT_TABLES_V2_HELPERS_H__ +#ifndef XLAT_TABLES_V2_HELPERS_H +#define XLAT_TABLES_V2_HELPERS_H -#ifndef __XLAT_TABLES_V2_H__ +#ifndef XLAT_TABLES_V2_H #error "Do not include this header file directly. Include xlat_tables_v2.h instead." #endif @@ -32,7 +32,7 @@ struct mmap_region; * the fields of the structure but its parameter list is not guaranteed to * remain stable as we add members to mmap_region_t. */ -#define _MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, _gr) \ +#define MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, _gr) \ { \ .base_pa = (_pa), \ .base_va = (_va), \ @@ -58,7 +58,7 @@ struct xlat_ctx { * null entry. */ struct mmap_region *mmap; - unsigned int mmap_num; + int mmap_num; /* * Array of finer-grain translation tables. @@ -66,7 +66,7 @@ struct xlat_ctx { * contain both level-2 and level-3 entries. */ uint64_t (*tables)[XLAT_TABLE_ENTRIES]; - unsigned int tables_num; + int tables_num; /* * Keep track of how many regions are mapped in each table. The base * table can't be unmapped so it isn't needed to keep track of it. @@ -75,7 +75,7 @@ struct xlat_ctx { int *tables_mapped_regions; #endif /* PLAT_XLAT_TABLES_DYNAMIC */ - unsigned int next_table; + int next_table; /* * Base translation table. It doesn't need to have the same amount of @@ -96,7 +96,7 @@ struct xlat_ctx { unsigned int base_level; /* Set to 1 when the translation tables are initialized. */ - unsigned int initialized; + int initialized; /* * Translation regime managed by this xlat_ctx_t. It should be one of @@ -106,60 +106,60 @@ struct xlat_ctx { }; #if PLAT_XLAT_TABLES_DYNAMIC -#define _ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ +#define XLAT_ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ static int _ctx_name##_mapped_regions[_xlat_tables_count]; -#define _REGISTER_DYNMAP_STRUCT(_ctx_name) \ +#define XLAT_REGISTER_DYNMAP_STRUCT(_ctx_name) \ .tables_mapped_regions = _ctx_name##_mapped_regions, #else -#define _ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ +#define XLAT_ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ /* do nothing */ -#define _REGISTER_DYNMAP_STRUCT(_ctx_name) \ +#define XLAT_REGISTER_DYNMAP_STRUCT(_ctx_name) \ /* do nothing */ #endif /* PLAT_XLAT_TABLES_DYNAMIC */ -#define _REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, _mmap_count, _xlat_tables_count, \ - _virt_addr_space_size, _phy_addr_space_size, \ - _xlat_regime, _section_name) \ - CASSERT(CHECK_VIRT_ADDR_SPACE_SIZE(_virt_addr_space_size), \ - assert_invalid_virtual_addr_space_size_for_##_ctx_name); \ - \ - CASSERT(CHECK_PHY_ADDR_SPACE_SIZE(_phy_addr_space_size), \ - assert_invalid_physical_addr_space_sizefor_##_ctx_name); \ - \ - static mmap_region_t _ctx_name##_mmap[_mmap_count + 1]; \ - \ - static uint64_t _ctx_name##_xlat_tables[_xlat_tables_count] \ - [XLAT_TABLE_ENTRIES] \ - __aligned(XLAT_TABLE_SIZE) __section(_section_name); \ - \ - static uint64_t _ctx_name##_base_xlat_table \ - [GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size)] \ - __aligned(GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size) \ - * sizeof(uint64_t)); \ - \ - _ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ - \ - static xlat_ctx_t _ctx_name##_xlat_ctx = { \ - .va_max_address = (_virt_addr_space_size) - 1, \ - .pa_max_address = (_phy_addr_space_size) - 1, \ - .mmap = _ctx_name##_mmap, \ - .mmap_num = (_mmap_count), \ - .base_level = GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_size), \ - .base_table = _ctx_name##_base_xlat_table, \ - .base_table_entries = \ - GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size), \ - .tables = _ctx_name##_xlat_tables, \ - .tables_num = _xlat_tables_count, \ - _REGISTER_DYNMAP_STRUCT(_ctx_name) \ - .xlat_regime = (_xlat_regime), \ - .max_pa = 0, \ - .max_va = 0, \ - .next_table = 0, \ - .initialized = 0, \ +#define REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, _mmap_count, \ + _xlat_tables_count, _virt_addr_space_size, \ + _phy_addr_space_size, _xlat_regime, _section_name)\ + CASSERT(CHECK_VIRT_ADDR_SPACE_SIZE(_virt_addr_space_size), \ + assert_invalid_virtual_addr_space_size_for_##_ctx_name);\ + \ + CASSERT(CHECK_PHY_ADDR_SPACE_SIZE(_phy_addr_space_size), \ + assert_invalid_physical_addr_space_sizefor_##_ctx_name);\ + \ + static mmap_region_t _ctx_name##_mmap[_mmap_count + 1]; \ + \ + static uint64_t _ctx_name##_xlat_tables[_xlat_tables_count] \ + [XLAT_TABLE_ENTRIES] \ + __aligned(XLAT_TABLE_SIZE) __section(_section_name); \ + \ + static uint64_t _ctx_name##_base_xlat_table \ + [GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size)] \ + __aligned(GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size)\ + * sizeof(uint64_t)); \ + \ + XLAT_ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ + \ + static xlat_ctx_t _ctx_name##_xlat_ctx = { \ + .va_max_address = (_virt_addr_space_size) - 1UL, \ + .pa_max_address = (_phy_addr_space_size) - 1ULL, \ + .mmap = _ctx_name##_mmap, \ + .mmap_num = (_mmap_count), \ + .base_level = GET_XLAT_TABLE_LEVEL_BASE(_virt_addr_space_size),\ + .base_table = _ctx_name##_base_xlat_table, \ + .base_table_entries = \ + GET_NUM_BASE_LEVEL_ENTRIES(_virt_addr_space_size),\ + .tables = _ctx_name##_xlat_tables, \ + .tables_num = _xlat_tables_count, \ + XLAT_REGISTER_DYNMAP_STRUCT(_ctx_name) \ + .xlat_regime = (_xlat_regime), \ + .max_pa = 0U, \ + .max_va = 0U, \ + .next_table = 0, \ + .initialized = 0, \ } #endif /*__ASSEMBLY__*/ -#endif /* __XLAT_TABLES_V2_HELPERS_H__ */ +#endif /* XLAT_TABLES_V2_HELPERS_H */ |