From 9e3f8ddd832ee8ee0db731e116ea798a1da5c7e7 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 3 Mar 2022 19:10:14 +0000 Subject: r1.241 was the culprit. Unrevert r1.240. --- sys/scsi/scsiconf.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 6bee581f30c..22742df798f 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.242 2022/03/03 16:52:07 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.243 2022/03/03 19:10:13 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -75,7 +75,8 @@ int scsibussubprint(void *, const char *); int scsibusbioctl(struct device *, u_long, caddr_t); #endif /* NBIO > 0 */ -void scsi_get_target_luns(struct scsi_link *, struct scsi_lun_array *); +void scsi_get_target_luns(struct scsibus_softc *, int, + struct scsi_lun_array *); void scsi_add_link(struct scsi_link *); void scsi_remove_link(struct scsi_link *); void scsi_print_link(struct scsi_link *); @@ -441,18 +442,15 @@ int scsi_probe_target(struct scsibus_softc *sb, int target) { struct scsi_lun_array lunarray; - struct scsi_link *link0; int i, r, rv = 0; if (target < 0 || target == sb->sb_adapter_target) return EINVAL; - /* Probe all possible luns on target. */ - scsi_probe_link(sb, target, 0, 0); - link0 = scsi_get_link(sb, target, 0); - if (link0 == NULL) + scsi_get_target_luns(sb, target, &lunarray); + if (lunarray.count == 0) return EINVAL; - scsi_get_target_luns(link0, &lunarray); + for (i = 0; i < lunarray.count; i++) { r = scsi_probe_link(sb, target, lunarray.luns[i], lunarray.dumbscan); @@ -862,11 +860,21 @@ scsi_remove_link(struct scsi_link *link) } void -scsi_get_target_luns(struct scsi_link *link0, struct scsi_lun_array *lunarray) +scsi_get_target_luns(struct scsibus_softc *sb, int target, + struct scsi_lun_array *lunarray) { struct scsi_report_luns_data *report; + struct scsi_link *link0; int i, nluns, rv = 0; + /* LUN 0 *must* be present. */ + scsi_probe_link(sb, target, 0, 0); + link0 = scsi_get_link(sb, target, 0); + if (link0 == NULL) { + lunarray->count = 0; + return; + } + /* Initialize dumbscan result. Just in case. */ report = NULL; for (i = 0; i < link0->bus->sb_luns; i++) -- cgit v1.2.3