Commit cca1aa01 authored by Marek Vasut's avatar Marek Vasut

mxssb: Replace SB_HAB_IVT_HEADER macro with a function

To make better use of the type-checking capabilities of compiler,
replace the SB_HAB_IVT_HEADER macro with a function sb_hab_ivt_header(),
which does exactly the same thing.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 030b4fdc
......@@ -740,9 +740,9 @@ static int sb_build_command_load(struct sb_image_ctx *ictx, struct sb_cmd_list *
goto err;
}
ivt->header = SB_HAB_IVT_HEADER(sizeof(*ivt)),
ivt->entry = ivtep,
ivt->self = dest,
ivt->header = sb_hab_ivt_header();
ivt->entry = ivtep;
ivt->self = dest;
cctx->data = (uint8_t *)ivt;
cctx->length = sizeof(*ivt);
......
......@@ -86,20 +86,22 @@ struct sb_ivt_header {
uint32_t reserved2;
};
#define SB_HAB_IVT_TAG 0xd1
#define SB_HAB_VERSION 0x40
#define SB_HAB_IVT_TAG 0xd1UL
#define SB_HAB_VERSION 0x40UL
/*
* The "size" field in the IVT header is not naturally aligned,
* use this macro to fill first 4 bytes of the IVT header without
* causing issues on some systems (esp. M68k, PPC, MIPS-BE, ARM-BE).
*/
#define SB_HAB_IVT_HEADER(size) \
( \
(SB_HAB_IVT_TAG << 24) | \
(htons(size) << 16) | \
SB_HAB_VERSION \
)
static inline uint32_t sb_hab_ivt_header(void)
{
uint32_t ret = 0;
ret |= SB_HAB_IVT_TAG << 24;
ret |= (uint32_t)htons(sizeof(struct sb_ivt_header)) << 16;
ret |= SB_HAB_VERSION;
return ret;
}
struct sb_sections_header {
uint32_t section_number; /* Section number. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment