Source-Changes-HG archive

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

[src/trunk]: src Add a basic control program for iop devices.



details:   https://anonhg.NetBSD.org/src/rev/3b02b1d06b27
branches:  trunk
changeset: 500395:3b02b1d06b27
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Dec 11 13:48:52 2000 +0000

description:
Add a basic control program for iop devices.

diffstat:

 distrib/sets/lists/base/mi |    3 +-
 distrib/sets/lists/man/mi  |    4 +-
 usr.sbin/Makefile          |    6 +-
 usr.sbin/iopctl/Makefile   |    6 +
 usr.sbin/iopctl/iopctl.8   |   98 +++++++++
 usr.sbin/iopctl/iopctl.c   |  449 +++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 561 insertions(+), 5 deletions(-)

diffs (truncated from 627 to 300 lines):

diff -r bed1d71f8edf -r 3b02b1d06b27 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Mon Dec 11 13:48:10 2000 +0000
+++ b/distrib/sets/lists/base/mi        Mon Dec 11 13:48:52 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.193 2000/11/24 22:15:09 scw Exp $
+# $NetBSD: mi,v 1.194 2000/12/11 13:48:52 ad Exp $
 .
 ./altroot
 ./bin
@@ -596,6 +596,7 @@
 ./usr/sbin/hprop
 ./usr/sbin/ifmcstat
 ./usr/sbin/inetd
+./usr/sbin/iopctl
 ./usr/sbin/iostat
 ./usr/sbin/ipfs
 ./usr/sbin/ipfstat
diff -r bed1d71f8edf -r 3b02b1d06b27 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Dec 11 13:48:10 2000 +0000
+++ b/distrib/sets/lists/man/mi Mon Dec 11 13:48:52 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.290 2000/12/09 18:33:45 bjh21 Exp $
+# $NetBSD: mi,v 1.291 2000/12/11 13:48:52 ad Exp $
 ./usr/share/info/am-utils.info
 ./usr/share/info/as.info
 ./usr/share/info/awk.info
@@ -1158,6 +1158,7 @@
 ./usr/share/man/cat8/inetd.0
 ./usr/share/man/cat8/init.0
 ./usr/share/man/cat8/intro.0
+./usr/share/man/cat8/iopctl.0
 ./usr/share/man/cat8/iostat.0
 ./usr/share/man/cat8/ipf.0
 ./usr/share/man/cat8/ipfs.0
@@ -2587,6 +2588,7 @@
 ./usr/share/man/man8/inetd.8
 ./usr/share/man/man8/init.8
 ./usr/share/man/man8/intro.8
+./usr/share/man/man8/iopctl.8
 ./usr/share/man/man8/iostat.8
 ./usr/share/man/man8/ipf.8
 ./usr/share/man/man8/ipfs.8
diff -r bed1d71f8edf -r 3b02b1d06b27 usr.sbin/Makefile
--- a/usr.sbin/Makefile Mon Dec 11 13:48:10 2000 +0000
+++ b/usr.sbin/Makefile Mon Dec 11 13:48:52 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.148 2000/08/06 20:42:25 thorpej Exp $
+#      $NetBSD: Makefile,v 1.149 2000/12/11 13:48:52 ad Exp $
 #      from: @(#)Makefile      5.20 (Berkeley) 6/12/93
 
 .include <bsd.own.mk>
@@ -7,8 +7,8 @@
        chown chroot chrtbl cnwctl config cron dbsym dev_mkdb \
        dhcp diskpart dumpfs dumplfs edquota eeprom \
        envstat eshconfig greconfig \
-       grfconfig grfinfo gspa hilinfo inetd iostat ipf iteconfig kgmon \
-       kvm_mkdb lastlogin link lpr mailwrapper map-mbone \
+       grfconfig grfinfo gspa hilinfo inetd iopctl iostat ipf iteconfig
+       kgmon kvm_mkdb lastlogin link lpr mailwrapper map-mbone \
        mdconfig mdsetimage \
        memswitch mopd mountd mrinfo mrouted mtrace mtree \
        netgroup_mkdb nfsd ntp pkg_install pppd pstat \
