Source-Changes-HG archive

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

[src/netbsd-7]: src Pull up following revision(s) (requested by jmcneill in t...



details:   https://anonhg.NetBSD.org/src/rev/4bb27c336dea
branches:  netbsd-7
changeset: 798381:4bb27c336dea
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Sep 29 16:15:58 2014 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #120):
        sys/dev/ic/mpt_netbsd.c: revision 1.28
        sys/dev/ic/mpt_netbsd.c: revision 1.29
        sys/dev/ic/mpt.c: revision 1.17
        sys/dev/ic/mpt_netbsd.c: revision 1.30
        sys/dev/ic/mpt_netbsd.c: revision 1.31
        share/man/man4/bio.4: revision 1.12
        share/man/man4/mpt.4: revision 1.6
        sys/dev/ic/mpt.h: revision 1.8
        sys/dev/ic/mpt_netbsd.c: revision 1.26
        sys/dev/ic/mpt_netbsd.c: revision 1.27
- Add bio(4) support.
- xref mpt(4) in bio(4).
- xref bio(4) in mpt(4).
- show "sd0" instead of "mpt0" for volume device name
- include vendor/product/rev info for volumes and their disks.
- implement BIOCDISK_NOVOL
- for BIOCDISK_NOVOL, set bd_disknovol=true for any disk not associated with a
  volume for BIOCDISK_NOVOL, when setting bd_disknovol=false, also set
  bv_volid

diffstat:

 share/man/man4/bio.4    |    6 +-
 share/man/man4/mpt.4    |    5 +-
 sys/dev/ic/mpt.c        |   15 +-
 sys/dev/ic/mpt.h        |    6 +-
 sys/dev/ic/mpt_netbsd.c |  482 +++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 501 insertions(+), 13 deletions(-)

diffs (truncated from 646 to 300 lines):

diff -r abbaecdf707b -r 4bb27c336dea share/man/man4/bio.4
--- a/share/man/man4/bio.4      Mon Sep 29 15:45:36 2014 +0000
+++ b/share/man/man4/bio.4      Mon Sep 29 16:15:58 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: bio.4,v 1.11 2014/03/18 18:20:39 riastradh Exp $
+.\"    $NetBSD: bio.4,v 1.11.4.1 2014/09/29 16:15:59 msaitoh Exp $
 .\"    $OpenBSD: bio.4,v 1.19 2006/09/20 22:22:37 jmc Exp $
 .\"
 .\" Copyright (c) 2002 Niklas Hallqvist
@@ -28,7 +28,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 25, 2008
+.Dd Sep 27, 2014
 .Dt BIO 4
 .Os
 .Sh NAME
@@ -67,6 +67,8 @@
 Compaq Smart ARRAY 5/6 SAS/SATA/SCSI RAID controller
 .It Xr mfi 4
 LSI Logic \*[Am] Dell MegaRAID SAS RAID controller
+.It Xr mpt 4
+LSI Fusion-MPT RAID controller
 .El
 .Pp
 The following ioctl calls apply to the
diff -r abbaecdf707b -r 4bb27c336dea share/man/man4/mpt.4
--- a/share/man/man4/mpt.4      Mon Sep 29 15:45:36 2014 +0000
+++ b/share/man/man4/mpt.4      Mon Sep 29 16:15:58 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mpt.4,v 1.5 2010/02/16 10:11:47 msaitoh Exp $
+.\"    $NetBSD: mpt.4,v 1.5.26.1 2014/09/29 16:15:59 msaitoh Exp $
 .\"
 .\" Copyright (c) 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 16, 2009
+.Dd Sep 27, 2014
 .Dt MPT 4
 .Os
 .Sh NAME
@@ -84,6 +84,7 @@
 .Pq Dual 2Gb/s Tn Fibre Channel, PCI-X
 .El
 .Sh SEE ALSO
+.Xr bio 4 ,
 .Xr cd 4 ,
 .Xr ch 4 ,
 .Xr intro 4 ,
diff -r abbaecdf707b -r 4bb27c336dea sys/dev/ic/mpt.c
--- a/sys/dev/ic/mpt.c  Mon Sep 29 15:45:36 2014 +0000
+++ b/sys/dev/ic/mpt.c  Mon Sep 29 16:15:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpt.c,v 1.16 2012/03/18 21:05:21 martin Exp $  */
+/*     $NetBSD: mpt.c,v 1.16.14.1 2014/09/29 16:15:58 msaitoh Exp $    */
 
 /*
  * Copyright (c) 2000, 2001 by Greg Ansley
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt.c,v 1.16 2012/03/18 21:05:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt.c,v 1.16.14.1 2014/09/29 16:15:58 msaitoh Exp $");
 
 #include <dev/ic/mpt.h>
 
@@ -565,10 +565,7 @@
  * Utiltity routine to read configuration headers and pages
  */
 
-static int
-mpt_read_cfg_header(mpt_softc_t *, int, int, int, fCONFIG_PAGE_HEADER *);
-
-static int
+int
 mpt_read_cfg_header(mpt_softc_t *mpt, int PageType, int PageNumber,
     int PageAddress, fCONFIG_PAGE_HEADER *rslt)
 {
@@ -1516,4 +1513,10 @@
        MPT_2_HOST16(rpd0, ErrorData.SmartCount);
 }
 
+void
+mpt2host_config_page_ioc_2(fCONFIG_PAGE_IOC_2 *ioc2)
+{
+       MPT_2_HOST32(ioc2, CapabilitiesFlags);
+}
+
 #endif
diff -r abbaecdf707b -r 4bb27c336dea sys/dev/ic/mpt.h
--- a/sys/dev/ic/mpt.h  Mon Sep 29 15:45:36 2014 +0000
+++ b/sys/dev/ic/mpt.h  Mon Sep 29 16:15:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpt.h,v 1.7 2010/04/28 22:45:27 chs Exp $      */
+/*     $NetBSD: mpt.h,v 1.7.34.1 2014/09/29 16:15:58 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2000, 2001 by Greg Ansley
@@ -173,6 +173,7 @@
 int mpt_intr(void *);
 void mpt_check_doorbell(mpt_softc_t *);
 
+int mpt_read_cfg_header(mpt_softc_t *, int, int, int, fCONFIG_PAGE_HEADER *);
 int mpt_read_cfg_page(mpt_softc_t *, int, fCONFIG_PAGE_HEADER *);
 int mpt_write_cfg_page(mpt_softc_t *, int, fCONFIG_PAGE_HEADER *);
 
@@ -212,6 +213,8 @@
 void host2mpt_config_page_fc_port_1(fCONFIG_PAGE_FC_PORT_1 *);
 void mpt2host_config_page_raid_vol_0(fCONFIG_PAGE_RAID_VOL_0 *);
 void mpt2host_config_page_raid_phys_disk_0(fCONFIG_PAGE_RAID_PHYS_DISK_0 *);
+void mpt2host_config_page_raid_phys_disk_0(fCONFIG_PAGE_RAID_PHYS_DISK_0 *);
+void mpt2host_config_page_ioc_2(fCONFIG_PAGE_IOC_2 *);
 #else
 #define        mpt2host_sge_simple_union(x)            do { ; } while (0)
 #define        mpt2host_iocfacts_reply(x)              do { ; } while (0)
@@ -230,6 +233,7 @@
 #define        mpt2host_config_page_raid_vol_0(x)      do { ; } while (0)
 #define        mpt2host_config_page_raid_phys_disk_0(x)                        \
        do { ; } while (0)
+#define mpt2host_config_page_ioc_2(x)          do { ; } while (0)
 #endif
 
 #endif /* _KERNEL */
diff -r abbaecdf707b -r 4bb27c336dea sys/dev/ic/mpt_netbsd.c
--- a/sys/dev/ic/mpt_netbsd.c   Mon Sep 29 15:45:36 2014 +0000
+++ b/sys/dev/ic/mpt_netbsd.c   Mon Sep 29 16:15:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpt_netbsd.c,v 1.25 2014/07/08 14:18:54 chs Exp $      */
+/*     $NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,11 +77,17 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25 2014/07/08 14:18:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $");
+
+#include "bio.h"
 
 #include <dev/ic/mpt.h>                        /* pulls in all headers */
 #include <sys/scsiio.h>
 
+#if NBIO > 0
+#include <dev/biovar.h>
+#endif
+
 static int     mpt_poll(mpt_softc_t *, struct scsipi_xfer *, int);
 static void    mpt_timeout(void *);
 static void    mpt_restart(mpt_softc_t *, request_t *);
@@ -100,6 +106,16 @@
 static int     mpt_ioctl(struct scsipi_channel *, u_long, void *, int,
        struct proc *);
 
+#if NBIO > 0
+static bool    mpt_is_raid(mpt_softc_t *);
+static int     mpt_bio_ioctl(device_t, u_long, void *);
+static int     mpt_bio_ioctl_inq(mpt_softc_t *, struct bioc_inq *);
+static int     mpt_bio_ioctl_vol(mpt_softc_t *, struct bioc_vol *);
+static int     mpt_bio_ioctl_disk(mpt_softc_t *, struct bioc_disk *);
+static int     mpt_bio_ioctl_disk_novol(mpt_softc_t *, struct bioc_disk *);
+static int     mpt_bio_ioctl_setstate(mpt_softc_t *, struct bioc_setstate *);
+#endif
+
 void
 mpt_scsipi_attach(mpt_softc_t *mpt)
 {
@@ -144,6 +160,14 @@
        */
        mpt->sc_scsibus_dv = config_found(mpt->sc_dev, &mpt->sc_channel, 
        scsiprint);
+
+#if NBIO > 0
+       if (mpt_is_raid(mpt)) {
+               if (bio_register(mpt->sc_dev, mpt_bio_ioctl) != 0)
+                       panic("%s: controller registration failed",
+                           device_xname(mpt->sc_dev));
+       }
+#endif
 }
 
 int
@@ -1585,3 +1609,457 @@
                return (ENOTTY);
        }
 }
