diff mbox series

[v2,12/14] arm: delete unused efi support from loader/arm

Message ID 20170803100432.29913-13-leif.lindholm@linaro.org
State Superseded
Headers show
Series efi: improved correctness, arm unification, and cleanup | expand

Commit Message

Leif Lindholm Aug. 3, 2017, 10:04 a.m. UTC
The 32-bit arm efi port now shares the 64-bit linux loader, so delete
the now unused bits from the 32-bit linux loader.

This in turn leaves the grub-core/kern/arm/efi/misc.c unused, so
delete that too.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 grub-core/Makefile.am         |   1 -
 grub-core/kern/arm/efi/misc.c | 202 ------------------------------------------
 grub-core/loader/arm/linux.c  |  28 ------
 include/grub/arm/efi/loader.h |  26 ------
 include/grub/arm/linux.h      |  16 ----
 5 files changed, 273 deletions(-)
 delete mode 100644 grub-core/kern/arm/efi/misc.c
 delete mode 100644 include/grub/arm/efi/loader.h

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Vladimir 'phcoder' Serbinenko Aug. 7, 2017, 2:09 p.m. UTC | #1
LGTM

Le Thu, Aug 3, 2017 à 12:11 PM, Leif Lindholm <leif.lindholm@linaro.org> a
écrit :

> The 32-bit arm efi port now shares the 64-bit linux loader, so delete

> the now unused bits from the 32-bit linux loader.

>

> This in turn leaves the grub-core/kern/arm/efi/misc.c unused, so

> delete that too.

>

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---

>  grub-core/Makefile.am         |   1 -

>  grub-core/kern/arm/efi/misc.c | 202

> ------------------------------------------

>  grub-core/loader/arm/linux.c  |  28 ------

>  include/grub/arm/efi/loader.h |  26 ------

>  include/grub/arm/linux.h      |  16 ----

>  5 files changed, 273 deletions(-)

>  delete mode 100644 grub-core/kern/arm/efi/misc.c

>  delete mode 100644 include/grub/arm/efi/loader.h

>

> diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am

> index 622f946f5..cd3424c07 100644

> --- a/grub-core/Makefile.am

> +++ b/grub-core/Makefile.am

> @@ -256,7 +256,6 @@ KERNEL_HEADER_FILES +=

> $(top_srcdir)/include/grub/fdtbus.h

>  endif

>

>  if COND_arm_efi

> -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h

>  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/arm/system.h

> diff --git a/grub-core/kern/arm/efi/misc.c b/grub-core/kern/arm/efi/misc.c

> deleted file mode 100644

> index 7cd41842a..000000000

> --- a/grub-core/kern/arm/efi/misc.c

> +++ /dev/null

> @@ -1,202 +0,0 @@

> -/* misc.c - various system functions for an arm-based EFI system */

> -/*

> - *  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/>.

> - */

> -

> -#include <grub/misc.h>

> -#include <grub/mm.h>

> -#include <grub/cpu/linux.h>

> -#include <grub/cpu/system.h>

> -#include <grub/efi/efi.h>

> -#include <grub/machine/loader.h>

> -

> -static inline grub_size_t

> -page_align (grub_size_t size)

> -{

> -  return (size + (1 << 12) - 1) & (~((1 << 12) - 1));

> -}

> -

> -/* Find the optimal number of pages for the memory map. Is it better to

> -   move this code to efi/mm.c?  */

> -static grub_efi_uintn_t

> -find_mmap_size (void)

> -{

> -  static grub_efi_uintn_t mmap_size = 0;

> -

> -  if (mmap_size != 0)

> -    return mmap_size;

> -

> -  mmap_size = (1 << 12);

> -  while (1)

> -    {

> -      int ret;

> -      grub_efi_memory_descriptor_t *mmap;

> -      grub_efi_uintn_t desc_size;

> -

> -      mmap = grub_malloc (mmap_size);

> -      if (! mmap)

> -       return 0;

> -

> -      ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0);

> -      grub_free (mmap);

> -

> -      if (ret < 0)

> -       {

> -         grub_error (GRUB_ERR_IO, "cannot get memory map");

> -         return 0;

> -       }

> -      else if (ret > 0)

> -       break;

> -

> -      mmap_size += (1 << 12);

> -    }

