Skip to contentSkip to conversation

efi: Implement generic EFI boot for x86

PATCH Superseded Ard Biesheuvel 9 participants 26 messages May 11, 2023 – May 16, 2023 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#18 lore raw

PATCH v2 2/6 efi: Make EFI PXE protocol methods non-callable

In reply to 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.

---
 include/grub/efi/api.h | 24 ++++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)
include/grub/efi/api.h +12 -12
index b4c4646651cd53f5..da1a80ca3a94fe1c 100644
@@ -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;
 
Signature · 1 line
2.39.2
#0 lore raw

v2 cover efi: Implement generic EFI boot for x86

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
Signature · 1 line
2.39.2
#19 lore raw

PATCH v2 3/6 efi: Add calling convention annotation to all prototypes

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.

---
 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(-)
grub-core/kern/arm/efi/init.c +1 -1
index 7fcf91bf41168d4a..ab48342f3cda116d 100644
@@ -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)))
 {
include/grub/efi/api.h +299 -270

781 lines not on this page · raw message

include/grub/efi/tpm.h +73 -76

161 lines not on this page · raw message

Signature · 1 line
2.39.2
#21 lore raw

PATCH v2 5/6 efi: Remove x86_64 call wrappers

In reply to 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.

---
 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(-)
grub-core/Makefile.core.def +0 -1
index 9194be1d4f796bd7..8ee2bd89c4205761 100644
@@ -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;
 
grub-core/kern/x86_64/efi/callwrap.S deleted +0 -129

129 lines not on this page · raw message

include/grub/efi/api.h +0 -73

77 lines not on this page · raw message

Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 1/6 ia64: Remove support

In reply to 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.

---
 .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(-)
.travis.yml +1 -6
index 4bd05a30a27ad15c..7bea51b2f0c4da89 100644
@@ -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"
Makefile.util.def +0 -1
index beaef1168f0d09b0..ae9e628e5c85b751 100644
@@ -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;
configure.ac +0 -8
index ca42ff8f73182511..789e5658e4d9ab9e 100644
@@ -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])
docs/grub-dev.texi +1 -1
index 31eb99ea29943c39..ab68676b03814cfc 100644
@@ -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
 
docs/grub.texi +1 -1
index a3e9ce2d1ac7e780..c0b7f832f79f7c16 100644
@@ -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
gentpl.py +3 -3
index 88abe5b0a119321c..2b5ead8afad95cd7 100644
@@ -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)
 
grub-core/Makefile.am +0 -6
index 80e7a83edf9ba3aa..6feecfdef0db6385 100644
@@ -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
grub-core/Makefile.core.def +0 -15
index 801df7c21de663ec..9194be1d4f796bd7 100644
@@ -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;
grub-core/commands/file.c +0 -33
index 7c13e976b505b3bf..574353491296e48a 100644
@@ -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))
grub-core/kern/dl.c +0 -12
index e447fd0fab4e303b..b3009fce4a3cae93 100644
@@ -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;
grub-core/kern/emu/cache.c +1 -3
index 113682cc42c1d6e8..0fdb763a57bd006a 100644
@@ -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);
 
grub-core/kern/emu/cache_s.S +1 -1
index 6885ffd69bde2b59..2ad520474ea28609 100644
@@ -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"
grub-core/kern/emu/lite.c +0 -3
index b327d4e418841bc1..81baec907669dcd3 100644
@@ -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"
grub-core/kern/ia64/cache.c deleted +0 -35
deleted file mode 100644
index 13efd308f7158943..0000000000000000
@@ -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;;");
-}
grub-core/kern/ia64/dl.c deleted +0 -150

150 lines not on this page · raw message

grub-core/kern/ia64/dl_helper.c deleted +0 -241

241 lines not on this page · raw message

grub-core/kern/ia64/efi/init.c deleted +0 -80

80 lines not on this page · raw message

grub-core/kern/ia64/efi/startup.S deleted +0 -44

44 lines not on this page · raw message

grub-core/kern/misc.c +1 -1
index dfae4f9d7897a71d..dad79abf0c6fdebb 100644
@@ -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.
   */
grub-core/lib/efi/halt.c +1 -1
index 29d41364168eaeba..0b42be6740f246b7 100644
@@ -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
grub-core/lib/ia64/longjmp.S deleted +0 -162