+
+#if NBIO > 0
+static fCONFIG_PAGE_IOC_2 *
+mpt_get_cfg_page_ioc2(mpt_softc_t *mpt)
+{
+       fCONFIG_PAGE_HEADER hdr;
+       fCONFIG_PAGE_IOC_2 *ioc2;
+       int rv;
+
+       rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_IOC, 2, 0, &hdr);
+       if (rv)
+               return NULL;
+
+       ioc2 = malloc(hdr.PageLength * 4, M_DEVBUF, M_WAITOK | M_ZERO);
+       if (ioc2 == NULL)
+               return NULL;
+
+       memcpy(ioc2, &hdr, sizeof(hdr));
+
+       rv = mpt_read_cfg_page(mpt, 0, &ioc2->Header);
+       if (rv)
+               goto fail;
+       mpt2host_config_page_ioc_2(ioc2);
+
+       return ioc2;
+
+fail:
+       free(ioc2, M_DEVBUF);
+       return NULL;
+}
+
+static fCONFIG_PAGE_IOC_3 *
+mpt_get_cfg_page_ioc3(mpt_softc_t *mpt)
+{
+       fCONFIG_PAGE_HEADER hdr;
+       fCONFIG_PAGE_IOC_3 *ioc3;
+       int rv;
+
+       rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_IOC, 3, 0, &hdr);
+       if (rv)
+               return NULL;
+
+       ioc3 = malloc(hdr.PageLength * 4, M_DEVBUF, M_WAITOK | M_ZERO);
+       if (ioc3 == NULL)
+               return NULL;
+
+       memcpy(ioc3, &hdr, sizeof(hdr));
+
+       rv = mpt_read_cfg_page(mpt, 0, &ioc3->Header);
+       if (rv)
+               goto fail;
+
+       return ioc3;
+
+fail:
+       free(ioc3, M_DEVBUF);
+       return NULL;
+}
+
+
+static fCONFIG_PAGE_RAID_VOL_0 *
+mpt_get_cfg_page_raid_vol0(mpt_softc_t *mpt, int address)
+{
+       fCONFIG_PAGE_HEADER hdr;
+       fCONFIG_PAGE_RAID_VOL_0 *rvol0;
+       int rv;
+
+       rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 0,
+           address, &hdr);
+       if (rv)
+               return NULL;
+
+       rvol0 = malloc(hdr.PageLength * 4, M_DEVBUF, M_WAITOK | M_ZERO);
+       if (rvol0 == NULL)
+               return NULL;
+
+       memcpy(rvol0, &hdr, sizeof(hdr));
+
+       rv = mpt_read_cfg_page(mpt, address, &rvol0->Header);
+       if (rv)
+               goto fail;
+       mpt2host_config_page_raid_vol_0(rvol0);
+
+       return rvol0;
+
+fail:
+       free(rvol0, M_DEVBUF);
+       return NULL;
+}
+
+static fCONFIG_PAGE_RAID_PHYS_DISK_0 *
+mpt_get_cfg_page_raid_phys_disk0(mpt_softc_t *mpt, int address)
+{
+       fCONFIG_PAGE_HEADER hdr;
+       fCONFIG_PAGE_RAID_PHYS_DISK_0 *physdisk0;
+       int rv;
+
+       rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_PHYSDISK, 0,
+           address, &hdr);
+       if (rv)
+               return NULL;
+
+       physdisk0 = malloc(hdr.PageLength * 4, M_DEVBUF, M_WAITOK | M_ZERO);
+       if (physdisk0 == NULL)
+               return NULL;
+
+       memcpy(physdisk0, &hdr, sizeof(hdr));
+



Home | Main Index | Thread Index | Old Index