[2524] 2009-08-24 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]> Mon, 24 Aug 2009 13:20:25 +0000
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2524
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2524
Author:   phcoder
Date:     2009-08-24 13:20:24 +0000 (Mon, 24 Aug 2009)
Log Message:
-----------
2009-08-24  Vladimir Serbinenko  <[email protected]>

	Fix OpenBSD and NetBSD support.

	* include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve
	memory address conflict.
	(OPENBSD_MMAP_ACPI): New definition.
	(OPENBSD_MMAP_NVS): Likewise.
	* loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI
	and OPENBSD_MMAP_NVS.
	Add memory map terminator
	Explicit cast when calling grub_unix_real_boot.
	(grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/include/grub/i386/bsd.h
    trunk/grub2/loader/i386/bsd.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-08-24 13:10:12 UTC (rev 2523)
+++ trunk/grub2/ChangeLog	2009-08-24 13:20:24 UTC (rev 2524)
@@ -1,5 +1,19 @@
 2009-08-24  Vladimir Serbinenko  <[email protected]>
 
+	Fix OpenBSD and NetBSD support.
+
+	* include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve
+	memory address conflict.
+	(OPENBSD_MMAP_ACPI): New definition.
+	(OPENBSD_MMAP_NVS): Likewise.
+	* loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI
+	and OPENBSD_MMAP_NVS.
+	Add memory map terminator
+	Explicit cast when calling grub_unix_real_boot.
+	(grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot.
+
+2009-08-24  Vladimir Serbinenko  <[email protected]>
+
 	Let user specify NetBSD root device.
 
 	* loader/i386/bsd.c (netbsd_root): New variable.

Modified: trunk/grub2/include/grub/i386/bsd.h
===================================================================
--- trunk/grub2/include/grub/i386/bsd.h	2009-08-24 13:10:12 UTC (rev 2523)
+++ trunk/grub2/include/grub/i386/bsd.h	2009-08-24 13:20:24 UTC (rev 2524)
@@ -29,7 +29,7 @@
     KERNEL_TYPE_NETBSD,
   };
 
-#define GRUB_BSD_TEMP_BUFFER	0x68000
+#define GRUB_BSD_TEMP_BUFFER   0x80000
 
 #define FREEBSD_RB_ASKNAME	(1 << 0)  /* ask for file name to reboot from */
 #define FREEBSD_RB_SINGLE       (1 << 1)  /* reboot to single user only */
@@ -157,6 +157,8 @@
   grub_uint64_t len;
 #define	OPENBSD_MMAP_AVAILABLE	1
 #define	OPENBSD_MMAP_RESERVED 2
+#define	OPENBSD_MMAP_ACPI	3
+#define	OPENBSD_MMAP_NVS 	4
   grub_uint32_t type;
 };
 

Modified: trunk/grub2/loader/i386/bsd.c
===================================================================
--- trunk/grub2/loader/i386/bsd.c	2009-08-24 13:10:12 UTC (rev 2523)
+++ trunk/grub2/loader/i386/bsd.c	2009-08-24 13:20:24 UTC (rev 2524)
@@ -574,6 +574,14 @@
 	  pm->type = OPENBSD_MMAP_AVAILABLE;
 	  break;
 
+        case GRUB_MACHINE_MEMORY_ACPI:
+	  pm->type = OPENBSD_MMAP_ACPI;
+	  break;
+
+        case GRUB_MACHINE_MEMORY_NVS:
+	  pm->type = OPENBSD_MMAP_NVS;
+	  break;
+
 	default:
 	  pm->type = OPENBSD_MMAP_RESERVED;
 	  break;
@@ -589,6 +597,12 @@
   pm = (struct grub_openbsd_bios_mmap *) (pa + 1);
   grub_mmap_iterate (hook);
 
+  /* Memory map terminator.  */
+  pm->addr = 0;
+  pm->len = 0;
+  pm->type = 0;
+  pm++;
+
   pa->ba_size = (char *) pm - (char *) pa;
   pa->ba_next = (struct grub_openbsd_bootargs *) pm;
   pa = pa->ba_next;
@@ -600,8 +614,8 @@
 	     (part << OPENBSD_B_PARTSHIFT));
 
   grub_unix_real_boot (entry, bootflags, bootdev, OPENBSD_BOOTARG_APIVER,
-		       0, grub_mmap_get_upper () >> 10,
-		       grub_mmap_get_lower () >> 10,
+		       0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
+		       (grub_uint32_t) (grub_mmap_get_lower () >> 10),
 		       (char *) pa - buf, buf);
 
   /* Not reached.  */
@@ -642,8 +656,8 @@
     }
 
   grub_unix_real_boot (entry, bootflags, 0, bootinfo,
-		       0, grub_mmap_get_upper () >> 10,
-		       grub_mmap_get_lower () >> 10);
+		       0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
+		       (grub_uint32_t) (grub_mmap_get_lower () >> 10));
 
   /* Not reached.  */
   return GRUB_ERR_NONE;