> -

> -  /* Increase the size a bit for safety, because GRUB allocates more on

> -     later, and EFI itself may allocate more.  */

> -  mmap_size += (1 << 12);

> -

> -  return page_align (mmap_size);

> -}

> -

> -#define NEXT_MEMORY_DESCRIPTOR(desc, size)      \

> -  ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))

> -#define PAGE_SHIFT 12

> -

> -void *

> -grub_efi_allocate_loader_memory (grub_uint32_t min_offset, grub_uint32_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;

> -  grub_addr_t min_start = 0;

> -

> -  mmap_size = find_mmap_size();

> -  if (!mmap_size)

> -    return NULL;

> -

> -  mmap = grub_malloc(mmap_size);

> -  if (!mmap)

> -    return NULL;

> -

> -  tmp_mmap_size = mmap_size;

> -  if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <=

> 0)

> -    {

> -      grub_error (GRUB_ERR_IO, "cannot get memory map");

> -      goto fail;

> -    }

> -

> -  mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size);

> -  /* Find lowest accessible RAM location */

> -  {

> -    int found = 0;

> -    for (desc = mmap ; !found && (desc < mmap_end) ;

> -        desc = NEXT_MEMORY_DESCRIPTOR(desc, desc_size))

> -      {

> -       switch (desc->type)

> -         {

> -         case GRUB_EFI_CONVENTIONAL_MEMORY:

> -         case GRUB_EFI_LOADER_CODE:

> -         case GRUB_EFI_LOADER_DATA:

> -           min_start = desc->physical_start + min_offset;

> -           found = 1;

> -           break;

> -         default:

> -           break;

> -         }

> -      }

> -  }

> -

> -  /* 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_dprintf("mm", "%s: 0x%08x bytes @ 0x%08x\n",

> -                  __FUNCTION__,

> -                  (grub_uint32_t) (desc->num_pages << PAGE_SHIFT),

> -                  (grub_uint32_t) (desc->physical_start));

> -

> -      if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)

> -       continue;

> -

> -      start = desc->physical_start;

> -      end = start + (desc->num_pages << PAGE_SHIFT);

> -      grub_dprintf("mm", "%s: start=0x%016llx, end=0x%016llx\n",

> -                 __FUNCTION__, start, end);

> -      start = start < min_start ? min_start : start;

> -      if (start + size > end)

> -       continue;

> -      grub_dprintf("mm", "%s: let's allocate some (0x%x) pages @

> 0x%08x...\n",

> -                 __FUNCTION__, (size >> PAGE_SHIFT), (grub_addr_t) start);

> -      mem = grub_efi_allocate_pages (start, (size >> PAGE_SHIFT) + 1);

> -      grub_dprintf("mm", "%s: retval=0x%08x\n",

> -                  __FUNCTION__, (grub_addr_t) mem);

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

> -  return NULL;

> -}

> -

> -grub_err_t

> -grub_efi_prepare_platform (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;

> -

> -  /*

> -   * Cloned from IA64

> -   * Must be done after grub_machine_fini because map_key is used by

> -   *exit_boot_services.

> -   */

> -  mmap_size = find_mmap_size ();

> -  if (! mmap_size)

> -    return GRUB_ERR_OUT_OF_MEMORY;

> -  mmap_buf = grub_efi_allocate_pages (0, page_align (mmap_size) >> 12);

> -  if (! mmap_buf)

> -    return GRUB_ERR_OUT_OF_MEMORY;

> -

> -  err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key,

> -                                      &desc_size, &desc_version);

> -  if (err != GRUB_ERR_NONE)

> -    return err;

> -

> -  return GRUB_ERR_NONE;

> -}

> diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c

> index 067f69894..e563eca95 100644

> --- a/grub-core/loader/arm/linux.c

> +++ b/grub-core/loader/arm/linux.c

> @@ -290,15 +290,6 @@ linux_boot (void)

>     */

>    linuxmain = (kernel_entry_t) linux_addr;

>

> -#ifdef GRUB_MACHINE_EFI

> -  {

> -    grub_err_t err;

> -    err = grub_efi_prepare_platform();

> -    if (err != GRUB_ERR_NONE)

> -      return err;

> -  }

