aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2012-07-27 18:23:11 +0000
committerMarius Strobl <marius@FreeBSD.org>2012-07-27 18:23:11 +0000
commit614e3098036088b1de1073cbc05ef4e001e3cf2c (patch)
tree2610f644090b6159f53ad96b22afa27f8308f45b
parentfe1557c11cbbc1c72dc7ae587f2584e26b4bc9ff (diff)
Notes
-rw-r--r--UPDATING5
-rw-r--r--sys/boot/sparc64/loader/main.c52
2 files changed, 48 insertions, 9 deletions
diff --git a/UPDATING b/UPDATING
index cf580e8ca3de..fc00ae0da05d 100644
--- a/UPDATING
+++ b/UPDATING
@@ -24,6 +24,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
+20120727:
+ The sparc64 ZFS loader has been changed to no longer try to auto-
+ detect ZFS providers based on diskN aliases but now requires these
+ to be explicitly listed in the OFW boot-device environment variable.
+
20120712:
The OpenSSL has been upgraded to 1.0.1c. Any binaries requiring
libcrypto.so.6 or libssl.so.6 must be recompiled. Also, there are
diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c
index 4cbea1746534..9b76f0d46bf6 100644
--- a/sys/boot/sparc64/loader/main.c
+++ b/sys/boot/sparc64/loader/main.c
@@ -7,7 +7,7 @@
* unchanged, you can do what ever you want with this file.
*/
/*-
- * Copyright (c) 2008 Marius Strobl <marius@FreeBSD.org>
+ * Copyright (c) 2008 - 2012 Marius Strobl <marius@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$");
#include "libofw.h"
#include "dev_net.h"
-#define MAXDEV 31
-
extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
enum {
@@ -735,18 +733,52 @@ sparc64_zfs_probe(void)
{
struct vtoc8 vtoc;
struct zfs_devdesc zfs_currdev;
- char devname[32];
+ char alias[64], devname[sizeof(alias) + sizeof(":x") - 1];
+ char type[sizeof("device_type")];
+ char *bdev, *dev, *odev;
uint64_t guid;
- int fd, part, unit;
+ int fd, len, part;
+ phandle_t aliases, options;
/* Get the GUID of the ZFS pool on the boot device. */
guid = 0;
zfs_probe_dev(bootpath, &guid);
- for (unit = 0; unit < MAXDEV; unit++) {
+ /*
+ * Get the GUIDs of the ZFS pools on any additional disks listed in
+ * the boot-device environment variable.
+ */
+ if ((aliases = OF_finddevice("/aliases")) == -1)
+ goto out;
+ options = OF_finddevice("/options");
+ len = OF_getproplen(options, "boot-device");
+ if (len <= 0)
+ goto out;
+ bdev = odev = malloc(len + 1);
+ if (bdev == NULL)
+ goto out;
+ if (OF_getprop(options, "boot-device", bdev, len) <= 0)
+ goto out;
+ bdev[len] = '\0';
+ while ((dev = strsep(&bdev, " ")) != NULL) {
+ if (*dev == '\0')
+ continue;
+ strcpy(alias, dev);
+ (void)OF_getprop(aliases, dev, alias, sizeof(alias));
+ /*
+ * Don't probe the boot disk twice. Note that bootpath
+ * includes the partition specifier.
+ */
+ if (strncmp(alias, bootpath, strlen(alias)) == 0)
+ continue;
+ if (OF_getprop(OF_finddevice(alias), "device_type", type,
+ sizeof(type)) == -1)
+ continue;
+ if (strcmp(type, "block") != 0)
+ continue;
+
/* Find freebsd-zfs slices in the VTOC. */
- sprintf(devname, "disk%d:", unit);
- fd = open(devname, O_RDONLY);
+ fd = open(alias, O_RDONLY);
if (fd == -1)
continue;
lseek(fd, 0, SEEK_SET);
@@ -760,12 +792,14 @@ sparc64_zfs_probe(void)
if (part == 2 || vtoc.part[part].tag !=
VTOC_TAG_FREEBSD_ZFS)
continue;
- sprintf(devname, "disk%d:%c", unit, part + 'a');
+ (void)sprintf(devname, "%s:%c", alias, part + 'a');
if (zfs_probe_dev(devname, NULL) == ENXIO)
break;
}
}
+ free(odev);
+ out:
if (guid != 0) {
zfs_currdev.pool_guid = guid;
zfs_currdev.root_guid = 0;