]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Remove dead grub_efi_mm_fini.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 16 Oct 2010 15:50:48 +0000 (17:50 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 16 Oct 2010 15:50:48 +0000 (17:50 +0200)
* grub-core/kern/efi/mm.c (allocated_page): Removed.
(ALLOCATED_PAGES_SIZE): Likewise.
(MAX_ALLOCATED_PAGES): Likewise.
(allocated_pages): Likewise.
(grub_efi_allocate_pages): Don't record allocated pages.
(grub_efi_free_pages): Likewise.
(grub_efi_mm_init): Likewise.
(grub_efi_mm_fini): Removed.

ChangeLog
grub-core/kern/efi/mm.c

index 7292b1d3f8857d5e766cb01e34a8cd0bc0415c24..1d72f60f751b2967f66a2c00691d29214cc60970 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-16  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Remove dead grub_efi_mm_fini.
+
+       * grub-core/kern/efi/mm.c (allocated_page): Removed.
+       (ALLOCATED_PAGES_SIZE): Likewise.
+       (MAX_ALLOCATED_PAGES): Likewise.
+       (allocated_pages): Likewise.
+       (grub_efi_allocate_pages): Don't record allocated pages.
+       (grub_efi_free_pages): Likewise.
+       (grub_efi_mm_init): Likewise.
+       (grub_efi_mm_fini): Removed.
+
 2010-10-16  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/kern/efi/mm.c (BYTES_TO_PAGES): Round up instead of down.
index 6205abf9bd2c4e82232bb86d3c1d6ccbedc89864..a715da07637056349b036a0cdf6c90fd5ae06b6a 100644 (file)
    a multiplier of 4KB.  */
 #define MEMORY_MAP_SIZE        0x3000
 
-/* Maintain the list of allocated pages.  */
-struct allocated_page
-{
-  grub_efi_physical_address_t addr;
-  grub_efi_uint64_t num_pages;
-};
-
-#define ALLOCATED_PAGES_SIZE   0x1000
-#define MAX_ALLOCATED_PAGES    \
-  (ALLOCATED_PAGES_SIZE / sizeof (struct allocated_page))
-
-static struct allocated_page *allocated_pages = 0;
-
 /* The minimum and maximum heap size for GRUB itself.  */
 #define MIN_HEAP_SIZE  0x100000
 #define MAX_HEAP_SIZE  (1600 * 0x100000)
@@ -102,22 +89,6 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
        return 0;
     }
 
-  if (allocated_pages)
-    {
-      unsigned i;
-
-      for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
-       if (allocated_pages[i].addr == 0)
-         {
-           allocated_pages[i].addr = address;
-           allocated_pages[i].num_pages = pages;
-           break;
-         }
-
-      if (i == MAX_ALLOCATED_PAGES)
-       grub_fatal ("too many page allocations");
-    }
-
   return (void *) ((grub_addr_t) address);
 }
 
@@ -128,20 +99,6 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
 {
   grub_efi_boot_services_t *b;
 
-  if (allocated_pages
-      && ((grub_efi_physical_address_t) ((grub_addr_t) allocated_pages)
-         != address))
-    {
-      unsigned i;
-
-      for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
-       if (allocated_pages[i].addr == address)
-         {
-           allocated_pages[i].addr = 0;
-           break;
-         }
-    }
-
   b = grub_efi_system_table->boot_services;
   efi_call_2 (b->free_pages, address, pages);
 }
@@ -422,14 +379,6 @@ grub_efi_mm_init (void)
   grub_efi_uint64_t required_pages;
   int mm_status;
 
-  /* First of all, allocate pages to maintain allocations.  */
-  allocated_pages
-    = grub_efi_allocate_pages (0, BYTES_TO_PAGES (ALLOCATED_PAGES_SIZE));
-  if (! allocated_pages)
-    grub_fatal ("cannot allocate memory");
-
-  grub_memset (allocated_pages, 0, ALLOCATED_PAGES_SIZE);
-
   /* Prepare a memory region to store two memory maps.  */
   memory_map = grub_efi_allocate_pages (0,
                                        2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
@@ -502,24 +451,3 @@ grub_efi_mm_init (void)
   grub_efi_free_pages ((grub_addr_t) memory_map,
                       2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
 }
-
-void
-grub_efi_mm_fini (void)
-{
-  if (allocated_pages)
-    {
-      unsigned i;
-
-      for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
-       {
-         struct allocated_page *p;
-
-         p = allocated_pages + i;
-         if (p->addr != 0)
-           grub_efi_free_pages ((grub_addr_t) p->addr, p->num_pages);
-       }
-
-      grub_efi_free_pages ((grub_addr_t) allocated_pages,
-                          BYTES_TO_PAGES (ALLOCATED_PAGES_SIZE));
-    }
-}