From patchwork Wed Jun 27 17:17:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 140373 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1153467ljj; Wed, 27 Jun 2018 10:20:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpegEtmbrM2UiomtiEAiVUY1/VHue7KIhFN9jpOckrDV4X2RSrVrIzp+NWdGRlf+mVO5rB2k X-Received: by 2002:a37:6d41:: with SMTP id i62-v6mr5791196qkc.142.1530120010108; Wed, 27 Jun 2018 10:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530120010; cv=none; d=google.com; s=arc-20160816; b=vkwqRN5gLvU46rcc2FIviGWwqTOcywIkk4LoVK9sormad2qj9nJsI/7Fw5JqAvL/Zn Fcp7OLMpw/Xtscz1aRpW6XjphVJsEtmnMieezMyt1TVBszyokn507KoaVrVmN2RFy19g 2igKUHuFDUperFyyceX/DvC3U6GeHNAHm82hOsLhr4z1Vtuihh2aSx8ElbqCDUWYIjJs EKu3k5qgP4NEehTbma07YtsB2IzzagUUpsZbuQ67oNDZlv6tCw1UZGrgZuzHkv0x/upF dHrG+UZuCU0G+oHoOutbkswDd/7PgCIR7F5VZZCnb4aStxXvidugNeH+5fum9Vb2DlYX QfBg== 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=czmDIQ/0AgExlIfMlWX+6TOF3ljKUO3K7x84J6R2PgI=; b=yMv9945HHOZ7tVrRfI12a/911s6O/nfdocbeK1Wca3QO3PtpW3CD+x1lWylIbyMvjW IHijdIGE/Xa1zPBc2sHenKTjc9RnlMh/r1v/Fjk3SlamSanl+qzsHJWEvNK5FU7cwnER 1hCLujxm8VvLnEysKfRjsDo+f3A443u8AGYiY3evh3PTxTlViXnAa4T2QXau0eHb2Uzu YRck0WSwlqWCG8cJF2E9FyV+zY8IVwGZ3HLZ+Nr/oMSypZvQjSjd3SN7nEoOZ6/xyy9+ To8ckZIxHcEMrxz/qlvsElQpZXSZjzJ7K9a4x+ti5JneyWtONP2D0yHorL+nBtkmhEJY /eGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aaOEqQXv; 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 u20-v6si4448093qth.247.2018.06.27.10.20.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Jun 2018 10:20:10 -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=aaOEqQXv; 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]:60588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYE6z-0006M0-BB for patch@linaro.org; Wed, 27 Jun 2018 13:20:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYE4R-0004ak-7B for grub-devel@gnu.org; Wed, 27 Jun 2018 13:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYE4P-0006OF-TU for grub-devel@gnu.org; Wed, 27 Jun 2018 13:17:31 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:40842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYE4P-0006Mk-J9 for grub-devel@gnu.org; Wed, 27 Jun 2018 13:17:29 -0400 Received: by mail-wm0-x242.google.com with SMTP id z13-v6so6315532wma.5 for ; Wed, 27 Jun 2018 10:17:29 -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=Jgsb13aLReiJiSJqzP2uFly8H0EdYG3oDsWIFtU6Vms=; b=aaOEqQXv8AlcQOgeFZW9D4KDejmxM43TpIGIX1Nd2/v8I5dOSD62Nxm1cOx6u9ZKIS 5rjiRt2TXX4ehQlkO++DAnDi8XyztNQ60rbExZ+D8pNR51ccKt2dGavqiG2CnWDE1vLv xwYFQaySL3f/0oVZDLP7kD/MNwDl+0N8VUG8Y= 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=Jgsb13aLReiJiSJqzP2uFly8H0EdYG3oDsWIFtU6Vms=; b=XztAs78uLFThLfq3G27tlDZZQ5Epw84vVO+eiQcv69B8boBWx6TqF02hxEYegZ2ngj B+D/4yUskUrPHEPg4GVTxLyXzIB5OqkMNFRvVmBUR7ljAabknEvHbp0/Y4Bdbb4m5sUg rdvujoiH+VP4S2aBHpOkFyqOyVmycNvijPCS3aFWKy0i3FEfDD0vkCp4xg/mnKhrot8/ ehwvUFnrBmzA0p0EJI0hf8OC3oR2uuZzWmWC/0PoK5OBG9NcxTmRZ9I+FVRBrQpdysHd 92VJk3hEySlgaaaR7DQc4uX2ZqiYR31ebmc9KvQNQJcg6g9W0x8j8UM/yEqxeYdXuSVn 3Wcg== X-Gm-Message-State: APt69E3Y7f5VqYJ7FaGeQ6LeiYCm0Uqhz9AZxUTeaqXPbQeMMK1P26PT jFYCTnJdmrQ2M6KtpFFCz9ik4Hs0a2M= X-Received: by 2002:a1c:c006:: with SMTP id q6-v6mr5550535wmf.107.1530119848205; Wed, 27 Jun 2018 10:17:28 -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 a2-v6sm3406572wmb.6.2018.06.27.10.17.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 10:17:26 -0700 (PDT) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH v3 3/6] arm64 linux loader: rename functions and macros and move to common headers Date: Wed, 27 Jun 2018 18:17:17 +0100 Message-Id: <20180627171720.27028-4-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180627171720.27028-1-leif.lindholm@linaro.org> References: <20180627171720.27028-1-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 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_efi*/GRUB_EFI*. 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..577fbda54 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_efi_linux_check_image (struct linux_armxx_kernel_header * lh) { - if (lh->magic != GRUB_LINUX_ARM64_MAGIC_SIGNATURE) + if (lh->magic != 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_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_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_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..b86704757 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_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_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..4c0d8d239 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 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..5888bf6ac 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_efi_linux_check_image(struct linux_armxx_kernel_header *lh); +grub_err_t grub_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, + char *args); #endif grub_addr_t grub_efi_modules_addr (void);