From: Leif Lindholm <leif.lindholm@linaro.org>
To: grub-devel@gnu.org
Cc: Daniel Kiper <dkiper@net-space.pl>
Subject: [PATCH v2 09/14] arm64 linux loader: rename functions and macros and move to common headers
Date: Thu, 3 Aug 2017 11:04:27 +0100 [thread overview]
Message-ID: <20170803100432.29913-10-leif.lindholm@linaro.org> (raw)
In-Reply-To: <20170803100432.29913-1-leif.lindholm@linaro.org>
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 <leif.lindholm@linaro.org>
---
grub-core/loader/arm64/linux.c | 14 +++++++-------
grub-core/loader/arm64/xen_boot.c | 12 ++++++------
include/grub/arm64/linux.h | 11 ++---------
include/grub/efi/efi.h | 4 ++++
4 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index c60469e53..8cd44230d 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 grub_arm64_linux_kernel_header * lh)
+grub_efi_linux_check_image (struct grub_linux_kernel_header * lh)
{
- if (lh->magic != GRUB_ARM64_LINUX_MAGIC)
+ if (lh->magic != GRUB_LINUX_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;
@@ -173,8 +173,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
@@ -250,7 +250,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
grub_file_t file = 0;
- struct grub_arm64_linux_kernel_header lh;
+ struct grub_linux_kernel_header lh;
grub_dl_ref (my_mod);
@@ -269,7 +269,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 d092a53ed..e8720584b 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -67,7 +67,7 @@ typedef enum module_type module_type_t;
struct xen_hypervisor_header
{
- struct grub_arm64_linux_kernel_header efi_head;
+ struct grub_linux_kernel_header efi_head;
/* This is always PE\0\0. */
grub_uint8_t signature[GRUB_PE32_SIGNATURE_SIZE];
@@ -254,9 +254,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
@@ -458,8 +458,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 grub_arm64_linux_kernel_header *) &sh) != GRUB_ERR_NONE)
+ if (grub_efi_linux_check_image
+ ((struct grub_linux_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 a981df5d1..e53be83b1 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -19,12 +19,10 @@
#ifndef GRUB_LINUX_CPU_HEADER
#define GRUB_LINUX_CPU_HEADER 1
-#include <grub/efi/efi.h>
-
-#define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */
+#define GRUB_LINUX_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */
/* From linux/Documentation/arm64/booting.txt */
-struct grub_arm64_linux_kernel_header
+struct grub_linux_kernel_header
{
grub_uint32_t code0; /* Executable code */
grub_uint32_t code1; /* Executable code */
@@ -38,9 +36,4 @@ struct grub_arm64_linux_kernel_header
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
};
-grub_err_t grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header
- *lh);
-grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size,
- char *args);
-
#endif /* ! GRUB_LINUX_CPU_HEADER */
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index a58774efc..149969941 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -92,6 +92,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/cpu/linux.h>
+grub_err_t grub_efi_linux_check_image(struct grub_linux_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);
--
2.11.0
next prev parent reply other threads:[~2017-08-03 10:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 10:04 [PATCH v2 00/14] efi: improved correctness, arm unification, and cleanup Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 01/14] arm64/efi: move EFI_PAGE definitions to efi/memory.h Leif Lindholm
2017-08-03 15:18 ` Vladimir 'phcoder' Serbinenko
2017-08-04 9:11 ` Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 02/14] efi: add central copy of grub_efi_find_mmap_size Leif Lindholm
2017-08-03 15:19 ` Vladimir 'phcoder' Serbinenko
2017-08-08 15:56 ` Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 03/14] loader: drop local implementations of find_efi_mmap_size Leif Lindholm
2017-08-03 15:20 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 04/14] efi: add grub_efi_get_ram_base() function for arm* Leif Lindholm
2017-08-03 15:30 ` Vladimir 'phcoder' Serbinenko
2017-08-08 16:04 ` Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 05/14] efi: refactor grub_efi_allocate_pages Leif Lindholm
2017-08-03 15:37 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 06/14] efi: move fdt helper library Leif Lindholm
2017-08-03 15:38 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 07/14] efi: Add GRUB_PE32_MAGIC definition Leif Lindholm
2017-08-03 16:35 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 08/14] arm64 linux loader: improve type portability Leif Lindholm
2017-08-03 16:41 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` Leif Lindholm [this message]
2017-08-03 16:44 ` [PATCH v2 09/14] arm64 linux loader: rename functions and macros and move to common headers Vladimir 'phcoder' Serbinenko
2017-08-03 16:46 ` Vladimir 'phcoder' Serbinenko
2017-09-04 14:29 ` Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 10/14] loader: switch arm/linux to grub_linux_kernel_header struct Leif Lindholm
2017-08-07 14:07 ` Vladimir 'phcoder' Serbinenko
2017-09-04 14:31 ` Leif Lindholm
2017-09-04 14:35 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 11/14] arm/efi: switch to arm64 linux loader Leif Lindholm
2017-08-07 14:08 ` Vladimir 'phcoder' Serbinenko
2017-09-04 14:35 ` Leif Lindholm
2017-08-03 10:04 ` [PATCH v2 12/14] arm: delete unused efi support from loader/arm Leif Lindholm
2017-08-07 14:09 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 13/14] efi: restrict arm/arm64 linux loader initrd placement Leif Lindholm
2017-08-07 14:10 ` Vladimir 'phcoder' Serbinenko
2017-08-03 10:04 ` [PATCH v2 14/14] efi: change heap allocation type to GRUB_EFI_LOADER_CODE Leif Lindholm
2017-08-07 14:11 ` Vladimir 'phcoder' Serbinenko
2017-08-07 16:18 ` Konrad Rzeszutek Wilk
2017-08-07 16:22 ` Vladimir 'phcoder' Serbinenko
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=20170803100432.29913-10-leif.lindholm@linaro.org \
--to=leif.lindholm@linaro.org \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.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).