162 lines not on this page · raw message

grub-core/lib/ia64/setjmp.S deleted +0 -177

177 lines not on this page · raw message

grub-core/lib/setjmp.S +0 -3
index 9c8721088a3ff8f1..1bf29c3cce773658 100644
@@ -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__)
grub-core/loader/ia64/efi/linux.c deleted +0 -607

607 lines not on this page · raw message

include/grub/cache.h +1 -1
index 7aa8d793395ad2c9..0a424616f9c2c92d 100644
@@ -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__)
include/grub/dl.h +1 -11
index acb4d42327d78ebd..7b4841b0be54bdc3 100644
@@ -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
include/grub/efi/pe32.h +0 -2
index 98c4ff177e19f0fa..57743cd8dcb5b0ad 100644
@@ -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
 
include/grub/elf.h +0 -109

115 lines not on this page · raw message

include/grub/ia64/efi/memory.h deleted +0 -6
deleted file mode 100644
index 2c64918e3f711610..0000000000000000
@@ -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 */
include/grub/ia64/efi/time.h deleted +0 -23
deleted file mode 100644
index 897ce9c00738b834..0000000000000000
@@ -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 */
include/grub/ia64/kernel.h deleted +0 -25
deleted file mode 100644
index c5496a00b65afbad..0000000000000000
@@ -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 */
include/grub/ia64/reloc.h deleted +0 -44

44 lines not on this page · raw message

include/grub/ia64/setjmp.h deleted +0 -28
deleted file mode 100644
index 0a62113795ef49b3..0000000000000000
@@ -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 <[email protected]>.
-
-   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));
include/grub/ia64/time.h deleted +0 -28
deleted file mode 100644
index 03ee79fa4e454dd2..0000000000000000
@@ -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 */
include/grub/ia64/types.h deleted +0 -32
deleted file mode 100644
index 91a546dd2c5e9080..0000000000000000
@@ -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 */
include/grub/misc.h +1 -1
index 6c9d56de9264ff20..b12ded5b1b9577be 100644
@@ -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
include/grub/util/install.h +0 -1
index 7d7445af9815eb93..2785eddc1ac3f202 100644
@@ -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,
include/grub/util/mkimage.h +0 -2
index 3819a67441c86958..7c31c23d302a7000 100644
@@ -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;
 };
tests/core_compress_test.in +1 -1
index 24a811418aad8dfa..78a411e0984a7cf0 100644
@@ -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
util/grub-install-common.c +0 -1
index e45fb290307150bc..6fa9776df078d1d9 100644
@@ -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"     },
util/grub-install.c +0 -16
index 53b46480428878cb..db7b3e7dfc613310 100644
@@ -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);
util/grub-mkimage.c +0 -1
index c0d559937020b2d2..080e7c0d69576dc5 100644
@@ -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>
util/grub-mkimagexx.c +2 -173

223 lines not on this page · raw message

util/grub-mknetdir.c +0 -1
index d609ff94cca29de7..cb1c3f03c4058fb8 100644
@@ -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" },
util/grub-mkrescue.c +0 -7
index 1e0e40ca6ab6e0eb..a0e17cdb9651acbc 100644
@@ -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);
util/grub-module-verifier.c +0 -22
index 163529ca9c25422e..e64239b2ffcbf49b 100644
@@ -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,
util/mkimage.c +0 -17
index 43078c71cd995889..a21a19e37fa9d599 100644
@@ -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},
Signature · 1 line
2.39.2
#20 lore raw

PATCH v2 4/6 efi: Drop all uses of efi_call_XX wrappers

In reply to 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.

---
 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(-)
grub-core/commands/acpi.c +4 -4
index fda62f4ea98a6da8..ab067ae6e51d43af 100644
@@ -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
 
grub-core/commands/efi/efitextmode.c +3 -5
index 3679f6b4d8028bc7..198bc694d3fc3c3b 100644
@@ -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);
 
