Author: avg
Date: Sun Jan 20 19:55:49 2013
New Revision: 245697
URL: http://svnweb.freebsd.org/changeset/base/245697

Log:
  zfs/sparc64 boot: fix booting after r242230
  
  arch_zfs_probe method is supposed to only probe for ZFS vdevs, but it can
  not expect that ZFS data is in a ready state yet.
  So, move some code from sparc64_zfs_probe to main to meet the constraints.
  
  Reported by:  Chris Ross <[email protected]>
  Tested by:    Chris Ross <[email protected]>
  MFC after:    4 days

Modified:
  head/sys/boot/sparc64/loader/main.c

Modified: head/sys/boot/sparc64/loader/main.c
==============================================================================
--- head/sys/boot/sparc64/loader/main.c Sun Jan 20 19:44:33 2013        
(r245696)
+++ head/sys/boot/sparc64/loader/main.c Sun Jan 20 19:55:49 2013        
(r245697)
@@ -142,6 +142,10 @@ static vm_offset_t heapva;
 static char bootpath[64];
 static phandle_t root;
 
+#ifdef LOADER_ZFS_SUPPORT
+static struct zfs_devdesc zfs_currdev;
+#endif
+
 /*
  * Machine dependent structures that the machine independent
  * loader part uses.
@@ -732,7 +736,6 @@ static void
 sparc64_zfs_probe(void)
 {
        struct vtoc8 vtoc;
-       struct zfs_devdesc zfs_currdev;
        char alias[64], devname[sizeof(alias) + sizeof(":x") - 1];
        char type[sizeof("device_type")];
        char *bdev, *dev, *odev;
@@ -805,9 +808,6 @@ sparc64_zfs_probe(void)
                zfs_currdev.root_guid = 0;
                zfs_currdev.d_dev = &zfs_dev;
                zfs_currdev.d_type = zfs_currdev.d_dev->dv_type;
-               (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
-                   sizeof(bootpath) - 1);
-               bootpath[sizeof(bootpath) - 1] = '\0';
        }
 }
 #endif /* LOADER_ZFS_SUPPORT */
@@ -878,10 +878,14 @@ main(int (*openfirm)(void *))
                if ((*dp)->dv_init != 0)
                        (*dp)->dv_init();
 
-       /*
-        * Now that sparc64_zfs_probe() might have altered bootpath,
-        * export it.
-        */
+#ifdef LOADER_ZFS_SUPPORT
+       if (zfs_currdev.pool_guid != 0) {
+               (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
+                   sizeof(bootpath) - 1);
+               bootpath[sizeof(bootpath) - 1] = '\0';
+       }
+#endif
+
        env_setenv("currdev", EV_VOLATILE, bootpath,
            ofw_setcurrdev, env_nounset);
        env_setenv("loaddev", EV_VOLATILE, bootpath,
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to