Skip to contentSkip to conversation

powerpc: drop Open Hack'Ware

PATCH In review Daniel Axtens 3 participants 8 messages Sep 6, 2021 – Sep 22, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 powerpc: drop Open Hack'Ware

Open Hack'Ware was an alternative firmware of powerpc under qemu.

The last commit to any Open Hack'Ware repo I can find is from 2014.[1]

Open Hack'Ware was used for the qemu "prep" machine type, which was deprecated in qemu in commit 54c86f5a4844 ("hw/ppc: deprecate the machine type 'prep', replaced by '40p'") in qemu v3.1, and had reportedly been broken for years before without anyone noticing. Support was removed in Feburary 2020 by commit b2ce76a0730e ("hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS").

Open Hack'Ware's limitations require some messy code in grub. This complexity is not worth carrying any more.

Remove detection of Open Hack'Ware. We will clean up the feature flags in following commits.

[1]: https://github.com/qemu/openhackware and
https://repo.or.cz/w/openhackware.git are qemu submodules. They have only small changes on top of OHW v0.4.1, which was imported into qemu SCM in 2010. I can't find anything resembling an official repo any more.

---
 grub-core/kern/ieee1275/cmain.c | 16 ----------------
 1 file changed, 16 deletions(-)
grub-core/kern/ieee1275/cmain.c +0 -16
index 20cbbd761ec3..4442b6a83193 100644
@@ -49,7 +49,6 @@ grub_ieee1275_find_options (void)
   grub_ieee1275_phandle_t root;
   grub_ieee1275_phandle_t options;
   grub_ieee1275_phandle_t openprom;
-  grub_ieee1275_phandle_t bootrom;
   int rc;
   grub_uint32_t realmode = 0;
   char tmp[256];
@@ -190,21 +189,6 @@ grub_ieee1275_find_options (void)
 
       grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_HAS_CURSORONOFF);
     }
-
-  if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom)
-      || ! grub_ieee1275_finddevice ("/boot-rom", &bootrom))
-    {
-      rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0);
-      if (rc >= 0 && !grub_strncmp (tmp, "PPC Open Hack'Ware",
-				    sizeof ("PPC Open Hack'Ware") - 1))
-	{
-	  grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT);
-	  grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS);
-	  grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET);
-	  grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM);
-	  grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_ANSI);
-	}
-    }
 }
 
 void
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/5 powerpc: remove GRUB_IEEE1275_FLAG_FORCE_CLAIM

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

---
 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          | 10 ----------
 4 files changed, 1 insertion(+), 33 deletions(-)
grub-core/kern/ieee1275/init.c +1 -5
index c5d091689f29..8d944dae083e 100644
@@ -205,11 +205,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
 
grub-core/lib/ieee1275/relocator.c +0 -4
index c6dd8facb02a..d1bb45c75e69 100644
@@ -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;
 }
grub-core/loader/powerpc/ieee1275/linux.c +0 -14
index 818b2a86d1ac..6fdd86313083 100644
@@ -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;
include/grub/ieee1275/ieee1275.h +0 -10
index 73e2f4644751..17cfc898e3ee 100644
@@ -85,13 +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
 {
@@ -119,9 +112,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,
 
Signature · 1 line
2.30.2
#2 lore raw

PATCH 3/5 powerpc: remove GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS

In reply to Daniel Axtens

Open Hack'Ware was the only user.

---
 grub-core/term/ieee1275/console.c | 15 ++++++---------
 grub-core/video/ieee1275.c        |  7 +++----
 include/grub/ieee1275/ieee1275.h  |  3 ---
 3 files changed, 9 insertions(+), 16 deletions(-)
grub-core/term/ieee1275/console.c +6 -9
index 7e797a7d4445..ad2574d65086 100644
@@ -171,6 +171,7 @@ static grub_err_t
 grub_console_init_output (struct grub_term_output *term)
 {
   grub_ssize_t actual;
+  unsigned col;
 
   /* The latest PowerMacs don't actually initialize the screen for us, so we
    * use this trick to re-open the output device (but we avoid doing this on
@@ -184,16 +185,12 @@ grub_console_init_output (struct grub_term_output *term)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdout");
 
   /* Initialize colors.  */
-  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
-    {
-      unsigned col;
-      for (col = 0; col < ARRAY_SIZE (colors); col++)
-	grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
-				 colors[col].green, colors[col].blue);
+  for (col = 0; col < ARRAY_SIZE (colors); col++)
+    grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
+			     colors[col].green, colors[col].blue);
 
-      /* Set the right fg and bg colors.  */
-      grub_terminfo_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
-    }
+  /* Set the right fg and bg colors.  */
+  grub_terminfo_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
 
   grub_console_dimensions ();
 
