From 51fe15e2975672156b28514cc440be72cd1c9bd7 Mon Sep 17 00:00:00 2001 From: avg Date: Sun, 20 Jan 2013 19:55:49 +0000 Subject: 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 Tested by: Chris Ross MFC after: 4 days --- sys/boot/sparc64/loader/main.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index fa9d068..5a0badf 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -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, -- cgit v1.1