* [PATCH v2 0/6] efi: Implement generic EFI boot for x86
@ 2023-05-11 12:06 Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
` (5 more replies)
0 siblings, 6 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
Switch the i386-efi and x86_64-efi builds to the generic EFI loader,
which enters the Linux kernel via the EFI stub and provides the initrd
via the LoadFile2 protocol. This unifies x86 with other EFI
architectures, and removes the dependency on the setup header and struct
bootparams.
Do some preparatory cleanup first, so we no longer need to rely on the
MS to SysV calling convention translation code.
Changes since v1:
- drop Itanium support, which is a maintenance burden as it shares the
EFI code with other architectures, but does not have a EFI stub in
Linux, and there is no way to test whether our changes break the boot
for it or not;
- enable generic EFI for i386 as well
- wire up the existing x86 code as a fallback for kernels that lack EFI
stub or LoadFile2 support. This removes the need for additional
changes to support v5.8 or older kernels.
Ard Biesheuvel (6):
ia64: Remove support
efi: Make EFI PXE protocol methods non-callable
efi: Add calling convention annotation to all prototypes
efi: Drop all uses of efi_call_XX wrappers
efi: Remove x86_64 call wrappers
efi: Use generic EFI loader for x86_64 and i386
.travis.yml | 7 +-
Makefile.util.def | 1 -
configure.ac | 8 -
docs/grub-dev.texi | 2 +-
docs/grub.texi | 2 +-
gentpl.py | 6 +-
grub-core/Makefile.am | 6 -
grub-core/Makefile.core.def | 21 +-
grub-core/commands/acpi.c | 8 +-
grub-core/commands/efi/efitextmode.c | 8 +-
grub-core/commands/efi/lsefi.c | 5 +-
grub-core/commands/efi/tpm.c | 21 +-
grub-core/commands/file.c | 33 -
grub-core/disk/efi/efidisk.c | 7 +-
grub-core/kern/arm/efi/init.c | 12 +-
grub-core/kern/dl.c | 12 -
grub-core/kern/efi/efi.c | 56 +-
grub-core/kern/efi/init.c | 15 +-
grub-core/kern/efi/mm.c | 17 +-
grub-core/kern/emu/cache.c | 4 +-
grub-core/kern/emu/cache_s.S | 2 +-
grub-core/kern/emu/lite.c | 3 -
grub-core/kern/i386/efi/tsc.c | 2 +-
grub-core/kern/ia64/cache.c | 35 -
grub-core/kern/ia64/dl.c | 150 -----
grub-core/kern/ia64/dl_helper.c | 241 -------
grub-core/kern/ia64/efi/init.c | 80 ---
grub-core/kern/ia64/efi/startup.S | 44 --
grub-core/kern/misc.c | 2 +-
grub-core/kern/x86_64/efi/callwrap.S | 129 ----
grub-core/lib/efi/datetime.c | 9 +-
grub-core/lib/efi/halt.c | 6 +-
grub-core/lib/efi/relocator.c | 6 +-
grub-core/lib/ia64/longjmp.S | 162 -----
grub-core/lib/ia64/setjmp.S | 177 ------
grub-core/lib/setjmp.S | 3 -
grub-core/loader/efi/appleloader.c | 8 +-
grub-core/loader/efi/chainloader.c | 20 +-
grub-core/loader/efi/linux.c | 51 +-
grub-core/loader/i386/linux.c | 8 +
grub-core/loader/ia64/efi/linux.c | 607 ------------------
grub-core/mmap/efi/mmap.c | 16 +-
grub-core/net/drivers/efi/efinet.c | 26 +-
grub-core/term/efi/console.c | 29 +-
grub-core/term/efi/serial.c | 18 +-
grub-core/video/efi_gop.c | 18 +-
grub-core/video/efi_uga.c | 8 +-
include/grub/cache.h | 2 +-
include/grub/dl.h | 12 +-
include/grub/efi/api.h | 666 +++++++++-----------
include/grub/efi/efi.h | 2 +-
include/grub/efi/pe32.h | 2 -
include/grub/efi/tpm.h | 149 +++--
include/grub/elf.h | 109 ----
include/grub/ia64/efi/memory.h | 6 -
include/grub/ia64/efi/time.h | 23 -
include/grub/ia64/kernel.h | 25 -
include/grub/ia64/reloc.h | 44 --
include/grub/ia64/setjmp.h | 28 -
include/grub/ia64/time.h | 28 -
include/grub/ia64/types.h | 32 -
include/grub/misc.h | 2 +-
include/grub/util/install.h | 1 -
include/grub/util/mkimage.h | 2 -
tests/core_compress_test.in | 2 +-
util/grub-install-common.c | 1 -
util/grub-install.c | 16 -
util/grub-mkimage.c | 1 -
util/grub-mkimagexx.c | 175 +----
util/grub-mknetdir.c | 1 -
util/grub-mkrescue.c | 7 -
util/grub-module-verifier.c | 22 -
util/mkimage.c | 17 -
73 files changed, 610 insertions(+), 2876 deletions(-)
delete mode 100644 grub-core/kern/ia64/cache.c
delete mode 100644 grub-core/kern/ia64/dl.c
delete mode 100644 grub-core/kern/ia64/dl_helper.c
delete mode 100644 grub-core/kern/ia64/efi/init.c
delete mode 100644 grub-core/kern/ia64/efi/startup.S
delete mode 100644 grub-core/kern/x86_64/efi/callwrap.S
delete mode 100644 grub-core/lib/ia64/longjmp.S
delete mode 100644 grub-core/lib/ia64/setjmp.S
delete mode 100644 grub-core/loader/ia64/efi/linux.c
delete mode 100644 include/grub/ia64/efi/memory.h
delete mode 100644 include/grub/ia64/efi/time.h
delete mode 100644 include/grub/ia64/kernel.h
delete mode 100644 include/grub/ia64/reloc.h
delete mode 100644 include/grub/ia64/setjmp.h
delete mode 100644 include/grub/ia64/time.h
delete mode 100644 include/grub/ia64/types.h
--
2.39.2
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:14 ` John Paul Adrian Glaubitz
2023-05-11 22:31 ` Vladimir 'phcoder' Serbinenko
2023-05-11 12:06 ` [PATCH v2 2/6] efi: Make EFI PXE protocol methods non-callable Ard Biesheuvel
` (4 subsequent siblings)
5 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
Itanium IA-64 support is obsolete, and implements its own flavor of EFI
boot that deviates from other architectures. Given that IA64 is unused
and unmaintained, it makes no sense to pretend that the EFI changes we
are making are tested or supported on IA64, so let's just get rid of it.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
.travis.yml | 7 +-
Makefile.util.def | 1 -
configure.ac | 8 -
docs/grub-dev.texi | 2 +-
docs/grub.texi | 2 +-
gentpl.py | 6 +-
grub-core/Makefile.am | 6 -
grub-core/Makefile.core.def | 15 -
grub-core/commands/file.c | 33 --
grub-core/kern/dl.c | 12 -
grub-core/kern/emu/cache.c | 4 +-
grub-core/kern/emu/cache_s.S | 2 +-
grub-core/kern/emu/lite.c | 3 -
grub-core/kern/ia64/cache.c | 35 --
grub-core/kern/ia64/dl.c | 150 -----
grub-core/kern/ia64/dl_helper.c | 241 --------
grub-core/kern/ia64/efi/init.c | 80 ---
grub-core/kern/ia64/efi/startup.S | 44 --
grub-core/kern/misc.c | 2 +-
grub-core/lib/efi/halt.c | 2 +-
grub-core/lib/ia64/longjmp.S | 162 ------
grub-core/lib/ia64/setjmp.S | 177 ------
grub-core/lib/setjmp.S | 3 -
grub-core/loader/ia64/efi/linux.c | 607 --------------------
include/grub/cache.h | 2 +-
include/grub/dl.h | 12 +-
include/grub/efi/pe32.h | 2 -
include/grub/elf.h | 109 ----
include/grub/ia64/efi/memory.h | 6 -
include/grub/ia64/efi/time.h | 23 -
include/grub/ia64/kernel.h | 25 -
include/grub/ia64/reloc.h | 44 --
include/grub/ia64/setjmp.h | 28 -
include/grub/ia64/time.h | 28 -
include/grub/ia64/types.h | 32 --
include/grub/misc.h | 2 +-
include/grub/util/install.h | 1 -
include/grub/util/mkimage.h | 2 -
tests/core_compress_test.in | 2 +-
util/grub-install-common.c | 1 -
util/grub-install.c | 16 -
util/grub-mkimage.c | 1 -
util/grub-mkimagexx.c | 175 +-----
util/grub-mknetdir.c | 1 -
util/grub-mkrescue.c | 7 -
util/grub-module-verifier.c | 22 -
util/mkimage.c | 17 -
47 files changed, 16 insertions(+), 2146 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 4bd05a30a27ad15c..7bea51b2f0c4da89 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,7 +23,7 @@ addons:
env:
global:
# Include all cross toolchain paths, so we can just call them later down.
- - PATH=/tmp/qemu-install/bin:/tmp/grub/bin:/usr/bin:/bin:/tmp/cross/gcc-8.1.0-nolibc/aarch64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/arm-linux-gnueabi/bin:/tmp/cross/gcc-8.1.0-nolibc/ia64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/mips64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/powerpc64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv32-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/sparc64-linux/bin
+ - PATH=/tmp/qemu-install/bin:/tmp/grub/bin:/usr/bin:/bin:/tmp/cross/gcc-8.1.0-nolibc/aarch64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/arm-linux-gnueabi/bin:/tmp/cross/gcc-8.1.0-nolibc/mips64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/powerpc64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv32-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/sparc64-linux/bin
before_script:
# Install necessary toolchains based on $CROSS_TARGETS variable.
@@ -44,7 +44,6 @@ script:
arch=${target%-*};
[ "$arch" = "arm64" ] && arch=aarch64-linux;
[ "$arch" = "arm" ] && arch=arm-linux-gnueabi;
- [ "$arch" = "ia64" ] && arch=ia64-linux;
[ "$arch" = "mipsel" ] && arch=mips64-linux;
[ "$arch" = "powerpc" ] && arch=powerpc64-linux;
[ "$arch" = "riscv32" ] && arch=riscv32-linux;
@@ -83,10 +82,6 @@ matrix:
env:
- GRUB_TARGETS="sparc64-ieee1275"
- CROSS_TARGETS="sparc64-linux"
- - name: "ia64"
- env:
- - GRUB_TARGETS="ia64-efi"
- - CROSS_TARGETS="ia64-linux"
- name: "mips"
env:
- GRUB_TARGETS="mips-arc mipsel-arc mipsel-qemu_mips mips-qemu_mips"
diff --git a/Makefile.util.def b/Makefile.util.def
index beaef1168f0d09b0..ae9e628e5c85b751 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -160,7 +160,6 @@ library = {
common = grub-core/io/gzio.c;
common = grub-core/io/xzio.c;
common = grub-core/io/lzopio.c;
- common = grub-core/kern/ia64/dl_helper.c;
common = grub-core/kern/arm/dl_helper.c;
common = grub-core/kern/arm64/dl_helper.c;
common = grub-core/lib/minilzo/minilzo.c;
diff --git a/configure.ac b/configure.ac
index ca42ff8f73182511..789e5658e4d9ab9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,7 +141,6 @@ if test "x$with_platform" = x; then
sparc64-*) platform=ieee1275 ;;
mipsel-*) platform=loongson ;;
mips-*) platform=arc ;;
- ia64-*) platform=efi ;;
arm-*) platform=uboot ;;
arm64-*) platform=efi ;;
riscv32-*) platform=efi ;;
@@ -180,7 +179,6 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
- ia64-efi) ;;
mips-qemu_mips) ;;
mips-qemu-mips) platform=qemu_mips;;
mips-arc) ;;
@@ -890,11 +888,6 @@ if test x"$platform" != xemu ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_target_cc_soft_float="-march=rv64imac_zicsr_zifencei -mabi=lp64"], [])
fi
- if test "x$target_cpu" = xia64; then
- CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], [])
- fi
if test "x$target_cpu" = xsh4; then
CFLAGS="$TARGET_CFLAGS -m4-nofpu -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
@@ -1997,7 +1990,6 @@ AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xc
AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
-AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index 31eb99ea29943c39..ab68676b03814cfc 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -753,7 +753,7 @@ ones (sorry that this list is duplicated):
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
"mips_loongson", "sparc64_ieee1275",
- "powerpc_ieee1275", "mips_arc", "ia64_efi",
+ "powerpc_ieee1275", "mips_arc",
"mips_qemu_mips", "s390_mainframe" ]
@end example
diff --git a/docs/grub.texi b/docs/grub.texi
index a3e9ce2d1ac7e780..c0b7f832f79f7c16 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -6848,7 +6848,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
@item Requires ACPI
@end enumerate
-PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
+PowerPC and Sparc64 ports support only Linux. MIPS port supports Linux
and multiboot2.
@section Boot tests
diff --git a/gentpl.py b/gentpl.py
index 88abe5b0a119321c..2b5ead8afad95cd7 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -30,7 +30,7 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
"i386_xen", "x86_64_xen", "i386_xen_pvh",
"mips_loongson", "sparc64_ieee1275",
- "powerpc_ieee1275", "mips_arc", "ia64_efi",
+ "powerpc_ieee1275", "mips_arc",
"mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",
"arm_coreboot", "riscv32_efi", "riscv64_efi" ]
@@ -51,7 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
GROUPS["riscv64"] = [ "riscv64_efi" ]
# Groups based on firmware
-GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi",
+GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "arm_efi", "arm64_efi",
"riscv32_efi", "riscv64_efi" ]
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
GROUPS["uboot"] = [ "arm_uboot" ]
@@ -83,7 +83,7 @@ GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi", "riscv32_efi", "riscv64_e
# Needs software helpers for division
# Must match GRUB_DIVISION_IN_SOFTWARE in misc.h
-GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"] + GROUPS["riscv32"]
+GROUPS["softdiv"] = GROUPS["arm"] + GROUPS["riscv32"]
GROUPS["no_softdiv"] = GRUB_PLATFORMS[:]
for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i)
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 80e7a83edf9ba3aa..6feecfdef0db6385 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -188,12 +188,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
endif
-if COND_ia64_efi
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
-endif
-
if COND_mips
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
endif
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 801df7c21de663ec..9194be1d4f796bd7 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -57,10 +57,6 @@ kernel = {
x86_64_efi_ldflags = '-Wl,-r';
x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
- ia64_efi_cflags = '-fshort-wchar -fno-builtin -fpic -minline-int-divide-max-throughput';
- ia64_efi_ldflags = '-Wl,-r';
- ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
-
arm_efi_cflags = '-fshort-wchar';
arm_efi_ldflags = '-Wl,-r';
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
@@ -252,12 +248,6 @@ kernel = {
i386_xen_pvh = kern/xen/init.c;
i386_xen_pvh = term/xen/console.c;
- ia64_efi = kern/ia64/efi/startup.S;
- ia64_efi = kern/ia64/efi/init.c;
- ia64_efi = kern/ia64/dl.c;
- ia64_efi = kern/ia64/dl_helper.c;
- ia64_efi = kern/ia64/cache.c;
-
arm_efi = kern/arm/efi/init.c;
arm_efi = kern/efi/fdt.c;
@@ -837,7 +827,6 @@ module = {
enable = sparc64_ieee1275;
enable = powerpc_ieee1275;
enable = mips_arc;
- enable = ia64_efi;
enable = arm_efi;
enable = arm64_efi;
enable = arm_uboot;
@@ -1730,8 +1719,6 @@ module = {
extra_dist = lib/x86_64/setjmp.S;
extra_dist = lib/sparc64/setjmp.S;
extra_dist = lib/powerpc/setjmp.S;
- extra_dist = lib/ia64/setjmp.S;
- extra_dist = lib/ia64/longjmp.S;
extra_dist = lib/arm/setjmp.S;
extra_dist = lib/arm64/setjmp.S;
extra_dist = lib/riscv/setjmp.S;
@@ -1831,7 +1818,6 @@ module = {
mips = loader/mips/linux.c;
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
- ia64_efi = loader/ia64/efi/linux.c;
arm_coreboot = loader/arm/linux.c;
arm_efi = loader/efi/linux.c;
arm_uboot = loader/arm/linux.c;
@@ -1929,7 +1915,6 @@ module = {
enable = x86;
enable = i386_xen_pvh;
- enable = ia64_efi;
enable = arm_efi;
enable = arm64_efi;
enable = riscv32_efi;
diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c
index 7c13e976b505b3bf..574353491296e48a 100644
--- a/grub-core/commands/file.c
+++ b/grub-core/commands/file.c
@@ -52,8 +52,6 @@ static const struct grub_arg_option options[] = {
N_("Check if FILE is ARM Linux"), 0, 0},
{"is-arm64-linux", 0, 0,
N_("Check if FILE is ARM64 Linux"), 0, 0},
- {"is-ia64-linux", 0, 0,
- N_("Check if FILE is IA64 Linux"), 0, 0},
{"is-mips-linux", 0, 0,
N_("Check if FILE is MIPS Linux"), 0, 0},
{"is-mipsel-linux", 0, 0,
@@ -84,8 +82,6 @@ static const struct grub_arg_option options[] = {
N_("Check if FILE is i386 EFI file"), 0, 0},
{"is-x86_64-efi", 0, 0,
N_("Check if FILE is x86_64 EFI file"), 0, 0},
- {"is-ia64-efi", 0, 0,
- N_("Check if FILE is IA64 EFI file"), 0, 0},
{"is-arm64-efi", 0, 0,
N_("Check if FILE is ARM64 EFI file"), 0, 0},
{"is-arm-efi", 0, 0,
@@ -116,7 +112,6 @@ enum
IS_MULTIBOOT2,
IS_ARM_LINUX,
IS_ARM64_LINUX,
- IS_IA64_LINUX,
IS_MIPS_LINUX,
IS_MIPSEL_LINUX,
IS_SPARC64_LINUX,
@@ -190,30 +185,6 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
ret = 1;
break;
}
- case IS_IA64_LINUX:
- {
- Elf64_Ehdr ehdr;
-
- if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
- break;
-
- if (ehdr.e_ident[EI_MAG0] != ELFMAG0
- || ehdr.e_ident[EI_MAG1] != ELFMAG1
- || ehdr.e_ident[EI_MAG2] != ELFMAG2
- || ehdr.e_ident[EI_MAG3] != ELFMAG3
- || ehdr.e_ident[EI_VERSION] != EV_CURRENT
- || ehdr.e_version != EV_CURRENT)
- break;
-
- if (ehdr.e_ident[EI_CLASS] != ELFCLASS64
- || ehdr.e_ident[EI_DATA] != ELFDATA2LSB
- || ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_IA_64))
- break;
-
- ret = 1;
-
- break;
- }
case IS_SPARC64_LINUX:
{
@@ -623,10 +594,6 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_X86_64))
break;
- if (type == IS_IA_EFI
- && coff_head.machine !=
- grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64))
- break;
if (type == IS_ARM64_EFI
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64))
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index e447fd0fab4e303b..b3009fce4a3cae93 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -391,18 +391,6 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
case STT_FUNC:
sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod,
sym->st_shndx);
-#ifdef __ia64__
- {
- /* FIXME: free descriptor once it's not used anymore. */
- char **desc;
- desc = grub_malloc (2 * sizeof (char *));
- if (!desc)
- return grub_errno;
- desc[0] = (void *) sym->st_value;
- desc[1] = mod->base;
- sym->st_value = (grub_addr_t) desc;
- }
-#endif
if (bind != STB_LOCAL)
if (grub_dl_register_symbol (name, (void *) sym->st_value, 1, mod))
return grub_errno;
diff --git a/grub-core/kern/emu/cache.c b/grub-core/kern/emu/cache.c
index 113682cc42c1d6e8..0fdb763a57bd006a 100644
--- a/grub-core/kern/emu/cache.c
+++ b/grub-core/kern/emu/cache.c
@@ -4,9 +4,7 @@
#include <grub/cache.h>
-#if defined(__ia64__)
-#include "../ia64/cache.c"
-#elif defined (__arm__) || defined (__aarch64__)
+#if defined (__arm__) || defined (__aarch64__)
void __clear_cache (void *beg, void *end);
diff --git a/grub-core/kern/emu/cache_s.S b/grub-core/kern/emu/cache_s.S
index 6885ffd69bde2b59..2ad520474ea28609 100644
--- a/grub-core/kern/emu/cache_s.S
+++ b/grub-core/kern/emu/cache_s.S
@@ -13,7 +13,7 @@
#include "../sparc64/cache.S"
#elif defined(__powerpc__)
#include "../powerpc/cache.S"
-#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
+#elif defined(__arm__) || defined(__aarch64__) || \
defined(__mips__) || defined(__riscv)
#else
#error "No target cpu type is defined"
diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c
index b327d4e418841bc1..81baec907669dcd3 100644
--- a/grub-core/kern/emu/lite.c
+++ b/grub-core/kern/emu/lite.c
@@ -15,9 +15,6 @@
#include "../mips/dl.c"
#elif defined(__powerpc__)
#include "../powerpc/dl.c"
-#elif defined(__ia64__)
-#include "../ia64/dl_helper.c"
-#include "../ia64/dl.c"
#elif defined(__arm__)
#include "../arm/dl_helper.c"
#include "../arm/dl.c"
diff --git a/grub-core/kern/ia64/cache.c b/grub-core/kern/ia64/cache.c
deleted file mode 100644
index 13efd308f7158943..0000000000000000
--- a/grub-core/kern/ia64/cache.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* init.c - initialize an ia64-based EFI system */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/types.h>
-#include <grub/cache.h>
-
-void
-grub_arch_sync_caches (void *address, grub_size_t len)
-{
- /* Cache line length is at least 32. */
- len += (grub_uint64_t)address & 0x1f;
- grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
-
- /* Flush data. */
- for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
- asm volatile ("fc.i %0" : : "r" (a));
- /* Sync and serialize. Maybe extra. */
- asm volatile (";; sync.i;; srlz.i;;");
-}
diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c
deleted file mode 100644
index db59300fea3ceec9..0000000000000000
--- a/grub-core/kern/ia64/dl.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* dl.c - arch-dependent part of loadable module support */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/dl.h>
-#include <grub/elf.h>
-#include <grub/misc.h>
-#include <grub/err.h>
-#include <grub/mm.h>
-#include <grub/i18n.h>
-#include <grub/ia64/reloc.h>
-
-#define MASK19 ((1 << 19) - 1)
-#define MASK20 ((1 << 20) - 1)
-
-/* Check if EHDR is a valid ELF header. */
-grub_err_t
-grub_arch_dl_check_header (void *ehdr)
-{
- Elf_Ehdr *e = ehdr;
-
- /* Check the magic numbers. */
- if (e->e_ident[EI_CLASS] != ELFCLASS64
- || e->e_ident[EI_DATA] != ELFDATA2LSB
- || e->e_machine != EM_IA_64)
- return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic"));
-
- return GRUB_ERR_NONE;
-}
-
-#pragma GCC diagnostic ignored "-Wcast-align"
-
-/* Relocate symbols. */
-grub_err_t
-grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
- Elf_Shdr *s, grub_dl_segment_t seg)
-{
- Elf_Rela *rel, *max;
-
- for (rel = (Elf_Rela *) ((char *) ehdr + s->sh_offset),
- max = (Elf_Rela *) ((char *) rel + s->sh_size);
- rel < max;
- rel = (Elf_Rela *) ((char *) rel + s->sh_entsize))
- {
- grub_addr_t addr;
- Elf_Sym *sym;
- grub_uint64_t value;
-
- if (seg->size < (rel->r_offset & ~3))
- return grub_error (GRUB_ERR_BAD_MODULE,
- "reloc offset is out of the segment");
-
- addr = (grub_addr_t) seg->addr + rel->r_offset;
- sym = (Elf_Sym *) ((char *) mod->symtab
- + mod->symsize * ELF_R_SYM (rel->r_info));
-
- /* On the PPC the value does not have an explicit
- addend, add it. */
- value = sym->st_value + rel->r_addend;
-
- switch (ELF_R_TYPE (rel->r_info))
- {
- case R_IA64_PCREL21B:
- {
- grub_int64_t noff;
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- {
- struct grub_ia64_trampoline *tr = mod->trampptr;
- grub_ia64_make_trampoline (tr, value);
- noff = ((char *) tr - (char *) (addr & ~3)) >> 4;
- mod->trampptr = tr + 1;
- }
- else
- noff = ((char *) value - (char *) (addr & ~3)) >> 4;
-
- if ((noff & ~MASK19) && ((-noff) & ~MASK19))
- return grub_error (GRUB_ERR_BAD_MODULE,
- "jump offset too big (%lx)", noff);
- grub_ia64_add_value_to_slot_20b (addr, noff);
- }
- break;
- case R_IA64_SEGREL64LSB:
- *(grub_uint64_t *) addr += value - (grub_addr_t) seg->addr;
- break;
- case R_IA64_FPTR64LSB:
- case R_IA64_DIR64LSB:
- *(grub_uint64_t *) addr += value;
- break;
- case R_IA64_PCREL64LSB:
- *(grub_uint64_t *) addr += value - addr;
- break;
- case R_IA64_GPREL64I:
- grub_ia64_set_immu64 (addr, value - (grub_addr_t) mod->base);
- break;
- case R_IA64_GPREL22:
- if ((value - (grub_addr_t) mod->base) & ~MASK20)
- return grub_error (GRUB_ERR_BAD_MODULE,
- "gprel offset too big (%lx)",
- value - (grub_addr_t) mod->base);
- grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) mod->base);
- break;
-
- case R_IA64_LTOFF22X:
- case R_IA64_LTOFF22:
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- value = *(grub_uint64_t *) sym->st_value + rel->r_addend;
- /* Fallthrough. */
- case R_IA64_LTOFF_FPTR22:
- {
- grub_uint64_t *gpptr = mod->gotptr;
- *gpptr = value;
- if (((grub_addr_t) gpptr - (grub_addr_t) mod->base) & ~MASK20)
- return grub_error (GRUB_ERR_BAD_MODULE,
- "gprel offset too big (%lx)",
- (grub_addr_t) gpptr - (grub_addr_t) mod->base);
- grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) mod->base);
- mod->gotptr = gpptr + 1;
- break;
- }
- /* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
- case R_IA64_LDXMOV:
- break;
- default:
- {
- char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
-
- grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
- ELF_R_TYPE (rel->r_info));
- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("relocation 0x%s is not implemented yet"), rel_info);
- }
- }
- }
- return GRUB_ERR_NONE;
-}
diff --git a/grub-core/kern/ia64/dl_helper.c b/grub-core/kern/ia64/dl_helper.c
deleted file mode 100644
index 05a0a68db7a1263c..0000000000000000
--- a/grub-core/kern/ia64/dl_helper.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* dl.c - arch-dependent part of loadable module support */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/dl.h>
-#include <grub/elf.h>
-#include <grub/misc.h>
-#include <grub/err.h>
-#include <grub/mm.h>
-#include <grub/i18n.h>
-#include <grub/ia64/reloc.h>
-
-#pragma GCC diagnostic ignored "-Wcast-align"
-
-#define MASK20 ((1 << 20) - 1)
-#define MASK3 (~(grub_addr_t) 3)
-
-void
-grub_ia64_set_immu64 (grub_addr_t addr, grub_uint64_t val)
-{
- /* Copied from binutils. */
- grub_uint64_t *ptr = ((grub_uint64_t *) (addr & MASK3));
- grub_uint64_t t0, t1;
-
- t0 = grub_le_to_cpu64 (ptr[0]);
- t1 = grub_le_to_cpu64 (ptr[1]);
-
- /* tmpl/s: bits 0.. 5 in t0
- slot 0: bits 5..45 in t0
- slot 1: bits 46..63 in t0, bits 0..22 in t1
- slot 2: bits 23..63 in t1 */
-
- /* First, clear the bits that form the 64 bit constant. */
- t0 &= ~(0x3ffffLL << 46);
- t1 &= ~(0x7fffffLL
- | (( (0x07fLL << 13) | (0x1ffLL << 27)
- | (0x01fLL << 22) | (0x001LL << 21)
- | (0x001LL << 36)) << 23));
-
- t0 |= ((val >> 22) & 0x03ffffLL) << 46; /* 18 lsbs of imm41 */
- t1 |= ((val >> 40) & 0x7fffffLL) << 0; /* 23 msbs of imm41 */
- t1 |= ( (((val >> 0) & 0x07f) << 13) /* imm7b */
- | (((val >> 7) & 0x1ff) << 27) /* imm9d */
- | (((val >> 16) & 0x01f) << 22) /* imm5c */
- | (((val >> 21) & 0x001) << 21) /* ic */
- | (((val >> 63) & 0x001) << 36)) << 23; /* i */
-
- ptr[0] = t0;
- ptr[1] = t1;
-}
-
-void
-grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value)
-{
- grub_uint32_t val;
- switch (addr & 3)
- {
- case 0:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 2)));
- val = (((((val & MASK20) + value) & MASK20) << 2)
- | (val & ~(MASK20 << 2)));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2),
- grub_cpu_to_le32 (val));
- break;
- case 1:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 7)));
- val = ((((((val >> 3) & MASK20) + value) & MASK20) << 3)
- | (val & ~(MASK20 << 3)));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7),
- grub_cpu_to_le32 (val));
- break;
- case 2:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 12)));
- val = ((((((val >> 4) & MASK20) + value) & MASK20) << 4)
- | (val & ~(MASK20 << 4)));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12),
- grub_cpu_to_le32 (val));
- break;
- }
-}
-
-#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) )
-
-static grub_uint32_t
-add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value)
-{
- grub_uint32_t high, mid, low, c;
- low = (a & 0x00007f);
- mid = (a & 0x7fc000) >> 7;
- high = (a & 0x003e00) << 7;
- c = (low | mid | high) + value;
- return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00); //0x003e00
-}
-
-void
-grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value)
-{
- grub_uint32_t val;
- switch (addr & 3)
- {
- case 0:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 2)));
- val = ((add_value_to_slot_21_real (((val >> 2) & MASKF21), value)
- & MASKF21) << 2) | (val & ~(MASKF21 << 2));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2),
- grub_cpu_to_le32 (val));
- break;
- case 1:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 7)));
- val = ((add_value_to_slot_21_real (((val >> 3) & MASKF21), value)
- & MASKF21) << 3) | (val & ~(MASKF21 << 3));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7),
- grub_cpu_to_le32 (val));
- break;
- case 2:
- val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
- (addr & MASK3) + 12)));
- val = ((add_value_to_slot_21_real (((val >> 4) & MASKF21), value)
- & MASKF21) << 4) | (val & ~(MASKF21 << 4));
- grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12),
- grub_cpu_to_le32 (val));
- break;
- }
-}
-
-static const grub_uint8_t nopm[5] =
- {
- /* [MLX] nop.m 0x0 */
- 0x05, 0x00, 0x00, 0x00, 0x01
- };
-
-#ifdef GRUB_UTIL
-static grub_uint8_t jump[0x20] =
- {
- /* [MMI] add r15=r15,r1;; */
- 0x0b, 0x78, 0x3c, 0x02, 0x00, 0x20,
- /* ld8 r16=[r15],8 */
- 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0,
- /* mov r14=r1;; */
- 0x01, 0x08, 0x00, 0x84,
- /* [MIB] ld8 r1=[r15] */
- 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,
- /* mov b6=r16 */
- 0x60, 0x80, 0x04, 0x80, 0x03, 0x00,
- /* br.few b6;; */
- 0x60, 0x00, 0x80, 0x00
- };
-#else
-static const grub_uint8_t jump[0x20] =
- {
- /* ld8 r16=[r15],8 */
- 0x02, 0x80, 0x20, 0x1e, 0x18, 0x14,
- /* mov r14=r1;; */
- 0xe0, 0x00, 0x04, 0x00, 0x42, 0x00,
- /* nop.i 0x0 */
- 0x00, 0x00, 0x04, 0x00,
- /* ld8 r1=[r15] */
- 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,
- /* mov b6=r16 */
- 0x60, 0x80, 0x04, 0x80, 0x03, 0x00,
- /* br.few b6;; */
- 0x60, 0x00, 0x80, 0x00
- };
-#endif
-
-void
-grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t addr)
-{
- grub_memcpy (tr->nop, nopm, sizeof (tr->nop));
- tr->addr_hi[0] = ((addr & 0xc00000) >> 16);
- tr->addr_hi[1] = (addr >> 24) & 0xff;
- tr->addr_hi[2] = (addr >> 32) & 0xff;
- tr->addr_hi[3] = (addr >> 40) & 0xff;
- tr->addr_hi[4] = (addr >> 48) & 0xff;
- tr->addr_hi[5] = (addr >> 56) & 0xff;
- tr->e0 = 0xe0;
- tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01;
- tr->addr_lo[1] = (((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11)
- | ((addr & 0x200000) >> 17));
- tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19);
- tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60;
- grub_memcpy (tr->jump, jump, sizeof (tr->jump));
-}
-
-grub_err_t
-grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
- grub_size_t *got)
-{
- const Elf64_Ehdr *e = ehdr;
- grub_size_t cntt = 0, cntg = 0;
- const Elf64_Shdr *s;
- unsigned i;
-
- for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu64 (e->e_shoff));
- i < grub_le_to_cpu16 (e->e_shnum);
- i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
- if (s->sh_type == grub_cpu_to_le32_compile_time (SHT_RELA))
- {
- const Elf64_Rela *rel, *max;
-
- for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu64 (s->sh_offset)),
- max = (const Elf64_Rela *) ((char *) rel + grub_le_to_cpu64 (s->sh_size));
- rel < max; rel = (const Elf64_Rela *) ((char *) rel + grub_le_to_cpu64 (s->sh_entsize)))
- switch (ELF64_R_TYPE (grub_le_to_cpu64 (rel->r_info)))
- {
- case R_IA64_PCREL21B:
- cntt++;
- break;
- case R_IA64_LTOFF_FPTR22:
- case R_IA64_LTOFF22X:
- case R_IA64_LTOFF22:
- cntg++;
- break;
- }
- }
- *tramp = cntt * sizeof (struct grub_ia64_trampoline);
- *got = cntg * sizeof (grub_uint64_t);
-
- return GRUB_ERR_NONE;
-}
-
diff --git a/grub-core/kern/ia64/efi/init.c b/grub-core/kern/ia64/efi/init.c
deleted file mode 100644
index f1965571b1dc0dce..0000000000000000
--- a/grub-core/kern/ia64/efi/init.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* init.c - initialize an ia64-based EFI system */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/types.h>
-#include <grub/misc.h>
-#include <grub/mm.h>
-#include <grub/time.h>
-#include <grub/err.h>
-#include <grub/dl.h>
-#include <grub/kernel.h>
-#include <grub/efi/efi.h>
-#include <grub/loader.h>
-
-static grub_uint64_t divisor = 1;
-
-static grub_uint64_t
-get_itc (void)
-{
- grub_uint64_t ret;
- asm volatile ("mov %0=ar.itc" : "=r" (ret));
- return ret;
-}
-
-grub_uint64_t
-grub_rtc_get_time_ms (void)
-{
- return get_itc () / divisor;
-}
-
-void
-grub_machine_init (void)
-{
- grub_efi_event_t event;
- grub_uint64_t before, after;
- grub_efi_uintn_t idx;
- grub_efi_init ();
-
- efi_call_5 (grub_efi_system_table->boot_services->create_event,
- GRUB_EFI_EVT_TIMER, GRUB_EFI_TPL_CALLBACK, 0, 0, &event);
-
- before = get_itc ();
- efi_call_3 (grub_efi_system_table->boot_services->set_timer, event,
- GRUB_EFI_TIMER_RELATIVE, 200000);
- efi_call_3 (grub_efi_system_table->boot_services->wait_for_event, 1,
- &event, &idx);
- after = get_itc ();
- efi_call_1 (grub_efi_system_table->boot_services->close_event, event);
- divisor = (after - before + 5) / 20;
- if (divisor == 0)
- divisor = 800000;
- grub_install_get_time_ms (grub_rtc_get_time_ms);
-}
-
-void
-grub_machine_fini (int flags)
-{
- if (!(flags & GRUB_LOADER_FLAG_NORETURN))
- return;
-
- grub_efi_fini ();
-
- if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
- grub_efi_memory_fini ();
-}
diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S
deleted file mode 100644
index d75c6d7cc741d5eb..0000000000000000
--- a/grub-core/kern/ia64/efi/startup.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <config.h>
-#include <grub/symbol.h>
-#include <grub/offsets.h>
-
- .text
- .psr abi64
- .psr lsb
- .lsb
-
- .global _start
- .proc _start
-_start:
- alloc loc0=ar.pfs,2,4,0,0
- mov loc1=rp
- addl loc2=@gprel(grub_efi_image_handle),gp
- addl loc3=@gprel(grub_efi_system_table),gp
- ;;
- st8 [loc2]=in0
- st8 [loc3]=in1
- br.call.sptk.few rp=grub_main
- ;;
- mov ar.pfs=loc0
- mov rp=loc1
- ;;
- br.ret.sptk.few rp
-
- .endp _start
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index dfae4f9d7897a71d..dad79abf0c6fdebb 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -620,7 +620,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
grub_uint64_t q = 0;
grub_uint64_t m = 0;
- /* ARM and IA64 don't have a fast 32-bit division.
+ /* ARM doesn't have a fast 32-bit division.
Using that code would just make us use software division routines, calling
ourselves indirectly and hence getting infinite recursion.
*/
diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c
index 29d41364168eaeba..0b42be6740f246b7 100644
--- a/grub-core/lib/efi/halt.c
+++ b/grub-core/lib/efi/halt.c
@@ -30,7 +30,7 @@ grub_halt (void)
{
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
-#if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \
+#if !defined(__arm__) && !defined(__aarch64__) && \
!defined(__riscv)
grub_acpi_halt ();
#endif
diff --git a/grub-core/lib/ia64/longjmp.S b/grub-core/lib/ia64/longjmp.S
deleted file mode 100644
index 38afb2243c6b9f87..0000000000000000
--- a/grub-core/lib/ia64/longjmp.S
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- Note that __sigsetjmp() did NOT flush the register stack. Instead,
- we do it here since __longjmp() is usually much less frequently
- invoked than __sigsetjmp(). The only difficulty is that __sigsetjmp()
- didn't (and wouldn't be able to) save ar.rnat either. This is a problem
- because if we're not careful, we could end up loading random NaT bits.
- There are two cases:
-
- (i) ar.bsp < ia64_rse_rnat_addr(jmpbuf.ar_bsp)
- ar.rnat contains the desired bits---preserve ar.rnat
- across loadrs and write to ar.bspstore
-
- (ii) ar.bsp >= ia64_rse_rnat_addr(jmpbuf.ar_bsp)
- The desired ar.rnat is stored in
- ia64_rse_rnat_addr(jmpbuf.ar_bsp). Load those
- bits into ar.rnat after setting ar.bspstore. */
-
-
-
-# define pPos p6 /* is rotate count positive? */
-# define pNeg p7 /* is rotate count negative? */
-
-
- /* __longjmp(__jmp_buf buf, int val) */
-
- .text
-
- .proc EXT_C(grub_longjmp)
-FUNCTION(grub_longjmp)
- alloc r8=ar.pfs,2,1,0,0
- mov r27=ar.rsc
- add r2=0x98,in0 // r2 <- &jmpbuf.orig_jmp_buf_addr
- ;;
- ld8 r8=[r2],-16 // r8 <- orig_jmp_buf_addr
- mov r10=ar.bsp
- and r11=~0x3,r27 // clear ar.rsc.mode
- ;;
- flushrs // flush dirty regs to backing store (must be first in insn grp)
- ld8 r23=[r2],8 // r23 <- jmpbuf.ar_bsp
- sub r8=r8,in0 // r8 <- &orig_jmpbuf - &jmpbuf
- ;;
- ld8 r25=[r2] // r25 <- jmpbuf.ar_unat
- extr.u r8=r8,3,6 // r8 <- (&orig_jmpbuf - &jmpbuf)/8 & 0x3f
- ;;
- cmp.lt pNeg,pPos=r8,r0
- mov r2=in0
- ;;
-(pPos) mov r16=r8
-(pNeg) add r16=64,r8
-(pPos) sub r17=64,r8
-(pNeg) sub r17=r0,r8
- ;;
- mov ar.rsc=r11 // put RSE in enforced lazy mode
- shr.u r8=r25,r16
- add r3=8,in0 // r3 <- &jmpbuf.r1
- shl r9=r25,r17
- ;;
- or r25=r8,r9
- ;;
- mov r26=ar.rnat
- mov ar.unat=r25 // setup ar.unat (NaT bits for r1, r4-r7, and r12)
- ;;
- ld8.fill.nta sp=[r2],16 // r12 (sp)
- ld8.fill.nta gp=[r3],16 // r1 (gp)
- dep r11=-1,r23,3,6 // r11 <- ia64_rse_rnat_addr(jmpbuf.ar_bsp)
- ;;
- ld8.nta r16=[r2],16 // caller's unat
- ld8.nta r17=[r3],16 // fpsr
- ;;
- ld8.fill.nta r4=[r2],16 // r4
- ld8.fill.nta r5=[r3],16 // r5 (gp)
- cmp.geu p8,p0=r10,r11 // p8 <- (ar.bsp >= jmpbuf.ar_bsp)
- ;;
- ld8.fill.nta r6=[r2],16 // r6
- ld8.fill.nta r7=[r3],16 // r7
- ;;
- mov ar.unat=r16 // restore caller's unat
- mov ar.fpsr=r17 // restore fpsr
- ;;
- ld8.nta r16=[r2],16 // b0
- ld8.nta r17=[r3],16 // b1
- ;;
-(p8) ld8 r26=[r11] // r26 <- *ia64_rse_rnat_addr(jmpbuf.ar_bsp)
- mov ar.bspstore=r23 // restore ar.bspstore
- ;;
- ld8.nta r18=[r2],16 // b2
- ld8.nta r19=[r3],16 // b3
- ;;
- ld8.nta r20=[r2],16 // b4
- ld8.nta r21=[r3],16 // b5
- ;;
- ld8.nta r11=[r2],16 // ar.pfs
- ld8.nta r22=[r3],56 // ar.lc
- ;;
- ld8.nta r24=[r2],32 // pr
- mov b0=r16
- ;;
- ldf.fill.nta f2=[r2],32
- ldf.fill.nta f3=[r3],32
- mov b1=r17
- ;;
- ldf.fill.nta f4=[r2],32
- ldf.fill.nta f5=[r3],32
- mov b2=r18
- ;;
- ldf.fill.nta f16=[r2],32
- ldf.fill.nta f17=[r3],32
- mov b3=r19
- ;;
- ldf.fill.nta f18=[r2],32
- ldf.fill.nta f19=[r3],32
- mov b4=r20
- ;;
- ldf.fill.nta f20=[r2],32
- ldf.fill.nta f21=[r3],32
- mov b5=r21
- ;;
- ldf.fill.nta f22=[r2],32
- ldf.fill.nta f23=[r3],32
- mov ar.lc=r22
- ;;
- ldf.fill.nta f24=[r2],32
- ldf.fill.nta f25=[r3],32
- cmp.eq p8,p9=0,in1
- ;;
- ldf.fill.nta f26=[r2],32
- ldf.fill.nta f27=[r3],32
- mov ar.pfs=r11
- ;;
- ldf.fill.nta f28=[r2],32
- ldf.fill.nta f29=[r3],32
- ;;
- ldf.fill.nta f30=[r2]
- ldf.fill.nta f31=[r3]
-(p8) mov r8=1
-
- mov ar.rnat=r26 // restore ar.rnat
- ;;
- mov ar.rsc=r27 // restore ar.rsc
-(p9) mov r8=in1
-
- invala // virt. -> phys. regnum mapping may change
- mov pr=r24,-1
- br.ret.dptk.few rp
- .endp EXT_C(grub_longjmp)
diff --git a/grub-core/lib/ia64/setjmp.S b/grub-core/lib/ia64/setjmp.S
deleted file mode 100644
index a0382d83d602d9b4..0000000000000000
--- a/grub-core/lib/ia64/setjmp.S
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- The layout of the jmp_buf is as follows. This is subject to change
- and user-code should never depend on the particular layout of
- jmp_buf!
-
-
- offset: description:
- ------- ------------
- 0x000 stack pointer (r12) ; unchangeable (see _JMPBUF_UNWINDS)
- 0x008 r1 (gp)
- 0x010 caller's unat
- 0x018 fpsr
- 0x020 r4
- 0x028 r5
- 0x030 r6
- 0x038 r7
- 0x040 rp (b0)
- 0x048 b1
- 0x050 b2
- 0x058 b3
- 0x060 b4
- 0x068 b5
- 0x070 ar.pfs
- 0x078 ar.lc
- 0x080 pr
- 0x088 ar.bsp ; unchangeable (see __longjmp.S)
- 0x090 ar.unat
- 0x098 &__jmp_buf ; address of the jmpbuf (needed to locate NaT bits in unat)
- 0x0a0 f2
- 0x0b0 f3
- 0x0c0 f4
- 0x0d0 f5
- 0x0e0 f16
- 0x0f0 f17
- 0x100 f18
- 0x110 f19
- 0x120 f20
- 0x130 f21
- 0x130 f22
- 0x140 f23
- 0x150 f24
- 0x160 f25
- 0x170 f26
- 0x180 f27
- 0x190 f28
- 0x1a0 f29
- 0x1b0 f30
- 0x1c0 f31 */
-
-#include <grub/symbol.h>
-#include <grub/dl.h>
-
- .file "setjmp.S"
-
-GRUB_MOD_LICENSE "GPLv2+"
-
- /* The following two entry points are the traditional entry points: */
-
- .text
-
- .proc EXT_C(grub_setjmp)
-FUNCTION(grub_setjmp)
- alloc r8=ar.pfs,2,0,0,0
- mov in1=1
- br.cond.sptk.many __sigsetjmp
- .endp EXT_C(grub_setjmp)
-
- /* __sigsetjmp(__jmp_buf buf, int savemask) */
-
- .proc __sigsetjmp
-__sigsetjmp:
- //.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
- alloc loc1=ar.pfs,2,2,2,0
- mov r16=ar.unat
- ;;
- mov r17=ar.fpsr
- mov r2=in0
- add r3=8,in0
- ;;
- st8.spill.nta [r2]=sp,16 // r12 (sp)
- st8.spill.nta [r3]=gp,16 // r1 (gp)
- ;;
- st8.nta [r2]=r16,16 // save caller's unat
- st8.nta [r3]=r17,16 // save fpsr
- add r8=0xa0,in0
- ;;
- st8.spill.nta [r2]=r4,16 // r4
- st8.spill.nta [r3]=r5,16 // r5
- add r9=0xb0,in0
- ;;
- stf.spill.nta [r8]=f2,32
- stf.spill.nta [r9]=f3,32
- mov loc0=rp
- .body
- ;;
- stf.spill.nta [r8]=f4,32
- stf.spill.nta [r9]=f5,32
- mov r17=b1
- ;;
- stf.spill.nta [r8]=f16,32
- stf.spill.nta [r9]=f17,32
- mov r18=b2
- ;;
- stf.spill.nta [r8]=f18,32
- stf.spill.nta [r9]=f19,32
- mov r19=b3
- ;;
- stf.spill.nta [r8]=f20,32
- stf.spill.nta [r9]=f21,32
- mov r20=b4
- ;;
- stf.spill.nta [r8]=f22,32
- stf.spill.nta [r9]=f23,32
- mov r21=b5
- ;;
- stf.spill.nta [r8]=f24,32
- stf.spill.nta [r9]=f25,32
- mov r22=ar.lc
- ;;
- stf.spill.nta [r8]=f26,32
- stf.spill.nta [r9]=f27,32
- mov r24=pr
- ;;
- stf.spill.nta [r8]=f28,32
- stf.spill.nta [r9]=f29,32
- ;;
- stf.spill.nta [r8]=f30
- stf.spill.nta [r9]=f31
-
- st8.spill.nta [r2]=r6,16 // r6
- st8.spill.nta [r3]=r7,16 // r7
- ;;
- mov r23=ar.bsp
- mov r25=ar.unat
- mov out0=in0
-
- st8.nta [r2]=loc0,16 // b0
- st8.nta [r3]=r17,16 // b1
- mov out1=in1
- ;;
- st8.nta [r2]=r18,16 // b2
- st8.nta [r3]=r19,16 // b3
- ;;
- st8.nta [r2]=r20,16 // b4
- st8.nta [r3]=r21,16 // b5
- ;;
- st8.nta [r2]=loc1,16 // ar.pfs
- st8.nta [r3]=r22,16 // ar.lc
- ;;
- st8.nta [r2]=r24,16 // pr
- st8.nta [r3]=r23,16 // ar.bsp
- ;;
- st8.nta [r2]=r25 // ar.unat
- st8.nta [r3]=in0 // &__jmp_buf
- mov r8=0
- mov rp=loc0
- mov ar.pfs=loc1
- br.ret.sptk.many rp
-
- .endp __sigsetjmp
diff --git a/grub-core/lib/setjmp.S b/grub-core/lib/setjmp.S
index 9c8721088a3ff8f1..1bf29c3cce773658 100644
--- a/grub-core/lib/setjmp.S
+++ b/grub-core/lib/setjmp.S
@@ -12,9 +12,6 @@
#include "./mips/setjmp.S"
#elif defined(__powerpc__) || defined(__PPC__)
#include "./powerpc/setjmp.S"
-#elif defined(__ia64__)
-#include "./ia64/setjmp.S"
-#include "./ia64/longjmp.S"
#elif defined(__arm__)
#include "./arm/setjmp.S"
#elif defined(__aarch64__)
diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c
deleted file mode 100644
index fb9b961f71a20208..0000000000000000
--- a/grub-core/loader/ia64/efi/linux.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008,2010 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/loader.h>
-#include <grub/file.h>
-#include <grub/disk.h>
-#include <grub/err.h>
-#include <grub/misc.h>
-#include <grub/types.h>
-#include <grub/command.h>
-#include <grub/dl.h>
-#include <grub/mm.h>
-#include <grub/cache.h>
-#include <grub/kernel.h>
-#include <grub/efi/api.h>
-#include <grub/efi/efi.h>
-#include <grub/elf.h>
-#include <grub/i18n.h>
-#include <grub/env.h>
-#include <grub/linux.h>
-#include <grub/verify.h>
-
-GRUB_MOD_LICENSE ("GPLv3+");
-
-#pragma GCC diagnostic ignored "-Wcast-align"
-
-#define ALIGN_MIN (256*1024*1024)
-
-#define GRUB_ELF_SEARCH 1024
-
-#define BOOT_PARAM_SIZE 16384
-
-struct ia64_boot_param
-{
- grub_uint64_t command_line; /* physical address of command line. */
- grub_uint64_t efi_systab; /* physical address of EFI system table */
- grub_uint64_t efi_memmap; /* physical address of EFI memory map */
- grub_uint64_t efi_memmap_size; /* size of EFI memory map */
- grub_uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */
- grub_uint32_t efi_memdesc_version; /* memory descriptor version */
- struct
- {
- grub_uint16_t num_cols; /* number of columns on console output dev */
- grub_uint16_t num_rows; /* number of rows on console output device */
- grub_uint16_t orig_x; /* cursor's x position */
- grub_uint16_t orig_y; /* cursor's y position */
- } console_info;
- grub_uint64_t fpswa; /* physical address of the fpswa interface */
- grub_uint64_t initrd_start;
- grub_uint64_t initrd_size;
-};
-
-typedef struct
-{
- grub_uint32_t revision;
- grub_uint32_t reserved;
- void *fpswa;
-} fpswa_interface_t;
-static fpswa_interface_t *fpswa;
-
-#define NEXT_MEMORY_DESCRIPTOR(desc, size) \
- ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
-
-static grub_dl_t my_mod;
-
-static int loaded;
-
-/* Kernel base and size. */
-static void *kernel_mem;
-static grub_efi_uintn_t kernel_pages;
-static grub_uint64_t entry;
-
-/* Initrd base and size. */
-static void *initrd_mem;
-static grub_efi_uintn_t initrd_pages;
-static grub_efi_uintn_t initrd_size;
-
-static struct ia64_boot_param *boot_param;
-static grub_efi_uintn_t boot_param_pages;
-
-static inline grub_size_t
-page_align (grub_size_t size)
-{
- return (size + (1 << 12) - 1) & (~((1 << 12) - 1));
-}
-
-static void
-query_fpswa (void)
-{
- grub_efi_handle_t fpswa_image;
- grub_efi_boot_services_t *bs;
- grub_efi_status_t status;
- grub_efi_uintn_t size;
- static const grub_efi_guid_t fpswa_protocol =
- { 0xc41b6531, 0x97b9, 0x11d3,
- {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} };
-
- if (fpswa != NULL)
- return;
-
- size = sizeof(grub_efi_handle_t);
-
- bs = grub_efi_system_table->boot_services;
- status = bs->locate_handle (GRUB_EFI_BY_PROTOCOL,
- (void *) &fpswa_protocol,
- NULL, &size, &fpswa_image);
- if (status != GRUB_EFI_SUCCESS)
- {
- grub_printf ("%s\n", _("Could not locate FPSWA driver"));
- return;
- }
- status = bs->handle_protocol (fpswa_image,
- (void *) &fpswa_protocol, (void *) &fpswa);
- if (status != GRUB_EFI_SUCCESS)
- {
- grub_printf ("%s\n",
- _("FPSWA protocol wasn't able to find the interface"));
- return;
- }
-}
-
-static void
-free_pages (void)
-{
- if (kernel_mem)
- {
- grub_efi_free_pages ((grub_addr_t) kernel_mem, kernel_pages);
- kernel_mem = 0;
- }
-
- if (initrd_mem)
- {
- grub_efi_free_pages ((grub_addr_t) initrd_mem, initrd_pages);
- initrd_mem = 0;
- }
-
- if (boot_param)
- {
- /* Free bootparam. */
- grub_efi_free_pages ((grub_efi_physical_address_t) boot_param,
- boot_param_pages);
- boot_param = 0;
- }
-}
-
-static void *
-allocate_pages (grub_uint64_t align, grub_uint64_t size_pages,
- grub_uint64_t nobase)
-{
- grub_uint64_t size;
- grub_efi_uintn_t desc_size;
- grub_efi_memory_descriptor_t *mmap, *mmap_end;
- grub_efi_uintn_t mmap_size, tmp_mmap_size;
- grub_efi_memory_descriptor_t *desc;
- void *mem = NULL;
-
- size = size_pages << 12;
-
- mmap_size = grub_efi_find_mmap_size ();
- if (!mmap_size)
- return 0;
-
- /* Read the memory map temporarily, to find free space. */
- mmap = grub_malloc (mmap_size);
- if (! mmap)
- return 0;
-
- tmp_mmap_size = mmap_size;
- if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <= 0)
- {
- grub_error (GRUB_ERR_IO, "cannot get memory map");
- goto fail;
- }
-
- mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size);
-
- /* First, find free pages for the real mode code
- and the memory map buffer. */
- for (desc = mmap;
- desc < mmap_end;
- desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
- {
- grub_uint64_t start, end;
- grub_uint64_t aligned_start;
-
- if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
- continue;
-
- start = desc->physical_start;
- end = start + (desc->num_pages << 12);
- /* Align is a power of 2. */
- aligned_start = (start + align - 1) & ~(align - 1);
- if (aligned_start + size > end)
- continue;
- if (aligned_start == nobase)
- aligned_start += align;
- if (aligned_start + size > end)
- continue;
- mem = grub_efi_allocate_fixed (aligned_start, size_pages);
- if (! mem)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory");
- goto fail;
- }
- break;
- }
-
- if (! mem)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory");
- goto fail;
- }
-
- grub_free (mmap);
- return mem;
-
- fail:
- grub_free (mmap);
- free_pages ();
- return 0;
-}
-
-static void
-set_boot_param_console (void)
-{
- grub_efi_simple_text_output_interface_t *conout;
- grub_efi_uintn_t cols, rows;
-
- conout = grub_efi_system_table->con_out;
- if (conout->query_mode (conout, conout->mode->mode, &cols, &rows)
- != GRUB_EFI_SUCCESS)
- return;
-
- grub_dprintf ("linux",
- "Console info: cols=%lu rows=%lu x=%u y=%u\n",
- cols, rows,
- conout->mode->cursor_column, conout->mode->cursor_row);
-
- boot_param->console_info.num_cols = cols;
- boot_param->console_info.num_rows = rows;
- boot_param->console_info.orig_x = conout->mode->cursor_column;
- boot_param->console_info.orig_y = conout->mode->cursor_row;
-}
-
-static grub_err_t
-grub_linux_boot (void)
-{
- grub_efi_uintn_t mmap_size;
- grub_efi_uintn_t map_key;
- grub_efi_uintn_t desc_size;
- grub_efi_uint32_t desc_version;
- grub_efi_memory_descriptor_t *mmap_buf;
- grub_err_t err;
-
- /* FPSWA. */
- query_fpswa ();
- boot_param->fpswa = (grub_uint64_t)fpswa;
-
- /* Initrd. */
- boot_param->initrd_start = (grub_uint64_t)initrd_mem;
- boot_param->initrd_size = (grub_uint64_t)initrd_size;
-
- set_boot_param_console ();
-
- grub_dprintf ("linux", "Jump to %016lx\n", entry);
-
- /* MDT.
- Must be done after grub_machine_fini because map_key is used by
- exit_boot_services. */
- mmap_size = grub_efi_find_mmap_size ();
- if (! mmap_size)
- return grub_errno;
- mmap_buf = grub_efi_allocate_any_pages (page_align (mmap_size) >> 12);
- if (! mmap_buf)
- return grub_error (GRUB_ERR_IO, "cannot allocate memory map");
- err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key,
- &desc_size, &desc_version);
- if (err)
- return err;
-
- boot_param->efi_memmap = (grub_uint64_t)mmap_buf;
- boot_param->efi_memmap_size = mmap_size;
- boot_param->efi_memdesc_size = desc_size;
- boot_param->efi_memdesc_version = desc_version;
-
- /* See you next boot. */
- asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(entry),"r"(boot_param));
-
- /* Never reach here. */
- return GRUB_ERR_NONE;
-}
-
-static grub_err_t
-grub_linux_unload (void)
-{
- free_pages ();
- grub_dl_unref (my_mod);
- loaded = 0;
- return GRUB_ERR_NONE;
-}
-
-static grub_err_t
-grub_load_elf64 (grub_file_t file, void *buffer, const char *filename)
-{
- Elf64_Ehdr *ehdr = (Elf64_Ehdr *) buffer;
- Elf64_Phdr *phdr;
- int i;
- grub_uint64_t low_addr;
- grub_uint64_t high_addr;
- grub_uint64_t align;
- grub_uint64_t reloc_offset;
- const char *relocate;
-
- if (ehdr->e_ident[EI_MAG0] != ELFMAG0
- || ehdr->e_ident[EI_MAG1] != ELFMAG1
- || ehdr->e_ident[EI_MAG2] != ELFMAG2
- || ehdr->e_ident[EI_MAG3] != ELFMAG3
- || ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
- return grub_error(GRUB_ERR_UNKNOWN_OS,
- N_("invalid arch-independent ELF magic"));
-
- if (ehdr->e_ident[EI_CLASS] != ELFCLASS64
- || ehdr->e_version != EV_CURRENT
- || ehdr->e_machine != EM_IA_64)
- return grub_error (GRUB_ERR_UNKNOWN_OS,
- N_("invalid arch-dependent ELF magic"));
-
- if (ehdr->e_type != ET_EXEC)
- return grub_error (GRUB_ERR_UNKNOWN_OS,
- N_("this ELF file is not of the right type"));
-
- /* FIXME: Should we support program headers at strange locations? */
- if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > GRUB_ELF_SEARCH)
- return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset");
-
- entry = ehdr->e_entry;
-
- /* Compute low, high and align addresses. */
- low_addr = ~0UL;
- high_addr = 0;
- align = 0;
- for (i = 0; i < ehdr->e_phnum; i++)
- {
- phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff
- + i * ehdr->e_phentsize);
- if (phdr->p_type == PT_LOAD)
- {
- if (phdr->p_paddr < low_addr)
- low_addr = phdr->p_paddr;
- if (phdr->p_paddr + phdr->p_memsz > high_addr)
- high_addr = phdr->p_paddr + phdr->p_memsz;
- if (phdr->p_align > align)
- align = phdr->p_align;
- }
- }
-
- if (align < ALIGN_MIN)
- align = ALIGN_MIN;
-
- if (high_addr == 0)
- return grub_error (GRUB_ERR_BAD_OS, "no program entries");
-
- kernel_pages = page_align (high_addr - low_addr) >> 12;
-
- /* Undocumented on purpose. */
- relocate = grub_env_get ("linux_relocate");
- if (!relocate || grub_strcmp (relocate, "force") != 0)
- {
- kernel_mem = grub_efi_allocate_fixed (low_addr, kernel_pages);
- reloc_offset = 0;
- }
- /* Try to relocate. */
- if (! kernel_mem && (!relocate || grub_strcmp (relocate, "off") != 0))
- {
- kernel_mem = allocate_pages (align, kernel_pages, low_addr);
- if (kernel_mem)
- {
- reloc_offset = (grub_uint64_t)kernel_mem - low_addr;
- grub_dprintf ("linux", " Relocated at %p (offset=%016lx)\n",
- kernel_mem, reloc_offset);
- entry += reloc_offset;
- }
- }
- if (! kernel_mem)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "cannot allocate memory for OS");
-
- /* Load every loadable segment in memory. */
- for (i = 0; i < ehdr->e_phnum; i++)
- {
- phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff
- + i * ehdr->e_phentsize);
- if (phdr->p_type == PT_LOAD)
- {
- grub_dprintf ("linux", " [paddr=%lx load=%lx memsz=%08lx "
- "off=%lx flags=%x]\n",
- phdr->p_paddr, phdr->p_paddr + reloc_offset,
- phdr->p_memsz, phdr->p_offset, phdr->p_flags);
-
- if (grub_file_seek (file, phdr->p_offset) == (grub_off_t)-1)
- return grub_errno;
-
- if (grub_file_read (file, (void *) (phdr->p_paddr + reloc_offset),
- phdr->p_filesz)
- != (grub_ssize_t) phdr->p_filesz)
- {
- if (!grub_errno)
- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
- filename);
- return grub_errno;
- }
-
- if (phdr->p_filesz < phdr->p_memsz)
- grub_memset
- ((char *)(phdr->p_paddr + reloc_offset + phdr->p_filesz),
- 0, phdr->p_memsz - phdr->p_filesz);
-
- /* Sync caches if necessary. */
- if (phdr->p_flags & PF_X)
- grub_arch_sync_caches
- ((void *)(phdr->p_paddr + reloc_offset), phdr->p_memsz);
- }
- }
- loaded = 1;
- return 0;
-}
-
-static grub_err_t
-grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
- int argc, char *argv[])
-{
- grub_file_t file = 0;
- char buffer[GRUB_ELF_SEARCH];
- char *cmdline, *p;
- grub_ssize_t len;
- int i;
-
- grub_dl_ref (my_mod);
-
- grub_loader_unset ();
-
- if (argc == 0)
- {
- grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
- goto fail;
- }
-
- file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
- if (! file)
- goto fail;
-
- len = grub_file_read (file, buffer, sizeof (buffer));
- if (len < (grub_ssize_t) sizeof (Elf64_Ehdr))
- {
- if (!grub_errno)
- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
- argv[0]);
- goto fail;
- }
-
- grub_dprintf ("linux", "Loading linux: %s\n", argv[0]);
-
- if (grub_load_elf64 (file, buffer, argv[0]))
- goto fail;
-
- len = sizeof("BOOT_IMAGE=") + 8;
- for (i = 0; i < argc; i++)
- len += grub_strlen (argv[i]) + 1;
- len += sizeof (struct ia64_boot_param) + 512; /* Room for extensions. */
- boot_param_pages = page_align (len) >> 12;
- boot_param = grub_efi_allocate_any_pages (boot_param_pages);
- if (boot_param == 0)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "cannot allocate memory for bootparams");
- goto fail;
- }
-
- grub_memset (boot_param, 0, len);
- cmdline = ((char *)(boot_param + 1)) + 256;
-
- /* Build cmdline. */
- p = grub_stpcpy (cmdline, "BOOT_IMAGE");
- for (i = 0; i < argc; i++)
- {
- *p++ = ' ';
- p = grub_stpcpy (p, argv[i]);
- }
- cmdline[10] = '=';
-
- *p = '\0';
-
- if (grub_verify_string (cmdline, GRUB_VERIFY_KERNEL_CMDLINE))
- goto fail;
-
- boot_param->command_line = (grub_uint64_t) cmdline;
- boot_param->efi_systab = (grub_uint64_t) grub_efi_system_table;
-
- grub_errno = GRUB_ERR_NONE;
-
- grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
-
- fail:
- if (file)
- grub_file_close (file);
-
- if (grub_errno != GRUB_ERR_NONE)
- {
- grub_efi_free_pages ((grub_efi_physical_address_t) boot_param,
- boot_param_pages);
- grub_dl_unref (my_mod);
- }
- return grub_errno;
-}
-
-static grub_err_t
-grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
- int argc, char *argv[])
-{
- struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 };
-
- if (argc == 0)
- {
- grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
- goto fail;
- }
-
- if (! loaded)
- {
- grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
- goto fail;
- }
-
- if (grub_initrd_init (argc, argv, &initrd_ctx))
- goto fail;
-
- initrd_size = grub_get_initrd_size (&initrd_ctx);
- grub_dprintf ("linux", "Loading initrd\n");
-
- initrd_pages = (page_align (initrd_size) >> 12);
- initrd_mem = grub_efi_allocate_any_pages (initrd_pages);
- if (! initrd_mem)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate pages");
- goto fail;
- }
-
- grub_dprintf ("linux", "[addr=0x%lx, size=0x%lx]\n",
- (grub_uint64_t) initrd_mem, initrd_size);
-
- if (grub_initrd_load (&initrd_ctx, initrd_mem))
- goto fail;
- fail:
- grub_initrd_close (&initrd_ctx);
- return grub_errno;
-}
-
-static grub_err_t
-grub_cmd_fpswa (grub_command_t cmd __attribute__ ((unused)),
- int argc __attribute__((unused)),
- char *argv[] __attribute__((unused)))
-{
- query_fpswa ();
- if (fpswa == NULL)
- grub_puts_ (N_("No FPSWA found"));
- else
- grub_printf (_("FPSWA revision: %x\n"), fpswa->revision);
- return GRUB_ERR_NONE;
-}
-
-static grub_command_t cmd_linux, cmd_initrd, cmd_fpswa;
-
-GRUB_MOD_INIT(linux)
-{
- cmd_linux = grub_register_command ("linux", grub_cmd_linux,
- N_("FILE [ARGS...]"), N_("Load Linux."));
-
- cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
- N_("FILE"), N_("Load initrd."));
-
- cmd_fpswa = grub_register_command ("fpswa", grub_cmd_fpswa,
- "", N_("Display FPSWA version."));
-
- my_mod = mod;
-}
-
-GRUB_MOD_FINI(linux)
-{
- grub_unregister_command (cmd_linux);
- grub_unregister_command (cmd_initrd);
- grub_unregister_command (cmd_fpswa);
-}
diff --git a/include/grub/cache.h b/include/grub/cache.h
index 7aa8d793395ad2c9..0a424616f9c2c92d 100644
--- a/include/grub/cache.h
+++ b/include/grub/cache.h
@@ -34,7 +34,7 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#endif
#ifndef GRUB_MACHINE_EMU
-#if defined (__aarch64__) || defined (__ia64__) || defined (__powerpc__) || \
+#if defined (__aarch64__) || defined (__powerpc__) || \
defined (__sparc__)
#elif defined (__i386__) || defined (__x86_64__)
diff --git a/include/grub/dl.h b/include/grub/dl.h
index acb4d42327d78ebd..7b4841b0be54bdc3 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -271,21 +271,11 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
void grub_arch_dl_init_linker (void);
#endif
-#define GRUB_IA64_DL_TRAMP_ALIGN 16
-#define GRUB_IA64_DL_GOT_ALIGN 16
-
-grub_err_t
-grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
- grub_size_t *got);
grub_err_t
grub_arm64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
grub_size_t *got);
-#if defined (__ia64__)
-#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
-#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
-#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
-#elif defined (__aarch64__)
+#if defined (__aarch64__)
#define grub_arch_dl_get_tramp_got_size grub_arm64_dl_get_tramp_got_size
#else
grub_err_t
diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
index 98c4ff177e19f0fa..57743cd8dcb5b0ad 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -84,7 +84,6 @@ struct grub_pe32_coff_header
};
#define GRUB_PE32_MACHINE_I386 0x14c
-#define GRUB_PE32_MACHINE_IA64 0x200
#define GRUB_PE32_MACHINE_X86_64 0x8664
#define GRUB_PE32_MACHINE_ARMTHUMB_MIXED 0x01c2
#define GRUB_PE32_MACHINE_ARM64 0xAA64
@@ -304,7 +303,6 @@ struct grub_pe32_fixup_block
#define GRUB_PE32_REL_BASED_ARM_MOV32T 7
#define GRUB_PE32_REL_BASED_RISCV_LOW12I 7
#define GRUB_PE32_REL_BASED_RISCV_LOW12S 8
-#define GRUB_PE32_REL_BASED_IA64_IMM64 9
#define GRUB_PE32_REL_BASED_DIR64 10
#define GRUB_PE32_REL_BASED_HIGH3ADJ 11
diff --git a/include/grub/elf.h b/include/grub/elf.h
index e6f073bc90331cd4..10d9a119928c730c 100644
--- a/include/grub/elf.h
+++ b/include/grub/elf.h
@@ -2233,115 +2233,6 @@ typedef Elf32_Addr Elf32_Conflict;
/* Keep this the last entry. */
#define R_ARM_NUM 256
-/* IA-64 specific declarations. */
-
-/* Processor specific flags for the Ehdr e_flags field. */
-#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */
-#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
-#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
-
-/* Processor specific values for the Phdr p_type field. */
-#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
-#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */
-
-/* Processor specific flags for the Phdr p_flags field. */
-#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */
-
-/* Processor specific values for the Shdr sh_type field. */
-#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
-#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
-
-/* Processor specific flags for the Shdr sh_flags field. */
-#define SHF_IA_64_SHORT 0x10000000 /* section near gp */
-#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */
-
-/* Processor specific values for the Dyn d_tag field. */
-#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
-#define DT_IA_64_NUM 1
-
-/* IA-64 relocations. */
-#define R_IA64_NONE 0x00 /* none */
-#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
-#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
-#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
-#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
-#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
-#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
-#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
-#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
-#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
-#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
-#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
-#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
-#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
-#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
-#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
-#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
-#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
-#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
-#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
-#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
-#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
-#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
-#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
-#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */
-#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
-#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
-#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
-#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
-#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
-#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
-#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
-#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
-#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
-#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
-#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
-#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
-#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
-#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
-#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
-#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
-#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
-#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
-#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
-#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
-#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
-#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
-#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
-#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
-#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */
-#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */
-#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */
-#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */
-#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
-#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
-#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */
-#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
-#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
-#define R_IA64_COPY 0x84 /* copy relocation */
-#define R_IA64_SUB 0x85 /* Addend and symbol difference */
-#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
-#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
-#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
-#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
-#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */
-#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
-#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
-#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
-#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
-#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */
-#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */
-#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */
-#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
-#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
-#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
-#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
-#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
-
/* SH specific declarations */
/* SH relocs. */
diff --git a/include/grub/ia64/efi/memory.h b/include/grub/ia64/efi/memory.h
deleted file mode 100644
index 2c64918e3f711610..0000000000000000
--- a/include/grub/ia64/efi/memory.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef GRUB_MEMORY_CPU_HEADER
-#include <grub/efi/memory.h>
-
-#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffff
-
-#endif /* ! GRUB_MEMORY_CPU_HEADER */
diff --git a/include/grub/ia64/efi/time.h b/include/grub/ia64/efi/time.h
deleted file mode 100644
index 897ce9c00738b834..0000000000000000
--- a/include/grub/ia64/efi/time.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef GRUB_MACHINE_TIME_HEADER
-#define GRUB_MACHINE_TIME_HEADER 1
-
-#include <grub/efi/time.h>
-
-#endif /* ! GRUB_MACHINE_TIME_HEADER */
diff --git a/include/grub/ia64/kernel.h b/include/grub/ia64/kernel.h
deleted file mode 100644
index c5496a00b65afbad..0000000000000000
--- a/include/grub/ia64/kernel.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2010 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_CPU_KERNEL_HEADER
-#define GRUB_CPU_KERNEL_HEADER 1
-
-#define GRUB_MOD_ALIGN 0x1
-#define GRUB_MOD_GAP 0x0
-
-#endif /* ! GRUB_CPU_KERNEL_HEADER */
diff --git a/include/grub/ia64/reloc.h b/include/grub/ia64/reloc.h
deleted file mode 100644
index 45c8fba2728ce5b3..0000000000000000
--- a/include/grub/ia64/reloc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2013 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_IA64_RELOC_H
-#define GRUB_IA64_RELOC_H 1
-
-struct grub_ia64_trampoline;
-
-void
-grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value);
-void
-grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value);
-void
-grub_ia64_set_immu64 (grub_addr_t addr, grub_uint64_t value);
-void
-grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t addr);
-
-struct grub_ia64_trampoline
-{
- /* nop.m */
- grub_uint8_t nop[5];
- /* movl r15 = addr*/
- grub_uint8_t addr_hi[6];
- grub_uint8_t e0;
- grub_uint8_t addr_lo[4];
- grub_uint8_t jump[0x20];
-};
-
-#endif
diff --git a/include/grub/ia64/setjmp.h b/include/grub/ia64/setjmp.h
deleted file mode 100644
index 0a62113795ef49b3..0000000000000000
--- a/include/grub/ia64/setjmp.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version.
- Copyright (C) 1999, 2000, 2008 Free Software Foundation, Inc.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* User code must not depend on the internal representation of jmp_buf. */
-
-#define _JBLEN 70
-
-/* the __jmp_buf element type should be __float80 per ABI... */
-typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
-
-int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
-void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
diff --git a/include/grub/ia64/time.h b/include/grub/ia64/time.h
deleted file mode 100644
index 03ee79fa4e454dd2..0000000000000000
--- a/include/grub/ia64/time.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2007, 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef KERNEL_CPU_TIME_HEADER
-#define KERNEL_CPU_TIME_HEADER 1
-
-static __inline void
-grub_cpu_idle (void)
-{
- /* FIXME: not implemented */
-}
-
-#endif /* ! KERNEL_CPU_TIME_HEADER */
diff --git a/include/grub/ia64/types.h b/include/grub/ia64/types.h
deleted file mode 100644
index 91a546dd2c5e9080..0000000000000000
--- a/include/grub/ia64/types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2008 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_TYPES_CPU_HEADER
-#define GRUB_TYPES_CPU_HEADER 1
-
-/* The size of void *. */
-#define GRUB_TARGET_SIZEOF_VOID_P 8
-
-/* The size of long. */
-#define GRUB_TARGET_SIZEOF_LONG 8
-
-/* ia64 is little-endian (usually). */
-#undef GRUB_TARGET_WORDS_BIGENDIAN
-
-
-#endif /* ! GRUB_TYPES_CPU_HEADER */
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 6c9d56de9264ff20..b12ded5b1b9577be 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -392,7 +392,7 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint64_t *r);
/* Must match softdiv group in gentpl.py. */
-#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__ia64__) || \
+#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || \
(defined(__riscv) && (__riscv_xlen == 32)))
#define GRUB_DIVISION_IN_SOFTWARE 1
#else
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index 7d7445af9815eb93..2785eddc1ac3f202 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -97,7 +97,6 @@ enum grub_install_plat
GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275,
GRUB_INSTALL_PLATFORM_MIPSEL_ARC,
GRUB_INSTALL_PLATFORM_MIPS_ARC,
- GRUB_INSTALL_PLATFORM_IA64_EFI,
GRUB_INSTALL_PLATFORM_ARM_UBOOT,
GRUB_INSTALL_PLATFORM_ARM_EFI,
GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS,
diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h
index 3819a67441c86958..7c31c23d302a7000 100644
--- a/include/grub/util/mkimage.h
+++ b/include/grub/util/mkimage.h
@@ -29,11 +29,9 @@ struct grub_mkimage_layout
void *reloc_section;
size_t reloc_size;
size_t align;
- grub_size_t ia64jmp_off;
grub_size_t tramp_off;
grub_size_t got_off;
grub_size_t got_size;
- unsigned ia64jmpnum;
grub_uint32_t bss_start;
grub_uint32_t end;
};
diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in
index 24a811418aad8dfa..78a411e0984a7cf0 100644
--- a/tests/core_compress_test.in
+++ b/tests/core_compress_test.in
@@ -21,7 +21,7 @@ grubshell=@builddir@/grub-shell
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
# FIXME: Only mips currently supports configurable core compression
- *-emu | i386-* | x86_64-* | sparc64-* | ia64-*)
+ *-emu | i386-* | x86_64-* | sparc64-*)
exit 77
;;
esac
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index e45fb290307150bc..6fa9776df078d1d9 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -903,7 +903,6 @@ static struct
[GRUB_INSTALL_PLATFORM_MIPS_ARC] = { "mips", "arc" },
[GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275] = { "sparc64", "ieee1275" },
[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc", "ieee1275" },
- [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64", "efi" },
[GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" },
[GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" },
[GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" },
diff --git a/util/grub-install.c b/util/grub-install.c
index 53b46480428878cb..db7b3e7dfc613310 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -316,8 +316,6 @@ get_default_platform (void)
return "mipsel-loongson";
#elif defined (__MIPSEB__)
return "mips-arc";
-#elif defined (__ia64__)
- return "ia64-efi";
#elif defined (__arm__)
return grub_install_get_default_arm_platform ();
#elif defined (__aarch64__)
@@ -482,7 +480,6 @@ have_bootdev (enum grub_install_plat pl)
case GRUB_INSTALL_PLATFORM_I386_PC:
case GRUB_INSTALL_PLATFORM_I386_EFI:
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
case GRUB_INSTALL_PLATFORM_ARM_EFI:
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
@@ -925,7 +922,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
@@ -972,7 +968,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_QEMU:
@@ -1027,7 +1022,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
is_efi = 1;
break;
default:
@@ -1150,9 +1144,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
efi_file = "BOOTX64.EFI";
break;
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
- efi_file = "BOOTIA64.EFI";
- break;
case GRUB_INSTALL_PLATFORM_ARM_EFI:
efi_file = "BOOTARM.EFI";
break;
@@ -1183,9 +1174,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
efi_file = "grubx64.efi";
break;
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
- efi_file = "grubia64.efi";
- break;
case GRUB_INSTALL_PLATFORM_ARM_EFI:
efi_file = "grubarm.efi";
break;
@@ -1502,7 +1490,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
g = grub_util_guess_efi_drive (*curdev);
break;
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
@@ -1597,7 +1584,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
core_name = "core.efi";
snprintf (mkimage_target, sizeof (mkimage_target),
"%s-%s",
@@ -1702,7 +1688,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
case GRUB_INSTALL_PLATFORM_I386_COREBOOT:
@@ -1957,7 +1942,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
{
char *dst = grub_util_path_concat (2, efidir, efi_file);
grub_install_copy_file (imgfile, dst, 1);
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
index c0d559937020b2d2..080e7c0d69576dc5 100644
--- a/util/grub-mkimage.c
+++ b/util/grub-mkimage.c
@@ -42,7 +42,6 @@
#include <grub/efi/pe32.h>
#include <grub/uboot/image.h>
#include <grub/arm/reloc.h>
-#include <grub/ia64/reloc.h>
#include <grub/osdep/hostfile.h>
#include <grub/util/install.h>
#include <grub/emu/config.h>
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index c5fb336e97584817..675ee6f771a695a5 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -43,7 +43,6 @@
#include <grub/uboot/image.h>
#include <grub/arm/reloc.h>
#include <grub/arm64/reloc.h>
-#include <grub/ia64/reloc.h>
#include <grub/osdep/hostfile.h>
#include <grub/util/install.h>
#include <grub/util/mkimage.h>
@@ -657,32 +656,6 @@ SUFFIX (get_target_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Addr offset,
return (Elf_Addr *) ((char *) e + grub_target_to_host (s->sh_offset) + offset);
}
-#ifdef MKIMAGE_ELF64
-static Elf_Addr
-SUFFIX (count_funcs) (Elf_Ehdr *e, Elf_Shdr *symtab_section,
- const struct grub_install_image_target_desc *image_target)
-{
- Elf_Word symtab_size, sym_size, num_syms;
- Elf_Off symtab_offset;
- Elf_Sym *sym;
- Elf_Word i;
- int ret = 0;
-
- symtab_size = grub_target_to_host (symtab_section->sh_size);
- sym_size = grub_target_to_host (symtab_section->sh_entsize);
- symtab_offset = grub_target_to_host (symtab_section->sh_offset);
- num_syms = symtab_size / sym_size;
-
- for (i = 0, sym = (Elf_Sym *) ((char *) e + symtab_offset);
- i < num_syms;
- i++, sym = (Elf_Sym *) ((char *) sym + sym_size))
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- ret++;
-
- return ret;
-}
-#endif
-
#ifdef MKIMAGE_ELF32
/* Deal with relocation information. This function relocates addresses
within the virtual address space starting from 0. So only relative
@@ -781,7 +754,6 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
Elf_Half i;
Elf_Shdr *s;
#ifdef MKIMAGE_ELF64
- struct grub_ia64_trampoline *tr = (void *) (pe_target + tramp_off);
grub_uint64_t *gpptr = (void *) (pe_target + got_off);
unsigned unmatched_adr_got_page = 0;
#define MASK19 ((1 << 19) - 1)
@@ -947,87 +919,6 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
break;
}
break;
- case EM_IA_64:
- switch (ELF_R_TYPE (info))
- {
- case R_IA64_PCREL21B:
- {
- grub_uint64_t noff;
- grub_ia64_make_trampoline (tr, addend + sym_addr);
- noff = ((char *) tr - (char *) pe_target
- - target_section_addr - (offset & ~3)) >> 4;
- tr++;
- if (noff & ~MASK19)
- grub_util_error ("trampoline offset too big (%"
- GRUB_HOST_PRIxLONG_LONG ")",
- (unsigned long long) noff);
- grub_ia64_add_value_to_slot_20b ((grub_addr_t) target, noff);
- }
- break;
-
- case R_IA64_LTOFF22X:
- case R_IA64_LTOFF22:
- {
- Elf_Sym *sym;
-
- sym = (Elf_Sym *) ((char *) e
- + grub_target_to_host (smd->symtab->sh_offset)
- + ELF_R_SYM (info) * grub_target_to_host (smd->symtab->sh_entsize));
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
- sym_addr = grub_target_to_host64 (*(grub_uint64_t *) (pe_target
- + sym->st_value
- - image_target->vaddr_offset));
- }
- /* FALLTHROUGH */
- case R_IA64_LTOFF_FPTR22:
- *gpptr = grub_host_to_target64 (addend + sym_addr);
- grub_ia64_add_value_to_slot_21 ((grub_addr_t) target,
- (char *) gpptr - (char *) pe_target
- + image_target->vaddr_offset);
- gpptr++;
- break;
-
- case R_IA64_GPREL22:
- grub_ia64_add_value_to_slot_21 ((grub_addr_t) target,
- addend + sym_addr);
- break;
- case R_IA64_GPREL64I:
- grub_ia64_set_immu64 ((grub_addr_t) target,
- addend + sym_addr);
- break;
- case R_IA64_PCREL64LSB:
- *target = grub_host_to_target64 (grub_target_to_host64 (*target)
- + addend + sym_addr
- - target_section_addr - offset
- - image_target->vaddr_offset);
- break;
-
- case R_IA64_SEGREL64LSB:
- *target = grub_host_to_target64 (grub_target_to_host64 (*target)
- + addend + sym_addr - target_section_addr);
- break;
- case R_IA64_DIR64LSB:
- case R_IA64_FPTR64LSB:
- *target = grub_host_to_target64 (grub_target_to_host64 (*target)
- + addend + sym_addr);
- grub_util_info ("relocating a direct entry to 0x%"
- GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
- GRUB_HOST_PRIxLONG_LONG,
- (unsigned long long)
- grub_target_to_host64 (*target),
- (unsigned long long) offset);
- break;
-
- /* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
- case R_IA64_LDXMOV:
- break;
-
- default:
- grub_util_error (_("relocation 0x%x is not implemented yet"),
- (unsigned int) ELF_R_TYPE (info));
- break;
- }
- break;
case EM_AARCH64:
{
sym_addr += addend;
@@ -1595,42 +1486,6 @@ translate_relocation_pe (struct translate_context *ctx,
image_target);
}
break;
- case EM_IA_64:
- switch (ELF_R_TYPE (info))
- {
- case R_IA64_PCREL64LSB:
- case R_IA64_LDXMOV:
- case R_IA64_PCREL21B:
- case R_IA64_LTOFF_FPTR22:
- case R_IA64_LTOFF22X:
- case R_IA64_LTOFF22:
- case R_IA64_GPREL22:
- case R_IA64_GPREL64I:
- case R_IA64_SEGREL64LSB:
- break;
-
- case R_IA64_FPTR64LSB:
- case R_IA64_DIR64LSB:
-#if 1
- {
- grub_util_info ("adding a relocation entry for 0x%"
- GRUB_HOST_PRIxLONG_LONG,
- (unsigned long long) addr);
- ctx->current_address
- = add_fixup_entry (&ctx->lst,
- GRUB_PE32_REL_BASED_DIR64,
- addr,
- 0, ctx->current_address,
- image_target);
- }
-#endif
- break;
- default:
- grub_util_error (_("relocation 0x%x is not implemented yet"),
- (unsigned int) ELF_R_TYPE (info));
- break;
- }
- break;
case EM_AARCH64:
#if defined(MKIMAGE_ELF64)
switch (ELF_R_TYPE (info))
@@ -2012,13 +1867,7 @@ make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout,
}
}
- if (image_target->elf_target == EM_IA_64)
- create_u64_fixups (&ctx,
- layout->ia64jmp_off
- + image_target->vaddr_offset,
- 2 * layout->ia64jmpnum,
- image_target);
- if (image_target->elf_target == EM_IA_64 || image_target->elf_target == EM_AARCH64)
+ if (image_target->elf_target == EM_AARCH64)
create_u64_fixups (&ctx,
layout->got_off
+ image_target->vaddr_offset,
@@ -2360,25 +2209,6 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
if (! smd.symtab)
grub_util_error ("%s", _("no symbol table"));
#ifdef MKIMAGE_ELF64
- if (image_target->elf_target == EM_IA_64)
- {
- grub_size_t tramp;
-
- layout->kernel_size = ALIGN_UP (layout->kernel_size, 16);
-
- grub_ia64_dl_get_tramp_got_size (e, &tramp, &layout->got_size);
-
- layout->tramp_off = layout->kernel_size;
- layout->kernel_size += ALIGN_UP (tramp, 16);
-
- layout->ia64jmp_off = layout->kernel_size;
- layout->ia64jmpnum = SUFFIX (count_funcs) (e, smd.symtab,
- image_target);
- layout->kernel_size += 16 * layout->ia64jmpnum;
-
- layout->got_off = layout->kernel_size;
- layout->kernel_size += ALIGN_UP (layout->got_size, 16);
- }
if (image_target->elf_target == EM_AARCH64)
{
grub_size_t tramp;
@@ -2408,8 +2238,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
if (is_relocatable (image_target))
{
layout->start_address = SUFFIX (relocate_symbols) (e, &smd,
- (char *) out_img + layout->ia64jmp_off,
- layout->ia64jmp_off + image_target->vaddr_offset,
+ (char *) out_img, image_target->vaddr_offset,
layout->bss_start, layout->end, image_target);
if (layout->start_address == (Elf_Addr) -1)
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c
index d609ff94cca29de7..cb1c3f03c4058fb8 100644
--- a/util/grub-mknetdir.c
+++ b/util/grub-mknetdir.c
@@ -105,7 +105,6 @@ static const struct
[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc-ieee1275", "ofnet", ".elf" },
[GRUB_INSTALL_PLATFORM_I386_EFI] = { "i386-efi", "efinet", ".efi" },
[GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64-efi", "efinet", ".efi" },
- [GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64-efi", "efinet", ".efi" },
[GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm-efi", "efinet", ".efi" },
[GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64-efi", "efinet", ".efi" },
[GRUB_INSTALL_PLATFORM_RISCV32_EFI] = { "riscv32-efi", "efinet", ".efi" },
diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
index 1e0e40ca6ab6e0eb..a0e17cdb9651acbc 100644
--- a/util/grub-mkrescue.c
+++ b/util/grub-mkrescue.c
@@ -270,7 +270,6 @@ make_image_abs (enum grub_install_plat plat,
{
case GRUB_INSTALL_PLATFORM_I386_EFI:
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
case GRUB_INSTALL_PLATFORM_ARM_EFI:
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
@@ -558,7 +557,6 @@ main (int argc, char *argv[])
if (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC]
|| source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275]
|| source_dirs[GRUB_INSTALL_PLATFORM_I386_EFI]
- || source_dirs[GRUB_INSTALL_PLATFORM_IA64_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_ARM_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_ARM64_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_RISCV32_EFI]
@@ -758,7 +756,6 @@ main (int argc, char *argv[])
if (source_dirs[GRUB_INSTALL_PLATFORM_I386_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_X86_64_EFI]
- || source_dirs[GRUB_INSTALL_PLATFORM_IA64_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_ARM_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_ARM64_EFI]
|| source_dirs[GRUB_INSTALL_PLATFORM_RISCV32_EFI]
@@ -788,10 +785,6 @@ main (int argc, char *argv[])
free (diskdir_uuid);
free (diskdir);
- imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi");
- make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
- free (imgname);
-
grub_install_push_module ("part_apple");
img64 = grub_util_path_concat (2, efidir_efi_boot, "bootx64.efi");
make_image_abs (GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64-efi", img64);
diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
index 163529ca9c25422e..e64239b2ffcbf49b 100644
--- a/util/grub-module-verifier.c
+++ b/util/grub-module-verifier.c
@@ -48,28 +48,6 @@ struct grub_module_verifier_arch archs[] = {
R_SPARC_32,
-1
} },
- { "ia64", 8, 0, EM_IA_64, GRUB_MODULE_VERIFY_SUPPORTS_RELA, (int[]){
- R_IA64_PCREL21B, /* We should verify that it's pointing either
- to a function or to a section in the same module.
- Checking that external symbol is a function is
- non-trivial and I have never seen this relocation used
- for anything else, so assume that it always points to a
- function.
- */
- R_IA64_SEGREL64LSB,
- R_IA64_FPTR64LSB,
- R_IA64_DIR64LSB,
- R_IA64_PCREL64LSB,
- R_IA64_LTOFF22X,
- R_IA64_LTOFF22,
- R_IA64_GPREL64I,
- R_IA64_LTOFF_FPTR22,
- R_IA64_LDXMOV,
- -1
- }, (int[]){
- R_IA64_GPREL22,
- -1
- } },
{ "mipsel", 4, 0, EM_MIPS, GRUB_MODULE_VERIFY_SUPPORTS_REL | GRUB_MODULE_VERIFY_SUPPORTS_RELA, (int[]){
R_MIPS_HI16,
R_MIPS_LO16,
diff --git a/util/mkimage.c b/util/mkimage.c
index 43078c71cd995889..a21a19e37fa9d599 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -43,7 +43,6 @@
#include <grub/uboot/image.h>
#include <grub/arm/reloc.h>
#include <grub/arm64/reloc.h>
-#include <grub/ia64/reloc.h>
#include <grub/osdep/hostfile.h>
#include <grub/util/install.h>
#include <grub/util/mkimage.h>
@@ -409,22 +408,6 @@ static const struct grub_install_image_target_desc image_targets[] =
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR,
.mod_align = GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN,
},
- {
- .dirname = "ia64-efi",
- .names = {"ia64-efi", NULL},
- .voidp_sizeof = 8,
- .bigendian = 0,
- .id = IMAGE_EFI,
- .flags = PLATFORM_FLAGS_NONE,
- .total_module_size = TARGET_NO_FIELD,
- .decompressor_compressed_size = TARGET_NO_FIELD,
- .decompressor_uncompressed_size = TARGET_NO_FIELD,
- .decompressor_uncompressed_addr = TARGET_NO_FIELD,
- .section_align = GRUB_PE32_SECTION_ALIGNMENT,
- .vaddr_offset = EFI64_HEADER_SIZE,
- .pe_target = GRUB_PE32_MACHINE_IA64,
- .elf_target = EM_IA_64,
- },
{
.dirname = "mips-arc",
.names = {"mips-arc", NULL},
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 2/6] efi: Make EFI PXE protocol methods non-callable
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 3/6] efi: Add calling convention annotation to all prototypes Ard Biesheuvel
` (3 subsequent siblings)
5 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
The grub_efi_pxe_t struct definition has placeholders for the various
protocol method pointers, given that they are never called in the code,
and the prototypes have been omitted, and therefore do not comply with
the UEFI spec.
So let's convert them into void* pointers, so they cannot be called
inadvertently.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
include/grub/efi/api.h | 24 ++++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index b4c4646651cd53f5..da1a80ca3a94fe1c 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1539,18 +1539,18 @@ typedef struct grub_efi_pxe_mode
typedef struct grub_efi_pxe
{
grub_uint64_t rev;
- void (*start) (void);
- void (*stop) (void);
- void (*dhcp) (void);
- void (*discover) (void);
- void (*mftp) (void);
- void (*udpwrite) (void);
- void (*udpread) (void);
- void (*setipfilter) (void);
- void (*arp) (void);
- void (*setparams) (void);
- void (*setstationip) (void);
- void (*setpackets) (void);
+ void *start;
+ void *stop;
+ void *dhcp;
+ void *discover;
+ void *mftp;
+ void *udpwrite;
+ void *udpread;
+ void *setipfilter;
+ void *arp;
+ void *setparams;
+ void *setstationip;
+ void *setpackets;
struct grub_efi_pxe_mode *mode;
} grub_efi_pxe_t;
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 3/6] efi: Add calling convention annotation to all prototypes
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 2/6] efi: Make EFI PXE protocol methods non-callable Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 4/6] efi: Drop all uses of efi_call_XX wrappers Ard Biesheuvel
` (2 subsequent siblings)
5 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
UEFI mandates MS calling convention on x86_64, which was not supported
on GCC when UEFI support was first introduced into GRUB. However, now we
can use the ms_abi function type attribute to annotate functions and
function pointers as adhering to the MS calling convention, and the
compiler will generate the correct instruction sequence for us.
So let's add the appropriate annotation to all the function prototypes.
This will allow us to drop the special call wrappers in a subsequent
patch.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
grub-core/kern/arm/efi/init.c | 2 +-
include/grub/efi/api.h | 569 ++++++++++----------
include/grub/efi/tpm.h | 149 +++--
3 files changed, 373 insertions(+), 347 deletions(-)
diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
index 7fcf91bf41168d4a..ab48342f3cda116d 100644
--- a/grub-core/kern/arm/efi/init.c
+++ b/grub-core/kern/arm/efi/init.c
@@ -34,7 +34,7 @@ grub_efi_get_time_ms (void)
return tmr;
}
-static void
+static void __grub_efi_api
increment_timer (grub_efi_event_t event __attribute__ ((unused)),
void *context __attribute__ ((unused)))
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index da1a80ca3a94fe1c..b145211003954092 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1127,209 +1127,210 @@ struct grub_efi_boot_services
grub_efi_table_header_t hdr;
grub_efi_tpl_t
- (*raise_tpl) (grub_efi_tpl_t new_tpl);
+ (__grub_efi_api *raise_tpl) (grub_efi_tpl_t new_tpl);
void
- (*restore_tpl) (grub_efi_tpl_t old_tpl);
+ (__grub_efi_api *restore_tpl) (grub_efi_tpl_t old_tpl);
grub_efi_status_t
- (*allocate_pages) (grub_efi_allocate_type_t type,
- grub_efi_memory_type_t memory_type,
- grub_efi_uintn_t pages,
- grub_efi_physical_address_t *memory);
+ (__grub_efi_api *allocate_pages) (grub_efi_allocate_type_t type,
+ grub_efi_memory_type_t memory_type,
+ grub_efi_uintn_t pages,
+ grub_efi_physical_address_t *memory);
grub_efi_status_t
- (*free_pages) (grub_efi_physical_address_t memory,
- grub_efi_uintn_t pages);
+ (__grub_efi_api *free_pages) (grub_efi_physical_address_t memory,
+ grub_efi_uintn_t pages);
grub_efi_status_t
- (*get_memory_map) (grub_efi_uintn_t *memory_map_size,
- grub_efi_memory_descriptor_t *memory_map,
- grub_efi_uintn_t *map_key,
- grub_efi_uintn_t *descriptor_size,
- grub_efi_uint32_t *descriptor_version);
+ (__grub_efi_api *get_memory_map) (grub_efi_uintn_t *memory_map_size,
+ grub_efi_memory_descriptor_t *memory_map,
+ grub_efi_uintn_t *map_key,
+ grub_efi_uintn_t *descriptor_size,
+ grub_efi_uint32_t *descriptor_version);
grub_efi_status_t
- (*allocate_pool) (grub_efi_memory_type_t pool_type,
- grub_efi_uintn_t size,
- void **buffer);
+ (__grub_efi_api *allocate_pool) (grub_efi_memory_type_t pool_type,
+ grub_efi_uintn_t size,
+ void **buffer);
grub_efi_status_t
- (*free_pool) (void *buffer);
+ (__grub_efi_api *free_pool) (void *buffer);
grub_efi_status_t
- (*create_event) (grub_efi_uint32_t type,
- grub_efi_tpl_t notify_tpl,
- void (*notify_function) (grub_efi_event_t event,
- void *context),
- void *notify_context,
- grub_efi_event_t *event);
+ (__grub_efi_api *create_event) (grub_efi_uint32_t type,
+ grub_efi_tpl_t notify_tpl,
+ void (__grub_efi_api *notify_function) (grub_efi_event_t,
+ void *context),
+ void *notify_context,
+ grub_efi_event_t *event);
grub_efi_status_t
- (*set_timer) (grub_efi_event_t event,
- grub_efi_timer_delay_t type,
- grub_efi_uint64_t trigger_time);
+ (__grub_efi_api *set_timer) (grub_efi_event_t event,
+ grub_efi_timer_delay_t type,
+ grub_efi_uint64_t trigger_time);
grub_efi_status_t
- (*wait_for_event) (grub_efi_uintn_t num_events,
- grub_efi_event_t *event,
- grub_efi_uintn_t *index);
+ (__grub_efi_api *wait_for_event) (grub_efi_uintn_t num_events,
+ grub_efi_event_t *event,
+ grub_efi_uintn_t *index);
grub_efi_status_t
- (*signal_event) (grub_efi_event_t event);
+ (__grub_efi_api *signal_event) (grub_efi_event_t event);
grub_efi_status_t
- (*close_event) (grub_efi_event_t event);
+ (__grub_efi_api *close_event) (grub_efi_event_t event);
grub_efi_status_t
- (*check_event) (grub_efi_event_t event);
+ (__grub_efi_api *check_event) (grub_efi_event_t event);
grub_efi_status_t
- (*install_protocol_interface) (grub_efi_handle_t *handle,
- grub_efi_guid_t *protocol,
- grub_efi_interface_type_t protocol_interface_type,
- void *protocol_interface);
+ (__grub_efi_api *install_protocol_interface) (grub_efi_handle_t *handle,
+ grub_efi_guid_t *protocol,
+ grub_efi_interface_type_t protocol_interface_type,
+ void *protocol_interface);
grub_efi_status_t
- (*reinstall_protocol_interface) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- void *old_interface,
- void *new_interface);
+ (__grub_efi_api *reinstall_protocol_interface) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ void *old_interface,
+ void *new_interface);
grub_efi_status_t
- (*uninstall_protocol_interface) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- void *protocol_interface);
+ (__grub_efi_api *uninstall_protocol_interface) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ void *protocol_interface);
grub_efi_status_t
- (*handle_protocol) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- void **protocol_interface);
+ (__grub_efi_api *handle_protocol) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ void **protocol_interface);
void *reserved;
grub_efi_status_t
- (*register_protocol_notify) (grub_efi_guid_t *protocol,
- grub_efi_event_t event,
- void **registration);
+ (__grub_efi_api *register_protocol_notify) (grub_efi_guid_t *protocol,
+ grub_efi_event_t event,
+ void **registration);
grub_efi_status_t
- (*locate_handle) (grub_efi_locate_search_type_t search_type,
- grub_efi_guid_t *protocol,
- void *search_key,
- grub_efi_uintn_t *buffer_size,
- grub_efi_handle_t *buffer);
+ (__grub_efi_api *locate_handle) (grub_efi_locate_search_type_t search_type,
+ grub_efi_guid_t *protocol,
+ void *search_key,
+ grub_efi_uintn_t *buffer_size,
+ grub_efi_handle_t *buffer);
grub_efi_status_t
- (*locate_device_path) (grub_efi_guid_t *protocol,
- grub_efi_device_path_t **device_path,
- grub_efi_handle_t *device);
+ (__grub_efi_api *locate_device_path) (grub_efi_guid_t *protocol,
+ grub_efi_device_path_t **device_path,
+ grub_efi_handle_t *device);
grub_efi_status_t
- (*install_configuration_table) (grub_efi_guid_t *guid, void *table);
+ (__grub_efi_api *install_configuration_table) (grub_efi_guid_t *guid,
+ void *table);
grub_efi_status_t
- (*load_image) (grub_efi_boolean_t boot_policy,
- grub_efi_handle_t parent_image_handle,
- grub_efi_device_path_t *file_path,
- void *source_buffer,
- grub_efi_uintn_t source_size,
- grub_efi_handle_t *image_handle);
+ (__grub_efi_api *load_image) (grub_efi_boolean_t boot_policy,
+ grub_efi_handle_t parent_image_handle,
+ grub_efi_device_path_t *file_path,
+ void *source_buffer,
+ grub_efi_uintn_t source_size,
+ grub_efi_handle_t *image_handle);
grub_efi_status_t
- (*start_image) (grub_efi_handle_t image_handle,
- grub_efi_uintn_t *exit_data_size,
- grub_efi_char16_t **exit_data);
+ (__grub_efi_api *start_image) (grub_efi_handle_t image_handle,
+ grub_efi_uintn_t *exit_data_size,
+ grub_efi_char16_t **exit_data);
grub_efi_status_t
- (*exit) (grub_efi_handle_t image_handle,
- grub_efi_status_t exit_status,
- grub_efi_uintn_t exit_data_size,
- grub_efi_char16_t *exit_data);
+ (__grub_efi_api *exit) (grub_efi_handle_t image_handle,
+ grub_efi_status_t exit_status,
+ grub_efi_uintn_t exit_data_size,
+ grub_efi_char16_t *exit_data);
grub_efi_status_t
- (*unload_image) (grub_efi_handle_t image_handle);
+ (__grub_efi_api *unload_image) (grub_efi_handle_t image_handle);
grub_efi_status_t
- (*exit_boot_services) (grub_efi_handle_t image_handle,
- grub_efi_uintn_t map_key);
+ (__grub_efi_api *exit_boot_services) (grub_efi_handle_t image_handle,
+ grub_efi_uintn_t map_key);
grub_efi_status_t
- (*get_next_monotonic_count) (grub_efi_uint64_t *count);
+ (__grub_efi_api *get_next_monotonic_count) (grub_efi_uint64_t *count);
grub_efi_status_t
- (*stall) (grub_efi_uintn_t microseconds);
+ (__grub_efi_api *stall) (grub_efi_uintn_t microseconds);
grub_efi_status_t
- (*set_watchdog_timer) (grub_efi_uintn_t timeout,
- grub_efi_uint64_t watchdog_code,
- grub_efi_uintn_t data_size,
- grub_efi_char16_t *watchdog_data);
+ (__grub_efi_api *set_watchdog_timer) (grub_efi_uintn_t timeout,
+ grub_efi_uint64_t watchdog_code,
+ grub_efi_uintn_t data_size,
+ grub_efi_char16_t *watchdog_data);
grub_efi_status_t
- (*connect_controller) (grub_efi_handle_t controller_handle,
- grub_efi_handle_t *driver_image_handle,
- grub_efi_device_path_protocol_t *remaining_device_path,
- grub_efi_boolean_t recursive);
+ (__grub_efi_api *connect_controller) (grub_efi_handle_t controller_handle,
+ grub_efi_handle_t *driver_image_handle,
+ grub_efi_device_path_protocol_t *remaining_device_path,
+ grub_efi_boolean_t recursive);
grub_efi_status_t
- (*disconnect_controller) (grub_efi_handle_t controller_handle,
- grub_efi_handle_t driver_image_handle,
- grub_efi_handle_t child_handle);
+ (__grub_efi_api *disconnect_controller) (grub_efi_handle_t controller_handle,
+ grub_efi_handle_t driver_image_handle,
+ grub_efi_handle_t child_handle);
grub_efi_status_t
- (*open_protocol) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- void **protocol_interface,
- grub_efi_handle_t agent_handle,
- grub_efi_handle_t controller_handle,
- grub_efi_uint32_t attributes);
+ (__grub_efi_api *open_protocol) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ void **protocol_interface,
+ grub_efi_handle_t agent_handle,
+ grub_efi_handle_t controller_handle,
+ grub_efi_uint32_t attributes);
grub_efi_status_t
- (*close_protocol) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- grub_efi_handle_t agent_handle,
- grub_efi_handle_t controller_handle);
+ (__grub_efi_api *close_protocol) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ grub_efi_handle_t agent_handle,
+ grub_efi_handle_t controller_handle);
grub_efi_status_t
- (*open_protocol_information) (grub_efi_handle_t handle,
- grub_efi_guid_t *protocol,
- grub_efi_open_protocol_information_entry_t **entry_buffer,
- grub_efi_uintn_t *entry_count);
+ (__grub_efi_api *open_protocol_information) (grub_efi_handle_t handle,
+ grub_efi_guid_t *protocol,
+ grub_efi_open_protocol_information_entry_t **entry_buffer,
+ grub_efi_uintn_t *entry_count);
grub_efi_status_t
- (*protocols_per_handle) (grub_efi_handle_t handle,
- grub_efi_packed_guid_t ***protocol_buffer,
- grub_efi_uintn_t *protocol_buffer_count);
+ (__grub_efi_api *protocols_per_handle) (grub_efi_handle_t handle,
+ grub_efi_packed_guid_t ***protocol_buffer,
+ grub_efi_uintn_t *protocol_buffer_count);
grub_efi_status_t
- (*locate_handle_buffer) (grub_efi_locate_search_type_t search_type,
- grub_efi_guid_t *protocol,
- void *search_key,
- grub_efi_uintn_t *no_handles,
- grub_efi_handle_t **buffer);
+ (__grub_efi_api *locate_handle_buffer) (grub_efi_locate_search_type_t search_type,
+ grub_efi_guid_t *protocol,
+ void *search_key,
+ grub_efi_uintn_t *no_handles,
+ grub_efi_handle_t **buffer);
grub_efi_status_t
- (*locate_protocol) (grub_efi_guid_t *protocol,
- void *registration,
- void **protocol_interface);
+ (__grub_efi_api *locate_protocol) (grub_efi_guid_t *protocol,
+ void *registration,
+ void **protocol_interface);
grub_efi_status_t
- (*install_multiple_protocol_interfaces) (grub_efi_handle_t *handle, ...);
+ (__grub_efi_api *install_multiple_protocol_interfaces) (grub_efi_handle_t *handle, ...);
grub_efi_status_t
- (*uninstall_multiple_protocol_interfaces) (grub_efi_handle_t handle, ...);
+ (__grub_efi_api *uninstall_multiple_protocol_interfaces) (grub_efi_handle_t handle, ...);
grub_efi_status_t
- (*calculate_crc32) (void *data,
- grub_efi_uintn_t data_size,
- grub_efi_uint32_t *crc32);
+ (__grub_efi_api *calculate_crc32) (void *data,
+ grub_efi_uintn_t data_size,
+ grub_efi_uint32_t *crc32);
void
- (*copy_mem) (void *destination, void *source, grub_efi_uintn_t length);
+ (__grub_efi_api *copy_mem) (void *destination, void *source, grub_efi_uintn_t length);
void
- (*set_mem) (void *buffer, grub_efi_uintn_t size, grub_efi_uint8_t value);
+ (__grub_efi_api *set_mem) (void *buffer, grub_efi_uintn_t size, grub_efi_uint8_t value);
};
typedef struct grub_efi_boot_services grub_efi_boot_services_t;
@@ -1338,61 +1339,61 @@ struct grub_efi_runtime_services
grub_efi_table_header_t hdr;
grub_efi_status_t
- (*get_time) (grub_efi_time_t *time,
- grub_efi_time_capabilities_t *capabilities);
+ (__grub_efi_api *get_time) (grub_efi_time_t *time,
+ grub_efi_time_capabilities_t *capabilities);
grub_efi_status_t
- (*set_time) (grub_efi_time_t *time);
+ (__grub_efi_api *set_time) (grub_efi_time_t *time);
grub_efi_status_t
- (*get_wakeup_time) (grub_efi_boolean_t *enabled,
- grub_efi_boolean_t *pending,
- grub_efi_time_t *time);
+ (__grub_efi_api *get_wakeup_time) (grub_efi_boolean_t *enabled,
+ grub_efi_boolean_t *pending,
+ grub_efi_time_t *time);
grub_efi_status_t
- (*set_wakeup_time) (grub_efi_boolean_t enabled,
- grub_efi_time_t *time);
+ (__grub_efi_api *set_wakeup_time) (grub_efi_boolean_t enabled,
+ grub_efi_time_t *time);
grub_efi_status_t
- (*set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
- grub_efi_uintn_t descriptor_size,
- grub_efi_uint32_t descriptor_version,
- grub_efi_memory_descriptor_t *virtual_map);
+ (__grub_efi_api *set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
+ grub_efi_uintn_t descriptor_size,
+ grub_efi_uint32_t descriptor_version,
+ grub_efi_memory_descriptor_t *virtual_map);
grub_efi_status_t
- (*convert_pointer) (grub_efi_uintn_t debug_disposition, void **address);
+ (__grub_efi_api *convert_pointer) (grub_efi_uintn_t debug_disposition, void **address);
#define GRUB_EFI_GLOBAL_VARIABLE_GUID \
{ 0x8BE4DF61, 0x93CA, 0x11d2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }}
grub_efi_status_t
- (*get_variable) (grub_efi_char16_t *variable_name,
- const grub_efi_guid_t *vendor_guid,
- grub_efi_uint32_t *attributes,
- grub_efi_uintn_t *data_size,
- void *data);
+ (__grub_efi_api *get_variable) (grub_efi_char16_t *variable_name,
+ const grub_efi_guid_t *vendor_guid,
+ grub_efi_uint32_t *attributes,
+ grub_efi_uintn_t *data_size,
+ void *data);
grub_efi_status_t
- (*get_next_variable_name) (grub_efi_uintn_t *variable_name_size,
- grub_efi_char16_t *variable_name,
- grub_efi_guid_t *vendor_guid);
+ (__grub_efi_api *get_next_variable_name) (grub_efi_uintn_t *variable_name_size,
+ grub_efi_char16_t *variable_name,
+ grub_efi_guid_t *vendor_guid);
grub_efi_status_t
- (*set_variable) (grub_efi_char16_t *variable_name,
- const grub_efi_guid_t *vendor_guid,
- grub_efi_uint32_t attributes,
- grub_efi_uintn_t data_size,
- void *data);
+ (__grub_efi_api *set_variable) (grub_efi_char16_t *variable_name,
+ const grub_efi_guid_t *vendor_guid,
+ grub_efi_uint32_t attributes,
+ grub_efi_uintn_t data_size,
+ void *data);
grub_efi_status_t
- (*get_next_high_monotonic_count) (grub_efi_uint32_t *high_count);
+ (__grub_efi_api *get_next_high_monotonic_count) (grub_efi_uint32_t *high_count);
void
- (*reset_system) (grub_efi_reset_type_t reset_type,
- grub_efi_status_t reset_status,
- grub_efi_uintn_t data_size,
- grub_efi_char16_t *reset_data);
+ (__grub_efi_api *reset_system) (grub_efi_reset_type_t reset_type,
+ grub_efi_status_t reset_status,
+ grub_efi_uintn_t data_size,
+ grub_efi_char16_t *reset_data);
};
typedef struct grub_efi_runtime_services grub_efi_runtime_services_t;
@@ -1410,33 +1411,42 @@ struct grub_efi_serial_io_interface
{
grub_efi_uint32_t revision;
void (*reset) (void);
- grub_efi_status_t (*set_attributes) (struct grub_efi_serial_io_interface *this,
- grub_efi_uint64_t speed,
- grub_efi_uint32_t fifo_depth,
- grub_efi_uint32_t timeout,
- grub_efi_parity_type_t parity,
- grub_uint8_t word_len,
- grub_efi_stop_bits_t stop_bits);
- grub_efi_status_t (*set_control_bits) (struct grub_efi_serial_io_interface *this,
- grub_efi_uint32_t flags);
- void (*get_control_bits) (void);
- grub_efi_status_t (*write) (struct grub_efi_serial_io_interface *this,
- grub_efi_uintn_t *buf_size,
- void *buffer);
- grub_efi_status_t (*read) (struct grub_efi_serial_io_interface *this,
- grub_efi_uintn_t *buf_size,
- void *buffer);
+
+ grub_efi_status_t
+ (__grub_efi_api *set_attributes) (struct grub_efi_serial_io_interface *this,
+ grub_efi_uint64_t speed,
+ grub_efi_uint32_t fifo_depth,
+ grub_efi_uint32_t timeout,
+ grub_efi_parity_type_t parity,
+ grub_uint8_t word_len,
+ grub_efi_stop_bits_t stop_bits);
+
+ grub_efi_status_t
+ (__grub_efi_api *set_control_bits) (struct grub_efi_serial_io_interface *this,
+ grub_efi_uint32_t flags);
+
+ void (__grub_efi_api *get_control_bits) (void);
+
+ grub_efi_status_t
+ (__grub_efi_api *write) (struct grub_efi_serial_io_interface *this,
+ grub_efi_uintn_t *buf_size,
+ void *buffer);
+
+ grub_efi_status_t
+ (__grub_efi_api *read) (struct grub_efi_serial_io_interface *this,
+ grub_efi_uintn_t *buf_size,
+ void *buffer);
};
struct grub_efi_simple_input_interface
{
grub_efi_status_t
- (*reset) (struct grub_efi_simple_input_interface *this,
- grub_efi_boolean_t extended_verification);
+ (__grub_efi_api *reset) (struct grub_efi_simple_input_interface *this,
+ grub_efi_boolean_t extended_verification);
grub_efi_status_t
- (*read_key_stroke) (struct grub_efi_simple_input_interface *this,
- grub_efi_input_key_t *key);
+ (__grub_efi_api *read_key_stroke) (struct grub_efi_simple_input_interface *this,
+ grub_efi_input_key_t *key);
grub_efi_event_t wait_for_key;
};
@@ -1448,77 +1458,77 @@ struct grub_efi_key_data {
};
typedef struct grub_efi_key_data grub_efi_key_data_t;
-typedef grub_efi_status_t (*grub_efi_key_notify_function_t) (
+typedef grub_efi_status_t (__grub_efi_api *grub_efi_key_notify_function_t) (
grub_efi_key_data_t *key_data
);
struct grub_efi_simple_text_input_ex_interface
{
grub_efi_status_t
- (*reset) (struct grub_efi_simple_text_input_ex_interface *this,
- grub_efi_boolean_t extended_verification);
+ (__grub_efi_api *reset) (struct grub_efi_simple_text_input_ex_interface *this,
+ grub_efi_boolean_t extended_verification);
grub_efi_status_t
- (*read_key_stroke) (struct grub_efi_simple_text_input_ex_interface *this,
- grub_efi_key_data_t *key_data);
+ (__grub_efi_api *read_key_stroke) (struct grub_efi_simple_text_input_ex_interface *this,
+ grub_efi_key_data_t *key_data);
grub_efi_event_t wait_for_key;
grub_efi_status_t
- (*set_state) (struct grub_efi_simple_text_input_ex_interface *this,
- grub_efi_key_toggle_state_t *key_toggle_state);
+ (__grub_efi_api *set_state) (struct grub_efi_simple_text_input_ex_interface *this,
+ grub_efi_key_toggle_state_t *key_toggle_state);
grub_efi_status_t
- (*register_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
- grub_efi_key_data_t *key_data,
- grub_efi_key_notify_function_t key_notification_function,
- void **notify_handle);
+ (__grub_efi_api *register_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
+ grub_efi_key_data_t *key_data,
+ grub_efi_key_notify_function_t key_notification_function,
+ void **notify_handle);
grub_efi_status_t
- (*unregister_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
- void *notification_handle);
+ (__grub_efi_api *unregister_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
+ void *notification_handle);
};
typedef struct grub_efi_simple_text_input_ex_interface grub_efi_simple_text_input_ex_interface_t;
struct grub_efi_simple_text_output_interface
{
grub_efi_status_t
- (*reset) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_boolean_t extended_verification);
+ (__grub_efi_api *reset) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_boolean_t extended_verification);
grub_efi_status_t
- (*output_string) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_char16_t *string);
+ (__grub_efi_api *output_string) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_char16_t *string);
grub_efi_status_t
- (*test_string) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_char16_t *string);
+ (__grub_efi_api *test_string) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_char16_t *string);
grub_efi_status_t
- (*query_mode) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_uintn_t mode_number,
- grub_efi_uintn_t *columns,
- grub_efi_uintn_t *rows);
+ (__grub_efi_api *query_mode) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_uintn_t mode_number,
+ grub_efi_uintn_t *columns,
+ grub_efi_uintn_t *rows);
grub_efi_status_t
- (*set_mode) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_uintn_t mode_number);
+ (__grub_efi_api *set_mode) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_uintn_t mode_number);
grub_efi_status_t
- (*set_attributes) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_uintn_t attribute);
+ (__grub_efi_api *set_attributes) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_uintn_t attribute);
grub_efi_status_t
- (*clear_screen) (struct grub_efi_simple_text_output_interface *this);
+ (__grub_efi_api *clear_screen) (struct grub_efi_simple_text_output_interface *this);
grub_efi_status_t
- (*set_cursor_position) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_uintn_t column,
- grub_efi_uintn_t row);
+ (__grub_efi_api *set_cursor_position) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_uintn_t column,
+ grub_efi_uintn_t row);
grub_efi_status_t
- (*enable_cursor) (struct grub_efi_simple_text_output_interface *this,
- grub_efi_boolean_t visible);
+ (__grub_efi_api *enable_cursor) (struct grub_efi_simple_text_output_interface *this,
+ grub_efi_boolean_t visible);
grub_efi_simple_text_output_mode_t *mode;
};
@@ -1619,23 +1629,23 @@ struct grub_efi_loaded_image
grub_efi_memory_type_t image_code_type;
grub_efi_memory_type_t image_data_type;
- grub_efi_status_t (*unload) (grub_efi_handle_t image_handle);
+ grub_efi_status_t (__grub_efi_api *unload) (grub_efi_handle_t image_handle);
};
typedef struct grub_efi_loaded_image grub_efi_loaded_image_t;
struct grub_efi_disk_io
{
grub_efi_uint64_t revision;
- grub_efi_status_t (*read) (struct grub_efi_disk_io *this,
- grub_efi_uint32_t media_id,
- grub_efi_uint64_t offset,
- grub_efi_uintn_t buffer_size,
- void *buffer);
- grub_efi_status_t (*write) (struct grub_efi_disk_io *this,
- grub_efi_uint32_t media_id,
- grub_efi_uint64_t offset,
- grub_efi_uintn_t buffer_size,
- void *buffer);
+ grub_efi_status_t (__grub_efi_api *read) (struct grub_efi_disk_io *this,
+ grub_efi_uint32_t media_id,
+ grub_efi_uint64_t offset,
+ grub_efi_uintn_t buffer_size,
+ void *buffer);
+ grub_efi_status_t (__grub_efi_api *write) (struct grub_efi_disk_io *this,
+ grub_efi_uint32_t media_id,
+ grub_efi_uint64_t offset,
+ grub_efi_uintn_t buffer_size,
+ void *buffer);
};
typedef struct grub_efi_disk_io grub_efi_disk_io_t;
@@ -1699,41 +1709,60 @@ enum
struct grub_efi_simple_network
{
grub_uint64_t revision;
- grub_efi_status_t (*start) (struct grub_efi_simple_network *this);
- grub_efi_status_t (*stop) (struct grub_efi_simple_network *this);
- grub_efi_status_t (*initialize) (struct grub_efi_simple_network *this,
- grub_efi_uintn_t extra_rx,
- grub_efi_uintn_t extra_tx);
- void (*reset) (void);
- grub_efi_status_t (*shutdown) (struct grub_efi_simple_network *this);
- grub_efi_status_t (*receive_filters) (struct grub_efi_simple_network *this,
- grub_uint32_t enable,
- grub_uint32_t disable,
- grub_efi_boolean_t reset_mcast_filter,
- grub_efi_uintn_t mcast_filter_count,
- grub_efi_mac_address_t *mcast_filter);
- void (*station_address) (void);
- void (*statistics) (void);
- void (*mcastiptomac) (void);
- void (*nvdata) (void);
- grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this,
- grub_uint32_t *int_status,
- void **txbuf);
- grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this,
- grub_efi_uintn_t header_size,
- grub_efi_uintn_t buffer_size,
- void *buffer,
- grub_efi_mac_t *src_addr,
- grub_efi_mac_t *dest_addr,
- grub_efi_uint16_t *protocol);
- grub_efi_status_t (*receive) (struct grub_efi_simple_network *this,
- grub_efi_uintn_t *header_size,
- grub_efi_uintn_t *buffer_size,
- void *buffer,
- grub_efi_mac_t *src_addr,
- grub_efi_mac_t *dest_addr,
- grub_uint16_t *protocol);
- void (*waitforpacket) (void);
+
+ grub_efi_status_t
+ (__grub_efi_api *start) (struct grub_efi_simple_network *this);
+
+ grub_efi_status_t
+ (__grub_efi_api *stop) (struct grub_efi_simple_network *this);
+
+ grub_efi_status_t
+ (__grub_efi_api *initialize) (struct grub_efi_simple_network *this,
+ grub_efi_uintn_t extra_rx,
+ grub_efi_uintn_t extra_tx);
+
+ void (__grub_efi_api *reset) (void);
+
+ grub_efi_status_t
+ (__grub_efi_api *shutdown) (struct grub_efi_simple_network *this);
+
+ grub_efi_status_t
+ (__grub_efi_api *receive_filters) (struct grub_efi_simple_network *this,
+ grub_uint32_t enable,
+ grub_uint32_t disable,
+ grub_efi_boolean_t reset_mcast_filter,
+ grub_efi_uintn_t mcast_filter_count,
+ grub_efi_mac_address_t *mcast_filter);
+
+ void (__grub_efi_api *station_address) (void);
+ void (__grub_efi_api *statistics) (void);
+ void (__grub_efi_api *mcastiptomac) (void);
+ void (__grub_efi_api *nvdata) (void);
+
+ grub_efi_status_t
+ (__grub_efi_api *get_status) (struct grub_efi_simple_network *this,
+ grub_uint32_t *int_status,
+ void **txbuf);
+
+ grub_efi_status_t
+ (__grub_efi_api *transmit) (struct grub_efi_simple_network *this,
+ grub_efi_uintn_t header_size,
+ grub_efi_uintn_t buffer_size,
+ void *buffer,
+ grub_efi_mac_t *src_addr,
+ grub_efi_mac_t *dest_addr,
+ grub_efi_uint16_t *protocol);
+
+ grub_efi_status_t
+ (__grub_efi_api *receive) (struct grub_efi_simple_network *this,
+ grub_efi_uintn_t *header_size,
+ grub_efi_uintn_t *buffer_size,
+ void *buffer,
+ grub_efi_mac_t *src_addr,
+ grub_efi_mac_t *dest_addr,
+ grub_uint16_t *protocol);
+
+ void (__grub_efi_api *waitforpacket) (void);
struct grub_efi_simple_network_mode *mode;
};
typedef struct grub_efi_simple_network grub_efi_simple_network_t;
@@ -1743,25 +1772,25 @@ struct grub_efi_block_io
{
grub_efi_uint64_t revision;
grub_efi_block_io_media_t *media;
- grub_efi_status_t (*reset) (struct grub_efi_block_io *this,
- grub_efi_boolean_t extended_verification);
- grub_efi_status_t (*read_blocks) (struct grub_efi_block_io *this,
- grub_efi_uint32_t media_id,
- grub_efi_lba_t lba,
- grub_efi_uintn_t buffer_size,
- void *buffer);
- grub_efi_status_t (*write_blocks) (struct grub_efi_block_io *this,
- grub_efi_uint32_t media_id,
- grub_efi_lba_t lba,
- grub_efi_uintn_t buffer_size,
- void *buffer);
- grub_efi_status_t (*flush_blocks) (struct grub_efi_block_io *this);
+ grub_efi_status_t (__grub_efi_api *reset) (struct grub_efi_block_io *this,
+ grub_efi_boolean_t extended_verification);
+ grub_efi_status_t (__grub_efi_api *read_blocks) (struct grub_efi_block_io *this,
+ grub_efi_uint32_t media_id,
+ grub_efi_lba_t lba,
+ grub_efi_uintn_t buffer_size,
+ void *buffer);
+ grub_efi_status_t (__grub_efi_api *write_blocks) (struct grub_efi_block_io *this,
+ grub_efi_uint32_t media_id,
+ grub_efi_lba_t lba,
+ grub_efi_uintn_t buffer_size,
+ void *buffer);
+ grub_efi_status_t (__grub_efi_api *flush_blocks) (struct grub_efi_block_io *this);
};
typedef struct grub_efi_block_io grub_efi_block_io_t;
struct grub_efi_shim_lock_protocol
{
- grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
+ grub_efi_status_t (__grub_efi_api *verify) (void *buffer, grub_uint32_t size);
};
typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
@@ -1769,13 +1798,13 @@ typedef grub_efi_guid_t grub_efi_rng_algorithm_t;
struct grub_efi_rng_protocol
{
- grub_efi_status_t (*get_info) (struct grub_efi_rng_protocol *this,
- grub_efi_uintn_t *rng_algorithm_list_size,
- grub_efi_rng_algorithm_t *rng_algorithm_list);
- grub_efi_status_t (*get_rng) (struct grub_efi_rng_protocol *this,
- grub_efi_rng_algorithm_t *rng_algorithm,
- grub_efi_uintn_t rng_value_length,
- grub_efi_uint8_t *rng_value);
+ grub_efi_status_t (__grub_efi_api *get_info) (struct grub_efi_rng_protocol *this,
+ grub_efi_uintn_t *rng_algorithm_list_size,
+ grub_efi_rng_algorithm_t *rng_algorithm_list);
+ grub_efi_status_t (__grub_efi_api *get_rng) (struct grub_efi_rng_protocol *this,
+ grub_efi_rng_algorithm_t *rng_algorithm,
+ grub_efi_uintn_t rng_value_length,
+ grub_efi_uint8_t *rng_value);
};
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
diff --git a/include/grub/efi/tpm.h b/include/grub/efi/tpm.h
index ec39725c00abd1b9..6c6802ee594ed945 100644
--- a/include/grub/efi/tpm.h
+++ b/include/grub/efi/tpm.h
@@ -62,42 +62,42 @@ typedef struct tdTCG_PCR_EVENT TCG_PCR_EVENT;
struct grub_efi_tpm_protocol
{
- grub_efi_status_t (*status_check) (struct grub_efi_tpm_protocol *this,
- TCG_EFI_BOOT_SERVICE_CAPABILITY *
- ProtocolCapability,
- grub_efi_uint32_t *TCGFeatureFlags,
- grub_efi_physical_address_t *
- EventLogLocation,
- grub_efi_physical_address_t *
- EventLogLastEntry);
- grub_efi_status_t (*hash_all) (struct grub_efi_tpm_protocol *this,
- grub_efi_uint8_t *HashData,
- grub_efi_uint64_t HashLen,
- grub_efi_uint32_t AlgorithmId,
- grub_efi_uint64_t *HashedDataLen,
- grub_efi_uint8_t **HashedDataResult);
- grub_efi_status_t (*log_event) (struct grub_efi_tpm_protocol *this,
- TCG_PCR_EVENT *TCGLogData,
- grub_efi_uint32_t *EventNumber,
- grub_efi_uint32_t Flags);
- grub_efi_status_t (*pass_through_to_tpm) (struct grub_efi_tpm_protocol *
- this,
- grub_efi_uint32_t
- TpmInputParameterBlockSize,
- grub_efi_uint8_t *
- TpmInputParameterBlock,
- grub_efi_uint32_t
- TpmOutputParameterBlockSize,
- grub_efi_uint8_t *
- TpmOutputParameterBlock);
- grub_efi_status_t (*log_extend_event) (struct grub_efi_tpm_protocol *this,
- grub_efi_physical_address_t HashData,
- grub_efi_uint64_t HashDataLen,
- grub_efi_uint32_t AlgorithmId,
- TCG_PCR_EVENT *TCGLogData,
- grub_efi_uint32_t *EventNumber,
- grub_efi_physical_address_t *
- EventLogLastEntry);
+ grub_efi_status_t
+ (__grub_efi_api *status_check) (struct grub_efi_tpm_protocol *this,
+ TCG_EFI_BOOT_SERVICE_CAPABILITY *ProtocolCapability,
+ grub_efi_uint32_t *TCGFeatureFlags,
+ grub_efi_physical_address_t *EventLogLocation,
+ grub_efi_physical_address_t *EventLogLastEntry);
+
+ grub_efi_status_t
+ (__grub_efi_api *hash_all) (struct grub_efi_tpm_protocol *this,
+ grub_efi_uint8_t *HashData,
+ grub_efi_uint64_t HashLen,
+ grub_efi_uint32_t AlgorithmId,
+ grub_efi_uint64_t *HashedDataLen,
+ grub_efi_uint8_t **HashedDataResult);
+
+ grub_efi_status_t
+ (__grub_efi_api *log_event) (struct grub_efi_tpm_protocol *this,
+ TCG_PCR_EVENT *TCGLogData,
+ grub_efi_uint32_t *EventNumber,
+ grub_efi_uint32_t Flags);
+
+ grub_efi_status_t
+ (__grub_efi_api *pass_through_to_tpm) (struct grub_efi_tpm_protocol *this,
+ grub_efi_uint32_t TpmInputParameterBlockSize,
+ grub_efi_uint8_t *TpmInputParameterBlock,
+ grub_efi_uint32_t TpmOutputParameterBlockSize,
+ grub_efi_uint8_t *TpmOutputParameterBlock);
+
+ grub_efi_status_t
+ (__grub_efi_api *log_extend_event) (struct grub_efi_tpm_protocol *this,
+ grub_efi_physical_address_t HashData,
+ grub_efi_uint64_t HashDataLen,
+ grub_efi_uint32_t AlgorithmId,
+ TCG_PCR_EVENT *TCGLogData,
+ grub_efi_uint32_t *EventNumber,
+ grub_efi_physical_address_t *EventLogLastEntry);
};
typedef struct grub_efi_tpm_protocol grub_efi_tpm_protocol_t;
@@ -151,46 +151,43 @@ typedef struct tdEFI_TCG2_EVENT EFI_TCG2_EVENT;
struct grub_efi_tpm2_protocol
{
- grub_efi_status_t (*get_capability) (struct grub_efi_tpm2_protocol *this,
- EFI_TCG2_BOOT_SERVICE_CAPABILITY *
- ProtocolCapability);
- grub_efi_status_t (*get_event_log) (struct grub_efi_tpm2_protocol *this,
- EFI_TCG2_EVENT_LOG_FORMAT
- EventLogFormat,
- grub_efi_physical_address_t *
- EventLogLocation,
- grub_efi_physical_address_t *
- EventLogLastEntry,
- grub_efi_boolean_t * EventLogTruncated);
- grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *
- this, grub_efi_uint64_t Flags,
- grub_efi_physical_address_t
- DataToHash,
- grub_efi_uint64_t DataToHashLen,
- EFI_TCG2_EVENT *EfiTcgEvent);
- grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this,
- grub_efi_uint32_t
- InputParameterBlockSize,
- grub_efi_uint8_t *InputParameterBlock,
- grub_efi_uint32_t
- OutputParameterBlockSize,
- grub_efi_uint8_t *
- OutputParameterBlock);
- grub_efi_status_t (*get_active_pcr_banks) (struct grub_efi_tpm2_protocol *
- this,
- grub_efi_uint32_t *
- ActivePcrBanks);
- grub_efi_status_t (*set_active_pcr_banks) (struct grub_efi_tpm2_protocol *
- this,
- grub_efi_uint32_t
- ActivePcrBanks);
- grub_efi_status_t (*get_result_of_set_active_pcr_banks) (struct
- grub_efi_tpm2_protocol
- *this,
- grub_efi_uint32_t *
- OperationPresent,
- grub_efi_uint32_t *
- Response);
+ grub_efi_status_t
+ (__grub_efi_api *get_capability) (struct grub_efi_tpm2_protocol *this,
+ EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability);
+
+ grub_efi_status_t
+ (__grub_efi_api *get_event_log) (struct grub_efi_tpm2_protocol *this,
+ EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
+ grub_efi_physical_address_t *EventLogLocation,
+ grub_efi_physical_address_t *EventLogLastEntry,
+ grub_efi_boolean_t *EventLogTruncated);
+
+ grub_efi_status_t
+ (__grub_efi_api *hash_log_extend_event) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint64_t Flags,
+ grub_efi_physical_address_t DataToHash,
+ grub_efi_uint64_t DataToHashLen,
+ EFI_TCG2_EVENT *EfiTcgEvent);
+
+ grub_efi_status_t
+ (__grub_efi_api *submit_command) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t InputParameterBlockSize,
+ grub_efi_uint8_t *InputParameterBlock,
+ grub_efi_uint32_t OutputParameterBlockSize,
+ grub_efi_uint8_t *OutputParameterBlock);
+
+ grub_efi_status_t
+ (__grub_efi_api *get_active_pcr_banks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t *ActivePcrBanks);
+
+ grub_efi_status_t
+ (__grub_efi_api *set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t ActivePcrBanks);
+
+ grub_efi_status_t
+ (__grub_efi_api *get_result_of_set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this,
+ grub_efi_uint32_t *OperationPresent,
+ grub_efi_uint32_t *Response);
};
typedef struct grub_efi_tpm2_protocol grub_efi_tpm2_protocol_t;
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 4/6] efi: Drop all uses of efi_call_XX wrappers
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
` (2 preceding siblings ...)
2023-05-11 12:06 ` [PATCH v2 3/6] efi: Add calling convention annotation to all prototypes Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 5/6] efi: Remove x86_64 call wrappers Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386 Ard Biesheuvel
5 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
Now that GCC can generate function calls using the correct calling
convention for us, we can stop using the efi_call_XX () wrappers, and
just dereference the function pointers directly.
This avoids the untyped variadic wrapper routines, which means better
type checking for the method calls.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
grub-core/commands/acpi.c | 8 +--
grub-core/commands/efi/efitextmode.c | 8 ++-
grub-core/commands/efi/lsefi.c | 5 +-
grub-core/commands/efi/tpm.c | 21 ++++----
grub-core/disk/efi/efidisk.c | 7 +--
grub-core/kern/arm/efi/init.c | 10 ++--
grub-core/kern/efi/efi.c | 56 ++++++++++----------
grub-core/kern/efi/init.c | 15 +++---
grub-core/kern/efi/mm.c | 17 +++---
grub-core/kern/i386/efi/tsc.c | 2 +-
grub-core/lib/efi/datetime.c | 9 ++--
grub-core/lib/efi/halt.c | 4 +-
grub-core/lib/efi/relocator.c | 6 +--
grub-core/loader/efi/appleloader.c | 8 +--
grub-core/loader/efi/chainloader.c | 20 +++----
grub-core/mmap/efi/mmap.c | 16 +++---
grub-core/net/drivers/efi/efinet.c | 26 ++++-----
grub-core/term/efi/console.c | 29 +++++-----
grub-core/term/efi/serial.c | 18 +++----
grub-core/video/efi_gop.c | 18 +++----
grub-core/video/efi_uga.c | 8 +--
21 files changed, 153 insertions(+), 158 deletions(-)
diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
index fda62f4ea98a6da8..ab067ae6e51d43af 100644
--- a/grub-core/commands/acpi.c
+++ b/grub-core/commands/acpi.c
@@ -762,10 +762,10 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
- efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
- &acpi20, grub_acpi_get_rsdpv2 ());
- efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
- &acpi, grub_acpi_get_rsdpv1 ());
+ grub_efi_system_table->boot_services->install_configuration_table (&acpi20,
+ grub_acpi_get_rsdpv2 ());
+ grub_efi_system_table->boot_services->install_configuration_table (&acpi,
+ grub_acpi_get_rsdpv1 ());
}
#endif
diff --git a/grub-core/commands/efi/efitextmode.c b/grub-core/commands/efi/efitextmode.c
index 3679f6b4d8028bc7..198bc694d3fc3c3b 100644
--- a/grub-core/commands/efi/efitextmode.c
+++ b/grub-core/commands/efi/efitextmode.c
@@ -36,7 +36,7 @@ grub_efi_set_mode (grub_efi_simple_text_output_interface_t *o,
if (mode != o->mode->mode)
{
- status = efi_call_2 (o->set_mode, o, mode);
+ status = o->set_mode (o, mode);
if (status == GRUB_EFI_SUCCESS)
;
else if (status == GRUB_EFI_DEVICE_ERROR)
@@ -79,8 +79,7 @@ grub_cmd_efitextmode (grub_command_t cmd __attribute__ ((unused)),
grub_printf_ (N_("Available modes for console output device.\n"));
for (i = 0; i < o->mode->max_mode; i++)
- if (GRUB_EFI_SUCCESS == efi_call_4 (o->query_mode, o, i,
- &columns, &rows))
+ if (GRUB_EFI_SUCCESS == o->query_mode (o, i, &columns, &rows))
grub_printf_ (N_(" [%" PRIuGRUB_EFI_UINT32_T "] Col %5"
PRIuGRUB_EFI_UINTN_T " Row %5" PRIuGRUB_EFI_UINTN_T
" %c\n"),
@@ -129,8 +128,7 @@ grub_cmd_efitextmode (grub_command_t cmd __attribute__ ((unused)),
N_("non-numeric or invalid rows number `%s'"), args[1]);
for (i = 0; i < o->mode->max_mode; i++)
- if (GRUB_EFI_SUCCESS == efi_call_4 (o->query_mode, o, i,
- &columns, &rows))
+ if (GRUB_EFI_SUCCESS == o->query_mode (o, i, &columns, &rows))
if (u_columns == columns && u_rows == rows)
return grub_efi_set_mode (o, (grub_efi_int32_t) i);
diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
index c304d25ccdd6f32b..53970149785a28f8 100644
--- a/grub-core/commands/efi/lsefi.c
+++ b/grub-core/commands/efi/lsefi.c
@@ -108,8 +108,9 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
grub_efi_print_device_path (dp);
}
- status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle,
- handle, &protocols, &num_protocols);
+ status = grub_efi_system_table->boot_services->protocols_per_handle (handle,
+ &protocols,
+ &num_protocols);
if (status != GRUB_EFI_SUCCESS) {
grub_printf ("Unable to retrieve protocols\n");
continue;
diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index e1f343fea3ff3503..4213552048aebad6 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -53,8 +53,7 @@ grub_tpm1_present (grub_efi_tpm_protocol_t *tpm)
caps.Size = (grub_uint8_t) sizeof (caps);
- status = efi_call_5 (tpm->status_check, tpm, &caps, &flags, &eventlog,
- &lastevent);
+ status = tpm->status_check (tpm, &caps, &flags, &eventlog, &lastevent);
if (status != GRUB_EFI_SUCCESS || caps.TPMDeactivatedFlag
|| !caps.TPMPresentFlag)
@@ -78,7 +77,7 @@ grub_tpm2_present (grub_efi_tpm2_protocol_t *tpm)
if (tpm2_present != -1)
return (grub_efi_boolean_t) tpm2_present;
- status = efi_call_2 (tpm->get_capability, tpm, &caps);
+ status = tpm->get_capability (tpm, &caps);
if (status != GRUB_EFI_SUCCESS || !caps.TPMPresentFlag)
tpm2_present = 0;
@@ -180,8 +179,8 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
grub_strcpy ((char *) event->Event, description);
algorithm = TCG_ALG_SHA;
- status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size,
- algorithm, event, &eventnum, &lastevent);
+ status = tpm->log_extend_event (tpm, (grub_addr_t) buf, (grub_uint64_t) size,
+ algorithm, event, &eventnum, &lastevent);
grub_free (event);
return grub_efi_log_event_status (status);
@@ -216,8 +215,8 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
sizeof (*event) - sizeof (event->Event) + grub_strlen (description) + 1;
grub_strcpy ((char *) event->Event, description);
- status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
- (grub_uint64_t) size, event);
+ status = tpm->hash_log_extend_event (tpm, 0, (grub_addr_t) buf,
+ (grub_uint64_t) size, event);
grub_free (event);
return grub_efi_log_event_status (status);
@@ -236,7 +235,7 @@ grub_cc_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
if (cc == NULL)
return;
- status = efi_call_3 (cc->map_pcr_to_mr_index, cc, pcr, &mr);
+ status = cc->map_pcr_to_mr_index (cc, pcr, &mr);
if (status != GRUB_EFI_SUCCESS)
{
grub_efi_log_event_status (status);
@@ -258,9 +257,9 @@ grub_cc_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
event->Size = sizeof (*event) + grub_strlen (description) + 1;
grub_strcpy ((char *) event->Event, description);
- status = efi_call_5 (cc->hash_log_extend_event, cc, 0,
- (grub_efi_physical_address_t)(grub_addr_t) buf,
- (grub_efi_uint64_t) size, event);
+ status = cc->hash_log_extend_event (cc, 0,
+ (grub_efi_physical_address_t)(grub_addr_t) buf,
+ (grub_efi_uint64_t) size, event);
grub_free (event);
if (status != GRUB_EFI_SUCCESS)
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index d7540040ed067063..ad025010a06bd338 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -579,9 +579,10 @@ grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector,
aligned_buf = buf;
}
- status = efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio,
- bio->media->media_id, (grub_efi_uint64_t) sector,
- (grub_efi_uintn_t) num_bytes, aligned_buf);
+ status = (wr ? bio->write_blocks : bio->read_blocks) (bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector,
+ (grub_efi_uintn_t) num_bytes,
+ aligned_buf);
if ((grub_addr_t) buf & (io_align - 1))
{
diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
index ab48342f3cda116d..809f69c8cfc8727e 100644
--- a/grub-core/kern/arm/efi/init.c
+++ b/grub-core/kern/arm/efi/init.c
@@ -50,9 +50,9 @@ grub_machine_init (void)
b = grub_efi_system_table->boot_services;
- efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
- GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
- efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000);
+ b->create_event (GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
+ GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
+ b->set_timer (tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000);
grub_install_get_time_ms (grub_efi_get_time_ms);
}
@@ -67,8 +67,8 @@ grub_machine_fini (int flags)
b = grub_efi_system_table->boot_services;
- efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
- efi_call_1 (b->close_event, tmr_evt);
+ b->set_timer (tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
+ b->close_event (tmr_evt);
grub_efi_fini ();
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index cf49d6357e00f49c..c84d5d28005670c4 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -45,8 +45,9 @@ grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration)
void *interface;
grub_efi_status_t status;
- status = efi_call_3 (grub_efi_system_table->boot_services->locate_protocol,
- protocol, registration, &interface);
+ status = grub_efi_system_table->boot_services->locate_protocol (protocol,
+ registration,
+ &interface);
if (status != GRUB_EFI_SUCCESS)
return 0;
@@ -72,7 +73,7 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
return 0;
b = grub_efi_system_table->boot_services;
- status = efi_call_5 (b->locate_handle, search_type, protocol, search_key,
+ status = b->locate_handle (search_type, protocol, search_key,
&buffer_size, buffer);
if (status == GRUB_EFI_BUFFER_TOO_SMALL)
{
@@ -81,7 +82,7 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
if (! buffer)
return 0;
- status = efi_call_5 (b->locate_handle, search_type, protocol, search_key,
+ status = b->locate_handle (search_type, protocol, search_key,
&buffer_size, buffer);
}
@@ -105,12 +106,12 @@ grub_efi_open_protocol (grub_efi_handle_t handle,
void *interface;
b = grub_efi_system_table->boot_services;
- status = efi_call_6 (b->open_protocol, handle,
- protocol,
- &interface,
- grub_efi_image_handle,
- 0,
- attributes);
+ status = b->open_protocol (handle,
+ protocol,
+ &interface,
+ grub_efi_image_handle,
+ 0,
+ attributes);
if (status != GRUB_EFI_SUCCESS)
return 0;
@@ -122,7 +123,7 @@ grub_efi_close_protocol (grub_efi_handle_t handle, grub_efi_guid_t *protocol)
{
grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
- return efi_call_4 (b->close_protocol, handle, protocol, grub_efi_image_handle, NULL);
+ return b->close_protocol (handle, protocol, grub_efi_image_handle, NULL);
}
int
@@ -137,12 +138,12 @@ grub_efi_set_text_mode (int on)
already in text mode. */
return 1;
- if (efi_call_4 (c->get_mode, c, &mode, 0, 0) != GRUB_EFI_SUCCESS)
+ if (c->get_mode (c, &mode, 0, 0) != GRUB_EFI_SUCCESS)
return 0;
new_mode = on ? GRUB_EFI_SCREEN_TEXT : GRUB_EFI_SCREEN_GRAPHICS;
if (mode != new_mode)
- if (efi_call_2 (c->set_mode, c, new_mode) != GRUB_EFI_SUCCESS)
+ if (c->set_mode (c, new_mode) != GRUB_EFI_SUCCESS)
return 0;
return 1;
@@ -151,7 +152,7 @@ grub_efi_set_text_mode (int on)
void
grub_efi_stall (grub_efi_uintn_t microseconds)
{
- efi_call_1 (grub_efi_system_table->boot_services->stall, microseconds);
+ grub_efi_system_table->boot_services->stall (microseconds);
}
grub_efi_loaded_image_t *
@@ -167,8 +168,9 @@ grub_reboot (void)
{
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
- efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
- GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL);
+ grub_efi_system_table->runtime_services->reset_system (GRUB_EFI_RESET_COLD,
+ GRUB_EFI_SUCCESS, 0,
+ NULL);
for (;;) ;
}
@@ -176,8 +178,8 @@ void
grub_exit (void)
{
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
- efi_call_4 (grub_efi_system_table->boot_services->exit,
- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
+ grub_efi_system_table->boot_services->exit (grub_efi_image_handle,
+ GRUB_EFI_SUCCESS, 0, 0);
for (;;) ;
}
@@ -191,8 +193,8 @@ grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
grub_efi_status_t status;
r = grub_efi_system_table->runtime_services;
- status = efi_call_4 (r->set_virtual_address_map, memory_map_size,
- descriptor_size, descriptor_version, virtual_map);
+ status = r->set_virtual_address_map (memory_map_size, descriptor_size,
+ descriptor_version, virtual_map);
if (status == GRUB_EFI_SUCCESS)
return GRUB_ERR_NONE;
@@ -219,11 +221,11 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
r = grub_efi_system_table->runtime_services;
- status = efi_call_5 (r->set_variable, var16, guid,
- (GRUB_EFI_VARIABLE_NON_VOLATILE
- | GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
- | GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
- datasize, data);
+ status = r->set_variable (var16, guid,
+ (GRUB_EFI_VARIABLE_NON_VOLATILE
+ | GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
+ | GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
+ datasize, data);
grub_free (var16);
if (status == GRUB_EFI_SUCCESS)
return GRUB_ERR_NONE;
@@ -258,7 +260,7 @@ grub_efi_get_variable_with_attributes (const char *var,
r = grub_efi_system_table->runtime_services;
- status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, NULL);
+ status = r->get_variable (var16, guid, NULL, &datasize, NULL);
if (status != GRUB_EFI_BUFFER_TOO_SMALL || !datasize)
{
@@ -273,7 +275,7 @@ grub_efi_get_variable_with_attributes (const char *var,
return GRUB_EFI_OUT_OF_RESOURCES;
}
- status = efi_call_5 (r->get_variable, var16, guid, attributes, &datasize, data);
+ status = r->get_variable (var16, guid, attributes, &datasize, data);
grub_free (var16);
if (status == GRUB_EFI_SUCCESS)
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index b67bc73a1b0102a8..e873ef5298ff3a5b 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -56,11 +56,11 @@ __stack_chk_fail (void)
* the serial console, at least on EDK2.
*/
o = grub_efi_system_table->con_out;
- efi_call_2 (o->output_string, o, stack_chk_fail_msg);
+ o->output_string (o, stack_chk_fail_msg);
- efi_call_1 (grub_efi_system_table->boot_services->stall, 5000000);
- efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
- GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_ABORTED, 0, NULL);
+ grub_efi_system_table->boot_services->stall (5000000);
+ grub_efi_system_table->runtime_services->reset_system (GRUB_EFI_RESET_SHUTDOWN,
+ GRUB_EFI_ABORTED, 0, NULL);
/*
* We shouldn't get here. It's unsafe to return because the stack
@@ -86,8 +86,8 @@ stack_protector_init (void)
{
grub_efi_status_t status;
- status = efi_call_4 (rng->get_rng, rng, NULL, sizeof (stack_chk_guard_buf),
- stack_chk_guard_buf);
+ status = rng->get_rng (rng, NULL, sizeof (stack_chk_guard_buf),
+ stack_chk_guard_buf);
if (status == GRUB_EFI_SUCCESS)
grub_memcpy (&__stack_chk_guard, stack_chk_guard_buf, sizeof (__stack_chk_guard));
}
@@ -124,8 +124,7 @@ grub_efi_init (void)
grub_shim_lock_verifier_setup ();
}
- efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
- 0, 0, 0, NULL);
+ grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL);
grub_efidisk_init ();
}
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index 3705b8b1b465d00e..09225a7c08e4d066 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -69,8 +69,8 @@ grub_efi_store_alloc (grub_efi_physical_address_t address,
grub_efi_status_t status;
b = grub_efi_system_table->boot_services;
- status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
- sizeof(*alloc), (void**)&alloc);
+ status = b->allocate_pool (GRUB_EFI_LOADER_DATA,
+ sizeof(*alloc), (void**)&alloc);
if (status == GRUB_EFI_SUCCESS)
{
@@ -105,7 +105,7 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
efi_allocated_memory = ea->next;
/* Then free the memory backing it. */
- efi_call_1 (b->free_pool, ea);
+ b->free_pool (ea);
/* And leave, we're done. */
break;
@@ -137,7 +137,7 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
}
b = grub_efi_system_table->boot_services;
- status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address);
+ status = b->allocate_pages (alloctype, memtype, pages, &address);
if (status != GRUB_EFI_SUCCESS)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
@@ -149,7 +149,7 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
/* Uggh, the address 0 was allocated... This is too annoying,
so reallocate another one. */
address = GRUB_EFI_MAX_USABLE_ADDRESS;
- status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address);
+ status = b->allocate_pages (alloctype, memtype, pages, &address);
grub_efi_free_pages (0, pages);
if (status != GRUB_EFI_SUCCESS)
{
@@ -188,7 +188,7 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
grub_efi_boot_services_t *b;
b = grub_efi_system_table->boot_services;
- efi_call_2 (b->free_pages, address, pages);
+ b->free_pages (address, pages);
grub_efi_drop_alloc (address, pages);
}
@@ -267,8 +267,7 @@ grub_efi_finish_boot_services (grub_efi_uintn_t *outbuf_size, void *outbuf,
}
b = grub_efi_system_table->boot_services;
- status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle,
- finish_key);
+ status = b->exit_boot_services (grub_efi_image_handle, finish_key);
if (status == GRUB_EFI_SUCCESS)
break;
@@ -381,7 +380,7 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size,
descriptor_size = &size;
b = grub_efi_system_table->boot_services;
- status = efi_call_5 (b->get_memory_map, memory_map_size, memory_map, map_key,
+ status = b->get_memory_map (memory_map_size, memory_map, map_key,
descriptor_size, descriptor_version);
if (*descriptor_size == 0)
*descriptor_size = sizeof (grub_efi_memory_descriptor_t);
diff --git a/grub-core/kern/i386/efi/tsc.c b/grub-core/kern/i386/efi/tsc.c
index 4b93ba8e1b5f377c..e41dc6526dda08d7 100644
--- a/grub-core/kern/i386/efi/tsc.c
+++ b/grub-core/kern/i386/efi/tsc.c
@@ -33,7 +33,7 @@ grub_tsc_calibrate_from_efi (void)
grub_uint64_t start_tsc, end_tsc;
/* Use EFI Time Service to calibrate TSC */
start_tsc = grub_get_tsc ();
- efi_call_1 (grub_efi_system_table->boot_services->stall, 1000);
+ grub_efi_system_table->boot_services->stall (1000);
end_tsc = grub_get_tsc ();
grub_tsc_rate = grub_divmod64 ((1ULL << 32), end_tsc - start_tsc, 0);
return 1;
diff --git a/grub-core/lib/efi/datetime.c b/grub-core/lib/efi/datetime.c
index 0fd1b5fbd615cfec..b03e4df5ecc1e98b 100644
--- a/grub-core/lib/efi/datetime.c
+++ b/grub-core/lib/efi/datetime.c
@@ -32,8 +32,7 @@ grub_get_datetime (struct grub_datetime *datetime)
grub_efi_status_t status;
struct grub_efi_time efi_time;
- status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
- &efi_time, 0);
+ status = grub_efi_system_table->runtime_services->get_time (&efi_time, 0);
if (status)
return grub_error (GRUB_ERR_INVALID_COMMAND,
@@ -57,8 +56,7 @@ grub_set_datetime (struct grub_datetime *datetime)
grub_efi_status_t status;
struct grub_efi_time efi_time;
- status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
- &efi_time, 0);
+ status = grub_efi_system_table->runtime_services->get_time (&efi_time, 0);
if (status)
return grub_error (GRUB_ERR_INVALID_COMMAND,
@@ -71,8 +69,7 @@ grub_set_datetime (struct grub_datetime *datetime)
efi_time.minute = datetime->minute;
efi_time.second = datetime->second;
- status = efi_call_1 (grub_efi_system_table->runtime_services->set_time,
- &efi_time);
+ status = grub_efi_system_table->runtime_services->set_time (&efi_time);
if (status)
return grub_error (GRUB_ERR_INVALID_COMMAND,
diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c
index 0b42be6740f246b7..f482fcb3a7b26312 100644
--- a/grub-core/lib/efi/halt.c
+++ b/grub-core/lib/efi/halt.c
@@ -34,8 +34,8 @@ grub_halt (void)
!defined(__riscv)
grub_acpi_halt ();
#endif
- efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
- GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
+ grub_efi_system_table->runtime_services->reset_system (GRUB_EFI_RESET_SHUTDOWN,
+ GRUB_EFI_SUCCESS, 0, NULL);
while (1);
}
diff --git a/grub-core/lib/efi/relocator.c b/grub-core/lib/efi/relocator.c
index 84da70a86cf7b992..b4518d0002485511 100644
--- a/grub-core/lib/efi/relocator.c
+++ b/grub-core/lib/efi/relocator.c
@@ -101,8 +101,8 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size)
(unsigned long long) start, (unsigned long long) size);
#endif
b = grub_efi_system_table->boot_services;
- status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
- GRUB_EFI_LOADER_DATA, size >> 12, &address);
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_ADDRESS,
+ GRUB_EFI_LOADER_DATA, size >> 12, &address);
return (status == GRUB_EFI_SUCCESS);
}
@@ -115,5 +115,5 @@ grub_relocator_firmware_free_region (grub_addr_t start, grub_size_t size)
return;
b = grub_efi_system_table->boot_services;
- efi_call_2 (b->free_pages, start, size >> 12);
+ b->free_pages (start, size >> 12);
}
diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c
index fc89e23bdc6f6ab3..a0b61a240b73af10 100644
--- a/grub-core/loader/efi/appleloader.c
+++ b/grub-core/loader/efi/appleloader.c
@@ -40,7 +40,7 @@ grub_appleloader_unload (void)
grub_efi_boot_services_t *b;
b = grub_efi_system_table->boot_services;
- efi_call_1 (b->unload_image, image_handle);
+ b->unload_image (image_handle);
grub_free (cmdline);
cmdline = 0;
@@ -55,7 +55,7 @@ grub_appleloader_boot (void)
grub_efi_boot_services_t *b;
b = grub_efi_system_table->boot_services;
- efi_call_3 (b->start_image, image_handle, 0, 0);
+ b->start_image (image_handle, 0, 0);
grub_appleloader_unload ();
@@ -165,8 +165,8 @@ grub_cmd_appleloader (grub_command_t cmd __attribute__ ((unused)),
b = grub_efi_system_table->boot_services;
for (pdev = devs ; pdev->devpath ; pdev++)
- if (efi_call_6 (b->load_image, 0, grub_efi_image_handle, pdev->devpath,
- NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
+ if (b->load_image (0, grub_efi_image_handle, pdev->devpath,
+ NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
break;
if (! pdev->devpath)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 7557eb269be34888..1759af632fe90b01 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -56,7 +56,7 @@ grub_chainloader_unload (void *context)
grub_free (loaded_image->load_options);
b = grub_efi_system_table->boot_services;
- efi_call_1 (b->unload_image, image_handle);
+ b->unload_image (image_handle);
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@@ -72,7 +72,7 @@ grub_chainloader_boot (void *context)
grub_efi_char16_t *exit_data = NULL;
b = grub_efi_system_table->boot_services;
- status = efi_call_3 (b->start_image, image_handle, &exit_data_size, &exit_data);
+ status = b->start_image (image_handle, &exit_data_size, &exit_data);
if (status != GRUB_EFI_SUCCESS)
{
if (exit_data)
@@ -94,7 +94,7 @@ grub_chainloader_boot (void *context)
}
if (exit_data)
- efi_call_1 (b->free_pool, exit_data);
+ b->free_pool (exit_data);
grub_loader_unset ();
@@ -289,7 +289,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12);
- status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_ANY_PAGES,
GRUB_EFI_LOADER_CODE,
pages, &address);
if (status != GRUB_EFI_SUCCESS)
@@ -346,9 +346,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
#endif
- status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
- boot_image, size,
- &image_handle);
+ status = b->load_image (0, grub_efi_image_handle, file_path,
+ boot_image, size,
+ &image_handle);
if (status != GRUB_EFI_SUCCESS)
{
if (status == GRUB_EFI_OUT_OF_RESOURCES)
@@ -403,7 +403,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_device_close (dev);
/* We're finished with the source image buffer and file path now. */
- efi_call_2 (b->free_pages, address, pages);
+ b->free_pages (address, pages);
grub_free (file_path);
grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
@@ -421,10 +421,10 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_free (file_path);
if (address)
- efi_call_2 (b->free_pages, address, pages);
+ b->free_pages (address, pages);
if (image_handle != NULL)
- efi_call_1 (b->unload_image, image_handle);
+ b->unload_image (image_handle);
grub_dl_unref (my_mod);
diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c
index bd495a184811445b..2f0ec4d037f02279 100644
--- a/grub-core/mmap/efi/mmap.c
+++ b/grub-core/mmap/efi/mmap.c
@@ -203,14 +203,14 @@ grub_mmap_register (grub_uint64_t start, grub_uint64_t size, int type)
b = grub_efi_system_table->boot_services;
address = start & (~0xfffULL);
pages = (end - address + 0xfff) >> 12;
- status = efi_call_2 (b->free_pages, address, pages);
+ status = b->free_pages (address, pages);
if (status != GRUB_EFI_SUCCESS && status != GRUB_EFI_NOT_FOUND)
{
grub_free (curover);
return 0;
}
- status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
- make_efi_memtype (type), pages, &address);
+ status = b->allocate_pages (GRUB_EFI_ALLOCATE_ADDRESS,
+ make_efi_memtype (type), pages, &address);
if (status != GRUB_EFI_SUCCESS)
{
grub_free (curover);
@@ -239,7 +239,7 @@ grub_mmap_unregister (int handle)
{
if (curover->handle == handle)
{
- efi_call_2 (b->free_pages, curover->address, curover->pages);
+ b->free_pages (curover->address, curover->pages);
if (prevover != 0)
prevover->next = curover->next;
else
@@ -281,8 +281,8 @@ grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)),
#endif
pages = (size + 0xfff) >> 12;
- status = efi_call_4 (b->allocate_pages, atype,
- make_efi_memtype (type), pages, &address);
+ status = b->allocate_pages (atype,
+ make_efi_memtype (type), pages, &address);
if (status != GRUB_EFI_SUCCESS)
{
grub_free (curover);
@@ -294,8 +294,8 @@ grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)),
/* Uggh, the address 0 was allocated... This is too annoying,
so reallocate another one. */
address = 0xffffffff;
- status = efi_call_4 (b->allocate_pages, atype,
- make_efi_memtype (type), pages, &address);
+ status = b->allocate_pages (atype,
+ make_efi_memtype (type), pages, &address);
grub_efi_free_pages (0, pages);
if (status != GRUB_EFI_SUCCESS)
return 0;
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5adf5f40f4924b2e..56a1797093f6cee1 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -46,7 +46,7 @@ send_card_buffer (struct grub_net_card *dev,
while (1)
{
txbuf = NULL;
- st = efi_call_3 (net->get_status, net, 0, &txbuf);
+ st = net->get_status (net, 0, &txbuf);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO,
N_("couldn't send network packet"));
@@ -74,8 +74,8 @@ send_card_buffer (struct grub_net_card *dev,
grub_memcpy (dev->txbuf, pack->data, dev->last_pkt_size);
- st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
- dev->txbuf, NULL, NULL, NULL);
+ st = net->transmit (net, 0, dev->last_pkt_size,
+ dev->txbuf, NULL, NULL, NULL);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
@@ -88,7 +88,7 @@ send_card_buffer (struct grub_net_card *dev,
Perhaps a timeout in the FW has discarded the recycle buffer.
*/
txbuf = NULL;
- st = efi_call_3 (net->get_status, net, 0, &txbuf);
+ st = net->get_status (net, 0, &txbuf);
dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf);
return GRUB_ERR_NONE;
@@ -114,8 +114,8 @@ get_card_packet (struct grub_net_card *dev)
if (!dev->rcvbuf)
return NULL;
- st = efi_call_7 (net->receive, net, NULL, &bufsize,
- dev->rcvbuf, NULL, NULL, NULL);
+ st = net->receive (net, NULL, &bufsize,
+ dev->rcvbuf, NULL, NULL, NULL);
if (st != GRUB_EFI_BUFFER_TOO_SMALL)
break;
dev->rcvbufsize = 2 * ALIGN_UP (dev->rcvbufsize > bufsize
@@ -168,7 +168,7 @@ open_card (struct grub_net_card *dev)
if (net != NULL)
{
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
- && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
+ && net->start (net) != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net start failed",
dev->name);
@@ -177,7 +177,7 @@ open_card (struct grub_net_card *dev)
dev->name);
if (net->mode->state == GRUB_EFI_NETWORK_STARTED
- && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
+ && net->initialize (net, 0, 0) != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net initialize failed",
dev->name);
@@ -201,7 +201,7 @@ open_card (struct grub_net_card *dev)
filters |= (net->mode->receive_filter_mask &
GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS);
- efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL);
+ net->receive_filters (net, filters, 0, 0, 0, NULL);
}
dev->efi_net = net;
@@ -216,8 +216,8 @@ open_card (struct grub_net_card *dev)
static void
close_card (struct grub_net_card *dev)
{
- efi_call_1 (dev->efi_net->shutdown, dev->efi_net);
- efi_call_1 (dev->efi_net->stop, dev->efi_net);
+ dev->efi_net->shutdown (dev->efi_net);
+ dev->efi_net->stop (dev->efi_net);
grub_efi_close_protocol (dev->efi_handle, &net_io_guid);
}
@@ -286,14 +286,14 @@ grub_efinet_findcards (void)
continue;
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
- && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
+ && net->start (net) != GRUB_EFI_SUCCESS)
continue;
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
continue;
if (net->mode->state == GRUB_EFI_NETWORK_STARTED
- && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
+ && net->initialize (net, 0, 0) != GRUB_EFI_SUCCESS)
continue;
card = grub_zalloc (sizeof (struct grub_net_card));
diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
index 532948a8e19fc9de..9a7bc0fcf9d16707 100644
--- a/grub-core/term/efi/console.c
+++ b/grub-core/term/efi/console.c
@@ -107,14 +107,13 @@ grub_console_setcolorstate (struct grub_term_output *term
switch (state) {
case GRUB_TERM_COLOR_STANDARD:
- efi_call_2 (o->set_attributes, o, GRUB_TERM_DEFAULT_STANDARD_COLOR
- & 0x7f);
+ o->set_attributes (o, GRUB_TERM_DEFAULT_STANDARD_COLOR & 0x7f);
break;
case GRUB_TERM_COLOR_NORMAL:
- efi_call_2 (o->set_attributes, o, grub_term_normal_color & 0x7f);
+ o->set_attributes (o, grub_term_normal_color & 0x7f);
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
- efi_call_2 (o->set_attributes, o, grub_term_highlight_color & 0x7f);
+ o->set_attributes (o, grub_term_highlight_color & 0x7f);
break;
default:
break;
@@ -135,7 +134,7 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)),
}
o = grub_efi_system_table->con_out;
- efi_call_2 (o->enable_cursor, o, on);
+ o->enable_cursor (o, on);
}
static grub_err_t
@@ -189,10 +188,10 @@ grub_console_putchar (struct grub_term_output *term,
/* Should this test be cached? */
if ((c->base > 0x7f || c->ncomb)
- && efi_call_2 (o->test_string, o, str) != GRUB_EFI_SUCCESS)
+ && o->test_string (o, str) != GRUB_EFI_SUCCESS)
return;
- efi_call_2 (o->output_string, o, str);
+ o->output_string (o, str);
}
const unsigned efi_codes[] =
@@ -242,7 +241,7 @@ grub_console_getkey_con (struct grub_term_input *term __attribute__ ((unused)))
grub_efi_status_t status;
i = grub_efi_system_table->con_in;
- status = efi_call_2 (i->read_key_stroke, i, &key);
+ status = i->read_key_stroke (i, &key);
if (status != GRUB_EFI_SUCCESS)
return GRUB_TERM_NO_KEY;
@@ -270,7 +269,7 @@ grub_console_read_key_stroke (
key = grub_efi_translate_key (key_data.key);
if (key == GRUB_TERM_NO_KEY) {
- status = efi_call_2 (text_input->read_key_stroke, text_input, &key_data);
+ status = text_input->read_key_stroke (text_input, &key_data);
if (status != GRUB_EFI_SUCCESS)
return GRUB_ERR_EOF;
@@ -391,8 +390,8 @@ grub_console_getwh (struct grub_term_output *term)
o = grub_efi_system_table->con_out;
if (grub_prepare_for_text_output (term) != GRUB_ERR_NONE ||
- efi_call_4 (o->query_mode, o, o->mode->mode,
- &columns, &rows) != GRUB_EFI_SUCCESS)
+ o->query_mode (o, o->mode->mode,
+ &columns, &rows) != GRUB_EFI_SUCCESS)
{
/* Why does this fail? */
columns = 80;
@@ -424,7 +423,7 @@ grub_console_gotoxy (struct grub_term_output *term,
return;
o = grub_efi_system_table->con_out;
- efi_call_3 (o->set_cursor_position, o, pos.x, pos.y);
+ o->set_cursor_position (o, pos.x, pos.y);
}
static void
@@ -438,9 +437,9 @@ grub_console_cls (struct grub_term_output *term __attribute__ ((unused)))
o = grub_efi_system_table->con_out;
orig_attr = o->mode->attribute;
- efi_call_2 (o->set_attributes, o, GRUB_EFI_BACKGROUND_BLACK);
- efi_call_1 (o->clear_screen, o);
- efi_call_2 (o->set_attributes, o, orig_attr);
+ o->set_attributes (o, GRUB_EFI_BACKGROUND_BLACK);
+ o->clear_screen (o);
+ o->set_attributes (o, orig_attr);
}
static grub_err_t
diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c
index 4c94723c57e7458f..e86ebce3f8bf68cf 100644
--- a/grub-core/term/efi/serial.c
+++ b/grub-core/term/efi/serial.c
@@ -51,16 +51,16 @@ do_real_config (struct grub_serial_port *port)
if (port->configured)
return;
- status = efi_call_7 (port->interface->set_attributes, port->interface,
- port->config.speed,
- 0, 0, parities[port->config.parity],
- port->config.word_len,
- stop_bits[port->config.stop_bits]);
+ status = port->interface->set_attributes (port->interface,
+ port->config.speed,
+ 0, 0, parities[port->config.parity],
+ port->config.word_len,
+ stop_bits[port->config.stop_bits]);
if (status != GRUB_EFI_SUCCESS)
port->broken = 1;
- status = efi_call_2 (port->interface->set_control_bits, port->interface,
- port->config.rtscts ? 0x4002 : 0x2);
+ status = port->interface->set_control_bits (port->interface,
+ port->config.rtscts ? 0x4002 : 0x2);
port->configured = 1;
}
@@ -76,7 +76,7 @@ serial_hw_fetch (struct grub_serial_port *port)
if (port->broken)
return -1;
- status = efi_call_3 (port->interface->read, port->interface, &bufsize, &c);
+ status = port->interface->read (port->interface, &bufsize, &c);
if (status != GRUB_EFI_SUCCESS || bufsize == 0)
return -1;
@@ -95,7 +95,7 @@ serial_hw_put (struct grub_serial_port *port, const int c)
if (port->broken)
return;
- efi_call_3 (port->interface->write, port->interface, &bufsize, &c0);
+ port->interface->write (port->interface, &bufsize, &c0);
}
/* Initialize a serial device. PORT is the port number for a serial device.
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
index 7a50546318d62f40..9c79010384312dd3 100644
--- a/grub-core/video/efi_gop.c
+++ b/grub-core/video/efi_gop.c
@@ -110,7 +110,7 @@ grub_video_gop_fini (void)
{
if (restore_needed)
{
- efi_call_2 (gop->set_mode, gop, old_mode);
+ gop->set_mode (gop, old_mode);
restore_needed = 0;
}
grub_free (framebuffer.offscreen);
@@ -274,7 +274,7 @@ grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info, vo
struct grub_efi_gop_mode_info *info = NULL;
struct grub_video_mode_info mode_info;
- status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
+ status = gop->query_mode (gop, mode, &size, &info);
if (status)
{
@@ -400,7 +400,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
grub_efi_uintn_t size;
grub_efi_status_t status;
- status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
+ status = gop->query_mode (gop, mode, &size, &info);
if (status)
{
info = 0;
@@ -461,7 +461,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
old_mode = gop->mode->mode;
restore_needed = 1;
}
- efi_call_2 (gop->set_mode, gop, best_mode);
+ gop->set_mode (gop, best_mode);
}
info = gop->mode->info;
@@ -523,10 +523,10 @@ grub_video_gop_swap_buffers (void)
{
if (framebuffer.offscreen)
{
- efi_call_10 (gop->blt, gop, framebuffer.offscreen,
- GRUB_EFI_BLT_BUFFER_TO_VIDEO, 0, 0, 0, 0,
- framebuffer.mode_info.width, framebuffer.mode_info.height,
- framebuffer.mode_info.width * 4);
+ gop->blt (gop, framebuffer.offscreen,
+ GRUB_EFI_BLT_BUFFER_TO_VIDEO, 0, 0, 0, 0,
+ framebuffer.mode_info.width, framebuffer.mode_info.height,
+ framebuffer.mode_info.width * 4);
}
return GRUB_ERR_NONE;
}
@@ -613,7 +613,7 @@ GRUB_MOD_FINI(efi_gop)
{
if (restore_needed)
{
- efi_call_2 (gop->set_mode, gop, old_mode);
+ gop->set_mode (gop, old_mode);
restore_needed = 0;
}
if (gop)
diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c
index e74d6c235000d611..25d22c8a3cd07845 100644
--- a/grub-core/video/efi_uga.c
+++ b/grub-core/video/efi_uga.c
@@ -186,13 +186,13 @@ check_protocol (void)
grub_uint32_t width, height, depth, rate, pixel;
int ret;
- if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
+ if (c->get_mode (c, &width, &height, &depth, &rate))
return 0;
grub_efi_set_text_mode (0);
pixel = RGB_MAGIC;
- efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
- GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
+ c->blt (c, (struct grub_efi_uga_pixel *) &pixel,
+ GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
ret = find_framebuf (&uga_fb, &uga_pitch);
grub_efi_set_text_mode (1);
@@ -236,7 +236,7 @@ grub_video_uga_setup (unsigned int width, unsigned int height,
grub_uint32_t d;
grub_uint32_t r;
- if ((! efi_call_5 (uga->get_mode, uga, &w, &h, &d, &r)) &&
+ if ((! uga->get_mode (uga, &w, &h, &d, &r)) &&
((! width) || (width == w)) &&
((! height) || (height == h)) &&
((! depth) || (depth == d)))
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 5/6] efi: Remove x86_64 call wrappers
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
` (3 preceding siblings ...)
2023-05-11 12:06 ` [PATCH v2 4/6] efi: Drop all uses of efi_call_XX wrappers Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386 Ard Biesheuvel
5 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
The call wrappers are no longer needed now that GCC can generate
function calls using MS calling convention, so let's get rid of them.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
grub-core/Makefile.core.def | 1 -
grub-core/kern/x86_64/efi/callwrap.S | 129 --------------------
include/grub/efi/api.h | 73 -----------
3 files changed, 203 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 9194be1d4f796bd7..8ee2bd89c4205761 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -227,7 +227,6 @@ kernel = {
x86_64 = kern/x86_64/dl.c;
x86_64_xen = kern/x86_64/dl.c;
- x86_64_efi = kern/x86_64/efi/callwrap.S;
x86_64_efi = kern/i386/efi/init.c;
x86_64_efi = bus/pci.c;
diff --git a/grub-core/kern/x86_64/efi/callwrap.S b/grub-core/kern/x86_64/efi/callwrap.S
deleted file mode 100644
index 1337fd9fc823f8a4..0000000000000000
--- a/grub-core/kern/x86_64/efi/callwrap.S
+++ /dev/null
@@ -1,129 +0,0 @@
-/* callwrap.S - wrapper for x86_64 efi calls */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2006,2007,2009 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <grub/symbol.h>
-
-/*
- * x86_64 uses registry to pass parameters. Unfortunately, gcc and efi use
- * different call conversion, so we need to do some conversion.
- *
- * gcc:
- * %rdi, %rsi, %rdx, %rcx, %r8, %r9, 8(%rsp), 16(%rsp), ...
- *
- * efi:
- * %rcx, %rdx, %r8, %r9, 32(%rsp), 40(%rsp), 48(%rsp), ...
- *
- */
-
- .file "callwrap.S"
- .text
-
-FUNCTION(efi_wrap_0)
- subq $40, %rsp
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_1)
- subq $40, %rsp
- mov %rsi, %rcx
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_2)
- subq $40, %rsp
- mov %rsi, %rcx
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_3)
- subq $40, %rsp
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_4)
- subq $40, %rsp
- mov %r8, %r9
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_5)
- subq $40, %rsp
- mov %r9, 32(%rsp)
- mov %r8, %r9
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $40, %rsp
- ret
-
-FUNCTION(efi_wrap_6)
- subq $56, %rsp
- mov 56+8(%rsp), %rax
- mov %rax, 40(%rsp)
- mov %r9, 32(%rsp)
- mov %r8, %r9
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $56, %rsp
- ret
-
-FUNCTION(efi_wrap_7)
- subq $88, %rsp
- mov 88+16(%rsp), %rax
- mov %rax, 48(%rsp)
- mov 88+8(%rsp), %rax
- mov %rax, 40(%rsp)
- mov %r9, 32(%rsp)
- mov %r8, %r9
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $88, %rsp
- ret
-
-FUNCTION(efi_wrap_10)
- subq $88, %rsp
- mov 88+40(%rsp), %rax
- mov %rax, 72(%rsp)
- mov 88+32(%rsp), %rax
- mov %rax, 64(%rsp)
- mov 88+24(%rsp), %rax
- mov %rax, 56(%rsp)
- mov 88+16(%rsp), %rax
- mov %rax, 48(%rsp)
- mov 88+8(%rsp), %rax
- mov %rax, 40(%rsp)
- mov %r9, 32(%rsp)
- mov %r8, %r9
- mov %rcx, %r8
- mov %rsi, %rcx
- call *%rdi
- addq $88, %rsp
- ret
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index b145211003954092..fb881ae12d5ae73a 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1824,77 +1824,4 @@ struct initrd_media_device_path {
} GRUB_PACKED;
typedef struct initrd_media_device_path initrd_media_device_path_t;
-#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
- || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
- || defined(__riscv)
-
-#define efi_call_0(func) (func)()
-#define efi_call_1(func, a) (func)(a)
-#define efi_call_2(func, a, b) (func)(a, b)
-#define efi_call_3(func, a, b, c) (func)(a, b, c)
-#define efi_call_4(func, a, b, c, d) (func)(a, b, c, d)
-#define efi_call_5(func, a, b, c, d, e) (func)(a, b, c, d, e)
-#define efi_call_6(func, a, b, c, d, e, f) (func)(a, b, c, d, e, f)
-#define efi_call_7(func, a, b, c, d, e, f, g) (func)(a, b, c, d, e, f, g)
-#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) (func)(a, b, c, d, e, f, g, h, i, j)
-
-#else
-
-#define efi_call_0(func) \
- efi_wrap_0(func)
-#define efi_call_1(func, a) \
- efi_wrap_1(func, (grub_uint64_t) (a))
-#define efi_call_2(func, a, b) \
- efi_wrap_2(func, (grub_uint64_t) (a), (grub_uint64_t) (b))
-#define efi_call_3(func, a, b, c) \
- efi_wrap_3(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c))
-#define efi_call_4(func, a, b, c, d) \
- efi_wrap_4(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c), (grub_uint64_t) (d))
-#define efi_call_5(func, a, b, c, d, e) \
- efi_wrap_5(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e))
-#define efi_call_6(func, a, b, c, d, e, f) \
- efi_wrap_6(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
- (grub_uint64_t) (f))
-#define efi_call_7(func, a, b, c, d, e, f, g) \
- efi_wrap_7(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
- (grub_uint64_t) (f), (grub_uint64_t) (g))
-#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
- efi_wrap_10(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
- (grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
- (grub_uint64_t) (f), (grub_uint64_t) (g), (grub_uint64_t) (h), \
- (grub_uint64_t) (i), (grub_uint64_t) (j))
-
-grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func);
-grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1);
-grub_uint64_t EXPORT_FUNC(efi_wrap_2) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2);
-grub_uint64_t EXPORT_FUNC(efi_wrap_3) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3);
-grub_uint64_t EXPORT_FUNC(efi_wrap_4) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3,
- grub_uint64_t arg4);
-grub_uint64_t EXPORT_FUNC(efi_wrap_5) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3,
- grub_uint64_t arg4, grub_uint64_t arg5);
-grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3,
- grub_uint64_t arg4, grub_uint64_t arg5,
- grub_uint64_t arg6);
-grub_uint64_t EXPORT_FUNC(efi_wrap_7) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3,
- grub_uint64_t arg4, grub_uint64_t arg5,
- grub_uint64_t arg6, grub_uint64_t arg7);
-grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1,
- grub_uint64_t arg2, grub_uint64_t arg3,
- grub_uint64_t arg4, grub_uint64_t arg5,
- grub_uint64_t arg6, grub_uint64_t arg7,
- grub_uint64_t arg8, grub_uint64_t arg9,
- grub_uint64_t arg10);
-#endif
-
#endif /* ! GRUB_EFI_API_HEADER */
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
` (4 preceding siblings ...)
2023-05-11 12:06 ` [PATCH v2 5/6] efi: Remove x86_64 call wrappers Ard Biesheuvel
@ 2023-05-11 12:06 ` Ard Biesheuvel
2023-05-11 12:14 ` Ard Biesheuvel
2023-05-14 5:12 ` Glenn Washburn
5 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:06 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper, Ard Biesheuvel
Switch the x86 based EFI platform builds to the generic EFI loader,
which exposes the initrd via the LoadFile2 protocol instead of the
x86-specific setup header. This will launch the Linux kernel via its EFI
stub, which performs its own initialization in the EFI boot services
context before calling ExitBootServices() and performing the bare metal
Linux boot.
Given that only Linux kernel versions v5.8 and later support this initrd
loading method, the existing x86 loader is retained as a fallback, which
will also be used for Linux kernels built without the EFI stub. In this
case, GRUB calls ExitBootServices() before entering the Linux kernel,
and all EFI related information is provided to the kernel via struct
boot_params in the setup header, as before.
Note that this means that booting EFI stub kernels older than v5.8 is
not supported even when not using an initrd at all. Also, the EFI
handover protocol, which has no basis in the UEFI specification, is not
implemented.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
grub-core/Makefile.core.def | 5 +-
grub-core/loader/efi/linux.c | 51 ++++++++++++++++++--
grub-core/loader/i386/linux.c | 8 +++
include/grub/efi/efi.h | 2 +-
4 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 8ee2bd89c4205761..bc08955ac791241a 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1818,11 +1818,8 @@ module = {
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
arm_coreboot = loader/arm/linux.c;
- arm_efi = loader/efi/linux.c;
arm_uboot = loader/arm/linux.c;
- arm64 = loader/efi/linux.c;
- riscv32 = loader/efi/linux.c;
- riscv64 = loader/efi/linux.c;
+ efi = loader/efi/linux.c;
emu = loader/emu/linux.c;
common = loader/linux.c;
common = lib/cmdline.c;
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index 15e0686549d7ecca..970a4d7a5d4d464f 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -69,6 +69,12 @@ static initrd_media_device_path_t initrd_lf2_device_path = {
}
};
+extern grub_err_t
+grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
+
+extern grub_err_t
+grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
+
static grub_efi_status_t __grub_efi_api
grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
grub_efi_device_path_t *device_path,
@@ -89,8 +95,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read Linux image header");
if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
+ return GRUB_ERR_NOT_IMPLEMENTED_YET;
grub_dprintf ("linux", "UEFI stub kernel:\n");
grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
@@ -117,7 +122,11 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
if (lh->pe_image_header.optional_header.major_image_version >= 1)
initrd_use_loadfile2 = true;
else
+#if defined(__i386__) || defined(__x86_64__)
+ return GRUB_ERR_NOT_IMPLEMENTED_YET;
+#else
initrd_use_loadfile2 = false;
+#endif
grub_dprintf ("linux", "LoadFile2 initrd loading %sabled\n",
initrd_use_loadfile2 ? "en" : "dis");
@@ -125,6 +134,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
return GRUB_ERR_NONE;
}
+#if !defined(__i386__) && !defined(__x86_64__)
static grub_err_t
finalize_params_linux (void)
{
@@ -169,6 +179,7 @@ failure:
grub_fdt_unload();
return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
}
+#endif
grub_err_t
grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
@@ -231,8 +242,10 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
static grub_err_t
grub_linux_boot (void)
{
+#if !defined(__i386__) && !defined(__x86_64__)
if (finalize_params_linux () != GRUB_ERR_NONE)
return grub_errno;
+#endif
return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
kernel_size, linux_args));
@@ -253,7 +266,9 @@ grub_linux_unload (void)
if (kernel_addr)
grub_efi_free_pages ((grub_addr_t) kernel_addr,
GRUB_EFI_BYTES_TO_PAGES (kernel_size));
+#if !defined(__i386__) && !defined(__x86_64__)
grub_fdt_unload ();
+#endif
if (initrd_lf2_handle != NULL)
{
@@ -269,6 +284,7 @@ grub_linux_unload (void)
return GRUB_ERR_NONE;
}
+#if !defined(__i386__) && !defined(__x86_64__)
/*
* As per linux/Documentation/arm/Booting
* ARM initrd needs to be covered by kernel linear mapping,
@@ -304,6 +320,7 @@ allocate_initrd_mem (int initrd_pages)
GRUB_EFI_ALLOCATE_MAX_ADDRESS,
GRUB_EFI_LOADER_DATA);
}
+#endif
static grub_efi_status_t __grub_efi_api
grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
@@ -345,7 +362,7 @@ static grub_err_t
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
- int initrd_size, initrd_pages;
+ int __attribute__ ((unused)) initrd_size, initrd_pages;
void *initrd_mem = NULL;
grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
grub_efi_status_t status;
@@ -356,6 +373,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
+#if defined(__i386__) || defined(__x86_64__)
+ if (!initrd_use_loadfile2)
+ return grub_cmd_initrd_x86_legacy (cmd, argc, argv);
+#endif
+
if (!loaded)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
@@ -391,6 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return GRUB_ERR_NONE;
}
+#if !defined(__i386__) && !defined(__x86_64__)
initrd_size = grub_get_initrd_size (&initrd_ctx);
grub_dprintf ("linux", "Loading initrd\n");
@@ -410,6 +433,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
initrd_end = initrd_start + initrd_size;
grub_dprintf ("linux", "[addr=%p, size=0x%x]\n",
(void *) initrd_start, initrd_size);
+#endif
fail:
grub_initrd_close (&initrd_ctx);
@@ -441,8 +465,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
kernel_size = grub_file_size (file);
- if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE)
- goto fail;
+ switch (grub_arch_efi_linux_load_image_header (file, &lh))
+ {
+ case GRUB_ERR_NONE:
+ break;
+ case GRUB_ERR_NOT_IMPLEMENTED_YET:
+#if defined(__i386__) || defined(__x86_64__)
+ /*
+ * Retry with the legacy x86 boot code - it can load EFI kernels without
+ * the stub, and supports loading initrds without the LoadFile2 protocol
+ */
+ grub_file_close (file);
+ return grub_cmd_linux_x86_legacy (cmd, argc, argv);
+#endif
+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
+ /* fall through */
+ default:
+ goto fail;
+ }
grub_loader_unset();
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index c2385d0a561a8fc4..997647a33326eeb8 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -1136,6 +1136,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
+#ifndef GRUB_MACHINE_EFI
static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
@@ -1152,3 +1153,10 @@ GRUB_MOD_FINI(linux)
grub_unregister_command (cmd_linux);
grub_unregister_command (cmd_initrd);
}
+#else
+extern grub_err_t __attribute__((alias("grub_cmd_linux")))
+grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
+
+extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
+grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
+#endif
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 444bf5b0b53e31fe..d02abca7da67f787 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -113,12 +113,12 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
#if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
+#endif
#include <grub/file.h>
grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file,
struct linux_arch_kernel_header *lh);
grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
char *args);
-#endif
grub_addr_t grub_efi_modules_addr (void);
--
2.39.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386
2023-05-11 12:06 ` [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386 Ard Biesheuvel
@ 2023-05-11 12:14 ` Ard Biesheuvel
2023-05-14 5:12 ` Glenn Washburn
1 sibling, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:14 UTC (permalink / raw)
To: grub-devel; +Cc: dkiper
On Thu, 11 May 2023 at 14:06, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Switch the x86 based EFI platform builds to the generic EFI loader,
> which exposes the initrd via the LoadFile2 protocol instead of the
> x86-specific setup header. This will launch the Linux kernel via its EFI
> stub, which performs its own initialization in the EFI boot services
> context before calling ExitBootServices() and performing the bare metal
> Linux boot.
>
> Given that only Linux kernel versions v5.8 and later support this initrd
> loading method, the existing x86 loader is retained as a fallback, which
> will also be used for Linux kernels built without the EFI stub. In this
> case, GRUB calls ExitBootServices() before entering the Linux kernel,
> and all EFI related information is provided to the kernel via struct
> boot_params in the setup header, as before.
>
> Note that this means that booting EFI stub kernels older than v5.8 is
> not supported even when not using an initrd at all.
Clarification: you /can/ boot EFI stub kernels older than v5.8 but
they will use the fallback, even though their lack of LoadFIle2
support is not strictly an impediment for booting via the EFI stub if
no initrd needs to be loaded.
> Also, the EFI
> handover protocol, which has no basis in the UEFI specification, is not
> implemented.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> grub-core/Makefile.core.def | 5 +-
> grub-core/loader/efi/linux.c | 51 ++++++++++++++++++--
> grub-core/loader/i386/linux.c | 8 +++
> include/grub/efi/efi.h | 2 +-
> 4 files changed, 56 insertions(+), 10 deletions(-)
>
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 8ee2bd89c4205761..bc08955ac791241a 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -1818,11 +1818,8 @@ module = {
> powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
> sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
> arm_coreboot = loader/arm/linux.c;
> - arm_efi = loader/efi/linux.c;
> arm_uboot = loader/arm/linux.c;
> - arm64 = loader/efi/linux.c;
> - riscv32 = loader/efi/linux.c;
> - riscv64 = loader/efi/linux.c;
> + efi = loader/efi/linux.c;
> emu = loader/emu/linux.c;
> common = loader/linux.c;
> common = lib/cmdline.c;
> diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> index 15e0686549d7ecca..970a4d7a5d4d464f 100644
> --- a/grub-core/loader/efi/linux.c
> +++ b/grub-core/loader/efi/linux.c
> @@ -69,6 +69,12 @@ static initrd_media_device_path_t initrd_lf2_device_path = {
> }
> };
>
> +extern grub_err_t
> +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
> +
> +extern grub_err_t
> +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
> +
> static grub_efi_status_t __grub_efi_api
> grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> grub_efi_device_path_t *device_path,
> @@ -89,8 +95,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
> return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read Linux image header");
>
> if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
> - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> - N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
> + return GRUB_ERR_NOT_IMPLEMENTED_YET;
>
> grub_dprintf ("linux", "UEFI stub kernel:\n");
> grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
> @@ -117,7 +122,11 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
> if (lh->pe_image_header.optional_header.major_image_version >= 1)
> initrd_use_loadfile2 = true;
> else
> +#if defined(__i386__) || defined(__x86_64__)
> + return GRUB_ERR_NOT_IMPLEMENTED_YET;
> +#else
> initrd_use_loadfile2 = false;
> +#endif
>
> grub_dprintf ("linux", "LoadFile2 initrd loading %sabled\n",
> initrd_use_loadfile2 ? "en" : "dis");
> @@ -125,6 +134,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
> return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> static grub_err_t
> finalize_params_linux (void)
> {
> @@ -169,6 +179,7 @@ failure:
> grub_fdt_unload();
> return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
> }
> +#endif
>
> grub_err_t
> grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
> @@ -231,8 +242,10 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
> static grub_err_t
> grub_linux_boot (void)
> {
> +#if !defined(__i386__) && !defined(__x86_64__)
> if (finalize_params_linux () != GRUB_ERR_NONE)
> return grub_errno;
> +#endif
>
> return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
> kernel_size, linux_args));
> @@ -253,7 +266,9 @@ grub_linux_unload (void)
> if (kernel_addr)
> grub_efi_free_pages ((grub_addr_t) kernel_addr,
> GRUB_EFI_BYTES_TO_PAGES (kernel_size));
> +#if !defined(__i386__) && !defined(__x86_64__)
> grub_fdt_unload ();
> +#endif
>
> if (initrd_lf2_handle != NULL)
> {
> @@ -269,6 +284,7 @@ grub_linux_unload (void)
> return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> /*
> * As per linux/Documentation/arm/Booting
> * ARM initrd needs to be covered by kernel linear mapping,
> @@ -304,6 +320,7 @@ allocate_initrd_mem (int initrd_pages)
> GRUB_EFI_ALLOCATE_MAX_ADDRESS,
> GRUB_EFI_LOADER_DATA);
> }
> +#endif
>
> static grub_efi_status_t __grub_efi_api
> grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> @@ -345,7 +362,7 @@ static grub_err_t
> grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> int argc, char *argv[])
> {
> - int initrd_size, initrd_pages;
> + int __attribute__ ((unused)) initrd_size, initrd_pages;
> void *initrd_mem = NULL;
> grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
> grub_efi_status_t status;
> @@ -356,6 +373,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> goto fail;
> }
>
> +#if defined(__i386__) || defined(__x86_64__)
> + if (!initrd_use_loadfile2)
> + return grub_cmd_initrd_x86_legacy (cmd, argc, argv);
> +#endif
> +
> if (!loaded)
> {
> grub_error (GRUB_ERR_BAD_ARGUMENT,
> @@ -391,6 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> initrd_size = grub_get_initrd_size (&initrd_ctx);
> grub_dprintf ("linux", "Loading initrd\n");
>
> @@ -410,6 +433,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> initrd_end = initrd_start + initrd_size;
> grub_dprintf ("linux", "[addr=%p, size=0x%x]\n",
> (void *) initrd_start, initrd_size);
> +#endif
>
> fail:
> grub_initrd_close (&initrd_ctx);
> @@ -441,8 +465,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
>
> kernel_size = grub_file_size (file);
>
> - if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE)
> - goto fail;
> + switch (grub_arch_efi_linux_load_image_header (file, &lh))
> + {
> + case GRUB_ERR_NONE:
> + break;
> + case GRUB_ERR_NOT_IMPLEMENTED_YET:
> +#if defined(__i386__) || defined(__x86_64__)
> + /*
> + * Retry with the legacy x86 boot code - it can load EFI kernels without
> + * the stub, and supports loading initrds without the LoadFile2 protocol
> + */
> + grub_file_close (file);
> + return grub_cmd_linux_x86_legacy (cmd, argc, argv);
> +#endif
> + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> + N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
> + /* fall through */
> + default:
> + goto fail;
> + }
>
> grub_loader_unset();
>
> diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
> index c2385d0a561a8fc4..997647a33326eeb8 100644
> --- a/grub-core/loader/i386/linux.c
> +++ b/grub-core/loader/i386/linux.c
> @@ -1136,6 +1136,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> return grub_errno;
> }
>
> +#ifndef GRUB_MACHINE_EFI
> static grub_command_t cmd_linux, cmd_initrd;
>
> GRUB_MOD_INIT(linux)
> @@ -1152,3 +1153,10 @@ GRUB_MOD_FINI(linux)
> grub_unregister_command (cmd_linux);
> grub_unregister_command (cmd_initrd);
> }
> +#else
> +extern grub_err_t __attribute__((alias("grub_cmd_linux")))
> +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
> +
> +extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
> +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char *argv[]);
> +#endif
> diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
> index 444bf5b0b53e31fe..d02abca7da67f787 100644
> --- a/include/grub/efi/efi.h
> +++ b/include/grub/efi/efi.h
> @@ -113,12 +113,12 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
> #if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
> void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
> grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
> +#endif
> #include <grub/file.h>
> grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file,
> struct linux_arch_kernel_header *lh);
> grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
> char *args);
> -#endif
>
> grub_addr_t grub_efi_modules_addr (void);
>
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
@ 2023-05-11 12:14 ` John Paul Adrian Glaubitz
2023-05-11 12:17 ` Ard Biesheuvel
2023-05-11 22:31 ` Vladimir 'phcoder' Serbinenko
1 sibling, 1 reply; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-05-11 12:14 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: dkiper, Ard Biesheuvel
On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> boot that deviates from other architectures. Given that IA64 is unused
> and unmaintained, it makes no sense to pretend that the EFI changes we
> are making are tested or supported on IA64, so let's just get rid of it.
But I just recently tested GRUB from git on IA64 and it worked without
any problems. We're using GRUB to boot Debian on IA64.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:14 ` John Paul Adrian Glaubitz
@ 2023-05-11 12:17 ` Ard Biesheuvel
2023-05-11 12:42 ` Steve McIntyre
2023-05-11 13:34 ` John Paul Adrian Glaubitz
0 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 12:17 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: The development of GNU GRUB, dkiper
On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> > boot that deviates from other architectures. Given that IA64 is unused
> > and unmaintained, it makes no sense to pretend that the EFI changes we
> > are making are tested or supported on IA64, so let's just get rid of it.
>
> But I just recently tested GRUB from git on IA64 and it worked without
> any problems. We're using GRUB to boot Debian on IA64.
>
IA-64 is a dead platform, and a waste of electricity.
Feel free to keep using it, but please stop demanding that our people
keep wasting their time on it. If you want to support it in Debian,
you can carry it as a downstream patch and shoulder the maintenance
burden.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:17 ` Ard Biesheuvel
@ 2023-05-11 12:42 ` Steve McIntyre
2023-05-11 13:34 ` John Paul Adrian Glaubitz
1 sibling, 0 replies; 26+ messages in thread
From: Steve McIntyre @ 2023-05-11 12:42 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: John Paul Adrian Glaubitz, dkiper
On Thu, May 11, 2023 at 02:17:57PM +0200, Ard Biesheuvel wrote:
>On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
><glaubitz@physik.fu-berlin.de> wrote:
>>
>> On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
>> > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
>> > boot that deviates from other architectures. Given that IA64 is unused
>> > and unmaintained, it makes no sense to pretend that the EFI changes we
>> > are making are tested or supported on IA64, so let's just get rid of it.
>>
>> But I just recently tested GRUB from git on IA64 and it worked without
>> any problems. We're using GRUB to boot Debian on IA64.
>>
>
>IA-64 is a dead platform, and a waste of electricity.
>
>Feel free to keep using it, but please stop demanding that our people
>keep wasting their time on it. If you want to support it in Debian,
>you can carry it as a downstream patch and shoulder the maintenance
>burden.
And I'm not convinced that as the Debian maintainer I care enough. At
some point old machines and old architectures die, it's a fact of
life. If people insist on keeping their old machines alive for the
sake of it, then at some point they also will have to accept staying
on old software too.
--
Steve McIntyre, Cambridge, UK. steve@einval.com
“Changing random stuff until your program works is bad coding
practice, but if you do it fast enough it’s Machine Learning.”
-- https://twitter.com/manisha72617183
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:17 ` Ard Biesheuvel
2023-05-11 12:42 ` Steve McIntyre
@ 2023-05-11 13:34 ` John Paul Adrian Glaubitz
2023-05-11 14:29 ` Ard Biesheuvel
1 sibling, 1 reply; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-05-11 13:34 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: dkiper, The development of GNU GRUB
On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
> On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
> >
> > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> > > boot that deviates from other architectures. Given that IA64 is unused
> > > and unmaintained, it makes no sense to pretend that the EFI changes we
> > > are making are tested or supported on IA64, so let's just get rid of it.
> >
> > But I just recently tested GRUB from git on IA64 and it worked without
> > any problems. We're using GRUB to boot Debian on IA64.
> >
>
> IA-64 is a dead platform, and a waste of electricity.
I was just making a statement regarding the testability of the code. That's all.
> Feel free to keep using it, but please stop demanding that our people
> keep wasting their time on it. If you want to support it in Debian,
> you can carry it as a downstream patch and shoulder the maintenance
> burden.
Who is "our people"? Do you think that you are part of the community and
I am not? I don't think this kind of hostility is justified. Neither you
nor I own this project.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 13:34 ` John Paul Adrian Glaubitz
@ 2023-05-11 14:29 ` Ard Biesheuvel
2023-05-11 18:42 ` matoro
2023-05-12 10:41 ` John Paul Adrian Glaubitz
0 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 14:29 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: dkiper, The development of GNU GRUB
On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
> > <glaubitz@physik.fu-berlin.de> wrote:
> > >
> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> > > > boot that deviates from other architectures. Given that IA64 is unused
> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
> > > > are making are tested or supported on IA64, so let's just get rid of it.
> > >
> > > But I just recently tested GRUB from git on IA64 and it worked without
> > > any problems. We're using GRUB to boot Debian on IA64.
> > >
> >
> > IA-64 is a dead platform, and a waste of electricity.
>
> I was just making a statement regarding the testability of the code. That's all.
>
Fair enough. That is good to know actually - that way, we have a known
working state right before we remove it.
> > Feel free to keep using it, but please stop demanding that our people
> > keep wasting their time on it. If you want to support it in Debian,
> > you can carry it as a downstream patch and shoulder the maintenance
> > burden.
>
> Who is "our people"? Do you think that you are part of the community and
> I am not? I don't think this kind of hostility is justified. Neither you
> nor I own this project.
>
Apologies - I had meant to type 'other people' not 'our people'. I
rarely contribute to GRUB myself, so I wouldn't consider myself more a
part of this community than anyone else.
But my point remains: I have inferred from your response (and your
involvement in similar discussions around the Linux kernel) that you
would prefer Itanium support to be retained, right?
So could you explain who you think should carry the maintenance
burden? IA64 will be the only EFI architecture in GRUB that does not
boot via an EFI stub in Linux, and this deviation means that retaining
support for it is going to take actual developer and maintainer
bandwidth. GRUB gets very little of that as it is, which means that
keeping IA64 support alive comes at the cost of worse support for
other architectures and platforms. (The series that this patch is part
of breaks the ia64 build, and i i struggle to see why i should care
about that)
Very few of those people have access to such systems to begin with
(probably none), and the companies that manufactured them stopped
supporting them in the open source years ago, so testing these changes
is not straight-forward, making it unreasonable to demand this from
contributors. Also, it is unclear to me why the needs of the few
people that do still run such a system are not served by a build based
on today's GRUB tree, and why ia64 support needs to be retained going
forward.
I'll leave it to the maintainers whether to merge this patch or not,
but if this needs to keep working on ia64 as well, someone else will
have to step up.
--
Ard.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 14:29 ` Ard Biesheuvel
@ 2023-05-11 18:42 ` matoro
2023-05-11 22:09 ` Ard Biesheuvel
2023-05-12 10:41 ` John Paul Adrian Glaubitz
1 sibling, 1 reply; 26+ messages in thread
From: matoro @ 2023-05-11 18:42 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: John Paul Adrian Glaubitz, dkiper, The development of GNU GRUB
On 2023-05-11 10:29, Ard Biesheuvel wrote:
> On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
>>
>> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
>> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
>> > <glaubitz@physik.fu-berlin.de> wrote:
>> > >
>> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
>> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
>> > > > boot that deviates from other architectures. Given that IA64 is unused
>> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
>> > > > are making are tested or supported on IA64, so let's just get rid of it.
>> > >
>> > > But I just recently tested GRUB from git on IA64 and it worked without
>> > > any problems. We're using GRUB to boot Debian on IA64.
>> > >
>> >
>> > IA-64 is a dead platform, and a waste of electricity.
>>
>> I was just making a statement regarding the testability of the code.
>> That's all.
>>
>
> Fair enough. That is good to know actually - that way, we have a known
> working state right before we remove it.
>
>> > Feel free to keep using it, but please stop demanding that our people
>> > keep wasting their time on it. If you want to support it in Debian,
>> > you can carry it as a downstream patch and shoulder the maintenance
>> > burden.
>>
>> Who is "our people"? Do you think that you are part of the community
>> and
>> I am not? I don't think this kind of hostility is justified. Neither
>> you
>> nor I own this project.
>>
>
> Apologies - I had meant to type 'other people' not 'our people'. I
> rarely contribute to GRUB myself, so I wouldn't consider myself more a
> part of this community than anyone else.
>
> But my point remains: I have inferred from your response (and your
> involvement in similar discussions around the Linux kernel) that you
> would prefer Itanium support to be retained, right?
>
> So could you explain who you think should carry the maintenance
> burden? IA64 will be the only EFI architecture in GRUB that does not
> boot via an EFI stub in Linux, and this deviation means that retaining
> support for it is going to take actual developer and maintainer
> bandwidth. GRUB gets very little of that as it is, which means that
> keeping IA64 support alive comes at the cost of worse support for
> other architectures and platforms. (The series that this patch is part
> of breaks the ia64 build, and i i struggle to see why i should care
> about that)
>
> Very few of those people have access to such systems to begin with
> (probably none), and the companies that manufactured them stopped
> supporting them in the open source years ago, so testing these changes
> is not straight-forward, making it unreasonable to demand this from
> contributors. Also, it is unclear to me why the needs of the few
> people that do still run such a system are not served by a build based
> on today's GRUB tree, and why ia64 support needs to be retained going
> forward.
>
> I'll leave it to the maintainers whether to merge this patch or not,
> but if this needs to keep working on ia64 as well, someone else will
> have to step up.
Hi, I also have a functioning GRUB install on ia64 EFI. My machine is
fully open and available for debugging work, including on kernel and
bootloader (hard resets can be done via management console).
If there is any way this support can be saved or at least delayed by
providing real hardware to work on, please reach out. The environment
is completely remote and available for anybody who would like to give it
a try.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 18:42 ` matoro
@ 2023-05-11 22:09 ` Ard Biesheuvel
2023-05-11 22:40 ` matoro
2023-05-12 0:08 ` Lennart Sorensen
0 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-11 22:09 UTC (permalink / raw)
To: matoro; +Cc: John Paul Adrian Glaubitz, dkiper, The development of GNU GRUB
On Thu, 11 May 2023 at 20:59, matoro
<matoro_mailinglist_grub-devel@matoro.tk> wrote:
>
> On 2023-05-11 10:29, Ard Biesheuvel wrote:
> > On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
> > <glaubitz@physik.fu-berlin.de> wrote:
> >>
> >> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
> >> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
> >> > <glaubitz@physik.fu-berlin.de> wrote:
> >> > >
> >> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> >> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> >> > > > boot that deviates from other architectures. Given that IA64 is unused
> >> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
> >> > > > are making are tested or supported on IA64, so let's just get rid of it.
> >> > >
> >> > > But I just recently tested GRUB from git on IA64 and it worked without
> >> > > any problems. We're using GRUB to boot Debian on IA64.
> >> > >
> >> >
> >> > IA-64 is a dead platform, and a waste of electricity.
> >>
> >> I was just making a statement regarding the testability of the code.
> >> That's all.
> >>
> >
> > Fair enough. That is good to know actually - that way, we have a known
> > working state right before we remove it.
> >
> >> > Feel free to keep using it, but please stop demanding that our people
> >> > keep wasting their time on it. If you want to support it in Debian,
> >> > you can carry it as a downstream patch and shoulder the maintenance
> >> > burden.
> >>
> >> Who is "our people"? Do you think that you are part of the community
> >> and
> >> I am not? I don't think this kind of hostility is justified. Neither
> >> you
> >> nor I own this project.
> >>
> >
> > Apologies - I had meant to type 'other people' not 'our people'. I
> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
> > part of this community than anyone else.
> >
> > But my point remains: I have inferred from your response (and your
> > involvement in similar discussions around the Linux kernel) that you
> > would prefer Itanium support to be retained, right?
> >
> > So could you explain who you think should carry the maintenance
> > burden? IA64 will be the only EFI architecture in GRUB that does not
> > boot via an EFI stub in Linux, and this deviation means that retaining
> > support for it is going to take actual developer and maintainer
> > bandwidth. GRUB gets very little of that as it is, which means that
> > keeping IA64 support alive comes at the cost of worse support for
> > other architectures and platforms. (The series that this patch is part
> > of breaks the ia64 build, and i i struggle to see why i should care
> > about that)
> >
> > Very few of those people have access to such systems to begin with
> > (probably none), and the companies that manufactured them stopped
> > supporting them in the open source years ago, so testing these changes
> > is not straight-forward, making it unreasonable to demand this from
> > contributors. Also, it is unclear to me why the needs of the few
> > people that do still run such a system are not served by a build based
> > on today's GRUB tree, and why ia64 support needs to be retained going
> > forward.
> >
> > I'll leave it to the maintainers whether to merge this patch or not,
> > but if this needs to keep working on ia64 as well, someone else will
> > have to step up.
>
> Hi, I also have a functioning GRUB install on ia64 EFI. My machine is
> fully open and available for debugging work, including on kernel and
> bootloader (hard resets can be done via management console).
>
> If there is any way this support can be saved or at least delayed by
> providing real hardware to work on, please reach out. The environment
> is completely remote and available for anybody who would like to give it
> a try.
Thanks, this could be helpful if we manage to find people that have
the bandwidth to keep working on this. Would you be willing to spend
time and development effort yourself on building and installing GRUB
from the upstream repository on this machine (which is a bit more
complicated than running kernels or user space programs)? Which distro
and version are you using btw?
And just out of curiosity, why does this matter to you? Given that the
ia64 firmware, the hardware and the linux boot protocol have not
changed in a decade, wouldn't it make much more sense to stick with a
stable, current version of GRUB, assuming that these are machines that
need to be kept in working order? What kind of workloads are you
running on these machines?
For ia64, there are no upsides to running newer GRUB code with changes
applied to the EFI layer, as these involve protocols and other
functionality that the ia64 firmware simply does not implement. In the
best case, it works exactly the same as it does today. In the worst
case, it bricks your box and someone has to go down and reinstall the
bootloader (or more) using some kind of rescue image. Future EFI work
will be focused on tightening memory permissions and implementing
other robustness and hardening improvements, and these changes might
tickle bugs in older firmware in ways we cannot anticipate at this
point.
So what exactly would we be trying to achieve by keeping ia64
supported in upstream GRUB? Is it really important enough to justify
asking contributors to spend time and effort on it rather than on
something else?
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
2023-05-11 12:14 ` John Paul Adrian Glaubitz
@ 2023-05-11 22:31 ` Vladimir 'phcoder' Serbinenko
1 sibling, 0 replies; 26+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-05-11 22:31 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 90225 bytes --]
I still have my itanium in the closet and check newer versions of GRUB with
it
Le jeu. 11 mai 2023, 14:07, Ard Biesheuvel <ardb@kernel.org> a écrit :
> Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> boot that deviates from other architectures. Given that IA64 is unused
> and unmaintained, it makes no sense to pretend that the EFI changes we
> are making are tested or supported on IA64, so let's just get rid of it.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> .travis.yml | 7 +-
> Makefile.util.def | 1 -
> configure.ac | 8 -
> docs/grub-dev.texi | 2 +-
> docs/grub.texi | 2 +-
> gentpl.py | 6 +-
> grub-core/Makefile.am | 6 -
> grub-core/Makefile.core.def | 15 -
> grub-core/commands/file.c | 33 --
> grub-core/kern/dl.c | 12 -
> grub-core/kern/emu/cache.c | 4 +-
> grub-core/kern/emu/cache_s.S | 2 +-
> grub-core/kern/emu/lite.c | 3 -
> grub-core/kern/ia64/cache.c | 35 --
> grub-core/kern/ia64/dl.c | 150 -----
> grub-core/kern/ia64/dl_helper.c | 241 --------
> grub-core/kern/ia64/efi/init.c | 80 ---
> grub-core/kern/ia64/efi/startup.S | 44 --
> grub-core/kern/misc.c | 2 +-
> grub-core/lib/efi/halt.c | 2 +-
> grub-core/lib/ia64/longjmp.S | 162 ------
> grub-core/lib/ia64/setjmp.S | 177 ------
> grub-core/lib/setjmp.S | 3 -
> grub-core/loader/ia64/efi/linux.c | 607 --------------------
> include/grub/cache.h | 2 +-
> include/grub/dl.h | 12 +-
> include/grub/efi/pe32.h | 2 -
> include/grub/elf.h | 109 ----
> include/grub/ia64/efi/memory.h | 6 -
> include/grub/ia64/efi/time.h | 23 -
> include/grub/ia64/kernel.h | 25 -
> include/grub/ia64/reloc.h | 44 --
> include/grub/ia64/setjmp.h | 28 -
> include/grub/ia64/time.h | 28 -
> include/grub/ia64/types.h | 32 --
> include/grub/misc.h | 2 +-
> include/grub/util/install.h | 1 -
> include/grub/util/mkimage.h | 2 -
> tests/core_compress_test.in | 2 +-
> util/grub-install-common.c | 1 -
> util/grub-install.c | 16 -
> util/grub-mkimage.c | 1 -
> util/grub-mkimagexx.c | 175 +-----
> util/grub-mknetdir.c | 1 -
> util/grub-mkrescue.c | 7 -
> util/grub-module-verifier.c | 22 -
> util/mkimage.c | 17 -
> 47 files changed, 16 insertions(+), 2146 deletions(-)
>
> diff --git a/.travis.yml b/.travis.yml
> index 4bd05a30a27ad15c..7bea51b2f0c4da89 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -23,7 +23,7 @@ addons:
> env:
> global:
> # Include all cross toolchain paths, so we can just call them later
> down.
> - -
> PATH=/tmp/qemu-install/bin:/tmp/grub/bin:/usr/bin:/bin:/tmp/cross/gcc-8.1.0-nolibc/aarch64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/arm-linux-gnueabi/bin:/tmp/cross/gcc-8.1.0-nolibc/ia64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/mips64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/powerpc64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv32-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/sparc64-linux/bin
> + -
> PATH=/tmp/qemu-install/bin:/tmp/grub/bin:/usr/bin:/bin:/tmp/cross/gcc-8.1.0-nolibc/aarch64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/arm-linux-gnueabi/bin:/tmp/cross/gcc-8.1.0-nolibc/mips64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/powerpc64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv32-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/sparc64-linux/bin
>
> before_script:
> # Install necessary toolchains based on $CROSS_TARGETS variable.
> @@ -44,7 +44,6 @@ script:
> arch=${target%-*};
> [ "$arch" = "arm64" ] && arch=aarch64-linux;
> [ "$arch" = "arm" ] && arch=arm-linux-gnueabi;
> - [ "$arch" = "ia64" ] && arch=ia64-linux;
> [ "$arch" = "mipsel" ] && arch=mips64-linux;
> [ "$arch" = "powerpc" ] && arch=powerpc64-linux;
> [ "$arch" = "riscv32" ] && arch=riscv32-linux;
> @@ -83,10 +82,6 @@ matrix:
> env:
> - GRUB_TARGETS="sparc64-ieee1275"
> - CROSS_TARGETS="sparc64-linux"
> - - name: "ia64"
> - env:
> - - GRUB_TARGETS="ia64-efi"
> - - CROSS_TARGETS="ia64-linux"
> - name: "mips"
> env:
> - GRUB_TARGETS="mips-arc mipsel-arc mipsel-qemu_mips
> mips-qemu_mips"
> diff --git a/Makefile.util.def b/Makefile.util.def
> index beaef1168f0d09b0..ae9e628e5c85b751 100644
> --- a/Makefile.util.def
> +++ b/Makefile.util.def
> @@ -160,7 +160,6 @@ library = {
> common = grub-core/io/gzio.c;
> common = grub-core/io/xzio.c;
> common = grub-core/io/lzopio.c;
> - common = grub-core/kern/ia64/dl_helper.c;
> common = grub-core/kern/arm/dl_helper.c;
> common = grub-core/kern/arm64/dl_helper.c;
> common = grub-core/lib/minilzo/minilzo.c;
> diff --git a/configure.ac b/configure.ac
> index ca42ff8f73182511..789e5658e4d9ab9e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -141,7 +141,6 @@ if test "x$with_platform" = x; then
> sparc64-*) platform=ieee1275 ;;
> mipsel-*) platform=loongson ;;
> mips-*) platform=arc ;;
> - ia64-*) platform=efi ;;
> arm-*) platform=uboot ;;
> arm64-*) platform=efi ;;
> riscv32-*) platform=efi ;;
> @@ -180,7 +179,6 @@ case "$target_cpu"-"$platform" in
> i386-qemu) ;;
> powerpc-ieee1275) ;;
> sparc64-ieee1275) ;;
> - ia64-efi) ;;
> mips-qemu_mips) ;;
> mips-qemu-mips) platform=qemu_mips;;
> mips-arc) ;;
> @@ -890,11 +888,6 @@ if test x"$platform" != xemu ; then
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
>
> [grub_cv_target_cc_soft_float="-march=rv64imac_zicsr_zifencei
> -mabi=lp64"], [])
> fi
> - if test "x$target_cpu" = xia64; then
> - CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt
> -Werror"
> - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> -
> [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"],
> [])
> - fi
> if test "x$target_cpu" = xsh4; then
> CFLAGS="$TARGET_CFLAGS -m4-nofpu -Werror"
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> @@ -1997,7 +1990,6 @@ AM_CONDITIONAL([COND_arm_coreboot], [test
> x$target_cpu = xarm -a x$platform = xc
> AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform =
> xefi])
> AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
> AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a
> x$platform = xefi])
> -AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform
> = xefi])
> AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform =
> xpc])
> AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform
> = xefi])
> AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform
> = xqemu])
> diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
> index 31eb99ea29943c39..ab68676b03814cfc 100644
> --- a/docs/grub-dev.texi
> +++ b/docs/grub-dev.texi
> @@ -753,7 +753,7 @@ ones (sorry that this list is duplicated):
> GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu",
> "i386_coreboot",
> "i386_multiboot", "i386_ieee1275", "x86_64_efi",
> "mips_loongson", "sparc64_ieee1275",
> - "powerpc_ieee1275", "mips_arc", "ia64_efi",
> + "powerpc_ieee1275", "mips_arc",
> "mips_qemu_mips", "s390_mainframe" ]
> @end example
>
> diff --git a/docs/grub.texi b/docs/grub.texi
> index a3e9ce2d1ac7e780..c0b7f832f79f7c16 100644
> --- a/docs/grub.texi
> +++ b/docs/grub.texi
> @@ -6848,7 +6848,7 @@ X86 support is summarised in the following table.
> ``Yes'' means that the kernel
> @item Requires ACPI
> @end enumerate
>
> -PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports
> Linux
> +PowerPC and Sparc64 ports support only Linux. MIPS port supports Linux
> and multiboot2.
>
> @section Boot tests
> diff --git a/gentpl.py b/gentpl.py
> index 88abe5b0a119321c..2b5ead8afad95cd7 100644
> --- a/gentpl.py
> +++ b/gentpl.py
> @@ -30,7 +30,7 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi",
> "i386_qemu", "i386_coreboot",
> "i386_multiboot", "i386_ieee1275", "x86_64_efi",
> "i386_xen", "x86_64_xen", "i386_xen_pvh",
> "mips_loongson", "sparc64_ieee1275",
> - "powerpc_ieee1275", "mips_arc", "ia64_efi",
> + "powerpc_ieee1275", "mips_arc",
> "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",
> "arm_coreboot", "riscv32_efi", "riscv64_efi" ]
>
> @@ -51,7 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
> GROUPS["riscv64"] = [ "riscv64_efi" ]
>
> # Groups based on firmware
> -GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi",
> "arm64_efi",
> +GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "arm_efi", "arm64_efi",
> "riscv32_efi", "riscv64_efi" ]
> GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275",
> "powerpc_ieee1275" ]
> GROUPS["uboot"] = [ "arm_uboot" ]
> @@ -83,7 +83,7 @@ GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi",
> "riscv32_efi", "riscv64_e
>
> # Needs software helpers for division
> # Must match GRUB_DIVISION_IN_SOFTWARE in misc.h
> -GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"] + GROUPS["riscv32"]
> +GROUPS["softdiv"] = GROUPS["arm"] + GROUPS["riscv32"]
> GROUPS["no_softdiv"] = GRUB_PLATFORMS[:]
> for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i)
>
> diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
> index 80e7a83edf9ba3aa..6feecfdef0db6385 100644
> --- a/grub-core/Makefile.am
> +++ b/grub-core/Makefile.am
> @@ -188,12 +188,6 @@ KERNEL_HEADER_FILES +=
> $(top_srcdir)/include/grub/acpi.h
> KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
> endif
>
> -if COND_ia64_efi
> -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
> -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
> -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
> -endif
> -
> if COND_mips
> KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
> endif
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 801df7c21de663ec..9194be1d4f796bd7 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -57,10 +57,6 @@ kernel = {
> x86_64_efi_ldflags = '-Wl,-r';
> x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R
> .comment -R .note.gnu.gold-version';
>
> - ia64_efi_cflags = '-fshort-wchar -fno-builtin -fpic
> -minline-int-divide-max-throughput';
> - ia64_efi_ldflags = '-Wl,-r';
> - ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment
> -R .note.gnu.gold-version';
> -
> arm_efi_cflags = '-fshort-wchar';
> arm_efi_ldflags = '-Wl,-r';
> arm_efi_stripflags = '--strip-unneeded -K start -R .note -R
> .comment -R .note.gnu.gold-version';
> @@ -252,12 +248,6 @@ kernel = {
> i386_xen_pvh = kern/xen/init.c;
> i386_xen_pvh = term/xen/console.c;
>
> - ia64_efi = kern/ia64/efi/startup.S;
> - ia64_efi = kern/ia64/efi/init.c;
> - ia64_efi = kern/ia64/dl.c;
> - ia64_efi = kern/ia64/dl_helper.c;
> - ia64_efi = kern/ia64/cache.c;
> -
> arm_efi = kern/arm/efi/init.c;
> arm_efi = kern/efi/fdt.c;
>
> @@ -837,7 +827,6 @@ module = {
> enable = sparc64_ieee1275;
> enable = powerpc_ieee1275;
> enable = mips_arc;
> - enable = ia64_efi;
> enable = arm_efi;
> enable = arm64_efi;
> enable = arm_uboot;
> @@ -1730,8 +1719,6 @@ module = {
> extra_dist = lib/x86_64/setjmp.S;
> extra_dist = lib/sparc64/setjmp.S;
> extra_dist = lib/powerpc/setjmp.S;
> - extra_dist = lib/ia64/setjmp.S;
> - extra_dist = lib/ia64/longjmp.S;
> extra_dist = lib/arm/setjmp.S;
> extra_dist = lib/arm64/setjmp.S;
> extra_dist = lib/riscv/setjmp.S;
> @@ -1831,7 +1818,6 @@ module = {
> mips = loader/mips/linux.c;
> powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
> sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
> - ia64_efi = loader/ia64/efi/linux.c;
> arm_coreboot = loader/arm/linux.c;
> arm_efi = loader/efi/linux.c;
> arm_uboot = loader/arm/linux.c;
> @@ -1929,7 +1915,6 @@ module = {
>
> enable = x86;
> enable = i386_xen_pvh;
> - enable = ia64_efi;
> enable = arm_efi;
> enable = arm64_efi;
> enable = riscv32_efi;
> diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c
> index 7c13e976b505b3bf..574353491296e48a 100644
> --- a/grub-core/commands/file.c
> +++ b/grub-core/commands/file.c
> @@ -52,8 +52,6 @@ static const struct grub_arg_option options[] = {
> N_("Check if FILE is ARM Linux"), 0, 0},
> {"is-arm64-linux", 0, 0,
> N_("Check if FILE is ARM64 Linux"), 0, 0},
> - {"is-ia64-linux", 0, 0,
> - N_("Check if FILE is IA64 Linux"), 0, 0},
> {"is-mips-linux", 0, 0,
> N_("Check if FILE is MIPS Linux"), 0, 0},
> {"is-mipsel-linux", 0, 0,
> @@ -84,8 +82,6 @@ static const struct grub_arg_option options[] = {
> N_("Check if FILE is i386 EFI file"), 0, 0},
> {"is-x86_64-efi", 0, 0,
> N_("Check if FILE is x86_64 EFI file"), 0, 0},
> - {"is-ia64-efi", 0, 0,
> - N_("Check if FILE is IA64 EFI file"), 0, 0},
> {"is-arm64-efi", 0, 0,
> N_("Check if FILE is ARM64 EFI file"), 0, 0},
> {"is-arm-efi", 0, 0,
> @@ -116,7 +112,6 @@ enum
> IS_MULTIBOOT2,
> IS_ARM_LINUX,
> IS_ARM64_LINUX,
> - IS_IA64_LINUX,
> IS_MIPS_LINUX,
> IS_MIPSEL_LINUX,
> IS_SPARC64_LINUX,
> @@ -190,30 +185,6 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc,
> char **args)
> ret = 1;
> break;
> }
> - case IS_IA64_LINUX:
> - {
> - Elf64_Ehdr ehdr;
> -
> - if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
> - break;
> -
> - if (ehdr.e_ident[EI_MAG0] != ELFMAG0
> - || ehdr.e_ident[EI_MAG1] != ELFMAG1
> - || ehdr.e_ident[EI_MAG2] != ELFMAG2
> - || ehdr.e_ident[EI_MAG3] != ELFMAG3
> - || ehdr.e_ident[EI_VERSION] != EV_CURRENT
> - || ehdr.e_version != EV_CURRENT)
> - break;
> -
> - if (ehdr.e_ident[EI_CLASS] != ELFCLASS64
> - || ehdr.e_ident[EI_DATA] != ELFDATA2LSB
> - || ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_IA_64))
> - break;
> -
> - ret = 1;
> -
> - break;
> - }
>
> case IS_SPARC64_LINUX:
> {
> @@ -623,10 +594,6 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc,
> char **args)
> && coff_head.machine !=
> grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_X86_64))
> break;
> - if (type == IS_IA_EFI
> - && coff_head.machine !=
> - grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64))
> - break;
> if (type == IS_ARM64_EFI
> && coff_head.machine !=
> grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64))
> diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
> index e447fd0fab4e303b..b3009fce4a3cae93 100644
> --- a/grub-core/kern/dl.c
> +++ b/grub-core/kern/dl.c
> @@ -391,18 +391,6 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
> case STT_FUNC:
> sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod,
>
> sym->st_shndx);
> -#ifdef __ia64__
> - {
> - /* FIXME: free descriptor once it's not used anymore. */
> - char **desc;
> - desc = grub_malloc (2 * sizeof (char *));
> - if (!desc)
> - return grub_errno;
> - desc[0] = (void *) sym->st_value;
> - desc[1] = mod->base;
> - sym->st_value = (grub_addr_t) desc;
> - }
> -#endif
> if (bind != STB_LOCAL)
> if (grub_dl_register_symbol (name, (void *) sym->st_value, 1,
> mod))
> return grub_errno;
> diff --git a/grub-core/kern/emu/cache.c b/grub-core/kern/emu/cache.c
> index 113682cc42c1d6e8..0fdb763a57bd006a 100644
> --- a/grub-core/kern/emu/cache.c
> +++ b/grub-core/kern/emu/cache.c
> @@ -4,9 +4,7 @@
>
> #include <grub/cache.h>
>
> -#if defined(__ia64__)
> -#include "../ia64/cache.c"
> -#elif defined (__arm__) || defined (__aarch64__)
> +#if defined (__arm__) || defined (__aarch64__)
>
> void __clear_cache (void *beg, void *end);
>
> diff --git a/grub-core/kern/emu/cache_s.S b/grub-core/kern/emu/cache_s.S
> index 6885ffd69bde2b59..2ad520474ea28609 100644
> --- a/grub-core/kern/emu/cache_s.S
> +++ b/grub-core/kern/emu/cache_s.S
> @@ -13,7 +13,7 @@
> #include "../sparc64/cache.S"
> #elif defined(__powerpc__)
> #include "../powerpc/cache.S"
> -#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
> +#elif defined(__arm__) || defined(__aarch64__) || \
> defined(__mips__) || defined(__riscv)
> #else
> #error "No target cpu type is defined"
> diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c
> index b327d4e418841bc1..81baec907669dcd3 100644
> --- a/grub-core/kern/emu/lite.c
> +++ b/grub-core/kern/emu/lite.c
> @@ -15,9 +15,6 @@
> #include "../mips/dl.c"
> #elif defined(__powerpc__)
> #include "../powerpc/dl.c"
> -#elif defined(__ia64__)
> -#include "../ia64/dl_helper.c"
> -#include "../ia64/dl.c"
> #elif defined(__arm__)
> #include "../arm/dl_helper.c"
> #include "../arm/dl.c"
> diff --git a/grub-core/kern/ia64/cache.c b/grub-core/kern/ia64/cache.c
> deleted file mode 100644
> index 13efd308f7158943..0000000000000000
> --- a/grub-core/kern/ia64/cache.c
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -/* init.c - initialize an ia64-based EFI system */
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2008 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include <grub/types.h>
> -#include <grub/cache.h>
> -
> -void
> -grub_arch_sync_caches (void *address, grub_size_t len)
> -{
> - /* Cache line length is at least 32. */
> - len += (grub_uint64_t)address & 0x1f;
> - grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
> -
> - /* Flush data. */
> - for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
> - asm volatile ("fc.i %0" : : "r" (a));
> - /* Sync and serialize. Maybe extra. */
> - asm volatile (";; sync.i;; srlz.i;;");
> -}
> diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c
> deleted file mode 100644
> index db59300fea3ceec9..0000000000000000
> --- a/grub-core/kern/ia64/dl.c
> +++ /dev/null
> @@ -1,150 +0,0 @@
> -/* dl.c - arch-dependent part of loadable module support */
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include <grub/dl.h>
> -#include <grub/elf.h>
> -#include <grub/misc.h>
> -#include <grub/err.h>
> -#include <grub/mm.h>
> -#include <grub/i18n.h>
> -#include <grub/ia64/reloc.h>
> -
> -#define MASK19 ((1 << 19) - 1)
> -#define MASK20 ((1 << 20) - 1)
> -
> -/* Check if EHDR is a valid ELF header. */
> -grub_err_t
> -grub_arch_dl_check_header (void *ehdr)
> -{
> - Elf_Ehdr *e = ehdr;
> -
> - /* Check the magic numbers. */
> - if (e->e_ident[EI_CLASS] != ELFCLASS64
> - || e->e_ident[EI_DATA] != ELFDATA2LSB
> - || e->e_machine != EM_IA_64)
> - return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF
> magic"));
> -
> - return GRUB_ERR_NONE;
> -}
> -
> -#pragma GCC diagnostic ignored "-Wcast-align"
> -
> -/* Relocate symbols. */
> -grub_err_t
> -grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
> - Elf_Shdr *s, grub_dl_segment_t seg)
> -{
> - Elf_Rela *rel, *max;
> -
> - for (rel = (Elf_Rela *) ((char *) ehdr + s->sh_offset),
> - max = (Elf_Rela *) ((char *) rel + s->sh_size);
> - rel < max;
> - rel = (Elf_Rela *) ((char *) rel + s->sh_entsize))
> - {
> - grub_addr_t addr;
> - Elf_Sym *sym;
> - grub_uint64_t value;
> -
> - if (seg->size < (rel->r_offset & ~3))
> - return grub_error (GRUB_ERR_BAD_MODULE,
> - "reloc offset is out of the segment");
> -
> - addr = (grub_addr_t) seg->addr + rel->r_offset;
> - sym = (Elf_Sym *) ((char *) mod->symtab
> - + mod->symsize * ELF_R_SYM (rel->r_info));
> -
> - /* On the PPC the value does not have an explicit
> - addend, add it. */
> - value = sym->st_value + rel->r_addend;
> -
> - switch (ELF_R_TYPE (rel->r_info))
> - {
> - case R_IA64_PCREL21B:
> - {
> - grub_int64_t noff;
> - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
> - {
> - struct grub_ia64_trampoline *tr = mod->trampptr;
> - grub_ia64_make_trampoline (tr, value);
> - noff = ((char *) tr - (char *) (addr & ~3)) >> 4;
> - mod->trampptr = tr + 1;
> - }
> - else
> - noff = ((char *) value - (char *) (addr & ~3)) >> 4;
> -
> - if ((noff & ~MASK19) && ((-noff) & ~MASK19))
> - return grub_error (GRUB_ERR_BAD_MODULE,
> - "jump offset too big (%lx)", noff);
> - grub_ia64_add_value_to_slot_20b (addr, noff);
> - }
> - break;
> - case R_IA64_SEGREL64LSB:
> - *(grub_uint64_t *) addr += value - (grub_addr_t) seg->addr;
> - break;
> - case R_IA64_FPTR64LSB:
> - case R_IA64_DIR64LSB:
> - *(grub_uint64_t *) addr += value;
> - break;
> - case R_IA64_PCREL64LSB:
> - *(grub_uint64_t *) addr += value - addr;
> - break;
> - case R_IA64_GPREL64I:
> - grub_ia64_set_immu64 (addr, value - (grub_addr_t) mod->base);
> - break;
> - case R_IA64_GPREL22:
> - if ((value - (grub_addr_t) mod->base) & ~MASK20)
> - return grub_error (GRUB_ERR_BAD_MODULE,
> - "gprel offset too big (%lx)",
> - value - (grub_addr_t) mod->base);
> - grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t)
> mod->base);
> - break;
> -
> - case R_IA64_LTOFF22X:
> - case R_IA64_LTOFF22:
> - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
> - value = *(grub_uint64_t *) sym->st_value + rel->r_addend;
> - /* Fallthrough. */
> - case R_IA64_LTOFF_FPTR22:
> - {
> - grub_uint64_t *gpptr = mod->gotptr;
> - *gpptr = value;
> - if (((grub_addr_t) gpptr - (grub_addr_t) mod->base) & ~MASK20)
> - return grub_error (GRUB_ERR_BAD_MODULE,
> - "gprel offset too big (%lx)",
> - (grub_addr_t) gpptr - (grub_addr_t)
> mod->base);
> - grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr -
> (grub_addr_t) mod->base);
> - mod->gotptr = gpptr + 1;
> - break;
> - }
> - /* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
> - case R_IA64_LDXMOV:
> - break;
> - default:
> - {
> - char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
> -
> - grub_snprintf (rel_info, sizeof (rel_info) - 1, "%"
> PRIxGRUB_UINT64_T,
> - ELF_R_TYPE (rel->r_info));
> - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> - N_("relocation 0x%s is not implemented
> yet"), rel_info);
> - }
> - }
> - }
> - return GRUB_ERR_NONE;
> -}
> diff --git a/grub-core/kern/ia64/dl_helper.c
> b/grub-core/kern/ia64/dl_helper.c
> deleted file mode 100644
> index 05a0a68db7a1263c..0000000000000000
> --- a/grub-core/kern/ia64/dl_helper.c
> +++ /dev/null
> @@ -1,241 +0,0 @@
> -/* dl.c - arch-dependent part of loadable module support */
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include <grub/dl.h>
> -#include <grub/elf.h>
> -#include <grub/misc.h>
> -#include <grub/err.h>
> -#include <grub/mm.h>
> -#include <grub/i18n.h>
> -#include <grub/ia64/reloc.h>
> -
> -#pragma GCC diagnostic ignored "-Wcast-align"
> -
> -#define MASK20 ((1 << 20) - 1)
> -#define MASK3 (~(grub_addr_t) 3)
> -
> -void
> -grub_ia64_set_immu64 (grub_addr_t addr, grub_uint64_t val)
> -{
> - /* Copied from binutils. */
> - grub_uint64_t *ptr = ((grub_uint64_t *) (addr & MASK3));
> - grub_uint64_t t0, t1;
> -
> - t0 = grub_le_to_cpu64 (ptr[0]);
> - t1 = grub_le_to_cpu64 (ptr[1]);
> -
> - /* tmpl/s: bits 0.. 5 in t0
> - slot 0: bits 5..45 in t0
> - slot 1: bits 46..63 in t0, bits 0..22 in t1
> - slot 2: bits 23..63 in t1 */
> -
> - /* First, clear the bits that form the 64 bit constant. */
> - t0 &= ~(0x3ffffLL << 46);
> - t1 &= ~(0x7fffffLL
> - | (( (0x07fLL << 13) | (0x1ffLL << 27)
> - | (0x01fLL << 22) | (0x001LL << 21)
> - | (0x001LL << 36)) << 23));
> -
> - t0 |= ((val >> 22) & 0x03ffffLL) << 46; /* 18 lsbs of
> imm41 */
> - t1 |= ((val >> 40) & 0x7fffffLL) << 0; /* 23 msbs of
> imm41 */
> - t1 |= ( (((val >> 0) & 0x07f) << 13) /* imm7b */
> - | (((val >> 7) & 0x1ff) << 27) /* imm9d */
> - | (((val >> 16) & 0x01f) << 22) /* imm5c */
> - | (((val >> 21) & 0x001) << 21) /* ic */
> - | (((val >> 63) & 0x001) << 36)) << 23; /* i */
> -
> - ptr[0] = t0;
> - ptr[1] = t1;
> -}
> -
> -void
> -grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value)
> -{
> - grub_uint32_t val;
> - switch (addr & 3)
> - {
> - case 0:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) + 2)));
> - val = (((((val & MASK20) + value) & MASK20) << 2)
> - | (val & ~(MASK20 << 2)));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2),
> - grub_cpu_to_le32 (val));
> - break;
> - case 1:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) + 7)));
> - val = ((((((val >> 3) & MASK20) + value) & MASK20) << 3)
> - | (val & ~(MASK20 << 3)));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7),
> - grub_cpu_to_le32 (val));
> - break;
> - case 2:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) +
> 12)));
> - val = ((((((val >> 4) & MASK20) + value) & MASK20) << 4)
> - | (val & ~(MASK20 << 4)));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12),
> - grub_cpu_to_le32 (val));
> - break;
> - }
> -}
> -
> -#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) )
> -
> -static grub_uint32_t
> -add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value)
> -{
> - grub_uint32_t high, mid, low, c;
> - low = (a & 0x00007f);
> - mid = (a & 0x7fc000) >> 7;
> - high = (a & 0x003e00) << 7;
> - c = (low | mid | high) + value;
> - return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00);
> //0x003e00
> -}
> -
> -void
> -grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value)
> -{
> - grub_uint32_t val;
> - switch (addr & 3)
> - {
> - case 0:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) + 2)));
> - val = ((add_value_to_slot_21_real (((val >> 2) & MASKF21), value)
> - & MASKF21) << 2) | (val & ~(MASKF21 << 2));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2),
> - grub_cpu_to_le32 (val));
> - break;
> - case 1:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) + 7)));
> - val = ((add_value_to_slot_21_real (((val >> 3) & MASKF21), value)
> - & MASKF21) << 3) | (val & ~(MASKF21 << 3));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7),
> - grub_cpu_to_le32 (val));
> - break;
> - case 2:
> - val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *)
> - (addr & MASK3) +
> 12)));
> - val = ((add_value_to_slot_21_real (((val >> 4) & MASKF21), value)
> - & MASKF21) << 4) | (val & ~(MASKF21 << 4));
> - grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12),
> - grub_cpu_to_le32 (val));
> - break;
> - }
> -}
> -
> -static const grub_uint8_t nopm[5] =
> - {
> - /* [MLX] nop.m 0x0 */
> - 0x05, 0x00, 0x00, 0x00, 0x01
> - };
> -
> -#ifdef GRUB_UTIL
> -static grub_uint8_t jump[0x20] =
> - {
> - /* [MMI] add r15=r15,r1;; */
> - 0x0b, 0x78, 0x3c, 0x02, 0x00, 0x20,
> - /* ld8 r16=[r15],8 */
> - 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0,
> - /* mov r14=r1;; */
> - 0x01, 0x08, 0x00, 0x84,
> - /* [MIB] ld8 r1=[r15] */
> - 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,
> - /* mov b6=r16 */
> - 0x60, 0x80, 0x04, 0x80, 0x03, 0x00,
> - /* br.few b6;; */
> - 0x60, 0x00, 0x80, 0x00
> - };
> -#else
> -static const grub_uint8_t jump[0x20] =
> - {
> - /* ld8 r16=[r15],8 */
> - 0x02, 0x80, 0x20, 0x1e, 0x18, 0x14,
> - /* mov r14=r1;; */
> - 0xe0, 0x00, 0x04, 0x00, 0x42, 0x00,
> - /* nop.i 0x0 */
> - 0x00, 0x00, 0x04, 0x00,
> - /* ld8 r1=[r15] */
> - 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,
> - /* mov b6=r16 */
> - 0x60, 0x80, 0x04, 0x80, 0x03, 0x00,
> - /* br.few b6;; */
> - 0x60, 0x00, 0x80, 0x00
> - };
> -#endif
> -
> -void
> -grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t
> addr)
> -{
> - grub_memcpy (tr->nop, nopm, sizeof (tr->nop));
> - tr->addr_hi[0] = ((addr & 0xc00000) >> 16);
> - tr->addr_hi[1] = (addr >> 24) & 0xff;
> - tr->addr_hi[2] = (addr >> 32) & 0xff;
> - tr->addr_hi[3] = (addr >> 40) & 0xff;
> - tr->addr_hi[4] = (addr >> 48) & 0xff;
> - tr->addr_hi[5] = (addr >> 56) & 0xff;
> - tr->e0 = 0xe0;
> - tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01;
> - tr->addr_lo[1] = (((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11)
> - | ((addr & 0x200000) >> 17));
> - tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19);
> - tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60;
> - grub_memcpy (tr->jump, jump, sizeof (tr->jump));
> -}
> -
> -grub_err_t
> -grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
> - grub_size_t *got)
> -{
> - const Elf64_Ehdr *e = ehdr;
> - grub_size_t cntt = 0, cntg = 0;
> - const Elf64_Shdr *s;
> - unsigned i;
> -
> - for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu64
> (e->e_shoff));
> - i < grub_le_to_cpu16 (e->e_shnum);
> - i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16
> (e->e_shentsize)))
> - if (s->sh_type == grub_cpu_to_le32_compile_time (SHT_RELA))
> - {
> - const Elf64_Rela *rel, *max;
> -
> - for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu64
> (s->sh_offset)),
> - max = (const Elf64_Rela *) ((char *) rel + grub_le_to_cpu64
> (s->sh_size));
> - rel < max; rel = (const Elf64_Rela *) ((char *) rel +
> grub_le_to_cpu64 (s->sh_entsize)))
> - switch (ELF64_R_TYPE (grub_le_to_cpu64 (rel->r_info)))
> - {
> - case R_IA64_PCREL21B:
> - cntt++;
> - break;
> - case R_IA64_LTOFF_FPTR22:
> - case R_IA64_LTOFF22X:
> - case R_IA64_LTOFF22:
> - cntg++;
> - break;
> - }
> - }
> - *tramp = cntt * sizeof (struct grub_ia64_trampoline);
> - *got = cntg * sizeof (grub_uint64_t);
> -
> - return GRUB_ERR_NONE;
> -}
> -
> diff --git a/grub-core/kern/ia64/efi/init.c
> b/grub-core/kern/ia64/efi/init.c
> deleted file mode 100644
> index f1965571b1dc0dce..0000000000000000
> --- a/grub-core/kern/ia64/efi/init.c
> +++ /dev/null
> @@ -1,80 +0,0 @@
> -/* init.c - initialize an ia64-based EFI system */
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2008 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include <grub/types.h>
> -#include <grub/misc.h>
> -#include <grub/mm.h>
> -#include <grub/time.h>
> -#include <grub/err.h>
> -#include <grub/dl.h>
> -#include <grub/kernel.h>
> -#include <grub/efi/efi.h>
> -#include <grub/loader.h>
> -
> -static grub_uint64_t divisor = 1;
> -
> -static grub_uint64_t
> -get_itc (void)
> -{
> - grub_uint64_t ret;
> - asm volatile ("mov %0=ar.itc" : "=r" (ret));
> - return ret;
> -}
> -
> -grub_uint64_t
> -grub_rtc_get_time_ms (void)
> -{
> - return get_itc () / divisor;
> -}
> -
> -void
> -grub_machine_init (void)
> -{
> - grub_efi_event_t event;
> - grub_uint64_t before, after;
> - grub_efi_uintn_t idx;
> - grub_efi_init ();
> -
> - efi_call_5 (grub_efi_system_table->boot_services->create_event,
> - GRUB_EFI_EVT_TIMER, GRUB_EFI_TPL_CALLBACK, 0, 0, &event);
> -
> - before = get_itc ();
> - efi_call_3 (grub_efi_system_table->boot_services->set_timer, event,
> - GRUB_EFI_TIMER_RELATIVE, 200000);
> - efi_call_3 (grub_efi_system_table->boot_services->wait_for_event, 1,
> - &event, &idx);
> - after = get_itc ();
> - efi_call_1 (grub_efi_system_table->boot_services->close_event, event);
> - divisor = (after - before + 5) / 20;
> - if (divisor == 0)
> - divisor = 800000;
> - grub_install_get_time_ms (grub_rtc_get_time_ms);
> -}
> -
> -void
> -grub_machine_fini (int flags)
> -{
> - if (!(flags & GRUB_LOADER_FLAG_NORETURN))
> - return;
> -
> - grub_efi_fini ();
> -
> - if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
> - grub_efi_memory_fini ();
> -}
> diff --git a/grub-core/kern/ia64/efi/startup.S
> b/grub-core/kern/ia64/efi/startup.S
> deleted file mode 100644
> index d75c6d7cc741d5eb..0000000000000000
> --- a/grub-core/kern/ia64/efi/startup.S
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2008 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -#include <config.h>
> -#include <grub/symbol.h>
> -#include <grub/offsets.h>
> -
> - .text
> - .psr abi64
> - .psr lsb
> - .lsb
> -
> - .global _start
> - .proc _start
> -_start:
> - alloc loc0=ar.pfs,2,4,0,0
> - mov loc1=rp
> - addl loc2=@gprel(grub_efi_image_handle),gp
> - addl loc3=@gprel(grub_efi_system_table),gp
> - ;;
> - st8 [loc2]=in0
> - st8 [loc3]=in1
> - br.call.sptk.few rp=grub_main
> - ;;
> - mov ar.pfs=loc0
> - mov rp=loc1
> - ;;
> - br.ret.sptk.few rp
> -
> - .endp _start
> diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
> index dfae4f9d7897a71d..dad79abf0c6fdebb 100644
> --- a/grub-core/kern/misc.c
> +++ b/grub-core/kern/misc.c
> @@ -620,7 +620,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d,
> grub_uint64_t *r)
> grub_uint64_t q = 0;
> grub_uint64_t m = 0;
>
> - /* ARM and IA64 don't have a fast 32-bit division.
> + /* ARM doesn't have a fast 32-bit division.
> Using that code would just make us use software division routines,
> calling
> ourselves indirectly and hence getting infinite recursion.
> */
> diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c
> index 29d41364168eaeba..0b42be6740f246b7 100644
> --- a/grub-core/lib/efi/halt.c
> +++ b/grub-core/lib/efi/halt.c
> @@ -30,7 +30,7 @@ grub_halt (void)
> {
> grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
> GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
> -#if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \
> +#if !defined(__arm__) && !defined(__aarch64__) && \
> !defined(__riscv)
> grub_acpi_halt ();
> #endif
> diff --git a/grub-core/lib/ia64/longjmp.S b/grub-core/lib/ia64/longjmp.S
> deleted file mode 100644
> index 38afb2243c6b9f87..0000000000000000
> --- a/grub-core/lib/ia64/longjmp.S
> +++ /dev/null
> @@ -1,162 +0,0 @@
> -/* Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation,
> Inc.
> - Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library 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
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, write to the Free
> - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> - 02111-1307 USA.
> -
> - Note that __sigsetjmp() did NOT flush the register stack. Instead,
> - we do it here since __longjmp() is usually much less frequently
> - invoked than __sigsetjmp(). The only difficulty is that __sigsetjmp()
> - didn't (and wouldn't be able to) save ar.rnat either. This is a
> problem
> - because if we're not careful, we could end up loading random NaT bits.
> - There are two cases:
> -
> - (i) ar.bsp < ia64_rse_rnat_addr(jmpbuf.ar_bsp)
> - ar.rnat contains the desired bits---preserve ar.rnat
> - across loadrs and write to ar.bspstore
> -
> - (ii) ar.bsp >= ia64_rse_rnat_addr(jmpbuf.ar_bsp)
> - The desired ar.rnat is stored in
> - ia64_rse_rnat_addr(jmpbuf.ar_bsp). Load those
> - bits into ar.rnat after setting ar.bspstore. */
> -
> -
> -
> -# define pPos p6 /* is rotate count positive? */
> -# define pNeg p7 /* is rotate count negative? */
> -
> -
> - /* __longjmp(__jmp_buf buf, int val) */
> -
> - .text
> -
> - .proc EXT_C(grub_longjmp)
> -FUNCTION(grub_longjmp)
> - alloc r8=ar.pfs,2,1,0,0
> - mov r27=ar.rsc
> - add r2=0x98,in0 // r2 <- &jmpbuf.orig_jmp_buf_addr
> - ;;
> - ld8 r8=[r2],-16 // r8 <- orig_jmp_buf_addr
> - mov r10=ar.bsp
> - and r11=~0x3,r27 // clear ar.rsc.mode
> - ;;
> - flushrs // flush dirty regs to backing store (must
> be first in insn grp)
> - ld8 r23=[r2],8 // r23 <- jmpbuf.ar_bsp
> - sub r8=r8,in0 // r8 <- &orig_jmpbuf - &jmpbuf
> - ;;
> - ld8 r25=[r2] // r25 <- jmpbuf.ar_unat
> - extr.u r8=r8,3,6 // r8 <- (&orig_jmpbuf - &jmpbuf)/8 & 0x3f
> - ;;
> - cmp.lt pNeg,pPos=r8,r0
> - mov r2=in0
> - ;;
> -(pPos) mov r16=r8
> -(pNeg) add r16=64,r8
> -(pPos) sub r17=64,r8
> -(pNeg) sub r17=r0,r8
> - ;;
> - mov ar.rsc=r11 // put RSE in enforced lazy mode
> - shr.u r8=r25,r16
> - add r3=8,in0 // r3 <- &jmpbuf.r1
> - shl r9=r25,r17
> - ;;
> - or r25=r8,r9
> - ;;
> - mov r26=ar.rnat
> - mov ar.unat=r25 // setup ar.unat (NaT bits for r1, r4-r7,
> and r12)
> - ;;
> - ld8.fill.nta sp=[r2],16 // r12 (sp)
> - ld8.fill.nta gp=[r3],16 // r1 (gp)
> - dep r11=-1,r23,3,6 // r11 <- ia64_rse_rnat_addr(jmpbuf.ar_bsp)
> - ;;
> - ld8.nta r16=[r2],16 // caller's unat
> - ld8.nta r17=[r3],16 // fpsr
> - ;;
> - ld8.fill.nta r4=[r2],16 // r4
> - ld8.fill.nta r5=[r3],16 // r5 (gp)
> - cmp.geu p8,p0=r10,r11 // p8 <- (ar.bsp >= jmpbuf.ar_bsp)
> - ;;
> - ld8.fill.nta r6=[r2],16 // r6
> - ld8.fill.nta r7=[r3],16 // r7
> - ;;
> - mov ar.unat=r16 // restore caller's unat
> - mov ar.fpsr=r17 // restore fpsr
> - ;;
> - ld8.nta r16=[r2],16 // b0
> - ld8.nta r17=[r3],16 // b1
> - ;;
> -(p8) ld8 r26=[r11] // r26 <-
> *ia64_rse_rnat_addr(jmpbuf.ar_bsp)
> - mov ar.bspstore=r23 // restore ar.bspstore
> - ;;
> - ld8.nta r18=[r2],16 // b2
> - ld8.nta r19=[r3],16 // b3
> - ;;
> - ld8.nta r20=[r2],16 // b4
> - ld8.nta r21=[r3],16 // b5
> - ;;
> - ld8.nta r11=[r2],16 // ar.pfs
> - ld8.nta r22=[r3],56 // ar.lc
> - ;;
> - ld8.nta r24=[r2],32 // pr
> - mov b0=r16
> - ;;
> - ldf.fill.nta f2=[r2],32
> - ldf.fill.nta f3=[r3],32
> - mov b1=r17
> - ;;
> - ldf.fill.nta f4=[r2],32
> - ldf.fill.nta f5=[r3],32
> - mov b2=r18
> - ;;
> - ldf.fill.nta f16=[r2],32
> - ldf.fill.nta f17=[r3],32
> - mov b3=r19
> - ;;
> - ldf.fill.nta f18=[r2],32
> - ldf.fill.nta f19=[r3],32
> - mov b4=r20
> - ;;
> - ldf.fill.nta f20=[r2],32
> - ldf.fill.nta f21=[r3],32
> - mov b5=r21
> - ;;
> - ldf.fill.nta f22=[r2],32
> - ldf.fill.nta f23=[r3],32
> - mov ar.lc=r22
> - ;;
> - ldf.fill.nta f24=[r2],32
> - ldf.fill.nta f25=[r3],32
> - cmp.eq p8,p9=0,in1
> - ;;
> - ldf.fill.nta f26=[r2],32
> - ldf.fill.nta f27=[r3],32
> - mov ar.pfs=r11
> - ;;
> - ldf.fill.nta f28=[r2],32
> - ldf.fill.nta f29=[r3],32
> - ;;
> - ldf.fill.nta f30=[r2]
> - ldf.fill.nta f31=[r3]
> -(p8) mov r8=1
> -
> - mov ar.rnat=r26 // restore ar.rnat
> - ;;
> - mov ar.rsc=r27 // restore ar.rsc
> -(p9) mov r8=in1
> -
> - invala // virt. -> phys. regnum mapping may change
> - mov pr=r24,-1
> - br.ret.dptk.few rp
> - .endp EXT_C(grub_longjmp)
> diff --git a/grub-core/lib/ia64/setjmp.S b/grub-core/lib/ia64/setjmp.S
> deleted file mode 100644
> index a0382d83d602d9b4..0000000000000000
> --- a/grub-core/lib/ia64/setjmp.S
> +++ /dev/null
> @@ -1,177 +0,0 @@
> -/* Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation,
> Inc.
> - Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library 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
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, write to the Free
> - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> - 02111-1307 USA.
> -
> - The layout of the jmp_buf is as follows. This is subject to change
> - and user-code should never depend on the particular layout of
> - jmp_buf!
> -
> -
> - offset: description:
> - ------- ------------
> - 0x000 stack pointer (r12) ; unchangeable (see
> _JMPBUF_UNWINDS)
> - 0x008 r1 (gp)
> - 0x010 caller's unat
> - 0x018 fpsr
> - 0x020 r4
> - 0x028 r5
> - 0x030 r6
> - 0x038 r7
> - 0x040 rp (b0)
> - 0x048 b1
> - 0x050 b2
> - 0x058 b3
> - 0x060 b4
> - 0x068 b5
> - 0x070 ar.pfs
> - 0x078 ar.lc
> - 0x080 pr
> - 0x088 ar.bsp ; unchangeable (see __longjmp.S)
> - 0x090 ar.unat
> - 0x098 &__jmp_buf ; address of the jmpbuf (needed to locate
> NaT bits in unat)
> - 0x0a0 f2
> - 0x0b0 f3
> - 0x0c0 f4
> - 0x0d0 f5
> - 0x0e0 f16
> - 0x0f0 f17
> - 0x100 f18
> - 0x110 f19
> - 0x120 f20
> - 0x130 f21
> - 0x130 f22
> - 0x140 f23
> - 0x150 f24
> - 0x160 f25
> - 0x170 f26
> - 0x180 f27
> - 0x190 f28
> - 0x1a0 f29
> - 0x1b0 f30
> - 0x1c0 f31 */
> -
> -#include <grub/symbol.h>
> -#include <grub/dl.h>
> -
> - .file "setjmp.S"
> -
> -GRUB_MOD_LICENSE "GPLv2+"
> -
> - /* The following two entry points are the traditional entry
> points: */
> -
> - .text
> -
> - .proc EXT_C(grub_setjmp)
> -FUNCTION(grub_setjmp)
> - alloc r8=ar.pfs,2,0,0,0
> - mov in1=1
> - br.cond.sptk.many __sigsetjmp
> - .endp EXT_C(grub_setjmp)
> -
> - /* __sigsetjmp(__jmp_buf buf, int savemask) */
> -
> - .proc __sigsetjmp
> -__sigsetjmp:
> - //.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS,
> ASM_UNW_PRLG_GRSAVE(2)
> - alloc loc1=ar.pfs,2,2,2,0
> - mov r16=ar.unat
> - ;;
> - mov r17=ar.fpsr
> - mov r2=in0
> - add r3=8,in0
> - ;;
> - st8.spill.nta [r2]=sp,16 // r12 (sp)
> - st8.spill.nta [r3]=gp,16 // r1 (gp)
> - ;;
> - st8.nta [r2]=r16,16 // save caller's unat
> - st8.nta [r3]=r17,16 // save fpsr
> - add r8=0xa0,in0
> - ;;
> - st8.spill.nta [r2]=r4,16 // r4
> - st8.spill.nta [r3]=r5,16 // r5
> - add r9=0xb0,in0
> - ;;
> - stf.spill.nta [r8]=f2,32
> - stf.spill.nta [r9]=f3,32
> - mov loc0=rp
> - .body
> - ;;
> - stf.spill.nta [r8]=f4,32
> - stf.spill.nta [r9]=f5,32
> - mov r17=b1
> - ;;
> - stf.spill.nta [r8]=f16,32
> - stf.spill.nta [r9]=f17,32
> - mov r18=b2
> - ;;
> - stf.spill.nta [r8]=f18,32
> - stf.spill.nta [r9]=f19,32
> - mov r19=b3
> - ;;
> - stf.spill.nta [r8]=f20,32
> - stf.spill.nta [r9]=f21,32
> - mov r20=b4
> - ;;
> - stf.spill.nta [r8]=f22,32
> - stf.spill.nta [r9]=f23,32
> - mov r21=b5
> - ;;
> - stf.spill.nta [r8]=f24,32
> - stf.spill.nta [r9]=f25,32
> - mov r22=ar.lc
> - ;;
> - stf.spill.nta [r8]=f26,32
> - stf.spill.nta [r9]=f27,32
> - mov r24=pr
> - ;;
> - stf.spill.nta [r8]=f28,32
> - stf.spill.nta [r9]=f29,32
> - ;;
> - stf.spill.nta [r8]=f30
> - stf.spill.nta [r9]=f31
> -
> - st8.spill.nta [r2]=r6,16 // r6
> - st8.spill.nta [r3]=r7,16 // r7
> - ;;
> - mov r23=ar.bsp
> - mov r25=ar.unat
> - mov out0=in0
> -
> - st8.nta [r2]=loc0,16 // b0
> - st8.nta [r3]=r17,16 // b1
> - mov out1=in1
> - ;;
> - st8.nta [r2]=r18,16 // b2
> - st8.nta [r3]=r19,16 // b3
> - ;;
> - st8.nta [r2]=r20,16 // b4
> - st8.nta [r3]=r21,16 // b5
> - ;;
> - st8.nta [r2]=loc1,16 // ar.pfs
> - st8.nta [r3]=r22,16 // ar.lc
> - ;;
> - st8.nta [r2]=r24,16 // pr
> - st8.nta [r3]=r23,16 // ar.bsp
> - ;;
> - st8.nta [r2]=r25 // ar.unat
> - st8.nta [r3]=in0 // &__jmp_buf
> - mov r8=0
> - mov rp=loc0
> - mov ar.pfs=loc1
> - br.ret.sptk.many rp
> -
> - .endp __sigsetjmp
> diff --git a/grub-core/lib/setjmp.S b/grub-core/lib/setjmp.S
> index 9c8721088a3ff8f1..1bf29c3cce773658 100644
> --- a/grub-core/lib/setjmp.S
> +++ b/grub-core/lib/setjmp.S
> @@ -12,9 +12,6 @@
> #include "./mips/setjmp.S"
> #elif defined(__powerpc__) || defined(__PPC__)
> #include "./powerpc/setjmp.S"
> -#elif defined(__ia64__)
> -#include "./ia64/setjmp.S"
> -#include "./ia64/longjmp.S"
> #elif defined(__arm__)
> #include "./arm/setjmp.S"
> #elif defined(__aarch64__)
> diff --git a/grub-core/loader/ia64/efi/linux.c
> b/grub-core/loader/ia64/efi/linux.c
> deleted file mode 100644
> index fb9b961f71a20208..0000000000000000
> --- a/grub-core/loader/ia64/efi/linux.c
> +++ /dev/null
> @@ -1,607 +0,0 @@
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2008,2010 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include <grub/loader.h>
> -#include <grub/file.h>
> -#include <grub/disk.h>
> -#include <grub/err.h>
> -#include <grub/misc.h>
> -#include <grub/types.h>
> -#include <grub/command.h>
> -#include <grub/dl.h>
> -#include <grub/mm.h>
> -#include <grub/cache.h>
> -#include <grub/kernel.h>
> -#include <grub/efi/api.h>
> -#include <grub/efi/efi.h>
> -#include <grub/elf.h>
> -#include <grub/i18n.h>
> -#include <grub/env.h>
> -#include <grub/linux.h>
> -#include <grub/verify.h>
> -
> -GRUB_MOD_LICENSE ("GPLv3+");
> -
> -#pragma GCC diagnostic ignored "-Wcast-align"
> -
> -#define ALIGN_MIN (256*1024*1024)
> -
> -#define GRUB_ELF_SEARCH 1024
> -
> -#define BOOT_PARAM_SIZE 16384
> -
> -struct ia64_boot_param
> -{
> - grub_uint64_t command_line; /* physical address of command line. */
> - grub_uint64_t efi_systab; /* physical address of EFI system table */
> - grub_uint64_t efi_memmap; /* physical address of EFI memory map */
> - grub_uint64_t efi_memmap_size; /* size of EFI memory map */
> - grub_uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor
> */
> - grub_uint32_t efi_memdesc_version; /* memory descriptor version */
> - struct
> - {
> - grub_uint16_t num_cols; /* number of columns on console output dev
> */
> - grub_uint16_t num_rows; /* number of rows on console output device
> */
> - grub_uint16_t orig_x; /* cursor's x position */
> - grub_uint16_t orig_y; /* cursor's y position */
> - } console_info;
> - grub_uint64_t fpswa; /* physical address of the fpswa interface
> */
> - grub_uint64_t initrd_start;
> - grub_uint64_t initrd_size;
> -};
> -
> -typedef struct
> -{
> - grub_uint32_t revision;
> - grub_uint32_t reserved;
> - void *fpswa;
> -} fpswa_interface_t;
> -static fpswa_interface_t *fpswa;
> -
> -#define NEXT_MEMORY_DESCRIPTOR(desc, size) \
> - ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
> -
> -static grub_dl_t my_mod;
> -
> -static int loaded;
> -
> -/* Kernel base and size. */
> -static void *kernel_mem;
> -static grub_efi_uintn_t kernel_pages;
> -static grub_uint64_t entry;
> -
> -/* Initrd base and size. */
> -static void *initrd_mem;
> -static grub_efi_uintn_t initrd_pages;
> -static grub_efi_uintn_t initrd_size;
> -
> -static struct ia64_boot_param *boot_param;
> -static grub_efi_uintn_t boot_param_pages;
> -
> -static inline grub_size_t
> -page_align (grub_size_t size)
> -{
> - return (size + (1 << 12) - 1) & (~((1 << 12) - 1));
> -}
> -
> -static void
> -query_fpswa (void)
> -{
> - grub_efi_handle_t fpswa_image;
> - grub_efi_boot_services_t *bs;
> - grub_efi_status_t status;
> - grub_efi_uintn_t size;
> - static const grub_efi_guid_t fpswa_protocol =
> - { 0xc41b6531, 0x97b9, 0x11d3,
> - {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} };
> -
> - if (fpswa != NULL)
> - return;
> -
> - size = sizeof(grub_efi_handle_t);
> -
> - bs = grub_efi_system_table->boot_services;
> - status = bs->locate_handle (GRUB_EFI_BY_PROTOCOL,
> - (void *) &fpswa_protocol,
> - NULL, &size, &fpswa_image);
> - if (status != GRUB_EFI_SUCCESS)
> - {
> - grub_printf ("%s\n", _("Could not locate FPSWA driver"));
> - return;
> - }
> - status = bs->handle_protocol (fpswa_image,
> - (void *) &fpswa_protocol, (void *) &fpswa);
> - if (status != GRUB_EFI_SUCCESS)
> - {
> - grub_printf ("%s\n",
> - _("FPSWA protocol wasn't able to find the interface"));
> - return;
> - }
> -}
> -
> -static void
> -free_pages (void)
> -{
> - if (kernel_mem)
> - {
> - grub_efi_free_pages ((grub_addr_t) kernel_mem, kernel_pages);
> - kernel_mem = 0;
> - }
> -
> - if (initrd_mem)
> - {
> - grub_efi_free_pages ((grub_addr_t) initrd_mem, initrd_pages);
> - initrd_mem = 0;
> - }
> -
> - if (boot_param)
> - {
> - /* Free bootparam. */
> - grub_efi_free_pages ((grub_efi_physical_address_t) boot_param,
> - boot_param_pages);
> - boot_param = 0;
> - }
> -}
> -
> -static void *
> -allocate_pages (grub_uint64_t align, grub_uint64_t size_pages,
> - grub_uint64_t nobase)
> -{
> - grub_uint64_t size;
> - grub_efi_uintn_t desc_size;
> - grub_efi_memory_descriptor_t *mmap, *mmap_end;
> - grub_efi_uintn_t mmap_size, tmp_mmap_size;
> - grub_efi_memory_descriptor_t *desc;
> - void *mem = NULL;
> -
> - size = size_pages << 12;
> -
> - mmap_size = grub_efi_find_mmap_size ();
> - if (!mmap_size)
> - return 0;
> -
> - /* Read the memory map temporarily, to find free space. */
> - mmap = grub_malloc (mmap_size);
> - if (! mmap)
> - return 0;
> -
> - tmp_mmap_size = mmap_size;
> - if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <=
> 0)
> - {
> - grub_error (GRUB_ERR_IO, "cannot get memory map");
> - goto fail;
> - }
> -
> - mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size);
> -
> - /* First, find free pages for the real mode code
> - and the memory map buffer. */
> - for (desc = mmap;
> - desc < mmap_end;
> - desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
> - {
> - grub_uint64_t start, end;
> - grub_uint64_t aligned_start;
> -
> - if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
> - continue;
> -
> - start = desc->physical_start;
> - end = start + (desc->num_pages << 12);
> - /* Align is a power of 2. */
> - aligned_start = (start + align - 1) & ~(align - 1);
> - if (aligned_start + size > end)
> - continue;
> - if (aligned_start == nobase)
> - aligned_start += align;
> - if (aligned_start + size > end)
> - continue;
> - mem = grub_efi_allocate_fixed (aligned_start, size_pages);
> - if (! mem)
> - {
> - grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory");
> - goto fail;
> - }
> - break;
> - }
> -
> - if (! mem)
> - {
> - grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory");
> - goto fail;
> - }
> -
> - grub_free (mmap);
> - return mem;
> -
> - fail:
> - grub_free (mmap);
> - free_pages ();
> - return 0;
> -}
> -
> -static void
> -set_boot_param_console (void)
> -{
> - grub_efi_simple_text_output_interface_t *conout;
> - grub_efi_uintn_t cols, rows;
> -
> - conout = grub_efi_system_table->con_out;
> - if (conout->query_mode (conout, conout->mode->mode, &cols, &rows)
> - != GRUB_EFI_SUCCESS)
> - return;
> -
> - grub_dprintf ("linux",
> - "Console info: cols=%lu rows=%lu x=%u y=%u\n",
> - cols, rows,
> - conout->mode->cursor_column, conout->mode->cursor_row);
> -
> - boot_param->console_info.num_cols = cols;
> - boot_param->console_info.num_rows = rows;
> - boot_param->console_info.orig_x = conout->mode->cursor_column;
> - boot_param->console_info.orig_y = conout->mode->cursor_row;
> -}
> -
> -static grub_err_t
> -grub_linux_boot (void)
> -{
> - grub_efi_uintn_t mmap_size;
> - grub_efi_uintn_t map_key;
> - grub_efi_uintn_t desc_size;
> - grub_efi_uint32_t desc_version;
> - grub_efi_memory_descriptor_t *mmap_buf;
> - grub_err_t err;
> -
> - /* FPSWA. */
> - query_fpswa ();
> - boot_param->fpswa = (grub_uint64_t)fpswa;
> -
> - /* Initrd. */
> - boot_param->initrd_start = (grub_uint64_t)initrd_mem;
> - boot_param->initrd_size = (grub_uint64_t)initrd_size;
> -
> - set_boot_param_console ();
> -
> - grub_dprintf ("linux", "Jump to %016lx\n", entry);
> -
> - /* MDT.
> - Must be done after grub_machine_fini because map_key is used by
> - exit_boot_services. */
> - mmap_size = grub_efi_find_mmap_size ();
> - if (! mmap_size)
> - return grub_errno;
> - mmap_buf = grub_efi_allocate_any_pages (page_align (mmap_size) >> 12);
> - if (! mmap_buf)
> - return grub_error (GRUB_ERR_IO, "cannot allocate memory map");
> - err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key,
> - &desc_size, &desc_version);
> - if (err)
> - return err;
> -
> - boot_param->efi_memmap = (grub_uint64_t)mmap_buf;
> - boot_param->efi_memmap_size = mmap_size;
> - boot_param->efi_memdesc_size = desc_size;
> - boot_param->efi_memdesc_version = desc_version;
> -
> - /* See you next boot. */
> - asm volatile ("mov r28=%1; br.sptk.few %0" ::
> "b"(entry),"r"(boot_param));
> -
> - /* Never reach here. */
> - return GRUB_ERR_NONE;
> -}
> -
> -static grub_err_t
> -grub_linux_unload (void)
> -{
> - free_pages ();
> - grub_dl_unref (my_mod);
> - loaded = 0;
> - return GRUB_ERR_NONE;
> -}
> -
> -static grub_err_t
> -grub_load_elf64 (grub_file_t file, void *buffer, const char *filename)
> -{
> - Elf64_Ehdr *ehdr = (Elf64_Ehdr *) buffer;
> - Elf64_Phdr *phdr;
> - int i;
> - grub_uint64_t low_addr;
> - grub_uint64_t high_addr;
> - grub_uint64_t align;
> - grub_uint64_t reloc_offset;
> - const char *relocate;
> -
> - if (ehdr->e_ident[EI_MAG0] != ELFMAG0
> - || ehdr->e_ident[EI_MAG1] != ELFMAG1
> - || ehdr->e_ident[EI_MAG2] != ELFMAG2
> - || ehdr->e_ident[EI_MAG3] != ELFMAG3
> - || ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
> - return grub_error(GRUB_ERR_UNKNOWN_OS,
> - N_("invalid arch-independent ELF magic"));
> -
> - if (ehdr->e_ident[EI_CLASS] != ELFCLASS64
> - || ehdr->e_version != EV_CURRENT
> - || ehdr->e_machine != EM_IA_64)
> - return grub_error (GRUB_ERR_UNKNOWN_OS,
> - N_("invalid arch-dependent ELF magic"));
> -
> - if (ehdr->e_type != ET_EXEC)
> - return grub_error (GRUB_ERR_UNKNOWN_OS,
> - N_("this ELF file is not of the right type"));
> -
> - /* FIXME: Should we support program headers at strange locations? */
> - if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > GRUB_ELF_SEARCH)
> - return grub_error (GRUB_ERR_BAD_OS, "program header at a too high
> offset");
> -
> - entry = ehdr->e_entry;
> -
> - /* Compute low, high and align addresses. */
> - low_addr = ~0UL;
> - high_addr = 0;
> - align = 0;
> - for (i = 0; i < ehdr->e_phnum; i++)
> - {
> - phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff
> - + i * ehdr->e_phentsize);
> - if (phdr->p_type == PT_LOAD)
> - {
> - if (phdr->p_paddr < low_addr)
> - low_addr = phdr->p_paddr;
> - if (phdr->p_paddr + phdr->p_memsz > high_addr)
> - high_addr = phdr->p_paddr + phdr->p_memsz;
> - if (phdr->p_align > align)
> - align = phdr->p_align;
> - }
> - }
> -
> - if (align < ALIGN_MIN)
> - align = ALIGN_MIN;
> -
> - if (high_addr == 0)
> - return grub_error (GRUB_ERR_BAD_OS, "no program entries");
> -
> - kernel_pages = page_align (high_addr - low_addr) >> 12;
> -
> - /* Undocumented on purpose. */
> - relocate = grub_env_get ("linux_relocate");
> - if (!relocate || grub_strcmp (relocate, "force") != 0)
> - {
> - kernel_mem = grub_efi_allocate_fixed (low_addr, kernel_pages);
> - reloc_offset = 0;
> - }
> - /* Try to relocate. */
> - if (! kernel_mem && (!relocate || grub_strcmp (relocate, "off") != 0))
> - {
> - kernel_mem = allocate_pages (align, kernel_pages, low_addr);
> - if (kernel_mem)
> - {
> - reloc_offset = (grub_uint64_t)kernel_mem - low_addr;
> - grub_dprintf ("linux", " Relocated at %p (offset=%016lx)\n",
> - kernel_mem, reloc_offset);
> - entry += reloc_offset;
> - }
> - }
> - if (! kernel_mem)
> - return grub_error (GRUB_ERR_OUT_OF_MEMORY,
> - "cannot allocate memory for OS");
> -
> - /* Load every loadable segment in memory. */
> - for (i = 0; i < ehdr->e_phnum; i++)
> - {
> - phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff
> - + i * ehdr->e_phentsize);
> - if (phdr->p_type == PT_LOAD)
> - {
> - grub_dprintf ("linux", " [paddr=%lx load=%lx memsz=%08lx "
> - "off=%lx flags=%x]\n",
> - phdr->p_paddr, phdr->p_paddr + reloc_offset,
> - phdr->p_memsz, phdr->p_offset, phdr->p_flags);
> -
> - if (grub_file_seek (file, phdr->p_offset) == (grub_off_t)-1)
> - return grub_errno;
> -
> - if (grub_file_read (file, (void *) (phdr->p_paddr +
> reloc_offset),
> - phdr->p_filesz)
> - != (grub_ssize_t) phdr->p_filesz)
> - {
> - if (!grub_errno)
> - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file
> %s"),
> - filename);
> - return grub_errno;
> - }
> -
> - if (phdr->p_filesz < phdr->p_memsz)
> - grub_memset
> - ((char *)(phdr->p_paddr + reloc_offset + phdr->p_filesz),
> - 0, phdr->p_memsz - phdr->p_filesz);
> -
> - /* Sync caches if necessary. */
> - if (phdr->p_flags & PF_X)
> - grub_arch_sync_caches
> - ((void *)(phdr->p_paddr + reloc_offset), phdr->p_memsz);
> - }
> - }
> - loaded = 1;
> - return 0;
> -}
> -
> -static grub_err_t
> -grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
> - int argc, char *argv[])
> -{
> - grub_file_t file = 0;
> - char buffer[GRUB_ELF_SEARCH];
> - char *cmdline, *p;
> - grub_ssize_t len;
> - int i;
> -
> - grub_dl_ref (my_mod);
> -
> - grub_loader_unset ();
> -
> - if (argc == 0)
> - {
> - grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> - goto fail;
> - }
> -
> - file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
> - if (! file)
> - goto fail;
> -
> - len = grub_file_read (file, buffer, sizeof (buffer));
> - if (len < (grub_ssize_t) sizeof (Elf64_Ehdr))
> - {
> - if (!grub_errno)
> - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
> - argv[0]);
> - goto fail;
> - }
> -
> - grub_dprintf ("linux", "Loading linux: %s\n", argv[0]);
> -
> - if (grub_load_elf64 (file, buffer, argv[0]))
> - goto fail;
> -
> - len = sizeof("BOOT_IMAGE=") + 8;
> - for (i = 0; i < argc; i++)
> - len += grub_strlen (argv[i]) + 1;
> - len += sizeof (struct ia64_boot_param) + 512; /* Room for extensions.
> */
> - boot_param_pages = page_align (len) >> 12;
> - boot_param = grub_efi_allocate_any_pages (boot_param_pages);
> - if (boot_param == 0)
> - {
> - grub_error (GRUB_ERR_OUT_OF_MEMORY,
> - "cannot allocate memory for bootparams");
> - goto fail;
> - }
> -
> - grub_memset (boot_param, 0, len);
> - cmdline = ((char *)(boot_param + 1)) + 256;
> -
> - /* Build cmdline. */
> - p = grub_stpcpy (cmdline, "BOOT_IMAGE");
> - for (i = 0; i < argc; i++)
> - {
> - *p++ = ' ';
> - p = grub_stpcpy (p, argv[i]);
> - }
> - cmdline[10] = '=';
> -
> - *p = '\0';
> -
> - if (grub_verify_string (cmdline, GRUB_VERIFY_KERNEL_CMDLINE))
> - goto fail;
> -
> - boot_param->command_line = (grub_uint64_t) cmdline;
> - boot_param->efi_systab = (grub_uint64_t) grub_efi_system_table;
> -
> - grub_errno = GRUB_ERR_NONE;
> -
> - grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
> -
> - fail:
> - if (file)
> - grub_file_close (file);
> -
> - if (grub_errno != GRUB_ERR_NONE)
> - {
> - grub_efi_free_pages ((grub_efi_physical_address_t) boot_param,
> - boot_param_pages);
> - grub_dl_unref (my_mod);
> - }
> - return grub_errno;
> -}
> -
> -static grub_err_t
> -grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> - int argc, char *argv[])
> -{
> - struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 };
> -
> - if (argc == 0)
> - {
> - grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> - goto fail;
> - }
> -
> - if (! loaded)
> - {
> - grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel
> first"));
> - goto fail;
> - }
> -
> - if (grub_initrd_init (argc, argv, &initrd_ctx))
> - goto fail;
> -
> - initrd_size = grub_get_initrd_size (&initrd_ctx);
> - grub_dprintf ("linux", "Loading initrd\n");
> -
> - initrd_pages = (page_align (initrd_size) >> 12);
> - initrd_mem = grub_efi_allocate_any_pages (initrd_pages);
> - if (! initrd_mem)
> - {
> - grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate pages");
> - goto fail;
> - }
> -
> - grub_dprintf ("linux", "[addr=0x%lx, size=0x%lx]\n",
> - (grub_uint64_t) initrd_mem, initrd_size);
> -
> - if (grub_initrd_load (&initrd_ctx, initrd_mem))
> - goto fail;
> - fail:
> - grub_initrd_close (&initrd_ctx);
> - return grub_errno;
> -}
> -
> -static grub_err_t
> -grub_cmd_fpswa (grub_command_t cmd __attribute__ ((unused)),
> - int argc __attribute__((unused)),
> - char *argv[] __attribute__((unused)))
> -{
> - query_fpswa ();
> - if (fpswa == NULL)
> - grub_puts_ (N_("No FPSWA found"));
> - else
> - grub_printf (_("FPSWA revision: %x\n"), fpswa->revision);
> - return GRUB_ERR_NONE;
> -}
> -
> -static grub_command_t cmd_linux, cmd_initrd, cmd_fpswa;
> -
> -GRUB_MOD_INIT(linux)
> -{
> - cmd_linux = grub_register_command ("linux", grub_cmd_linux,
> - N_("FILE [ARGS...]"), N_("Load
> Linux."));
> -
> - cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
> - N_("FILE"), N_("Load initrd."));
> -
> - cmd_fpswa = grub_register_command ("fpswa", grub_cmd_fpswa,
> - "", N_("Display FPSWA version."));
> -
> - my_mod = mod;
> -}
> -
> -GRUB_MOD_FINI(linux)
> -{
> - grub_unregister_command (cmd_linux);
> - grub_unregister_command (cmd_initrd);
> - grub_unregister_command (cmd_fpswa);
> -}
> diff --git a/include/grub/cache.h b/include/grub/cache.h
> index 7aa8d793395ad2c9..0a424616f9c2c92d 100644
> --- a/include/grub/cache.h
> +++ b/include/grub/cache.h
> @@ -34,7 +34,7 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address,
> grub_size_t len);
> #endif
>
> #ifndef GRUB_MACHINE_EMU
> -#if defined (__aarch64__) || defined (__ia64__) || defined (__powerpc__)
> || \
> +#if defined (__aarch64__) || defined (__powerpc__) || \
> defined (__sparc__)
>
> #elif defined (__i386__) || defined (__x86_64__)
> diff --git a/include/grub/dl.h b/include/grub/dl.h
> index acb4d42327d78ebd..7b4841b0be54bdc3 100644
> --- a/include/grub/dl.h
> +++ b/include/grub/dl.h
> @@ -271,21 +271,11 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void
> *ehdr,
> void grub_arch_dl_init_linker (void);
> #endif
>
> -#define GRUB_IA64_DL_TRAMP_ALIGN 16
> -#define GRUB_IA64_DL_GOT_ALIGN 16
> -
> -grub_err_t
> -grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
> - grub_size_t *got);
> grub_err_t
> grub_arm64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
> grub_size_t *got);
>
> -#if defined (__ia64__)
> -#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
> -#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
> -#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
> -#elif defined (__aarch64__)
> +#if defined (__aarch64__)
> #define grub_arch_dl_get_tramp_got_size grub_arm64_dl_get_tramp_got_size
> #else
> grub_err_t
> diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
> index 98c4ff177e19f0fa..57743cd8dcb5b0ad 100644
> --- a/include/grub/efi/pe32.h
> +++ b/include/grub/efi/pe32.h
> @@ -84,7 +84,6 @@ struct grub_pe32_coff_header
> };
>
> #define GRUB_PE32_MACHINE_I386 0x14c
> -#define GRUB_PE32_MACHINE_IA64 0x200
> #define GRUB_PE32_MACHINE_X86_64 0x8664
> #define GRUB_PE32_MACHINE_ARMTHUMB_MIXED 0x01c2
> #define GRUB_PE32_MACHINE_ARM64 0xAA64
> @@ -304,7 +303,6 @@ struct grub_pe32_fixup_block
> #define GRUB_PE32_REL_BASED_ARM_MOV32T 7
> #define GRUB_PE32_REL_BASED_RISCV_LOW12I 7
> #define GRUB_PE32_REL_BASED_RISCV_LOW12S 8
> -#define GRUB_PE32_REL_BASED_IA64_IMM64 9
> #define GRUB_PE32_REL_BASED_DIR64 10
> #define GRUB_PE32_REL_BASED_HIGH3ADJ 11
>
> diff --git a/include/grub/elf.h b/include/grub/elf.h
> index e6f073bc90331cd4..10d9a119928c730c 100644
> --- a/include/grub/elf.h
> +++ b/include/grub/elf.h
> @@ -2233,115 +2233,6 @@ typedef Elf32_Addr Elf32_Conflict;
> /* Keep this the last entry. */
> #define R_ARM_NUM 256
>
> -/* IA-64 specific declarations. */
> -
> -/* Processor specific flags for the Ehdr e_flags field. */
> -#define EF_IA_64_MASKOS 0x0000000f /* os-specific
> flags */
> -#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
> -#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
> -
> -/* Processor specific values for the Phdr p_type field. */
> -#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
> -#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind
> bits */
> -
> -/* Processor specific flags for the Phdr p_flags field. */
> -#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery
> */
> -
> -/* Processor specific values for the Shdr sh_type field. */
> -#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
> -#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
> -
> -/* Processor specific flags for the Shdr sh_flags field. */
> -#define SHF_IA_64_SHORT 0x10000000 /* section near gp
> */
> -#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery
> */
> -
> -/* Processor specific values for the Dyn d_tag field. */
> -#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
> -#define DT_IA_64_NUM 1
> -
> -/* IA-64 relocations. */
> -#define R_IA64_NONE 0x00 /* none */
> -#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
> -#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
> -#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
> -#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4
> MSB */
> -#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4
> LSB */
> -#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8
> MSB */
> -#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8
> LSB */
> -#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
> -#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov
> imm64 */
> -#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
> -#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
> -#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
> -#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
> -#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
> -#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov
> imm64 */
> -#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add
> imm22 */
> -#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
> -#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
> -#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
> -#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
> -#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
> -#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
> -#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
> -#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
> -#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl
> */
> -#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb,
> call */
> -#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add),
> chk.s */
> -#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add),
> fchkf */
> -#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
> -#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
> -#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
> -#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
> -#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
> -#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
> -#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
> -#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
> -#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
> -#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
> -#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
> -#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
> -#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
> -#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
> -#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
> -#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
> -#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
> -#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
> -#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
> -#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
> -#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
> -#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
> -#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4
> MSB */
> -#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4
> LSB */
> -#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8
> MSB */
> -#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8
> LSB */
> -#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
> -#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
> -#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add),
> 64bit inst */
> -#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT,
> MSB */
> -#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT,
> LSB */
> -#define R_IA64_COPY 0x84 /* copy relocation */
> -#define R_IA64_SUB 0x85 /* Addend and symbol difference */
> -#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
> -#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
> -#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
> -#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
> -#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add),
> imm64 */
> -#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
> -#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
> -#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
> -#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
> -#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
> -#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)),
> imm22 */
> -#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add),
> imm14 */
> -#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add),
> imm22 */
> -#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
> -#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
> -#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
> -#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
> -#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
> -#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
> -
> /* SH specific declarations */
>
> /* SH relocs. */
> diff --git a/include/grub/ia64/efi/memory.h
> b/include/grub/ia64/efi/memory.h
> deleted file mode 100644
> index 2c64918e3f711610..0000000000000000
> --- a/include/grub/ia64/efi/memory.h
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#ifndef GRUB_MEMORY_CPU_HEADER
> -#include <grub/efi/memory.h>
> -
> -#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffff
> -
> -#endif /* ! GRUB_MEMORY_CPU_HEADER */
> diff --git a/include/grub/ia64/efi/time.h b/include/grub/ia64/efi/time.h
> deleted file mode 100644
> index 897ce9c00738b834..0000000000000000
> --- a/include/grub/ia64/efi/time.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2008 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -#ifndef GRUB_MACHINE_TIME_HEADER
> -#define GRUB_MACHINE_TIME_HEADER 1
> -
> -#include <grub/efi/time.h>
> -
> -#endif /* ! GRUB_MACHINE_TIME_HEADER */
> diff --git a/include/grub/ia64/kernel.h b/include/grub/ia64/kernel.h
> deleted file mode 100644
> index c5496a00b65afbad..0000000000000000
> --- a/include/grub/ia64/kernel.h
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2010 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#ifndef GRUB_CPU_KERNEL_HEADER
> -#define GRUB_CPU_KERNEL_HEADER 1
> -
> -#define GRUB_MOD_ALIGN 0x1
> -#define GRUB_MOD_GAP 0x0
> -
> -#endif /* ! GRUB_CPU_KERNEL_HEADER */
> diff --git a/include/grub/ia64/reloc.h b/include/grub/ia64/reloc.h
> deleted file mode 100644
> index 45c8fba2728ce5b3..0000000000000000
> --- a/include/grub/ia64/reloc.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2013 Free Software Foundation, Inc.
> - *
> - * GRUB is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 3 of the License, or
> - * (at your option) any later version.
> - *
> - * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#ifndef GRUB_IA64_RELOC_H
> -#define GRUB_IA64_RELOC_H 1
> -
> -struct grub_ia64_trampoline;
> -
> -void
> -grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value);
> -void
> -grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value);
> -void
> -grub_ia64_set_immu64 (grub_addr_t addr, grub_uint64_t value);
> -void
> -grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t
> addr);
> -
> -struct grub_ia64_trampoline
> -{
> - /* nop.m */
> - grub_uint8_t nop[5];
> - /* movl r15 = addr*/
> - grub_uint8_t addr_hi[6];
> - grub_uint8_t e0;
> - grub_uint8_t addr_lo[4];
> - grub_uint8_t jump[0x20];
> -};
> -
> -#endif
> diff --git a/include/grub/ia64/setjmp.h b/include/grub/ia64/setjmp.h
> deleted file mode 100644
> index 0a62113795ef49b3..0000000000000000
> --- a/include/grub/ia64/setjmp.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version.
> - Copyright (C) 1999, 2000, 2008 Free Software Foundation, Inc.
> - Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Library General Public License as
> - published by the Free Software Foundation; either version 2 of the
> - License, or (at your option) any later version.
> -
> - The GNU C Library 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
> - Library General Public License for more details.
> -
> - You should have received a copy of the GNU Library General Public
> - License along with the GNU C Library; see the file COPYING.LIB. If
> not,
> - write to the Free Software Foundation, Inc., 59 Temple Place - Suite
> 330,
> - Boston, MA 02111-1307, USA. */
> -
> -/* User code must not depend on the internal representation of jmp_buf. */
> -
> -#define _JBLEN 70
> -
> -/* the __jmp_buf element type should be __float80 per ABI... */
> -typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /*
> guarantees 128-bit alignment! */
> -
> -int grub_setjmp (grub_
[-- Attachment #2: Type: text/html, Size: 107483 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 22:09 ` Ard Biesheuvel
@ 2023-05-11 22:40 ` matoro
2023-05-12 9:49 ` Ard Biesheuvel
2023-05-12 0:08 ` Lennart Sorensen
1 sibling, 1 reply; 26+ messages in thread
From: matoro @ 2023-05-11 22:40 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: John Paul Adrian Glaubitz, dkiper, The development of GNU GRUB
On 2023-05-11 18:09, Ard Biesheuvel wrote:
> On Thu, 11 May 2023 at 20:59, matoro
> <matoro_mailinglist_grub-devel@matoro.tk> wrote:
>>
>> On 2023-05-11 10:29, Ard Biesheuvel wrote:
>> > On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
>> > <glaubitz@physik.fu-berlin.de> wrote:
>> >>
>> >> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
>> >> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
>> >> > <glaubitz@physik.fu-berlin.de> wrote:
>> >> > >
>> >> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
>> >> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
>> >> > > > boot that deviates from other architectures. Given that IA64 is unused
>> >> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
>> >> > > > are making are tested or supported on IA64, so let's just get rid of it.
>> >> > >
>> >> > > But I just recently tested GRUB from git on IA64 and it worked without
>> >> > > any problems. We're using GRUB to boot Debian on IA64.
>> >> > >
>> >> >
>> >> > IA-64 is a dead platform, and a waste of electricity.
>> >>
>> >> I was just making a statement regarding the testability of the code.
>> >> That's all.
>> >>
>> >
>> > Fair enough. That is good to know actually - that way, we have a known
>> > working state right before we remove it.
>> >
>> >> > Feel free to keep using it, but please stop demanding that our people
>> >> > keep wasting their time on it. If you want to support it in Debian,
>> >> > you can carry it as a downstream patch and shoulder the maintenance
>> >> > burden.
>> >>
>> >> Who is "our people"? Do you think that you are part of the community
>> >> and
>> >> I am not? I don't think this kind of hostility is justified. Neither
>> >> you
>> >> nor I own this project.
>> >>
>> >
>> > Apologies - I had meant to type 'other people' not 'our people'. I
>> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
>> > part of this community than anyone else.
>> >
>> > But my point remains: I have inferred from your response (and your
>> > involvement in similar discussions around the Linux kernel) that you
>> > would prefer Itanium support to be retained, right?
>> >
>> > So could you explain who you think should carry the maintenance
>> > burden? IA64 will be the only EFI architecture in GRUB that does not
>> > boot via an EFI stub in Linux, and this deviation means that retaining
>> > support for it is going to take actual developer and maintainer
>> > bandwidth. GRUB gets very little of that as it is, which means that
>> > keeping IA64 support alive comes at the cost of worse support for
>> > other architectures and platforms. (The series that this patch is part
>> > of breaks the ia64 build, and i i struggle to see why i should care
>> > about that)
>> >
>> > Very few of those people have access to such systems to begin with
>> > (probably none), and the companies that manufactured them stopped
>> > supporting them in the open source years ago, so testing these changes
>> > is not straight-forward, making it unreasonable to demand this from
>> > contributors. Also, it is unclear to me why the needs of the few
>> > people that do still run such a system are not served by a build based
>> > on today's GRUB tree, and why ia64 support needs to be retained going
>> > forward.
>> >
>> > I'll leave it to the maintainers whether to merge this patch or not,
>> > but if this needs to keep working on ia64 as well, someone else will
>> > have to step up.
>>
>> Hi, I also have a functioning GRUB install on ia64 EFI. My machine is
>> fully open and available for debugging work, including on kernel and
>> bootloader (hard resets can be done via management console).
>>
>> If there is any way this support can be saved or at least delayed by
>> providing real hardware to work on, please reach out. The environment
>> is completely remote and available for anybody who would like to give
>> it
>> a try.
>
> Thanks, this could be helpful if we manage to find people that have
> the bandwidth to keep working on this. Would you be willing to spend
> time and development effort yourself on building and installing GRUB
> from the upstream repository on this machine (which is a bit more
> complicated than running kernels or user space programs)? Which distro
> and version are you using btw?
Yes, of course. I am running Gentoo (rolling), so everything is already
built from source anyway. Updating to the latest git revision and
adding drop-in patches are both part of the package manager and can be
done in a single command.
> And just out of curiosity, why does this matter to you? Given that the
> ia64 firmware, the hardware and the linux boot protocol have not
> changed in a decade, wouldn't it make much more sense to stick with a
> stable, current version of GRUB, assuming that these are machines that
> need to be kept in working order? What kind of workloads are you
> running on these machines?
I am simply an enthusiast of alternative architectures. In particular I
think it's the only way to keep ourselves honest about portability, and
also the only way to ensure that many ecosystems truly build from
source, as there's no way to pull down random binary code from the
internet on platforms like this.
I bought this hardware at great personal expense specifically for this
purpose - testing OSS on it, and making it available to upstreams with
an interest for developing/debugging. I already update to and run
official GRUB releases, as well as every kernel mainline point release
(and have already bisected kernel regressions resulting in boot failures
before).
> For ia64, there are no upsides to running newer GRUB code with changes
> applied to the EFI layer, as these involve protocols and other
> functionality that the ia64 firmware simply does not implement. In the
> best case, it works exactly the same as it does today. In the worst
> case, it bricks your box and someone has to go down and reinstall the
> bootloader (or more) using some kind of rescue image. Future EFI work
> will be focused on tightening memory permissions and implementing
> other robustness and hardening improvements, and these changes might
> tickle bugs in older firmware in ways we cannot anticipate at this
> point.
>
> So what exactly would we be trying to achieve by keeping ia64
> supported in upstream GRUB? Is it really important enough to justify
> asking contributors to spend time and effort on it rather than on
> something else?
Reinstalling a bootloader is definitely no problem. The machine is
either running builds/test suites or sitting idle. Gentoo Releng
produces installation CD's that I regularly test on a USB stick, so a
live/rescue environment is trivial:
https://gentoo.osuosl.org//releases/ia64/autobuilds/
I don't have basically any say here. I am not a GRUB developer. I
cannot help rewrite the code myself. I'm not even officially
representing a distro like Glaubitz. If the GRUB maintainers are of the
opinion that it is not worth the effort to maintain the support, that is
sad but understandable. Just thought I'd pipe up and offer what little
I can to help, if it's desired.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 22:09 ` Ard Biesheuvel
2023-05-11 22:40 ` matoro
@ 2023-05-12 0:08 ` Lennart Sorensen
1 sibling, 0 replies; 26+ messages in thread
From: Lennart Sorensen @ 2023-05-12 0:08 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: matoro, John Paul Adrian Glaubitz, dkiper
On Fri, May 12, 2023 at 12:09:14AM +0200, Ard Biesheuvel wrote:
> Thanks, this could be helpful if we manage to find people that have
> the bandwidth to keep working on this. Would you be willing to spend
> time and development effort yourself on building and installing GRUB
> from the upstream repository on this machine (which is a bit more
> complicated than running kernels or user space programs)? Which distro
> and version are you using btw?
>
> And just out of curiosity, why does this matter to you? Given that the
> ia64 firmware, the hardware and the linux boot protocol have not
> changed in a decade, wouldn't it make much more sense to stick with a
> stable, current version of GRUB, assuming that these are machines that
> need to be kept in working order? What kind of workloads are you
> running on these machines?
>
> For ia64, there are no upsides to running newer GRUB code with changes
> applied to the EFI layer, as these involve protocols and other
> functionality that the ia64 firmware simply does not implement. In the
> best case, it works exactly the same as it does today. In the worst
> case, it bricks your box and someone has to go down and reinstall the
> bootloader (or more) using some kind of rescue image. Future EFI work
> will be focused on tightening memory permissions and implementing
> other robustness and hardening improvements, and these changes might
> tickle bugs in older firmware in ways we cannot anticipate at this
> point.
>
> So what exactly would we be trying to achieve by keeping ia64
> supported in upstream GRUB? Is it really important enough to justify
> asking contributors to spend time and effort on it rather than on
> something else?
I don't personally care about IA64 (I think the architecture was awful,
right from when it was announced), but I don't understand some people's
desire to delete code that is working.
If the code works, why not leave it alone? Unless it gets in the way
of doing some big API change that affects lots of different parts of
the code, how does it add to anyone's effort? You don't have to compile
test the code if it is only used on an architecture you don't work with.
The people that do use that architecture can take care to make sure it
still builds and fix it if needed.
Now if the code ends up broken and no one actually cares to fix it,
OK at that point you should probably remove it, but until it breaks or
actually gets in the way (not just in theory), there really doesn't seem
to be any reason to delete it. Removing it in fact is work, and if
someone else still wants to work with it, you just made their effort
even higher.
The linux kernel I believe is considering dropping support for 486
recently because it was actually making it harder to maintain locking
code. So in that case it is causing a maintenance problem and it seemed
quite justified to consider removing it. I don't think they have actually
done so yet, but at least they are considering it.
--
Len Sorensen
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 22:40 ` matoro
@ 2023-05-12 9:49 ` Ard Biesheuvel
2023-05-12 13:39 ` Gerd Hoffmann
2023-05-12 15:36 ` matoro
0 siblings, 2 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-12 9:49 UTC (permalink / raw)
To: matoro; +Cc: John Paul Adrian Glaubitz, dkiper, The development of GNU GRUB
On Fri, 12 May 2023 at 00:41, matoro
<matoro_mailinglist_grub-devel@matoro.tk> wrote:
>
> On 2023-05-11 18:09, Ard Biesheuvel wrote:
> > On Thu, 11 May 2023 at 20:59, matoro
> > <matoro_mailinglist_grub-devel@matoro.tk> wrote:
> >>
> >> On 2023-05-11 10:29, Ard Biesheuvel wrote:
> >> > On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
> >> > <glaubitz@physik.fu-berlin.de> wrote:
> >> >>
> >> >> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
> >> >> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
> >> >> > <glaubitz@physik.fu-berlin.de> wrote:
> >> >> > >
> >> >> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
> >> >> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
> >> >> > > > boot that deviates from other architectures. Given that IA64 is unused
> >> >> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
> >> >> > > > are making are tested or supported on IA64, so let's just get rid of it.
> >> >> > >
> >> >> > > But I just recently tested GRUB from git on IA64 and it worked without
> >> >> > > any problems. We're using GRUB to boot Debian on IA64.
> >> >> > >
> >> >> >
> >> >> > IA-64 is a dead platform, and a waste of electricity.
> >> >>
> >> >> I was just making a statement regarding the testability of the code.
> >> >> That's all.
> >> >>
> >> >
> >> > Fair enough. That is good to know actually - that way, we have a known
> >> > working state right before we remove it.
> >> >
> >> >> > Feel free to keep using it, but please stop demanding that our people
> >> >> > keep wasting their time on it. If you want to support it in Debian,
> >> >> > you can carry it as a downstream patch and shoulder the maintenance
> >> >> > burden.
> >> >>
> >> >> Who is "our people"? Do you think that you are part of the community
> >> >> and
> >> >> I am not? I don't think this kind of hostility is justified. Neither
> >> >> you
> >> >> nor I own this project.
> >> >>
> >> >
> >> > Apologies - I had meant to type 'other people' not 'our people'. I
> >> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
> >> > part of this community than anyone else.
> >> >
> >> > But my point remains: I have inferred from your response (and your
> >> > involvement in similar discussions around the Linux kernel) that you
> >> > would prefer Itanium support to be retained, right?
> >> >
> >> > So could you explain who you think should carry the maintenance
> >> > burden? IA64 will be the only EFI architecture in GRUB that does not
> >> > boot via an EFI stub in Linux, and this deviation means that retaining
> >> > support for it is going to take actual developer and maintainer
> >> > bandwidth. GRUB gets very little of that as it is, which means that
> >> > keeping IA64 support alive comes at the cost of worse support for
> >> > other architectures and platforms. (The series that this patch is part
> >> > of breaks the ia64 build, and i i struggle to see why i should care
> >> > about that)
> >> >
> >> > Very few of those people have access to such systems to begin with
> >> > (probably none), and the companies that manufactured them stopped
> >> > supporting them in the open source years ago, so testing these changes
> >> > is not straight-forward, making it unreasonable to demand this from
> >> > contributors. Also, it is unclear to me why the needs of the few
> >> > people that do still run such a system are not served by a build based
> >> > on today's GRUB tree, and why ia64 support needs to be retained going
> >> > forward.
> >> >
> >> > I'll leave it to the maintainers whether to merge this patch or not,
> >> > but if this needs to keep working on ia64 as well, someone else will
> >> > have to step up.
> >>
> >> Hi, I also have a functioning GRUB install on ia64 EFI. My machine is
> >> fully open and available for debugging work, including on kernel and
> >> bootloader (hard resets can be done via management console).
> >>
> >> If there is any way this support can be saved or at least delayed by
> >> providing real hardware to work on, please reach out. The environment
> >> is completely remote and available for anybody who would like to give
> >> it
> >> a try.
> >
> > Thanks, this could be helpful if we manage to find people that have
> > the bandwidth to keep working on this. Would you be willing to spend
> > time and development effort yourself on building and installing GRUB
> > from the upstream repository on this machine (which is a bit more
> > complicated than running kernels or user space programs)? Which distro
> > and version are you using btw?
>
> Yes, of course. I am running Gentoo (rolling), so everything is already
> built from source anyway. Updating to the latest git revision and
> adding drop-in patches are both part of the package manager and can be
> done in a single command.
>
> > And just out of curiosity, why does this matter to you? Given that the
> > ia64 firmware, the hardware and the linux boot protocol have not
> > changed in a decade, wouldn't it make much more sense to stick with a
> > stable, current version of GRUB, assuming that these are machines that
> > need to be kept in working order? What kind of workloads are you
> > running on these machines?
>
> I am simply an enthusiast of alternative architectures. In particular I
> think it's the only way to keep ourselves honest about portability, and
> also the only way to ensure that many ecosystems truly build from
> source, as there's no way to pull down random binary code from the
> internet on platforms like this.
>
> I bought this hardware at great personal expense specifically for this
> purpose - testing OSS on it, and making it available to upstreams with
> an interest for developing/debugging. I already update to and run
> official GRUB releases, as well as every kernel mainline point release
> (and have already bisected kernel regressions resulting in boot failures
> before).
>
Thanks for providing this background. It is good to know that such
support is available, but I don't think GRUB should be one of the
projects making use of it tbh.
> > For ia64, there are no upsides to running newer GRUB code with changes
> > applied to the EFI layer, as these involve protocols and other
> > functionality that the ia64 firmware simply does not implement. In the
> > best case, it works exactly the same as it does today. In the worst
> > case, it bricks your box and someone has to go down and reinstall the
> > bootloader (or more) using some kind of rescue image. Future EFI work
> > will be focused on tightening memory permissions and implementing
> > other robustness and hardening improvements, and these changes might
> > tickle bugs in older firmware in ways we cannot anticipate at this
> > point.
> >
> > So what exactly would we be trying to achieve by keeping ia64
> > supported in upstream GRUB? Is it really important enough to justify
> > asking contributors to spend time and effort on it rather than on
> > something else?
>
> Reinstalling a bootloader is definitely no problem. The machine is
> either running builds/test suites or sitting idle. Gentoo Releng
> produces installation CD's that I regularly test on a USB stick, so a
> live/rescue environment is trivial:
> https://gentoo.osuosl.org//releases/ia64/autobuilds/
>
> I don't have basically any say here. I am not a GRUB developer. I
> cannot help rewrite the code myself. I'm not even officially
> representing a distro like Glaubitz. If the GRUB maintainers are of the
> opinion that it is not worth the effort to maintain the support, that is
> sad but understandable. Just thought I'd pipe up and offer what little
> I can to help, if it's desired.
Much appreciated.
But the question was why you think it is important that GRUB remains
among the set of programs running on this system that are built from
the latest source? GRUB is just a bootloader that implements the
Linux/ia64 boot protocol based on protocols exposed by the EFI
firmware, and neither side has changed in over a decade, or is going
to change in the future. Today's GRUB works as well on ia64 today as
it is ever going to run in the future.
So what is the point? Why would you risk running the latest GRUB
(carrying substantial changes in its EFI layer)? Just to prove the
point that it still works?
There is nothing wrong with that, of course. Personally, I think
Itanium is not worth anyone's time. But I fully support anyone's right
to spend it however they want.
*However*, that is not the issue I am raising here. The issue I am
raising is that the EFI layer in GRUB is likely to change
substantially if we want to stay relevant, and comply with the tighter
logo requirements that OEMs are going to implement for 'more secure'
systems. After this series is applied, IA64 is the only EFI
architecture in GRUB that boots in bare metal mode rather than via the
EFI stub in the Linux kernel.
There are a few options here:
- contributors will be requested (and required) to at least build test
their changes if they affect ia64, and to work with folks like
yourself to see if they break anything at runtime;
- the maintainer is in charge of this, perhaps with some automation
for the build tests, so that they can push back on changes that
regress ia64;
- we merge such changes without regard for ia64, and leave it to
enthusiasts like yourself to contribute fixes for ia64 once you notice
a regression;
- we decide that GRUB 2.xx (whichever was the most recent release at
the time of the decision) is good enough to boot Linux on ia64 for the
remaining life time of the architecture, and remove it from the GRUB
tree.
So the final option has my preference (in case that wasn't obvious),
and I am simply asking why having IA64 in top-of-tree GRUB is so
important to you, to the extent that you would ask other people to
spend their valuable time on it. It is clear that you made an
investment in IA64, but that by itself does not justify requiring
others to do the same (timewise or moneywise)
Thanks,
Ard.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-11 14:29 ` Ard Biesheuvel
2023-05-11 18:42 ` matoro
@ 2023-05-12 10:41 ` John Paul Adrian Glaubitz
2023-05-12 10:56 ` Ard Biesheuvel
2023-05-14 6:31 ` Oskari Pirhonen
1 sibling, 2 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-05-12 10:41 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: dkiper, The development of GNU GRUB
Hello Ard!
On Thu, 2023-05-11 at 16:29 +0200, Ard Biesheuvel wrote:
> > > Feel free to keep using it, but please stop demanding that our people
> > > keep wasting their time on it. If you want to support it in Debian,
> > > you can carry it as a downstream patch and shoulder the maintenance
> > > burden.
> >
> > Who is "our people"? Do you think that you are part of the community and
> > I am not? I don't think this kind of hostility is justified. Neither you
> > nor I own this project.
> >
>
> Apologies - I had meant to type 'other people' not 'our people'. I
> rarely contribute to GRUB myself, so I wouldn't consider myself more a
> part of this community than anyone else.
>
> But my point remains: I have inferred from your response (and your
> involvement in similar discussions around the Linux kernel) that you
> would prefer Itanium support to be retained, right?
Not necessarily. I am generally not opposed to removing ia64 support, but it
should happen in a coordinated form where downstreams and users are involved.
Just dropping support from random projects without prior coordination seems
like the wrong approach to me. I would suggest posting your plans to the
distributions mailing list [1], Debian's ia64 mailing list [2], the Gentoo
developer mailing list [3], the Linux ia64 mailing list [4] and maybe the
NetBSD ia64 mailing list [5].
If you don't get any objections there, I am not going to object either. I just
want this to happen in an ordered manner.
> So could you explain who you think should carry the maintenance
> burden? IA64 will be the only EFI architecture in GRUB that does not
> boot via an EFI stub in Linux, and this deviation means that retaining
> support for it is going to take actual developer and maintainer
> bandwidth. GRUB gets very little of that as it is, which means that
> keeping IA64 support alive comes at the cost of worse support for
> other architectures and platforms. (The series that this patch is part
> of breaks the ia64 build, and i i struggle to see why i should care
> about that)
>
> Very few of those people have access to such systems to begin with
> (probably none), and the companies that manufactured them stopped
> supporting them in the open source years ago, so testing these changes
> is not straight-forward, making it unreasonable to demand this from
> contributors. Also, it is unclear to me why the needs of the few
> people that do still run such a system are not served by a build based
> on today's GRUB tree, and why ia64 support needs to be retained going
> forward.
Well, that's why I am suggesting to coordinate this properly and ask potential
users of the code whether they are okay with the removal.
Thanks,
Adrian
> [1] https://lists.freedesktop.org/mailman/listinfo/distributions
> [2] https://lists.debian.org/debian-ia64/
> [3] https://archives.gentoo.org/gentoo-dev/
> [4] https://marc.info/?l=linux-ia64&r=1&w=1
> [5] https://mail-index.netbsd.org/port-ia64/tindex.html
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-12 10:41 ` John Paul Adrian Glaubitz
@ 2023-05-12 10:56 ` Ard Biesheuvel
2023-05-14 6:31 ` Oskari Pirhonen
1 sibling, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-12 10:56 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: dkiper, The development of GNU GRUB
On Fri, 12 May 2023 at 12:42, John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> Hello Ard!
>
> On Thu, 2023-05-11 at 16:29 +0200, Ard Biesheuvel wrote:
> > > > Feel free to keep using it, but please stop demanding that our people
> > > > keep wasting their time on it. If you want to support it in Debian,
> > > > you can carry it as a downstream patch and shoulder the maintenance
> > > > burden.
> > >
> > > Who is "our people"? Do you think that you are part of the community and
> > > I am not? I don't think this kind of hostility is justified. Neither you
> > > nor I own this project.
> > >
> >
> > Apologies - I had meant to type 'other people' not 'our people'. I
> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
> > part of this community than anyone else.
> >
> > But my point remains: I have inferred from your response (and your
> > involvement in similar discussions around the Linux kernel) that you
> > would prefer Itanium support to be retained, right?
>
> Not necessarily. I am generally not opposed to removing ia64 support, but it
> should happen in a coordinated form where downstreams and users are involved.
>
Are you aware of any actual users?
> Just dropping support from random projects without prior coordination seems
> like the wrong approach to me. I would suggest posting your plans to the
> distributions mailing list [1], Debian's ia64 mailing list [2], the Gentoo
> developer mailing list [3], the Linux ia64 mailing list [4] and maybe the
> NetBSD ia64 mailing list [5].
>
Fair enough
> If you don't get any objections there, I am not going to object either. I just
> want this to happen in an ordered manner.
>
I already sent a similar patch to the linux-ia64 a while ago, and the
only person that objected was you :-)
> > So could you explain who you think should carry the maintenance
> > burden? IA64 will be the only EFI architecture in GRUB that does not
> > boot via an EFI stub in Linux, and this deviation means that retaining
> > support for it is going to take actual developer and maintainer
> > bandwidth. GRUB gets very little of that as it is, which means that
> > keeping IA64 support alive comes at the cost of worse support for
> > other architectures and platforms. (The series that this patch is part
> > of breaks the ia64 build, and i i struggle to see why i should care
> > about that)
> >
> > Very few of those people have access to such systems to begin with
> > (probably none), and the companies that manufactured them stopped
> > supporting them in the open source years ago, so testing these changes
> > is not straight-forward, making it unreasonable to demand this from
> > contributors. Also, it is unclear to me why the needs of the few
> > people that do still run such a system are not served by a build based
> > on today's GRUB tree, and why ia64 support needs to be retained going
> > forward.
>
> Well, that's why I am suggesting to coordinate this properly and ask potential
> users of the code whether they are okay with the removal.
>
That is reasonable - let's see how other people feel about this.
--
Ard.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-12 9:49 ` Ard Biesheuvel
@ 2023-05-12 13:39 ` Gerd Hoffmann
2023-05-12 15:36 ` matoro
1 sibling, 0 replies; 26+ messages in thread
From: Gerd Hoffmann @ 2023-05-12 13:39 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: matoro, John Paul Adrian Glaubitz, dkiper
Hi,
> - we decide that GRUB 2.xx (whichever was the most recent release at
> the time of the decision) is good enough to boot Linux on ia64 for the
> remaining life time of the architecture, and remove it from the GRUB
> tree.
That looks like the most reasonable option to me.
Note that ia64 firmware development is dead, upstream edk2 dropped ia64
support years ago. All the efi changes in the pipeline are not relevant
for ia64.
take care,
Gerd
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-12 9:49 ` Ard Biesheuvel
2023-05-12 13:39 ` Gerd Hoffmann
@ 2023-05-12 15:36 ` matoro
1 sibling, 0 replies; 26+ messages in thread
From: matoro @ 2023-05-12 15:36 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: John Paul Adrian Glaubitz, dkiper, The development of GNU GRUB
On 2023-05-12 05:49, Ard Biesheuvel wrote:
> On Fri, 12 May 2023 at 00:41, matoro
> <matoro_mailinglist_grub-devel@matoro.tk> wrote:
>>
>> On 2023-05-11 18:09, Ard Biesheuvel wrote:
>> > On Thu, 11 May 2023 at 20:59, matoro
>> > <matoro_mailinglist_grub-devel@matoro.tk> wrote:
>> >>
>> >> On 2023-05-11 10:29, Ard Biesheuvel wrote:
>> >> > On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz
>> >> > <glaubitz@physik.fu-berlin.de> wrote:
>> >> >>
>> >> >> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote:
>> >> >> > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz
>> >> >> > <glaubitz@physik.fu-berlin.de> wrote:
>> >> >> > >
>> >> >> > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote:
>> >> >> > > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI
>> >> >> > > > boot that deviates from other architectures. Given that IA64 is unused
>> >> >> > > > and unmaintained, it makes no sense to pretend that the EFI changes we
>> >> >> > > > are making are tested or supported on IA64, so let's just get rid of it.
>> >> >> > >
>> >> >> > > But I just recently tested GRUB from git on IA64 and it worked without
>> >> >> > > any problems. We're using GRUB to boot Debian on IA64.
>> >> >> > >
>> >> >> >
>> >> >> > IA-64 is a dead platform, and a waste of electricity.
>> >> >>
>> >> >> I was just making a statement regarding the testability of the code.
>> >> >> That's all.
>> >> >>
>> >> >
>> >> > Fair enough. That is good to know actually - that way, we have a known
>> >> > working state right before we remove it.
>> >> >
>> >> >> > Feel free to keep using it, but please stop demanding that our people
>> >> >> > keep wasting their time on it. If you want to support it in Debian,
>> >> >> > you can carry it as a downstream patch and shoulder the maintenance
>> >> >> > burden.
>> >> >>
>> >> >> Who is "our people"? Do you think that you are part of the community
>> >> >> and
>> >> >> I am not? I don't think this kind of hostility is justified. Neither
>> >> >> you
>> >> >> nor I own this project.
>> >> >>
>> >> >
>> >> > Apologies - I had meant to type 'other people' not 'our people'. I
>> >> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
>> >> > part of this community than anyone else.
>> >> >
>> >> > But my point remains: I have inferred from your response (and your
>> >> > involvement in similar discussions around the Linux kernel) that you
>> >> > would prefer Itanium support to be retained, right?
>> >> >
>> >> > So could you explain who you think should carry the maintenance
>> >> > burden? IA64 will be the only EFI architecture in GRUB that does not
>> >> > boot via an EFI stub in Linux, and this deviation means that retaining
>> >> > support for it is going to take actual developer and maintainer
>> >> > bandwidth. GRUB gets very little of that as it is, which means that
>> >> > keeping IA64 support alive comes at the cost of worse support for
>> >> > other architectures and platforms. (The series that this patch is part
>> >> > of breaks the ia64 build, and i i struggle to see why i should care
>> >> > about that)
>> >> >
>> >> > Very few of those people have access to such systems to begin with
>> >> > (probably none), and the companies that manufactured them stopped
>> >> > supporting them in the open source years ago, so testing these changes
>> >> > is not straight-forward, making it unreasonable to demand this from
>> >> > contributors. Also, it is unclear to me why the needs of the few
>> >> > people that do still run such a system are not served by a build based
>> >> > on today's GRUB tree, and why ia64 support needs to be retained going
>> >> > forward.
>> >> >
>> >> > I'll leave it to the maintainers whether to merge this patch or not,
>> >> > but if this needs to keep working on ia64 as well, someone else will
>> >> > have to step up.
>> >>
>> >> Hi, I also have a functioning GRUB install on ia64 EFI. My machine is
>> >> fully open and available for debugging work, including on kernel and
>> >> bootloader (hard resets can be done via management console).
>> >>
>> >> If there is any way this support can be saved or at least delayed by
>> >> providing real hardware to work on, please reach out. The environment
>> >> is completely remote and available for anybody who would like to give
>> >> it
>> >> a try.
>> >
>> > Thanks, this could be helpful if we manage to find people that have
>> > the bandwidth to keep working on this. Would you be willing to spend
>> > time and development effort yourself on building and installing GRUB
>> > from the upstream repository on this machine (which is a bit more
>> > complicated than running kernels or user space programs)? Which distro
>> > and version are you using btw?
>>
>> Yes, of course. I am running Gentoo (rolling), so everything is
>> already
>> built from source anyway. Updating to the latest git revision and
>> adding drop-in patches are both part of the package manager and can be
>> done in a single command.
>>
>> > And just out of curiosity, why does this matter to you? Given that the
>> > ia64 firmware, the hardware and the linux boot protocol have not
>> > changed in a decade, wouldn't it make much more sense to stick with a
>> > stable, current version of GRUB, assuming that these are machines that
>> > need to be kept in working order? What kind of workloads are you
>> > running on these machines?
>>
>> I am simply an enthusiast of alternative architectures. In particular
>> I
>> think it's the only way to keep ourselves honest about portability,
>> and
>> also the only way to ensure that many ecosystems truly build from
>> source, as there's no way to pull down random binary code from the
>> internet on platforms like this.
>>
>> I bought this hardware at great personal expense specifically for this
>> purpose - testing OSS on it, and making it available to upstreams with
>> an interest for developing/debugging. I already update to and run
>> official GRUB releases, as well as every kernel mainline point release
>> (and have already bisected kernel regressions resulting in boot
>> failures
>> before).
>>
>
> Thanks for providing this background. It is good to know that such
> support is available, but I don't think GRUB should be one of the
> projects making use of it tbh.
>
>> > For ia64, there are no upsides to running newer GRUB code with changes
>> > applied to the EFI layer, as these involve protocols and other
>> > functionality that the ia64 firmware simply does not implement. In the
>> > best case, it works exactly the same as it does today. In the worst
>> > case, it bricks your box and someone has to go down and reinstall the
>> > bootloader (or more) using some kind of rescue image. Future EFI work
>> > will be focused on tightening memory permissions and implementing
>> > other robustness and hardening improvements, and these changes might
>> > tickle bugs in older firmware in ways we cannot anticipate at this
>> > point.
>> >
>> > So what exactly would we be trying to achieve by keeping ia64
>> > supported in upstream GRUB? Is it really important enough to justify
>> > asking contributors to spend time and effort on it rather than on
>> > something else?
>>
>> Reinstalling a bootloader is definitely no problem. The machine is
>> either running builds/test suites or sitting idle. Gentoo Releng
>> produces installation CD's that I regularly test on a USB stick, so a
>> live/rescue environment is trivial:
>> https://gentoo.osuosl.org//releases/ia64/autobuilds/
>>
>> I don't have basically any say here. I am not a GRUB developer. I
>> cannot help rewrite the code myself. I'm not even officially
>> representing a distro like Glaubitz. If the GRUB maintainers are of
>> the
>> opinion that it is not worth the effort to maintain the support, that
>> is
>> sad but understandable. Just thought I'd pipe up and offer what
>> little
>> I can to help, if it's desired.
>
> Much appreciated.
>
> But the question was why you think it is important that GRUB remains
> among the set of programs running on this system that are built from
> the latest source? GRUB is just a bootloader that implements the
> Linux/ia64 boot protocol based on protocols exposed by the EFI
> firmware, and neither side has changed in over a decade, or is going
> to change in the future. Today's GRUB works as well on ia64 today as
> it is ever going to run in the future.
>
> So what is the point? Why would you risk running the latest GRUB
> (carrying substantial changes in its EFI layer)? Just to prove the
> point that it still works?
>
> There is nothing wrong with that, of course. Personally, I think
> Itanium is not worth anyone's time. But I fully support anyone's right
> to spend it however they want.
>
> *However*, that is not the issue I am raising here. The issue I am
> raising is that the EFI layer in GRUB is likely to change
> substantially if we want to stay relevant, and comply with the tighter
> logo requirements that OEMs are going to implement for 'more secure'
> systems. After this series is applied, IA64 is the only EFI
> architecture in GRUB that boots in bare metal mode rather than via the
> EFI stub in the Linux kernel.
>
> There are a few options here:
> - contributors will be requested (and required) to at least build test
> their changes if they affect ia64, and to work with folks like
> yourself to see if they break anything at runtime;
> - the maintainer is in charge of this, perhaps with some automation
> for the build tests, so that they can push back on changes that
> regress ia64;
> - we merge such changes without regard for ia64, and leave it to
> enthusiasts like yourself to contribute fixes for ia64 once you notice
> a regression;
> - we decide that GRUB 2.xx (whichever was the most recent release at
> the time of the decision) is good enough to boot Linux on ia64 for the
> remaining life time of the architecture, and remove it from the GRUB
> tree.
>
> So the final option has my preference (in case that wasn't obvious),
> and I am simply asking why having IA64 in top-of-tree GRUB is so
> important to you, to the extent that you would ask other people to
> spend their valuable time on it. It is clear that you made an
> investment in IA64, but that by itself does not justify requiring
> others to do the same (timewise or moneywise)
>
> Thanks,
> Ard.
No, none of my investment justifies anything. It is your project, your
time. I only offer what help I can; I don't demand any effort on your
part if it's not deemed to be worth it.
As I'm sure you're aware, projects that lose upstream support and
attention eventually bitrot into an unbuildable or unusable state. See
e.g. what happened to the yaboot project on PowerPC - at one point the
de facto bootloader, now virtually unusable due to changes in the
userspace ecosystem over time.
FWIW, the kernel currently operates under option (3) for ia64, with the
exception that their CI also tests for build/config sanity via
cross-compiler.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386
2023-05-11 12:06 ` [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386 Ard Biesheuvel
2023-05-11 12:14 ` Ard Biesheuvel
@ 2023-05-14 5:12 ` Glenn Washburn
2023-05-16 17:57 ` Ard Biesheuvel
1 sibling, 1 reply; 26+ messages in thread
From: Glenn Washburn @ 2023-05-14 5:12 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: The development of GNU GRUB, dkiper
On Thu, 11 May 2023 14:06:40 +0200
Ard Biesheuvel <ardb@kernel.org> wrote:
> Switch the x86 based EFI platform builds to the generic EFI loader,
> which exposes the initrd via the LoadFile2 protocol instead of the
> x86-specific setup header. This will launch the Linux kernel via its
> EFI stub, which performs its own initialization in the EFI boot
> services context before calling ExitBootServices() and performing the
> bare metal Linux boot.
>
> Given that only Linux kernel versions v5.8 and later support this
> initrd loading method, the existing x86 loader is retained as a
> fallback, which will also be used for Linux kernels built without the
> EFI stub. In this case, GRUB calls ExitBootServices() before entering
> the Linux kernel, and all EFI related information is provided to the
> kernel via struct boot_params in the setup header, as before.
>
> Note that this means that booting EFI stub kernels older than v5.8 is
> not supported even when not using an initrd at all. Also, the EFI
> handover protocol, which has no basis in the UEFI specification, is
> not implemented.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> grub-core/Makefile.core.def | 5 +-
> grub-core/loader/efi/linux.c | 51 ++++++++++++++++++--
> grub-core/loader/i386/linux.c | 8 +++
> include/grub/efi/efi.h | 2 +-
> 4 files changed, 56 insertions(+), 10 deletions(-)
>
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 8ee2bd89c4205761..bc08955ac791241a 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -1818,11 +1818,8 @@ module = {
> powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
> sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
> arm_coreboot = loader/arm/linux.c;
> - arm_efi = loader/efi/linux.c;
> arm_uboot = loader/arm/linux.c;
> - arm64 = loader/efi/linux.c;
> - riscv32 = loader/efi/linux.c;
> - riscv64 = loader/efi/linux.c;
> + efi = loader/efi/linux.c;
> emu = loader/emu/linux.c;
> common = loader/linux.c;
> common = lib/cmdline.c;
> diff --git a/grub-core/loader/efi/linux.c
> b/grub-core/loader/efi/linux.c index
> 15e0686549d7ecca..970a4d7a5d4d464f 100644 ---
> a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c
> @@ -69,6 +69,12 @@ static initrd_media_device_path_t
> initrd_lf2_device_path = { }
> };
>
> +extern grub_err_t
> +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char
> *argv[]); +
> +extern grub_err_t
> +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char
> *argv[]); +
> static grub_efi_status_t __grub_efi_api
> grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> grub_efi_device_path_t *device_path,
> @@ -89,8 +95,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t
> file, return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read
> Linux image header");
> if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
> - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> - N_("plain image kernel not supported -
> rebuild with CONFIG_(U)EFI_STUB enabled"));
> + return GRUB_ERR_NOT_IMPLEMENTED_YET;
>
> grub_dprintf ("linux", "UEFI stub kernel:\n");
> grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
> @@ -117,7 +122,11 @@ grub_arch_efi_linux_load_image_header
> (grub_file_t file, if
> (lh->pe_image_header.optional_header.major_image_version >= 1)
> initrd_use_loadfile2 = true; else
> +#if defined(__i386__) || defined(__x86_64__)
> + return GRUB_ERR_NOT_IMPLEMENTED_YET;
Is this for the unimplemented EFI handover protocol? Regardless, I think
a comment above this line indicating what would be implemented here
would be nice for others looking at this.
Glenn
> +#else
> initrd_use_loadfile2 = false;
> +#endif
>
> grub_dprintf ("linux", "LoadFile2 initrd loading %sabled\n",
> initrd_use_loadfile2 ? "en" : "dis");
> @@ -125,6 +134,7 @@ grub_arch_efi_linux_load_image_header
> (grub_file_t file, return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> static grub_err_t
> finalize_params_linux (void)
> {
> @@ -169,6 +179,7 @@ failure:
> grub_fdt_unload();
> return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
> }
> +#endif
>
> grub_err_t
> grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size,
> char *args) @@ -231,8 +242,10 @@ grub_arch_efi_linux_boot_image
> (grub_addr_t addr, grub_size_t size, char *args) static grub_err_t
> grub_linux_boot (void)
> {
> +#if !defined(__i386__) && !defined(__x86_64__)
> if (finalize_params_linux () != GRUB_ERR_NONE)
> return grub_errno;
> +#endif
>
> return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
> kernel_size, linux_args));
> @@ -253,7 +266,9 @@ grub_linux_unload (void)
> if (kernel_addr)
> grub_efi_free_pages ((grub_addr_t) kernel_addr,
> GRUB_EFI_BYTES_TO_PAGES (kernel_size));
> +#if !defined(__i386__) && !defined(__x86_64__)
> grub_fdt_unload ();
> +#endif
>
> if (initrd_lf2_handle != NULL)
> {
> @@ -269,6 +284,7 @@ grub_linux_unload (void)
> return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> /*
> * As per linux/Documentation/arm/Booting
> * ARM initrd needs to be covered by kernel linear mapping,
> @@ -304,6 +320,7 @@ allocate_initrd_mem (int initrd_pages)
> GRUB_EFI_ALLOCATE_MAX_ADDRESS,
> GRUB_EFI_LOADER_DATA);
> }
> +#endif
>
> static grub_efi_status_t __grub_efi_api
> grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> @@ -345,7 +362,7 @@ static grub_err_t
> grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> int argc, char *argv[])
> {
> - int initrd_size, initrd_pages;
> + int __attribute__ ((unused)) initrd_size, initrd_pages;
> void *initrd_mem = NULL;
> grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
> grub_efi_status_t status;
> @@ -356,6 +373,11 @@ grub_cmd_initrd (grub_command_t cmd
> __attribute__ ((unused)), goto fail;
> }
>
> +#if defined(__i386__) || defined(__x86_64__)
> + if (!initrd_use_loadfile2)
> + return grub_cmd_initrd_x86_legacy (cmd, argc, argv);
> +#endif
> +
> if (!loaded)
> {
> grub_error (GRUB_ERR_BAD_ARGUMENT,
> @@ -391,6 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__
> ((unused)), return GRUB_ERR_NONE;
> }
>
> +#if !defined(__i386__) && !defined(__x86_64__)
> initrd_size = grub_get_initrd_size (&initrd_ctx);
> grub_dprintf ("linux", "Loading initrd\n");
>
> @@ -410,6 +433,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__
> ((unused)), initrd_end = initrd_start + initrd_size;
> grub_dprintf ("linux", "[addr=%p, size=0x%x]\n",
> (void *) initrd_start, initrd_size);
> +#endif
>
> fail:
> grub_initrd_close (&initrd_ctx);
> @@ -441,8 +465,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__
> ((unused)),
> kernel_size = grub_file_size (file);
>
> - if (grub_arch_efi_linux_load_image_header (file, &lh) !=
> GRUB_ERR_NONE)
> - goto fail;
> + switch (grub_arch_efi_linux_load_image_header (file, &lh))
> + {
> + case GRUB_ERR_NONE:
> + break;
> + case GRUB_ERR_NOT_IMPLEMENTED_YET:
> +#if defined(__i386__) || defined(__x86_64__)
> + /*
> + * Retry with the legacy x86 boot code - it can load EFI
> kernels without
> + * the stub, and supports loading initrds without the
> LoadFile2 protocol
> + */
> + grub_file_close (file);
> + return grub_cmd_linux_x86_legacy (cmd, argc, argv);
> +#endif
> + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> + N_("plain image kernel not supported - rebuild
> with CONFIG_(U)EFI_STUB enabled"));
> + /* fall through */
> + default:
> + goto fail;
> + }
>
> grub_loader_unset();
>
> diff --git a/grub-core/loader/i386/linux.c
> b/grub-core/loader/i386/linux.c index
> c2385d0a561a8fc4..997647a33326eeb8 100644 ---
> a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c
> @@ -1136,6 +1136,7 @@ grub_cmd_initrd (grub_command_t cmd
> __attribute__ ((unused)), return grub_errno;
> }
>
> +#ifndef GRUB_MACHINE_EFI
> static grub_command_t cmd_linux, cmd_initrd;
>
> GRUB_MOD_INIT(linux)
> @@ -1152,3 +1153,10 @@ GRUB_MOD_FINI(linux)
> grub_unregister_command (cmd_linux);
> grub_unregister_command (cmd_initrd);
> }
> +#else
> +extern grub_err_t __attribute__((alias("grub_cmd_linux")))
> +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char
> *argv[]); +
> +extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
> +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char
> *argv[]); +#endif
> diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
> index 444bf5b0b53e31fe..d02abca7da67f787 100644
> --- a/include/grub/efi/efi.h
> +++ b/include/grub/efi/efi.h
> @@ -113,12 +113,12 @@ extern void (*EXPORT_VAR(grub_efi_net_config))
> (grub_efi_handle_t hnd, #if defined(__arm__) || defined(__aarch64__)
> || defined(__riscv) void
> *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); grub_err_t
> EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); +#endif
> #include <grub/file.h>
> grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file,
> struct
> linux_arch_kernel_header *lh); grub_err_t
> grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
> char *args); -#endif
>
> grub_addr_t grub_efi_modules_addr (void);
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/6] ia64: Remove support
2023-05-12 10:41 ` John Paul Adrian Glaubitz
2023-05-12 10:56 ` Ard Biesheuvel
@ 2023-05-14 6:31 ` Oskari Pirhonen
1 sibling, 0 replies; 26+ messages in thread
From: Oskari Pirhonen @ 2023-05-14 6:31 UTC (permalink / raw)
To: John Paul Adrian Glaubitz
Cc: Ard Biesheuvel, dkiper, The development of GNU GRUB,
distributions
[-- Attachment #1: Type: text/plain, Size: 3841 bytes --]
On Fri, May 12, 2023 at 12:41:47 +0200, John Paul Adrian Glaubitz wrote:
> Hello Ard!
>
> On Thu, 2023-05-11 at 16:29 +0200, Ard Biesheuvel wrote:
> > > > Feel free to keep using it, but please stop demanding that our people
> > > > keep wasting their time on it. If you want to support it in Debian,
> > > > you can carry it as a downstream patch and shoulder the maintenance
> > > > burden.
> > >
> > > Who is "our people"? Do you think that you are part of the community and
> > > I am not? I don't think this kind of hostility is justified. Neither you
> > > nor I own this project.
> > >
> >
> > Apologies - I had meant to type 'other people' not 'our people'. I
> > rarely contribute to GRUB myself, so I wouldn't consider myself more a
> > part of this community than anyone else.
> >
> > But my point remains: I have inferred from your response (and your
> > involvement in similar discussions around the Linux kernel) that you
> > would prefer Itanium support to be retained, right?
>
> Not necessarily. I am generally not opposed to removing ia64 support, but it
> should happen in a coordinated form where downstreams and users are involved.
>
> Just dropping support from random projects without prior coordination seems
> like the wrong approach to me. I would suggest posting your plans to the
> distributions mailing list [1], Debian's ia64 mailing list [2], the Gentoo
> developer mailing list [3], the Linux ia64 mailing list [4] and maybe the
> NetBSD ia64 mailing list [5].
>
> If you don't get any objections there, I am not going to object either. I just
> want this to happen in an ordered manner.
>
For future reference, might I suggest the following "distributions" list
as well: distributions@lists.linux.dev
It's a relatively new list for cross-distro collaboration/PSAs. You can
find the archives here [6].
- Oskari
> > So could you explain who you think should carry the maintenance
> > burden? IA64 will be the only EFI architecture in GRUB that does not
> > boot via an EFI stub in Linux, and this deviation means that retaining
> > support for it is going to take actual developer and maintainer
> > bandwidth. GRUB gets very little of that as it is, which means that
> > keeping IA64 support alive comes at the cost of worse support for
> > other architectures and platforms. (The series that this patch is part
> > of breaks the ia64 build, and i i struggle to see why i should care
> > about that)
> >
> > Very few of those people have access to such systems to begin with
> > (probably none), and the companies that manufactured them stopped
> > supporting them in the open source years ago, so testing these changes
> > is not straight-forward, making it unreasonable to demand this from
> > contributors. Also, it is unclear to me why the needs of the few
> > people that do still run such a system are not served by a build based
> > on today's GRUB tree, and why ia64 support needs to be retained going
> > forward.
>
> Well, that's why I am suggesting to coordinate this properly and ask potential
> users of the code whether they are okay with the removal.
>
> Thanks,
> Adrian
>
> [1] https://lists.freedesktop.org/mailman/listinfo/distributions
> [2] https://lists.debian.org/debian-ia64/
> [3] https://archives.gentoo.org/gentoo-dev/
> [4] https://marc.info/?l=linux-ia64&r=1&w=1
> [5] https://mail-index.netbsd.org/port-ia64/tindex.html
>
[6] https://lore.kernel.org/distributions/
> --
> .''`. John Paul Adrian Glaubitz
> : :' : Debian Developer
> `. `' Physicist
> `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386
2023-05-14 5:12 ` Glenn Washburn
@ 2023-05-16 17:57 ` Ard Biesheuvel
0 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2023-05-16 17:57 UTC (permalink / raw)
To: development; +Cc: The development of GNU GRUB, dkiper
On Sun, 14 May 2023 at 07:12, Glenn Washburn
<development@efficientek.com> wrote:
>
> On Thu, 11 May 2023 14:06:40 +0200
> Ard Biesheuvel <ardb@kernel.org> wrote:
>
> > Switch the x86 based EFI platform builds to the generic EFI loader,
> > which exposes the initrd via the LoadFile2 protocol instead of the
> > x86-specific setup header. This will launch the Linux kernel via its
> > EFI stub, which performs its own initialization in the EFI boot
> > services context before calling ExitBootServices() and performing the
> > bare metal Linux boot.
> >
> > Given that only Linux kernel versions v5.8 and later support this
> > initrd loading method, the existing x86 loader is retained as a
> > fallback, which will also be used for Linux kernels built without the
> > EFI stub. In this case, GRUB calls ExitBootServices() before entering
> > the Linux kernel, and all EFI related information is provided to the
> > kernel via struct boot_params in the setup header, as before.
> >
> > Note that this means that booting EFI stub kernels older than v5.8 is
> > not supported even when not using an initrd at all. Also, the EFI
> > handover protocol, which has no basis in the UEFI specification, is
> > not implemented.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> > grub-core/Makefile.core.def | 5 +-
> > grub-core/loader/efi/linux.c | 51 ++++++++++++++++++--
> > grub-core/loader/i386/linux.c | 8 +++
> > include/grub/efi/efi.h | 2 +-
> > 4 files changed, 56 insertions(+), 10 deletions(-)
> >
> > diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> > index 8ee2bd89c4205761..bc08955ac791241a 100644
> > --- a/grub-core/Makefile.core.def
> > +++ b/grub-core/Makefile.core.def
> > @@ -1818,11 +1818,8 @@ module = {
> > powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
> > sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
> > arm_coreboot = loader/arm/linux.c;
> > - arm_efi = loader/efi/linux.c;
> > arm_uboot = loader/arm/linux.c;
> > - arm64 = loader/efi/linux.c;
> > - riscv32 = loader/efi/linux.c;
> > - riscv64 = loader/efi/linux.c;
> > + efi = loader/efi/linux.c;
> > emu = loader/emu/linux.c;
> > common = loader/linux.c;
> > common = lib/cmdline.c;
> > diff --git a/grub-core/loader/efi/linux.c
> > b/grub-core/loader/efi/linux.c index
> > 15e0686549d7ecca..970a4d7a5d4d464f 100644 ---
> > a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c
> > @@ -69,6 +69,12 @@ static initrd_media_device_path_t
> > initrd_lf2_device_path = { }
> > };
> >
> > +extern grub_err_t
> > +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char
> > *argv[]); +
> > +extern grub_err_t
> > +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char
> > *argv[]); +
> > static grub_efi_status_t __grub_efi_api
> > grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> > grub_efi_device_path_t *device_path,
> > @@ -89,8 +95,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t
> > file, return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read
> > Linux image header");
> > if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
> > - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> > - N_("plain image kernel not supported -
> > rebuild with CONFIG_(U)EFI_STUB enabled"));
> > + return GRUB_ERR_NOT_IMPLEMENTED_YET;
> >
> > grub_dprintf ("linux", "UEFI stub kernel:\n");
> > grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
> > @@ -117,7 +122,11 @@ grub_arch_efi_linux_load_image_header
> > (grub_file_t file, if
> > (lh->pe_image_header.optional_header.major_image_version >= 1)
> > initrd_use_loadfile2 = true; else
> > +#if defined(__i386__) || defined(__x86_64__)
> > + return GRUB_ERR_NOT_IMPLEMENTED_YET;
>
> Is this for the unimplemented EFI handover protocol?
No. This forces the caller (below) to take the x86 legacy fallback
path, which we need to use in 2 cases:
- no EFI stub support
- no LoadFile2 support
The former implies the latter for non-EFI stub kernels, which GRUB
supports today, and should remain supported imo. When booting EFI stub
kernels older than v5.8, we fall back to the legacy boot as well, as
it is the only way to boot with EFI support (at runtime) and with
initrd support.
The EFI handover protocol should remain unimplemented.
> Regardless, I think
> a comment above this line indicating what would be implemented here
> would be nice for others looking at this.
>
Nothing should be implemented here. This is just the escape hatch to
fall back to the legacy code. GRUB does not define
GRUB_ERR_NOT_IMPLEMENTED without the _YET, but one could argue that it
applies to the kernel image in this case. Other suggestions for
suitable GRUB_ERR_xxx values are welcome.
>
> > +#else
> > initrd_use_loadfile2 = false;
> > +#endif
> >
> > grub_dprintf ("linux", "LoadFile2 initrd loading %sabled\n",
> > initrd_use_loadfile2 ? "en" : "dis");
> > @@ -125,6 +134,7 @@ grub_arch_efi_linux_load_image_header
> > (grub_file_t file, return GRUB_ERR_NONE;
> > }
> >
> > +#if !defined(__i386__) && !defined(__x86_64__)
> > static grub_err_t
> > finalize_params_linux (void)
> > {
> > @@ -169,6 +179,7 @@ failure:
> > grub_fdt_unload();
> > return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
> > }
> > +#endif
> >
> > grub_err_t
> > grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size,
> > char *args) @@ -231,8 +242,10 @@ grub_arch_efi_linux_boot_image
> > (grub_addr_t addr, grub_size_t size, char *args) static grub_err_t
> > grub_linux_boot (void)
> > {
> > +#if !defined(__i386__) && !defined(__x86_64__)
> > if (finalize_params_linux () != GRUB_ERR_NONE)
> > return grub_errno;
> > +#endif
> >
> > return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
> > kernel_size, linux_args));
> > @@ -253,7 +266,9 @@ grub_linux_unload (void)
> > if (kernel_addr)
> > grub_efi_free_pages ((grub_addr_t) kernel_addr,
> > GRUB_EFI_BYTES_TO_PAGES (kernel_size));
> > +#if !defined(__i386__) && !defined(__x86_64__)
> > grub_fdt_unload ();
> > +#endif
> >
> > if (initrd_lf2_handle != NULL)
> > {
> > @@ -269,6 +284,7 @@ grub_linux_unload (void)
> > return GRUB_ERR_NONE;
> > }
> >
> > +#if !defined(__i386__) && !defined(__x86_64__)
> > /*
> > * As per linux/Documentation/arm/Booting
> > * ARM initrd needs to be covered by kernel linear mapping,
> > @@ -304,6 +320,7 @@ allocate_initrd_mem (int initrd_pages)
> > GRUB_EFI_ALLOCATE_MAX_ADDRESS,
> > GRUB_EFI_LOADER_DATA);
> > }
> > +#endif
> >
> > static grub_efi_status_t __grub_efi_api
> > grub_efi_initrd_load_file2 (grub_efi_load_file2_t *this,
> > @@ -345,7 +362,7 @@ static grub_err_t
> > grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> > int argc, char *argv[])
> > {
> > - int initrd_size, initrd_pages;
> > + int __attribute__ ((unused)) initrd_size, initrd_pages;
> > void *initrd_mem = NULL;
> > grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
> > grub_efi_status_t status;
> > @@ -356,6 +373,11 @@ grub_cmd_initrd (grub_command_t cmd
> > __attribute__ ((unused)), goto fail;
> > }
> >
> > +#if defined(__i386__) || defined(__x86_64__)
> > + if (!initrd_use_loadfile2)
> > + return grub_cmd_initrd_x86_legacy (cmd, argc, argv);
> > +#endif
> > +
> > if (!loaded)
> > {
> > grub_error (GRUB_ERR_BAD_ARGUMENT,
> > @@ -391,6 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__
> > ((unused)), return GRUB_ERR_NONE;
> > }
> >
> > +#if !defined(__i386__) && !defined(__x86_64__)
> > initrd_size = grub_get_initrd_size (&initrd_ctx);
> > grub_dprintf ("linux", "Loading initrd\n");
> >
> > @@ -410,6 +433,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__
> > ((unused)), initrd_end = initrd_start + initrd_size;
> > grub_dprintf ("linux", "[addr=%p, size=0x%x]\n",
> > (void *) initrd_start, initrd_size);
> > +#endif
> >
> > fail:
> > grub_initrd_close (&initrd_ctx);
> > @@ -441,8 +465,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__
> > ((unused)),
> > kernel_size = grub_file_size (file);
> >
> > - if (grub_arch_efi_linux_load_image_header (file, &lh) !=
> > GRUB_ERR_NONE)
> > - goto fail;
> > + switch (grub_arch_efi_linux_load_image_header (file, &lh))
> > + {
> > + case GRUB_ERR_NONE:
> > + break;
> > + case GRUB_ERR_NOT_IMPLEMENTED_YET:
> > +#if defined(__i386__) || defined(__x86_64__)
> > + /*
> > + * Retry with the legacy x86 boot code - it can load EFI
> > kernels without
> > + * the stub, and supports loading initrds without the
> > LoadFile2 protocol
> > + */
> > + grub_file_close (file);
> > + return grub_cmd_linux_x86_legacy (cmd, argc, argv);
> > +#endif
> > + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
> > + N_("plain image kernel not supported - rebuild
> > with CONFIG_(U)EFI_STUB enabled"));
> > + /* fall through */
> > + default:
> > + goto fail;
> > + }
> >
> > grub_loader_unset();
> >
> > diff --git a/grub-core/loader/i386/linux.c
> > b/grub-core/loader/i386/linux.c index
> > c2385d0a561a8fc4..997647a33326eeb8 100644 ---
> > a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c
> > @@ -1136,6 +1136,7 @@ grub_cmd_initrd (grub_command_t cmd
> > __attribute__ ((unused)), return grub_errno;
> > }
> >
> > +#ifndef GRUB_MACHINE_EFI
> > static grub_command_t cmd_linux, cmd_initrd;
> >
> > GRUB_MOD_INIT(linux)
> > @@ -1152,3 +1153,10 @@ GRUB_MOD_FINI(linux)
> > grub_unregister_command (cmd_linux);
> > grub_unregister_command (cmd_initrd);
> > }
> > +#else
> > +extern grub_err_t __attribute__((alias("grub_cmd_linux")))
> > +grub_cmd_linux_x86_legacy (grub_command_t cmd, int argc, char
> > *argv[]); +
> > +extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
> > +grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char
> > *argv[]); +#endif
> > diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
> > index 444bf5b0b53e31fe..d02abca7da67f787 100644
> > --- a/include/grub/efi/efi.h
> > +++ b/include/grub/efi/efi.h
> > @@ -113,12 +113,12 @@ extern void (*EXPORT_VAR(grub_efi_net_config))
> > (grub_efi_handle_t hnd, #if defined(__arm__) || defined(__aarch64__)
> > || defined(__riscv) void
> > *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); grub_err_t
> > EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); +#endif
> > #include <grub/file.h>
> > grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file,
> > struct
> > linux_arch_kernel_header *lh); grub_err_t
> > grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
> > char *args); -#endif
> >
> > grub_addr_t grub_efi_modules_addr (void);
> >
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2023-05-16 17:57 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 12:06 [PATCH v2 0/6] efi: Implement generic EFI boot for x86 Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 1/6] ia64: Remove support Ard Biesheuvel
2023-05-11 12:14 ` John Paul Adrian Glaubitz
2023-05-11 12:17 ` Ard Biesheuvel
2023-05-11 12:42 ` Steve McIntyre
2023-05-11 13:34 ` John Paul Adrian Glaubitz
2023-05-11 14:29 ` Ard Biesheuvel
2023-05-11 18:42 ` matoro
2023-05-11 22:09 ` Ard Biesheuvel
2023-05-11 22:40 ` matoro
2023-05-12 9:49 ` Ard Biesheuvel
2023-05-12 13:39 ` Gerd Hoffmann
2023-05-12 15:36 ` matoro
2023-05-12 0:08 ` Lennart Sorensen
2023-05-12 10:41 ` John Paul Adrian Glaubitz
2023-05-12 10:56 ` Ard Biesheuvel
2023-05-14 6:31 ` Oskari Pirhonen
2023-05-11 22:31 ` Vladimir 'phcoder' Serbinenko
2023-05-11 12:06 ` [PATCH v2 2/6] efi: Make EFI PXE protocol methods non-callable Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 3/6] efi: Add calling convention annotation to all prototypes Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 4/6] efi: Drop all uses of efi_call_XX wrappers Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 5/6] efi: Remove x86_64 call wrappers Ard Biesheuvel
2023-05-11 12:06 ` [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386 Ard Biesheuvel
2023-05-11 12:14 ` Ard Biesheuvel
2023-05-14 5:12 ` Glenn Washburn
2023-05-16 17:57 ` Ard Biesheuvel
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 read-only IMAP folder(s) and NNTP newsgroup(s).