> -#endif

> -

>    grub_arm_disable_caches_mmu ();

>

>    linuxmain (0, machine_type, target_fdt);

> @@ -317,13 +308,7 @@ linux_load (const char *filename, grub_file_t file)

>

>    size = grub_file_size (file);

>

> -#ifdef GRUB_MACHINE_EFI

> -  linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory

> (LINUX_PHYS_OFFSET, size);

> -  if (!linux_addr)

> -    return grub_errno;

> -#else

>    linux_addr = LINUX_ADDRESS;

> -#endif

>    grub_dprintf ("loader", "Loading Linux to 0x%08x\n",

>                 (grub_addr_t) linux_addr);

>

> @@ -428,20 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__

> ((unused)),

>

>    size = grub_get_initrd_size (&initrd_ctx);

>

> -#ifdef GRUB_MACHINE_EFI

> -  if (initrd_start)

> -    grub_efi_free_pages (initrd_start,

> -                        (initrd_end - initrd_start + 0xfff) >> 12);

> -  initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory

> (LINUX_INITRD_PHYS_OFFSET, size);

> -

> -  if (!initrd_start)

> -    {

> -      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));

> -      goto fail;

> -    }

> -#else

>    initrd_start = LINUX_INITRD_ADDRESS;

> -#endif

>

>    grub_dprintf ("loader", "Loading initrd to 0x%08x\n",

>                 (grub_addr_t) initrd_start);

> diff --git a/include/grub/arm/efi/loader.h b/include/grub/arm/efi/loader.h

> deleted file mode 100644

> index 4bab18e83..000000000

> --- a/include/grub/arm/efi/loader.h

> +++ /dev/null

> @@ -1,26 +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_LOADER_MACHINE_HEADER

> -#define GRUB_LOADER_MACHINE_HEADER     1

> -

> -grub_err_t EXPORT_FUNC (grub_efi_prepare_platform) (void);

> -void * EXPORT_FUNC (grub_efi_allocate_loader_memory) (grub_uint32_t

> min_offset,

> -                                                     grub_uint32_t size);

> -

> -#endif /* ! GRUB_LOADER_MACHINE_HEADER */

> diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> index 802090239..758e97d72 100644

> --- a/include/grub/arm/linux.h

> +++ b/include/grub/arm/linux.h

> @@ -41,20 +41,6 @@ struct grub_linux_kernel_header {

>  # define LINUX_FDT_ADDRESS    (LINUX_INITRD_ADDRESS - 0x10000)

>  # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data

>  # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type

> -#elif defined GRUB_MACHINE_EFI

> -# include <grub/efi/efi.h>

> -# include <grub/machine/loader.h>

> -/* On UEFI platforms - load the images at the lowest available address not

> -   less than *_PHYS_OFFSET from the first available memory location. */

> -# define LINUX_PHYS_OFFSET        (0x00008000)

> -# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)

> -# define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)

> -# define grub_arm_firmware_get_boot_data

> (grub_addr_t)grub_efi_get_firmware_fdt

> -static inline grub_uint32_t

> -grub_arm_firmware_get_machine_type (void)

> -{

> -  return GRUB_ARM_MACHINE_TYPE_FDT;

> -}

>  #elif defined (GRUB_MACHINE_COREBOOT)

>  #include <grub/fdtbus.h>

>  #include <grub/machine/kernel.h>

> @@ -73,6 +59,4 @@ grub_arm_firmware_get_machine_type (void)

>  }

>  #endif

>

> -#define FDT_ADDITIONAL_ENTRIES_SIZE    0x300

> -

>  #endif /* ! GRUB_LINUX_CPU_HEADER */

> --

> 2.11.0

>

>

> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
diff mbox series

Patch

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 622f946f5..cd3424c07 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -256,7 +256,6 @@  KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h
 endif
 
 if COND_arm_efi
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
 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/arm/system.h
