Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) (requested by bouyer in tic...



details:   https://anonhg.NetBSD.org/src/rev/a1f2f7f0ee1c
branches:  netbsd-8
changeset: 446498:a1f2f7f0ee1c
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 08 12:17:13 2018 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #1131):

        sys/dev/pci/mpiireg.h: revision 1.2
        sys/dev/pci/mfii.c: revision 1.3
        share/man/man4/mpii.4: revision 1.3
        share/man/man4/mpii.4: revision 1.4
        sys/dev/pci/mpii.c: revision 1.15
        sys/dev/pci/mpii.c: revision 1.16
        sys/dev/pci/mpii.c: revision 1.17
        sys/dev/pci/mpii.c: revision 1.18

Update the mpii(4) driver to the latest OpenBSD version.

This adds support for the SAS3xxx LSI controllers, and this also makes the
driver MP-safe.

adjust mfii.c for changes in mpiireg.h

Tested with a
mpii0: SMC2008-IR, firmware 9.0.0.0 IR, MPI 2.0
Update for the new mpii(4) driver, mostly from OpenBSD.

Also tell the scsi layer that we are MPSAFE

Remove trailing whitespace

NULL-terminate mpii_devices[], this is the end condition of the loop
in mpii_match(). Noticed by Mike Pumford

There's no sensors for physical disks so don't try to detach them.

diffstat:

 share/man/man4/mpii.4 |    35 +-
 sys/dev/pci/mfii.c    |    18 +-
 sys/dev/pci/mpii.c    |  2440 ++++++++++++++++++++++++------------------------
 sys/dev/pci/mpiireg.h |   257 ++--
 4 files changed, 1421 insertions(+), 1329 deletions(-)

diffs (truncated from 4989 to 300 lines):

diff -r c5941f4bb1ae -r a1f2f7f0ee1c share/man/man4/mpii.4
--- a/share/man/man4/mpii.4     Sat Dec 08 12:10:22 2018 +0000
+++ b/share/man/man4/mpii.4     Sat Dec 08 12:17:13 2018 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mpii.4,v 1.2 2012/04/19 20:13:48 wiz Exp $
+.\"    $NetBSD: mpii.4,v 1.2.28.1 2018/12/08 12:17:13 martin Exp $
 .\"    OpenBSD: mpii.4,v 1.8 2010/10/01 12:27:36 mikeb Exp
 .\"
 .\" Copyright (c) 2010 Marco Peereboom <marco%openbsd.org@localhost>
@@ -16,7 +16,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd April 19, 2012
+.Dd December 3, 2018
 .Dt MPII 4
 .Os
 .Sh NAME
@@ -34,20 +34,39 @@
 .Bl -dash -offset indent -compact
 .It
 LSISAS2004,
-LSISAS2008
+LSISAS2008,
+LSISAS2108,
+LSISAS2208,
+LSISAS2216,
+LSISAS2308,
+LSISAS3004,
+LSISAS3008,
+LSISAS3108,
+LSISAS3408,
+LSISAS3416,
+LSISAS3508,
+LSISAS3516
 .El
 .Pp
 These chipsets can be found on the following controllers:
 .Pp
 .Bl -dash -offset indent -compact
 .It
-Dell PERC H200
+Dell PERC H200, HBA330, 12Gbps SAS HBA
+.It
+IBM ServeRAID H1110
 .It
-LSI SAS 9200-8e, SAS 9211-4i, SAS 9211-8i
+Lenovo N2215, ThinkSystem 430
+.It
+LSI SAS 9200-8e, SAS 9207-8i, SAS 9211-4i, SAS 9211-8i
+.It
+Broadcom SAS 9300, HBA 9400
 .El
 .Pp
-Some models of these controllers have varying degrees of support for RAID 0
-and RAID 1.
+Some models of these controllers carry an Integrated RAID (IR) firmware
+providing support for RAID 0, RAID 1, RAID10 or RAID5 using SAS or SATA
+drives.
+All RAID configuration is done through the controllers' BIOSes.
 .Pp
 .Nm
 supports monitoring of the logical disks in the controller through the
@@ -94,4 +113,4 @@
 Instead they use an opaque ID and leave discovery order up to the operating
 system.
 The code to handle this is currently not implemented and therefore it is not a
-good idea to run this driver on a multi-boot machine or with more than 1 drive.
+good idea to run this driver on a multi-boot machine.
diff -r c5941f4bb1ae -r a1f2f7f0ee1c sys/dev/pci/mfii.c
--- a/sys/dev/pci/mfii.c        Sat Dec 08 12:10:22 2018 +0000
+++ b/sys/dev/pci/mfii.c        Sat Dec 08 12:17:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.3.2.2 2018/12/07 17:11:37 martin Exp $ */
+/* $NetBSD: mfii.c,v 1.3.2.3 2018/12/08 12:17:13 martin Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.2 2018/12/07 17:11:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.3 2018/12/08 12:17:13 martin Exp $");
 
 #include "bio.h"
 
@@ -1934,11 +1934,15 @@
        iiq->sense_buffer_address_high = htole32(
            MFII_DMA_DVA(sc->sc_sense) >> 32);
 
-       iiq->reply_descriptor_post_queue_address = htole64(
-           MFII_DMA_DVA(sc->sc_reply_postq));
-
-       iiq->system_request_frame_base_address =
-           htole64(MFII_DMA_DVA(sc->sc_requests));
+       iiq->reply_descriptor_post_queue_address_lo =
+           htole32(MFII_DMA_DVA(sc->sc_reply_postq));
+       iiq->reply_descriptor_post_queue_address_hi =
+           htole32(MFII_DMA_DVA(sc->sc_reply_postq) >> 32);
+
+       iiq->system_request_frame_base_address_lo = 
+           htole32(MFII_DMA_DVA(sc->sc_requests));
+       iiq->system_request_frame_base_address_hi = 
+           htole32(MFII_DMA_DVA(sc->sc_requests) >> 32);
 
        iiq->timestamp = htole64(time_uptime);
 
diff -r c5941f4bb1ae -r a1f2f7f0ee1c sys/dev/pci/mpii.c
--- a/sys/dev/pci/mpii.c        Sat Dec 08 12:10:22 2018 +0000
+++ b/sys/dev/pci/mpii.c        Sat Dec 08 12:17:13 2018 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: mpii.c,v 1.8.10.2 2018/12/07 17:11:37 martin Exp $ */
-/*     OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp    */
+/* $NetBSD: mpii.c,v 1.8.10.3 2018/12/08 12:17:13 martin Exp $ */
+/*     OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp   */
 /*
  * Copyright (c) 2010 Mike Belopuhov <mkb%crypt.org.ru@localhost>
  * Copyright (c) 2009 James Giannoules
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.2 2018/12/07 17:11:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.3 2018/12/08 12:17:13 martin Exp $");
 
 #include "bio.h"
 
@@ -44,15 +44,15 @@
 #include <dev/scsipi/scsi_all.h>
 #include <dev/scsipi/scsiconf.h>
 
-#include <dev/pci/mpiireg.h>
-
 #if NBIO > 0
 #include <dev/biovar.h>
-#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmonvar.h>     
 #include <sys/envsys.h>
 #endif
 
-/* #define MPII_DEBUG */
+#include <dev/pci/mpiireg.h>
+
+// #define MPII_DEBUG
 #ifdef MPII_DEBUG
 #define DPRINTF(x...)          do { if (mpii_debug) printf(x); } while(0)
 #define DNPRINTF(n,x...)       do { if (mpii_debug & (n)) printf(x); } while(0)
@@ -69,42 +69,29 @@
 #define        MPII_D_EVT              (0x0400)
 #define MPII_D_CFG             (0x0800)
 #define MPII_D_MAP             (0x1000)
-#if 0
+
 u_int32_t  mpii_debug = 0
-               | MPII_D_CMD
-               | MPII_D_INTR
-               | MPII_D_MISC
-               | MPII_D_DMA
-               | MPII_D_IOCTL
-               | MPII_D_RW
-               | MPII_D_MEM
-               | MPII_D_CCB
-               | MPII_D_PPR
-               | MPII_D_RAID
-               | MPII_D_EVT
-               | MPII_D_CFG
-               | MPII_D_MAP
+//             | MPII_D_CMD
+//             | MPII_D_INTR
+//             | MPII_D_MISC
+//             | MPII_D_DMA
+//             | MPII_D_IOCTL
+//             | MPII_D_RW
+//             | MPII_D_MEM
+//             | MPII_D_CCB
+//             | MPII_D_PPR
+//             | MPII_D_RAID
+//             | MPII_D_EVT
+//             | MPII_D_CFG
+//             | MPII_D_MAP
        ;
-#endif
-u_int32_t  mpii_debug = MPII_D_MISC;
 #else
 #define DPRINTF(x...)
 #define DNPRINTF(n,x...)
 #endif
 
-#define MPII_REQUEST_SIZE      (512)
-#define MPII_REPLY_SIZE                (128)
-#define MPII_REPLY_COUNT       PAGE_SIZE / MPII_REPLY_SIZE
-
-/*
- * this is the max number of sge's we can stuff in a request frame:
- * sizeof(scsi_io) + sizeof(sense) + sizeof(sge) * 32 = MPII_REQUEST_SIZE
- */
-#define MPII_MAX_SGL                   (32)
-
-#define MPII_MAX_REQUEST_CREDIT                (128)
-
-#define MPII_MAXFER MAXPHYS /* XXX bogus */
+#define MPII_REQUEST_SIZE              (512)
+#define MPII_REQUEST_CREDIT            (128)
 
 struct mpii_dmamem {
        bus_dmamap_t            mdm_map;
@@ -112,23 +99,14 @@
        size_t                  mdm_size;
        void                    *mdm_kva;
 };
-#define MPII_DMA_MAP(_mdm)     (_mdm)->mdm_map
-#define MPII_DMA_DVA(_mdm)     (_mdm)->mdm_map->dm_segs[0].ds_addr
-#define MPII_DMA_KVA(_mdm)     (void *)(_mdm)->mdm_kva
-
-struct mpii_ccb_bundle {
-       struct mpii_msg_scsi_io mcb_io; /* sgl must follow */
-       struct mpii_sge         mcb_sgl[MPII_MAX_SGL];
-       struct scsi_sense_data  mcb_sense;
-} __packed;
+#define MPII_DMA_MAP(_mdm) ((_mdm)->mdm_map)
+#define MPII_DMA_DVA(_mdm) ((uint64_t)(_mdm)->mdm_map->dm_segs[0].ds_addr)
+#define MPII_DMA_KVA(_mdm) ((_mdm)->mdm_kva)
 
 struct mpii_softc;
 
 struct mpii_rcb {
-       union {
-               struct work     rcb_wk; /* has to be first in struct */
-               SIMPLEQ_ENTRY(mpii_rcb) rcb_link;
-       } u;
+       SIMPLEQ_ENTRY(mpii_rcb) rcb_link;
        void                    *rcb_reply;
        u_int32_t               rcb_reply_dva;
 };
@@ -154,20 +132,19 @@
 };
 
 struct mpii_ccb {
-       union {
-               struct work     ccb_wk; /* has to be first in struct */
-               SIMPLEQ_ENTRY(mpii_ccb) ccb_link;
-       } u;
        struct mpii_softc       *ccb_sc;
-       int                     ccb_smid;
 
        void *                  ccb_cookie;
+       kmutex_t                ccb_mtx;
+       kcondvar_t              ccb_cv;
+
        bus_dmamap_t            ccb_dmamap;
 
        bus_addr_t              ccb_offset;
        void                    *ccb_cmd;
        bus_addr_t              ccb_cmd_dva;
        u_int16_t               ccb_dev_handle;
+       u_int16_t               ccb_smid;
 
        volatile enum {
                MPII_CCB_FREE,
@@ -179,11 +156,7 @@
        void                    (*ccb_done)(struct mpii_ccb *);
        struct mpii_rcb         *ccb_rcb;
 
-};
-
-struct mpii_ccb_wait {
-       kmutex_t        mpii_ccbw_mtx;
-       kcondvar_t      mpii_ccbw_cv;
+       SIMPLEQ_ENTRY(mpii_ccb) ccb_link;
 };
 
 SIMPLEQ_HEAD(mpii_ccb_list, mpii_ccb);
@@ -196,14 +169,16 @@
 
        void                    *sc_ih;
 
-       int                     sc_flags;
-#define MPII_F_RAID            (1<<1)
-
        struct scsipi_adapter   sc_adapt;
        struct scsipi_channel   sc_chan;
        device_t                sc_child; /* our scsibus */
 
+       int                     sc_flags;
+#define MPII_F_RAID            (1<<1)
+#define MPII_F_SAS3            (1<<2)
+
        struct mpii_device      **sc_devs;
+       kmutex_t                sc_devs_mtx;
 
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_ioh;
@@ -213,42 +188,37 @@
        kmutex_t                sc_req_mtx;
        kmutex_t                sc_rep_mtx;
 
-       u_int8_t                sc_porttype;
-       int                     sc_request_depth;
-       int                     sc_num_reply_frames;



Home | Main Index | Thread Index | Old Index