提交 59dde44a 编写于 作者: M Michael Weiss 提交者: Wolfgang Denk

powerpc/bootcount: Fix endianness problem

For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.
Signed-off-by: NMichael Weiss <michael.weiss@ifm.com>
Signed-off-by: NDetlev Zundel <dzu@denx.de>
上级 d74dda09
......@@ -77,10 +77,12 @@ ulong bootcount_load(void)
void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR;
#if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD)
if (in_be16(reg + 2) != (BOOTCOUNT_MAGIC & 0xffff))
u32 tmp = in_be32(reg);
if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
return 0;
else
return in_be16(reg);
return (tmp & 0x0000ffff);
#else
if (in_be32(reg + 4) != BOOTCOUNT_MAGIC)
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册