grub-core/video/ieee1275.c +3 -4
index 17a3dbbb5756..f437fb0dfab0 100644
@@ -93,10 +93,9 @@ grub_video_ieee1275_init (void)
 
   grub_memset (&framebuffer, 0, sizeof(framebuffer));
 
-  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS)
-      && !grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
-					      "stdout", &stdout_ihandle,
-					      sizeof (stdout_ihandle), &actual)
+  if (!grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
+					   "stdout", &stdout_ihandle,
+					   sizeof (stdout_ihandle), &actual)
       && actual == sizeof (stdout_ihandle))
     have_setcolors = 1;
 
include/grub/ieee1275/ieee1275.h +0 -3
index 17cfc898e3ee..3d0f21ce1173 100644
@@ -106,9 +106,6 @@ enum grub_ieee1275_flag
   /* OLPC / XO firmware hangs when accessing USB devices.  */
   GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
 
-  /* Open Hack'Ware stops when trying to set colors */
-  GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS,
-
   /* Open Hack'Ware stops when grub_ieee1275_interpret is used.  */
   GRUB_IEEE1275_FLAG_CANNOT_INTERPRET,
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 4/5 powerpc: remove GRUB_IEEE1275_FLAG_CANNOT_INTERPRET

In reply to Daniel Axtens

Open Hack'Ware was the only user.

---
 grub-core/kern/ieee1275/ieee1275.c     |  3 ---
 grub-core/net/drivers/ieee1275/ofnet.c | 12 ------------
 include/grub/ieee1275/ieee1275.h       |  3 ---
 3 files changed, 18 deletions(-)
grub-core/kern/ieee1275/ieee1275.c +0 -3
index 86f81a3c4671..b7cf09c64ca2 100644
@@ -398,9 +398,6 @@ grub_ieee1275_interpret (const char *command, grub_ieee1275_cell_t *catch)
   }
   args;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET))
-    return -1;
-
   INIT_IEEE1275_COMMON (&args.common, "interpret", 1, 1);
   args.command = (grub_ieee1275_cell_t) command;
 
grub-core/net/drivers/ieee1275/ofnet.c +0 -12
index ac4e62a95c95..8f038660228d 100644
@@ -321,12 +321,6 @@ grub_ieee1275_alloc_mem (grub_size_t len)
   }
   args;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET))
-    {
-      grub_error (GRUB_ERR_UNKNOWN_COMMAND, N_("interpret is not supported"));
-      return NULL;
-    }
-
   INIT_IEEE1275_COMMON (&args.common, "interpret", 2, 2);
   args.len = len;
   args.method = (grub_ieee1275_cell_t) "alloc-mem";
@@ -354,12 +348,6 @@ grub_ieee1275_free_mem (void *addr, grub_size_t len)
   }
   args;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET))
-    {
-      grub_error (GRUB_ERR_UNKNOWN_COMMAND, N_("interpret is not supported"));
-      return grub_errno;
-    }
-
   INIT_IEEE1275_COMMON (&args.common, "interpret", 3, 1);
   args.addr = (grub_ieee1275_cell_t)addr;
   args.len = len;
include/grub/ieee1275/ieee1275.h +0 -3
index 3d0f21ce1173..6ce347e1ce30 100644
@@ -106,9 +106,6 @@ enum grub_ieee1275_flag
   /* OLPC / XO firmware hangs when accessing USB devices.  */
   GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
 
-  /* Open Hack'Ware stops when grub_ieee1275_interpret is used.  */
-  GRUB_IEEE1275_FLAG_CANNOT_INTERPRET,
-
   /* Open Hack'Ware don't support the ANSI sequence.  */
   GRUB_IEEE1275_FLAG_NO_ANSI,
 
Signature · 1 line
2.30.2
#4 lore raw

PATCH 5/5 powerpc: remove GRUB_IEEE1275_FLAG_NO_ANSI

In reply to Daniel Axtens

Open Hack'Ware was the only user.

---
 grub-core/term/ieee1275/console.c | 4 +---
 include/grub/ieee1275/ieee1275.h  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)
