diff options
author | brian <brian@FreeBSD.org> | 2001-05-02 01:08:09 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-05-02 01:08:09 +0000 |
commit | d56c2badd609cf617b87e58be1d05bd9271b0819 (patch) | |
tree | 9433437f22d179a0c82daf644278ab5db7c011ad /usr.sbin | |
parent | 66031e93ec86375e32e73aa5b08ce1414a0347d6 (diff) | |
download | FreeBSD-src-d56c2badd609cf617b87e58be1d05bd9271b0819.zip FreeBSD-src-d56c2badd609cf617b87e58be1d05bd9271b0819.tar.gz |
Add a ``digi'' driver.
This driver supports PCI Xr-based and ISA Xem Digiboard cards.
dgm will go away soon if there are no problems reported. For now,
configuring dgm into your kernel warns that you should be using
digi. This driver is probably close to supporting Xi, Xe and Xeve
cards, but I wouldn't expect them to work properly (hardware
donations welcome).
The digi_* pseudo-drivers are not drivers themselves but contain
the BIOS and FEP/OS binaries for various digiboard cards and are
auto-loaded and auto-unloaded by the digi driver at initialisation
time. They *may* be configured into the kernel, but waste a lot
of space if they are. They're intended to be left as modules.
The digictl program is (mainly) used to re-initialise cards that
have external port modules attached such as the PC/Xem.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/Makefile | 1 | ||||
-rw-r--r-- | usr.sbin/digictl/Makefile | 9 | ||||
-rw-r--r-- | usr.sbin/digictl/digictl.8 | 80 | ||||
-rw-r--r-- | usr.sbin/digictl/digictl.c | 120 |
4 files changed, 210 insertions, 0 deletions
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 9422329..d276a0c 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -23,6 +23,7 @@ SUBDIR= IPXrouted \ ctm \ dev_mkdb \ devinfo \ + digictl \ diskpart \ edquota \ extattrctl \ diff --git a/usr.sbin/digictl/Makefile b/usr.sbin/digictl/Makefile new file mode 100644 index 0000000..63fc770 --- /dev/null +++ b/usr.sbin/digictl/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= digictl +MAN= digictl.8 + +CFLAGS+=-Wall +CFLAGS+=-I${.CURDIR}/../../sys + +.include <bsd.prog.mk> diff --git a/usr.sbin/digictl/digictl.8 b/usr.sbin/digictl/digictl.8 new file mode 100644 index 0000000..81c84aa --- /dev/null +++ b/usr.sbin/digictl/digictl.8 @@ -0,0 +1,80 @@ +.\" $FreeBSD$ +.Dd May 1, 2001 +.Dt DIGICTL 8 +.Os +.Sh NAME +.Nm digictl +.Nd Control Digiboard devices +.Sh SYNOPSIS +.Nm +.Op Fl d Ar debug +.Op Fl ir +.Ar device ... +.Sh DESCRIPTION +The +.Nm +program provides control of the Digiboard installed with the given control +.Ar device +name. +A digiboard control +.Ar device +is usually of the form +.Dq /dev/digi Ns Ar N Ns No .ctl +where +.Ar N +is the card number and starts at 0 for the first attached card. +.Pp +The following flags are recognised: +.Bl -tag -width XXXX -offset XXXX +.It Fl d Ar debug +If the driver has been compiled with +.Dv DEBUG +defined, the following bits from the +.Ar debug +variable are used to enable diagnostics in the digiboard driver: +.Bl -tag -width XXXXXXXXXXXX +.It 1 ( Em INIT ) +Diagnostics during card attach, detach and initialisation. +.It 2 ( Em OPEN ) +Diagnostics when opening a port. +.It 4 ( Em CLOSE ) +Diagnostics when closing a port. +.It 8 ( Em SET ) +Diagnostics when setting tty device flags. +.It 16 ( Em INT ) +Diagnostics when processing card events. +.It 32 ( Em READ ) +Reports return values from port reads. +.It 64 ( Em WRITE ) +Reports return values from port writes. +.It 128 ( Em RX ) +Reports receive queue flow control. +.It 256 ( Em TX ) +Reports transmit queue flow control. +.It 512 ( Em IRQ ) +Diagnostics during interrupts (enable these with care). +.It 1024 ( Em MODEM ) +Diagnostics when setting modem status flags. +.It 2048 ( Em RI ) +Reports when a RING is received. +.El +.It Fl i +Display the card identification string and type id. +.It Fl r +Reinitialise the card. +For boards with external port modules, it is possible to add or remove +modules and dynamically reprobe the number of ports using this switch. +All ports on the card must be closed in order to reinitialise the card. +.Pp +It is preferable to reinitialise the card rather than reload the entire +digi module as reinitialisation only affects the specified board rather +than affecting all attached boards. +.El +.Sh BUGS +It should be possible to reinitialise a board without closing all of the +existing ports. +.Sh HISTORY +The +.Nm +command first appeared in +.Fx 5.0 . diff --git a/usr.sbin/digictl/digictl.c b/usr.sbin/digictl/digictl.c new file mode 100644 index 0000000..157ced6 --- /dev/null +++ b/usr.sbin/digictl/digictl.c @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> +#include <sys/ioctl.h> +#include <unistd.h> + +#include "dev/digi/digiio.h" + +static int +usage(const char *prog) +{ + fprintf(stderr, "Usage: %s [-d debug] [-ir] device...\n", prog); + return (EX_USAGE); +} + +int +main(int argc, char **argv) +{ + char namedata[256], *name = namedata; + const char *prog; + digiModel_t model; + int ch, debug, fd, i, res; + int dflag, iflag, rflag; + + if ((prog = strrchr(argv[0], '/')) == NULL) + prog = argv[0]; + else + prog++; + + dflag = iflag = rflag = 0; + while ((ch = getopt(argc, argv, "d:ir")) != -1) + switch (ch) { + case 'd': + dflag = 1; + debug = atoi(optarg); + break; + case 'i': + iflag = 1; + break; + case 'r': + rflag = 1; + break; + default: + return usage(prog); + } + + if (argc < optind) + return usage(prog); + + res = 0; + for (i = optind; i < argc; i++) { + if ((fd = open(argv[i], O_RDONLY)) == -1) { + fprintf(stderr, "%s: %s: open: %s\n", prog, argv[i], + strerror(errno)); + res++; + continue; + } + + if (dflag && ioctl(fd, DIGIIO_DEBUG, &debug) != 0) { + fprintf(stderr, "%s: %s: debug: %s\n", + prog, argv[i], strerror(errno)); + res++; + } + + if (iflag) { + if (ioctl(fd, DIGIIO_MODEL, &model) != 0) { + fprintf(stderr, "%s: %s: model: %s\n", + prog, argv[i], strerror(errno)); + res++; + } else if (ioctl(fd, DIGIIO_IDENT, &name) != 0) { + fprintf(stderr, "%s: %s: ident: %s\n", + prog, argv[i], strerror(errno)); + res++; + } else + printf("%s: %s (type %d)\n", + argv[i], name, (int)model); + } + + if (rflag && ioctl(fd, DIGIIO_REINIT) != 0) { + fprintf(stderr, "%s: %s: reinit: %s\n", + prog, argv[i], strerror(errno)); + res++; + } + + close(fd); + } + + return (res); +} |