]> git.proxmox.com Git - grub2.git/blobdiff - grub-core/kern/ieee1275/init.c
Add support for modern sparc64 hardware
[grub2.git] / grub-core / kern / ieee1275 / init.c
index 9d163abcd34eab9699bdd722e9a0a5d860d16e21..6e87cada65aee67d97ae08f01cb5a9fb3100198c 100644 (file)
@@ -30,6 +30,9 @@
 #include <grub/time.h>
 #include <grub/ieee1275/console.h>
 #include <grub/ieee1275/ofdisk.h>
+#ifdef __sparc__
+#include <grub/ieee1275/obdisk.h>
+#endif
 #include <grub/ieee1275/ieee1275.h>
 #include <grub/net.h>
 #include <grub/offsets.h>
@@ -103,29 +106,13 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)),
 void
 grub_machine_get_bootlocation (char **device, char **path)
 {
-  char *bootpath;
-  grub_ssize_t bootpath_size;
+  char *bootpath = NULL;
   char *filename;
   char *type;
 
-  if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
-                                        &bootpath_size)
-      || bootpath_size <= 0)
-    {
-      /* Should never happen.  */
-      grub_printf ("/chosen/bootpath property missing!\n");
-      return;
-    }
-
-  bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
-  if (! bootpath)
-    {
-      grub_print_error ();
-      return;
-    }
-  grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
-                              (grub_size_t) bootpath_size + 1, 0);
-  bootpath[bootpath_size] = '\0';
+  grub_ieee1275_get_boot_dev (&bootpath);
+  if (bootpath == NULL)
+    return;
 
   /* Transform an OF device path to a GRUB path.  */
 
@@ -305,8 +292,11 @@ grub_machine_init (void)
   grub_console_init_early ();
   grub_claim_heap ();
   grub_console_init_lately ();
+#ifdef __sparc__
+  grub_obdisk_init ();
+#else
   grub_ofdisk_init ();
-
+#endif
   grub_parse_cmdline ();
 
 #ifdef __i386__
@@ -321,7 +311,11 @@ grub_machine_fini (int flags)
 {
   if (flags & GRUB_LOADER_FLAG_NORETURN)
     {
+#ifdef __sparc__
+      grub_obdisk_fini ();
+#else
       grub_ofdisk_fini ();
+#endif
       grub_console_fini ();
     }
 }