xref: /rk3399_ARM-atf/include/lib/xlat_tables/xlat_tables_v2.h (revision 0cc7aa896465ad7ecd8c253a4dc970508d96724c)
17bb01fb2SAntonio Nino Diaz /*
2*0cc7aa89SJeenu Viswambharan  * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
37bb01fb2SAntonio Nino Diaz  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
57bb01fb2SAntonio Nino Diaz  */
67bb01fb2SAntonio Nino Diaz 
77bb01fb2SAntonio Nino Diaz #ifndef __XLAT_TABLES_V2_H__
87bb01fb2SAntonio Nino Diaz #define __XLAT_TABLES_V2_H__
97bb01fb2SAntonio Nino Diaz 
107bb01fb2SAntonio Nino Diaz #include <xlat_tables_defs.h>
11*0cc7aa89SJeenu Viswambharan #include <xlat_tables_v2_helpers.h>
127bb01fb2SAntonio Nino Diaz 
137bb01fb2SAntonio Nino Diaz #ifndef __ASSEMBLY__
147bb01fb2SAntonio Nino Diaz #include <stddef.h>
157bb01fb2SAntonio Nino Diaz #include <stdint.h>
167bb01fb2SAntonio Nino Diaz #include <xlat_mmu_helpers.h>
177bb01fb2SAntonio Nino Diaz 
18fdb1964cSSandrine Bailleux /*
19fdb1964cSSandrine Bailleux  * Default granularity size for an mmap_region_t.
20fdb1964cSSandrine Bailleux  * Useful when no specific granularity is required.
21fdb1964cSSandrine Bailleux  *
22fdb1964cSSandrine Bailleux  * By default, choose the biggest possible block size allowed by the
23fdb1964cSSandrine Bailleux  * architectural state and granule size in order to minimize the number of page
24fdb1964cSSandrine Bailleux  * tables required for the mapping.
257bb01fb2SAntonio Nino Diaz  */
26fdb1964cSSandrine Bailleux #define REGION_DEFAULT_GRANULARITY	XLAT_BLOCK_SIZE(MIN_LVL_BLOCK_DESC)
277bb01fb2SAntonio Nino Diaz 
28fdb1964cSSandrine Bailleux /* Helper macro to define an mmap_region_t. */
29fdb1964cSSandrine Bailleux #define MAP_REGION(_pa, _va, _sz, _attr)	\
30fdb1964cSSandrine Bailleux 	_MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, REGION_DEFAULT_GRANULARITY)
31fdb1964cSSandrine Bailleux 
32fdb1964cSSandrine Bailleux /* Helper macro to define an mmap_region_t with an identity mapping. */
33fdb1964cSSandrine Bailleux #define MAP_REGION_FLAT(_adr, _sz, _attr)			\
34fdb1964cSSandrine Bailleux 	MAP_REGION(_adr, _adr, _sz, _attr)
35fdb1964cSSandrine Bailleux 
36fdb1964cSSandrine Bailleux /*
37fdb1964cSSandrine Bailleux  * Helper macro to define an mmap_region_t to map with the desired granularity
38fdb1964cSSandrine Bailleux  * of translation tables.
39fdb1964cSSandrine Bailleux  *
40fdb1964cSSandrine Bailleux  * The granularity value passed to this macro must be a valid block or page
41fdb1964cSSandrine Bailleux  * size. When using a 4KB translation granule, this might be 4KB, 2MB or 1GB.
42fdb1964cSSandrine Bailleux  * Passing REGION_DEFAULT_GRANULARITY is also allowed and means that the library
43fdb1964cSSandrine Bailleux  * is free to choose the granularity for this region. In this case, it is
44fdb1964cSSandrine Bailleux  * equivalent to the MAP_REGION() macro.
457bb01fb2SAntonio Nino Diaz  */
46fdb1964cSSandrine Bailleux #define MAP_REGION2(_pa, _va, _sz, _attr, _gr)			\
47fdb1964cSSandrine Bailleux 	_MAP_REGION_FULL_SPEC(_pa, _va, _sz, _attr, _gr)
487bb01fb2SAntonio Nino Diaz 
497bb01fb2SAntonio Nino Diaz /*
503a1b7b10SAntonio Nino Diaz  * Shifts and masks to access fields of an mmap attribute
517bb01fb2SAntonio Nino Diaz  */
52030567e6SVarun Wadekar #define MT_TYPE_MASK		U(0x7)
537bb01fb2SAntonio Nino Diaz #define MT_TYPE(_attr)		((_attr) & MT_TYPE_MASK)
547bb01fb2SAntonio Nino Diaz /* Access permissions (RO/RW) */
55030567e6SVarun Wadekar #define MT_PERM_SHIFT		U(3)
567bb01fb2SAntonio Nino Diaz /* Security state (SECURE/NS) */
57030567e6SVarun Wadekar #define MT_SEC_SHIFT		U(4)
587bb01fb2SAntonio Nino Diaz /* Access permissions for instruction execution (EXECUTE/EXECUTE_NEVER) */
59030567e6SVarun Wadekar #define MT_EXECUTE_SHIFT	U(5)
603a1b7b10SAntonio Nino Diaz /* In the EL1&0 translation regime, User (EL0) or Privileged (EL1). */
61609c9191SAntonio Nino Diaz #define MT_USER_SHIFT		U(6)
620b64f4efSAntonio Nino Diaz /* All other bits are reserved */
637bb01fb2SAntonio Nino Diaz 
647bb01fb2SAntonio Nino Diaz /*
657bb01fb2SAntonio Nino Diaz  * Memory mapping attributes
667bb01fb2SAntonio Nino Diaz  */
673a1b7b10SAntonio Nino Diaz 
687bb01fb2SAntonio Nino Diaz /*
697bb01fb2SAntonio Nino Diaz  * Memory types supported.
703a1b7b10SAntonio Nino Diaz  * These are organised so that, going down the list, the memory types are
713a1b7b10SAntonio Nino Diaz  * getting weaker; conversely going up the list the memory types are getting
723a1b7b10SAntonio Nino Diaz  * stronger.
737bb01fb2SAntonio Nino Diaz  */
743a1b7b10SAntonio Nino Diaz #define MT_DEVICE		U(0)
753a1b7b10SAntonio Nino Diaz #define MT_NON_CACHEABLE	U(1)
763a1b7b10SAntonio Nino Diaz #define MT_MEMORY		U(2)
777bb01fb2SAntonio Nino Diaz /* Values up to 7 are reserved to add new memory types in the future */
787bb01fb2SAntonio Nino Diaz 
793a1b7b10SAntonio Nino Diaz #define MT_RO			(U(0) << MT_PERM_SHIFT)
803a1b7b10SAntonio Nino Diaz #define MT_RW			(U(1) << MT_PERM_SHIFT)
817bb01fb2SAntonio Nino Diaz 
823a1b7b10SAntonio Nino Diaz #define MT_SECURE		(U(0) << MT_SEC_SHIFT)
833a1b7b10SAntonio Nino Diaz #define MT_NS			(U(1) << MT_SEC_SHIFT)
847bb01fb2SAntonio Nino Diaz 
857bb01fb2SAntonio Nino Diaz /*
863a1b7b10SAntonio Nino Diaz  * Access permissions for instruction execution are only relevant for normal
873a1b7b10SAntonio Nino Diaz  * read-only memory, i.e. MT_MEMORY | MT_RO. They are ignored (and potentially
883a1b7b10SAntonio Nino Diaz  * overridden) otherwise:
897bb01fb2SAntonio Nino Diaz  *  - Device memory is always marked as execute-never.
907bb01fb2SAntonio Nino Diaz  *  - Read-write normal memory is always marked as execute-never.
917bb01fb2SAntonio Nino Diaz  */
923a1b7b10SAntonio Nino Diaz #define MT_EXECUTE		(U(0) << MT_EXECUTE_SHIFT)
933a1b7b10SAntonio Nino Diaz #define MT_EXECUTE_NEVER	(U(1) << MT_EXECUTE_SHIFT)
94609c9191SAntonio Nino Diaz 
95609c9191SAntonio Nino Diaz /*
963a1b7b10SAntonio Nino Diaz  * When mapping a region at EL0 or EL1, this attribute will be used to determine
973a1b7b10SAntonio Nino Diaz  * if a User mapping (EL0) will be created or a Privileged mapping (EL1).
98609c9191SAntonio Nino Diaz  */
993a1b7b10SAntonio Nino Diaz #define MT_USER			(U(1) << MT_USER_SHIFT)
1003a1b7b10SAntonio Nino Diaz #define MT_PRIVILEGED		(U(0) << MT_USER_SHIFT)
1017bb01fb2SAntonio Nino Diaz 
102609c9191SAntonio Nino Diaz /* Compound attributes for most common usages */
1037bb01fb2SAntonio Nino Diaz #define MT_CODE			(MT_MEMORY | MT_RO | MT_EXECUTE)
1047bb01fb2SAntonio Nino Diaz #define MT_RO_DATA		(MT_MEMORY | MT_RO | MT_EXECUTE_NEVER)
105609c9191SAntonio Nino Diaz #define MT_RW_DATA		(MT_MEMORY | MT_RW | MT_EXECUTE_NEVER)
1067bb01fb2SAntonio Nino Diaz 
1073a1b7b10SAntonio Nino Diaz #if !ERROR_DEPRECATED
1083a1b7b10SAntonio Nino Diaz typedef unsigned int mmap_attr_t;
1093a1b7b10SAntonio Nino Diaz #endif
1103a1b7b10SAntonio Nino Diaz 
1117bb01fb2SAntonio Nino Diaz /*
1127bb01fb2SAntonio Nino Diaz  * Structure for specifying a single region of memory.
1137bb01fb2SAntonio Nino Diaz  */
1147bb01fb2SAntonio Nino Diaz typedef struct mmap_region {
1157bb01fb2SAntonio Nino Diaz 	unsigned long long	base_pa;
1167bb01fb2SAntonio Nino Diaz 	uintptr_t		base_va;
1177bb01fb2SAntonio Nino Diaz 	size_t			size;
1183a1b7b10SAntonio Nino Diaz 	unsigned int		attr;
119fdb1964cSSandrine Bailleux 	/* Desired granularity. See the MAP_REGION2() macro for more details. */
120fdb1964cSSandrine Bailleux 	size_t			granularity;
1217bb01fb2SAntonio Nino Diaz } mmap_region_t;
1227bb01fb2SAntonio Nino Diaz 
12355c84964SSandrine Bailleux /*
124b4ae615bSDouglas Raillard  * Translation regimes supported by this library.
125b4ae615bSDouglas Raillard  */
126b4ae615bSDouglas Raillard typedef enum xlat_regime {
127b4ae615bSDouglas Raillard 	EL1_EL0_REGIME,
128b4ae615bSDouglas Raillard 	EL3_REGIME,
129b4ae615bSDouglas Raillard } xlat_regime_t;
130b4ae615bSDouglas Raillard 
131b4ae615bSDouglas Raillard /*
13255c84964SSandrine Bailleux  * Declare the translation context type.
13355c84964SSandrine Bailleux  * Its definition is private.
13455c84964SSandrine Bailleux  */
13555c84964SSandrine Bailleux typedef struct xlat_ctx xlat_ctx_t;
13655c84964SSandrine Bailleux 
13755c84964SSandrine Bailleux /*
13855c84964SSandrine Bailleux  * Statically allocate a translation context and associated structures. Also
13955c84964SSandrine Bailleux  * initialize them.
14055c84964SSandrine Bailleux  *
14155c84964SSandrine Bailleux  * _ctx_name:
14255c84964SSandrine Bailleux  *   Prefix for the translation context variable.
14355c84964SSandrine Bailleux  *   E.g. If _ctx_name is 'foo', the variable will be called 'foo_xlat_ctx'.
14455c84964SSandrine Bailleux  *   Useful to distinguish multiple contexts from one another.
14555c84964SSandrine Bailleux  *
14655c84964SSandrine Bailleux  * _mmap_count:
14755c84964SSandrine Bailleux  *   Number of mmap_region_t to allocate.
14855c84964SSandrine Bailleux  *   Would typically be MAX_MMAP_REGIONS for the translation context describing
14955c84964SSandrine Bailleux  *   the BL image currently executing.
15055c84964SSandrine Bailleux  *
15155c84964SSandrine Bailleux  * _xlat_tables_count:
15255c84964SSandrine Bailleux  *   Number of sub-translation tables to allocate.
15355c84964SSandrine Bailleux  *   Would typically be MAX_XLAT_TABLES for the translation context describing
15455c84964SSandrine Bailleux  *   the BL image currently executing.
15555c84964SSandrine Bailleux  *   Note that this is only for sub-tables ; at the initial lookup level, there
15655c84964SSandrine Bailleux  *   is always a single table.
15755c84964SSandrine Bailleux  *
15855c84964SSandrine Bailleux  * _virt_addr_space_size, _phy_addr_space_size:
15955c84964SSandrine Bailleux  *   Size (in bytes) of the virtual (resp. physical) address space.
16055c84964SSandrine Bailleux  *   Would typically be PLAT_VIRT_ADDR_SPACE_SIZE
16155c84964SSandrine Bailleux  *   (resp. PLAT_PHY_ADDR_SPACE_SIZE) for the translation context describing the
16255c84964SSandrine Bailleux  *   BL image currently executing.
16355c84964SSandrine Bailleux  */
16455c84964SSandrine Bailleux #define REGISTER_XLAT_CONTEXT(_ctx_name, _mmap_count, _xlat_tables_count,	\
16555c84964SSandrine Bailleux 			_virt_addr_space_size, _phy_addr_space_size)		\
166609c9191SAntonio Nino Diaz 	_REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, _mmap_count,	\
167609c9191SAntonio Nino Diaz 					 _xlat_tables_count,		\
168609c9191SAntonio Nino Diaz 					 _virt_addr_space_size,		\
169609c9191SAntonio Nino Diaz 					 _phy_addr_space_size,		\
17045d640f0SAntonio Nino Diaz 					 IMAGE_XLAT_DEFAULT_REGIME,	\
17145d640f0SAntonio Nino Diaz 					"xlat_table")
172609c9191SAntonio Nino Diaz 
173609c9191SAntonio Nino Diaz /*
17445d640f0SAntonio Nino Diaz  * Same as REGISTER_XLAT_CONTEXT plus the additional parameters:
17545d640f0SAntonio Nino Diaz  *
17645d640f0SAntonio Nino Diaz  * _xlat_regime:
17745d640f0SAntonio Nino Diaz  *   Specify the translation regime managed by this xlat_ctx_t instance. The
178609c9191SAntonio Nino Diaz  *   values are the one from xlat_regime_t enumeration.
17945d640f0SAntonio Nino Diaz  *
18045d640f0SAntonio Nino Diaz  * _section_name:
18145d640f0SAntonio Nino Diaz  *   Specify the name of the section where the translation tables have to be
18245d640f0SAntonio Nino Diaz  *   placed by the linker.
183609c9191SAntonio Nino Diaz  */
184609c9191SAntonio Nino Diaz #define REGISTER_XLAT_CONTEXT2(_ctx_name, _mmap_count, _xlat_tables_count,	\
185609c9191SAntonio Nino Diaz 			_virt_addr_space_size, _phy_addr_space_size,		\
18645d640f0SAntonio Nino Diaz 			_xlat_regime, _section_name)				\
187609c9191SAntonio Nino Diaz 	_REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, _mmap_count,	\
188609c9191SAntonio Nino Diaz 					 _xlat_tables_count,		\
189609c9191SAntonio Nino Diaz 					 _virt_addr_space_size,		\
190609c9191SAntonio Nino Diaz 					 _phy_addr_space_size,		\
19145d640f0SAntonio Nino Diaz 					 _xlat_regime, _section_name)
19255c84964SSandrine Bailleux 
193a9ad848cSSandrine Bailleux /******************************************************************************
194a9ad848cSSandrine Bailleux  * Generic translation table APIs.
195a9ad848cSSandrine Bailleux  * Each API comes in 2 variants:
196a9ad848cSSandrine Bailleux  * - one that acts on the current translation context for this BL image
197a9ad848cSSandrine Bailleux  * - another that acts on the given translation context instead. This variant
198a9ad848cSSandrine Bailleux  *   is named after the 1st version, with an additional '_ctx' suffix.
199a9ad848cSSandrine Bailleux  *****************************************************************************/
200e769db3eSAntonio Nino Diaz 
201e769db3eSAntonio Nino Diaz /*
202e769db3eSAntonio Nino Diaz  * Initialize translation tables from the current list of mmap regions. Calling
203e769db3eSAntonio Nino Diaz  * this function marks the transition point after which static regions can no
204e769db3eSAntonio Nino Diaz  * longer be added.
205e769db3eSAntonio Nino Diaz  */
2067bb01fb2SAntonio Nino Diaz void init_xlat_tables(void);
207a9ad848cSSandrine Bailleux void init_xlat_tables_ctx(xlat_ctx_t *ctx);
2087bb01fb2SAntonio Nino Diaz 
2097bb01fb2SAntonio Nino Diaz /*
210e769db3eSAntonio Nino Diaz  * Add a static region with defined base PA and base VA. This function can only
211e769db3eSAntonio Nino Diaz  * be used before initializing the translation tables. The region cannot be
212e769db3eSAntonio Nino Diaz  * removed afterwards.
2137bb01fb2SAntonio Nino Diaz  */
2147bb01fb2SAntonio Nino Diaz void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
2153a1b7b10SAntonio Nino Diaz 		     size_t size, unsigned int attr);
216a9ad848cSSandrine Bailleux void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm);
2177bb01fb2SAntonio Nino Diaz 
2187bb01fb2SAntonio Nino Diaz /*
219a9ad848cSSandrine Bailleux  * Add an array of static regions with defined base PA and base VA. This
220a9ad848cSSandrine Bailleux  * function can only be used before initializing the translation tables. The
221a9ad848cSSandrine Bailleux  * regions cannot be removed afterwards.
222a9ad848cSSandrine Bailleux  */
223a9ad848cSSandrine Bailleux void mmap_add(const mmap_region_t *mm);
224a9ad848cSSandrine Bailleux void mmap_add_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm);
225a9ad848cSSandrine Bailleux 
226a9ad848cSSandrine Bailleux 
227a9ad848cSSandrine Bailleux #if PLAT_XLAT_TABLES_DYNAMIC
228a9ad848cSSandrine Bailleux /*
229e769db3eSAntonio Nino Diaz  * Add a dynamic region with defined base PA and base VA. This type of region
230e769db3eSAntonio Nino Diaz  * can be added and removed even after the translation tables are initialized.
2310b64f4efSAntonio Nino Diaz  *
2320b64f4efSAntonio Nino Diaz  * Returns:
2330b64f4efSAntonio Nino Diaz  *        0: Success.
2340b64f4efSAntonio Nino Diaz  *   EINVAL: Invalid values were used as arguments.
2350b64f4efSAntonio Nino Diaz  *   ERANGE: Memory limits were surpassed.
2360b64f4efSAntonio Nino Diaz  *   ENOMEM: Not enough space in the mmap array or not enough free xlat tables.
2370b64f4efSAntonio Nino Diaz  *    EPERM: It overlaps another region in an invalid way.
2380b64f4efSAntonio Nino Diaz  */
2390b64f4efSAntonio Nino Diaz int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va,
2403a1b7b10SAntonio Nino Diaz 			    size_t size, unsigned int attr);
241a9ad848cSSandrine Bailleux int mmap_add_dynamic_region_ctx(xlat_ctx_t *ctx, mmap_region_t *mm);
2427bb01fb2SAntonio Nino Diaz 
2430b64f4efSAntonio Nino Diaz /*
2440b64f4efSAntonio Nino Diaz  * Remove a region with the specified base VA and size. Only dynamic regions can
245e769db3eSAntonio Nino Diaz  * be removed, and they can be removed even if the translation tables are
246e769db3eSAntonio Nino Diaz  * initialized.
2470b64f4efSAntonio Nino Diaz  *
2480b64f4efSAntonio Nino Diaz  * Returns:
2490b64f4efSAntonio Nino Diaz  *        0: Success.
2500b64f4efSAntonio Nino Diaz  *   EINVAL: The specified region wasn't found.
2510b64f4efSAntonio Nino Diaz  *    EPERM: Trying to remove a static region.
2520b64f4efSAntonio Nino Diaz  */
2530b64f4efSAntonio Nino Diaz int mmap_remove_dynamic_region(uintptr_t base_va, size_t size);
254a9ad848cSSandrine Bailleux int mmap_remove_dynamic_region_ctx(xlat_ctx_t *ctx,
255a9ad848cSSandrine Bailleux 				uintptr_t base_va,
256a9ad848cSSandrine Bailleux 				size_t size);
257a9ad848cSSandrine Bailleux 
258a9ad848cSSandrine Bailleux #endif /* PLAT_XLAT_TABLES_DYNAMIC */
2590b64f4efSAntonio Nino Diaz 
2601be910bbSSandrine Bailleux /*
261996d6b39SSandrine Bailleux  * Change the memory attributes of the memory region starting from a given
262996d6b39SSandrine Bailleux  * virtual address in a set of translation tables.
263996d6b39SSandrine Bailleux  *
264996d6b39SSandrine Bailleux  * This function can only be used after the translation tables have been
265996d6b39SSandrine Bailleux  * initialized.
266996d6b39SSandrine Bailleux  *
267996d6b39SSandrine Bailleux  * The base address of the memory region must be aligned on a page boundary.
268996d6b39SSandrine Bailleux  * The size of this memory region must be a multiple of a page size.
269996d6b39SSandrine Bailleux  * The memory region must be already mapped by the given translation tables
270996d6b39SSandrine Bailleux  * and it must be mapped at the granularity of a page.
271996d6b39SSandrine Bailleux  *
272996d6b39SSandrine Bailleux  * Return 0 on success, a negative value on error.
273996d6b39SSandrine Bailleux  *
274996d6b39SSandrine Bailleux  * In case of error, the memory attributes remain unchanged and this function
275996d6b39SSandrine Bailleux  * has no effect.
276996d6b39SSandrine Bailleux  *
277996d6b39SSandrine Bailleux  * ctx
278996d6b39SSandrine Bailleux  *   Translation context to work on.
279996d6b39SSandrine Bailleux  * base_va:
280996d6b39SSandrine Bailleux  *   Virtual address of the 1st page to change the attributes of.
281996d6b39SSandrine Bailleux  * size:
282996d6b39SSandrine Bailleux  *   Size in bytes of the memory region.
283996d6b39SSandrine Bailleux  * attr:
284996d6b39SSandrine Bailleux  *   New attributes of the page tables. The attributes that can be changed are
285996d6b39SSandrine Bailleux  *   data access (MT_RO/MT_RW), instruction access (MT_EXECUTE_NEVER/MT_EXECUTE)
286996d6b39SSandrine Bailleux  *   and user/privileged access (MT_USER/MT_PRIVILEGED) in the case of contexts
287996d6b39SSandrine Bailleux  *   that are used in the EL1&0 translation regime. Also, note that this
288996d6b39SSandrine Bailleux  *   function doesn't allow to remap a region as RW and executable, or to remap
289996d6b39SSandrine Bailleux  *   device memory as executable.
290996d6b39SSandrine Bailleux  *
291996d6b39SSandrine Bailleux  * NOTE: The caller of this function must be able to write to the translation
292996d6b39SSandrine Bailleux  * tables, i.e. the memory where they are stored must be mapped with read-write
293996d6b39SSandrine Bailleux  * access permissions. This function assumes it is the case. If this is not
294996d6b39SSandrine Bailleux  * the case then this function might trigger a data abort exception.
295996d6b39SSandrine Bailleux  *
296996d6b39SSandrine Bailleux  * NOTE2: The caller is responsible for making sure that the targeted
297996d6b39SSandrine Bailleux  * translation tables are not modified by any other code while this function is
298996d6b39SSandrine Bailleux  * executing.
299996d6b39SSandrine Bailleux  */
300996d6b39SSandrine Bailleux int change_mem_attributes(xlat_ctx_t *ctx, uintptr_t base_va, size_t size,
301b3323cd6SAntonio Nino Diaz 			  uint32_t attr);
302996d6b39SSandrine Bailleux 
303996d6b39SSandrine Bailleux /*
3041be910bbSSandrine Bailleux  * Query the memory attributes of a memory page in a set of translation tables.
3051be910bbSSandrine Bailleux  *
3061be910bbSSandrine Bailleux  * Return 0 on success, a negative error code on error.
3071be910bbSSandrine Bailleux  * On success, the attributes are stored into *attributes.
3081be910bbSSandrine Bailleux  *
3091be910bbSSandrine Bailleux  * ctx
3101be910bbSSandrine Bailleux  *   Translation context to work on.
3111be910bbSSandrine Bailleux  * base_va
3121be910bbSSandrine Bailleux  *   Virtual address of the page to get the attributes of.
3131be910bbSSandrine Bailleux  *   There are no alignment restrictions on this address. The attributes of the
3141be910bbSSandrine Bailleux  *   memory page it lies within are returned.
3151be910bbSSandrine Bailleux  * attributes
3161be910bbSSandrine Bailleux  *   Output parameter where to store the attributes of the targeted memory page.
3171be910bbSSandrine Bailleux  */
3181be910bbSSandrine Bailleux int get_mem_attributes(const xlat_ctx_t *ctx, uintptr_t base_va,
319b3323cd6SAntonio Nino Diaz 		       uint32_t *attributes);
3201be910bbSSandrine Bailleux 
3217bb01fb2SAntonio Nino Diaz #endif /*__ASSEMBLY__*/
3227bb01fb2SAntonio Nino Diaz #endif /* __XLAT_TABLES_V2_H__ */
323