1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(C) 2022 Marvell. 3 */ 4 5 #ifndef _ROC_NPA_DP_H_ 6 #define _ROC_NPA_DP_H_ 7 8 #define ROC_AURA_ID_MASK (BIT_ULL(16) - 1) 9 10 static inline uint64_t roc_npa_aura_handle_to_aura(uint64_t aura_handle)11roc_npa_aura_handle_to_aura(uint64_t aura_handle) 12 { 13 return aura_handle & ROC_AURA_ID_MASK; 14 } 15 16 static inline uintptr_t roc_npa_aura_handle_to_base(uint64_t aura_handle)17roc_npa_aura_handle_to_base(uint64_t aura_handle) 18 { 19 return (uintptr_t)(aura_handle & ~ROC_AURA_ID_MASK); 20 } 21 22 static inline void roc_npa_aura_op_free(uint64_t aura_handle,const int fabs,uint64_t iova)23roc_npa_aura_op_free(uint64_t aura_handle, const int fabs, uint64_t iova) 24 { 25 uint64_t reg = roc_npa_aura_handle_to_aura(aura_handle); 26 const uint64_t addr = 27 roc_npa_aura_handle_to_base(aura_handle) + NPA_LF_AURA_OP_FREE0; 28 if (fabs) 29 reg |= BIT_ULL(63); /* FABS */ 30 31 roc_store_pair(iova, reg, addr); 32 } 33 34 #endif /* _ROC_NPA_DP_H_ */ 35