瀏覽代碼

powerpc/bootcount: Fix endianness problem

For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.

Signed-off-by: Michael Weiss <michael.weiss@ifm.com>
Signed-off-by: Detlev Zundel <dzu@denx.de>
Michael Weiss 15 年之前
父節點
當前提交
59dde44acb
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      arch/powerpc/lib/bootcount.c

+ 4 - 2
arch/powerpc/lib/bootcount.c

@@ -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;