Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84142?usp=email )
Change subject: src/include: Introduce a new BIT_FLAG_32(x) macro ......................................................................
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 --- M src/include/types.h 1 file changed, 9 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Pratikkumar V Prajapati: Looks good to me, approved Subrata Banik: Looks good to me, approved Jérémy Compostella: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve
diff --git a/src/include/types.h b/src/include/types.h index ca45717..df5e7ae 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 */