]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Workaround yet another IEEE1275 bug.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 12 Feb 2011 07:22:55 +0000 (10:22 +0300)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 12 Feb 2011 07:22:55 +0000 (10:22 +0300)
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
is set.
* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.

ChangeLog
grub-core/kern/ieee1275/cmain.c
grub-core/kern/ieee1275/mmap.c
include/grub/ieee1275/ieee1275.h

index 3a695b25a67e33d1c54485b7ae684c2a26624459..72d718b083b8d7da9e7dc7dc1ce8d7ab89afdbf3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-02-12  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Workaround yet another IEEE1275 bug.
+
+       * include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
+       GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
+       * grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
+       adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
+       is set.
+       * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
+       GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.
+
 2011-02-12  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/partmap/msdos.c (pc_partition_map_embed): Fix off by one
index 30eacbbddaccb5e02aca70f404aec21d046a1302..2fbe809b23c3288a6737e3ee94572905071f6d65 100644 (file)
@@ -84,6 +84,9 @@ grub_ieee1275_find_options (void)
   if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
     is_qemu = 1;
 
+  if (grub_strncmp (tmp, "PowerMac", sizeof ("PowerMac") - 1) == 0)
+    grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
+
   if (is_smartfirmware)
     {
       /* Broken in all versions */
index 942e5a3548d7e14d0d146dffc03a44d3edd1ddc0..2e4e085bb19e79aa63c14c039a551a1f16fed15e 100644 (file)
@@ -50,6 +50,12 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
                       "couldn't examine /memory/available property");
 
+  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
+    {
+      address_cells = 1;
+      size_cells = 1;
+    }
+
   /* Decode each entry and call `hook'.  */
   i = 0;
   available_size /= sizeof (grub_uint32_t);
index 2592dd348d15740dc52862111aad6de3c193e8b3..4c56cc20f733e74974bac2885d4232cc7c1f2f75 100644 (file)
@@ -106,6 +106,12 @@ enum grub_ieee1275_flag
 
   /* OLPC / XO firmware has the cursor ON/OFF routines.  */
   GRUB_IEEE1275_FLAG_HAS_CURSORONOFF,
+
+  /* Some PowerMacs claim to use 2 address cells but in fact use only 1. 
+     Other PowerMacs claim to use only 1 and really do so. Always assume
+     1 address cell is used on PowerMacs.
+   */
+  GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS,
 };
 
 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);