linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/6] ARM: add atag32_to_cpu() function
Date: Wed, 19 Jun 2013 17:30:00 +0100	[thread overview]
Message-ID: <1371659404-20167-4-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1371659404-20167-1-git-send-email-ben.dooks@codethink.co.uk>

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>
---
 arch/arm/include/uapi/asm/setup.h |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h
index 979ff40..d3b3fa1 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 */
-- 
1.7.10.4

  parent reply	other threads:[~2013-06-19 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 16:29 ARM big-endian - atags and loader updates Ben Dooks
2013-06-19 16:29 ` [PATCH 1/6] ARM: add CPU_BE8_BOOT_LE configuration Ben Dooks
2013-06-19 17:29   ` Thomas Petazzoni
2013-06-20 10:58     ` Ben Dooks
2013-06-19 16:29 ` [PATCH 2/6] ARM: fixup head for atag verification Ben Dooks
2013-06-19 16:30 ` Ben Dooks [this message]
2013-06-19 16:30 ` [PATCH 4/6] ARM: update atag-to-fdt code to be endian agnostic Ben Dooks
2013-06-19 16:30 ` [PATCH 5/6] ARM: fixup atags " Ben Dooks
2013-06-19 16:30 ` [PATCH 6/6] ARM: ensure loader information in LE format for BE kernels Ben Dooks
2013-06-27 17:15 ` ARM big-endian - atags and loader updates Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371659404-20167-4-git-send-email-ben.dooks@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).