xref: /rk3399_ARM-atf/plat/xilinx/common/include/plat_common.h (revision dd9fae1ce0e7b985c9fe8f8f8ae358b8c166c6a9)
1 /*
2  * Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /* Header file to contain common macros across different platforms */
8 #ifndef PLAT_COMMON_H
9 #define PLAT_COMMON_H
10 
11 #define __bf_shf(x)            (__builtin_ffsll(x) - 1U)
12 #define FIELD_GET(_mask, _reg)						\
13 	({								\
14 		(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask));	\
15 	})
16 
17 #endif /* PLAT_COMMON_H */
18