]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/ieee1275/ieee1275.h: Introduce flag for firmwares
authorproski <proski@localhost>
Thu, 24 Jan 2008 08:21:43 +0000 (08:21 +0000)
committerproski <proski@localhost>
Thu, 24 Jan 2008 08:21:43 +0000 (08:21 +0000)
that hang if GRUB tries to setup colors.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
colors for firmwares that don't support it.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
Recognize Open Hack'Ware, set flags to work around its
limitations.

ChangeLog
include/grub/ieee1275/ieee1275.h
kern/powerpc/ieee1275/cmain.c
term/ieee1275/ofconsole.c

index 6450ebe8f30433045af7bbb83665921c9460c504..75e91fd538b1a1cf8e7204167561b1012577eec7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-24  Pavel Roskin  <proski@gnu.org>
+
+       * include/grub/ieee1275/ieee1275.h: Introduce flag for firmwares
+       that hang if GRUB tries to setup colors.
+       * term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
+       colors for firmwares that don't support it.
+       * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
+       Recognize Open Hack'Ware, set flags to work around its
+       limitations.
+
 2008-01-24  Robert Millan  <rmh@aybabtu.com>
 
        * kern/file.c (grub_file_open): Do not account previous failures of
index 008a114f6147974681c2a8f7ba957bb54eb74429..463180dca649797816c8543177331058cede97bc 100644 (file)
@@ -86,6 +86,9 @@ 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,
 };
 
 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
index 2b7cce56c6f6a4bc8ac4ddccf63324592ae53a4b..0a3a2a5c7e8b314953ccf44b5b05a45ef5676b3d 100644 (file)
@@ -46,12 +46,16 @@ grub_ieee1275_set_flag (enum grub_ieee1275_flag flag)
   grub_ieee1275_flags |= (1 << flag);
 }
 
+#define SF "SmartFirmware(tm)"
+#define OHW "PPC Open Hack'Ware"
+
 static void
 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;
   int realmode = 0;
   char tmp[32];
@@ -69,7 +73,6 @@ grub_ieee1275_find_options (void)
 
   rc = grub_ieee1275_get_property (openprom, "CodeGen-copyright",
                                   tmp, sizeof (tmp), 0);
-#define SF "SmartFirmware(tm)"
   if (rc >= 0 && !grub_strncmp (tmp, SF, sizeof (SF) - 1))
     is_smartfirmware = 1;
 
@@ -133,8 +136,21 @@ grub_ieee1275_find_options (void)
 
       grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
     }
+
+  if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom))
+    {
+      rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0);
+      if (rc >= 0 && !grub_strncmp (tmp, OHW, sizeof (OHW) - 1))
+       {
+         grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT);
+         grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS);
+       }
+    }
 }
 
+#undef SF
+#undef OHW
+
 void cmain (void);
 void
 cmain (void)
index dbd0b6e974a84578eb4329c6220a4dc5be96c09f..b44950749dfb7a12a57df68014e03a4f88953203 100644 (file)
@@ -333,12 +333,15 @@ grub_ofconsole_init (void)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
   /* Initialize colors.  */
-  for (col = 0; col < 7; col++)
-    grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
-                            colors[col].green, colors[col].blue);
+  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
+    {
+      for (col = 0; col < 7; 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_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+    /* Set the right fg and bg colors.  */
+      grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+    }
 
   return 0;
 }