summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2019-12-29 21:30:22 +0000
committerkn <kn@cvs.openbsd.org>2019-12-29 21:30:22 +0000
commit99ad85fe597bc1333273dd58cad463d90f6d7d8b (patch)
tree165c5497f306bd0196f4334e16235bea6beed3dc
parent98d63417a5b7186a1cbc1b5c042f36cb5a54f2bf (diff)
Populate logical disk port WWNs with their RAID volume's WWID
On sparc64, booting root devices off hardware RAID volumes requires the port WWN to be set for autoconf(9) to match the disk against the bootpath and therefore identify it as root device. Pointed out by kettenis Input and OK jmatthew
-rw-r--r--sys/dev/pci/mpii.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index ca7331ad132..9a69902c80a 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpii.c,v 1.122 2019/12/28 04:38:22 kn Exp $ */
+/* $OpenBSD: mpii.c,v 1.123 2019/12/29 21:30:21 kn Exp $ */
/*
* Copyright (c) 2010, 2012 Mike Belopuhov
* Copyright (c) 2009 James Giannoules
@@ -910,8 +910,29 @@ mpii_scsi_probe(struct scsi_link *link)
if (ISSET(flags, MPII_DF_HIDDEN) || ISSET(flags, MPII_DF_UNUSED))
return (1);
- if (ISSET(flags, MPII_DF_VOLUME))
+ if (ISSET(flags, MPII_DF_VOLUME)) {
+ struct mpii_cfg_hdr hdr;
+ struct mpii_cfg_raid_vol_pg1 vpg;
+ size_t pagelen;
+
+ address = MPII_CFG_RAID_VOL_ADDR_HANDLE | dev->dev_handle;
+
+ if (mpii_req_cfg_header(sc, MPII_CONFIG_REQ_PAGE_TYPE_RAID_VOL,
+ 1, address, MPII_PG_POLL, &hdr) != 0)
+ return (EINVAL);
+
+ memset(&vpg, 0, sizeof(vpg));
+ /* avoid stack trash on future page growth */
+ pagelen = min(sizeof(vpg), hdr.page_length * 4);
+
+ if (mpii_req_cfg_page(sc, address, MPII_PG_POLL, &hdr, 1,
+ &vpg, pagelen) != 0)
+ return (EINVAL);
+
+ link->port_wwn = letoh64(vpg.wwid);
+
return (0);
+ }
memset(&ehdr, 0, sizeof(ehdr));
ehdr.page_type = MPII_CONFIG_REQ_PAGE_TYPE_EXTENDED;