summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@codethink.co.uk>2013-02-01 10:31:13 +0000
committerBen Dooks <ben.dooks@codethink.co.uk>2013-08-30 20:12:49 +0100
commitb2c1d314527378a6fa29cc05d2cd5659fa99c6a1 (patch)
tree047e7c2b526c68d6d9412639986fb37b3e71650e
parentb2c187cba13882e8f212d5fe99ecbd384354d200 (diff)
downloadlinux-b2c1d314527378a6fa29cc05d2cd5659fa99c6a1.tar.gz
ARM: add atag32_to_cpu() function
Add atag32_to_cpu() function to allow code manipulating ATAGs to deal with the case where the boot-loader was in little-endian and Linux is running big-endian. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
-rw-r--r--arch/arm/include/uapi/asm/setup.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h
index 979ff4016404..d3b3fa146e2b 100644
--- a/arch/arm/include/uapi/asm/setup.h
+++ b/arch/arm/include/uapi/asm/setup.h
@@ -175,13 +175,20 @@ struct tagtable {
#define tag_member_present(tag,member) \
((unsigned long)(&((struct tag *)0L)->member + 1) \
- <= (tag)->hdr.size * 4)
+ <= atag32_to_cpu((tag)->hdr.size) * 4)
-#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size))
+#define tag_next(t) ((struct tag *)((__u32 *)(t) + atag32_to_cpu((t)->hdr.size)))
#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
#define for_each_tag(t,base) \
for (t = base; t->hdr.size; t = tag_next(t))
+#ifdef CONFIG_CPU_BE8_BOOT_LE
+#define atag32_to_cpu(x) le32_to_cpu(x)
+#define cpu_to_atag32(x) cpu_to_le32(x)
+#else
+#define cpu_to_atag32(x) x
+#define atag32_to_cpu(x) x
+#endif
#endif /* _UAPI__ASMARM_SETUP_H */