1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
12 #include "osdep_rte/osdep_generic.h"
14 #include "osdep_raw/osdep_generic.h"
25 typedef uint64_t dma_addr_t;
33 #define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
36 #define BIT(a) (1UL << (a))
39 #define BIT_ULL(a) (1ULL << (a))
42 #define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
45 #define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
46 #endif /* GENMASK_ULL */
47 #endif /* LINUX_MACROS */
49 #define SET_FIELD(m, v) (((v) << (__builtin_ffsll(m) - 1)) & (m))
50 #define GET_FIELD(m, v) (((v) & (m)) >> (__builtin_ffsll(m) - 1))
52 #define dev_err(x, args...) dev_printf(ERR, args)
53 #define dev_info(x, args...) dev_printf(INFO, args)
54 #define dev_warn(x, args...) dev_printf(WARNING, args)
57 #define dev_debug(x, args...) dev_printf(DEBUG, args)
59 #define dev_debug(x, args...) do { } while (0)
62 #define pr_err(y, args...) dev_err(0, y, ##args)
63 #define pr_warn(y, args...) dev_warn(0, y, ##args)
64 #define pr_info(y, args...) dev_info(0, y, ##args)
67 #define WARN_ON(x) do { \
70 pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
74 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
75 #define udelay(x) opae_udelay(x)
76 #define msleep(x) opae_udelay(1000 * (x))
77 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))