summaryrefslogtreecommitdiff
path: root/include/bootcount.h
diff options
context:
space:
mode:
authorNiko Mauno <[email protected]>2026-02-04 15:17:35 +0200
committerTom Rini <[email protected]>2026-02-18 16:35:07 -0600
commit27e1924ffaa9361542d4cf75a9b73613fa45d007 (patch)
tree04c8267c11806d60bd22cf74374cd403c1240818 /include/bootcount.h
parentb5213bbfdcb1812be510427857827ee8becb9f8f (diff)
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 <[email protected]> Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'include/bootcount.h')
-rw-r--r--include/bootcount.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/bootcount.h b/include/bootcount.h
index 847c0f02d98..86474569d36 100644
--- a/include/bootcount.h
+++ b/include/bootcount.h
@@ -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);