grub-core/commands/efi/lsefi.c +3 -2
index c304d25ccdd6f32b..53970149785a28f8 100644
@@ -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;
grub-core/commands/efi/tpm.c +10 -11
index e1f343fea3ff3503..4213552048aebad6 100644
@@ -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)
grub-core/disk/efi/efidisk.c +4 -3
index d7540040ed067063..ad025010a06bd338 100644
@@ -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))
     {
grub-core/kern/arm/efi/init.c +5 -5
index ab48342f3cda116d..809f69c8cfc8727e 100644
@@ -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 ();
 
grub-core/kern/efi/efi.c +29 -27

138 lines not on this page · raw message

grub-core/kern/efi/init.c +7 -8
index b67bc73a1b0102a8..e873ef5298ff3a5b 100644
@@ -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 ();
 }
grub-core/kern/efi/mm.c +8 -9
index 3705b8b1b465d00e..09225a7c08e4d066 100644
@@ -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);
grub-core/kern/i386/efi/tsc.c +1 -1
index 4b93ba8e1b5f377c..e41dc6526dda08d7 100644
@@ -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;
grub-core/lib/efi/datetime.c +3 -6
index 0fd1b5fbd615cfec..b03e4df5ecc1e98b 100644
@@ -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,
grub-core/lib/efi/halt.c +2 -2
index 0b42be6740f246b7..f482fcb3a7b26312 100644
@@ -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);
 }
grub-core/lib/efi/relocator.c +3 -3
index 84da70a86cf7b992..b4518d0002485511 100644
@@ -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);
 }
grub-core/loader/efi/appleloader.c +4 -4
index fc89e23bdc6f6ab3..a0b61a240b73af10 100644
@@ -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)
grub-core/loader/efi/chainloader.c +10 -10
index 7557eb269be34888..1759af632fe90b01 100644
@@ -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);
 
grub-core/mmap/efi/mmap.c +8 -8
index bd495a184811445b..2f0ec4d037f02279 100644
@@ -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;
grub-core/net/drivers/efi/efinet.c +13 -13
index 5adf5f40f4924b2e..56a1797093f6cee1 100644
@@ -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));
grub-core/term/efi/console.c +14 -15
index 532948a8e19fc9de..9a7bc0fcf9d16707 100644
@@ -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
grub-core/term/efi/serial.c +9 -9
index 4c94723c57e7458f..e86ebce3f8bf68cf 100644
@@ -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.
grub-core/video/efi_gop.c +9 -9
index 7a50546318d62f40..9c79010384312dd3 100644
@@ -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)
grub-core/video/efi_uga.c +4 -4
index e74d6c235000d611..25d22c8a3cd07845 100644
@@ -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)))
Signature · 1 line
2.39.2
#22 lore raw

PATCH v2 6/6 efi: Use generic EFI loader for x86_64 and i386

In reply to 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.

---
 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(-)
grub-core/Makefile.core.def +1 -4
index 8ee2bd89c4205761..bc08955ac791241a 100644
@@ -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;
grub-core/loader/efi/linux.c +46 -5

139 lines not on this page · raw message

grub-core/loader/i386/linux.c +8 -0
index c2385d0a561a8fc4..997647a33326eeb8 100644
@@ -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
include/grub/efi/efi.h +1 -1
index 444bf5b0b53e31fe..d02abca7da67f787 100644
@@ -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);
 
Signature · 1 line
2.39.2
#23 lore raw

Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

Quoted 15 lines · 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.

Quoted 2 lines

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.

Quoted 230 lines

Also, the EFI
handover protocol, which has no basis in the UEFI specification, is not implemented.

---
 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(-)
grub-core/Makefile.core.def +1 -4
index 8ee2bd89c4205761..bc08955ac791241a 100644
@@ -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;
grub-core/loader/efi/linux.c +46 -5
index 15e0686549d7ecca..970a4d7a5d4d464f 100644
@@ -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();
 
grub-core/loader/i386/linux.c +8 -0
index c2385d0a561a8fc4..997647a33326eeb8 100644
@@ -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
include/grub/efi/efi.h +1 -2
index 444bf5b0b53e31fe..d02abca7da67f787 100644
@@ -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

#2 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel
Quoted 4 lines · 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.

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

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#3 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 10 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

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.

#4 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 13 lines · Ard Biesheuvel
Quoted 10 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

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.

Quoted 6 lines

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.

Signature · 4 lines
Steve McIntyre, Cambridge, UK.                                [email protected]
“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
#5 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 4 lines

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

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#6 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 9 lines
Quoted 4 lines

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.

