summaryrefslogtreecommitdiff
path: root/include/ec_commands.h
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2020-11-24 16:41:00 -0800
committerCommit Bot <commit-bot@chromium.org>2020-11-25 21:59:25 +0000
commit559ad51bad0a4204e8735c6a9e0ec7256a8ea0b2 (patch)
tree7792f8b21dc08ca88a49b4088310331ec6c2f538 /include/ec_commands.h
parent20f7ec106e4e5c410d930931b4ed2b2dba1a94cd (diff)
downloadchrome-ec-559ad51bad0a4204e8735c6a9e0ec7256a8ea0b2.tar.gz
ec_commands: Add GENMASK macros
GENMASK is used in ec_commands.h, but is not defined if not compiling in kernel or Chrome OS EC environments. BRANCH=none BUG=b:144959033 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I439b0d77c47f3921f7bf2afd04c62cc72d668ea6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558857 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r--include/ec_commands.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index f1aa73f7f2..2fd55c0216 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -56,6 +56,14 @@ extern "C" {
#define BIT_ULL(nr) (1ULL << (nr))
#endif
+#ifndef GENMASK
+#define GENMASK(h, l) (((BIT(h) << 1) - 1) ^ (BIT(l) - 1))
+#endif
+
+#ifndef GENMASK_ULL
+#define GENMASK_ULL(h, l) (((BIT_ULL(h) << 1) - 1) ^ (BIT_ULL(l) - 1))
+#endif
+
#endif /* __KERNEL__ */
/*