diff --git a/grub-core/kern/arm/efi/misc.c b/grub-core/kern/arm/efi/misc.c
deleted file mode 100644
index 7cd41842a..000000000
--- a/grub-core/kern/arm/efi/misc.c
+++ /dev/null
@@ -1,202 +0,0 @@ 
-/* misc.c - various system functions for an arm-based EFI system */
-/*
- *  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/>.
- */
-
-#include <grub/misc.h>
-#include <grub/mm.h>
-#include <grub/cpu/linux.h>
-#include <grub/cpu/system.h>
-#include <grub/efi/efi.h>
-#include <grub/machine/loader.h>
-
-static inline grub_size_t
-page_align (grub_size_t size)
-{
-  return (size + (1 << 12) - 1) & (~((1 << 12) - 1));
-}
-
-/* Find the optimal number of pages for the memory map. Is it better to
-   move this code to efi/mm.c?  */
-static grub_efi_uintn_t
-find_mmap_size (void)
-{
-  static grub_efi_uintn_t mmap_size = 0;
-
-  if (mmap_size != 0)
-    return mmap_size;
-  
-  mmap_size = (1 << 12);
-  while (1)
-    {
-      int ret;
-      grub_efi_memory_descriptor_t *mmap;
-      grub_efi_uintn_t desc_size;
-      
-      mmap = grub_malloc (mmap_size);
-      if (! mmap)
-	return 0;
-
-      ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0);
-      grub_free (mmap);
-      
-      if (ret < 0)
-	{
-	  grub_error (GRUB_ERR_IO, "cannot get memory map");
-	  return 0;
-	}
-      else if (ret > 0)
-	break;
-
-      mmap_size += (1 << 12);
-    }
-
-  /* Increase the size a bit for safety, because GRUB allocates more on
-     later, and EFI itself may allocate more.  */
-  mmap_size += (1 << 12);
-
-  return page_align (mmap_size);
-}
-
-#define NEXT_MEMORY_DESCRIPTOR(desc, size)      \
-  ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
-#define PAGE_SHIFT 12
-
-void *
-grub_efi_allocate_loader_memory (grub_uint32_t min_offset, grub_uint32_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;
-  grub_addr_t min_start = 0;
-
-  mmap_size = find_mmap_size();
-  if (!mmap_size)
-    return NULL;
-
-  mmap = grub_malloc(mmap_size);
-  if (!mmap)
-    return NULL;
-
-  tmp_mmap_size = mmap_size;
-  if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <= 0)
-    {
-      grub_error (GRUB_ERR_IO, "cannot get memory map");
-      goto fail;
-    }
-
-  mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size);
-  /* Find lowest accessible RAM location */
-  {
-    int found = 0;
-    for (desc = mmap ; !found && (desc < mmap_end) ;
-	 desc = NEXT_MEMORY_DESCRIPTOR(desc, desc_size))
-      {
-	switch (desc->type)
-	  {
-	  case GRUB_EFI_CONVENTIONAL_MEMORY:
-	  case GRUB_EFI_LOADER_CODE:
-	  case GRUB_EFI_LOADER_DATA:
-	    min_start = desc->physical_start + min_offset;
-	    found = 1;
-	    break;
-	  default:
-	    break;
-	  }
-      }
-  }
-
-  /* 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_dprintf("mm", "%s: 0x%08x bytes @ 0x%08x\n",
-		   __FUNCTION__,
-		   (grub_uint32_t) (desc->num_pages << PAGE_SHIFT),
-		   (grub_uint32_t) (desc->physical_start));
-
-      if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
-	continue;
-
-      start = desc->physical_start;
-      end = start + (desc->num_pages << PAGE_SHIFT);
-      grub_dprintf("mm", "%s: start=0x%016llx, end=0x%016llx\n",
-		  __FUNCTION__, start, end);
-      start = start < min_start ? min_start : start;
-      if (start + size > end)
-	continue;
-      grub_dprintf("mm", "%s: let's allocate some (0x%x) pages @ 0x%08x...\n",
-		  __FUNCTION__, (size >> PAGE_SHIFT), (grub_addr_t) start);
-      mem = grub_efi_allocate_pages (start, (size >> PAGE_SHIFT) + 1);
-      grub_dprintf("mm", "%s: retval=0x%08x\n",
-		   __FUNCTION__, (grub_addr_t) mem);
-      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);
-  return NULL;
-}
-
-grub_err_t
-grub_efi_prepare_platform (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;
-
-  /*
-   * Cloned from IA64
-   * Must be done after grub_machine_fini because map_key is used by
-   *exit_boot_services.
-   */
-  mmap_size = find_mmap_size ();
-  if (! mmap_size)
-    return GRUB_ERR_OUT_OF_MEMORY;
-  mmap_buf = grub_efi_allocate_pages (0, page_align (mmap_size) >> 12);
-  if (! mmap_buf)
-    return GRUB_ERR_OUT_OF_MEMORY;
-
-  err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key,
-				       &desc_size, &desc_version);
-  if (err != GRUB_ERR_NONE)
-    return err;
-
-  return GRUB_ERR_NONE;
-}
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index 067f69894..e563eca95 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -290,15 +290,6 @@  linux_boot (void)
    */
   linuxmain = (kernel_entry_t) linux_addr;
 