Signature · 1 line
Ard.
#7 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 62 lines · Ard Biesheuvel
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 9 lines
Quoted 4 lines

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.

Quoted 3 lines

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.

#8 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 71 lines · matoro
Quoted 65 lines · Ard Biesheuvel
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 11 lines
Quoted 4 lines

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.

Quoted 3 lines

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.

Quoted 8 lines

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?

#17 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel

I still have my itanium in the closet and check newer versions of GRUB with it

Quoted 2,443 lines · 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.

---
 .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(-)
.travis.yml +0 -0
index 4bd05a30a27ad15c..7bea51b2f0c4da89 100644
@@ -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.

.travis.yml +0 -5
@@ -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"

Makefile.util.def +0 -1
index beaef1168f0d09b0..ae9e628e5c85b751 100644
@@ -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;
configure.ac +0 -8
index ca42ff8f73182511..789e5658e4d9ab9e 100644
@@ -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"],

[])

configure.ac +0 -1
-    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])

docs/grub-dev.texi +1 -1
index 31eb99ea29943c39..ab68676b03814cfc 100644
@@ -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
docs/grub.texi +0 -0
index a3e9ce2d1ac7e780..c0b7f832f79f7c16 100644
@@ -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

docs/grub.texi +1 -0
+PowerPC and Sparc64 ports support only Linux. MIPS port supports Linux
 and multiboot2.
 
 @section Boot tests
gentpl.py +2 -2
index 88abe5b0a119321c..2b5ead8afad95cd7 100644
@@ -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" ]

gentpl.py +0 -0
@@ -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

gentpl.py +1 -1
-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)
grub-core/Makefile.am +0 -0
index 80e7a83edf9ba3aa..6feecfdef0db6385 100644
@@ -188,12 +188,6 @@ KERNEL_HEADER_FILES +=

$(top_srcdir)/include/grub/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h endif

grub-core/Makefile.am +0 -6
-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
grub-core/Makefile.core.def +0 -6
index 801df7c21de663ec..9194be1d4f796bd7 100644
@@ -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';

grub-core/Makefile.core.def +0 -11
@@ -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;
grub-core/commands/file.c +0 -29
index 7c13e976b505b3bf..574353491296e48a 100644
@@ -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:
       {
grub-core/commands/file.c +0 -4
@@ -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))
grub-core/kern/dl.c +0 -12
index e447fd0fab4e303b..b3009fce4a3cae93 100644
@@ -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;
grub-core/kern/emu/cache.c +1 -3
index 113682cc42c1d6e8..0fdb763a57bd006a 100644
@@ -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);
 
grub-core/kern/emu/cache_s.S +1 -1
index 6885ffd69bde2b59..2ad520474ea28609 100644
@@ -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"
grub-core/kern/emu/lite.c +0 -3
index b327d4e418841bc1..81baec907669dcd3 100644
@@ -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"
grub-core/kern/ia64/cache.c deleted +0 -35
deleted file mode 100644
index 13efd308f7158943..0000000000000000
@@ -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;;");
-}
grub-core/kern/ia64/dl.c deleted +0 -41
deleted file mode 100644
index db59300fea3ceec9..0000000000000000
@@ -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"));

grub-core/kern/ia64/dl.c deleted +0 -74
-
-  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);

grub-core/kern/ia64/dl.c deleted +0 -15
-         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);

grub-core/kern/ia64/dl.c deleted +0 -11
-           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,

grub-core/kern/ia64/dl.c deleted +0 -3
-                          ELF_R_TYPE (rel->r_info));
-           return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                              N_("relocation 0x%s is not implemented

yet"), rel_info);

grub-core/kern/ia64/dl.c deleted +0 -5
-         }
-       }
-    }
-  return GRUB_ERR_NONE;
-}
grub-core/kern/ia64/dl_helper.c deleted +0 -55
deleted file mode 100644
index 05a0a68db7a1263c..0000000000000000
@@ -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 */

grub-core/kern/ia64/dl_helper.c deleted +0 -35
-  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)));

grub-core/kern/ia64/dl_helper.c deleted +0 -19
-      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

grub-core/kern/ia64/dl_helper.c deleted +0 -27
-}
-
-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)));

grub-core/kern/ia64/dl_helper.c deleted +0 -50
-      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-core/kern/ia64/dl_helper.c deleted +0 -27
-{
-  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));

