Blame SOURCES/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch

b35c50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b35c50
From: Daniel Axtens <dja@axtens.net>
b35c50
Date: Mon, 6 Sep 2021 15:46:12 +1000
b35c50
Subject: [PATCH] powerpc: Drop Open Hack'Ware - remove
b35c50
 GRUB_IEEE1275_FLAG_FORCE_CLAIM
b35c50
b35c50
Open Hack'Ware was the only user. It added a lot of complexity.
b35c50
b35c50
Signed-off-by: Daniel Axtens <dja@axtens.net>
b35c50
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b35c50
(cherry picked from commit 333e63b356f1ce833cda1937ed8351618cbdf9d3)
b35c50
---
b35c50
 grub-core/kern/ieee1275/init.c            |  6 +-----
b35c50
 grub-core/lib/ieee1275/relocator.c        |  4 ----
b35c50
 grub-core/loader/powerpc/ieee1275/linux.c | 14 --------------
b35c50
 include/grub/ieee1275/ieee1275.h          | 11 -----------
b35c50
 4 files changed, 1 insertion(+), 34 deletions(-)
b35c50
b35c50
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
b35c50
index 0dcd114ce5..6581c2c996 100644
b35c50
--- a/grub-core/kern/ieee1275/init.c
b35c50
+++ b/grub-core/kern/ieee1275/init.c
b35c50
@@ -207,11 +207,7 @@ grub_claim_heap (void)
b35c50
 {
b35c50
   unsigned long total = 0;
b35c50
 
b35c50
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
b35c50
-    heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN,
b35c50
-	       1, &total);
b35c50
-  else
b35c50
-    grub_machine_mmap_iterate (heap_init, &total);
b35c50
+  grub_machine_mmap_iterate (heap_init, &total);
b35c50
 }
b35c50
 #endif
b35c50
 
b35c50
diff --git a/grub-core/lib/ieee1275/relocator.c b/grub-core/lib/ieee1275/relocator.c
b35c50
index c6dd8facb0..d1bb45c75e 100644
b35c50
--- a/grub-core/lib/ieee1275/relocator.c
b35c50
+++ b/grub-core/lib/ieee1275/relocator.c
b35c50
@@ -38,8 +38,6 @@ grub_relocator_firmware_get_max_events (void)
b35c50
 {
b35c50
   int counter = 0;
b35c50
 
b35c50
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
b35c50
-    return 0;
b35c50
   grub_machine_mmap_iterate (count, &counter);
b35c50
   return 2 * counter;
b35c50
 }
b35c50
@@ -92,8 +90,6 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
b35c50
     .counter = 0
b35c50
   };
b35c50
 
b35c50
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
b35c50
-    return 0;
b35c50
   grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx;;
b35c50
   return ctx.counter;
b35c50
 }
b35c50
diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c
b35c50
index 818b2a86d1..6fdd863130 100644
b35c50
--- a/grub-core/loader/powerpc/ieee1275/linux.c
b35c50
+++ b/grub-core/loader/powerpc/ieee1275/linux.c
b35c50
@@ -111,20 +111,6 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
b35c50
     .found_addr = (grub_addr_t) -1
b35c50
   };
b35c50
 
b35c50
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
b35c50
-    {
b35c50
-      grub_uint64_t addr = target;
b35c50
-      if (addr < GRUB_IEEE1275_STATIC_HEAP_START
b35c50
-	  + GRUB_IEEE1275_STATIC_HEAP_LEN)
b35c50
-	addr = GRUB_IEEE1275_STATIC_HEAP_START
b35c50
-	  + GRUB_IEEE1275_STATIC_HEAP_LEN;
b35c50
-      addr = ALIGN_UP (addr, align);
b35c50
-      if (grub_claimmap (addr, size) == GRUB_ERR_NONE)
b35c50
-	return addr;
b35c50
-      return (grub_addr_t) -1;
b35c50
-    }
b35c50
-	
b35c50
-
b35c50
   grub_machine_mmap_iterate (alloc_mem, &ctx;;
b35c50
 
b35c50
   return ctx.found_addr;
b35c50
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
b35c50
index b5a1d49bbc..6a1d3e5d70 100644
b35c50
--- a/include/grub/ieee1275/ieee1275.h
b35c50
+++ b/include/grub/ieee1275/ieee1275.h
b35c50
@@ -85,14 +85,6 @@ extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
b35c50
 
b35c50
 extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *) GRUB_IEEE1275_ENTRY_FN_ATTRIBUTE;
b35c50
 
b35c50
-/* Static heap, used only if FORCE_CLAIM is set,
b35c50
-   happens on Open Hack'Ware. Should be in platform-specific
b35c50
-   header but is used only on PPC anyway.
b35c50
-*/
b35c50
-#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000
b35c50
-#define GRUB_IEEE1275_STATIC_HEAP_LEN   0x1000000
b35c50
-
b35c50
-
b35c50
 enum grub_ieee1275_flag
b35c50
 {
b35c50
   /* Old World Macintosh firmware fails seek when "dev:0" is opened.  */
b35c50
@@ -119,9 +111,6 @@ enum grub_ieee1275_flag
b35c50
   /* Open Hack'Ware stops when grub_ieee1275_interpret is used.  */
b35c50
   GRUB_IEEE1275_FLAG_CANNOT_INTERPRET,
b35c50
 
b35c50
-  /* Open Hack'Ware has no memory map, just claim what we need.  */
b35c50
-  GRUB_IEEE1275_FLAG_FORCE_CLAIM,
b35c50
-
b35c50
   /* Open Hack'Ware don't support the ANSI sequence.  */
b35c50
   GRUB_IEEE1275_FLAG_NO_ANSI,
b35c50