Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up the following, requested by msaitoh in ticket #1524:



details:   https://anonhg.NetBSD.org/src/rev/0eafadd68002
branches:  netbsd-9
changeset: 370088:0eafadd68002
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Sep 16 18:27:38 2022 +0000

description:
Pull up the following, requested by msaitoh in ticket #1524:

        sys/dev/ic/mfireg.h                             1.22
        sys/dev/pci/mfii.c                              1.16-1.22,1.27 via patch
        share/man/man4/mfii.4                           1.3 via patch

- Fix wrong access in mfii_start().
- Add SAS3216,SAS3224,SAS3316 and SAS3324 support.
- Add CVPM02 BBU support.
- Use bus_space_write_8() if available.
- Don't panic on detach if no any sensor device.
- Add comment. Sort entries. KNF.

diffstat:

 share/man/man4/mfii.4 |   12 ++++-
 sys/dev/ic/mfireg.h   |    3 +-
 sys/dev/pci/mfii.c    |  101 +++++++++++++++++++++++++++++++++----------------
 3 files changed, 79 insertions(+), 37 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r 837bd47d5073 -r 0eafadd68002 share/man/man4/mfii.4
--- a/share/man/man4/mfii.4     Mon Sep 12 17:12:39 2022 +0000
+++ b/share/man/man4/mfii.4     Fri Sep 16 18:27:38 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mfii.4,v 1.2 2018/11/24 20:31:29 wiz Exp $
+.\"    $NetBSD: mfii.4,v 1.2.8.1 2022/09/16 18:27:38 martin Exp $
 .\"    $OpenBSD: mfii.4,v 1.7 2018/03/27 07:01:42 jsg Exp $
 .\"
 .\" Copyright (c) 2012 David Gwynne <dlg%openbsd.org@localhost>
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd March 27, 2018
+.Dd July 16, 2022
 .Dt MFII 4
 .Os
 .Sh NAME
@@ -37,6 +37,14 @@
 .It
 SAS3108
 .It
+SAS3216
+.It
+SAS3224
+.It
+SAS3316
+.It
+SAS3324
+.It
 SAS3404
 .It
 SAS3408
diff -r 837bd47d5073 -r 0eafadd68002 sys/dev/ic/mfireg.h
--- a/sys/dev/ic/mfireg.h       Mon Sep 12 17:12:39 2022 +0000
+++ b/sys/dev/ic/mfireg.h       Fri Sep 16 18:27:38 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.9.4.1 2022/05/17 10:29:47 bouyer Exp $ */
+/* $NetBSD: mfireg.h,v 1.9.4.2 2022/09/16 18:27:38 martin Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom <marco%peereboom.us@localhost>
@@ -1268,6 +1268,7 @@
 #define MFI_BBU_TYPE_IBBU      1
 #define MFI_BBU_TYPE_BBU       2
 #define MFI_BBU_TYPE_IBBU09    5
+#define MFI_BBU_TYPE_CVPM02    6
        uint8_t                 reserved;
        uint16_t                voltage; /* mV */
        int16_t                 current; /* mA */
diff -r 837bd47d5073 -r 0eafadd68002 sys/dev/pci/mfii.c
--- a/sys/dev/pci/mfii.c        Mon Sep 12 17:12:39 2022 +0000
+++ b/sys/dev/pci/mfii.c        Fri Sep 16 18:27:38 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.4.4.1 2022/05/17 10:29:47 bouyer Exp $ */
+/* $NetBSD: mfii.c,v 1.4.4.2 2022/09/16 18:27:38 martin 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.4.4.1 2022/05/17 10:29:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.4.4.2 2022/09/16 18:27:38 martin Exp $");
 
 #include "bio.h"
 
@@ -587,23 +587,40 @@
 };
 
 static const struct mfii_device mfii_devices[] = {
+       /* Fusion */
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_2208,
            &mfii_iop_thunderbolt },
+       /* Fury */
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3008,
            &mfii_iop_25 },
+       /* Invader */
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3108,
            &mfii_iop_25 },
+       /* Intruder */
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3316,
+           &mfii_iop_25 },
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3324,
+           &mfii_iop_25 },
+       /* Cutlass */
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_32XX_1,
+           &mfii_iop_25 },
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_32XX_2,
+           &mfii_iop_25 },
+       /* Crusader */
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3404,
            &mfii_iop_35 },
-       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3504,
-           &mfii_iop_35 },
-       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3408,
-           &mfii_iop_35 },
-       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3508,
-           &mfii_iop_35 },
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3416,
            &mfii_iop_35 },