grub-core/kern/ia64/dl_helper.c deleted +0 -2
-       i < grub_le_to_cpu16 (e->e_shnum);
-       i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16

(e->e_shentsize)))

grub-core/kern/ia64/dl_helper.c deleted +0 -5
-    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)))

grub-core/kern/ia64/dl_helper.c deleted +0 -18
-         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;
-}
-
grub-core/kern/ia64/efi/init.c deleted +0 -80
deleted file mode 100644
index f1965571b1dc0dce..0000000000000000
@@ -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 ();
-}
grub-core/kern/ia64/efi/startup.S deleted +0 -44
deleted file mode 100644
index d75c6d7cc741d5eb..0000000000000000
@@ -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
grub-core/kern/misc.c +1 -1
index dfae4f9d7897a71d..dad79abf0c6fdebb 100644
@@ -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.
*/

grub-core/lib/efi/halt.c +1 -1
index 29d41364168eaeba..0b42be6740f246b7 100644
@@ -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
grub-core/lib/ia64/longjmp.S deleted +0 -1
deleted file mode 100644
index 38afb2243c6b9f87..0000000000000000
@@ -1,162 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2008  Free Software Foundation,

Inc.

grub-core/lib/ia64/longjmp.S deleted +0 -21
-   Contributed by David Mosberger-Tang <[email protected]>.
-
-   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

grub-core/lib/ia64/longjmp.S deleted +0 -33
-   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)

grub-core/lib/ia64/longjmp.S deleted +0 -23
-       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)

grub-core/lib/ia64/longjmp.S deleted +0 -22
-       ;;
-       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)

grub-core/lib/ia64/longjmp.S deleted +0 -62
-       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)
grub-core/lib/ia64/setjmp.S deleted +0 -1
deleted file mode 100644
index a0382d83d602d9b4..0000000000000000
@@ -1,177 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation,

Inc.

grub-core/lib/ia64/setjmp.S deleted +0 -25
-   Contributed by David Mosberger-Tang <[email protected]>.
-
-   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)

grub-core/lib/ia64/setjmp.S deleted +0 -19
-       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)

grub-core/lib/ia64/setjmp.S deleted +0 -29
-       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: */

grub-core/lib/ia64/setjmp.S deleted +0 -15
-
-       .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)

grub-core/lib/ia64/setjmp.S deleted +0 -88
-       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
grub-core/lib/setjmp.S +0 -3
index 9c8721088a3ff8f1..1bf29c3cce773658 100644
@@ -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__)
grub-core/loader/ia64/efi/linux.c deleted +0 -54
deleted file mode 100644
index fb9b961f71a20208..0000000000000000
@@ -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-core/loader/ia64/efi/linux.c deleted +0 -4
-  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-core/loader/ia64/efi/linux.c deleted +0 -4
-    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-core/loader/ia64/efi/linux.c deleted +0 -121
-  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-core/loader/ia64/efi/linux.c deleted +0 -118
-    {
-      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));

grub-core/loader/ia64/efi/linux.c deleted +0 -47
-
-  /* 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");

grub-core/loader/ia64/efi/linux.c deleted +0 -69
-
-  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),

grub-core/loader/ia64/efi/linux.c deleted +0 -5
-                             phdr->p_filesz)
-              != (grub_ssize_t) phdr->p_filesz)
-           {
-             if (!grub_errno)
-               grub_error (GRUB_ERR_BAD_OS, N_("premature end of file

%s"),

grub-core/loader/ia64/efi/linux.c deleted +0 -61
-                           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.

*/

grub-core/loader/ia64/efi/linux.c deleted +0 -61
-  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"));

grub-core/loader/ia64/efi/linux.c deleted +0 -46
-      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."));

grub-core/loader/ia64/efi/linux.c deleted +0 -16
-
-  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);
-}
include/grub/cache.h +1 -1
index 7aa8d793395ad2c9..0a424616f9c2c92d 100644
@@ -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__)

include/grub/dl.h +1 -11
index acb4d42327d78ebd..7b4841b0be54bdc3 100644
@@ -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

include/grub/efi/pe32.h +0 -2
index 98c4ff177e19f0fa..57743cd8dcb5b0ad 100644
@@ -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
 
