Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix off-by-one SCSI target reporting



details:   https://anonhg.NetBSD.org/src/rev/49e967471681
branches:  trunk
changeset: 1011802:49e967471681
user:      kim <kim%NetBSD.org@localhost>
date:      Sun Jul 12 06:40:11 2020 +0000

description:
Fix off-by-one SCSI target reporting

Use max_target as the controller ID instead of zero, so that the device
located at SCSI ID zero (e.g. a disk) is not obscured through not being
probed by scsi_probe_bus() (which skips the controller ID).

Copy the target requested onto the wire without decrementing it by one.

ok christos@

diffstat:

 sys/dev/pci/vioscsi.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r dceeb6b42e5d -r 49e967471681 sys/dev/pci/vioscsi.c
--- a/sys/dev/pci/vioscsi.c     Sun Jul 12 06:38:56 2020 +0000
+++ b/sys/dev/pci/vioscsi.c     Sun Jul 12 06:40:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vioscsi.c,v 1.21 2019/04/13 06:17:33 maxv Exp $        */
+/*     $NetBSD: vioscsi.c,v 1.22 2020/07/12 06:40:11 kim Exp $ */
 /*     $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.21 2019/04/13 06:17:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.22 2020/07/12 06:40:11 kim Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -194,7 +194,7 @@
        chan->chan_channel = 0;
        chan->chan_ntargets = MIN(max_target, 16);      /* cap reasonably */
        chan->chan_nluns = MIN(max_lun, 1024);          /* cap reasonably */
-       chan->chan_id = 0;
+       chan->chan_id = max_target;
        chan->chan_flags = SCSIPI_CHAN_NOSETTLE;
 
        config_found(self, &sc->sc_channel, scsiprint);
@@ -318,7 +318,7 @@
        }
 
        req->lun[0] = 1;
-       req->lun[1] = periph->periph_target - 1;
+       req->lun[1] = periph->periph_target;
        req->lun[2] = 0x40 | ((periph->periph_lun >> 8) & 0x3F);
        req->lun[3] = periph->periph_lun & 0xFF;
        memset(req->lun + 4, 0, 4);



Home | Main Index | Thread Index | Old Index