+       /* Ventura */
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3504,
+           &mfii_iop_35 },
        { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3516,
+           &mfii_iop_35 },
+       /* Tomcat */
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3408,
+           &mfii_iop_35 },
+       /* Harpoon */
+       { PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_MEGARAID_3508,
            &mfii_iop_35 }
 };
 
@@ -991,8 +1008,8 @@
        if (sc->sc_child != NULL)
                return 0;
 
-       sc->sc_child = config_found_sm_loc(self, ifattr, locators, &sc->sc_chan,
-           scsiprint, NULL);
+       sc->sc_child = config_found_sm_loc(self, ifattr, locators,
+           &sc->sc_chan, scsiprint, NULL);
        return 0;
 }
 
@@ -1046,7 +1063,8 @@
                mfii_scrub_ccb(ccb);
                if (mfii_do_mgmt(sc, ccb, MR_DCMD_CTRL_CACHE_FLUSH, &mbox,
                    NULL, 0, MFII_DATA_NONE, true)) {
-                       aprint_error_dev(dev, "shutdown: cache flush failed\n");
+                       aprint_error_dev(dev,
+                           "shutdown: cache flush failed\n");
                        rv = false;
                        goto fail;
                }
@@ -1188,7 +1206,8 @@
        mdm = mfii_dmamem_alloc(sc, sizeof(struct mfi_evt_detail));
        if (mdm == NULL) {
                mfii_put_ccb(sc, ccb);
-               aprint_error_dev(sc->sc_dev, "unable to allocate event data\n");
+               aprint_error_dev(sc->sc_dev,
+                   "unable to allocate event data\n");
                return (ENOMEM);
        }
 
@@ -1333,8 +1352,8 @@
        if (mfii_mgmt(sc, MR_DCMD_LD_GET_LIST, NULL, &sc->sc_ld_list,
            sizeof(sc->sc_ld_list), MFII_DATA_IN, false) != 0) {
                mutex_exit(&sc->sc_lock);
-               DNPRINTF(MFII_D_MISC, "%s: getting list of logical disks failed\n",
-                   DEVNAME(sc));
+               DNPRINTF(MFII_D_MISC,
+                   "%s: getting list of logical disks failed\n", DEVNAME(sc));
                return;
        }
        mutex_exit(&sc->sc_lock);
@@ -1573,7 +1592,8 @@
            sc->sc_info.mci_host.mih_port_count);
 
        for (i = 0; i < 8; i++)
-               DPRINTF("%.0" PRIx64 " ", sc->sc_info.mci_host.mih_port_addr[i]);
+               DPRINTF("%.0" PRIx64 " ",
+                   sc->sc_info.mci_host.mih_port_addr[i]);
        DPRINTF("\n");
 
        DPRINTF("%s: type %.x port_count %d port_addr ",
@@ -1582,7 +1602,8 @@
            sc->sc_info.mci_device.mid_port_count);
 
        for (i = 0; i < 8; i++)
-               DPRINTF("%.0" PRIx64 " ", sc->sc_info.mci_device.mid_port_addr[i]);
+               DPRINTF("%.0" PRIx64 " ",
+                   sc->sc_info.mci_device.mid_port_addr[i]);
        DPRINTF("\n");
 
        return (0);