include/grub/elf.h +0 -4
index e6f073bc90331cd4..10d9a119928c730c 100644
@@ -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 */

include/grub/elf.h +0 -6
-#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 */

include/grub/elf.h +0 -3
-
-/* Processor specific flags for the Phdr p_flags field.  */
-#define PF_IA_64_NORECOV       0x80000000      /* spec insns w/o recovery

*/

include/grub/elf.h +0 -7
-
-/* 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
*/

include/grub/elf.h +0 -11
-
-/* 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 */

include/grub/elf.h +0 -2
-#define R_IA64_GPREL22         0x2a    /* @gprel(sym + add), add imm22 */
-#define R_IA64_GPREL64I                0x2b    /* @gprel(sym + add), mov

imm64 */

include/grub/elf.h +0 -6
-#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 */

include/grub/elf.h +0 -9
-#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 */

include/grub/elf.h +0 -23
-#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 */

include/grub/elf.h +0 -3
-#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 */

include/grub/elf.h +0 -7
-#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 */

include/grub/elf.h +0 -6
-#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 */

include/grub/elf.h +0 -7
-#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.  */
include/grub/ia64/efi/memory.h deleted +0 -6
deleted file mode 100644
index 2c64918e3f711610..0000000000000000
@@ -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 */
include/grub/ia64/efi/time.h deleted +0 -23
deleted file mode 100644
index 897ce9c00738b834..0000000000000000
@@ -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 */
include/grub/ia64/kernel.h deleted +0 -25
deleted file mode 100644
index c5496a00b65afbad..0000000000000000
@@ -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 */
include/grub/ia64/reloc.h deleted +0 -31
deleted file mode 100644
index 45c8fba2728ce5b3..0000000000000000
@@ -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);

include/grub/ia64/reloc.h deleted +0 -13
-
-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
include/grub/ia64/setjmp.h deleted +0 -16
deleted file mode 100644
index 0a62113795ef49b3..0000000000000000
@@ -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 <[email protected]>.
-
-   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,

include/grub/ia64/setjmp.h deleted +0 -8
-   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! */

include/grub/ia64/setjmp.h deleted +0 -2
-
-int grub_setjmp (grub_
#9 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel
Quoted 82 lines · Ard Biesheuvel
Quoted 71 lines · matoro
Quoted 65 lines · Ard Biesheuvel
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 11 lines
Quoted 4 lines

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.

Quoted 3 lines

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.

Quoted 8 lines

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.

Quoted 6 lines

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.

Quoted 6 lines

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).

Quoted 11 lines

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.

Quoted 4 lines

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.

#13 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel
Quoted 25 lines · Ard Biesheuvel

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.

Quoted 4 lines

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.

Signature · 1 line
Len Sorensen
#10 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to matoro
Quoted 110 lines · matoro
Quoted 83 lines · Ard Biesheuvel
Quoted 75 lines · matoro
Quoted 65 lines · Ard Biesheuvel
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 11 lines
Quoted 4 lines

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.

Quoted 3 lines

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).

Quoted 5 lines

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.

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 7 lines

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.

Quoted 22 lines
Quoted 11 lines

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.

Quoted 4 lines

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/

Quoted 6 lines
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.

#14 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel

Hello Ard!

Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines
Quoted 4 lines

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.

Quoted 7 lines

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.

Quoted 10 lines

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)

Quoted 8 lines

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

Quoted 5 lines

[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

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#15 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

Quoted 18 lines · John Paul Adrian Glaubitz

Hello Ard!

Quoted 14 lines · Ard Biesheuvel
Quoted 9 lines
Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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?

Quoted 6 lines

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

Quoted 3 lines

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 :-)

Quoted 19 lines
Quoted 10 lines

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)

Quoted 8 lines

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.

Quoted 3 lines

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.

Signature · 1 line
Ard.
#11 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel

Hi,

Quoted 4 lines

- 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

#12 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to Ard Biesheuvel
Quoted 201 lines · Ard Biesheuvel
Quoted 110 lines · matoro
Quoted 83 lines · Ard Biesheuvel
Quoted 75 lines · matoro
Quoted 65 lines · Ard Biesheuvel
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Ard Biesheuvel
Quoted 7 lines · John Paul Adrian Glaubitz
Quoted 4 lines · 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.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 11 lines
Quoted 4 lines

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.

