Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci It seems that a logical volume number and the ta...



details:   https://anonhg.NetBSD.org/src/rev/85a7cecc9a4e
branches:  trunk
changeset: 368498:85a7cecc9a4e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sat Jul 16 07:13:03 2022 +0000

description:
It seems that a logical volume number and the target ID is different
on newer systems. It's observed on an Aero. Add sc->sc_ld[X].ld_target_id
to keep the target ID and use it for scsipi layer. Now sdX is attached
on Aero system. Tested by Mark Davies.

diffstat:

 sys/dev/pci/mfii.c |  24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diffs (87 lines):

diff -r 3c3575d1c0ef -r 85a7cecc9a4e sys/dev/pci/mfii.c
--- a/sys/dev/pci/mfii.c        Sat Jul 16 06:52:40 2022 +0000
+++ b/sys/dev/pci/mfii.c        Sat Jul 16 07:13:03 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.24 2022/07/16 06:52:41 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.25 2022/07/16 07:13:03 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.24 2022/07/16 06:52:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.25 2022/07/16 07:13:03 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -355,6 +355,7 @@
        struct {
                bool            ld_present;
                char            ld_dev[16];     /* device name sd? */
+               int             ld_target_id;
        }                       sc_ld[MFII_MAX_LD_EXT];
        int                     sc_target_lds[MFII_MAX_LD_EXT];
        bool                    sc_max256vd;
@@ -942,6 +943,7 @@
        for (i = 0; i < sc->sc_ld_list.mll_no_ld; i++) {
                int target = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
                sc->sc_target_lds[target] = i;
+               sc->sc_ld[i].ld_target_id = target;
        }
 
        /* enable interrupts */
@@ -1452,6 +1454,7 @@
                DNPRINTF(MFII_D_MISC, "%s: target %d: state %d\n",
                    DEVNAME(sc), target, sc->sc_ld_list.mll_list[i].mll_state);
                newlds[target] = i;
+               sc->sc_ld[i].ld_target_id = target;
        }
 
        for (i = 0; i < MFII_MAX_LD_EXT; i++) {
@@ -2339,9 +2342,10 @@
        struct scsipi_periph *periph = xs->xs_periph;
        struct mpii_msg_scsi_io *io = ccb->ccb_request;
        struct mfii_raid_context *ctx = (struct mfii_raid_context *)(io + 1);
-       int segs;
-
-       io->dev_handle = htole16(periph->periph_target);
+       int segs, target;
+
+       target = sc->sc_ld[periph->periph_target].ld_target_id;
+       io->dev_handle = htole16(target);
        io->function = MFII_FUNCTION_LDIO_REQUEST;
        io->sense_buffer_low_address = htole32(ccb->ccb_sense_dva);
        io->sgl_flags = htole16(0x02); /* XXX */
@@ -2368,7 +2372,7 @@
        ctx->type_nseg = sc->sc_iop->ldio_ctx_type_nseg;
        ctx->timeout_value = htole16(0x14); /* XXX */
        ctx->reg_lock_flags = htole16(sc->sc_iop->ldio_ctx_reg_lock_flags);
-       ctx->virtual_disk_target_id = htole16(periph->periph_target);
+       ctx->virtual_disk_target_id = htole16(target);
 
        if (mfii_load_ccb(sc, ccb, ctx + 1,
            ISSET(xs->xs_control, XS_CTL_NOSLEEP)) != 0)
@@ -2399,8 +2403,10 @@
        struct scsipi_periph *periph = xs->xs_periph;
        struct mpii_msg_scsi_io *io = ccb->ccb_request;
        struct mfii_raid_context *ctx = (struct mfii_raid_context *)(io + 1);
-
-       io->dev_handle = htole16(periph->periph_target);
+       int target;
+
+       target = sc->sc_ld[periph->periph_target].ld_target_id;
+       io->dev_handle = htole16(target);
        io->function = MFII_FUNCTION_LDIO_REQUEST;
        io->sense_buffer_low_address = htole32(ccb->ccb_sense_dva);
        io->sgl_flags = htole16(0x02); /* XXX */
@@ -2425,7 +2431,7 @@
        }
        memcpy(io->cdb, xs->cmd, xs->cmdlen);
 
-       ctx->virtual_disk_target_id = htole16(periph->periph_target);
+       ctx->virtual_disk_target_id = htole16(target);
 
        if (mfii_load_ccb(sc, ccb, ctx + 1,
            ISSET(xs->xs_control, XS_CTL_NOSLEEP)) != 0)



Home | Main Index | Thread Index | Old Index