diff options
author | avg <avg@FreeBSD.org> | 2013-01-20 19:55:49 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2013-01-20 19:55:49 +0000 |
commit | 51fe15e2975672156b28514cc440be72cd1c9bd7 (patch) | |
tree | 53a57f0974fff24647bf6aeced6f5edbf8878173 /sys/boot/sparc64 | |
parent | 368bd87849c4a2f2a7b253c353dfb4100b29c7c9 (diff) | |
download | FreeBSD-src-51fe15e2975672156b28514cc440be72cd1c9bd7.zip FreeBSD-src-51fe15e2975672156b28514cc440be72cd1c9bd7.tar.gz |
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 <cross+freebsd@distal.com>
Tested by: Chris Ross <cross+freebsd@distal.com>
MFC after: 4 days
Diffstat (limited to 'sys/boot/sparc64')
-rw-r--r-- | sys/boot/sparc64/loader/main.c | 20 |
1 files 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, |