Quoted 3 lines

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).

Quoted 5 lines

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.

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 7 lines

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.

Quoted 22 lines
Quoted 11 lines

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.

Quoted 4 lines

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/

Quoted 6 lines
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)

Quoted 2 lines

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.

#24 lore raw

Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

In reply to Ard Biesheuvel
Quoted 76 lines · On Thu, 11 May 2023 14:06:40 +0200 Ard Biesheuvel <[email protected]> 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.

---
 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(-)
grub-core/Makefile.core.def +1 -4
index 8ee2bd89c4205761..bc08955ac791241a 100644
@@ -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;
(quoted diff) +0 -0

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

grub-core/loader/efi/linux.c +4 -0
@@ -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)
(quoted diff) +0 -2
-    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		       N_("plain image kernel not supported -

rebuild with CONFIG_(U)EFI_STUB enabled"));

grub-core/loader/efi/linux.c +1 -0
+    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

grub-core/loader/efi/linux.c grub_arch_efi_linux_load_image_header (grub_file_t file, · line 126

Quoted 2 lines
grub-core/loader/efi/linux.c +2 -0
+#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

Quoted 169 lines
grub-core/loader/efi/linux.c +4 -0
+#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)
{

grub-core/loader/efi/linux.c +22 -3
+#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-core/loader/efi/linux.c +6 -0
+       */
+      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"));

grub-core/loader/efi/linux.c +4 -0
+      /* fall through */
+    default:
+      goto fail;
+    }
 
   grub_loader_unset();
(quoted diff) +0 -0

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

grub-core/loader/i386/linux.c +4 -0
@@ -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[]); +

(quoted diff) +2 -0
+extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
+grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char

*argv[]); +#endif

include/grub/efi/efi.h +0 -0
index 444bf5b0b53e31fe..d02abca7da67f787 100644
@@ -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);

#16 lore raw

Re: [PATCH v2 1/6] ia64: Remove support

In reply to John Paul Adrian Glaubitz
Quoted 24 lines · John Paul Adrian Glaubitz

Hello Ard!

Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines
Quoted 4 lines

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.

Quoted 7 lines

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.

Quoted 9 lines

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: [email protected]

It's a relatively new list for cross-distro collaboration/PSAs. You can find the archives here [6].

- Oskari

Quoted 22 lines
Quoted 10 lines

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)

Quoted 8 lines

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.

Quoted 9 lines

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/

Quoted 10 lines
Signature · 9 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#25 lore raw

Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

In reply to Glenn Washburn
Quoted 74 lines · Glenn Washburn
Quoted 70 lines · On Thu, 11 May 2023 14:06:40 +0200 Ard Biesheuvel <[email protected]> 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.

---
 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(-)
grub-core/Makefile.core.def +1 -4
index 8ee2bd89c4205761..bc08955ac791241a 100644
@@ -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;
(quoted diff) +0 -0

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

grub-core/loader/efi/linux.c +4 -0
@@ -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)
(quoted diff) +0 -2
-    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;

Quoted 10 lines

grub-core/loader/efi/linux.c grub_arch_efi_linux_load_image_header (grub_file_t file, · line 126

Quoted 8 lines
   grub_dprintf ("linux", "UEFI stub kernel:\n");
   grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
(quoted diff) +0 -0
@@ -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

grub-core/loader/efi/linux.c +2 -0
+#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.

Quoted 4 lines

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.

Quoted 170 lines
Quoted 170 lines
grub-core/loader/efi/linux.c +4 -0
+#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)
{

grub-core/loader/efi/linux.c +22 -3
+#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-core/loader/efi/linux.c +6 -0
+       */
+      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"));

grub-core/loader/efi/linux.c +4 -0
+      /* fall through */
+    default:
+      goto fail;
+    }
 
   grub_loader_unset();
(quoted diff) +0 -0

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

grub-core/loader/i386/linux.c +4 -0
@@ -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[]); +

(quoted diff) +2 -0
+extern grub_err_t __attribute__((alias("grub_cmd_initrd")))
+grub_cmd_initrd_x86_legacy (grub_command_t cmd, int argc, char

*argv[]); +#endif

include/grub/efi/efi.h +0 -0
index 444bf5b0b53e31fe..d02abca7da67f787 100644
@@ -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);