@@ -1843,23 +1864,24 @@
 static void
 mfii_start(struct mfii_softc *sc, struct mfii_ccb *ccb)
 {
-       u_long *r = (u_long *)&ccb->ccb_req;
+       uint32_t *r = (uint32_t *)&ccb->ccb_req;
+#if defined(__LP64__)
+       uint64_t buf;
+#endif
 
        bus_dmamap_sync(sc->sc_dmat, MFII_DMA_MAP(sc->sc_requests),
            ccb->ccb_request_offset, MFII_REQUEST_SIZE,
            BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
-#if defined(__LP64__) && 0
-       bus_space_write_8(sc->sc_iot, sc->sc_ioh, MFI_IQPL, *r);
+#if defined(__LP64__)
+       buf = ((uint64_t)r[1] << 32) | r[0];
+       bus_space_write_8(sc->sc_iot, sc->sc_ioh, MFI_IQPL, buf);
 #else
        mutex_enter(&sc->sc_post_mtx);
        bus_space_write_4(sc->sc_iot, sc->sc_ioh, MFI_IQPL, r[0]);
+       bus_space_write_4(sc->sc_iot, sc->sc_ioh, MFI_IQPH, r[1]);
        bus_space_barrier(sc->sc_iot, sc->sc_ioh,
            MFI_IQPL, 8, BUS_SPACE_BARRIER_WRITE);
-
-       bus_space_write_4(sc->sc_iot, sc->sc_ioh, MFI_IQPH, r[1]);
-       bus_space_barrier(sc->sc_iot, sc->sc_ioh,
-           MFI_IQPH, 8, BUS_SPACE_BARRIER_WRITE);
        mutex_exit(&sc->sc_post_mtx);
 #endif
 }
@@ -2019,7 +2041,8 @@
 
        for (;;) {
                rdp = &postq[sc->sc_reply_postq_index];
-               DNPRINTF(MFII_D_INTR, "%s: mfii_postq index %d flags 0x%x data 0x%x\n",
+               DNPRINTF(MFII_D_INTR,
+                   "%s: mfii_postq index %d flags 0x%x data 0x%x\n",
                    DEVNAME(sc), sc->sc_reply_postq_index, rdp->reply_flags,
                        rdp->data == 0xffffffff);
                if ((rdp->reply_flags & MPII_REPLY_DESCR_TYPE_MASK) ==
@@ -2973,7 +2996,8 @@
        if (sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_span_depth > 1)
                bv->bv_level *= 10;
 
-       bv->bv_nodisk = sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_no_drv_per_span *
+       bv->bv_nodisk =
+           sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_no_drv_per_span *
            sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_span_depth;
 
        bv->bv_size = sc->sc_ld_details[i].mld_size * 512; /* bytes per block */
@@ -3171,8 +3195,9 @@
                break;
 
        default:
-               DNPRINTF(MFII_D_IOCTL, "%s: mfii_ioctl_alarm biocalarm invalid "
-                   "opcode %x\n", DEVNAME(sc), ba->ba_opcode);
+               DNPRINTF(MFII_D_IOCTL,
+                   "%s: mfii_ioctl_alarm biocalarm invalid opcode %x\n",
+                   DEVNAME(sc), ba->ba_opcode);
                return (EINVAL);
        }
 
@@ -3232,8 +3257,9 @@
 
        case BIOC_SBALARM:
        default:
-               DNPRINTF(MFII_D_IOCTL, "%s: mfii_ioctl_blink biocblink invalid "
-                   "opcode %x\n", DEVNAME(sc), bb->bb_status);
+               DNPRINTF(MFII_D_IOCTL,
+                   "%s: mfii_ioctl_blink biocblink invalid opcode %x\n",
+                   DEVNAME(sc), bb->bb_status);
                goto done;
        }
 
@@ -3506,7 +3532,8 @@
                                if (bp->bp_autonext < 0)
                                        return (EINVAL);
                                else
-                                       prop.next_exec = time + bp->bp_autonext;
+                                       prop.next_exec =
+                                           time + bp->bp_autonext;
                        }
                        prop.op_mode = MFI_PR_OPMODE_AUTO;
                        break;
@@ -3577,8 +3604,9 @@
                break;
 
        default:
-               DNPRINTF(MFII_D_IOCTL, "%s: mfii_ioctl_patrol biocpatrol invalid "
-                   "opcode %x\n", DEVNAME(sc), bp->bp_opcode);
+               DNPRINTF(MFII_D_IOCTL,
+                   "%s: mfii_ioctl_patrol biocpatrol invalid opcode %x\n",
+                   DEVNAME(sc), bp->bp_opcode);
                return (EINVAL);
        }
 
@@ -3637,7 +3665,8 @@
        /* offset into hotspare structure */
        i = volid - cfg->mfc_no_ld;
 
-       DNPRINTF(MFII_D_IOCTL, "%s: mfii_vol_hs i %d volid %d no_ld %d no_hs %d "
+       DNPRINTF(MFII_D_IOCTL,
+           "%s: mfii_vol_hs i %d volid %d no_ld %d no_hs %d "
            "hs %p cfg %p id %02x\n", DEVNAME(sc), i, volid, cfg->mfc_no_ld,
            cfg->mfc_no_hs, hs, cfg, hs[i].mhs_pd.mfp_id);
 
@@ -3712,6 +3741,7 @@
        switch (bbu.battery_type) {
        case MFI_BBU_TYPE_IBBU:
        case MFI_BBU_TYPE_IBBU09:
+       case MFI_BBU_TYPE_CVPM02:
                mask = MFI_BBU_STATE_BAD_IBBU;
                soh_bad = 0;
                break;
@@ -3743,7 +3773,8 @@
                edata->state = ENVSYS_SVALID;
                return;
        case 3:
-               edata->value_cur = le16toh(bbu.temperature) * 1000000 + 273150000;
+               edata->value_cur =
+                   le16toh(bbu.temperature) * 1000000 + 273150000;



Home | Main Index | Thread Index | Old Index