[PATCH 2/5] fwu: centralize bank state macros in fwu_mdata.h
Dario Binacchi
dario.binacchi at amarulasolutions.com
Sun Dec 28 16:17:52 CET 2025
Move the bank state definitions to fwu_mdata.h so they live next to
the structures they describe and can be consistently reused by both
U-Boot code and mkfwumdata, avoiding duplication and reducing the
risk of mismatched constants.
Signed-off-by: Dario Binacchi <dario.binacchi at amarulasolutions.com>
---
include/fwu.h | 4 ----
include/fwu_mdata.h | 4 ++++
tools/mkfwumdata.c | 5 +----
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/include/fwu.h b/include/fwu.h
index e7bd1d492af1..c9549019601c 100644
--- a/include/fwu.h
+++ b/include/fwu.h
@@ -80,10 +80,6 @@ struct fwu_mdata_ops {
#define FWU_IMAGE_ACCEPTED 0x1
-#define FWU_BANK_INVALID (uint8_t)0xFF
-#define FWU_BANK_VALID (uint8_t)0xFE
-#define FWU_BANK_ACCEPTED (uint8_t)0xFC
-
enum {
PRIMARY_PART = 1,
SECONDARY_PART,
diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h
index d2521f39b42e..43b3487c4a23 100644
--- a/include/fwu_mdata.h
+++ b/include/fwu_mdata.h
@@ -9,6 +9,10 @@
#include <linux/compiler_attributes.h>
#include <efi.h>
+#define FWU_BANK_INVALID (uint8_t)0xFF
+#define FWU_BANK_VALID (uint8_t)0xFE
+#define FWU_BANK_ACCEPTED (uint8_t)0xFC
+
/**
* struct fwu_image_bank_info - firmware image information
* @image_guid: Guid value of the image in this bank
diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c
index fbc2067bc12d..0d1697622e6a 100644
--- a/tools/mkfwumdata.c
+++ b/tools/mkfwumdata.c
@@ -33,9 +33,6 @@ typedef uint64_t u64;
/* version 2 supports maximum of 4 banks */
#define MAX_BANKS_V2 4
-#define BANK_INVALID (u8)0xFF
-#define BANK_ACCEPTED (u8)0xFC
-
#include <fwu_mdata.h>
static const char *opts_short = "b:i:a:p:v:V:gh";
@@ -297,7 +294,7 @@ static void fwu_fill_version_specific_mdata(struct fwu_mdata_object *mobj)
for (i = 0; i < MAX_BANKS_V2; i++)
mdata->bank_state[i] = i < mobj->banks ?
- BANK_ACCEPTED : BANK_INVALID;
+ FWU_BANK_ACCEPTED : FWU_BANK_INVALID;
fw_desc = (struct fwu_fw_store_desc *)((u8 *)mdata + sizeof(*mdata));
fw_desc->num_banks = mobj->banks;
--
2.43.0
More information about the U-Boot
mailing list