nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Axtens <dja@axtens.net>
Date: Mon, 6 Sep 2021 15:46:12 +1000
Subject: [PATCH] powerpc: Drop Open Hack'Ware - remove
 GRUB_IEEE1275_FLAG_FORCE_CLAIM

Open Hack'Ware was the only user. It added a lot of complexity.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
(cherry picked from commit 333e63b356f1ce833cda1937ed8351618cbdf9d3)
---
 grub-core/kern/ieee1275/init.c            |  6 +-----
 grub-core/lib/ieee1275/relocator.c        |  4 ----
 grub-core/loader/powerpc/ieee1275/linux.c | 14 --------------
 include/grub/ieee1275/ieee1275.h          | 11 -----------
 4 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 0dcd114ce5..6581c2c996 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -207,11 +207,7 @@ grub_claim_heap (void)
 {
   unsigned long total = 0;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
-    heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN,
-	       1, &total);
-  else
-    grub_machine_mmap_iterate (heap_init, &total);
+  grub_machine_mmap_iterate (heap_init, &total);
 }
 #endif
 
diff --git a/grub-core/lib/ieee1275/relocator.c b/grub-core/lib/ieee1275/relocator.c
index c6dd8facb0..d1bb45c75e 100644
--- a/grub-core/lib/ieee1275/relocator.c
+++ b/grub-core/lib/ieee1275/relocator.c
@@ -38,8 +38,6 @@ grub_relocator_firmware_get_max_events (void)
 {
   int counter = 0;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
-    return 0;
   grub_machine_mmap_iterate (count, &counter);
   return 2 * counter;
 }
@@ -92,8 +90,6 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
     .counter = 0
   };
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
-    return 0;
   grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx);
   return ctx.counter;
 }
diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c
index 818b2a86d1..6fdd863130 100644
--- a/grub-core/loader/powerpc/ieee1275/linux.c
+++ b/grub-core/loader/powerpc/ieee1275/linux.c
@@ -111,20 +111,6 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
     .found_addr = (grub_addr_t) -1
   };
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
-    {
-      grub_uint64_t addr = target;
-      if (addr < GRUB_IEEE1275_STATIC_HEAP_START
-	  + GRUB_IEEE1275_STATIC_HEAP_LEN)
-	addr = GRUB_IEEE1275_STATIC_HEAP_START
-	  + GRUB_IEEE1275_STATIC_HEAP_LEN;
-      addr = ALIGN_UP (addr, align);
-      if (grub_claimmap (addr, size) == GRUB_ERR_NONE)
-	return addr;
-      return (grub_addr_t) -1;
-    }
-	
-
   grub_machine_mmap_iterate (alloc_mem, &ctx);
 
   return ctx.found_addr;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index b5a1d49bbc..6a1d3e5d70 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -85,14 +85,6 @@ extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
 
 extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *) GRUB_IEEE1275_ENTRY_FN_ATTRIBUTE;
 
-/* Static heap, used only if FORCE_CLAIM is set,
-   happens on Open Hack'Ware. Should be in platform-specific
-   header but is used only on PPC anyway.
-*/
-#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000
-#define GRUB_IEEE1275_STATIC_HEAP_LEN   0x1000000
-
-
 enum grub_ieee1275_flag
 {
   /* Old World Macintosh firmware fails seek when "dev:0" is opened.  */
@@ -119,9 +111,6 @@ enum grub_ieee1275_flag
   /* Open Hack'Ware stops when grub_ieee1275_interpret is used.  */
   GRUB_IEEE1275_FLAG_CANNOT_INTERPRET,
 
-  /* Open Hack'Ware has no memory map, just claim what we need.  */
-  GRUB_IEEE1275_FLAG_FORCE_CLAIM,
-
   /* Open Hack'Ware don't support the ANSI sequence.  */
   GRUB_IEEE1275_FLAG_NO_ANSI,