bootcount: Use predefined count/magic bit masks

Use predefined bit masks in operations where only the magic half or
only the count half of the 32-bit value are processed.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Niko Mauno
2026-02-04 15:17:35 +02:00
committed by Tom Rini
parent b5213bbfdc
commit 27e1924ffa
4 changed files with 18 additions and 12 deletions

View File

@@ -10,6 +10,7 @@
#include <asm/io.h>
#include <asm/byteorder.h>
#include <env.h>
#include <linux/bitops.h>
#ifdef CONFIG_DM_BOOTCOUNT
@@ -59,6 +60,10 @@ int dm_bootcount_set(struct udevice *dev, u32 bootcount);
#endif
/* Bit masks for magic and count parts in single word scheme */
#define BOOTCOUNT_MAGIC_MASK GENMASK(31, 16)
#define BOOTCOUNT_COUNT_MASK GENMASK(15, 0)
/** bootcount_store() - store the current bootcount */
void bootcount_store(ulong);