summaryrefslogtreecommitdiff
path: root/drivers/common/octeontx2/otx2_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/common/octeontx2/otx2_common.h')
-rw-r--r--drivers/common/octeontx2/otx2_common.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/common/octeontx2/otx2_common.h b/drivers/common/octeontx2/otx2_common.h
index a155462..0d0b87e 100644
--- a/drivers/common/octeontx2/otx2_common.h
+++ b/drivers/common/octeontx2/otx2_common.h
@@ -31,6 +31,23 @@
#define BIT(nr) (1UL << (nr))
#endif
+#ifndef BITS_PER_LONG
+#define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
+#endif
+#ifndef BITS_PER_LONG_LONG
+#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)
+#endif
+
+#ifndef GENMASK
+#define GENMASK(h, l) \
+ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#endif
+#ifndef GENMASK_ULL
+#define GENMASK_ULL(h, l) \
+ (((~0ULL) - (1ULL << (l)) + 1) & \
+ (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+#endif
+
/* Compiler attributes */
#ifndef __hot
#define __hot __attribute__((hot))