1 /* 2 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef PAR_H 8 #define PAR_H 9 10 #include<arch_features.h> 11 #include<lib/extensions/sysreg128.h> 12 get_par_el1_pa(sysreg_t par)13static inline uint64_t get_par_el1_pa(sysreg_t par) 14 { 15 uint64_t pa = par & UINT64_MAX; 16 /* PA, bits [51:12] is Output address */ 17 uint64_t mask = PAR_ADDR_MASK; 18 19 #if ENABLE_FEAT_D128 20 /* If D128 is in use, the PA is in the upper 64-bit word of PAR_EL1 */ 21 if (is_feat_d128_supported() && (par & PAR_EL1_D128)) { 22 pa = (par >> 64) & UINT64_MAX; 23 /* PA, bits [55:12] is Output address */ 24 mask = PAR_D128_ADDR_MASK; 25 } 26 #endif 27 return pa & mask; 28 } 29 30 #endif /* PAR_H */ 31