From patchwork Mon Jul 9 17:33:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 141477 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2923693ljj; Mon, 9 Jul 2018 10:34:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcuzRuWKBVgARpxtz6pWS4QkBRg46gRNdTIkhh/U+J7j0mdNvUn6bv3Dj01O6kx5iMo1osI X-Received: by 2002:a37:ab17:: with SMTP id u23-v6mr18466957qke.279.1531157666224; Mon, 09 Jul 2018 10:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531157666; cv=none; d=google.com; s=arc-20160816; b=KjIFruKg5D3lpW5sVSww8w6GYZNBfAaNSMzhg+DddWuAuQ3aF8SDoXdlwDjIFpfsya zlccoJCP2hyP9+KRt1Rwlh+fH6xa0loqpxlRRkLu2MOBbDzPJf7vftziLWt+odjRr7qD 6aVu5PonelV/9dpoRt2//GBGnUzRL2rEdgEC1g7S5stB2T0SPCxLWvG4Zag5Ah4a3IzV sCro2CDGacGoshI7N7La5EG8XzmTls94vFa87OhwJ/3wXTPxTGCS8s+W0Sc3v+tbrt5W DIqv6oEtpHPos6ft+XOP6wLExjzwykFeJUGB3nEnqYjeCBiwTETu38mNIeWbRnvHYJLQ FjwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:arc-authentication-results; bh=MJFO/8cj5wYavyPNYn4mheI326p6n5jWs3oq04rKmmg=; b=TW2oliGOPUbwmdqlsseRSYefPmpIrpGBXBsAqRineBw0drD0vT9b7s2bhcY9+8f/ap nCUEIyxww0PqwdXrDtxZbn960iPC9D/Vj5RU239rh1GB9FcvDUjgd/eEC0up5fK13Qkg pifzEpZCeqbF0Viuu3Qmr/LB/00O39Hl2NFhsV7jqYrGq/IiUgcXpragyOemiU/jwk4F lbDCb8WhultXfSyocNiOcmvZq82fRja4zhsBJbvAd6qbZHH69tpSRtoAofSNztVyQSOO Wxuw2h1g7/JxRyK5i1xa86gIgdx4REV6sCyt4UBaLBEs4q66swqW88H5vALDAnw1c8Wd niag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="dA+Y/G6p"; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o62-v6si1925869qkc.112.2018.07.09.10.34.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 09 Jul 2018 10:34:26 -0700 (PDT) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="dA+Y/G6p"; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fca3N-0000LJ-H3 for patch@linaro.org; Mon, 09 Jul 2018 13:34:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fca2E-0000I9-Gm for grub-devel@gnu.org; Mon, 09 Jul 2018 13:33:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fca2D-0002gO-EU for grub-devel@gnu.org; Mon, 09 Jul 2018 13:33:14 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:34950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fca2D-0002fy-5W for grub-devel@gnu.org; Mon, 09 Jul 2018 13:33:13 -0400 Received: by mail-wr1-x444.google.com with SMTP id a3-v6so2591010wrt.2 for ; Mon, 09 Jul 2018 10:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0E35Ed+bLDcoVv3jWhX8CibdX5rV2j7zVhQfj075eio=; b=dA+Y/G6p5SUCzvDHYl9hoN0/8oKb1CvhLepXVPvzUoKasvSK+u6nSKEAY85/1PfuSL M0hjsSQfPDqkWI812ehZE+nQyosn5S6vWicjfn+tSa/GOEJTC4GF7CF1PPWWQfCTbxcT 1q7WKg1cc0NxmnDbq56eTnP7V0+ZTsxDmvP8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0E35Ed+bLDcoVv3jWhX8CibdX5rV2j7zVhQfj075eio=; b=sSnQd341YDCD8+hB+9QNpDrEhiMnrx3y4bnGEQUgJoc4hasfDV/nAVOeRIP4k5CZQq vs/X/bY5TxsPL4ToQtz21xKL/QhwrtnMK1xxZELdxxpdWWkM9NSJ06XbbSxezbXtpxZw mEyqJz7asU4UklDGckBiXPsZtjLfzQlzfEjaPmiLEj3eRjqNdpHpVvOO8q7fNE6t0f8X 4Nfy3kOSfb3q4n9igmKdawAWL8qZ8865LAL0jTz2upBMvmO69Su48WfYvQ1kRF0ZKAa1 /LxgxO2RJlJvLzNU8drPGQcmScTCErhSOh6BNclQQJRmAWmmiKYBjZ/K2teBzqzMvf8w v9gQ== X-Gm-Message-State: APt69E1Ke3dnJ7DZ1+/7+RJ2suo13DnSg4e8CWeu+0RYpZcoqxwj0pik 2Z2WXraJMdWhDUz+x+QKzmsrWFJrBQA= X-Received: by 2002:adf:d4c4:: with SMTP id w4-v6mr14708514wrk.185.1531157591868; Mon, 09 Jul 2018 10:33:11 -0700 (PDT) Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id p3-v6sm27742988wrg.47.2018.07.09.10.33.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 10:33:10 -0700 (PDT) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH v4 3/6] arm64 linux loader: rename functions and macros and move to common headers Date: Mon, 9 Jul 2018 18:33:02 +0100 Message-Id: <20180709173305.17588-4-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180709173305.17588-1-leif.lindholm@linaro.org> References: <20180709173305.17588-1-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" In preparation for using the linux loader for 32-bit and 64-bit platforms, rename grub_arm64*/GRUB_ARM64* to grub_armxx*/GRUB_ARMXX*. Move prototypes for now-common functions to efi/efi.h. Signed-off-by: Leif Lindholm --- grub-core/loader/arm64/linux.c | 14 +++++++------- grub-core/loader/arm64/xen_boot.c | 10 +++++----- include/grub/arm64/linux.h | 9 ++++----- include/grub/efi/efi.h | 4 ++++ 4 files changed, 20 insertions(+), 17 deletions(-) -- 2.11.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c index ebe1e730d..f90c5f926 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -48,9 +48,9 @@ static grub_addr_t initrd_start; static grub_addr_t initrd_end; grub_err_t -grub_arm64_uefi_check_image (struct linux_arm64_kernel_header * lh) +grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh) { - if (lh->magic != GRUB_LINUX_ARM64_MAGIC_SIGNATURE) + if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE) return grub_error(GRUB_ERR_BAD_OS, "invalid magic number"); if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC) @@ -109,7 +109,7 @@ failure: } grub_err_t -grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) +grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) { grub_efi_memory_mapped_device_path_t *mempath; grub_efi_handle_t image_handle; @@ -172,8 +172,8 @@ grub_linux_boot (void) if (finalize_params_linux () != GRUB_ERR_NONE) return grub_errno; - return (grub_arm64_uefi_boot_image((grub_addr_t)kernel_addr, - kernel_size, linux_args)); + return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr, + kernel_size, linux_args)); } static grub_err_t @@ -249,7 +249,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) { grub_file_t file = 0; - struct linux_arm64_kernel_header lh; + struct linux_armxx_kernel_header lh; grub_dl_ref (my_mod); @@ -268,7 +268,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) return grub_errno; - if (grub_arm64_uefi_check_image (&lh) != GRUB_ERR_NONE) + if (grub_armxx_efi_linux_check_image (&lh) != GRUB_ERR_NONE) goto fail; grub_loader_unset(); diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c index 258264c79..1003a0b99 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c @@ -265,9 +265,9 @@ xen_boot (void) if (err) return err; - return grub_arm64_uefi_boot_image (xen_hypervisor->start, - xen_hypervisor->size, - xen_hypervisor->cmdline); + return grub_armxx_efi_linux_boot_image (xen_hypervisor->start, + xen_hypervisor->size, + xen_hypervisor->cmdline); } static void @@ -468,8 +468,8 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), if (grub_file_read (file, &sh, sizeof (sh)) != (long) sizeof (sh)) goto fail; - if (grub_arm64_uefi_check_image - ((struct linux_arm64_kernel_header *) &sh) != GRUB_ERR_NONE) + if (grub_armxx_efi_linux_check_image + ((struct linux_armxx_kernel_header *) &sh) != GRUB_ERR_NONE) goto fail; grub_file_seek (file, 0); diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h index b06347624..8655067e0 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -19,8 +19,6 @@ #ifndef GRUB_ARM64_LINUX_HEADER #define GRUB_ARM64_LINUX_HEADER 1 -#include - #define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */ /* From linux/Documentation/arm64/booting.txt */ @@ -38,8 +36,9 @@ struct linux_arm64_kernel_header grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ }; -grub_err_t grub_arm64_uefi_check_image (struct linux_arm64_kernel_header *lh); -grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, - char *args); +#if defined(__aarch64__) +# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE +# define linux_armxx_kernel_header linux_arm64_kernel_header +#endif #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h index 57db74b57..1deaa3c8f 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -95,6 +95,10 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); #endif #if defined(__aarch64__) grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); +#include +grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh); +grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, + char *args); #endif grub_addr_t grub_efi_modules_addr (void);