-#ifdef GRUB_MACHINE_EFI
-  {
-    grub_err_t err;
-    err = grub_efi_prepare_platform();
-    if (err != GRUB_ERR_NONE)
-      return err;
-  }
-#endif
-
   grub_arm_disable_caches_mmu ();
 
   linuxmain (0, machine_type, target_fdt);
@@ -317,13 +308,7 @@  linux_load (const char *filename, grub_file_t file)
 
   size = grub_file_size (file);
 
-#ifdef GRUB_MACHINE_EFI
-  linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_PHYS_OFFSET, size);
-  if (!linux_addr)
-    return grub_errno;
-#else
   linux_addr = LINUX_ADDRESS;
-#endif
   grub_dprintf ("loader", "Loading Linux to 0x%08x\n",
 		(grub_addr_t) linux_addr);
 
@@ -428,20 +413,7 @@  grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   size = grub_get_initrd_size (&initrd_ctx);
 
-#ifdef GRUB_MACHINE_EFI
-  if (initrd_start)
-    grub_efi_free_pages (initrd_start,
-			 (initrd_end - initrd_start + 0xfff) >> 12);
-  initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_INITRD_PHYS_OFFSET, size);
-
-  if (!initrd_start)
-    {
-      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
-      goto fail;
-    }
-#else
   initrd_start = LINUX_INITRD_ADDRESS;
-#endif
 
   grub_dprintf ("loader", "Loading initrd to 0x%08x\n",
 		(grub_addr_t) initrd_start);
diff --git a/include/grub/arm/efi/loader.h b/include/grub/arm/efi/loader.h
deleted file mode 100644
index 4bab18e83..000000000
--- a/include/grub/arm/efi/loader.h
+++ /dev/null
@@ -1,26 +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_LOADER_MACHINE_HEADER
-#define GRUB_LOADER_MACHINE_HEADER	1
-
-grub_err_t EXPORT_FUNC (grub_efi_prepare_platform) (void);
-void * EXPORT_FUNC (grub_efi_allocate_loader_memory) (grub_uint32_t min_offset,
-						      grub_uint32_t size);
-
-#endif /* ! GRUB_LOADER_MACHINE_HEADER */
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index 802090239..758e97d72 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -41,20 +41,6 @@  struct grub_linux_kernel_header {
 # define LINUX_FDT_ADDRESS    (LINUX_INITRD_ADDRESS - 0x10000)
 # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
 # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
-#elif defined GRUB_MACHINE_EFI
-# include <grub/efi/efi.h>
-# include <grub/machine/loader.h>
-/* On UEFI platforms - load the images at the lowest available address not
-   less than *_PHYS_OFFSET from the first available memory location. */
-# define LINUX_PHYS_OFFSET        (0x00008000)
-# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
-# define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)
-# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
-static inline grub_uint32_t
-grub_arm_firmware_get_machine_type (void)
-{
-  return GRUB_ARM_MACHINE_TYPE_FDT;
-}
 #elif defined (GRUB_MACHINE_COREBOOT)
 #include <grub/fdtbus.h>
 #include <grub/machine/kernel.h>
@@ -73,6 +59,4 @@  grub_arm_firmware_get_machine_type (void)
 }
 #endif
 
-#define FDT_ADDITIONAL_ENTRIES_SIZE	0x300
-
 #endif /* ! GRUB_LINUX_CPU_HEADER */