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