From patchwork Wed Jun 18 23:07:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 4379741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1554BEEAA for ; Wed, 18 Jun 2014 23:11:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14F0820383 for ; Wed, 18 Jun 2014 23:11:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D18E20357 for ; Wed, 18 Jun 2014 23:11:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxOxR-0004CR-SK; Wed, 18 Jun 2014 23:07:57 +0000 Received: from 107-1-141-74-ip-static.hfc.comcastbusiness.net ([107.1.141.74] helo=[192.168.254.170]) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxOxP-0004Bv-0p; Wed, 18 Jun 2014 23:07:55 +0000 Message-ID: <1403132874.17030.38.camel@smoke> Subject: [PATCH] arm64: Add new file asm/image.h From: Geoff Levand To: Mark Rutland Date: Wed, 18 Jun 2014 16:07:54 -0700 In-Reply-To: <1403132622.17030.35.camel@smoke> References: <1400233839-15140-1-git-send-email-mark.rutland@arm.com> <1400233839-15140-4-git-send-email-mark.rutland@arm.com> <1402950432.3708.22.camel@smoke> <20140618164927.GA9612@leverpostej> <1403132622.17030.35.camel@smoke> X-Mailer: Evolution 3.10.4-0ubuntu1 Mime-Version: 1.0 Cc: "peter.maydell@linaro.org" , "trini@kernel.crashing.org" , Marc Zyngier , Catalin Marinas , Will Deacon , "rob.herring@linaro.org" , "leif.lindholm@linaro.org" , "ijc@hellion.org.uk" , Dave P Martin , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_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 the new file asm/image.h that exports a structure arm64_image_header and some constants to user space that describe the arm64 image header. Signed-off-by: Geoff Levand --- Documentation/arm64/booting.txt | 21 ++-------------- arch/arm64/include/asm/Kbuild | 2 ++ arch/arm64/include/asm/image.h | 53 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 arch/arm64/include/asm/image.h diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.txt index 525e37c..55f246b 100644 --- a/Documentation/arm64/booting.txt +++ b/Documentation/arm64/booting.txt @@ -68,25 +68,8 @@ Image target is available instead. Requirement: MANDATORY -The decompressed kernel image contains a 64-byte header as follows: - - u32 code0; /* Executable code */ - u32 code1; /* Executable code */ - u64 text_offset; /* Image load offset */ - u8 byte_order; /* 1=LSB (little endian), 2=MSB (big endian) */ - u8[3] res1; /* reserved */ - u32 res2 = 0; /* reserved */ - u64 res3 = 0; /* reserved */ - u64 res4 = 0; /* reserved */ - u64 res5 = 0; /* reserved */ - u64 res6 = 0; /* reserved */ - u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */ - u32 res7 = 0; /* reserved */ - - -Header notes: - -- code0/code1 are responsible for branching to stext. +The decompressed kernel image contains a 64-byte header as described in +arch/arm64/include/asm/image.h. The image must be placed at the specified offset (currently 0x80000) from the start of the system RAM and called there. The start of the diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 42c7eec..f73e67a 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -55,3 +55,5 @@ generic-y += unaligned.h generic-y += user.h generic-y += vga.h generic-y += xor.h + +header-y += image.h diff --git a/arch/arm64/include/asm/image.h b/arch/arm64/include/asm/image.h new file mode 100644 index 0000000..7d56872 --- /dev/null +++ b/arch/arm64/include/asm/image.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2014 Linaro. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __ASM_IMAGE_H +#define __ASM_IMAGE_H + +#if !defined(__ASSEMBLY__) + +/** + * struct arm64_image_header - arm64 kernel image header. + * + * @branch_code: Reserved for instructions to branch to stext. + * @text_offset: Image load offset. + * @endian: Image byte order: 1=LSB (little endian), 2=MSB (big endian). + * @reserved_1: Reserved. + * @reserved_2: Reserved. + * @reserved_3: Reserved. + * @magic: Magic number, "ARM\x64". + * @reserved_4: Reserved. + **/ + +struct arm64_image_header { + uint32_t branch_code[2]; + uint64_t text_offset; + uint8_t endian; + uint8_t reserved_1[3]; + uint32_t reserved_2; + uint64_t reserved_3[4]; + uint8_t magic[4]; + uint32_t reserved_4; +}; + +enum {arm64_image_le = 1, arm64_image_be = 2}; + +static const uint8_t arm64_image_magic[4] = {'A', 'R', 'M', 0x64}; +static const uint32_t arm64_image_magic_lsb = 0x644d5241U; +static const uint32_t arm64_image_magic_msb = 0x41524d64U; + +#endif /* !defined(__ASSEMBLY__) */ + +#endif /* __ASM_IMAGE_H */