From patchwork Fri Aug 30 19:17:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 2852199 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8021C9F495 for ; Fri, 30 Aug 2013 19:20:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92BF62016D for ; Fri, 30 Aug 2013 19:20:22 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F87B20160 for ; Fri, 30 Aug 2013 19:20:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFUEO-0007iv-CV; Fri, 30 Aug 2013 19:19:40 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFUE3-0008No-K1; Fri, 30 Aug 2013 19:19:19 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFUDV-0008Lf-Bp for linux-arm-kernel@merlin.infradead.org; Fri, 30 Aug 2013 19:18:45 +0000 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81] helo=rainbowdash.ducie.codethink.co.uk) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFUDT-0007Br-Ot for linux-arm-kernel@lists.infradead.org; Fri, 30 Aug 2013 19:18:44 +0000 Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.80) (envelope-from ) id 1VFUCp-0003hD-SC; Fri, 30 Aug 2013 20:18:03 +0100 From: Ben Dooks To: linux-arm-kernel@lists.infradead.org, steve.mcintyre@linaro.org, linux@arm.linux.org.uk, thomas.petazzoni@free-electrons.com, dave.martin@arm.com, will.deacon@arm.com, victor.kamensky@linaro.org Subject: [PATCH 3/5] ARM: add atag32_to_cpu() function Date: Fri, 30 Aug 2013 20:17:59 +0100 Message-Id: <1377890281-10757-4-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377890281-10757-1-git-send-email-ben.dooks@codethink.co.uk> References: <1377890281-10757-1-git-send-email-ben.dooks@codethink.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130830_201843_839433_EE41C1DD X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.3 (/) Cc: Ben Dooks X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 */