summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSaurabh Mishra <mishra.saurabh@intel.corp-partner.google.com>2024-08-30 14:02:06 +0530
committerSubrata Banik <subratabanik@google.com>2024-09-04 18:31:25 +0000
commit640d1c456c977711774f0b7f58f1a97e4512fc4b (patch)
tree4a75eebc033c416ac4be3ac25468dded0e439bca /src
parent8db1dfb9cb8ae797214f7506a3204faf3af00945 (diff)
src/include: Introduce a new BIT_FLAG_32(x) macro
Introduces the BIT_FLAG_32(x) macro to create a 32-bit mask with the designated bit set. This ensures compatibility with the 32-bit 'GEN_PMCON_A' register on 64-bit systems, where 1ul is 64 bits wide and could potentially cause an overflow when shifted beyond 31 bits. Change-Id: I70be1ccba59d25af2ba85a2014232072abf2f87d Signed-off-by: Saurabh Mishra <mishra.saurabh@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84142 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Pratikkumar V Prajapati <pratikkumar.v.prajapati@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/types.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/types.h b/src/include/types.h
index ca4571777c..df5e7ae06d 100644
--- a/src/include/types.h
+++ b/src/include/types.h
@@ -21,6 +21,15 @@
#define BIT(x) (1ul << (x))
#endif
+/*
+ * This macro declares a bit as a 32-bits unsigned integer. The common BIT_32(x)
+ * macro is already used by some external header file. To avoid any conflicts, we
+ * use a different name.
+ */
+#ifndef BIT_FLAG_32
+#define BIT_FLAG_32(x) (1u << (x))
+#endif
+
#define BITS_PER_BYTE 8
#endif /* __TYPES_H */