Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src Pull up following revision(s) (requested by jmcneill in t...
details: https://anonhg.NetBSD.org/src/rev/7b10abb87917
branches: netbsd-6
changeset: 776762:7b10abb87917
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Nov 03 22:05:37 2014 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #1160):
sys/dev/ic/mpt_netbsd.c: revision 1.26-1.31
sys/dev/ic/mpt.c: revision 1.17
share/man/man4/bio.4: revision 1.12
share/man/man4/mpt.4: revision 1.6
sys/dev/ic/mpt.h: revision 1.8
- 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.
- 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 | 480 +++++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 499 insertions(+), 13 deletions(-)
diffs (truncated from 643 to 300 lines):
diff -r 1eb25318a4dc -r 7b10abb87917 share/man/man4/bio.4
--- a/share/man/man4/bio.4 Mon Nov 03 21:35:25 2014 +0000
+++ b/share/man/man4/bio.4 Mon Nov 03 22:05:37 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: bio.4,v 1.9 2009/05/18 14:07:09 wiz Exp $
+.\" $NetBSD: bio.4,v 1.9.10.1 2014/11/03 22:05:37 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 1eb25318a4dc -r 7b10abb87917 share/man/man4/mpt.4
--- a/share/man/man4/mpt.4 Mon Nov 03 21:35:25 2014 +0000
+++ b/share/man/man4/mpt.4 Mon Nov 03 22:05:37 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.10.1 2014/11/03 22:05:37 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 1eb25318a4dc -r 7b10abb87917 sys/dev/ic/mpt.c
--- a/sys/dev/ic/mpt.c Mon Nov 03 21:35:25 2014 +0000
+++ b/sys/dev/ic/mpt.c Mon Nov 03 22:05:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpt.c,v 1.15 2011/05/24 10:08:03 mrg Exp $ */
+/* $NetBSD: mpt.c,v 1.15.10.1 2014/11/03 22:05:37 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.15 2011/05/24 10:08:03 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt.c,v 1.15.10.1 2014/11/03 22:05:37 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 1eb25318a4dc -r 7b10abb87917 sys/dev/ic/mpt.h
--- a/sys/dev/ic/mpt.h Mon Nov 03 21:35:25 2014 +0000
+++ b/sys/dev/ic/mpt.h Mon Nov 03 22:05:37 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.14.1 2014/11/03 22:05:37 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 1eb25318a4dc -r 7b10abb87917 sys/dev/ic/mpt_netbsd.c
--- a/sys/dev/ic/mpt_netbsd.c Mon Nov 03 21:35:25 2014 +0000
+++ b/sys/dev/ic/mpt_netbsd.c Mon Nov 03 22:05:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpt_netbsd.c,v 1.17.2.1 2012/11/22 17:19:56 riz Exp $ */
+/* $NetBSD: mpt_netbsd.c,v 1.17.2.2 2014/11/03 22:05:37 msaitoh Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,10 +77,17 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17.2.1 2012/11/22 17:19:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17.2.2 2014/11/03 22:05:37 msaitoh Exp $");
+
+#include "bio.h"
#include <dev/ic/mpt.h> /* pulls in all headers */
+#if NBIO > 0
+#include <dev/biovar.h>
+#include <sys/ioccom.h>
+#endif
+
static int mpt_poll(mpt_softc_t *, struct scsipi_xfer *, int);
static void mpt_timeout(void *);
static void mpt_done(mpt_softc_t *, uint32_t);
@@ -94,6 +101,16 @@
scsipi_adapter_req_t, void *);
static void mpt_minphys(struct buf *);
+#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)
{
@@ -132,6 +149,14 @@
chan->chan_id = mpt->mpt_ini_id;
(void) 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
@@ -1375,3 +1400,454 @@
bp->b_bcount = MPT_MAX_XFER;
minphys(bp);
}
+
+#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