]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New value
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 May 2010 16:52:13 +0000 (18:52 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 May 2010 16:52:13 +0000 (18:52 +0200)
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM.
* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM on qemu.
* kern/ieee1275/init.c (grub_claim_heap): Don0t allocate below
1.5MiB if GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM is set.

ChangeLog
include/grub/ieee1275/ieee1275.h
kern/ieee1275/cmain.c
kern/ieee1275/init.c

index 6a8b7af7d0825ab6a3fa076156bcf1f78ba5ecbb..c38bf213d34f5ff90b7a8fbddaa57c7041304ef3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-05-05  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New value
+       GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM.
+       * kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
+       GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM on qemu.
+       * kern/ieee1275/init.c (grub_claim_heap): Don0t allocate below
+       1.5MiB if GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM is set.
+
 2010-05-05  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * term/ieee1275/ofconsole.c (grub_ofconsole_getkey): Fix off-by-one
index 2b2c36f8f85965bde0bf74d1e1a843d916429c4c..b30909c68f4dc6169c6a0f46e9d38f74b7572c03 100644 (file)
@@ -100,6 +100,9 @@ enum grub_ieee1275_flag
 
   /* 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,
 };
 
 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
index c1185f82c138e6aa7e70b102dd2671d0d7facc1e..e59d436465c8ef99a7e7a7c327f77caf2c45831f 100644 (file)
@@ -59,6 +59,7 @@ grub_ieee1275_find_options (void)
   char tmp[32];
   int is_smartfirmware = 0;
   int is_olpc = 0;
+  int is_qemu = 0;
 
   grub_ieee1275_finddevice ("/", &root);
   grub_ieee1275_finddevice ("/options", &options);
@@ -79,6 +80,11 @@ grub_ieee1275_find_options (void)
   if (rc >= 0 && !grub_strcmp (tmp, "OLPC"))
     is_olpc = 1;
 
+  rc = grub_ieee1275_get_property (root, "model",
+                                  tmp, sizeof (tmp), 0);
+  if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
+    is_qemu = 1;
+
   if (is_smartfirmware)
     {
       /* Broken in all versions */
@@ -135,6 +141,10 @@ grub_ieee1275_find_options (void)
       grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
     }
 
+  if (is_qemu)
+    /* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB.  */
+    grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM);
+
   if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom))
     {
       rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0);
index 75f261a71b3452720037b42773cf5f181cb0fbe5..b48df37bc5b67f6ed186c6713b395236d25fb038 100644 (file)
@@ -133,6 +133,17 @@ static void grub_claim_heap (void)
     if (type != 1)
       return 0;
 
+    if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM))
+      {
+       if (addr + len <= 0x180000)
+         return 0;
+
+       if (addr < 0x180000)
+         {
+           len = addr + len - 0x180000;
+           addr = 0x180000;
+         }
+      }
     len -= 1; /* Required for some firmware.  */
 
     /* Never exceed HEAP_MAX_SIZE  */