blob: 676baa2c76930d96b208a4af1f1b95de6eaa96dc [file] [log] [blame]
Akshay Belsare5303e3f2023-05-12 14:28:05 +05301/*
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 */