diff -r bed1d71f8edf -r 3b02b1d06b27 usr.sbin/iopctl/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/iopctl/Makefile  Mon Dec 11 13:48:52 2000 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 2000/12/11 13:48:53 ad Exp $
+
+PROG=  iopctl
+MAN=   iopctl.8
+
+.include <bsd.prog.mk>
diff -r bed1d71f8edf -r 3b02b1d06b27 usr.sbin/iopctl/iopctl.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/iopctl/iopctl.8  Mon Dec 11 13:48:52 2000 +0000
@@ -0,0 +1,98 @@
+.\"    $NetBSD: iopctl.8,v 1.1 2000/12/11 13:48:53 ad Exp $
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Andrew Doran.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"        This product includes software developed by the NetBSD
+.\"        Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\"    contributors may be used to endorse or promote products derived
+.\"    from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 1, 2000
+.Dt IOPCTL 8
+.Os NetBSD
+.Sh NAME
+.Nm iopctl
+.Nd a program to control IOP devices
+.Sh SYNOPSIS
+.Nm iopctl
+.Op Fl f Ar ctldev
+.Ar command
+.Op tid
+.Sh DESCRIPTION
+.Nm
+can be used to interrogate, issue commands to and otherwise control
+.Xr iop 4
+devices.
+.Pp
+The following options are available:
+.Bl -tag -width xxxxxxxxxxx
+.It Fl f Ar ctldev
+Specify the control device to use. The default is
+.Pa /dev/iop0 .
+.El
+.Pp
+The following commands are available:
+.Bl -tag -width indent
+.It reconfig
+Reconfigure the IOP: ask all bus ports to rescan their busses, and attach or
+detach devices from the system as necessary.
+.It showddmid Ar tid
+Retrieve and display the device driver module parameter group from the
+specified target.
+.It showdevid Ar tid
+Retrieve and display the device identity parameter group from the specified
+target.
+.It showlct
+Display the driver's private copy of the logical configuration table.  This
+copy of the LCT matches the current device configuration, but is not
+necessarily the latest available version of the LCT.
+.It showstatus
+Display the current status of the IOP.
+.El
+.Sh FILES
+.Bl -tag -width /dev/iopn -compact
+.It Pa /dev/iop Ns Ar u
+control device for IOP unit
+.Ar u
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr iop 4 ,
+.Xr iopsp 4 ,
+.Xr ld 4
+.Sh AUTHOR
+The
+.Nm
+command was written by Andrew Doran.
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Nx 1.6 .
diff -r bed1d71f8edf -r 3b02b1d06b27 usr.sbin/iopctl/iopctl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/iopctl/iopctl.c  Mon Dec 11 13:48:52 2000 +0000
@@ -0,0 +1,449 @@
+/*     $NetBSD: iopctl.c,v 1.1 2000/12/11 13:48:53 ad Exp $    */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef lint
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: iopctl.c,v 1.1 2000/12/11 13:48:53 ad Exp $");
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/uio.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include <util.h>
+#include <getopt.h>
+
+#include <dev/i2o/i2o.h>
+#include <dev/i2o/iopvar.h>
+
+const char     *class2str(int);
+int    main(int, char *[]);
+int    show(const char *, const char *, ...);
+void   i2ostrvis(const char *, int, char *, int);
+void   usage(void);
+
+void   reconfig(char **);
+void   showdevid(char **);
+void   showddmid(char **);
+void   showlct(char **);
+void   showstatus(char **);
+
+struct {
+       int     class;
+       const char      *caption;
+} const i2oclass[] = {
+       { I2O_CLASS_EXECUTIVE, "executive" },
+       { I2O_CLASS_DDM, "device driver module" },
+       { I2O_CLASS_RANDOM_BLOCK_STORAGE, "random block storage" },
+       { I2O_CLASS_SEQUENTIAL_STORAGE, "sequential storage" },
+       { I2O_CLASS_LAN, "LAN port" },
+       { I2O_CLASS_WAN, "WAN port" },
+       { I2O_CLASS_FIBRE_CHANNEL_PORT, "fibrechannel port" },
+       { I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL, "fibrechannel peripheral" },
+       { I2O_CLASS_SCSI_PERIPHERAL, "SCSI peripheral" },
+       { I2O_CLASS_ATE_PORT, "ATE port" },
+       { I2O_CLASS_ATE_PERIPHERAL, "ATE peripheral" },
+       { I2O_CLASS_FLOPPY_CONTROLLER, "floppy controller" },
+       { I2O_CLASS_FLOPPY_DEVICE, "floppy device" },
+       { I2O_CLASS_BUS_ADAPTER_PORT, "bus adapter port" },
+};
+
+struct {
+       const char      *label;
+       int     takesargs;
+       void    (*func)(char **);
+} const cmdtab[] = {
+       { "reconfig", 0, reconfig },
+       { "showddmid", 1, showddmid },
+       { "showdevid", 1, showdevid },
+       { "showlct", 0, showlct },
+       { "showstatus", 0, showstatus },
+};
+
+int    fd;
+char   buf[32768];
+struct i2o_status status;
+
+int
+main(int argc, char **argv)
+{
+       int ch, i;
+       const char *dv;
+       struct iovec iov;
+
+       dv = "/dev/iop0";
+       
+       while ((ch = getopt(argc, argv, "f:")) != -1) {
+               switch (ch) {
+               case 'f':
+                       dv = optarg;



Home | Main Index | Thread Index | Old Index