grub-core/term/ieee1275/console.c +1 -3
index ad2574d65086..0664dfd8a3c3 100644
@@ -248,9 +248,7 @@ grub_console_init_lately (void)
 {
   const char *type;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
-    type = "dumb";
-  else if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
+  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
     type = "ieee1275-nocursor";
   else
     type = "ieee1275";
include/grub/ieee1275/ieee1275.h +0 -3
index 6ce347e1ce30..b24505295bca 100644
@@ -106,9 +106,6 @@ enum grub_ieee1275_flag
   /* OLPC / XO firmware hangs when accessing USB devices.  */
   GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
 
-  /* Open Hack'Ware don't support the ANSI sequence.  */
-  GRUB_IEEE1275_FLAG_NO_ANSI,
-
   /* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB.  */
   GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,
 
Signature · 1 line
2.30.2
#5 lore raw

Re: [PATCH 5/5] powerpc: remove GRUB_IEEE1275_FLAG_NO_ANSI

Any reason to drop OpenHackware?

Quoted 51 lines · Daniel Axtens

Open Hack'Ware was the only user.

---
 grub-core/term/ieee1275/console.c | 4 +---
 include/grub/ieee1275/ieee1275.h  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)
grub-core/term/ieee1275/console.c +1 -3
index ad2574d65086..0664dfd8a3c3 100644
@@ -248,9 +248,7 @@ grub_console_init_lately (void)
 {
   const char *type;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
-    type = "dumb";
-  else if (grub_ieee1275_test_flag
 (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
+  if (grub_ieee1275_test_flag
 (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
     type = "ieee1275-nocursor";
   else
     type = "ieee1275";
include/grub/ieee1275/ieee1275.h +0 -3
index 6ce347e1ce30..b24505295bca 100644
@@ -106,9 +106,6 @@ enum grub_ieee1275_flag
   /* OLPC / XO firmware hangs when accessing USB devices.  */
   GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
 
-  /* Open Hack'Ware don't support the ANSI sequence.  */
-  GRUB_IEEE1275_FLAG_NO_ANSI,
-
   /* OpenFirmware hangs on qemu if one requests any memory below 1.5

MiB. */
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,

--
2.30.2

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

#6 lore raw

Re: [PATCH 5/5] powerpc: remove GRUB_IEEE1275_FLAG_NO_ANSI

Quoted 2 lines · Vladimir 'phcoder' Serbinenko

Any reason to drop OpenHackware?

I've just seen the other mail thread. Will answer there

Quoted 55 lines · Daniel Axtens
Quoted 52 lines

Open Hack'Ware was the only user.

---
 grub-core/term/ieee1275/console.c | 4 +---
 include/grub/ieee1275/ieee1275.h  | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)
grub-core/term/ieee1275/console.c +1 -3
index ad2574d65086..0664dfd8a3c3 100644
@@ -248,9 +248,7 @@ grub_console_init_lately (void)
 {
   const char *type;
 
-  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
-    type = "dumb";
-  else if (grub_ieee1275_test_flag
 (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
+  if (grub_ieee1275_test_flag
 (GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN))
     type = "ieee1275-nocursor";
   else
     type = "ieee1275";
include/grub/ieee1275/ieee1275.h +0 -3
index 6ce347e1ce30..b24505295bca 100644
@@ -106,9 +106,6 @@ enum grub_ieee1275_flag
   /* OLPC / XO firmware hangs when accessing USB devices.  */
   GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY,
 
-  /* Open Hack'Ware don't support the ANSI sequence.  */
-  GRUB_IEEE1275_FLAG_NO_ANSI,
-
   /* OpenFirmware hangs on qemu if one requests any memory below 1.5

MiB. */
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,

--
2.30.2

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

#7 lore raw
In reply to Daniel Axtens
Quoted 17 lines · Daniel Axtens

Open Hack'Ware was an alternative firmware of powerpc under qemu.

The last commit to any Open Hack'Ware repo I can find is from 2014.[1]

Open Hack'Ware was used for the qemu "prep" machine type, which was deprecated in qemu in commit 54c86f5a4844 ("hw/ppc: deprecate the machine type 'prep', replaced by '40p'") in qemu v3.1, and had reportedly been broken for years before without anyone noticing. Support was removed in Feburary 2020 by commit b2ce76a0730e ("hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS").

Open Hack'Ware's limitations require some messy code in grub. This complexity is not worth carrying any more.

Remove detection of Open Hack'Ware. We will clean up the feature flags in following commits.

Quoted 7 lines

[1]: https://github.com/qemu/openhackware and
https://repo.or.cz/w/openhackware.git are qemu submodules. They have only small changes on top of OHW v0.4.1, which was imported into qemu SCM in 2010. I can't find anything resembling an official repo any more.

For all the patches: Reviewed-by: Daniel Kiper <[email protected]>

I agreed Open Hack'Ware removal with Vladimir.

Daniel