TO_REMOVE+=/usr/share/man/man1/strip217.1.gz
TO_REMOVE+=/usr/share/man/cat4/i386/est.4.gz
TO_REMOVE+=/usr/share/man/man4/i386/est.4.gz
-
-.if ${MACHINE_ARCH} == "x86_64"
-TO_REMOVE+=/usr/sbin/sgsc
-TO_REMOVE+=/usr/share/man/cat1/sgsc.1.gz
-TO_REMOVE+=/usr/share/man/man1/sgsc.1.gz
+TO_REMOVE+=/boot/kernel/aha.ko
+TO_REMOVE+=/usr/bin/sasc
+TO_REMOVE+=/usr/include/machine/asc_ioctl.h
TO_REMOVE+=/usr/include/machine/gsc.h
+TO_REMOVE+=/usr/include/machine/spigot.h
+TO_REMOVE+=/usr/libexec/xtend
+TO_REMOVE+=/usr/sbin/sgsc
+TO_REMOVE+=/usr/sbin/wlconfig
TO_REMOVE+=/usr/sbin/xten
+TO_REMOVE+=/usr/share/man/cat1/sasc.1.gz
+TO_REMOVE+=/usr/share/man/cat1/sgsc.1.gz
TO_REMOVE+=/usr/share/man/cat1/xten.1.gz
+TO_REMOVE+=/usr/share/man/cat4/aha.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386.asc.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386.dgb.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/el.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/gsc.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/ie.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/labpc.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/le.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/mse.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386.rc.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/rdp.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386.tw.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/wl.4.gz
+TO_REMOVE+=/usr/share/man/cat4/i386/wt.4.gz
+TO_REMOVE+=/usr/share/man/cat8/wlconfig.8.gz
+TO_REMOVE+=/usr/share/man/cat8/xtend.8.gz
+TO_REMOVE+=/usr/share/man/man1/sasc.1.gz
+TO_REMOVE+=/usr/share/man/man1/sgsc.1.gz
TO_REMOVE+=/usr/share/man/man1/xten.1.gz
+TO_REMOVE+=/usr/share/man/man4/aha.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/asc.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/dgb.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/el.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/gsc.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/ie.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/labpc.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/le.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/mse.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/rc.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/rdp.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/tw.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/wl.4.gz
+TO_REMOVE+=/usr/share/man/man4/i386/wt.4.gz
+TO_REMOVE+=/usr/share/man/man8/wlconfig.8.gz
+TO_REMOVE+=/usr/share/man/man8/xten.8.gz
+
+.if ${MACHINE_ARCH} == "x86_64"
TO_REMOVE+=/usr/libdata/stallion/2681.sys
TO_REMOVE+=/usr/libdata/stallion/cdk.sys
TO_REMOVE+=/usr/sbin/stlload
# Setup some shorthand for regex that we use later in the file.
#XXX Yes, these are gross -- imp
set scsi-controller-regex
- "(aac|adv|adw|aha|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\
+ "(aac|adv|adw|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\
esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\
[0-9]+";
};
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/lib/libc/net/if_indextoname.3,v 1.11 2005/11/23 10:49:07 ru Exp $
-.\" $DragonFly: src/lib/libc/net/if_indextoname.3,v 1.5 2007/08/18 20:48:47 swildner Exp $
.\"
.Dd November 23, 2005
.Dt IF_NAMETOINDEX 3
structure contains at least the following entries:
.Bd -literal
unsigned int if_index; /* 1, 2, ... */
- char *if_name; /* null terminated name: "le0", ... */
+ char *if_name; /* null terminated name: "lnc0", ... */
.Ed
.Pp
The end of the array of structures is indicated by a structure with an
.\"
.\" From: @(#)linkaddr.3 8.1 (Berkeley) 7/28/93
.\" $FreeBSD: src/lib/libc/net/linkaddr.3,v 1.16 2007/02/28 21:18:38 bms Exp $
-.\" $DragonFly: src/lib/libc/net/linkaddr.3,v 1.3 2008/11/23 21:55:52 swildner Exp $
.\"
.Dd February 28, 2007
.Dt LINK_ADDR 3
.\" .Ed
.\" .Pp
Thus
-.Li le0:8.0.9.13.d.30
+.Li lnc0:8.0.9.13.d.30
represents an ethernet address
to be transmitted on the first Lance ethernet interface.
.Sh RETURN VALUES
int hostnamelen;
char domainname[FNAME_SIZE]; /* our DNS domain */
int domainnamelen;
-char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */
+char ifname[IFNAME_SIZE]; /* name of interface (e.g. "lnc0") */
struct in_addr myip; /* my ip address */
struct in_addr nameip; /* DNS server ip address */
struct in_addr rootip; /* root ip address */
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD: src/libexec/Makefile,v 1.42.2.5 2002/11/12 17:32:48 obrien Exp $
-# $DragonFly: src/libexec/Makefile,v 1.13 2008/02/02 18:20:51 matthias Exp $
# Present but disabled: kpasswdd
SUBDIR= atrun \
telnetd \
tftpd \
utmp_update \
- xtend \
ypxfr
.if !defined(NO_SENDMAIL)
+++ /dev/null
-# Makefile for xtend (Stark) 10/30/93
-# $FreeBSD: src/libexec/xtend/Makefile,v 1.7.2.1 2001/04/25 10:41:03 ru Exp $
-
-BINMODE= 555
-
-PROG= xtend
-SRCS= xtend.c status.c packet.c user.c
-WARNS?= 1
-
-CFLAGS+= -DXTENUNAME=\"xten\" -DXTENGNAME=\"xten\"
-DPADD= ${LIBUTIL}
-LDADD= -lutil
-
-MAN= xtend.8
-
-.include <bsd.prog.mk>
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/packet.c,v 1.8 1999/08/28 00:10:30 peter Exp $
- * $DragonFly: src/libexec/xtend/packet.c,v 1.2 2003/06/17 04:27:08 dillon Exp $
- */
-
-#include <stdio.h>
-#include <sys/time.h>
-#include "xtend.h"
-#include "xten.h"
-
-char *X10housenames[] = {
- "A", "B", "C", "D", "E", "F", "G", "H",
- "I", "J", "K", "L", "M", "N", "O", "P",
- NULL
-};
-
-char *X10cmdnames[] = {
- "1", "2", "3", "4", "5", "6", "7", "8",
- "9", "10", "11", "12", "13", "14", "15", "16",
- "AllUnitsOff", "AllLightsOn", "On", "Off", "Dim", "Bright", "AllLightsOff",
- "ExtendedCode", "HailRequest", "HailAcknowledge", "PreSetDim0", "PreSetDim1",
- "ExtendedData", "StatusOn", "StatusOff", "StatusRequest",
- NULL
-};
-
-/*
- * Log a packet and update device status accordingly
- */
-
-void
-logpacket(p)
-unsigned char *p;
-{
- fprintf(Log, "%s: %s %s ", thedate(),
- X10housenames[p[1]], X10cmdnames[p[2]]);
- if(p[0] & TW_RCV_LOCAL) fprintf(Log, "(loc,");
- else fprintf(Log, "(rem,");
- if(p[0] & TW_RCV_ERROR) fprintf(Log, "err)");
- else fprintf(Log, " ok)");
- fprintf(Log, "\n");
-}
-
-/*
- * Process a received packet p, updating device status information both
- * in core and on disk.
- */
-
-void
-processpacket(p)
-unsigned char *p;
-{
- int i, j, h, k;
- STATUS *s;
-
- /*
- * If the packet had the error flag set, there is no other useful info.
- */
- if(p[0] & TW_RCV_ERROR) return;
- /*
- * First update in-core status information for the device.
- */
- h = p[1]; k = p[2];
- if(k < 16) { /* We received a unit code, to select a particular device */
- s = &Status[h][k];
- s->selected = SELECTED;
- s->lastchange = time(NULL);
- s->changed = 1;
- } else { /* We received a key code, to execute some function */
- /*
- * Change in status depends on the key code received
- */
- if(k == DIM) {
- /*
- * We can't really track DIM/BRIGHT properly the way things are right
- * now. The TW523 reports the first, fourth, seventh, etc. Dim packet.
- * We don't really have any way to tell when gaps occur, to cancel
- * selection. For now, we'll assume that successive sequences of
- * Dim/Bright commands are never transmitted without some other
- * intervening command, and we make a good guess about how many units of
- * dim/bright are represented by each packet actually reported by the
- * TW523.
- */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- switch(s->selected) {
- case SELECTED: /* Selected, but not being dimmed or brightened */
- if(s->onoff == 0) {
- s->onoff = 1;
- s->brightness = 15;
- }
- s->brightness -= 2;
- if(s->brightness < 0) s->brightness = 0;
- s->selected = DIMMING;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- case DIMMING: /* Selected and being dimmed */
- s->brightness -=3;
- if(s->brightness < 0) s->brightness = 0;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- case BRIGHTENING: /* Selected and being brightened (an error) */
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- default:
- break;
- }
- }
- } else if(k == BRIGHT) {
- /*
- * Same problem here...
- */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- switch(s->selected) {
- case SELECTED: /* Selected, but not being dimmed or brightened */
- if(s->onoff == 0) {
- s->onoff = 1;
- s->brightness = 15;
- }
- s->brightness += 2;
- if(s->brightness > 15) s->brightness = 15;
- s->selected = BRIGHTENING;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- case DIMMING: /* Selected and being dimmed (an error) */
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- case BRIGHTENING: /* Selected and being brightened */
- s->brightness +=3;
- if(s->brightness > 15) s->brightness = 15;
- s->lastchange = time(NULL);
- s->changed = 1;
- break;
- default:
- break;
- }
- }
- } else { /* Other key codes besides Bright and Dim */
- /*
- * We cancel brightening and dimming on ALL units on ALL house codes,
- * because the arrival of a different packet indicates a gap that
- * terminates any prior sequence of brightening and dimming
- */
- for(j = 0; j < 16; j++) {
- for(i = 0; i < 16; i++) {
- s = &Status[j][i];
- if(s->selected == BRIGHTENING || s->selected == DIMMING) {
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- }
- switch(k) {
- case ALLUNITSOFF:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- s->onoff = 0;
- s->selected = IDLE;
- s->brightness = 0;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- break;
- case ALLLIGHTSON:
- /* Does AllLightsOn cancel selectedness of non-lights? */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->devcap & ISLIGHT) {
- s->onoff = 1;
- s->selected = IDLE;
- s->brightness = 15;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case UNITON:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == SELECTED) {
- s->onoff = 1;
- s->selected = IDLE;
- s->brightness = 15;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case UNITOFF:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == SELECTED) {
- s->onoff = 0;
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case ALLLIGHTSOFF:
- /* Does AllLightsOff cancel selectedness of non-lights? */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->devcap & ISLIGHT) {
- s->onoff = 0;
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case EXTENDEDCODE:
- break;
- case HAILREQUEST:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == SELECTED) {
- s->selected = HAILED;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case HAILACKNOWLEDGE:
- /* Do these commands cancel selection of devices not affected? */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == HAILED) {
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case PRESETDIM0:
- case PRESETDIM1:
- /* I don't really understand these */
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == SELECTED) {
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case EXTENDEDDATA:
- /* Who knows? The TW523 can't receive these anyway. */
- break;
- case STATUSON:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected == REQUESTED) {
- s->onoff = 1;
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- case STATUSOFF:
- for(i = 0; i < 16; i++) {
- if(s->selected == REQUESTED) {
- s = &Status[h][i];
- s->onoff = 0;
- s->selected = IDLE;
- s->brightness = 0;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- case STATUSREQUEST:
- for(i = 0; i < 16; i++) {
- s = &Status[h][i];
- if(s->selected) {
- s->selected = REQUESTED;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- break;
- }
- }
- }
-}
+++ /dev/null
-/*
- * Pathnames for files used by xtend
- *
- * $FreeBSD: src/libexec/xtend/paths.h,v 1.6 1999/08/28 00:10:30 peter Exp $
- * $DragonFly: src/libexec/xtend/paths.h,v 1.2 2003/06/17 04:27:08 dillon Exp $
- */
-
-#define X10DIR "/var/spool/xten"
-#define X10LOGNAME "Log"
-#define X10STATNAME "Status"
-#define X10DUMPNAME "status.out"
-#define TWPATH "/dev/tw0"
-#define SOCKPATH "/var/run/tw523"
-#define PIDPATH "/var/run/xtend.pid"
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/status.c,v 1.8 1999/08/28 00:10:30 peter Exp $
- * $DragonFly: src/libexec/xtend/status.c,v 1.3 2003/11/14 03:54:32 dillon Exp $
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include "xtend.h"
-#include "xten.h"
-#include "paths.h"
-
-void printstatus (FILE *, STATUS *);
-
-/*
- * Initialize the status table from the status files
- */
-
-void
-initstatus()
-{
- if(lseek(status, 0, SEEK_SET) != 0) {
- fprintf(Log, "%s: Seek error on status file\n", thedate());
- return;
- }
- if(read(status, Status, 16*16*sizeof(STATUS)) != 16*16*sizeof(STATUS)) {
- fprintf(Log, "%s: Read error on status file\n", thedate());
- return;
- }
-}
-
-/*
- * Checkpoint status of any devices whose status has changed
- * and notify anyone monitoring those devices.
- */
-
-void
-checkpoint_status()
-{
- int h, i, k, offset;
-
- offset = 0;
- for(h = 0; h < 16; h++) {
- for(i = 0; i < 16; i++) {
- if(Status[h][i].changed) {
- if(lseek(status, offset, SEEK_SET) != offset) {
- fprintf(Log, "%s: Seek error on status file\n", thedate());
- } else {
- if(write(status, &Status[h][i], sizeof(STATUS)) != sizeof(STATUS)) {
- fprintf(Log, "%s: Write error on status file\n", thedate());
- }
- }
- Status[h][i].changed = 0;
- for(k = 0; k < MAXMON; k++) {
- if(Monitor[k].inuse
- && Monitor[k].house == h && Monitor[k].unit == i) {
- /*
- * Arrange to catch SIGPIPE in case client has gone away.
- */
- extern int client;
- extern void clientgone();
- void (*prev)();
-
- client = k;
- prev = signal(SIGPIPE, clientgone);
- printstatus(Monitor[k].user, &Status[h][i]);
- fflush(Monitor[k].user);
- signal(SIGPIPE, prev);
- }
- }
- }
- offset += sizeof(STATUS);
- }
- }
-}
-
-int client;
-
-void clientgone()
-{
- fprintf(Log, "%s: Deleting monitor table entry %d, client gone\n", thedate(), client);
- fclose(Monitor[client].user);
- Monitor[client].inuse = 0;
-}
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/user.c,v 1.9 1999/08/28 00:10:30 peter Exp $
- * $DragonFly: src/libexec/xtend/user.c,v 1.3 2003/11/14 03:54:32 dillon Exp $
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include "xtend.h"
-#include "xten.h"
-#include "paths.h"
-
-MONENTRY Monitor[MAXMON];
-
-int find (char *, char *[]);
-void printstatus (FILE *, STATUS *);
-
-/*
- * Process a user command
- */
-
-int
-user_command()
-{
- char h;
- char *m;
- int i, k, n, error;
- char cmd[512], dumppath[MAXPATHLEN+1], pkt[3];
- FILE *dumpf;
-
- error = 0;
- if(fgets(cmd, 512, User) != NULL) {
- m = cmd;
- while ( *m != '\0' ) {
- if(isupper(*m))
- *m = tolower(*m);
- m++;
- }
- if(sscanf(cmd, "status %c %d", &h, &i) == 2
- && h >= 'a' && h <= 'p' && i >= 1 && i <= 16) {
- h -= 'a';
- i--;
- printstatus(User, &Status[h][i]);
- } else if(sscanf(cmd, "send %c %s %d", &h, cmd, &n) == 3
- && h >= 'a' && h <= 'p' && (i = find(cmd, X10cmdnames)) >= 0) {
- h -= 'a';
- pkt[0] = h;
- pkt[1] = i;
- pkt[2] = n;
- if(write(tw523, pkt, 3) != 3) {
- fprintf(Log, "%s: Transmission error (packet [%s %s]:%d).\n",
- thedate(), X10housenames[h], X10cmdnames[i], n);
- error++;
- } else {
- fprintf(User, "OK\n");
- }
- } else if(!strcmp("dump\n", cmd)) {
- strcpy(dumppath, X10DIR);
- strcat(dumppath, "/");
- strcat(dumppath, X10DUMPNAME);
- if((dumpf = fopen(dumppath, "w")) != NULL) {
- for(h = 0; h < 16; h++) {
- for(i = 0; i < 16; i++) {
- if(Status[h][i].lastchange) {
- fprintf(dumpf, "%s%d\t", X10housenames[h], i+1);
- printstatus(dumpf, &Status[h][i]);
- }
- }
- }
- fclose(dumpf);
- fprintf(User, "OK\n");
- } else {
- error++;
- }
- } else if(sscanf(cmd, "monitor %c %d", &h, &i) == 2
- && h >= 'a' && h <= 'p' && i >= 1 && i <= 16) {
- h -= 'a';
- i--;
- for(k = 0; k < MAXMON; k++) {
- if(!Monitor[k].inuse) break;
- }
- if(k == MAXMON) {
- error++;
- } else {
- Monitor[k].house = h;
- Monitor[k].unit = i;
- Monitor[k].user = User;
- Monitor[k].inuse = 1;
- fprintf(Log, "%s: Adding %c %d to monitor list (entry %d)\n",
- thedate(), h+'A', i+1, k);
- fprintf(User, "OK\n");
- fflush(User);
- User = NULL;
- return(0); /* We don't want caller to close stream */
- }
- } else if(!strcmp("done\n", cmd)) {
- fprintf(User, "OK\n");
- fflush(User);
- return(1);
- } else {
- if(feof(User)) {
- return(1);
- } else {
- error++;
- }
- }
- } else {
- error++;
- }
- if(error) {
- fprintf(User, "ERROR\n");
- }
- fflush(User);
- return(0);
-}
-
-int
-find(s, tab)
-char *s;
-char *tab[];
-{
- int i;
-
- for(i = 0; tab[i] != NULL; i++) {
- if(strcasecmp(s, tab[i]) == 0) return(i);
- }
- return(-1);
-}
-
-void
-printstatus(f, s)
-FILE *f;
-STATUS *s;
-{
- fprintf(f, "%s:%d", s->onoff ? "On" : "Off", s->brightness);
- switch(s->selected) {
- case IDLE:
- fprintf(f, " (normal) "); break;
- case SELECTED:
- fprintf(f, " (selected) "); break;
- case DIMMING:
- fprintf(f, " (dimming) "); break;
- case BRIGHTENING:
- fprintf(f, " (brightening) "); break;
- case REQUESTED:
- fprintf(f, " (requested) "); break;
- case HAILED:
- fprintf(f, " (hailed) "); break;
- default:
- fprintf(f, " (bogus) "); break;
- }
- fprintf(f, "%s", ctime(&s->lastchange));
-}
-
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/xten.h,v 1.6 1999/08/28 00:10:31 peter Exp $
- * $DragonFly: src/libexec/xtend/xten.h,v 1.2 2003/06/17 04:27:08 dillon Exp $
- */
-
-extern char *X10housenames[];
-extern char *X10cmdnames[];
-
-#define ALLUNITSOFF 16
-#define ALLLIGHTSON 17
-#define UNITON 18
-#define UNITOFF 19
-#define DIM 20
-#define BRIGHT 21
-#define ALLLIGHTSOFF 22
-#define EXTENDEDCODE 23
-#define HAILREQUEST 24
-#define HAILACKNOWLEDGE 25
-#define PRESETDIM0 26
-#define PRESETDIM1 27
-#define EXTENDEDDATA 28
-#define STATUSON 29
-#define STATUSOFF 30
-#define STATUSREQUEST 31
-
-/*
- * Flags for first byte of received packet
- */
-
-#define TW_RCV_LOCAL 1 /* The packet arrived during a local transmission */
-#define TW_RCV_ERROR 2 /* An invalid/corrupted packet was received */
-
+++ /dev/null
-.\" Copyright (c) 1992, 1993 Eugene W. Stark
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Eugene W. Stark.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/xtend.8,v 1.11.2.4 2001/08/16 10:44:22 ru Exp $
-.\" $DragonFly: src/libexec/xtend/xtend.8,v 1.4 2007/12/16 02:55:38 thomas Exp $
-.\"
-.Dd October 30, 1993
-.Dt XTEND 8
-.Os
-.Sh NAME
-.Nm xtend
-.Nd X-10 daemon
-.Sh SYNOPSIS
-.Nm /usr/libexec/xtend
-.Sh DESCRIPTION
-.Nm Xtend
-interfaces between user-level programs and the TW523 X-10 controller.
-It logs all packets received from the TW523, attempts to track the
-status of all X-10 devices, and accepts socket connections from user-level
-client programs that need to manipulate X-10 devices.
-.Pp
-When
-.Nm
-is started, it forks, releases the controlling terminal, then opens
-its log file, where it subsequently records all X-10 activity and
-diagnostic messages. It then begins processing packets received from
-the TW523 and accepting connections one at a time from clients
-wishing to issue X-10 commands.
-.Pp
-Sending
-.Nm
-a
-.Dv SIGHUP
-causes it to close and reopen its log file. This is useful
-in shell scripts that rotate the log files to keep them from growing
-indefinitely.
-If
-.Nm
-receives a
-.Dv SIGTERM ,
-it shuts down gracefully and exits.
-A
-.Dv SIGPIPE
-causes
-.Nm
-to abort the current client connection.
-.Pp
-.Nm Xtend
-communicates with client processes by a simple protocol in which a one-line
-command is sent by the client, and is acknowledged by a one-line response
-from the daemon.
-.Pp
-.Nm Xtend
-understands four types of commands:
-.Bl -tag -width "monitor H U"
-.It Ic status Ar H U
-where
-.Ar H
-is a single letter house code, and
-.Ar U
-is a numeric unit code,
-causes
-.Nm
-to respond with one line of status information about the specified device.
-.It Ic send Ar H U N
-where
-.Ar H
-is a single-letter house code,
-.Ar U
-is either a numeric unit code
-or a function code (see source file
-.Pa xtend/packet.c )
-for a list, and
-.Ar N
-is a number indicating the number of times (usually 2)
-the packet is to be transmitted without gaps,
-causes
-.Nm
-to perform the specified X-10 transmission. If the transmission was apparently
-successful, a single-line response containing
-.Sy OK
-is issued, otherwise a single-line response containing
-.Sy ERROR
-is produced.
-.It Ic dump
-causes
-.Nm
-to dump the current status of all devices to an
-.Tn ASCII
-file in the spool
-directory. The response
-.Sy OK
-is issued, regardless of whether the status dump was successful.
-.It Ic monitor Ar H U
-causes
-.Nm
-to add the current client socket connection to a list of clients that are to
-be notified about activity concerning the specified X-10 device.
-The single-line acknowledgement
-.Sy OK
-is returned if the maximum (currently 5) number of such clients was not
-exceeded, otherwise
-.Sy ERROR
-is returned.
-.Nm Xtend
-then returns to its normal mode of accepting connections from clients.
-However, each subsequent change in the status of the specified device will
-cause
-.Nm
-to write one line of status information for the device (in the same
-format as produced by the
-.Ic status
-command) to the saved socket. This feature is useful for writing programs
-that need to monitor the activity of devices, like motion detectors, that can
-perform X-10 transmissions.
-.El
-.Sh OPTIONS
-None.
-.Sh FILES
-.Bl -tag -width /var/spool/xten/status.out -compact
-.It Pa /dev/tw0
-the TW523 special file
-.It Pa /var/run/tw523
-socket for client connections
-.It Pa /var/run/xtend.pid
-pid file
-.It Pa /var/spool/xten/Log
-log file
-.It Pa /var/spool/xten/Status
-device status file (binary)
-.It Pa /var/spool/xten/status.out
-.Tn ASCII
-dump of device status
-.El
-.Sh SEE ALSO
-.Xr xten 1 ,
-.Xr tw 4
-.Sh AUTHORS
-.An Eugene W. Stark Aq stark@cs.sunysb.edu
-.Sh BUGS
-There is currently no timeout on client socket connections, so a hung
-client program can prevent other clients from accessing the daemon.
-.Pp
-.Nm Xtend
-does the best it can at trying to track device status, but there is
-usually no way it can tell when a device has been operated manually.
-This is due to the fact that most X-10 devices are not able to
-respond to queries about their status.
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/xtend.c,v 1.9 1999/08/28 00:10:31 peter Exp $
- * $DragonFly: src/libexec/xtend/xtend.c,v 1.3 2003/11/14 03:54:32 dillon Exp $
- */
-
-/*
- * xtend - X-10 daemon
- * Eugene W. Stark (stark@cs.sunysb.edu)
- * January 14, 1993
- */
-
-#include <err.h>
-#include <pwd.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <grp.h>
-
-#include "xtend.h"
-#include "xten.h"
-#include "paths.h"
-
-FILE *Log; /* Log file */
-FILE *User; /* User connection */
-STATUS Status[16][16]; /* Device status table */
-int status; /* Status file descriptor */
-int tw523; /* tw523 controller */
-int sock; /* socket for user */
-jmp_buf mainloop; /* longjmp point after SIGHUP */
-void onhup(); /* SIGHUP handler */
-void onterm(); /* SIGTERM handler */
-void onpipe(); /* SIGPIPE handler */
-
-void checkpoint_status (void);
-void initstatus (void);
-void logpacket (unsigned char *);
-void processpacket (unsigned char *);
-int user_command (void);
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char *twpath = TWPATH;
- char *sockpath = SOCKPATH;
- char logpath[MAXPATHLEN+1];
- char statpath[MAXPATHLEN+1];
- struct sockaddr_un sa;
- struct timeval tv;
- struct passwd *pw;
- struct group *gr;
- struct stat sb;
- int user;
- FILE *pidf;
-
- /*
- * Make sure we start out running as root
- */
- if(geteuid() != 0)
- errx(1, "you must be root");
-
- /*
- * Find out what UID/GID we are to run as
- */
- if((pw = getpwnam(XTENUNAME)) == NULL)
- errx(1, "no such user '%s'", XTENUNAME);
- if((gr = getgrnam(XTENGNAME)) == NULL)
- errx(1, "no such group '%s'", XTENGNAME);
-
- /*
- * Open the log file before doing anything else
- */
- strcpy(logpath, X10DIR);
- if(stat(logpath, &sb) == -1 && errno == ENOENT) {
- if(mkdir(logpath, 0755) != -1) {
- chown(logpath, pw->pw_uid, gr->gr_gid);
- } else {
- errx(1, "can't create directory '%s'", logpath);
- }
- }
- strcat(logpath, "/");
- strcat(logpath, X10LOGNAME);
- if((Log = fopen(logpath, "a")) == NULL)
- errx(1, "can't open log file '%s'", logpath);
- chown(logpath, pw->pw_uid, gr->gr_gid);
-
- /*
- * Become a daemon
- */
- if(daemon(0, 0) == -1) {
- fprintf(Log, "%s: Unable to become a daemon\n", thedate());
- fclose(Log);
- exit(1);
- }
- fprintf(Log, "%s: %s [%d] started\n", thedate(), argv[0], getpid());
-
- /*
- * Get ahold of the TW523 device
- */
- if((tw523 = open(twpath, O_RDWR)) < 0) {
- fprintf(Log, "%s: Can't open %s\n", thedate(), twpath);
- fclose(Log);
- exit(1);
- }
- fprintf(Log, "%s: %s successfully opened\n", thedate(), twpath);
-
- /*
- * Put our pid in a file so we can be signalled by shell scripts
- */
- if((pidf = fopen(PIDPATH, "w")) == NULL) {
- fprintf(Log, "%s: Error writing pid file: %s\n", thedate(), PIDPATH);
- fclose(Log);
- exit(1);
- }
- fprintf(pidf, "%d\n", getpid());
- fclose(pidf);
-
- /*
- * Set up socket to accept user commands
- */
- if((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- fprintf(Log, "%s: Can't create socket\n", thedate());
- fclose(Log);
- exit(1);
- }
- strcpy(sa.sun_path, sockpath);
- sa.sun_family = AF_UNIX;
- unlink(sockpath);
- if(bind(sock, (struct sockaddr *)(&sa), strlen(sa.sun_path) + 2) < 0) {
- fprintf(Log, "%s: Can't bind socket to %s\n", thedate(), sockpath);
- fclose(Log);
- exit(1);
- }
- if(listen(sock, 5) < 0) {
- fprintf(Log, "%s: Can't listen on socket\n", thedate());
- fclose(Log);
- exit(1);
- }
-
- /*
- * Set proper ownership and permissions on the socket
- */
- if(chown(sockpath, pw->pw_uid, gr->gr_gid) == -1 ||
- chmod(sockpath, 0660) == -1) {
- fprintf(Log, "%s: Can't set owner/permissions on socket\n", thedate());
- fclose(Log);
- exit(1);
- }
-
- /*
- * Give up root privileges
- */
- setgid(pw->pw_gid);
- setuid(pw->pw_uid);
-
- /*
- * Initialize the status table
- */
- strcpy(statpath, X10DIR);
- strcat(statpath, "/");
- strcat(statpath, X10STATNAME);
- if((status = open(statpath, O_RDWR)) < 0) {
- if((status = open(statpath, O_RDWR | O_CREAT, 0666)) < 0) {
- fprintf(Log, "%s: Can't open %s\n", thedate(), statpath);
- fclose(Log);
- exit(1);
- }
- if(write(status, Status, 16 * 16 * sizeof(STATUS))
- != 16 * 16 * sizeof(STATUS)) {
- fprintf(Log, "%s: Error initializing status file\n", thedate());
- fclose(Log);
- exit(1);
- }
- }
- initstatus();
-
- /*
- * Return here on SIGHUP after closing and reopening log file.
- * Also on SIGPIPE after closing user connection.
- */
- signal(SIGTERM, onterm);
- signal(SIGHUP, onhup);
- signal(SIGPIPE, onpipe);
- setjmp(mainloop);
-
- /*
- * Now start the main processing loop.
- */
- tv.tv_sec = 0;
- tv.tv_usec = 250000;
- while(1) {
- fd_set fs;
- unsigned char rpkt[3];
- int sel, h, k;
- STATUS *s;
-
- FD_ZERO(&fs);
- FD_SET(tw523, &fs);
- if(User != NULL) FD_SET(user, &fs);
- else FD_SET(sock, &fs);
- sel = select(FD_SETSIZE, &fs, 0, 0, &tv);
- if(sel == 0) {
- /*
- * Cancel brightening and dimming on ALL units on ALL house codes,
- * because the fact that we haven't gotten a packet for awhile means
- * that there was a gap in transmission.
- */
- for(h = 0; h < 16; h++) {
- for(k = 0; k < 16; k++) {
- s = &Status[h][k];
- if(s->selected == BRIGHTENING || s->selected == DIMMING) {
- s->selected = IDLE;
- s->lastchange = time(NULL);
- s->changed = 1;
- }
- }
- }
- fflush(Log);
- checkpoint_status();
- /*
- * Now that we've done this stuff, we'll set the timeout a little
- * longer, so we don't keep looping too frequently.
- */
- tv.tv_sec = 60;
- tv.tv_usec = 0;
- continue;
- }
- /*
- * While there is stuff happening, we keep a short timeout, so we
- * don't get stuck for some unknown reason, and so we can keep the
- * brightening and dimming data up-to-date.
- */
- tv.tv_sec = 0;
- tv.tv_usec = 250000;
- if(FD_ISSET(tw523, &fs)) { /* X10 data arriving from TW523 */
- if(read(tw523, rpkt, 3) < 3) {
- fprintf(Log, "%s: Error reading from TW523\n", thedate());
- } else {
- logpacket(rpkt);
- processpacket(rpkt);
- }
- } else if(FD_ISSET(user, &fs) && User != NULL) {
- if(user_command()) {
- fprintf(Log, "%s: Closing user connection\n", thedate());
- fclose(User);
- User = NULL;
- }
- } else if(FD_ISSET(sock, &fs)) { /* Accept a connection */
- if (User == NULL) {
- int len = sizeof(struct sockaddr_un);
- if((user = accept(sock, (struct sockaddr *)(&sa), &len)) >= 0) {
- fprintf(Log, "%s: Accepting user connection\n", thedate());
- if((User = fdopen(user, "w+")) == NULL) {
- fprintf(Log, "%s: Can't attach socket to stream\n", thedate());
- }
- } else {
- fprintf(Log, "%s: Failure in attempt to accept connection\n", thedate());
- }
- } else {
- /* "Can't happen */
- }
- }
- }
- /* Not reached */
-}
-
-char *thedate()
-{
- char *cp, *cp1;
- time_t tod;
-
- tod = time(NULL);
- cp = cp1 = ctime(&tod);
- while(*cp1 != '\n') cp1++;
- *cp1 = '\0';
- return(cp);
-}
-
-/*
- * When SIGHUP received, close and reopen the Log file
- */
-
-void onhup()
-{
- char logpath[MAXPATHLEN+1];
-
- fprintf(Log, "%s: SIGHUP received, reopening Log\n", thedate());
- fclose(Log);
- strcpy(logpath, X10DIR);
- strcat(logpath, "/");
- strcat(logpath, X10LOGNAME);
- if((Log = fopen(logpath, "a")) == NULL)
- errx(1, "can't open log file '%s'", logpath);
- longjmp(mainloop, 1);
- /* No return */
-}
-
-/*
- * When SIGTERM received, just exit normally
- */
-
-void onterm()
-{
- fprintf(Log, "%s: SIGTERM received, shutting down\n", thedate());
- fclose(Log);
- exit(0);
-}
-
-/*
- * When SIGPIPE received, reset user connection
- */
-
-void onpipe()
-{
- fprintf(Log, "%s: SIGPIPE received, resetting user connection\n",
- thedate());
- if(User != NULL) {
- fclose(User);
- User = NULL;
- }
- longjmp(mainloop, 1);
- /* No return */
-}
+++ /dev/null
-/*-
- * Copyright (c) 1992, 1993, 1995 Eugene W. Stark
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Eugene W. Stark.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/libexec/xtend/xtend.h,v 1.6 1999/08/28 00:10:31 peter Exp $
- * $DragonFly: src/libexec/xtend/xtend.h,v 1.2 2003/06/17 04:27:08 dillon Exp $
- */
-
-/*
- * Device capabilities
- */
-
-#define ISLIGHT 1 /* Is device a light? */
-#define CANQUERY 2 /* Responds to status query */
-
-/*
- * Device status
- */
-
-typedef enum {
- IDLE,
- SELECTED,
- DIMMING,
- BRIGHTENING,
- REQUESTED,
- HAILED
- } SELECT;
-
-typedef struct {
- unsigned int devcap; /* device capabilities */
- unsigned int changed; /* status changed since last checkpoint? */
- time_t lastchange; /* time status last changed */
- SELECT selected; /* select status of device */
- unsigned int onoff; /* nonzero if on */
- unsigned int brightness; /* value in range 0-15 */
-} STATUS;
-
-typedef struct {
- int inuse; /* Is entry in use? */
- FILE *user; /* Socket to notify user */
- int house; /* House code of device to monitor */
- int unit; /* Unit code of device to monitor */
-} MONENTRY;
-
-#define MAXMON 5 /* Maximum number of monitor entries */
-
-extern FILE *Log; /* Log file */
-extern FILE *User; /* User connection */
-extern STATUS Status[16][16]; /* Device status table */
-extern int status; /* Status file descriptor */
-extern int tw523; /* tw523 controller */
-extern MONENTRY Monitor[MAXMON];/* Monitor table */
-
-extern char *thedate();
aesni.4 \
age.4 \
agp.4 \
- aha.4 \
ahc.4 \
ahci.4 \
ahd.4 \
resource allocation among devices.
.Sh SEE ALSO
.Xr adw 4 ,
-.Xr aha 4 ,
.Xr ahc 4 ,
.Xr cd 4 ,
.Xr da 4 ,
+++ /dev/null
-.\"
-.\" Copyright (c) 1994 Wilko Bulte
-.\" 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.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/aha.4,v 1.11.4.6 2001/10/01 13:07:22 dd Exp $
-.\"
-.Dd October 15, 1998
-.Dt AHA 4
-.Os
-.Sh NAME
-.Nm aha
-.Nd Adaptec SCSI host adapter driver
-.Sh SYNOPSIS
-.Cd device "aha0 at isa? port ? irq ? drq 5"
-.Cd device scbus0 at aha0
-.Sh DESCRIPTION
-This driver provides access to the
-.Tn SCSI
-bus connected to an Adaptec 154xA, 154xB, 154xC, 154xCF, or 154xCP
-host adapter. Host adapters supporting a 154X compatible interface,
-such as some Tekram controllers and the Adaptec 174x in 154x
-emulation mode can also be attached with this driver.
-.Pp
-One kernel config entry for every card to be attached by the system is
-required. Specific values for the port address, irq, and drq may be
-specified. If wildcard values are used, the driver will query the
-device for its current settings and use those. If the port address
-is a wildcard, the driver consults an internal table of possible port address
-locations and attaches to the first unattached card it finds. The possible
-port addresses for this card are 0x330, 0x334, 0x230, 0x234, 0x130, and
-0x134.
-.Sh SEE ALSO
-.Xr ahc 4 ,
-.Xr cd 4 ,
-.Xr da 4 ,
-.Xr sa 4 ,
-.Xr scsi 4
-.\"
-.\" .Sh DIAGNOSTICS
-.\"
-.Sh AUTHORS
-.An -nosplit
-The
-.Nm
-driver was ported by
-.An M. Warner Losh
-from the
-.Nm bt
-driver written by
-.An Justin T. Gibbs .
more SCB space available, the less host bus traffic consumed saving
and restoring SCB data.
.Sh SEE ALSO
-.Xr aha 4 ,
.Xr cd 4 ,
.Xr da 4 ,
.Xr sa 4 ,
.Bl -tag -width 12n -offset indent -compact
.It Xr adv 4
Advansys SCSI host adapter driver
-.It Xr aha 4
-Adaptec SCSI host adapter driver
.It Xr aic 4
Adaptec AIC-6260 and AIC-6360 SCSI driver
.It Xr bt 4
PC architecture floppy disk controller driver
.It Xr nata 4
Generic ATA/ATAPI disk controller driver
-.It Xr wt 4
-Archive/Wangtek cartridge tape driver
.It Xr ata 4
Generic ATA/ATAPI disk controller driver (deprecated)
.El
DigiBoard intelligent serial cards driver
.It Xr lpt 4
Generic printer device driver
-.It Xr rc 4
-RISCom/8 multiport serial card driver
.It Xr rp 4
Comtrol RocketPort serial card driver
.It Xr si 4
Stallion Technologies multiport serial controller driver
.It Xr stli 4
Stallion Technologies multiport serial controller driver
-.It Xr dgb 4
-DigiBoard intelligent serial cards driver (deprecated)
.El
.Ss Network interfaces
.Bl -tag -width 12n -offset indent -compact
Crystal Semiconductor CS8900 and CS8920 ethernet adapter driver
.It Xr ed 4
Novell NE1000/NE2000 and WD-80x3 ethenet adapter driver
-.It Xr el 4
-3Com Etherlink 3C501 ethernet adapter driver
.It Xr ep 4
3Com Etherlink III (3C5x9) ethernet adapter driver
.It Xr ex 4
Intel EtherExpress Pro/10 and Pro/10+ ethernet adapter driver
.It Xr fe 4
Fujitsu MB86960A and MB86965A ethernet adapter driver
-.It Xr ie 4
-Intel i82586 ethernet adapter driver
-.It Xr le 4
-DEC EtherWORKS II/III ethernet adapter driver
.It Xr lnc 4
AMD Am7900 LANCE and Am79C9xx PCnet ethernet adapter driver
-.It Xr rdp 4
-RealTek RTL 8002 pocket ethernet adapter driver
.It Xr sn 4
SMC91Cxx ethernet adapter driver
.It Xr sr 4
RISCom/N2 device driver
-.It Xr wl 4
-T1 speed radio lan card driver
.El
.Ss Sound cards
.Bl -tag -width 12n -offset indent -compact
.Bl -tag -width 12n -offset indent -compact
.It Xr atkbdc 4
AT keyboard controller interface
-.\".It Xr gpib 4
-.\"No manpage.
.It Xr joy 4
Joystick device driver
-.It Xr labpc 4
-National Instruments LABPC and LABPC+ driver
-.It Xr mse 4
-Bus and InPort mice driver
.It Xr npx 4
Numeric Processing Extension coprocessor and emulator
.It Xr orm 4
Parallel Port Chipset driver
.It Xr spic 4
Sony Programmable I/O Controller device driver
-.\".It Xr spigot 4
-.\"No manpage.
.It Xr syscons 4
System Console driver
-.It Xr tw 4
-TW-523 X-10 device driver
.It Xr vga 4
VGA graphics driver
.El
# $FreeBSD: src/share/man/man4/man4.i386/Makefile,v 1.122.2.12 2003/04/15 17:23:32 fjoe Exp $
-MAN= aic.4 apm.4 ar.4 asc.4 asr.4 \
+MAN= aic.4 apm.4 ar.4 asr.4 \
cs.4 cy.4 \
- dgb.4 digi.4 el.4 en.4 ep.4 ex.4 fe.4 glxsb.4 gsc.4 \
- ie.4 io.4 labpc.4 le.4 linux.4 lnc.4 longrun.4 \
- mse.4 npx.4 \
+ digi.4 en.4 ep.4 ex.4 fe.4 glxsb.4 \
+ io.4 linux.4 lnc.4 longrun.4 \
+ npx.4 \
pcf.4 perfmon.4 pnp.4 pnpbios.4 \
- rc.4 rdp.4 sb.4 sbni.4 \
- spkr.4 sr.4 stl.4 tw.4 \
- tx.4 viapm.4 vx.4 \
- wl.4 wt.4
+ sb.4 sbni.4 \
+ spkr.4 sr.4 stl.4 \
+ tx.4 viapm.4 vx.4
# XXX re-add when adjusted to the new 802.11 framework
#MAN+= ndis.4 \
NEC PC-9801-100 (PC98)
.El
.Sh SEE ALSO
-.Xr aha 4 ,
.Xr ahc 4 ,
.Xr cd 4 ,
.Xr ch 4 ,
+++ /dev/null
-.\" asc(4) - manual page for the scanner device driver `asc'
-.\"
-.\"
-.\" Copyright (c) 1995 Gunther Schadow, Luigi Rizzo. 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgements:
-.\" This product includes software developed by Gunther Schadow.
-.\" This product includes software developed by Luigi Rizzo.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/man4.i386/asc.4,v 1.14.2.2 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/asc.4,v 1.5 2008/01/26 15:14:41 swildner Exp $
-.Dd January 19, 1995
-.Dt ASC 4 i386
-.Os
-.Sh NAME
-.Nm asc
-.Nd device driver for a GI1904-based hand scanner
-.Sh SYNOPSIS
-.Cd "device asc0 at isa? port IO_ASC1 drq 3 irq 10"
-.Sh DESCRIPTION
-The
-.Nm
-character device driver currently handles the
-.Tn GI1904 Ns -based
-hand scanner (e.g. Trust Amiscan Grey).
-It uses DMA and interrupts.
-Up to 50 lines of scanned input data are buffered in the driver.
-.Pp
-The device can operate at four different resolutions: 100, 200, 300
-and 400 dots per inch.
-It produces a simple bitmap with the most
-significant bit at the left side. The driver can optionally output
-the simple portable bitmap file format
-.Xr pbm 5 ;
-thus the scans can easily processed by most graphics packages.
-.Pp
-The width of the output bitmap is fixed as given by the
-resolution value. However, the height of the bitmap must be
-supplied when in
-.Xr pbm 5
-mode, since the driver must know at what time the
-`end-of-file' shall be reached. The default is to produce a
-square image; i.e., height equals width.
-With this feature one is able to
-directly copy the scanner output into a
-.Xr pbm 5
-file using
-.Xr cat 1 .
-One can obtain a similar effect by using
-.Xr dd 1
-with the driver
-in raw mode.
-.Sh IOCTLS
-The
-.Xr ioctl 2
-commands applicable to
-.Nm
-are listed below.
-The
-.Xr sasc 1
-provides user-level access to these commands.
-.Bl -tag -width ".Dv ASC_GHEIGHT"
-.It Dv ASC_GRES
-.Pq Li int
-Get current resolution in dots per inch (dpi).
-.It Dv ASC_GWIDTH
-.Pq Li int
-Get current width of the bitmap in pixels.
-.It Dv ASC_SHEIGHT
-.Pq Li int
-Set the height of the bitmap in
-.Xr pbm 5
-mode. This is actually
-a limit on the amount of lines scannable after the first read
-operation. When the limit is reached, read will return 0. However, the
-device is turned off only when the last open file descriptor is closed.
-.It Dv ASC_GHEIGHT
-.Pq Li int
-Get the current height of the bitmap.
-.It Dv ASC_SBLEN
-.Pq Li int
-Set the length of the buffer used internally to do the DMA transfer.
-The buffer length is supplied in lines of the bitmap.
-Since the buffer
-size limit is (currently) 0x3000 bytes, the maximum number of lines
-allowed will vary with the width of each line. An
-.Er ENOMEM
-error is returned if the requested length would exceed this limit.
-.It Dv ASC_GBLEN
-.Pq Li int
-Get the current buffer length in lines.
-.It Dv ASC_SBTIME
-.Pq Li int
-Set the timeout for the completion of reading one buffer.
-Since a
-handy scanner is a human/computer interface timeout values are usually
-higher than those of a flat scanner; the default is 15 seconds. After
-timeout is reached the read operation will fail with
-.Er EBUSY .
-Note that
-the timeout timer starts anew for each buffer to be read and thus
-reducing it does not result in faster scans for longer images.
-.It Dv ASC_GBTIME
-.Pq Li int
-Get the current buffer timeout.
-.El
-.Pp
-All
-.Fn ioctl
-requests that modify a parameter except
-.Dv ASC_SBTIME
-do not have an effect on an ongoing scan process. The user must close
-the device and open it again for the new selections to take effect.
-Consequently, the selections are
-.Em not
-reset when the device is opened or closed.
-.Pp
-Similarly, requests that read a value do not report the value that is
-used for the ongoing scan process. The values needed during the scan
-process are saved when it starts and thus are not accessed by
-.Fn ioctl
-requests.
-.Pp
-The
-.Dv ASC_SBTIME
-value does, however, have an immediate effect on the ongoing scan.
-Thus the timeout can, for example, be set to a large value until the
-user starts scanning, and then set to a small value to react
-(nearly) immediately when the user stops.
-.Pp
-Note that the
-.Xr pbm 5
-versus raw mode selection is done by the
-minor number, not by
-.Fn ioctl
-requests. In raw mode, the selected
-height of the bitmap will have no effect.
-.Sh FILES
-.Bl -tag -width /dev/asc0pd -compact
-.It Pa /dev/asc0
-device node for raw output
-.It Pa /dev/asc0d
-device node for raw output, emitting debug messages if the
-.Dv ASCDEBUG
-option was given in the kernel configuration file
-.It Pa /dev/asc0p
-device node for output in
-.Xr pbm 5
-file format
-.It Pa /dev/asc0pd
-device node for
-.Xr pbm 5
-and debug mode
-.El
-.\"
-.\" .Sh DIAGNOSTICS
-.\"
-.Sh SEE ALSO
-.Xr sasc 1 ,
-.Xr pbm 5 Pq Pa pkgsrc/graphics/netpbm
-.Sh HISTORY
-The
-.Nm
-driver first appeared in
-.Fx 2.1 .
-.Sh AUTHORS
-The
-.Nm
-driver was written by
-.An Luigi Rizzo .
-.Sh BUGS
-Ioctl support is not working yet.
+++ /dev/null
-.\" Copyright (c) 1990, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the Systems Programming Group of the University of Utah Computer
-.\" Science Department.
-.\" 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 University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
-.\"
-.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
-.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
-.\" from: sio.4,v 1.15 1994/12/06 20:14:30 bde Exp
-.\" $FreeBSD: src/share/man/man4/man4.i386/dgb.4,v 1.13.2.6 2001/08/17 13:08:45 ru Exp $
-.\"
-.Dd August 6, 2009
-.Dt DGB 4 i386
-.Os
-.Sh NAME
-.Nm dgb
-.Nd DigiBoard intelligent serial cards driver
-.Sh SYNOPSIS
-.Cd "options NDGBPORTS=8"
-.Cd "device dgb0 at isa? port 0x220 iomem 0xfc0000 iosiz ? flags 0x0"
-All values are just examples.
-.Pp
-The
-.Dv NDGBPORTS
-option defines the total number of ports on all cards
-installed in the system.
-When not defined the number is computed:
-.Bd -ragged -offset 4n
-default
-.Dv NDGBPORTS
-= number_of_described_DigiBoard_cards * 16
-.Ed
-.Pp
-If it is less than the actual number of ports
-the system will be able to use only the
-first
-.Dv NDGBPORTS
-ports.
-If it is greater than all ports will be usable
-but some memory will be wasted.
-.Pp
-Meaning of
-.Cm flags :
-.Bl -tag -width indent -compact
-.It 0x0001
-use alternate pinout (exchange DCD and DSR lines)
-.It 0x0002
-don't use 8K window mode of PC/Xe
-.El
-.Pp
-Device numbering:
-.Bd -literal -compact
-0b\fICC\fPmmmmmmmm\fIOLIPPPPP\fP
- \fBCC\fPard number
- \fRmmmmmmmm\fPajor number
- call\fBO\fPut
- \fBL\fPock
- \fBI\fPnitial
- \fBPPPPP\fPort number
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for DigiBoard PC/Xe and PC/Xi series intelligent
-serial multiport cards with asynchronous interfaces based on the
-.Tn EIA
-.Tn RS-232C
-.Pf ( Tn CCITT
-.Tn V.24 )
-standard.
-.Pp
-Input and output for each line may set to one of following baud rates;
-50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
-19200, 38400, 57600, or for newer versions of cards 115200.
-.Pp
-The driver doesn't use any interrupts, it is
-.Dq polling\-based .
-This means that
-it uses clock interrupts instead of interrupts generated by DigiBoard cards and
-checks the state of cards 25 times per second.
-This is practical because the
-DigiBoard cards have large input and output buffers (more than 1Kbyte per
-port) and hardware that allows efficiently finding the port that needs
-attention.
-The only problem seen with this policy is slower
-SLIP and PPP response.
-.Pp
-Each line in the kernel configuration file describes one card, not one port
-as in the
-.Xr sio 4
-driver.
-.Pp
-The
-.Cm flags
-keyword may be used on each
-.Dq Li "device dgb"
-line in the kernel configuration file
-to change the pinout of the interface or to use new PC/Xe cards
-which can work with an 8K memory window in compatibility mode
-(with a 64K memory window).
-Note
-that using 8K memory window doesn't mean shorter input/output buffers, it means
-only that all buffers will be mapped to the same memory address and switched as
-needed.
-.Pp
-The
-.Cm port
-value must be the same
-as the
-port
-set on the card by jumpers.
-For PC/Xi cards the same rule is applicable to the
-.Cm iomem
-value.
-It must be the same as the memory address set on the card
-by jumpers.
-.\"Some documentation gives the address as a ``paragraph'' or ``segment'';
-.\"you can get the value of address by adding the digit "0" at end of
-.\"paragraph value, e.g., 0xfc000 -> 0xfc0000.
-For PC/Xe cards there is no need to use jumpers for this purpose.
-In fact there are no jumpers to do it.
-Just
-write the address you want as the
-.Cm iomem
-value in kernel config file and the card will be programmed
-to use this address.
-.Pp
-The same range of memory addresses may be used
-for all the DigiBoards installed
-(but not for any other card or real memory).
-DigiBoards
-with a large amount of memory (256K or 512K and perhaps
-even 128K) must be mapped
-to memory addresses outside of the first megabyte.
-If the computer
-has more than 15 megabytes of memory then there is no free address space
-outside of the first megabyte where such DigiBoards can be mapped.
-In this case you
-may need to reduce the amount of memory in the computer.
-But many machines provide a better solution.
-They have the ability to
-.Dq "turn off"
-the memory in the 16th megabyte (addresses 0xF00000 - 0xFFFFFF)
-using the
-BIOS setup.
-Then the DigiBoard's address space can be set to this
-.Dq hole .
-.\" XXX the following should be true for all serial drivers and
-.\" should not be repeated in the man pages for all serial drivers.
-.\" It was copied from sio.4. The only changes were s/sio/dgb/g.
-.Pp
-Serial ports controlled by the
-.Nm
-driver can be used for both
-.Dq callin
-and
-.Dq callout .
-For each port there is a callin device and a callout device.
-The minor number of the callout device is 128 higher
-than that of the corresponding callin port.
-The callin device is general purpose.
-Processes opening it normally wait for carrier
-and for the callout device to become inactive.
-The callout device is used to steal the port from
-processes waiting for carrier on the callin device.
-Processes opening it do not wait for carrier
-and put any processes waiting for carrier on the callin device into
-a deeper sleep so that they do not conflict with the callout session.
-The callout device is abused for handling programs that are supposed
-to work on general ports and need to open the port without waiting
-but are too stupid to do so.
-.Pp
-The
-.Nm
-driver also supports an initial-state and a lock-state control
-device for each of the callin and the callout
-.Dq data
-devices.
-The minor number of the initial-state device is 32 higher
-than that of the corresponding data device.
-The minor number of the lock-state device is 64 higher
-than that of the corresponding data device.
-The termios settings of a data device are copied
-from those of the corresponding initial-state device
-on first opens and are not inherited from previous opens.
-Use
-.Xr stty 1
-in the normal way on the initial-state devices to program
-initial termios states suitable for your setup.
-.Pp
-The lock termios state acts as flags to disable changing
-the termios state.
-E.g., to lock a flag variable such as
-.Dv CRTSCTS ,
-use
-.Dq Li "stty crtscts"
-on the lock-state device.
-Speeds and special characters
-may be locked by setting the corresponding value in the lock-state
-device to any nonzero value.
-.Pp
-Correct programs talking to correctly wired external devices
-.\" XXX change next line in other man pages too, and rewrite this paragraph.
-work with almost arbitrary initial states and no locking,
-but other setups may benefit from changing some of the default
-initial state and locking the state.
-In particular, the initial states for non (POSIX) standard flags
-should be set to suit the devices attached and may need to be
-locked to prevent buggy programs from changing them.
-E.g.,
-.Dv CRTSCTS
-should be locked on for devices that support
-RTS/CTS handshaking at all times and off for devices that don't
-support it at all.
-.Dv CLOCAL
-should be locked on for devices
-that don't support carrier.
-.Dv HUPCL
-may be locked off if you don't
-want to hang up for some reason.
-In general, very bad things happen
-if something is locked to the wrong state, and things should not
-be locked for devices that support more than one setting.
-The
-.Dv CLOCAL
-flag on callin ports should be locked off for logins
-to avoid certain security holes, but this needs to be done by
-getty if the callin port is used for anything else.
-.Sh FILES
-.Bl -tag -width /dev/ttyiD?? -compact
-.It Pa /dev/ttyD??
-for callin ports
-.It Pa /dev/ttyiD??
-.It Pa /dev/ttylD??
-corresponding callin initial-state and lock-state devices
-.Pp
-.It Pa /dev/cuaD??
-for callout ports
-.It Pa /dev/cuaiD??
-.It Pa /dev/cualD??
-corresponding callout initial-state and lock-state devices
-.El
-.Pp
-.Bl -tag -width /etc/rc.d/serial -compact
-.It Pa /etc/rc.d/serial
-examples of setting the initial-state and lock-state devices
-.El
-.Pp
-The first question mark in these device names is short for the
-card number
-(a decimal number between 0 and 65535 inclusive).
-The second question mark is short for the port number
-(a letter in the range [0-9a-v]).
-.Sh DIAGNOSTICS
-You may enable extended diagnostics by defining DEBUG at the
-start of the source file
-.Pa dgb.c .
-.Bl -diag
-.It dgb\fIX\fP: warning: address \fIN\fP truncated to \fIM\fP
-The memory address for the PC/Xe's 8K window is misaligned (it should be
-on an 8K boundary) or outside of the first megabyte.
-.It dgb\fIX\fP: 1st reset failed
-Problems with accessing I/O port of the card, probably
-the wrong
-.Cm port
-value is specified in the kernel config file.
-.It dgb\fIX\fP: 2nd reset failed
-Problems with hardware.
-.It dgb\fIX\fP: \fIN\fP[st,nd,rd,th] memory test failed
-Problems with accessing the memory of the card, probably
-the wrong
-.Cm iomem
-value is specified in the kernel config file.
-.It dgb\fIX\fP: BIOS start failed
-Problems with starting the on-board BIOS.
-Probably the memory addresses of the
-DigiBoard overlap with some other device or with RAM.
-.It dgb\fIX\fP: BIOS download failed
-Problems with the on-board BIOS.
-Probably the memory addresses of the
-DigiBoard overlap with some other device or with RAM.
-.It dgb\fIX\fP: FEP code download failed
-Problems with downloading of the Front-End Processor's micro-OS.
-Probably the memory addresses of the
-DigiBoard overlap with some other device or with RAM.
-.It dgb\fIX\fP: FEP/OS start failed
-Problems with starting of the Front-End Processor's micro-OS.
-Probably the memory addresses of the
-DigiBoard overlap with some other device or with RAM.
-.It dgb\fIX\fP: too many ports
-This DigiBoard reports that it has more than 32 ports.
-Perhaps a hardware problem or
-the memory addresses of the
-DigiBoard overlap with some other device or with RAM.
-.It dgb\fIX\fP: only \fIN\fP ports are usable
-The
-.Dv NDGBPORTS
-parameter is too small and there is only enough space allocated
-for
-.Ar N
-ports on this card.
-.It dgb\fIX\fP: port \fIY\fP is broken
-The on-board diagnostic has reported that the specified port has hardware
-problems.
-.It dgb\fIX\fP: polling of disabled board stopped
-Internal problems in the polling logic of driver.
-.It dgb\fIX\fP: event queue's head or tail is wrong!
-Internal problems in the driver or hardware.
-.It dgb\fIX\fP: port \fIY\fP: got event on nonexisting port
-Some status changed on a port that is physically present but is
-unusable due to misconfiguration.
-.It dgb\fIX\fP: port \fIY\fP: event \fIN\fP mstat \fIM\fP lstat \fIK\fP
-The driver got a strange event from card.
-Probably this means that you have a
-newer card with an extended list of events or some other hardware problem.
-.It dgb\fIX\fP: port \fIY\fP: overrun
-Input buffer has filled up.
-Problems in polling logic of driver.
-.It dgb\fIX\fP: port \fIY\fP: FEP command on disabled port
-Internal problems in driver.
-.It dgb\fIX\fP: port \fIY\fP: timeout on FEP command
-Problems in hardware.
-.El
-.Sh SEE ALSO
-.Xr stty 1 ,
-.Xr termios 4 ,
-.Xr tty 4 ,
-.Xr comcontrol 8
-.Sh HISTORY
-The
-.Nm
-driver is derived from the
-.Xr sio 4
-driver and the DigiBoard driver from
-.Tn Linux
-and is
-.Ud
-.Sh BUGS
-The implementation of sending
-.Dv BREAK
-is broken.
-.Dv BREAK
-of fixed length of \(14 s
-is sent anyway.
-.Pp
-There was a bug in implementation of
-.Xr select 2 .
-It is fixed now but not widely tested yet.
-.Pp
-There is no ditty command.
-Most of its functions (alternate pinout,
-speed up to 115200 baud, etc.) are implemented in the driver itself.
-Some
-other functions are missing.
-.Pp
-The
-.Nm
-driver is deprecated, please consider the
-.Xr digi 4
-driver.
+++ /dev/null
-.\"
-.\" Copyright (c) 1994 James A. Jegers
-.\" 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. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/man4.i386/el.4,v 1.11.2.3 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/el.4,v 1.3 2006/02/17 19:37:10 swildner Exp $
-.\"
-.Dd July 10, 1995
-.Dt EL 4 i386
-.Os
-.Sh NAME
-.Nm el
-.Nd Ethernet driver for 3Com Etherlink 3C501 device driver
-.Sh SYNOPSIS
-.Cd "device el0 at isa? port 0x300 irq 9"
-.Sh DESCRIPTION
-The
-.Nm
-interface provides support for the 3Com 3c501 8bit ISA ethernet card.
-The 3c501 card is known to be quite slow, and a different ethernet card
-should be used if possible.
-However, they allow inexpensive access to 10 Mb/s Ethernet networks.
-.Pp
-The valid I/O ports are in the range 0x280-0x3f0.
-.Sh SEE ALSO
-.Xr ed 4 ,
-.Xr ep 4 ,
-.Xr ie 4 ,
-.Xr intro 4 ,
-.Xr le 4 ,
-.Xr ng_ether 4 ,
-.Xr ifconfig 8
-.Sh BUGS
-The driver assumes the card is configured for the same IRQ as the kernel.
-No probing or checking is done to determine if this is the case.
-.Pp
-Does not currently support DMA.
-.Pp
-Does not currently support multicasts.
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man4/man4.i386/ep.4,v 1.16.2.6 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/ep.4,v 1.4 2008/05/02 02:05:06 swildner Exp $
.\"
.Dd February 4, 1993
.Dt EP 4 i386
.El
.Sh SEE ALSO
.Xr ed 4 ,
-.Xr el 4 ,
-.Xr ie 4 ,
.Xr ifmedia 4 ,
.Xr intro 4 ,
-.Xr le 4 ,
.Xr ng_ether 4 ,
.Xr vx 4 ,
.Xr ifconfig 8
+++ /dev/null
-.\" gsc.4 - manual page for the scanner device driver `gsc'
-.\"
-.\"
-.\" Copyright (c) 1995 Gunther Schadow. 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Gunther Schadow.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/man4.i386/gsc.4,v 1.12.2.7 2001/12/17 11:30:13 ru Exp $
-.\"
-.Dd January 9, 1995
-.Dt GSC 4 i386
-.Os
-.Sh NAME
-.Nm gsc
-.Nd a device driver for a handy scanner
-.Sh SYNOPSIS
-.In machine/gsc.h
-.Pp
-.Cd Minor number bits: Ar uu d g p ...
-.Bl -tag -width "uu " -compact -offset indent
-.It Ar uu
-unit gsc0 .. gsc3
-.It Ar d
-selects logging of
-.Em debug
-messages
-.It Ar g
-selects
-.Em bitmap
-vs.
-.Em graymap
-output
-.It Ar p
-selects
-.Em raw
-vs. portable
-.Em pnm
-output
-.El
-.Sh DESCRIPTION
-The
-.Nm
-character device driver currently handles only the
-Genius GS-4500 handy scanner.
-It operates in pure DMA modes, although
-the hardware could be set up to work with irq.
-I had neither enough
-documentation nor experience in writing interrupt driven device
-drivers.
-.Pp
-The device can operate at four different
-.Em resolutions :
-100, 200,
-300 and 400dpi.
-It produces a simple bitmap with the most significant
-bit at the left side.
-The driver can optionally output the famous and
-likely simple portable bitmap file format
-.Xr pbm 5
-by Jef Poskanzer.
-Thus the scans can easily processed by any graphic package around
-.Xr ( xpaint 1 ,
-.Xr xv 1 ,
-.Xr xli 1
-only to name some of them ...). In
-.Em raw
-mode a
-bit which is set means a black pixel because the scanner detects black
-points on white paper.
-On the other hand, because pnm format describes
-intensities of electron beams in video screens a set bit in
-.Em pbm
-mode means a white pixel.
-.Pp
-The
-.Em width
-of the output bitmap is fixed as given by the
-resolution value.
-However, the
-.Em height
-of the bitmap must be
-supplied in
-.Em pnm
-mode since the driver must know at what time the
-.Sq end-of-file
-shall be reached.
-With this feature you are able to
-directly copy the scanner output into a pbm file with
-.Xr cat 1 .
-Of course you can obtain a similar effect by using
-.Xr dd 1
-with the driver in
-.Em raw
-mode.
-.Pp
-The
-.Em graymap
-output mode is not yet implemented into the driver.
-It is even questionable if external programs would not do this job
-better thereby not counting to the size of the kernel.
-Even though, I
-do not know of tools which produce a graymap from a halftone bitmap.
-.Pp
-The ioctl requests that are served by
-.Nm
-are listed below.
-There is a utility, called
-.Xr sgsc 1 ,
-that provides access to these
-requests from within shell.
-.Bl -tag -width Ds
-.It Dv GSC_SRES Vt int
-Set the
-.Em resolution
-value.
-If this call is made after the first
-read access to the device there will be no effect unless the device is
-closed and opened again.
-.It Dv GSC_GRES Vt int
-Get current resolution in dots per inch (dpi).
-.It Dv GSC_SRESSW Vt void
-Set resolution value from selector switch.
-The driver must be in an
-open though untouched state otherwise the request will fail and
-.Xr errno 2
-is set to
-.Er EBUSY .
-.It Dv GSC_SWIDTH Vt int
-Set the
-.Em width
-of the bitmap.
-Actually, this is an alternative
-way of setting the resolution, since any allowed resolution matches
-exactly one width.
-Allowed are listed in the table below.
-.Bl -tag -width resolution -compact -offset indent
-.It resolution
-width
-.It 100 dpi
-424 pixels
-.It 200 dpi
-840 pixels
-.It 300 dpi
-1264 pixels
-.It 400 dpi
-1648 pixels
-.It ?
-1696 pixels
-.It ?
-2544 pixels
-.It ?
-3648 pixels
-.El
-.Pp
-Values which are not reported in the above table will cause the ioctl
-call to fail with
-.Xr errno 2
-set to
-.Er EINVAL .
-.Pp
-As you can see, there are width values > 1696.
-This does, however, not
-mean that you can obtain scanned lines longer than the width of your
-scanner or by higher resolutions.
-Actually, the resolution is selected
-by only by the hardware switch.
-Any line that is longer than what is
-defined for the actual resolution will be undefined (usually white) on
-the right part that is exceeding the standard line.
-.It Dv GSC_GWIDTH Vt int
-Get current width of the bitmap in pixels.
-.It Dv GSC_SHEIGHT Vt int
-Set the
-.Em height
-of the bitmap in
-.Em pnm
-mode.
-This is actually
-a limit on the amount of lines scannable after the first read
-operation.
-When the limit is reached read will return 0. However, the
-device is turned off only when a close is performed (either
-explicitly or implicitly on exit of the calling process).
-.It Dv GSC_GHEIGHT Vt int
-Get the current height of the bitmap.
-.It Dv GSC_SBLEN Vt int
-Set the length of the buffer used internally to do the DMA transfer.
-The buffer length is supplied in lines of the bitmap.
-Since the buffer
-size limit is (currently) 0x3000 bytes the maximum number of lines
-allowed will vary with the width of each line.
-This upper limit is
-checked before it overwrites the current value and passes an
-.Er ENOMEM
-in the
-.Xr errno 2
-variable.
-However, since the bitmap width can change
-after a buffer length was selected a read request may fail with
-.Er ENOMEM
-if the buffer length turns out too high.
-It is generally wise to
-choose long buffers rather than go save in order to obtain better
-output.
-.It Dv GSC_GBLEN Vt int
-Get the current buffer length in lines.
-.It Dv GSC_SBTIME Vt int
-Set the timeout for the completion of reading one buffer.
-Since a
-handy scanner is a human/computer interface timeout values are usually
-higher than those of a flat scanner.
-Default is 15 seconds.
-After
-timeout is reached the read operation will fail with
-.Er EBUSY .
-Note that
-the timeout timer starts anew for each buffer to be read and thus does
-not cause you to scan faster for longer images.
-BLEN/BTIME is similar
-as MIN/TIME in
-.Xr termios 4 .
-.It Dv GSC_GBTIME Vt int
-Get the current buffer timeout.
-.El
-.Pp
-All ioctl requests that modify a parameter except
-.Dv GSC_SBTIME
-do not
-have an effect on an ongoing scan process, i.e. after the first read
-request that follows open.
-You must close the device and open it again
-for the new selections to take effect.
-Consequently, the selections
-are not reset when you close or open the device.
-.Pp
-Similarly, requests that read a value do not report the value that is
-used for the ongoing scan process.
-The values needed during the scan
-process are saved when it starts and thus are not accessed by ioctl
-requests.
-.Pp
-The BTIME value does, however, have an immediate effect on the ongoing
-scan.
-Thus the timeout can for example be set to long until the user
-starts scanning. It can then be set to a short amount to react
-(nearly) immediately when the user stops.
-Note that the user should be
-left time to at least fill one buffer without having to haste.
-.Pp
-Note that the
-.Em pbm
-versus
-.Em raw
-mode selection is done by the
-minor number not by ioctl requests.
-In
-.Em raw
-mode the selected
-height of the bitmap will have no effect.
-.Sh FILES
-.Bl -tag -width /dev/gsc0pd
-.It Pa /dev/gsc0
-device node for
-.Em raw
-output, has minor number 0.
-.It Pa /dev/gsc0d
-device node for
-.Em raw
-output emitting
-.Em debug
-messages if the
-GSCDEBUG option was given at compile time, has minor number 32.
-.It Pa /dev/gsc0p
-device node for output in
-.Em pbm
-file format, has minor number 8.
-.It Pa /dev/gsc0pd
-device node for
-.Em pbm
-and
-.Em debug
-mode, has minor number 40.
-.El
-.Sh EXAMPLES
-.Bd -literal -offset indent
-dd if=/dev/gsc0 of=rawfile bs=(width/8) count=(height)
-
-cat /dev/gsc0p > pbmfile
-.Ed
-.Sh DIAGNOSTICS
-.Bl -tag -width Cd
-.It GSCDEBUG
-When you define this name as an `option' in the kernel configuration
-you can get debug output if you access the driver with a minor number
-whose debug bit (i.e. bit 5 out of 7) is set.
-.El
-.Sh SEE ALSO
-.Xr cat 1 ,
-.Xr dd 1 ,
-.Xr pbmtopgm 1 Pq Pa pkgsrc/graphics/netpbm ,
-.Xr sgsc 1 ,
-.Xr close 2 ,
-.Xr intro 2 ,
-.Xr ioctl 2 ,
-.Xr open 2 ,
-.Xr read 2 ,
-.Xr termios 4 ,
-.Xr pbm 5 Pq Pa pkgsrc/graphics/netpbm ,
-.Xr pnm 5 Pq Pa pkgsrc/graphics/netpbm
-.Sh AUTHORS
-.An Gunther Schadow Aq gusw@fub46.zedat.fu-berlin.de
-.Sh BUGS
-Even though the scanner device has a little switch by which you should
-be able to select one of the four resolution modes, I could not yet
-determine how to read its status.
-Unless this is not fixed the driver
-depends on the value passed by means of
-.Xr ioctl 2
-which need not match
-what is selected by the hardware.
+++ /dev/null
-.\"
-.\" Copyright (c) 1994, Wilko Bulte
-.\" All rights reserved.
-.\"
-.\" $FreeBSD: src/share/man/man4/man4.i386/ie.4,v 1.11.2.5 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/ie.4,v 1.3 2006/12/29 18:20:11 swildner Exp $
-.\"
-.Dd September 23, 1994
-.Dt IE 4 i386
-.Os
-.Sh NAME
-.Nm ie
-.Nd Intel i82586 ethernet device driver
-.Sh SYNOPSIS
-.Cd "device ie0 at isa? port 0x360 irq 7 iomem 0xd0000"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for 8 and 16bit ISA ethernet cards that are based on
-the Intel i82586 chip.
-It supports the AT&T Starlan 10 and Starlan Fiber,
-the EN100, the Intel EtherExpress 16, the 3COM 3C507 and the RACAL Interlan
-NI5210.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "ie%d: unknown board type code %d"
-An i82586 chip was found, but the driver was unable to determine the actual
-board type during the probe.
-.It "ie%d: kernel configured maddr %x doesn't match board configured maddr %x"
-The device probe detected a different maddr than the one specified in the
-kernel configuration file.
-.It "ie%d: can't find shared memory"
-The device probe could not access the shared memory to determine its size.
-.It "ie%d: kernel configured msize %d doesn't match board configured msize %d"
-The device probe found a different size for the shared memory than the one
-specified in the kernel configuration file.
-.It "ie%d: kernel configured irq %d doesn't match board configured irq %d"
-The device probe detected that the board is configured for a different
-interrupt than the one specified in the kernel configuration file.
-.It "ie%d: reset"
-The Intel i82586 had to be reset by the driver.
-.It "ie%d: transceiver problem"
-The driver has detected a problem with the ethernet transceiver.
-This is
-usually due to a loose or broken transceiver cable when using an external
-transceiver.
-When you experience this problem with an on-card transceiver
-your card may be incorrectly jumpered for to use an external transceiver.
-Worst case your on-board transceiver may be broken.
-.It "ie%d: TDR detected an open %d clocks away"
-The driver detected an open circuit in the ethernet cable.
-Check your
-coax cable and terminator resistors.
-.It "ie%d: TDR detected a short %d clocks away"
-The driver detected a short circuit in the ethernet cable.
-Check your
-coax cable and terminator resistors.
-.It "ie%d: TDR returned unknown status %x"
-The driver got an unknown status from the card during the ethernet cable
-test.
-.It "ie%d: multicast address setup command failed"
-The card could not be put into multicast mode.
-.It "ie%d: configure command failed"
-The card refused to respond correctly during configuration.
-.It "ie%d: individual address setup command failed"
-The programming of the Ethernet (MAC) address failed.
-.El
-.Sh CAVEATS
-The Racal Interlan NI5210 comes in variants with 8 and 16 kbytes of
-shared memory.
-It is strongly advisable to use the 16 kbyte variant.
-You can upgrade your 8 kbyte card to 16 kbyte by adding an additional
-RAM chip.
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ng_ether 4 ,
-.Xr ifconfig 8
-.Sh AUTHORS
-.An -nosplit
-The
-.Nm
-device driver was written by
-.An Garrett A. Wollman ,
-based on code by
-.An William F. Jolitz
-and Lawrence Berkeley Laboratories.
-.Tn 3C507
-support was written by
-.An Charles M. Hannum .
-This manual page was written by
-.An Wilko C. Bulte .
+++ /dev/null
-.\"
-.\" Copyright (c) 1995 HD Associates, Inc.
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Christopher G. Demetriou.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/man4.i386/labpc.4,v 1.8.2.2 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/labpc.4,v 1.4 2007/03/22 23:02:31 swildner Exp $
-.\"
-.Dd April 26, 1995
-.Dt LABPC 4 i386
-.Os
-.Sh NAME
-.Nm labpc
-.Nd National Instruments LABPC and LABPC+ driver
-.Sh SYNOPSIS
-.Cd "device labpc0 at isa? port 260 irq 5"
-.Sh DESCRIPTION
-This supports the National Instruments LABPC and LABPC+ \fILow-Cost
-Multifunction I/O Board\fP.
-.Pp
-This board provides 8 12 bit A-D input channels, 2 12 bit D-A output
-channels, and 3 8 bit digital I/O ports. It also supports setting
-up the National Instruments SCXI bus off the digital I/O ports,
-although that software is currently present in an external program
-and not as part of the driver.
-.Pp
-The selection of the input or output device, mode, and channel is
-through the minor number:
-.Bd -literal -offset indent
-The 8 bit minor number format is UUSIDCCC, with
- UU: Board unit.
- S: SCAN bit for scan enable.
- I: INTERVAL for interval support
- D: 1: Digital I/O, 0: Analog I/O
-CCC: The channel selector:
- ANALOG:
- input: channel must be 0 to 7 for AD0 ... AD7
- output: channel must be 0 to 2
- 0: D-A 0
- 1: D-A 1
- 2: Alternate channel 0 then 1
-
- DIGITAL:
- input: Channel must be 0 to 2.
- output: Channel must be 0 to 2.
-.Ed
-.Pp
-The /dev/MAKEDEV script will make the basic analog and digital
-devices if you do "sh MAKEDEV labpcaio" and "sh MAKEDEV labpcdio",
-however, it won't make device entries for INTERVAL and SCAN devices.
-SCAN devices automatically scan over all channels from the channel
-number down to 0 (for example, a SCAN for /dev/ad7 will read channels
-AD7 ... AD0) while the INTERVAL device will wait for an external
-signal and then read all the channels from the selected channel
-number down to 0 as fast as it can. This is done by the hardware
-and not the driver (other than turning it on); See the \fILabPC+
-User's Manual\fP and the source code if this doesn't make sense to
-you.
-.Pp
-The driver supports several general analog I/O ioctl calls. These
-are defined in
-.In sys/dataacq.h
-and are intended to be implemented in
-other data acquisition board device drivers.
-.Pp
-.Dv AD_MICRO_PERIOD_SET
-takes a pointer to a long argument specifying
-the number of microseconds between samples.
-.Pp
-.Dv AD_MICRO_PERIOD_GET
-takes a pointer to a long argument and returns
-the current number of microseconds between samples.
-.Pp
-.Dv AD_NGAINS_GET
-takes a pointer to an integer and returns the number
-of different gain settings the board supports. This is 8 for the
-LabPC board.
-.Pp
-.Dv AD_NCHANS_GET
-takes a pointer to an integer and returns the number
-of channels the board supports. This is 8 for the LabPC board.
-.Pp
-.Dv AD_SUPPORTED_GAINS
-returns an array of NGAINS (the number obtained
-by
-.Dv AD_NGAINS_GET )
-doubles. These are the gains the board supports.
-.Pp
-.Dv AD_GAINS_SET
-takes an array of NCHANS (the number obtained by
-.Dv AD_NCHANS_GET )
-integers and sets the board gains. These are indices
-into the supported gain array, with one gain for each channel.
-.Pp
-.Dv AD_GAINS_GET
-takes an array of NCHANS (returned by
-.Dv AD_NCHANS_GET )
-integers and returns the current board gains.
-.Sh BUGS
-In general, only those capabilities that I needed are present. In
-particular the following notable restrictions are present.
-.Pp
-The analog input is only supported in a clocked conversion mode.
-.Pp
-You can only set the sample clock down to 15 Hz. Anything slower
-needs a modification to the driver to support TCINTEN in order to
-chain together the counters to get a lower clock rate.
-.Pp
-There is no support for clocked D-A output.
-.Pp
-The 8255 providing the digital I/O ports is supported only in mode
-0 (three 8 bit ports).
-.Pp
-There is support for the SCXI bus off the LABPC board. It is not
-in the driver but is a separate user process that accesses the
-digital I/O devices. Ask dufault@hda.com for it.
-.Pp
-MAKEDEV only makes the "basic" devices. You must make the INTERVAL
-or SCAN devices by hand.
-.Pp
-The INTERVAL device sets the clock rate as high as possible so that
-it samples all the channels as quickly as it can after the external
-signal. This is a silly restriction; it should simply use the
-clock setting.
-.Sh CAVEATS
-National Instrument's (like most other laboratory grade board
-vendors) definition of Low-Cost differs dramatically from many on
-the net.
+++ /dev/null
-.\"
-.\" Copyright (c) 1997 David E. O'Brien
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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: src/share/man/man4/man4.i386/le.4,v 1.10.2.5 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/le.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
-.\"
-.Dd January 19, 1997
-.Dt LE 4 i386
-.Os
-.Sh NAME
-.Nm le
-.Nd DEC EtherWORKS II/III Ethernet device driver
-.Sh SYNOPSIS
-.Cd "device le0 at isa? port 0x300 irq 5 iomem 0xd0000"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for the later Digital Equipment EtherWORKS II
-(DE200, DE201, DE202, DE422), and the DEC EtherWORKS III NICs (DE203, DE204,
-and DE205) NICs.
-.Pp
-The valid IRQ settings for the
-.Nm
-driver are 5, 10, 11, and 15.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "le%d: not configured -- too many devices"
-There is a limit of the number of
-.Nm
-devices allowed in a single machine.
-.It "le%d: lemac configuration error: expected IRQ 0x%x actual 0x%x"
-The probed IRQ value did not match the value specified in the kernel
-configuration file. Either the card should be changed, or a new kernel
-should be built.
-.It "le%d: lemac configuration error: expected iomem 0x%x actual 0x%x"
-The probed iomem value did not match the value specified in the kernel
-configuration file. Either the card should be changed, or a new kernel
-should be built.
-.It "le%d: reset: EEPROM checksum failed (0x%x)"
-The
-.Nm
-driver depends on the information in the EEPROM being correct.
-If this error occurs, please reconfigure the card.
-.It "le%d: fatal RXD error, attempting recovery"
-.It "le%d: recovery failed -- board disabled"
-A receive error occurred. The driver will attempt to recover from this
-error. However if it cannot, the driver will shut the card down.
-.It "le%d: lance: warning: excessive collisions: TDR%dns (%d-%dm)"
-An overly high number of Ethernet collisions were detected. It may be the
-case that the network is overly busy. Or this may suggest a problem with
-the EtherWORKS card.
-.El
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ng_ether 4 ,
-.Xr config 8 ,
-.Xr ifconfig 8
-.Rs
-.%T "Building 4.3 BSD UNIX System with Config"
-.Re
-.Sh HISTORY
-The
-.Nm
-device driver was present in
-.Fx 2.0 .
-.Sh AUTHORS
-.An -nosplit
-The
-.Nm
-device driver was written by
-.An Matt Thomas .
-This manual page was written by
-.An David E. O'Brien .
+++ /dev/null
-.\" Copyright 1992 by the University of Guelph
-.\"
-.\" Permission to use, copy and modify this
-.\" software and its documentation for any purpose and without
-.\" fee is hereby granted, provided that the above copyright
-.\" notice appear in all copies and that both that copyright
-.\" notice and this permission notice appear in supporting
-.\" documentation.
-.\" University of Guelph makes no representations about the suitability of
-.\" this software for any purpose. It is provided "as is"
-.\" without express or implied warranty.
-.\"
-.\" $FreeBSD: src/share/man/man4/man4.i386/mse.4,v 1.10.2.4 2001/08/17 13:08:45 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/mse.4,v 1.4 2008/05/02 02:05:06 swildner Exp $
-.\"
-.Dd December 3, 1997
-.Dt MSE 4 i386
-.Os
-.Sh NAME
-.Nm mse
-.Nd bus and InPort mice driver
-.Sh SYNOPSIS
-.\" .Cd "options MSE_XXX=N"
-.Cd "device mse0 at isa? port 0x23c irq 5"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for the bus mouse and the InPort mouse, which
-are often collectively called ``bus'' mice, as these mice are sold with
-an interface card which needs to be installed in an expansion bus slot.
-The interface circuit may come on an integrated I/O card or as an option
-on video cards.
-.Pp
-The bus and InPort mice have two or three buttons,
-and a D-sub 9-pin male connector or a round DIN 9-pin
-male connector.
-.Pp
-The primary port address of the bus and InPort mouse interface cards
-is usually 0x23c.
-Some cards may also be set to use the secondary port
-address at 0x238.
-The interface cards require a single IRQ, which may be
-2, 3, 4 or 5. Some cards may offer additional IRQs.
-The port number and the IRQ number are configured by jumpers on the cards
-or by software provided with the card.
-.Pp
-Frequency, or report rate, at which the device sends movement
-and button state reports to the host system, may also be configurable on
-some interface cards.
-It may be 15, 30, 60 or 120Hz.
-.Pp
-The difference between the two types of the mice is not in mouse devices
-(in fact they are exactly the same). But in the circuit on the interface
-cards.
-This means that the device from a bus mouse package can be
-connected to the interface card from an InPort mouse package, or vice
-versa, provided that their connectors match.
-.Ss Operation Levels
-The
-.Nm
-driver has two levels of operation.
-The current operation level can be set via an ioctl call.
-.Pp
-At the level zero the basic support is provided; the device driver will report
-horizontal and vertical movement of the attached device
-and state of up to three buttons in the format described below.
-It is a subset of the MouseSystems protocol.
-.Pp
-.Bl -tag -width Byte_1 -compact
-.It Byte 1
-.Bl -tag -width bit_7 -compact
-.It bit 7
-Always one.
-.It bit 6..3
-Always zero.
-.It bit 2
-Left button status; cleared if pressed, otherwise set.
-.It bit 1
-Middle button status; cleared if pressed, otherwise set.
-Always one,
-if the device does not have the middle button.
-.It bit 0
-Right button status; cleared if pressed, otherwise set.
-.El
-.It Byte 2
-Horizontal movement count in two's complement; -128 through 127.
-.It Byte 3
-Vertical movement count in two's complement; -128 through 127.
-.It Byte 4
-Always zero.
-.It Byte 5
-Always zero.
-.El
-.Pp
-This is the default level of operation and the driver is initially
-at this level when opened by the user program.
-.Pp
-At the operation level one (extended level), a data packet is encoded
-in the standard format
-.Dv MOUSE_PROTO_SYSMOUSE
-as defined in
-.Xr mouse 4 .
-.Ss Acceleration
-The
-.Nm
-driver can somewhat `accelerate' the movement of the pointing device.
-The faster you move the device, the further the pointer
-travels on the screen.
-The driver has an internal variable which governs the effect of
-the acceleration.
-Its value can be modified via the driver flag
-or via an ioctl call.
-.Ss Device Number
-The minor device number of the
-.Nm
-is made up of:
-.Bd -literal -offset indent
-minor = (`unit' << 1) | `non-blocking'
-.Ed
-.Pp
-where `unit' is the device number (usually 0) and the `non-blocking' bit
-is set to indicate ``don't block waiting for mouse input,
-return immediately''.
-The `non-blocking' bit should be set for \fIXFree86\fP,
-therefore the minor device number usually used for \fIXFree86\fP is 1.
-See
-.Sx FILES
-for device node names.
-.Sh DRIVER CONFIGURATION
-.\" .Ss Kernel Configuration Options
-.Ss Driver Flags
-The
-.Nm
-driver accepts the following driver flag.
-Set it in the
-kernel configuration file
-(see
-.Xr config 8 )
-or in the User Configuration Menu at
-the boot time
-(see
-.Xr boot 8 ) .
-.Bl -tag -width MOUSE
-.It bit 4..7 ACCELERATION
-This flag controls the amount of acceleration effect.
-The smaller the value of this flag is, more sensitive the movement becomes.
-The minimum value allowed, thus the value for the most sensitive setting,
-is one.
-Setting this flag to zero will completely disables the
-acceleration effect.
-.El
-.Sh IOCTLS
-There are a few
-.Xr ioctl 2
-commands for mouse drivers.
-These commands and related structures and constants are defined in
-.In sys/mouse.h .
-General description of the commands is given in
-.Xr mouse 4 .
-This section explains the features specific to the
-.Nm
-driver.
-.Pp
-.Bl -tag -width MOUSE -compact
-.It Dv MOUSE_GETLEVEL Ar int *level
-.It Dv MOUSE_SETLEVEL Ar int *level
-These commands manipulate the operation level of the
-.Nm
-driver.
-.Pp
-.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
-Returns the hardware information of the attached device in the following
-structure.
-Only the
-.Dv iftype
-field is guaranteed to be filled with the correct value by the current
-version of the
-.Nm
-driver.
-.Bd -literal
-typedef struct mousehw {
- int buttons; /* number of buttons */
- int iftype; /* I/F type */
- int type; /* mouse/track ball/pad... */
- int model; /* I/F dependent model ID */
- int hwid; /* I/F dependent hardware ID */
-} mousehw_t;
-.Ed
-.Pp
-The
-.Dv buttons
-field holds the number of buttons on the device.
-.Pp
-The
-.Dv iftype
-is either
-.Dv MOUSE_IF_BUS
-or
-.Dv MOUSE_IF_INPORT .
-.Pp
-The
-.Dv type
-may be
-.Dv MOUSE_MOUSE ,
-.Dv MOUSE_TRACKBALL ,
-.Dv MOUSE_STICK ,
-.Dv MOUSE_PAD ,
-or
-.Dv MOUSE_UNKNOWN .
-.Pp
-The
-.Dv model
-is always
-.Dv MOUSE_MODEL_GENERIC
-at the operation level 0.
-It may be
-.Dv MOUSE_MODEL_GENERIC
-or one of
-.Dv MOUSE_MODEL_XXX
-constants at higher operation levels.
-.Pp
-The
-.Dv hwid
-is always 0.
-.Pp
-.It Dv MOUSE_GETMODE Ar mousemode_t *mode
-The command gets the current operation parameters of the mouse
-driver.
-.Bd -literal
-typedef struct mousemode {
- int protocol; /* MOUSE_PROTO_XXX */
- int rate; /* report rate (per sec), -1 if unknown */
- int resolution; /* MOUSE_RES_XXX, -1 if unknown */
- int accelfactor; /* acceleration factor */
- int level; /* driver operation level */
- int packetsize; /* the length of the data packet */
- unsigned char syncmask[2]; /* sync. bits */
-} mousemode_t;
-.Ed
-.Pp
-The
-.Dv protocol
-is either
-.Dv MOUSE_PROTO_BUS
-or
-.Dv MOUSE_PROTO_INPORT
-at the operation level zero.
-.Dv MOUSE_PROTO_SYSMOUSE
-at the operation level one.
-.Pp
-The
-.Dv rate
-is the status report rate (reports/sec) at which the device will send
-movement report to the host computer.
-As there is no standard to detect the current setting,
-this field is always set to -1.
-.Pp
-The
-.Dv resolution
-is always set to -1.
-.Pp
-The
-.Dv accelfactor
-field holds a value to control acceleration feature
-(see
-.Sx Acceleration ) .
-It is zero or greater.
-If it is zero, acceleration is disabled.
-.Pp
-The
-.Dv packetsize
-field specifies the length of the data packet.
-It depends on the
-operation level.
-.Pp
-.Bl -tag -width level_0__ -compact
-.It Em level 0
-5 bytes
-.It Em level 1
-8 bytes
-.El
-.Pp
-The array
-.Dv syncmask
-holds a bit mask and pattern to detect the first byte of the
-data packet.
-.Dv syncmask[0]
-is the bit mask to be ANDed with a byte.
-If the result is equal to
-.Dv syncmask[1] ,
-the byte is likely to be the first byte of the data packet.
-Note that this detection method is not 100% reliable,
-thus, should be taken only as an advisory measure.
-.Pp
-Only
-.Dv level
-and
-.Dv accelfactor
-are modifiable by the
-.Dv MOUSE_SETMODE
-command.
-Changing the other field doesn't cause error, but has no effect.
-.Pp
-.It Dv MOUSE_SETMODE Ar mousemode_t *mode
-The command changes the current operation parameters of the mouse driver
-as specified in
-.Ar mode .
-Only
-.Dv level
-and
-.Dv accelfactor
-may be modifiable.
-Setting values in the other field does not generate
-error and has no effect.
-.\" .Pp
-.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
-.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
-.\" These commands are not supported by the
-.\" .Nm
-.\" driver.
-.Pp
-.It Dv MOUSE_READDATA Ar mousedata_t *data
-.It Dv MOUSE_READSTATE Ar mousedata_t *state
-These commands are not supported by the
-.Nm
-driver.
-.Pp
-.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
-The command returns the current state of buttons and
-movement counts as described in
-.Xr mouse 4 .
-.El
-.Sh FILES
-.Bl -tag -width /dev/nmse0 -compact
-.It Pa /dev/mse0
-`non-blocking' device node
-.It Pa /dev/nmse0
-`non-blocking' device node
-.El
-.Sh EXAMPLES
-.Dl "device mse0 at isa? port 0x23c irq 5"
-.Pp
-Add the
-.Nm
-driver at the primary port address with the IRQ 5.
-.Pp
-.Dl "device mse1 at isa? port 0x238 flags 0x30 irq 4"
-.Pp
-Define the
-.Nm
-driver at the secondary port address with the IRQ 4 and the acceleration
-factor of 3.
-.Sh CAVEAT
-Some bus mouse interface cards generate interrupts at the fixed report rate
-when enabled, whether or not the mouse state is changing.
-The others generate interrupts only when the state is changing.
-.Sh SEE ALSO
-.Xr ioctl 2 ,
-.Xr mouse 4 ,
-.Xr psm 4 ,
-.Xr sysmouse 4 ,
-.Xr moused 8
-.\".Sh HISTORY
+++ /dev/null
-.\"
-.\" Copyright (c) 2004 Tom Rhodes
-.\" 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: src/share/man/man4/rc.4,v 1.5 2005/03/18 02:38:03 brueffer Exp $
-.\"
-.Dd March 18, 2005
-.Dt RC 4
-.Os
-.Sh NAME
-.Nm rc
-.Nd RISCom/8 multiport card
-.Sh SYNOPSIS
-.Cd device isa
-.Cd device rc
-.Sh DESCRIPTION
-The
-.Tn RISCom/8
-is an eight port
-.Tn ISA
-.Tn RS-232C
-communications multiplexer with a built in
-.Tn RISC
-processor.
-It uses a block of sixteen
-.Tn I/O
-ports in the range 0x200 to 0x3f0 selectable by on-board
-switches or jumpers.
-The block must be aligned on a sixteen port boundary.
-.Pp
-This driver is mostly based on the Cirrus Logic CL-CD180 driver.
-.Sh HARDWARE
-The
-.Nm
-driver provides support for the
-.Tn SDL
-Communications
-.Tn RISCom/8
-boards.
-.Sh DIAGNOSTICS
-The following driver specific error messages
-may be reported:
-.Bl -diag
-.It "rc%d channel%d: interrupt-level buffer overflow"
-An internal buffer overflow error has occurred on
-the listed channel.
-The
-.Nm
-driver will need to be reloaded to correct this.
-.It "rc%d: Bad char chan %d"
-The channel has obtained a bad set of characters.
-.It "rc%d: Got extra chars chan %d"
-The
-.Nm
-driver got more characters than expected on the channel shown.
-.It "rc%d: data mismatch chan %d ptr %d (%d != %d)"
-Data sent from channel
-.Ar %d
-to the rx buffer was different then expected.
-.It "rc%d: channel %d command timeout, rc.c line: %d"
-A command timeout has occurred on the channel, the
-.Pa src/sys/dev/serial/rc/rc.c
-file can be consulted for more information.
-.El
-.Sh SEE ALSO
-.Xr tty 1 ,
-.Xr ttyname 3 ,
-.Xr sio 4 ,
-.Xr tty 4 ,
-.Xr comcontrol 8 ,
-.Xr getty 8
-.Pp
-.Pa http://www.sdlcomm.com
-.Sh HISTORY
-The
-.Nm
-driver first appeared in
-.Fx 2.0.5 .
-This manual page first appeared in
-.Fx 5.3 .
-.Sh AUTHORS
-This manual page was written by
-.An Tom Rhodes Aq trhodes@FreeBSD.org .
+++ /dev/null
-.\"
-.\"
-.\" Copyright (c) 1997 Joerg Wunsch
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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: src/share/man/man4/man4.i386/rdp.4,v 1.5.2.4 2001/08/17 13:08:46 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/rdp.4,v 1.4 2007/05/17 08:19:01 swildner Exp $
-.\"
-.\"
-.\" " (emacs disconfusion)
-.Dd December 21, 1998
-.Dt RDP 4 i386
-.Os
-.Sh NAME
-.Nm rdp
-.Nd Ethernet driver for RealTek RTL 8002 pocket ethernet
-.Sh SYNOPSIS
-.Cd "device rdp0 at isa? port 0x378 irq 7"
-.Cd "device rdp0 at isa? port 0x378 irq 7 flags 0x2"
-.Sh DESCRIPTION
-The
-.Nm
-device driver supports RealTek RTL 8002-based pocket ethernet adapters,
-connected to a standard parallel port.
-.Pp
-These adapters seem to belong to the cheaper choices among pocket
-ethernet adapters. The RTL 8002 is the central part, containing an
-interface to BNC and UTP (10 Mbit/s) media, as well as a host
-interface that is designed to talk to standard parallel printer
-adapters. For the full ethernet adapter to work, it is completed by
-an external RAM used as the Tx and Rx packet buffer (16 K x 4 for the
-RTL 8002), and an EEPROM to hold the assigned ethernet hardware
-address. For the RTL 8002, the EEPROM can be either a standard 93C46
-serial EEPROM (which seems to be a common choice), or a 74S288
-parallel one. The latter variant needs the device configuration flag
-0x1 in order to work.
-.Pp
-Since standard printer adapters seem to vary wildly among their timing
-requirements, there are currently two possible choices for the way
-data are being exchanged between the pocket ethernet adapter and the
-printer interface. The default is the fastest mode the RTL 8002
-supports. If the printer adapter to use is particularly slow (which
-can be noticed by watching the ethernet wire for crippled packets, or
-by not seeing correctly received packets), the configuration flag 0x2
-can be set in order to throttle down the
-.Nm
-driver. Note that in fast mode, the data rate is asymmetric, sending
-is a little faster (up to two times) than receiving. Rates like 150
-KB/s for sending and 80 KB/s for receiving are common. For slow mode,
-both rates are about the same, and in the range of 50 KB/s through 70
-KB/s. As always, your mileage may vary.
-.Pp
-In case the adapter isn't recognized at boot-time, setting the
-.Em bootverbose
-flag
-.Pq Ql \-v
-might help in diagnosing the reason. Since the RTL 8002 requires
-the availability of a working interrupt for the printer adapter (unlike
-the
-.Xr ppc 4
-driver), the
-.Nm
-driver fails to attach if the ethernet adapter cannot assert an
-interrupt at probe time.
-.Pp
-The RTL 8002 doesn't support (hardware) multicast.
-.Pp
-The
-.Nm
-driver internally sets a flag so it gets probed very early. This way,
-it is possible to configure both, an
-.Nm
-driver as well as a
-.Xr ppc 4
-driver into the same kernel. If no RTL 8002 hardware is present, probing
-will eventually detect the printer driver.
-.Sh DIAGNOSTICS
-.Dl "rdp0: configured IRQ (7) cannot be asserted by device"
-.Pp
-The probe routine was unable to get the RTL 8002 asserting an interrupt
-request through the printer adapter.
-.Pp
-.Dl "rdp0: failed to find a valid hardware address in EEPROM"
-.Pp
-Since there doesn't seem to be a standard place for storing the hardware
-ethernet address within the EEPROM, the
-.Nm
-driver walks the entire (serial) EEPROM contents until it finds something
-that looks like a valid ethernet hardware address, based on the IEEE's
-OUI assignments. This diagnostic tells the driver was unable to find
-one. Note: it might as well be the current adapter is one of the rare
-examples with a 74S288 EEPROM, so
-.Ql flags 0x1
-should be tried.
-.Pp
-.Dl "rdp0: Device timeout"
-.Pp
-After initiating a packet transmission, the ethernet adapter didn't
-return a notification of the (successful or failed) transmission. The
-hardware is likely to be wedged, and is being reset.
-.Sh SEE ALSO
-.Xr ng_ether 4 ,
-.Xr ppc 4 ,
-.Xr ifconfig 8
-.Sh AUTHORS
-This driver was written by
-.An J\(:org Wunsch ,
-based on RealTek's packet driver for the RTL 8002, as well as on some
-description of the successor chip, RTL 8012, gracefully provided by
-RealTek.
-.Sh BUGS
-There are certainly many of them.
-.Pp
-Since the
-.Nm
-driver wants to probe its hardware at boot-time, the adapter needs
-to be present then in order to be detected.
-.Pp
-Only two out of the eight different speed modes RealTek's packet
-driver could handle are implemented. Thus there might be hardware
-where even the current slow mode is too fast.
-.Pp
-There should be a DMA transfer test in the probe routine that figures
-out the usable mode automatically.
-.Pp
-Abusing a standard printer interface for data exchange is error-prone.
-Occasional stuck hardware shouldn't surprise too much, hopefully the
-timeout routine will catch these cases. Flood-pinging is a good
-example of triggering this problem. Likewise, albeit BPF is of course
-supported, it's certainly a bad idea attempting to watch a crowded
-ethernet wire using promiscuous mode.
-.Pp
-Since the RTL 8002 has only 4 KB of Rx buffer space (2 x 2 KB are used
-as Tx buffers), the usual NFS deadlock with large packets arriving too
-quickly could happen if a machine using the
-.Nm
-driver NFS-mounts some fast server with the standard NFS blocksize of
-8 KB. (Since NFS can only retransmit entire NFS packets, the same
-packet will be retransmitted over and over again.)
-.Pp
-The heuristic to find out the ethernet hardware address from the
-EEPROM sucks, but seems to be the only sensible generic way that
-doesn't depend on the actual location in EEPROM. RealTek's sample
-driver placed it directly at address 0, other vendors picked something
-like 15, with other junk in front of it that must not be confused with
-a valid ethernet address.
-.Pp
-The driver should support the successor chip RTL 8012, which seems to
-be available and used these days. (The RTL 8002 is already somewhat
-aged, around 1992/93.) The RTL 8012 offers support for advanced
-printer adapter hardware, like bidirectional SPP, or EPP, which could
-speed up the transfers substantially. The RTL 8012 also supports
-hardware multicast, and has the ability to address 64 K x 4 packet
-buffer RAM.
-.Pp
-The driver should be layered upon the ppc driver, instead of working
-standalone, and should be available as a loadable module, so the
-device probing can be deferred until the pocket ethernet adapter has
-actually been attached.
+++ /dev/null
-.\" Copyright (c) 1992, 1993 Eugene W. Stark
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Eugene W. Stark.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY EUGENE W. STARK (THE AUTHOR) ``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 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: src/share/man/man4/man4.i386/tw.4,v 1.9.2.3 2001/08/17 13:08:46 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/tw.4,v 1.3 2006/08/18 01:42:58 swildner Exp $
-.\"
-.Dd October 30, 1993
-.Dt TW 4 i386
-.Os
-.Sh NAME
-.Nm tw
-.Nd TW-523 X-10 device driver
-.Sh DESCRIPTION
-.Nm Tw
-is the driver for the TW-523 power line interface, for use with X-10 home
-control products. The X-10 protocol is compatible with a number of home
-control systems, including Radio Shack ``Plug 'n Power(tm)'' and
-Stanley ``Lightmaker(tm).''
-.Pp
-The driver supports
-.Fn read
-.Fn write
-and
-.Fn select
-system calls.
-The driver allows multiple processes to read and write simultaneously,
-but there is probably not much sense in having more than one reader or more
-than one writer at a time, and in fact there may currently be a race
-condition in the driver if two processes try to transmit simultaneously
-(due to unsynchronized access to the sc_pkt structure in tw_sc).
-.Pp
-Transmission is done by calling
-.Fn write
-to send three byte packets of data.
-The first byte contains a four bit house code (0=A to 15=P). The second byte
-contains a five bit unit/key code (0=unit 1 to 15=unit 16, 16=All Units Off
-to 31 = Status Request). The third byte specifies the number of times the
-packet is to be transmitted without any gaps between successive transmissions.
-Normally this is 2, as per the X-10 documentation, but sometimes (e.g. for
-bright and dim codes) it can be another value. Each call to
-.Fn write
-can specify
-an arbitrary number of data bytes, but at most one packet will actually be
-processed in any call. Any incomplete packet is buffered until a subsequent
-call to
-.Fn write
-provides data to complete it. Successive calls to
-.Fn write
-leave a three-cycle gap between transmissions, per the X-10 documentation.
-The driver transmits each bit only once per half cycle, not three times as
-the X-10 documentation states, because the TW523 only provides sync on
-each power line zero crossing. So, the driver will probably not work
-properly if you have three-phase service. Most residences use a two-wire
-system, for which the driver does work.
-.Pp
-Reception is done using
-.Fn read
-The driver produces a series of three
-character packets. In each packet, the first character consists of flags,
-the second character is a four bit house code (0-15), and the third character
-is a five bit key/function code (0-31). The flags are the following:
-.Bd -literal
-#define TW_RCV_LOCAL 1 /* The packet arrived during a local transmission */
-#define TW_RCV_ERROR 2 /* An invalid/corrupted packet was received */
-.Ed
-.Pp
-The
-.Fn select
-system call can be used in the usual way to determine if there
-is data ready for reading.
-.Sh FILES
-.Bl -tag -width /dev/tw
-.It Pa /dev/tw?
-the TW523 special file
-.El
-.Sh SEE ALSO
-.Xr xten 1 ,
-.Xr xtend 8
-.Pp
-TW-523 documentation from X-10 Inc.
-.Sh AUTHORS
-.An Eugene W. Stark Aq stark@cs.sunysb.edu
+++ /dev/null
-.\"
-.\" Copyright (c) 1997, Jim Binkley
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Jim Binkley
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" 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: src/share/man/man4/man4.i386/wl.4,v 1.10.2.5 2002/03/19 18:24:15 schweikh Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/wl.4,v 1.5 2008/04/15 19:19:49 swildner Exp $
-.Dd July 7, 1997
-.Dt WL 4 i386
-.Os
-.Sh NAME
-.Nm wl
-.Nd T1 speed ISA/radio lan card
-.Sh SYNOPSIS
-.Cd "device wl0 at isa? port 0x300 irq 5"
-.Sh DESCRIPTION
-The
-.Nm
-driver controls a radio lan card system made originally by
-NCR, then ATT, now Lucent. The system is spread-spectrum radio
-at around 915 MHz (or 2.4 GHz). With the supplied omni-directional antennae,
-about 400 feet (indoors, more outdoors) can be covered in circumference.
-This card can talk to the companion (wlp0) pccard. Speeds vary
-from 1 megabit to theoretically 2 megabits (roughly T1 in speed).
-.Pp
-The card has three fundamental hardware
-units, a so-called PSA or programmable storage area, a radio modem,
-and an ethernet lan controller. The latter component is the
-ancient (and not very honorable) Intel 82586 ethernet chip.
-Fundamentally it appears to the operating system as an ethernet system,
-and speaks IEEE MAC addresses. The radio modem simply translates
-ethernet packets to/from radio packets, that are either at 2.4 GHz
-or 915 MHz depending on the radio modem. It supports a collision
-avoidance scheme. The lan controller
-supports promiscuous mode, broadcast, and multicasting
-(although there is a glitch
-in the latter). "It thinks it is ethernet".
-.Pp
-How it is used
-depends on the kind of antennae deployed with it. Point to point
-applications are possible as are ethernet-like lan use. The vendor
-ships an omni-directional antennae that works in the
-vicinity of 400 feet (indoors).
-Point to point antennae can be purchased that will go miles.
-.Sh SETUP
-The card can either be initialized with the vendor supplied DOS setup software.
-Typically minimally an IRQ, port, and Network ID must be supplied.
-Michael Smith's
-.Xr wlconfig 8
-utility can now be used to do this work from the
-.Ux
-side. The card is "not" plug and play.
-The network id controls whether one set of cards can hear another.
-If different, cards will read physical packets, but they will be discarded
-by the radio modem.
-.Sh CONTROL
-In addition to the config utility, there are several sysctl
-switches that can be used to modify runtime parameters.
-The
-.Xr sysctl 8
-variables are as follows:
-.Bl -diag
-.It "machdep.wl_xmit_delay <useconds>"
-This variable will cause the driver to insert a delay on transmit.
-250 is the default. The delay should probably be a bit longer
-on faster cpus and less on slower cpus. It exists because the 82586
-was not designed to work with pentium-speed cpu systems and if overdriven
-will have copious xmit side errors.
-.It machdep.wl_ignore_nwid <0 | 1>
-This switch defaults to 0; i.e., the nwid is not ignored. It can
-be set to 1 to cause the nwid to not be used. This may be useful
-when the device is in promiscuous mode as one can watch for all
-packets and ignore nwid differences.
-.It machdep.wl_xmit_watch <milliseconds>
-This switch is not currently useful.
-.It machdep.wl_gather_snr <milliseconds>
-This switch is not currently useful.
-.Pp
-There is also a signal strength cache in the driver. It may be interrogated
-with
-.Xr wlconfig 8 .
-Incoming packets
-are checked for certain hardware radio-modem values including signal
-strength, silence, and quality, which range fro 0..63, 0..63, and 0..15
-respectively. Thus one can read out signal strenth values to see
-how close/far peer nodes are. The signal strength cache is indexed by
-sender MAC address.
-There are two sysctls that change how it filters packets. Both are on
-by default.
-.It machdep.wl_wlcache_mcastonly <0 | 1>
-By default this switch is on.
-It forces the cache to filter out
-unicast packets. Only broadcast or multicast packets are accepted.
-.It machdep.wl_wlcache_iponly <0 | 1>
-By default this switch is on. It forces the driver to discard non-IP
-packets and also stores the IP src address. ARP packets are ignored,
-as are any other network protocol barring IPv4 packets.
-.El
-.Sh CAVEATS
-The 82586 has numerous defects. It may experience transmit-side
-errors when modern faster cpus send packets at it faster than it can handle.
-The driver (and probably the chip) does not support an all multicast mode.
-As a result, it can be used with applications like
-.Xr mrouted 8 ,
-but it must go into promiscuous mode for that to work. The driver
-is slow to change modes from "normal" to promiscuous mode, presumably
-due to delays in the configuration code.
-.Sh SEE ALSO
-.Xr sysctl 8 ,
-.Xr wlconfig 8
-.Pp
-.Pa http://web.archive.org/web/*/http://www.wavelan.com
-.Sh HISTORY
-The
-.Nm
-driver was written by
-.An Anders Klemets
-(thousands of years ago?) and
-appears to be based on an even older Intel 82586 driver. The 82586
-controller was one of the first (if not the first?) integrated lan
-controller on the block. That does not mean it was the best either.
-Anders ported and or created a driver for the ISA wavelan and PCCARD
-wavelan system too (wlp).
-.An Robert T. Morris, Jr.
-ported the Mach drivers to BSDI.
-.An Jim Binkley
-ported them to
-.Fx 2.1 .
-.An Michael Smith
-ported the wl driver only to 2.2.2. Jim and Michael have been
-maintaining them. The current state of the driver is NOT ANYONE'S
-FAULT. Thanks to
-.An Bernie Doehner
-and
-.An Robert Buaas
-for contributions.
-.Sh AUTHORS
-Too numerous to mention. See above.
+++ /dev/null
-.\"
-.\" Copyright (c) 1994 James A. Jegers
-.\" 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. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: src/share/man/man4/man4.i386/wt.4,v 1.6.2.5 2001/08/17 13:08:46 ru Exp $
-.\" $DragonFly: src/share/man/man4/man4.i386/wt.4,v 1.2 2003/06/17 04:37:00 dillon Exp $
-.\"
-.Dd July 10, 1995
-.Dt WT 4 i386
-.Os
-.Sh NAME
-.Nm wt
-.Nd Archive/Wangtek cartridge tape driver
-.Sh SYNOPSIS
-.Cd "device wt0 at isa? port 0x300 irq 5 drq 1"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for the following Archive and Wangtek boards:
-.Pp
-.Bl -item -offset indent -compact
-.It
-QIC-02
-.It
-QIC-36
-.El
-.Sh SEE ALSO
-.Xr intro 4
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man4/mouse.4,v 1.8.2.3 2001/12/17 11:30:12 ru Exp $
-.\" $DragonFly: src/share/man/man4/mouse.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
.\"
.Dd December 3, 1997
.Dt MOUSE 4
.In sys/mouse.h
.Sh DESCRIPTION
The mouse drivers
-.Xr mse 4 ,
.Xr psm 4 ,
.Xr ums 4
and
.Bl -tag -width /dev/sysmouseXX -compact
.It Pa /dev/cuaa%d
serial ports
-.It Pa /dev/mse%d
-bus and InPort mouse device
.It Pa /dev/psm%d
PS/2 mouse device
.It Pa /dev/sysmouse
.El
.Sh SEE ALSO
.Xr ioctl 2 ,
-.Xr mse 4 ,
.Xr psm 4 ,
.Xr sysmouse 4 ,
.Xr ums 4 ,
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man4/psm.4,v 1.24.2.9 2002/12/29 16:35:38 schweikh Exp $
-.\" $DragonFly: src/share/man/man4/psm.4,v 1.7 2008/05/02 02:05:05 swildner Exp $
.\"
.Dd October 15, 2010
.Dt PSM 4
.Xr syslog 3 ,
.Xr atkbdc 4 ,
.Xr mouse 4 ,
-.Xr mse 4 ,
.Xr sysmouse 4 ,
.Xr moused 8 ,
.Xr syslogd 8
.Xr camcontrol 8
for details.
.Sh SEE ALSO
-.Xr aha 4 ,
.Xr ahc 4 ,
.Xr bt 4 ,
.Xr cd 4 ,
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man4/sn.4,v 1.4.2.1 2002/11/19 22:05:47 bmah Exp $
-.\" $DragonFly: src/share/man/man4/sn.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
.\"
.Dd November 7, 2000
.Dt SN 4
device driver supports SMC9xxx based ISA and PCMCIA cards.
.Sh SEE ALSO
.Xr ed 4 ,
-.Xr el 4 ,
.Xr ep 4 ,
-.Xr ie 4 ,
.Xr intro 4 ,
-.Xr le 4 ,
.Xr ng_ether 4 ,
.Xr vx 4 ,
.Xr ifconfig 8
this is the actual port the mouse is on.
It might be
.Pa /dev/cuaa0
-for a COM1 serial mouse,
+for a COM1 serial mouse or
.Pa /dev/psm0
-for a PS/2 mouse or
-.Pa /dev/mse0
-for a bus mouse, for example.
+for a PS/2 mouse, for example.
.It Va moused_flags
.Pq Vt str
If
#
# $FreeBSD: src/sys/boot/common/pnpdata,v 1.2 1999/08/28 00:39:51 peter Exp $
-# $DragonFly: src/sys/boot/common/pnpdata,v 1.4 2007/05/17 19:26:05 swildner Exp $
#
# This file contains the system default Plug-and-Play data. It is
# derived from a number of sources, including:
ident=PNP80d5 module=ed # NE1000 Compatible
ident=PNP80d6 module=ed # NE2000 Compatible
ident=PNP80d8 module=lnc # Novell/Anthem NE2100
-ident=PNP80e9 module=le # DEC (DE200) EtherWorks Turbo
-ident=PNP80eb module=le # DEC (DE201) EtherWorks Turbo/TP
-ident=PNP80ec module=le # DEC (DE202) EtherWorks Turbo/TP_BNC
ident=PNP80f1 module=eg # 3Com EtherLink Plus
ident=PNP80f3 module=ed # 3Com EtherLink II or IITP (8 or 16-bit)
ident=PNP80f6 module=ed # 3Com EtherLink 16
ident=PNP8127 module=ed # SMC EtherCard PLUS With Boot ROM Socket (WD/8003EB)
ident=PNP8128 module=ed # SMC EtherCard PLUS TP (WD/8003WT)
ident=PNP812a module=ed # SMC EtherCard PLUS 16 With Boot ROM Socket (WD/8013EBT)
-ident=PNP812d module=ie # Intel EtherExpress 16 or 16TP
ident=PNP8137 module=ed # Artisoft AE-1
ident=PNP8138 module=ed # Artisoft AE-2 or AE-3
ident=PNP8158 module=ed # HP PC LAN Adapter/16 TP Plus (HP27247B)
* $FreeBSD: src/sys/i386/isa/isa_compat.h,v 1.27.2.11 2002/10/05 18:31:48 scottl Exp $
*/
-#include "use_el.h"
-#include "use_le.h"
-#include "use_rdp.h"
-#include "use_wt.h"
-#include "use_ctx.h"
-#include "use_spigot.h"
-#include "use_gp.h"
-#include "use_gsc.h"
#include "use_cy.h"
-#include "use_dgb.h"
-#include "use_labpc.h"
-#include "use_rc.h"
-#include "use_tw.h"
-#include "use_asc.h"
#include "use_stl.h"
#include "use_stli.h"
struct isa_driver *driver;
};
-extern struct isa_driver eldriver;
-extern struct isa_driver ledriver;
-extern struct isa_driver rdpdriver;
-extern struct isa_driver wtdriver;
-extern struct isa_driver ctxdriver;
-extern struct isa_driver spigotdriver;
-extern struct isa_driver gpdriver;
-extern struct isa_driver gscdriver;
-extern struct isa_driver cydriver;
-extern struct isa_driver dgbdriver;
-extern struct isa_driver labpcdriver;
-extern struct isa_driver rcdriver;
-extern struct isa_driver twdriver;
-extern struct isa_driver ascdriver;
+extern struct isa_driver cydriver;
extern struct isa_driver stldriver;
extern struct isa_driver stlidriver;
/* Sensitive BIO */
/* Sensitive NET */
-#if NRDP > 0
- { 0, &rdpdriver },
-#endif
/* Sensitive CAM */
/* TTY */
-#if NGP > 0
- { 0, &gpdriver },
-#endif
-#if NGSC > 0
- { 0, &gscdriver },
-#endif
#if NCY > 0
{ 0, &cydriver },
#endif
-#if NDGB > 0
- { 0, &dgbdriver },
-#endif
-#if NLABPC > 0
- { 0, &labpcdriver },
-#endif
-#if NRC > 0
- { 0, &rcdriver },
-#endif
-#if NTW > 0
- { 0, &twdriver },
-#endif
-#if NASC > 0
- { 0, &ascdriver },
-#endif
#if NSTL > 0
{ 0, &stldriver },
#endif
/* BIO */
-#if NWT > 0
- { 0, &wtdriver },
-#endif
-
/* NET */
-#if NLE > 0
- { 0, &ledriver },
-#endif
-#if NEL > 0
- { 0, &eldriver },
-#endif
-
/* MISC */
-#if NCTX > 0
- { 0, &ctxdriver },
-#endif
-#if NSPIGOT > 0
- { 0, &spigotdriver },
-#endif
-
};
#define old_drivers_count NELEM(old_drivers)
dev/raid/amr/amr_disk.c optional amr
#dev/raid/amr/amr_linux.c optional amr compat_linux
dev/raid/amr/amr_pci.c optional amr pci
-dev/disk/aha/aha.c optional aha
-dev/disk/aha/aha_isa.c optional aha isa
dev/disk/aic/aic.c optional aic
dev/disk/aic/aic_pccard.c optional aic pccard
dev/disk/aic7xxx/ahc_pci.c optional ahc pci
dev/raid/hptmv/gui_lib.c optional hptmv
dev/raid/hptmv/hptproc.c optional hptmv
dev/raid/hptmv/ioctl.c optional hptmv
-dev/netif/ie/if_ie.c optional nowerror ie isa
dev/powermng/ichsmb/ichsmb.c optional ichsmb
dev/powermng/ichsmb/ichsmb_pci.c optional ichsmb pci
dev/powermng/coretemp/coretemp.c optional coretemp
device adv0 at isa?
device adw
device bt0 at isa?
-device aha0 at isa?
device aic0 at isa?
device ncv # NCR 53C500
device wi
# The probe order of these is presently determined by i386/isa/isa_compat.c.
-device ie0 at isa? disable port 0x300 irq 10 iomem 0xd0000
-#device le0 at isa? disable port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? disable port 0x280 irq 10 drq 0
device cs0 at isa? disable port 0x300
device sn0 at isa? disable port 0x300 irq 10
#
#
-# SCSI host adapters: `aha', `aic', `bt'
+# SCSI host adapters: `aic' and `bt'
#
# adv: All Narrow SCSI bus AdvanSys controllers.
# adw: Second Generation AdvanSys controllers including the ADV940UW.
-# aha: Adaptec 154x
# ahc: Adaptec 274x/284x/294x
# aic: Adaptec 152x
# bt: Most Buslogic controllers
device bt0 at isa? port IO_BT0
device adv0 at isa?
device adw
-device aha0 at isa?
device aic0 at isa?
device ncv
device nsp
device fd1 at fdc0 drive 1
#
-# Other standard PC hardware: `mse', `sio', etc.
-#
-# mse: Logitech and ATI InPort bus mouse ports
# sio: serial ports (see sio(4))
-device mse0 at isa? port 0x23c irq 5
-
device sio0 at isa? port IO_COM1 flags 0x10 irq 4
#
device puc
#
-# Network interfaces: `ed', `el', `ep', `ie', `is', `le', `lnc'
+# Network interfaces: `ed', `ep', `is', `lnc'
#
# ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver (requires sppp)
# cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters
# ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
-# el: 3Com 3C501 (slow!)
# ep: 3Com 3C509
# ex: Intel EtherExpress Pro/10 and other i82595-based adapters
# fe: Fujitsu MB86960A/MB86965A Ethernet
-# ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; Intel EtherExpress
-# le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100,
-# DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422)
# lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 & Am79C960)
-# rdp: RealTek RTL 8002-based pocket ethernet adapters
# sbni: Granch SBNI12-xx adapters
# sbsh: Granch SBNI16 SHDSL modem PCI adapters
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
-# wl: Lucent Wavelan (ISA card only).
# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
# the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA
# bridge with a PCMCIA adapter plugged into it.
device ar0 at isa? port 0x300 irq 10 iomem 0xd0000
device cs0 at isa? port 0x300
device ed0 at isa? port 0x280 irq 5 iomem 0xd8000
-device el0 at isa? port 0x300 irq 9
device ep
device ex
device fe0 at isa? port 0x300
-device ie0 at isa? port 0x300 irq 5 iomem 0xd0000
-device ie1 at isa? port 0x360 irq 7 iomem 0xd0000
-device le0 at isa? port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? port 0x280 irq 10 drq 0
-device rdp0 at isa? port 0x378 irq 7 flags 2
device sbni0 at isa? port 0x210 irq 5 flags 0xefdead
device sln
device sr
device wlan_wep # 802.11 WEP support
device wlan_xauth # 802.11 WPA or 802.1x authentication for AP
device wlan_amrr # 802.11 AMRR TX rate control algorithm
-options WLCACHE # enables the signal-strength cache
-options WLDEBUG # enables verbose debugging output
device an # Aironet Communications 4500/4800
device ath # Atheros AR521x
options AH_SUPPORT_AR5416
device wi # WaveLAN/IEEE, PRISM-II, Spectrum24 802.11DS
#device rtw # RealTek 8180
#device acx # TI ACX100/ACX111.
-device wl0 at isa? port 0x300 # T1 speed ISA/radio lan
device xe # Xircom PCMCIA
device ral # Ralink Technology 802.11 wireless NIC
device wpi
#
# Miscellaneous hardware:
#
-# wt: Wangtek and Archive QIC-02/QIC-36 tape drives
-# ctx: Cortex-I frame grabber
# apm: Laptop Advanced Power Management (experimental)
-# spigot: The Creative Labs Video Spigot video-acquisition board
# bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board
# cy: Cyclades serial driver
-# dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!)
-# dgm: Digiboard PC/Xem driver
-# gp: National Instruments AT-GPIB and AT-GPIB/TNT board
-# asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey
-# gsc: Genius GS-4500 hand scanner.
# joy: joystick
-# labpc: National Instrument's Lab-PC and Lab-PC+
-# rc: RISCom/8 multiport card
# rp: Comtrol Rocketport(ISA) - single card
-# tw: TW-523 power line interface for use with X-10 home control products
# si: Specialix SI/XIO 4-32 port terminal multiplexor
# spic: Sony Programmable I/O controller (VAIO notebooks)
# stl: Stallion EasyIO and EasyConnection 8/32 (ISA and PCI), EasyConnection 8/64 PCI
# If apm is omitted, some systems require sysctl -w kern.timecounter.method=1
# for correct timekeeping.
-# Notes on the spigot:
-# The video spigot is at 0xad6. This port address can not be changed.
-# The irq values may only be 10, 11, or 15
-# I/O memory is an 8kb region. Possible values are:
-# 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff
-# The start address must be on an even boundary.
-# Add the following option if you want to allow non-root users to be able
-# to access the spigot. This option is not secure because it allows users
-# direct access to the I/O page.
-# options SPIGOT_UNSECURE
-
# Notes on the Comtrol Rocketport driver:
#
# The exact values used for rp0 depend on how many boards you have
#
# device rp
-# Notes on the Digiboard driver:
-#
-# The following flag values have special meanings:
-# 0x01 - alternate layout of pins (dgb & dgm)
-# 0x02 - use the windowed PC/Xe in 64K mode (dgb only)
-
# Notes on the Specialix SI/XIO driver:
# **This is NOT a Specialix supported Driver!**
# The host card is memory, not IO mapped.
# Stallion: flags 1 iosiz 0x10000
# For the PCI cards, "device stl" will suffice.
-# for the SoundBlaster 16 multicd - up to 4 devices
-device wt0 at isa? port 0x300 irq 5 drq 1
-device ctx0 at isa? port 0x230 iomem 0xd0000
-device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000
device apm0
-device gp0 at isa? port 0x2c0
-device gsc0 at isa? port IO_GSC1 drq 3
device joy0 at isa? port IO_GAME
device cy0 at isa? irq 10 iomem 0xd4000 iosiz 0x2000
-#device dgb0 at isa? port 0x220 iomem 0xfc000
-#options NDGBPORTS=16 # Defaults to 16*NDGB
-device dgm0 at isa? port 0x104 iomem 0xd0000
-device labpc0 at isa? port 0x260 irq 5
-device rc0 at isa? port 0x220 irq 12
device nrp
-#device rp0 at isa? port 0x280
-# the port and irq for tw0 are fictitious
-device tw0 at isa? port 0x380 irq 11
device si0 at isa? iomem 0xd0000 irq 12
-device asc0 at isa? port IO_ASC1 drq 3 irq 10
device spic0 at isa? irq 0 port 0x10a0
device stl0 at isa? port 0x2a0 irq 10
device stli0 at isa? port 0x2a0 iomem 0xcc000 flags 23 iosiz 0x1000
#
#
-# SCSI host adapters: `aha', `aic', `bt'
+# SCSI host adapters: `aic' and `bt'
#
# adv: All Narrow SCSI bus AdvanSys controllers.
# adw: Second Generation AdvanSys controllers including the ADV940UW.
-# aha: Adaptec 154x
# ahc: Adaptec 274x/284x/294x
# aic: Adaptec 152x
# bt: Most Buslogic controllers
device bt0 at isa? port IO_BT0
device adv0 at isa?
device adw
-device aha0 at isa?
device aic0 at isa?
device ncv
device nsp
# ST16650A-compatible UARTs.
#
-# Network interfaces: `ed', `ep', `ie', `is', `lnc'
+# Network interfaces: `ed', `ep', `is', `lnc'
#
# cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters
# ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
# ep: 3Com 3C509
# ex: Intel EtherExpress Pro/10 and other i82595-based adapters
# fe: Fujitsu MB86960A/MB86965A Ethernet
-# ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; Intel EtherExpress
# lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 & Am79C960)
# sbsh: Granch SBNI16 SHDSL modem PCI adapters
# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
device ed0 at isa? port 0x280 irq 5 iomem 0xd8000
device ep
device ex
-device ie0 at isa? port 0x300 irq 5 iomem 0xd0000
-device ie1 at isa? port 0x360 irq 7 iomem 0xd0000
device lnc0 at isa? port 0x280 irq 10 drq 0
device sln
device sn0 at isa? port 0x300 irq 10
device adv0 at isa?
device adw
device bt0 at isa?
-device aha0 at isa?
device aic0 at isa?
device ncv # NCR 53C500
device wi
# The probe order of these is presently determined by i386/isa/isa_compat.c.
-#device le0 at isa? disable port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? disable port 0x280 irq 10 drq 0
device cs0 at isa? disable port 0x300
device sn0 at isa? disable port 0x300 irq 10
.include "${.CURDIR}/../../platform/${MACHINE_PLATFORM}/Makefile.inc"
-SUBDIR= aha ahci aic aic7xxx ccd dm iscsi ispfw md mmcsd mps mpt ncv nsp
+SUBDIR= ahci aic aic7xxx ccd dm iscsi ispfw md mmcsd mps mpt ncv nsp
SUBDIR+= sbp sdhci sili stg trm vn vpo
.for dir in ${SUBDIR}
+++ /dev/null
-# $FreeBSD: src/sys/modules/aha/Makefile,v 1.4 2000/01/28 11:26:23 bde Exp $
-
-KMOD = aha
-SRCS = aha.c aha_isa.c ahareg.h opt_cam.h device_if.h bus_if.h use_aha.h \
- opt_scsi.h isa_if.h
-CLEANFILES = use_aha.h
-
-use_aha.h:
- echo "#define NAHA 1" > use_aha.h
-
-.if !defined(BUILDING_WITH_KERNEL)
-opt_scsi.h:
- echo "#define SCSI_DELAY 15000" > opt_scsi.h
-.endif
-
-.include <bsd.kmod.mk>
+++ /dev/null
-/*
- * Generic register and struct definitions for the Adaptech 154x/164x
- * SCSI host adapters. Product specific probe and attach routines can
- * be found in:
- * aha 1540/1542B/1542C/1542CF/1542CP aha_isa.c
- *
- * Copyright (c) 1998 M. Warner Losh.
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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.
- *
- * Derived from bt.c written by:
- *
- * Copyright (c) 1998 Justin T. Gibbs.
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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: src/sys/dev/aha/aha.c,v 1.34.2.1 2000/08/02 22:24:39 peter Exp $
- * $DragonFly: src/sys/dev/disk/aha/aha.c,v 1.20 2008/05/18 20:30:21 pavalos Exp $
- */
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/kernel.h>
-#include <sys/thread2.h>
-
-#include <machine/clock.h>
-
-#include <bus/cam/cam.h>
-#include <bus/cam/cam_ccb.h>
-#include <bus/cam/cam_sim.h>
-#include <bus/cam/cam_xpt_sim.h>
-#include <bus/cam/cam_debug.h>
-
-#include <bus/cam/scsi/scsi_message.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-
-#include "ahareg.h"
-
-struct aha_softc *aha_softcs[NAHATOT];
-
-#define PRVERB(x) do { if (bootverbose) device_printf x; } while(0)
-
-/* Macro to determine that a rev is potentially a new valid one
- * so that the driver doesn't keep breaking on new revs as it
- * did for the CF and CP.
- */
-#define PROBABLY_NEW_BOARD(REV) (REV > 0x43 && REV < 0x56)
-
-/* MailBox Management functions */
-static __inline void ahanextinbox(struct aha_softc *aha);
-static __inline void ahanextoutbox(struct aha_softc *aha);
-
-#define aha_name(aha) device_get_nameunit(aha->dev)
-
-static __inline void
-ahanextinbox(struct aha_softc *aha)
-{
- if (aha->cur_inbox == aha->last_inbox)
- aha->cur_inbox = aha->in_boxes;
- else
- aha->cur_inbox++;
-}
-
-static __inline void
-ahanextoutbox(struct aha_softc *aha)
-{
- if (aha->cur_outbox == aha->last_outbox)
- aha->cur_outbox = aha->out_boxes;
- else
- aha->cur_outbox++;
-}
-
-#define ahautoa24(u,s3) \
- (s3)[0] = ((u) >> 16) & 0xff; \
- (s3)[1] = ((u) >> 8) & 0xff; \
- (s3)[2] = (u) & 0xff;
-
-#define aha_a24tou(s3) \
- (((s3)[0] << 16) | ((s3)[1] << 8) | (s3)[2])
-
-/* CCB Mangement functions */
-static __inline u_int32_t ahaccbvtop(struct aha_softc *aha,
- struct aha_ccb *accb);
-static __inline struct aha_ccb* ahaccbptov(struct aha_softc *aha,
- u_int32_t ccb_addr);
-
-static __inline u_int32_t
-ahaccbvtop(struct aha_softc *aha, struct aha_ccb *accb)
-{
- return (aha->aha_ccb_physbase
- + (u_int32_t)((caddr_t)accb - (caddr_t)aha->aha_ccb_array));
-}
-static __inline struct aha_ccb *
-ahaccbptov(struct aha_softc *aha, u_int32_t ccb_addr)
-{
- return (aha->aha_ccb_array +
- + ((struct aha_ccb*)(intptr_t)ccb_addr -
- (struct aha_ccb*)(intptr_t)aha->aha_ccb_physbase));
-}
-
-static struct aha_ccb* ahagetccb(struct aha_softc *aha);
-static __inline void ahafreeccb(struct aha_softc *aha, struct aha_ccb *accb);
-static void ahaallocccbs(struct aha_softc *aha);
-static bus_dmamap_callback_t ahaexecuteccb;
-static void ahadone(struct aha_softc *aha, struct aha_ccb *accb,
- aha_mbi_comp_code_t comp_code);
-
-/* Host adapter command functions */
-static int ahareset(struct aha_softc* aha, int hard_reset);
-
-/* Initialization functions */
-static int ahainitmboxes(struct aha_softc *aha);
-static bus_dmamap_callback_t ahamapmboxes;
-static bus_dmamap_callback_t ahamapccbs;
-static bus_dmamap_callback_t ahamapsgs;
-
-/* Transfer Negotiation Functions */
-static void ahafetchtransinfo(struct aha_softc *aha,
- struct ccb_trans_settings *cts);
-
-/* CAM SIM entry points */
-#define ccb_accb_ptr spriv_ptr0
-#define ccb_aha_ptr spriv_ptr1
-static void ahaaction(struct cam_sim *sim, union ccb *ccb);
-static void ahapoll(struct cam_sim *sim);
-
-/* Our timeout handler */
-static timeout_t ahatimeout;
-
-u_long aha_unit = 0;
-
-/*
- * Do our own re-probe protection until a configuration
- * manager can do it for us. This ensures that we don't
- * reprobe a card already found by the EISA or PCI probes.
- */
-static struct aha_isa_port aha_isa_ports[] =
-{
- { 0x130, 4 },
- { 0x134, 5 },
- { 0x230, 2 },
- { 0x234, 3 },
- { 0x330, 0 },
- { 0x334, 1 }
-};
-
-/*
- * I/O ports listed in the order enumerated by the
- * card for certain op codes.
- */
-static u_int16_t aha_board_ports[] =
-{
- 0x330,
- 0x334,
- 0x230,
- 0x234,
- 0x130,
- 0x134
-};
-
-/* Exported functions */
-struct aha_softc *
-aha_alloc(device_t dev, bus_space_tag_t tag, bus_space_handle_t bsh)
-{
- struct aha_softc *aha;
-
- int unit = device_get_unit(dev);
- if (unit != AHA_TEMP_UNIT) {
- if (unit >= NAHATOT) {
- device_printf(dev, "unit number (%d) too high\n", unit);
- return NULL;
- }
-
- /*
- * Allocate a storage area for us
- */
- if (aha_softcs[unit]) {
- device_printf(dev, "memory already allocated\n");
- return NULL;
- }
- }
-
- aha = kmalloc(sizeof(struct aha_softc), M_DEVBUF, M_INTWAIT | M_ZERO);
- SLIST_INIT(&aha->free_aha_ccbs);
- LIST_INIT(&aha->pending_ccbs);
- SLIST_INIT(&aha->sg_maps);
- aha->dev = dev;
- aha->tag = tag;
- aha->bsh = bsh;
- aha->ccb_sg_opcode = INITIATOR_SG_CCB_WRESID;
- aha->ccb_ccb_opcode = INITIATOR_CCB_WRESID;
-
- if (unit != AHA_TEMP_UNIT) {
- aha_softcs[unit] = aha;
- }
- return (aha);
-}
-
-void
-aha_free(struct aha_softc *aha)
-{
- int unit = device_get_unit(aha->dev);
-
- switch (aha->init_level) {
- default:
- case 8:
- {
- struct sg_map_node *sg_map;
-
- while ((sg_map = SLIST_FIRST(&aha->sg_maps))!= NULL) {
- SLIST_REMOVE_HEAD(&aha->sg_maps, links);
- bus_dmamap_unload(aha->sg_dmat,
- sg_map->sg_dmamap);
- bus_dmamem_free(aha->sg_dmat, sg_map->sg_vaddr,
- sg_map->sg_dmamap);
- kfree(sg_map, M_DEVBUF);
- }
- bus_dma_tag_destroy(aha->sg_dmat);
- }
- /* fall through */
- case 7:
- bus_dmamap_unload(aha->ccb_dmat, aha->ccb_dmamap);
- /* fall through */
- case 6:
- bus_dmamap_destroy(aha->ccb_dmat, aha->ccb_dmamap);
- bus_dmamem_free(aha->ccb_dmat, aha->aha_ccb_array,
- aha->ccb_dmamap);
- /* fall through */
- case 5:
- bus_dma_tag_destroy(aha->ccb_dmat);
- /* fall through */
- case 4:
- bus_dmamap_unload(aha->mailbox_dmat, aha->mailbox_dmamap);
- /* fall through */
- case 3:
- bus_dmamem_free(aha->mailbox_dmat, aha->in_boxes,
- aha->mailbox_dmamap);
- bus_dmamap_destroy(aha->mailbox_dmat, aha->mailbox_dmamap);
- /* fall through */
- case 2:
- bus_dma_tag_destroy(aha->buffer_dmat);
- /* fall through */
- case 1:
- bus_dma_tag_destroy(aha->mailbox_dmat);
- /* fall through */
- case 0:
- break;
- }
- if (unit != AHA_TEMP_UNIT) {
- aha_softcs[unit] = NULL;
- }
- kfree(aha, M_DEVBUF);
-}
-
-/*
- * Probe the adapter and verify that the card is an Adaptec.
- */
-int
-aha_probe(struct aha_softc* aha)
-{
- u_int status;
- u_int intstat;
- int error;
- board_id_data_t board_id;
-
- /*
- * See if the three I/O ports look reasonable.
- * Touch the minimal number of registers in the
- * failure case.
- */
- status = aha_inb(aha, STATUS_REG);
- if ((status == 0)
- || (status & (DIAG_ACTIVE|CMD_REG_BUSY|
- STATUS_REG_RSVD)) != 0) {
- PRVERB((aha->dev, "status reg test failed %x\n", status));
- return (ENXIO);
- }
-
- intstat = aha_inb(aha, INTSTAT_REG);
- if ((intstat & INTSTAT_REG_RSVD) != 0) {
- PRVERB((aha->dev, "Failed Intstat Reg Test\n"));
- return (ENXIO);
- }
-
- /*
- * Looking good so far. Final test is to reset the
- * adapter and fetch the board ID and ensure we aren't
- * looking at a BusLogic.
- */
- if ((error = ahareset(aha, /*hard_reset*/TRUE)) != 0) {
- PRVERB((aha->dev, "Failed Reset\n"));
- return (ENXIO);
- }
-
- /*
- * Get the board ID. We use this to see if we're dealing with
- * a buslogic card or a aha card (or clone).
- */
- error = aha_cmd(aha, AOP_INQUIRE_BOARD_ID, NULL, /*parmlen*/0,
- (u_int8_t*)&board_id, sizeof(board_id),
- DEFAULT_CMD_TIMEOUT);
- if (error != 0) {
- PRVERB((aha->dev, "INQUIRE failed %x\n", error));
- return (ENXIO);
- }
- aha->fw_major = board_id.firmware_rev_major;
- aha->fw_minor = board_id.firmware_rev_minor;
- aha->boardid = board_id.board_type;
-
- /*
- * The Buslogic cards have an id of either 0x41 or 0x42. So
- * if those come up in the probe, we test the geometry register
- * of the board. Adaptec boards that are this old will not have
- * this register, and return 0xff, while buslogic cards will return
- * something different.
- *
- * It appears that for reasons unknow, for the for the
- * aha-1542B cards, we need to wait a little bit before trying
- * to read the geometry register. I picked 10ms since we have
- * reports that a for loop to 1000 did the trick, and this
- * errs on the side of conservatism. Besides, no one will
- * notice a 10mS delay here, even the 1542B card users :-)
- *
- * Some compatible cards return 0 here. Some cards also
- * seem to return 0x7f.
- *
- * XXX I'm not sure how this will impact other cloned cards
- *
- * This really should be replaced with the esetup command, since
- * that appears to be more reliable. This becomes more and more
- * true over time as we discover more cards that don't read the
- * geometry register consistantly.
- */
- if (aha->boardid <= 0x42) {
- /* Wait 10ms before reading */
- DELAY(10000);
- status = aha_inb(aha, GEOMETRY_REG);
- if (status != 0xff && status != 0x00 && status != 0x7f) {
- PRVERB((aha->dev, "Geometry Register test failed 0x%x\n", status));
- return (ENXIO);
- }
- }
-
- return (0);
-}
-
-/*
- * Pull the boards setup information and record it in our softc.
- */
-int
-aha_fetch_adapter_info(struct aha_softc *aha)
-{
- setup_data_t setup_info;
- config_data_t config_data;
- u_int8_t length_param;
- int error;
- struct aha_extbios extbios;
-
- switch (aha->boardid) {
- case BOARD_1540_16HEAD_BIOS:
- ksnprintf(aha->model, sizeof(aha->model), "1540 16 head BIOS");
- break;
- case BOARD_1540_64HEAD_BIOS:
- ksnprintf(aha->model, sizeof(aha->model), "1540 64 head BIOS");
- break;
- case BOARD_1542:
- ksnprintf(aha->model, sizeof(aha->model), "1540/1542 64 head BIOS");
- break;
- case BOARD_1640:
- ksnprintf(aha->model, sizeof(aha->model), "1640");
- break;
- case BOARD_1740:
- ksnprintf(aha->model, sizeof(aha->model), "1740A/1742A/1744");
- break;
- case BOARD_1542C:
- ksnprintf(aha->model, sizeof(aha->model), "1542C");
- break;
- case BOARD_1542CF:
- ksnprintf(aha->model, sizeof(aha->model), "1542CF");
- break;
- case BOARD_1542CP:
- ksnprintf(aha->model, sizeof(aha->model), "1542CP");
- break;
- default:
- ksnprintf(aha->model, sizeof(aha->model), "Unknown");
- break;
- }
- /*
- * If we are a new type of 1542 board (anything newer than a 1542C)
- * then disable the extended bios so that the
- * mailbox interface is unlocked.
- * This is also true for the 1542B Version 3.20. First Adaptec
- * board that supports >1Gb drives.
- * No need to check the extended bios flags as some of the
- * extensions that cause us problems are not flagged in that byte.
- */
- if (PROBABLY_NEW_BOARD(aha->boardid) ||
- (aha->boardid == 0x41
- && aha->fw_major == 0x31 &&
- aha->fw_minor >= 0x34)) {
- error = aha_cmd(aha, AOP_RETURN_EXT_BIOS_INFO, NULL,
- /*paramlen*/0, (u_char *)&extbios, sizeof(extbios),
- DEFAULT_CMD_TIMEOUT);
- error = aha_cmd(aha, AOP_MBOX_IF_ENABLE, (u_int8_t *)&extbios,
- /*paramlen*/2, NULL, 0, DEFAULT_CMD_TIMEOUT);
- }
- if (aha->boardid < 0x41)
- device_printf(aha->dev, "Warning: aha-1542A won't likely work.\n");
-
- aha->max_sg = 17; /* Need >= 17 to do 64k I/O */
- aha->diff_bus = 0;
- aha->extended_lun = 0;
- aha->extended_trans = 0;
- aha->max_ccbs = 16;
- /* Determine Sync/Wide/Disc settings */
- length_param = sizeof(setup_info);
- error = aha_cmd(aha, AOP_INQUIRE_SETUP_INFO, &length_param,
- /*paramlen*/1, (u_int8_t*)&setup_info,
- sizeof(setup_info), DEFAULT_CMD_TIMEOUT);
- if (error != 0) {
- device_printf(aha->dev, "aha_fetch_adapter_info - Failed "
- "Get Setup Info\n");
- return (error);
- }
- if (setup_info.initiate_sync != 0) {
- aha->sync_permitted = ALL_TARGETS;
- }
- aha->disc_permitted = ALL_TARGETS;
-
- /* We need as many mailboxes as we can have ccbs */
- aha->num_boxes = aha->max_ccbs;
-
- /* Determine our SCSI ID */
-
- error = aha_cmd(aha, AOP_INQUIRE_CONFIG, NULL, /*parmlen*/0,
- (u_int8_t*)&config_data, sizeof(config_data),
- DEFAULT_CMD_TIMEOUT);
- if (error != 0) {
- device_printf(aha->dev, "aha_fetch_adapter_info - Failed Get Config\n");
- return (error);
- }
- aha->scsi_id = config_data.scsi_id;
- return (0);
-}
-
-/*
- * Start the board, ready for normal operation
- */
-int
-aha_init(struct aha_softc* aha)
-{
- /* Announce the Adapter */
- device_printf(aha->dev, "AHA-%s FW Rev. %c.%c (ID=%x) ",
- aha->model, aha->fw_major, aha->fw_minor, aha->boardid);
-
- if (aha->diff_bus != 0)
- kprintf("Diff ");
- kprintf("SCSI Host Adapter, SCSI ID %d, %d CCBs\n", aha->scsi_id,
- aha->max_ccbs);
-
- /*
- * Create our DMA tags. These tags define the kinds of device
- * accessible memory allocations and memory mappings we will
- * need to perform during normal operation.
- *
- * Unless we need to further restrict the allocation, we rely
- * on the restrictions of the parent dmat, hence the common
- * use of MAXADDR and MAXSIZE.
- */
-
- /* DMA tag for mapping buffers into device visible space. */
- if (bus_dma_tag_create(aha->parent_dmat, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- /*maxsize*/MAXBSIZE, /*nsegments*/AHA_NSEG,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_24BIT,
- /*flags*/BUS_DMA_ALLOCNOW,
- &aha->buffer_dmat) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
- /* DMA tag for our mailboxes */
- if (bus_dma_tag_create(aha->parent_dmat, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- aha->num_boxes * (sizeof(aha_mbox_in_t)
- + sizeof(aha_mbox_out_t)),
- /*nsegments*/1,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_24BIT,
- /*flags*/0, &aha->mailbox_dmat) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
-
- /* Allocation for our mailboxes */
- if (bus_dmamem_alloc(aha->mailbox_dmat, (void *)&aha->out_boxes,
- BUS_DMA_NOWAIT, &aha->mailbox_dmamap) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
-
- /* And permanently map them */
- bus_dmamap_load(aha->mailbox_dmat, aha->mailbox_dmamap,
- aha->out_boxes,
- aha->num_boxes * (sizeof(aha_mbox_in_t)
- + sizeof(aha_mbox_out_t)),
- ahamapmboxes, aha, /*flags*/0);
-
- aha->init_level++;
-
- aha->in_boxes = (aha_mbox_in_t *)&aha->out_boxes[aha->num_boxes];
-
- ahainitmboxes(aha);
-
- /* DMA tag for our ccb structures */
- if (bus_dma_tag_create(aha->parent_dmat, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- aha->max_ccbs * sizeof(struct aha_ccb),
- /*nsegments*/1,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_24BIT,
- /*flags*/0, &aha->ccb_dmat) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
-
- /* Allocation for our ccbs */
- if (bus_dmamem_alloc(aha->ccb_dmat, (void *)&aha->aha_ccb_array,
- BUS_DMA_NOWAIT, &aha->ccb_dmamap) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
-
- /* And permanently map them */
- bus_dmamap_load(aha->ccb_dmat, aha->ccb_dmamap,
- aha->aha_ccb_array,
- aha->max_ccbs * sizeof(struct aha_ccb),
- ahamapccbs, aha, /*flags*/0);
-
- aha->init_level++;
-
- /* DMA tag for our S/G structures. We allocate in page sized chunks */
- if (bus_dma_tag_create(aha->parent_dmat, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- PAGE_SIZE, /*nsegments*/1,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_24BIT,
- /*flags*/0, &aha->sg_dmat) != 0) {
- goto error_exit;
- }
-
- aha->init_level++;
-
- /* Perform initial CCB allocation */
- bzero(aha->aha_ccb_array, aha->max_ccbs * sizeof(struct aha_ccb));
- ahaallocccbs(aha);
-
- if (aha->num_ccbs == 0) {
- device_printf(aha->dev,
- "aha_init - Unable to allocate initial ccbs\n");
- goto error_exit;
- }
-
- /*
- * Note that we are going and return (to probe)
- */
- return 0;
-
-error_exit:
-
- return (ENXIO);
-}
-
-int
-aha_attach(struct aha_softc *aha)
-{
- int tagged_dev_openings;
- struct cam_devq *devq;
-
- /*
- * We don't do tagged queueing, since the aha cards don't
- * support it.
- */
- tagged_dev_openings = 0;
-
- /*
- * Create the device queue for our SIM.
- */
- devq = cam_simq_alloc(aha->max_ccbs - 1);
- if (devq == NULL)
- return (ENOMEM);
-
- /*
- * Construct our SIM entry
- */
- aha->sim = cam_sim_alloc(ahaaction, ahapoll, "aha", aha, device_get_unit(aha->dev),
- &sim_mplock, 2, tagged_dev_openings, devq);
- cam_simq_release(devq);
- if (aha->sim == NULL) {
- return (ENOMEM);
- }
-
- if (xpt_bus_register(aha->sim, 0) != CAM_SUCCESS) {
- cam_sim_free(aha->sim);
- return (ENXIO);
- }
-
- if (xpt_create_path(&aha->path, /*periph*/NULL,
- cam_sim_path(aha->sim), CAM_TARGET_WILDCARD,
- CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- xpt_bus_deregister(cam_sim_path(aha->sim));
- cam_sim_free(aha->sim);
- return (ENXIO);
- }
-
- return (0);
-}
-
-void
-aha_find_probe_range(int ioport, int *port_index, int *max_port_index)
-{
- if (ioport > 0) {
- int i;
-
- for (i = 0;i < AHA_NUM_ISAPORTS; i++)
- if (ioport <= aha_isa_ports[i].addr)
- break;
- if ((i >= AHA_NUM_ISAPORTS)
- || (ioport != aha_isa_ports[i].addr)) {
- kprintf("\n"
-"aha_isa_probe: Invalid baseport of 0x%x specified.\n"
-"aha_isa_probe: Nearest valid baseport is 0x%x.\n"
-"aha_isa_probe: Failing probe.\n",
- ioport,
- (i < AHA_NUM_ISAPORTS)
- ? aha_isa_ports[i].addr
- : aha_isa_ports[AHA_NUM_ISAPORTS - 1].addr);
- *port_index = *max_port_index = -1;
- return;
- }
- *port_index = *max_port_index = aha_isa_ports[i].bio;
- } else {
- *port_index = 0;
- *max_port_index = AHA_NUM_ISAPORTS - 1;
- }
-}
-
-int
-aha_iop_from_bio(isa_compat_io_t bio_index)
-{
- if (bio_index >= 0 && bio_index < AHA_NUM_ISAPORTS)
- return (aha_board_ports[bio_index]);
- return (-1);
-}
-
-static void
-ahaallocccbs(struct aha_softc *aha)
-{
- struct aha_ccb *next_ccb;
- struct sg_map_node *sg_map;
- bus_addr_t physaddr;
- aha_sg_t *segs;
- int newcount;
- int i;
-
- next_ccb = &aha->aha_ccb_array[aha->num_ccbs];
-
- sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT);
-
- /* Allocate S/G space for the next batch of CCBS */
- if (bus_dmamem_alloc(aha->sg_dmat, (void *)&sg_map->sg_vaddr,
- BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) {
- kfree(sg_map, M_DEVBUF);
- return;
- }
-
- SLIST_INSERT_HEAD(&aha->sg_maps, sg_map, links);
-
- bus_dmamap_load(aha->sg_dmat, sg_map->sg_dmamap, sg_map->sg_vaddr,
- PAGE_SIZE, ahamapsgs, aha, /*flags*/0);
-
- segs = sg_map->sg_vaddr;
- physaddr = sg_map->sg_physaddr;
-
- newcount = (PAGE_SIZE / (AHA_NSEG * sizeof(aha_sg_t)));
- for (i = 0; aha->num_ccbs < aha->max_ccbs && i < newcount; i++) {
- int error;
-
- next_ccb->sg_list = segs;
- next_ccb->sg_list_phys = physaddr;
- next_ccb->flags = ACCB_FREE;
- error = bus_dmamap_create(aha->buffer_dmat, /*flags*/0,
- &next_ccb->dmamap);
- if (error != 0)
- break;
- SLIST_INSERT_HEAD(&aha->free_aha_ccbs, next_ccb, links);
- segs += AHA_NSEG;
- physaddr += (AHA_NSEG * sizeof(aha_sg_t));
- next_ccb++;
- aha->num_ccbs++;
- }
-
- /* Reserve a CCB for error recovery */
- if (aha->recovery_accb == NULL) {
- aha->recovery_accb = SLIST_FIRST(&aha->free_aha_ccbs);
- SLIST_REMOVE_HEAD(&aha->free_aha_ccbs, links);
- }
-}
-
-static __inline void
-ahafreeccb(struct aha_softc *aha, struct aha_ccb *accb)
-{
- crit_enter();
- if ((accb->flags & ACCB_ACTIVE) != 0)
- LIST_REMOVE(&accb->ccb->ccb_h, sim_links.le);
- if (aha->resource_shortage != 0
- && (accb->ccb->ccb_h.status & CAM_RELEASE_SIMQ) == 0) {
- accb->ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
- aha->resource_shortage = FALSE;
- }
- accb->flags = ACCB_FREE;
- SLIST_INSERT_HEAD(&aha->free_aha_ccbs, accb, links);
- aha->active_ccbs--;
- crit_exit();
-}
-
-static struct aha_ccb*
-ahagetccb(struct aha_softc *aha)
-{
- struct aha_ccb* accb;
-
- crit_enter();
- if ((accb = SLIST_FIRST(&aha->free_aha_ccbs)) != NULL) {
- SLIST_REMOVE_HEAD(&aha->free_aha_ccbs, links);
- aha->active_ccbs++;
- } else if (aha->num_ccbs < aha->max_ccbs) {
- ahaallocccbs(aha);
- accb = SLIST_FIRST(&aha->free_aha_ccbs);
- if (accb == NULL)
- device_printf(aha->dev, "Can't malloc ACCB\n");
- else {
- SLIST_REMOVE_HEAD(&aha->free_aha_ccbs, links);
- aha->active_ccbs++;
- }
- }
- crit_exit();
-
- return (accb);
-}
-
-static void
-ahaaction(struct cam_sim *sim, union ccb *ccb)
-{
- struct aha_softc *aha;
-
- CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahaaction\n"));
-
- aha = (struct aha_softc *)cam_sim_softc(sim);
-
- switch (ccb->ccb_h.func_code) {
- /* Common cases first */
- case XPT_SCSI_IO: /* Execute the requested I/O operation */
- case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */
- {
- struct aha_ccb *accb;
- struct aha_hccb *hccb;
-
- /*
- * get a accb to use.
- */
- if ((accb = ahagetccb(aha)) == NULL) {
- crit_enter();
- aha->resource_shortage = TRUE;
- crit_exit();
- xpt_freeze_simq(aha->sim, /*count*/1);
- ccb->ccb_h.status = CAM_REQUEUE_REQ;
- xpt_done(ccb);
- return;
- }
-
- hccb = &accb->hccb;
-
- /*
- * So we can find the ACCB when an abort is requested
- */
- accb->ccb = ccb;
- ccb->ccb_h.ccb_accb_ptr = accb;
- ccb->ccb_h.ccb_aha_ptr = aha;
-
- /*
- * Put all the arguments for the xfer in the accb
- */
- hccb->target = ccb->ccb_h.target_id;
- hccb->lun = ccb->ccb_h.target_lun;
- hccb->ahastat = 0;
- hccb->sdstat = 0;
-
- if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
- struct ccb_scsiio *csio;
- struct ccb_hdr *ccbh;
-
- csio = &ccb->csio;
- ccbh = &csio->ccb_h;
- hccb->opcode = aha->ccb_ccb_opcode;
- hccb->datain = (ccb->ccb_h.flags & CAM_DIR_IN) != 0;
- hccb->dataout = (ccb->ccb_h.flags & CAM_DIR_OUT) != 0;
- hccb->cmd_len = csio->cdb_len;
- if (hccb->cmd_len > sizeof(hccb->scsi_cdb)) {
- ccb->ccb_h.status = CAM_REQ_INVALID;
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- return;
- }
- hccb->sense_len = csio->sense_len;
- if ((ccbh->flags & CAM_CDB_POINTER) != 0) {
- if ((ccbh->flags & CAM_CDB_PHYS) == 0) {
- bcopy(csio->cdb_io.cdb_ptr,
- hccb->scsi_cdb, hccb->cmd_len);
- } else {
- /* I guess I could map it in... */
- ccbh->status = CAM_REQ_INVALID;
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- return;
- }
- } else {
- bcopy(csio->cdb_io.cdb_bytes,
- hccb->scsi_cdb, hccb->cmd_len);
- }
- /*
- * If we have any data to send with this command,
- * map it into bus space.
- */
- /* Only use S/G if there is a transfer */
- if ((ccbh->flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
- if ((ccbh->flags & CAM_SCATTER_VALID) == 0) {
- /*
- * We've been given a pointer
- * to a single buffer.
- */
- if ((ccbh->flags & CAM_DATA_PHYS)==0) {
- int error;
-
- crit_enter();
- error = bus_dmamap_load(
- aha->buffer_dmat,
- accb->dmamap,
- csio->data_ptr,
- csio->dxfer_len,
- ahaexecuteccb,
- accb,
- /*flags*/0);
- if (error == EINPROGRESS) {
- /*
- * So as to maintain
- * ordering, freeze the
- * controller queue
- * until our mapping is
- * returned.
- */
- xpt_freeze_simq(aha->sim,
- 1);
- csio->ccb_h.status |=
- CAM_RELEASE_SIMQ;
- }
- crit_exit();
- } else {
- struct bus_dma_segment seg;
-
- /* Pointer to physical buffer */
- seg.ds_addr =
- (bus_addr_t)csio->data_ptr;
- seg.ds_len = csio->dxfer_len;
- ahaexecuteccb(accb, &seg, 1, 0);
- }
- } else {
- struct bus_dma_segment *segs;
-
- if ((ccbh->flags & CAM_DATA_PHYS) != 0)
- panic("ahaaction - Physical "
- "segment pointers "
- "unsupported");
-
- if ((ccbh->flags&CAM_SG_LIST_PHYS)==0)
- panic("ahaaction - Virtual "
- "segment addresses "
- "unsupported");
-
- /* Just use the segments provided */
- segs = (struct bus_dma_segment *)
- csio->data_ptr;
- ahaexecuteccb(accb, segs,
- csio->sglist_cnt, 0);
- }
- } else {
- ahaexecuteccb(accb, NULL, 0, 0);
- }
- } else {
- hccb->opcode = INITIATOR_BUS_DEV_RESET;
- /* No data transfer */
- hccb->datain = TRUE;
- hccb->dataout = TRUE;
- hccb->cmd_len = 0;
- hccb->sense_len = 0;
- ahaexecuteccb(accb, NULL, 0, 0);
- }
- break;
- }
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
- case XPT_ABORT: /* Abort the specified CCB */
- /* XXX Implement */
- ccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(ccb);
- break;
- case XPT_SET_TRAN_SETTINGS:
- {
- /* XXX Implement */
- ccb->ccb_h.status = CAM_PROVIDE_FAIL;
- xpt_done(ccb);
- break;
- }
- case XPT_GET_TRAN_SETTINGS:
- /* Get default/user set transfer settings for the target */
- {
- struct ccb_trans_settings *cts = &ccb->cts;
- u_int target_mask = 0x01 << ccb->ccb_h.target_id;
- struct ccb_trans_settings_scsi *scsi =
- &cts->proto_specific.scsi;
- struct ccb_trans_settings_spi *spi =
- &cts->xport_specific.spi;
-
- cts->protocol = PROTO_SCSI;
- cts->protocol_version = SCSI_REV_2;
- cts->transport = XPORT_SPI;
- cts->transport_version = 2;
- if (cts->type == CTS_TYPE_USER_SETTINGS) {
- spi->flags = 0;
- if ((aha->disc_permitted & target_mask) != 0)
- spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
- spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
- if ((aha->sync_permitted & target_mask) != 0) {
- if (aha->boardid >= BOARD_1542CF)
- spi->sync_period = 25;
- else
- spi->sync_period = 50;
- } else {
- spi->sync_period = 0;
- }
-
- if (spi->sync_period != 0)
- spi->sync_offset = 15;
-
- spi->valid = CTS_SPI_VALID_SYNC_RATE
- | CTS_SPI_VALID_SYNC_OFFSET
- | CTS_SPI_VALID_BUS_WIDTH
- | CTS_SPI_VALID_DISC;
- scsi->valid = CTS_SCSI_VALID_TQ;
- } else {
- ahafetchtransinfo(aha, cts);
- }
-
- ccb->ccb_h.status = CAM_REQ_CMP;
- xpt_done(ccb);
- break;
- }
- case XPT_CALC_GEOMETRY:
- {
- struct ccb_calc_geometry *ccg;
- u_int32_t size_mb;
- u_int32_t secs_per_cylinder;
-
- ccg = &ccb->ccg;
- size_mb = ccg->volume_size
- / ((1024L * 1024L) / ccg->block_size);
-
- if (size_mb >= 1024 && (aha->extended_trans != 0)) {
- if (size_mb >= 2048) {
- ccg->heads = 255;
- ccg->secs_per_track = 63;
- } else {
- ccg->heads = 128;
- ccg->secs_per_track = 32;
- }
- } else {
- ccg->heads = 64;
- ccg->secs_per_track = 32;
- }
- secs_per_cylinder = ccg->heads * ccg->secs_per_track;
- ccg->cylinders = ccg->volume_size / secs_per_cylinder;
- ccb->ccb_h.status = CAM_REQ_CMP;
- xpt_done(ccb);
- break;
- }
- case XPT_RESET_BUS: /* Reset the specified SCSI bus */
- {
- ahareset(aha, /*hardreset*/TRUE);
- ccb->ccb_h.status = CAM_REQ_CMP;
- xpt_done(ccb);
- break;
- }
- case XPT_TERM_IO: /* Terminate the I/O process */
- /* XXX Implement */
- ccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(ccb);
- break;
- case XPT_PATH_INQ: /* Path routing inquiry */
- {
- struct ccb_pathinq *cpi = &ccb->cpi;
-
- cpi->version_num = 1; /* XXX??? */
- cpi->hba_inquiry = PI_SDTR_ABLE;
- cpi->target_sprt = 0;
- cpi->hba_misc = 0;
- cpi->hba_eng_cnt = 0;
- cpi->max_target = 7;
- cpi->max_lun = 7;
- cpi->initiator_id = aha->scsi_id;
- cpi->bus_id = cam_sim_bus(sim);
- cpi->base_transfer_speed = 3300;
- strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
- strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
- strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
- cpi->unit_number = cam_sim_unit(sim);
- cpi->transport = XPORT_SPI;
- cpi->transport_version = 2;
- cpi->protocol = PROTO_SCSI;
- cpi->protocol_version = SCSI_REV_2;
- cpi->ccb_h.status = CAM_REQ_CMP;
- xpt_done(ccb);
- break;
- }
- default:
- ccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(ccb);
- break;
- }
-}
-
-static void
-ahaexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
-{
- struct aha_ccb *accb;
- union ccb *ccb;
- struct aha_softc *aha;
- u_int32_t paddr;
-
- accb = (struct aha_ccb *)arg;
- ccb = accb->ccb;
- aha = (struct aha_softc *)ccb->ccb_h.ccb_aha_ptr;
-
- if (error != 0) {
- if (error != EFBIG)
- device_printf(aha->dev,
- "Unexpected error 0x%x returned from "
- "bus_dmamap_load\n", error);
- if (ccb->ccb_h.status == CAM_REQ_INPROG) {
- xpt_freeze_devq(ccb->ccb_h.path, /*count*/1);
- ccb->ccb_h.status = CAM_REQ_TOO_BIG|CAM_DEV_QFRZN;
- }
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- return;
- }
-
- if (nseg != 0) {
- aha_sg_t *sg;
- bus_dma_segment_t *end_seg;
- bus_dmasync_op_t op;
-
- end_seg = dm_segs + nseg;
-
- /* Copy the segments into our SG list */
- sg = accb->sg_list;
- while (dm_segs < end_seg) {
- ahautoa24(dm_segs->ds_len, sg->len);
- ahautoa24(dm_segs->ds_addr, sg->addr);
- sg++;
- dm_segs++;
- }
-
- if (nseg > 1) {
- accb->hccb.opcode = aha->ccb_sg_opcode;
- ahautoa24((sizeof(aha_sg_t) * nseg),
- accb->hccb.data_len);
- ahautoa24(accb->sg_list_phys, accb->hccb.data_addr);
- } else {
- bcopy(accb->sg_list->len, accb->hccb.data_len, 3);
- bcopy(accb->sg_list->addr, accb->hccb.data_addr, 3);
- }
-
- if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
- op = BUS_DMASYNC_PREREAD;
- else
- op = BUS_DMASYNC_PREWRITE;
-
- bus_dmamap_sync(aha->buffer_dmat, accb->dmamap, op);
-
- } else {
- accb->hccb.opcode = INITIATOR_CCB;
- ahautoa24(0, accb->hccb.data_len);
- ahautoa24(0, accb->hccb.data_addr);
- }
-
- crit_enter();
-
- /*
- * Last time we need to check if this CCB needs to
- * be aborted.
- */
- if (ccb->ccb_h.status != CAM_REQ_INPROG) {
- if (nseg != 0)
- bus_dmamap_unload(aha->buffer_dmat, accb->dmamap);
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- crit_exit();
- return;
- }
-
- accb->flags = ACCB_ACTIVE;
- ccb->ccb_h.status |= CAM_SIM_QUEUED;
- LIST_INSERT_HEAD(&aha->pending_ccbs, &ccb->ccb_h, sim_links.le);
-
- callout_reset(&ccb->ccb_h.timeout_ch, (ccb->ccb_h.timeout * hz) / 1000,
- ahatimeout, accb);
-
- /* Tell the adapter about this command */
- if (aha->cur_outbox->action_code != AMBO_FREE) {
- /*
- * We should never encounter a busy mailbox.
- * If we do, warn the user, and treat it as
- * a resource shortage. If the controller is
- * hung, one of the pending transactions will
- * timeout causing us to start recovery operations.
- */
- device_printf(aha->dev,
- "Encountered busy mailbox with %d out of %d "
- "commands active!!!", aha->active_ccbs, aha->max_ccbs);
- callout_stop(&ccb->ccb_h.timeout_ch);
- if (nseg != 0)
- bus_dmamap_unload(aha->buffer_dmat, accb->dmamap);
- ahafreeccb(aha, accb);
- aha->resource_shortage = TRUE;
- xpt_freeze_simq(aha->sim, /*count*/1);
- ccb->ccb_h.status = CAM_REQUEUE_REQ;
- xpt_done(ccb);
- crit_exit();
- return;
- }
- paddr = ahaccbvtop(aha, accb);
- ahautoa24(paddr, aha->cur_outbox->ccb_addr);
- aha->cur_outbox->action_code = AMBO_START;
- aha_outb(aha, COMMAND_REG, AOP_START_MBOX);
-
- ahanextoutbox(aha);
- crit_exit();
-}
-
-void
-aha_intr(void *arg)
-{
- struct aha_softc *aha;
- u_int intstat;
-
- aha = (struct aha_softc *)arg;
- while (((intstat = aha_inb(aha, INTSTAT_REG)) & INTR_PENDING) != 0) {
- if ((intstat & CMD_COMPLETE) != 0) {
- aha->latched_status = aha_inb(aha, STATUS_REG);
- aha->command_cmp = TRUE;
- }
-
- aha_outb(aha, CONTROL_REG, RESET_INTR);
-
- if ((intstat & IMB_LOADED) != 0) {
- while (aha->cur_inbox->comp_code != AMBI_FREE) {
- u_int32_t paddr;
- paddr = aha_a24tou(aha->cur_inbox->ccb_addr);
- ahadone(aha,
- ahaccbptov(aha, paddr),
- aha->cur_inbox->comp_code);
- aha->cur_inbox->comp_code = AMBI_FREE;
- ahanextinbox(aha);
- }
- }
-
- if ((intstat & SCSI_BUS_RESET) != 0) {
- ahareset(aha, /*hardreset*/FALSE);
- }
- }
-}
-
-static void
-ahadone(struct aha_softc *aha, struct aha_ccb *accb, aha_mbi_comp_code_t comp_code)
-{
- union ccb *ccb;
- struct ccb_scsiio *csio;
-
- ccb = accb->ccb;
- csio = &accb->ccb->csio;
-
- if ((accb->flags & ACCB_ACTIVE) == 0) {
- device_printf(aha->dev,
- "ahadone - Attempt to free non-active ACCB %p\n",
- (void *)accb);
- return;
- }
-
- if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
- bus_dmasync_op_t op;
-
- if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
- op = BUS_DMASYNC_POSTREAD;
- else
- op = BUS_DMASYNC_POSTWRITE;
- bus_dmamap_sync(aha->buffer_dmat, accb->dmamap, op);
- bus_dmamap_unload(aha->buffer_dmat, accb->dmamap);
- }
-
- if (accb == aha->recovery_accb) {
- /*
- * The recovery ACCB does not have a CCB associated
- * with it, so short circuit the normal error handling.
- * We now traverse our list of pending CCBs and process
- * any that were terminated by the recovery CCBs action.
- * We also reinstate timeouts for all remaining, pending,
- * CCBs.
- */
- struct cam_path *path;
- struct ccb_hdr *ccb_h;
- cam_status error;
-
- /* Notify all clients that a BDR occured */
- error = xpt_create_path(&path, /*periph*/NULL,
- cam_sim_path(aha->sim),
- accb->hccb.target,
- CAM_LUN_WILDCARD);
-
- if (error == CAM_REQ_CMP)
- xpt_async(AC_SENT_BDR, path, NULL);
-
- ccb_h = LIST_FIRST(&aha->pending_ccbs);
- while (ccb_h != NULL) {
- struct aha_ccb *pending_accb;
-
- pending_accb = (struct aha_ccb *)ccb_h->ccb_accb_ptr;
- if (pending_accb->hccb.target == accb->hccb.target) {
- pending_accb->hccb.ahastat = AHASTAT_HA_BDR;
- ccb_h = LIST_NEXT(ccb_h, sim_links.le);
- ahadone(aha, pending_accb, AMBI_ERROR);
- } else {
- callout_reset(&ccb_h->timeout_ch,
- (ccb_h->timeout * hz) / 1000,
- ahatimeout, pending_accb);
- ccb_h = LIST_NEXT(ccb_h, sim_links.le);
- }
- }
- device_printf(aha->dev, "No longer in timeout\n");
- return;
- }
-
- callout_stop(&ccb->ccb_h.timeout_ch);
-
- switch (comp_code) {
- case AMBI_FREE:
- device_printf(aha->dev,
- "ahadone - CCB completed with free status!\n");
- break;
- case AMBI_NOT_FOUND:
- device_printf(aha->dev,
- "ahadone - CCB Abort failed to find CCB\n");
- break;
- case AMBI_ABORT:
- case AMBI_ERROR:
- /* An error occured */
- if (accb->hccb.opcode < INITIATOR_CCB_WRESID)
- csio->resid = 0;
- else
- csio->resid = aha_a24tou(accb->hccb.data_len);
- switch(accb->hccb.ahastat) {
- case AHASTAT_DATARUN_ERROR:
- {
- if (csio->resid <= 0) {
- csio->ccb_h.status = CAM_DATA_RUN_ERR;
- break;
- }
- /* FALLTHROUGH */
- }
- case AHASTAT_NOERROR:
- csio->scsi_status = accb->hccb.sdstat;
- csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR;
- switch(csio->scsi_status) {
- case SCSI_STATUS_CHECK_COND:
- case SCSI_STATUS_CMD_TERMINATED:
- csio->ccb_h.status |= CAM_AUTOSNS_VALID;
- /*
- * The aha writes the sense data at different
- * offsets based on the scsi cmd len
- */
- bcopy((caddr_t) &accb->hccb.scsi_cdb +
- accb->hccb.cmd_len,
- (caddr_t) &csio->sense_data,
- accb->hccb.sense_len);
- break;
- default:
- break;
- case SCSI_STATUS_OK:
- csio->ccb_h.status = CAM_REQ_CMP;
- break;
- }
- break;
- case AHASTAT_SELTIMEOUT:
- csio->ccb_h.status = CAM_SEL_TIMEOUT;
- break;
- case AHASTAT_UNEXPECTED_BUSFREE:
- csio->ccb_h.status = CAM_UNEXP_BUSFREE;
- break;
- case AHASTAT_INVALID_PHASE:
- csio->ccb_h.status = CAM_SEQUENCE_FAIL;
- break;
- case AHASTAT_INVALID_ACTION_CODE:
- panic("%s: Inavlid Action code", aha_name(aha));
- break;
- case AHASTAT_INVALID_OPCODE:
- if (accb->hccb.opcode < INITIATOR_CCB_WRESID)
- panic("%s: Invalid CCB Opcode %x hccb = %p",
- aha_name(aha), accb->hccb.opcode,
- &accb->hccb);
- device_printf(aha->dev,
- "AHA-1540A detected, compensating\n");
- aha->ccb_sg_opcode = INITIATOR_SG_CCB;
- aha->ccb_ccb_opcode = INITIATOR_CCB;
- xpt_freeze_devq(ccb->ccb_h.path, /*count*/1);
- csio->ccb_h.status = CAM_REQUEUE_REQ;
- break;
- case AHASTAT_LINKED_CCB_LUN_MISMATCH:
- /* We don't even support linked commands... */
- panic("%s: Linked CCB Lun Mismatch", aha_name(aha));
- break;
- case AHASTAT_INVALID_CCB_OR_SG_PARAM:
- panic("%s: Invalid CCB or SG list", aha_name(aha));
- break;
- case AHASTAT_HA_SCSI_BUS_RESET:
- if ((csio->ccb_h.status & CAM_STATUS_MASK)
- != CAM_CMD_TIMEOUT)
- csio->ccb_h.status = CAM_SCSI_BUS_RESET;
- break;
- case AHASTAT_HA_BDR:
- if ((accb->flags & ACCB_DEVICE_RESET) == 0)
- csio->ccb_h.status = CAM_BDR_SENT;
- else
- csio->ccb_h.status = CAM_CMD_TIMEOUT;
- break;
- }
- if (csio->ccb_h.status != CAM_REQ_CMP) {
- xpt_freeze_devq(csio->ccb_h.path, /*count*/1);
- csio->ccb_h.status |= CAM_DEV_QFRZN;
- }
- if ((accb->flags & ACCB_RELEASE_SIMQ) != 0)
- ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- break;
- case AMBI_OK:
- /* All completed without incident */
- /* XXX DO WE NEED TO COPY SENSE BYTES HERE???? XXX */
- /* I don't think so since it works???? */
- ccb->ccb_h.status |= CAM_REQ_CMP;
- if ((accb->flags & ACCB_RELEASE_SIMQ) != 0)
- ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
- ahafreeccb(aha, accb);
- xpt_done(ccb);
- break;
- }
-}
-
-static int
-ahareset(struct aha_softc* aha, int hard_reset)
-{
- struct ccb_hdr *ccb_h;
- u_int status;
- u_int timeout;
- u_int8_t reset_type;
-
- if (hard_reset != 0)
- reset_type = HARD_RESET;
- else
- reset_type = SOFT_RESET;
- aha_outb(aha, CONTROL_REG, reset_type);
-
- /* Wait 5sec. for Diagnostic start */
- timeout = 5 * 10000;
- while (--timeout) {
- status = aha_inb(aha, STATUS_REG);
- if ((status & DIAG_ACTIVE) != 0)
- break;
- DELAY(100);
- }
- if (timeout == 0) {
- PRVERB((aha->dev, "ahareset - Diagnostic Active failed to "
- "assert. status = 0x%x\n", status));
- return (ETIMEDOUT);
- }
-
- /* Wait 10sec. for Diagnostic end */
- timeout = 10 * 10000;
- while (--timeout) {
- status = aha_inb(aha, STATUS_REG);
- if ((status & DIAG_ACTIVE) == 0)
- break;
- DELAY(100);
- }
- if (timeout == 0) {
- panic("%s: ahareset - Diagnostic Active failed to drop. "
- "status = 0x%x\n", aha_name(aha), status);
- return (ETIMEDOUT);
- }
-
- /* Wait for the host adapter to become ready or report a failure */
- timeout = 10000;
- while (--timeout) {
- status = aha_inb(aha, STATUS_REG);
- if ((status & (DIAG_FAIL|HA_READY|DATAIN_REG_READY)) != 0)
- break;
- DELAY(100);
- }
- if (timeout == 0) {
- device_printf(aha->dev, "ahareset - Host adapter failed to "
- "come ready. status = 0x%x\n", status);
- return (ETIMEDOUT);
- }
-
- /* If the diagnostics failed, tell the user */
- if ((status & DIAG_FAIL) != 0
- || (status & HA_READY) == 0) {
- device_printf(aha->dev, "ahareset - Adapter failed diagnostics\n");
- if ((status & DATAIN_REG_READY) != 0)
- device_printf(aha->dev, "ahareset - Host Adapter "
- "Error code = 0x%x\n", aha_inb(aha, DATAIN_REG));
- return (ENXIO);
- }
-
- /* If we've allocated mailboxes, initialize them */
- if (aha->init_level > 4)
- ahainitmboxes(aha);
-
- /* If we've attached to the XPT, tell it about the event */
- if (aha->path != NULL)
- xpt_async(AC_BUS_RESET, aha->path, NULL);
-
- /*
- * Perform completion processing for all outstanding CCBs.
- */
- while ((ccb_h = LIST_FIRST(&aha->pending_ccbs)) != NULL) {
- struct aha_ccb *pending_accb;
-
- pending_accb = (struct aha_ccb *)ccb_h->ccb_accb_ptr;
- pending_accb->hccb.ahastat = AHASTAT_HA_SCSI_BUS_RESET;
- ahadone(aha, pending_accb, AMBI_ERROR);
- }
-
- return (0);
-}
-
-/*
- * Send a command to the adapter.
- */
-int
-aha_cmd(struct aha_softc *aha, aha_op_t opcode, u_int8_t *params,
- u_int param_len, u_int8_t *reply_data, u_int reply_len,
- u_int cmd_timeout)
-{
- u_int timeout;
- u_int status;
- u_int saved_status;
- u_int intstat;
- u_int reply_buf_size;
- int cmd_complete;
- int error;
-
- /* No data returned to start */
- reply_buf_size = reply_len;
- reply_len = 0;
- intstat = 0;
- cmd_complete = 0;
- saved_status = 0;
- error = 0;
-
- /*
- * All commands except for the "start mailbox" and the "enable
- * outgoing mailbox read interrupt" commands cannot be issued
- * while there are pending transactions. Freeze our SIMQ
- * and wait for all completions to occur if necessary.
- */
- timeout = 100000;
- crit_enter();
- while (LIST_FIRST(&aha->pending_ccbs) != NULL && --timeout) {
- /* Fire the interrupt handler in case interrupts are blocked */
- aha_intr(aha);
- crit_exit();
- DELAY(100);
- crit_enter();
- }
- crit_exit();
-
- if (timeout == 0) {
- device_printf(aha->dev, "aha_cmd: Timeout waiting for adapter idle\n");
- return (ETIMEDOUT);
- }
- aha->command_cmp = 0;
- /*
- * Wait up to 10 sec. for the adapter to become
- * ready to accept commands.
- */
- timeout = 100000;
- while (--timeout) {
-
- status = aha_inb(aha, STATUS_REG);
- if ((status & HA_READY) != 0
- && (status & CMD_REG_BUSY) == 0)
- break;
- /*
- * Throw away any pending data which may be
- * left over from earlier commands that we
- * timedout on.
- */
- if ((status & DATAIN_REG_READY) != 0)
- (void)aha_inb(aha, DATAIN_REG);
- DELAY(100);
- }
- if (timeout == 0) {
- device_printf(aha->dev, "aha_cmd: Timeout waiting for adapter "
- "ready, status = 0x%x\n", status);
- return (ETIMEDOUT);
- }
-
- /*
- * Send the opcode followed by any necessary parameter bytes.
- */
- aha_outb(aha, COMMAND_REG, opcode);
-
- /*
- * Wait for up to 1sec to get the parameter list sent
- */
- timeout = 10000;
- while (param_len && --timeout) {
- DELAY(100);
- crit_enter();
- status = aha_inb(aha, STATUS_REG);
- intstat = aha_inb(aha, INTSTAT_REG);
- crit_exit();
-
- if ((intstat & (INTR_PENDING|CMD_COMPLETE))
- == (INTR_PENDING|CMD_COMPLETE)) {
- saved_status = status;
- cmd_complete = 1;
- break;
- }
-
- if (aha->command_cmp != 0) {
- saved_status = aha->latched_status;
- cmd_complete = 1;
- break;
- }
- if ((status & DATAIN_REG_READY) != 0)
- break;
- if ((status & CMD_REG_BUSY) == 0) {
- aha_outb(aha, COMMAND_REG, *params++);
- param_len--;
- timeout = 10000;
- }
- }
- if (timeout == 0) {
- device_printf(aha->dev, "aha_cmd: Timeout sending parameters, "
- "status = 0x%x\n", status);
- error = ETIMEDOUT;
- }
-
- /*
- * For all other commands, we wait for any output data
- * and the final comand completion interrupt.
- */
- while (cmd_complete == 0 && --cmd_timeout) {
-
- crit_enter();
- status = aha_inb(aha, STATUS_REG);
- intstat = aha_inb(aha, INTSTAT_REG);
- crit_exit();
-
- if (aha->command_cmp != 0) {
- cmd_complete = 1;
- saved_status = aha->latched_status;
- } else if ((intstat & (INTR_PENDING|CMD_COMPLETE))
- == (INTR_PENDING|CMD_COMPLETE)) {
- /*
- * Our poll (in case interrupts are blocked)
- * saw the CMD_COMPLETE interrupt.
- */
- cmd_complete = 1;
- saved_status = status;
- }
- if ((status & DATAIN_REG_READY) != 0) {
- u_int8_t data;
-
- data = aha_inb(aha, DATAIN_REG);
- if (reply_len < reply_buf_size) {
- *reply_data++ = data;
- } else {
- device_printf(aha->dev, "aha_cmd - Discarded reply data "
- "byte for opcode 0x%x\n", opcode);
- }
- /*
- * Reset timeout to ensure at least a second
- * between response bytes.
- */
- cmd_timeout = MAX(cmd_timeout, 10000);
- reply_len++;
- }
- DELAY(100);
- }
- if (cmd_timeout == 0) {
- device_printf(aha->dev, "aha_cmd: Timeout: status = 0x%x, "
- "intstat = 0x%x, reply_len = %d\n", status, intstat,
- reply_len);
- return (ETIMEDOUT);
- }
-
- /*
- * Clear any pending interrupts. Block interrupts so our
- * interrupt handler is not re-entered.
- */
- crit_enter();
- aha_intr(aha);
- crit_exit();
-
- if (error != 0)
- return (error);
-
- /*
- * If the command was rejected by the controller, tell the caller.
- */
- if ((saved_status & CMD_INVALID) != 0) {
- PRVERB((aha->dev, "Invalid Command 0x%x\n", opcode));
- /*
- * Some early adapters may not recover properly from
- * an invalid command. If it appears that the controller
- * has wedged (i.e. status was not cleared by our interrupt
- * reset above), perform a soft reset.
- */
- DELAY(1000);
- status = aha_inb(aha, STATUS_REG);
- if ((status & (CMD_INVALID|STATUS_REG_RSVD|DATAIN_REG_READY|
- CMD_REG_BUSY|DIAG_FAIL|DIAG_ACTIVE)) != 0
- || (status & (HA_READY|INIT_REQUIRED))
- != (HA_READY|INIT_REQUIRED)) {
- ahareset(aha, /*hard_reset*/FALSE);
- }
- return (EINVAL);
- }
-
- if (param_len > 0) {
- /* The controller did not accept the full argument list */
- PRVERB((aha->dev, "Controller did not accept full argument "
- "list (%d > 0)\n", param_len));
- return (E2BIG);
- }
-
- if (reply_len != reply_buf_size) {
- /* Too much or too little data received */
- PRVERB((aha->dev,"data received mistmatch (%d != %d)\n",
- reply_len, reply_buf_size));
- return (EMSGSIZE);
- }
-
- /* We were successful */
- return (0);
-}
-
-static int
-ahainitmboxes(struct aha_softc *aha)
-{
- int error;
- init_24b_mbox_params_t init_mbox;
-
- bzero(aha->in_boxes, sizeof(aha_mbox_in_t) * aha->num_boxes);
- bzero(aha->out_boxes, sizeof(aha_mbox_out_t) * aha->num_boxes);
- aha->cur_inbox = aha->in_boxes;
- aha->last_inbox = aha->in_boxes + aha->num_boxes - 1;
- aha->cur_outbox = aha->out_boxes;
- aha->last_outbox = aha->out_boxes + aha->num_boxes - 1;
-
- /* Tell the adapter about them */
- init_mbox.num_mboxes = aha->num_boxes;
- ahautoa24(aha->mailbox_physbase, init_mbox.base_addr);
- error = aha_cmd(aha, AOP_INITIALIZE_MBOX, (u_int8_t *)&init_mbox,
- /*parmlen*/sizeof(init_mbox), /*reply_buf*/NULL,
- /*reply_len*/0, DEFAULT_CMD_TIMEOUT);
-
- if (error != 0)
- device_printf(aha->dev,
- "ahainitmboxes: Initialization command failed\n");
- return (error);
-}
-
-/*
- * Update the XPT's idea of the negotiated transfer
- * parameters for a particular target.
- */
-static void
-ahafetchtransinfo(struct aha_softc *aha, struct ccb_trans_settings* cts)
-{
- setup_data_t setup_info;
- u_int target;
- u_int targ_offset;
- u_int sync_period;
- int error;
- u_int8_t param;
- targ_syncinfo_t sync_info;
- struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi;
-
- target = cts->ccb_h.target_id;
- targ_offset = (target & 0x7);
-
- /*
- * Inquire Setup Information. This command retreives
- * the sync info for older models.
- */
- param = sizeof(setup_info);
- error = aha_cmd(aha, AOP_INQUIRE_SETUP_INFO, ¶m, /*paramlen*/1,
- (u_int8_t*)&setup_info, sizeof(setup_info),
- DEFAULT_CMD_TIMEOUT);
-
- if (error != 0) {
- device_printf(aha->dev,
- "ahafetchtransinfo - Inquire Setup Info Failed %d\n",
- error);
- return;
- }
-
- sync_info = setup_info.syncinfo[targ_offset];
-
- if (sync_info.sync == 0)
- spi->sync_offset = 0;
- else
- spi->sync_offset = sync_info.offset;
-
- spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
-
- if (aha->boardid >= BOARD_1542CF)
- sync_period = 1000;
- else
- sync_period = 2000;
- sync_period += 500 * sync_info.period;
-
- /* Convert ns value to standard SCSI sync rate */
- if (spi->sync_offset != 0)
- spi->sync_period = scsi_calc_syncparam(sync_period);
- else
- spi->sync_period = 0;
-
- spi->valid = CTS_SPI_VALID_SYNC_RATE
- | CTS_SPI_VALID_SYNC_OFFSET
- | CTS_SPI_VALID_BUS_WIDTH;
- xpt_async(AC_TRANSFER_NEG, cts->ccb_h.path, cts);
-}
-
-static void
-ahamapmboxes(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
- struct aha_softc* aha;
-
- aha = (struct aha_softc*)arg;
- aha->mailbox_physbase = segs->ds_addr;
-}
-
-static void
-ahamapccbs(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
- struct aha_softc* aha;
-
- aha = (struct aha_softc*)arg;
- aha->aha_ccb_physbase = segs->ds_addr;
-}
-
-static void
-ahamapsgs(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
-
- struct aha_softc* aha;
-
- aha = (struct aha_softc*)arg;
- SLIST_FIRST(&aha->sg_maps)->sg_physaddr = segs->ds_addr;
-}
-
-static void
-ahapoll(struct cam_sim *sim)
-{
- aha_intr(cam_sim_softc(sim));
-}
-
-static void
-ahatimeout(void *arg)
-{
- struct aha_ccb *accb;
- union ccb *ccb;
- struct aha_softc *aha;
- u_int32_t paddr;
-
- accb = (struct aha_ccb *)arg;
- ccb = accb->ccb;
- aha = (struct aha_softc *)ccb->ccb_h.ccb_aha_ptr;
- xpt_print_path(ccb->ccb_h.path);
- kprintf("CCB %p - timed out\n", (void *)accb);
-
- crit_enter();
-
- if ((accb->flags & ACCB_ACTIVE) == 0) {
- xpt_print_path(ccb->ccb_h.path);
- kprintf("CCB %p - timed out CCB already completed\n",
- (void *)accb);
- crit_exit();
- return;
- }
-
- /*
- * In order to simplify the recovery process, we ask the XPT
- * layer to halt the queue of new transactions and we traverse
- * the list of pending CCBs and remove their timeouts. This
- * means that the driver attempts to clear only one error
- * condition at a time. In general, timeouts that occur
- * close together are related anyway, so there is no benefit
- * in attempting to handle errors in parrallel. Timeouts will
- * be reinstated when the recovery process ends.
- */
- if ((accb->flags & ACCB_DEVICE_RESET) == 0) {
- struct ccb_hdr *ccb_h;
-
- if ((accb->flags & ACCB_RELEASE_SIMQ) == 0) {
- xpt_freeze_simq(aha->sim, /*count*/1);
- accb->flags |= ACCB_RELEASE_SIMQ;
- }
-
- ccb_h = LIST_FIRST(&aha->pending_ccbs);
- while (ccb_h != NULL) {
- struct aha_ccb *pending_accb;
-
- pending_accb = (struct aha_ccb *)ccb_h->ccb_accb_ptr;
- callout_stop(&ccb_h->timeout_ch);
- ccb_h = LIST_NEXT(ccb_h, sim_links.le);
- }
- }
-
- if ((accb->flags & ACCB_DEVICE_RESET) != 0
- || aha->cur_outbox->action_code != AMBO_FREE) {
- /*
- * Try a full host adapter/SCSI bus reset.
- * We do this only if we have already attempted
- * to clear the condition with a BDR, or we cannot
- * attempt a BDR for lack of mailbox resources.
- */
- ccb->ccb_h.status = CAM_CMD_TIMEOUT;
- ahareset(aha, /*hardreset*/TRUE);
- device_printf(aha->dev, "No longer in timeout\n");
- } else {
- /*
- * Send a Bus Device Reset message:
- * The target that is holding up the bus may not
- * be the same as the one that triggered this timeout
- * (different commands have different timeout lengths),
- * but we have no way of determining this from our
- * timeout handler. Our strategy here is to queue a
- * BDR message to the target of the timed out command.
- * If this fails, we'll get another timeout 2 seconds
- * later which will attempt a bus reset.
- */
- accb->flags |= ACCB_DEVICE_RESET;
- callout_reset(&ccb->ccb_h.timeout_ch, 2 * hz, ahatimeout, accb);
- aha->recovery_accb->hccb.opcode = INITIATOR_BUS_DEV_RESET;
-
- /* No Data Transfer */
- aha->recovery_accb->hccb.datain = TRUE;
- aha->recovery_accb->hccb.dataout = TRUE;
- aha->recovery_accb->hccb.ahastat = 0;
- aha->recovery_accb->hccb.sdstat = 0;
- aha->recovery_accb->hccb.target = ccb->ccb_h.target_id;
-
- /* Tell the adapter about this command */
- paddr = ahaccbvtop(aha, aha->recovery_accb);
- ahautoa24(paddr, aha->cur_outbox->ccb_addr);
- aha->cur_outbox->action_code = AMBO_START;
- aha_outb(aha, COMMAND_REG, AOP_START_MBOX);
- ahanextoutbox(aha);
- }
-
- crit_exit();
-}
-
-int
-aha_detach(struct aha_softc *aha)
-{
- xpt_async(AC_LOST_DEVICE, aha->path, NULL);
- xpt_free_path(aha->path);
- xpt_bus_deregister(cam_sim_path(aha->sim));
- cam_sim_free(aha->sim);
- return (0);
-}
+++ /dev/null
-/*
- * Product specific probe and attach routines for:
- * Adaptec 154x.
- *
- * Derived from code written by:
- *
- * Copyright (c) 1998 Justin T. Gibbs
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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: src/sys/dev/aha/aha_isa.c,v 1.17.2.1 2000/08/02 22:24:40 peter Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <bus/isa/isavar.h>
-
-#include "ahareg.h"
-
-#include <bus/cam/scsi/scsi_all.h>
-
-static struct isa_pnp_id aha_ids[] = {
- {ADP0100_PNP, "Adaptec 1540/1542 ISA SCSI"}, /* ADP0100 */
- {AHA1540_PNP, "Adaptec 1540/aha-1640/aha-1535"},/* ADP1542 */
- {AHA1542_PNP, "Adaptec 1542/aha-1535"}, /* ADP1542 */
- {AHA1542_PNPCOMPAT, "Adaptec 1542 compatible"}, /* PNP00A0 */
- {ICU0091_PNP, "Adaptec AHA-1540/1542 SCSI"}, /* ICU0091 */
- {0}
-};
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c
- */
-static int
-aha_isa_probe(device_t dev)
-{
- /*
- * find unit and check we have that many defined
- */
- struct aha_softc **sc = device_get_softc(dev);
- struct aha_softc *aha;
- int port_index;
- int max_port_index;
- int error;
- u_long port_start, port_count;
- struct resource *port_res;
- int port_rid;
- int drq;
- int irq;
-
- aha = NULL;
-
- /* Check isapnp ids */
- if (ISA_PNP_PROBE(device_get_parent(dev), dev, aha_ids) == ENXIO)
- return (ENXIO);
-
- error = bus_get_resource(dev, SYS_RES_IOPORT, 0,
- &port_start, &port_count);
- if (error != 0)
- port_start = 0;
-
- /*
- * Bound our board search if the user has
- * specified an exact port.
- */
- aha_find_probe_range(port_start, &port_index, &max_port_index);
-
- if (port_index < 0)
- return ENXIO;
-
- /* Attempt to find an adapter */
- for (;port_index <= max_port_index; port_index++) {
- config_data_t config_data;
- u_int ioport;
- int error;
-
- ioport = aha_iop_from_bio(port_index);
-
- error = bus_set_resource(dev, SYS_RES_IOPORT, 0,
- ioport, AHA_NREGS);
- if (error)
- return error;
-
- port_rid = 0;
- port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid,
- 0, ~0, AHA_NREGS, RF_ACTIVE);
- if (!port_res)
- continue;
-
- /* Allocate a softc for use during probing */
- aha = aha_alloc(dev, rman_get_bustag(port_res),
- rman_get_bushandle(port_res));
-
- if (aha == NULL) {
- bus_release_resource(dev, SYS_RES_IOPORT, port_rid,
- port_res);
- break;
- }
-
- /* See if there is really a card present */
- if (aha_probe(aha) || aha_fetch_adapter_info(aha)) {
- aha_free(aha);
- bus_release_resource(dev, SYS_RES_IOPORT, port_rid,
- port_res);
- continue;
- }
-
- /*
- * Determine our IRQ, and DMA settings and
- * export them to the configuration system.
- */
- error = aha_cmd(aha, AOP_INQUIRE_CONFIG, NULL, /*parmlen*/0,
- (u_int8_t*)&config_data, sizeof(config_data),
- DEFAULT_CMD_TIMEOUT);
-
- if (error != 0) {
- kprintf("aha_isa_probe: Could not determine IRQ or DMA "
- "settings for adapter at 0x%x. Failing probe\n",
- ioport);
- aha_free(aha);
- bus_release_resource(dev, SYS_RES_IOPORT, port_rid,
- port_res);
- continue;
- }
-
- bus_release_resource(dev, SYS_RES_IOPORT, port_rid, port_res);
-
- switch (config_data.dma_chan) {
- case DMA_CHAN_5:
- drq = 5;
- break;
- case DMA_CHAN_6:
- drq = 6;
- break;
- case DMA_CHAN_7:
- drq = 7;
- break;
- default:
- kprintf("aha_isa_probe: Invalid DMA setting "
- "detected for adapter at 0x%x. "
- "Failing probe\n", ioport);
- return (ENXIO);
- }
- error = bus_set_resource(dev, SYS_RES_DRQ, 0, drq, 1);
- if (error)
- return error;
-
- irq = ffs(config_data.irq) + 8;
- error = bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1);
- if (error)
- return error;
-
- *sc = aha;
- aha_unit++;
-
- return (0);
- }
-
- return (ENXIO);
-}
-
-/*
- * Attach all the sub-devices we can find
- */
-static int
-aha_isa_attach(device_t dev)
-{
- struct aha_softc **sc = device_get_softc(dev);
- struct aha_softc *aha;
- bus_dma_filter_t *filter;
- void *filter_arg;
- bus_addr_t lowaddr;
- void *ih;
- int error;
-
- aha = *sc;
- aha->dev = dev;
- aha->portrid = 0;
- aha->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &aha->portrid,
- 0, ~0, AHA_NREGS, RF_ACTIVE);
- if (!aha->port) {
- device_printf(dev, "Unable to allocate I/O ports\n");
- return ENOMEM;
- }
-
- aha->irqrid = 0;
- aha->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &aha->irqrid, 0, ~0, 1,
- RF_ACTIVE);
- if (!aha->irq) {
- device_printf(dev, "Unable to allocate excluse use of irq\n");
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- return ENOMEM;
- }
-
- aha->drqrid = 0;
- aha->drq = bus_alloc_resource(dev, SYS_RES_DRQ, &aha->drqrid, 0, ~0, 1,
- RF_ACTIVE);
- if (!aha->drq) {
- device_printf(dev, "Unable to allocate drq\n");
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- return ENOMEM;
- }
-
-#if 0 /* is the drq ever unset? */
- if (dev->id_drq != -1)
- isa_dmacascade(dev->id_drq);
-#endif
- isa_dmacascade(rman_get_start(aha->drq));
-
- /* Allocate our parent dmatag */
- filter = NULL;
- filter_arg = NULL;
- lowaddr = BUS_SPACE_MAXADDR_24BIT;
-
- if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/1, /*boundary*/0,
- lowaddr, /*highaddr*/BUS_SPACE_MAXADDR,
- filter, filter_arg,
- /*maxsize*/BUS_SPACE_MAXSIZE_24BIT,
- /*nsegments*/BUS_SPACE_UNRESTRICTED,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_24BIT,
- /*flags*/0, &aha->parent_dmat) != 0) {
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- bus_release_resource(dev, SYS_RES_DRQ, aha->drqrid, aha->drq);
- aha_free(aha);
- return (ENOMEM);
- }
-
- if (aha_init(aha)) {
- device_printf(dev, "init failed\n");
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- bus_release_resource(dev, SYS_RES_DRQ, aha->drqrid, aha->drq);
- aha_free(aha);
- return (ENOMEM);
- }
-
- error = aha_attach(aha);
- if (error) {
- device_printf(dev, "attach failed\n");
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- bus_release_resource(dev, SYS_RES_DRQ, aha->drqrid, aha->drq);
- aha_free(aha);
- return (error);
- }
-
- error = bus_setup_intr(dev, aha->irq, 0, aha_intr, aha, &ih, NULL);
- if (error) {
- device_printf(dev, "Unable to register interrupt handler\n");
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- bus_release_resource(dev, SYS_RES_DRQ, aha->drqrid, aha->drq);
- aha_free(aha);
- return (error);
- }
-
- return (0);
-}
-
-static int
-aha_isa_detach(device_t dev)
-{
- struct aha_softc *aha = *(struct aha_softc **) device_get_softc(dev);
- int error;
-
- error = bus_teardown_intr(dev, aha->irq, aha->ih);
- if (error) {
- device_printf(dev, "failed to unregister interrupt handler\n");
- }
-
- bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);
- bus_release_resource(dev, SYS_RES_IRQ, aha->irqrid, aha->irq);
- bus_release_resource(dev, SYS_RES_DRQ, aha->drqrid, aha->drq);
-
- error = aha_detach(aha);
- if (error) {
- device_printf(dev, "detach failed\n");
- return (error);
- }
- aha_free(aha);
-
- return (0);
-}
-
-static device_method_t aha_isa_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, aha_isa_probe),
- DEVMETHOD(device_attach, aha_isa_attach),
- DEVMETHOD(device_detach, aha_isa_detach),
-
- { 0, 0 }
-};
-
-static driver_t aha_isa_driver = {
- "aha",
- aha_isa_methods,
- sizeof(struct aha_softc*),
-};
-
-static devclass_t aha_devclass;
-
-DRIVER_MODULE(aha, isa, aha_isa_driver, aha_devclass, NULL, NULL);
+++ /dev/null
-/*
- * Generic register and struct definitions for the Adaptech 154x/164x
- * SCSI host adapters. Product specific probe and attach routines can
- * be found in:
- * <fill in list here>
- *
- * Derived from bt.c written by:
- *
- * Copyright (c) 1998 Justin T. Gibbs.
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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: src/sys/dev/aha/ahareg.h,v 1.8.2.1 2000/08/02 22:24:40 peter Exp $
- * $DragonFly: src/sys/dev/disk/aha/ahareg.h,v 1.4 2005/09/11 13:03:16 sephe Exp $
- */
-
-#ifndef _AHAREG_H_
-#define _AHAREG_H_
-
-#include "use_aha.h"
-
-#include <sys/queue.h>
-#include <bus/cam/scsi/scsi_all.h>
-
-#define AHA_MAXTRANSFER_SIZE 0xffffff /* limited by 24bit counter */
-#define AHA_NSEG 17 /* The number of dma segments
- * supported. */
-#define ALL_TARGETS (~0)
-
-/*
- * Control Register pp. 1-8, 1-9 (Write Only)
- */
-#define CONTROL_REG 0x00
-#define HARD_RESET 0x80 /* Hard Reset - return to POST state */
-#define SOFT_RESET 0x40 /* Soft Reset - Clears Adapter state */
-#define RESET_INTR 0x20 /* Reset/Ack Interrupt */
-#define RESET_SBUS 0x10 /* Drive SCSI bus reset signal */
-
-/*
- * Status Register pp. 1-9, 1-10 (Read Only)
- */
-#define STATUS_REG 0x00
-#define DIAG_ACTIVE 0x80 /* Performing Internal Diags */
-#define DIAG_FAIL 0x40 /* Internal Diags failed */
-#define INIT_REQUIRED 0x20 /* MBOXes need initialization */
-#define HA_READY 0x10 /* HA ready for new commands */
-#define CMD_REG_BUSY 0x08 /* HA busy with last cmd byte */
-#define DATAIN_REG_READY 0x04 /* Data-in Byte available */
-#define STATUS_REG_RSVD 0x02
-#define CMD_INVALID 0x01 /* Invalid Command detected */
-
-/*
- * Command/Parameter Register pp. 1-10, 1-11 (Write Only)
- */
-#define COMMAND_REG 0x01
-
-/*
- * Data in Register p. 1-11 (Read Only)
- */
-#define DATAIN_REG 0x01
-
-/*
- * Interrupt Status Register pp. 1-12 -> 1-14 (Read Only)
- */
-#define INTSTAT_REG 0x02
-#define INTR_PENDING 0x80 /* There is a pending INTR */
-#define INTSTAT_REG_RSVD 0x70
-#define SCSI_BUS_RESET 0x08 /* Bus Reset detected */
-#define CMD_COMPLETE 0x04
-#define OMB_READY 0x02 /* Outgoin Mailbox Ready */
-#define IMB_LOADED 0x01 /* Incoming Mailbox loaded */
-
-/*
- * Definitions for the "undocumented" geometry register, we just need
- * its location.
- */
-#define GEOMETRY_REG 0x03
-
-#define AHA_NREGS (4)
-
-/*
- * Opcodes for Adapter commands.
- */
-typedef enum {
- AOP_NOP = 0x00,
- AOP_INITIALIZE_MBOX = 0x01,
- AOP_START_MBOX = 0x02,
- AOP_EXECUTE_BIOS_CMD = 0x03,
- AOP_INQUIRE_BOARD_ID = 0x04,
- AOP_ENABLE_OMBR_INT = 0x05,
- AOP_SET_SEL_TIMOUT = 0x06,
- AOP_SET_TIME_ON_BUS = 0x07,
- AOP_SET_TIME_OFF_BUS = 0x08,
- AOP_SET_BUS_TRANS_RATE = 0x09,
- AOP_INQUIRE_INST_LDEVS = 0x0A,
- AOP_INQUIRE_CONFIG = 0x0B,
- AOP_ENABLE_TARGET_MODE = 0x0C,
- AOP_INQUIRE_SETUP_INFO = 0x0D,
- AOP_WRITE_LRAM = 0x1A,
- AOP_READ_LRAM = 0x1B,
- AOP_WRITE_CHIP_FIFO = 0x1C,
- AOP_READ_CHIP_FIFO = 0x1D,
- AOP_ECHO_DATA_BYTE = 0x1F,
- AOP_ADAPTER_DIAGNOSTICS = 0x20,
- AOP_SET_ADAPTER_OPTIONS = 0x21,
- AOP_SET_EEPROM = 0x22,
- AOP_RETURN_EEPROM = 0x23,
- AOP_ENABLE_SHADOW_RAM = 0x24,
- AOP_INIT_BIOS_MBOX = 0x25,
- AOP_SET_BIOS_BANK_1 = 0x26,
- AOP_SET_BIOS_BANK_2 = 0x27,
- AOP_RETURN_EXT_BIOS_INFO= 0x28,
- AOP_MBOX_IF_ENABLE = 0x29,
- AOP_SCSI_TERM_STATUS = 0x2C,
- AOP_INQUIRE_SCAM_DEV = 0x2D,
- AOP_SCSI_DEV_TABLE = 0x2E,
- AOP_SCAM_OP = 0x2F,
- AOP_START_BIOS_CMD = 0x82,
- AOP_INQUIRE_ESETUP_INFO = 0x8D
-} aha_op_t;
-
-/************** Definitions of Multi-byte commands and responses ************/
-
-struct aha_extbios
-{
- u_int8_t flags; /* Bit 3 == 1 extended bios enabled */
- u_int8_t mailboxlock; /* mail box lock code to unlock it */
-};
-
-typedef struct {
- u_int8_t num_mboxes;
- u_int8_t base_addr[3];
-} init_24b_mbox_params_t;
-
-typedef struct {
- u_int8_t board_type;
-/* These values are mostly from the aha-1540CP technical reference, but */
-/* with other values from the old aha1542.c driver. The values from the */
-/* aha-1540CP technical manual are used where conflicts arise */
-#define BOARD_1540_16HEAD_BIOS 0x00
-#define BOARD_1540_64HEAD_BIOS 0x30
-#define BOARD_1542 0x41 /* aha-1540/1542 w/64-h bios */
-#define BOARD_1640 0x42 /* aha-1640 */
-#define BOARD_1740 0x43 /* aha-1740A/1742A/1744 */
-#define BOARD_1542C 0x44 /* aha-1542C */
-#define BOARD_1542CF 0x45 /* aha-1542CF */
-#define BOARD_1542CP 0x46 /* aha-1542CP, plug and play */
- u_int8_t cust_features;
-#define FEATURES_STANDARD 0x30
- u_int8_t firmware_rev_major;
- u_int8_t firmware_rev_minor;
-} board_id_data_t;
-
-typedef struct {
- u_int8_t dma_chan;
-#define DMA_CHAN_5 0x20
-#define DMA_CHAN_6 0x40
-#define DMA_CHAN_7 0x80
- u_int8_t irq;
-#define IRQ_9 0x01
-#define IRQ_10 0x02
-#define IRQ_11 0x04
-#define IRQ_12 0x08
-#define IRQ_14 0x20
-#define IRQ_15 0x40
- u_int8_t scsi_id;
-} config_data_t;
-
-typedef struct {
- u_int8_t enable;
-} target_mode_params_t;
-
-typedef struct {
- u_int8_t offset : 4,
- period : 3,
- sync : 1;
-} targ_syncinfo_t;
-
-typedef struct {
- u_int8_t initiate_sync : 1,
- parity_enable : 1,
- : 6;
-
- u_int8_t bus_transfer_rate;
- u_int8_t time_on_bus;
- u_int8_t time_off_bus;
- u_int8_t num_mboxes;
- u_int8_t mbox_base_addr[3];
- targ_syncinfo_t syncinfo[8];
- u_int8_t discinfo;
- u_int8_t customer_sig[20];
- u_int8_t auto_retry;
- u_int8_t board_switches;
- u_int8_t firmware_cksum[2];
- u_int8_t bios_mbox_addr[3];
-} setup_data_t;
-
-struct aha_isa_port {
- u_int16_t addr;
- u_int8_t bio; /* board IO offset */
-};
-
-#define AHA_NUM_ISAPORTS 6
-
-typedef enum {
- BIO_330 = 0,
- BIO_334 = 1,
- BIO_230 = 2,
- BIO_234 = 3,
- BIO_130 = 4,
- BIO_134 = 5,
- BIO_DISABLED = 6,
- BIO_DISABLED2 = 7
-} isa_compat_io_t;
-
-typedef struct {
- u_int8_t sync_rate[16]; /* Sync in 10ns units */
-} target_sync_info_data_t;
-
-typedef struct {
- u_int8_t len[3];
- u_int8_t addr[3];
-} aha_sg_t;
-
-/********************** Mail Box definitions *******************************/
-
-typedef enum {
- AMBO_FREE = 0x0, /* MBO intry is free */
- AMBO_START = 0x1, /* MBO activate entry */
- AMBO_ABORT = 0x2 /* MBO abort entry */
-} aha_mbo_action_code_t;
-
-typedef struct aha_mbox_out {
- u_int8_t action_code;
- u_int8_t ccb_addr[3];
-} aha_mbox_out_t;
-
-typedef enum {
- AMBI_FREE = 0x0, /* MBI entry is free */
- AMBI_OK = 0x1, /* completed without error */
- AMBI_ABORT = 0x2, /* aborted ccb */
- AMBI_NOT_FOUND = 0x3, /* Tried to abort invalid CCB */
- AMBI_ERROR = 0x4 /* Completed with error */
-} aha_mbi_comp_code_t;
-
-typedef struct aha_mbox_in {
- u_int8_t comp_code;
- u_int8_t ccb_addr[3];
-} aha_mbox_in_t;
-
-/****************** Hardware CCB definition *********************************/
-typedef enum {
- INITIATOR_CCB = 0x00,
- INITIATOR_SG_CCB = 0x02,
- INITIATOR_CCB_WRESID = 0x03,
- INITIATOR_SG_CCB_WRESID = 0x04,
- INITIATOR_BUS_DEV_RESET = 0x81
-} aha_ccb_opcode_t;
-
-typedef enum {
- AHASTAT_NOERROR = 0x00,
- AHASTAT_SELTIMEOUT = 0x11,
- AHASTAT_DATARUN_ERROR = 0x12,
- AHASTAT_UNEXPECTED_BUSFREE = 0x13,
- AHASTAT_INVALID_PHASE = 0x14,
- AHASTAT_INVALID_ACTION_CODE = 0x15,
- AHASTAT_INVALID_OPCODE = 0x16,
- AHASTAT_LINKED_CCB_LUN_MISMATCH = 0x17,
- AHASTAT_INVALID_CCB_OR_SG_PARAM = 0x1A,
- AHASTAT_HA_SCSI_BUS_RESET = 0x22, /* stolen from bt */
- AHASTAT_HA_BDR = 0x25 /* Stolen from bt */
-} ahastat_t;
-
-struct aha_hccb {
- u_int8_t opcode; /* 0 */
- u_int8_t lun : 3, /* 1 */
- datain : 1,
- dataout : 1,
- target : 3;
- u_int8_t cmd_len; /* 2 */
- u_int8_t sense_len; /* 3 */
- u_int8_t data_len[3]; /* 4 */
- u_int8_t data_addr[3]; /* 7 */
- u_int8_t link_ptr[3]; /* 10 */
- u_int8_t link_id; /* 13 */
- u_int8_t ahastat; /* 14 */
- u_int8_t sdstat; /* 15 */
- u_int8_t reserved1; /* 16 */
- u_int8_t reserved2; /* 17 */
- u_int8_t scsi_cdb[16]; /* 18 */
- u_int8_t sense_data[SSD_FULL_SIZE];
-};
-
-typedef enum {
- ACCB_FREE = 0x0,
- ACCB_ACTIVE = 0x1,
- ACCB_DEVICE_RESET = 0x2,
- ACCB_RELEASE_SIMQ = 0x4
-} accb_flags_t;
-
-struct aha_ccb {
- struct aha_hccb hccb; /* hccb assumed to be at 0 */
- SLIST_ENTRY(aha_ccb) links;
- u_int32_t flags;
- union ccb *ccb;
- bus_dmamap_t dmamap;
- aha_sg_t *sg_list;
- u_int32_t sg_list_phys;
-};
-
-struct sg_map_node {
- bus_dmamap_t sg_dmamap;
- bus_addr_t sg_physaddr;
- aha_sg_t* sg_vaddr;
- SLIST_ENTRY(sg_map_node) links;
-};
-
-struct aha_softc {
- bus_space_tag_t tag;
- bus_space_handle_t bsh;
- struct cam_sim *sim;
- struct cam_path *path;
- aha_mbox_out_t *cur_outbox;
- aha_mbox_in_t *cur_inbox;
- aha_mbox_out_t *last_outbox;
- aha_mbox_in_t *last_inbox;
- struct aha_ccb *aha_ccb_array;
- SLIST_HEAD(,aha_ccb) free_aha_ccbs;
- LIST_HEAD(,ccb_hdr) pending_ccbs;
- u_int active_ccbs;
- u_int32_t aha_ccb_physbase;
- aha_ccb_opcode_t ccb_sg_opcode;
- aha_ccb_opcode_t ccb_ccb_opcode;
- aha_mbox_in_t *in_boxes;
- aha_mbox_out_t *out_boxes;
- struct scsi_sense_data *sense_buffers;
- u_int32_t sense_buffers_physbase;
- struct aha_ccb *recovery_accb;
- u_int num_boxes;
- bus_dma_tag_t parent_dmat; /*
- * All dmat's derive from
- * the dmat defined by our
- * bus.
- */
- bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */
- bus_dma_tag_t mailbox_dmat; /* dmat for our mailboxes */
- bus_dmamap_t mailbox_dmamap;
- bus_dma_tag_t ccb_dmat; /* dmat for our ccb array */
- bus_dmamap_t ccb_dmamap;
- bus_dma_tag_t sg_dmat; /* dmat for our sg maps */
- SLIST_HEAD(, sg_map_node) sg_maps;
- bus_addr_t mailbox_physbase;
- u_int num_ccbs; /* Number of CCBs malloc'd */
- u_int max_ccbs; /* Maximum allocatable CCBs */
- u_int max_sg;
- u_int scsi_id;
- u_int32_t extended_trans :1,
- diff_bus :1,
- extended_lun :1,
- strict_rr :1,
- tag_capable :1,
- resource_shortage:1,
- :26;
- u_int16_t disc_permitted;
- u_int16_t sync_permitted;
- u_int8_t init_level;
- volatile u_int8_t command_cmp;
- volatile u_int8_t latched_status;
- u_int32_t bios_addr;
- u_int8_t fw_major;
- u_int8_t fw_minor;
- char model[32];
- u_int8_t boardid;
- struct resource *irq;
- int irqrid;
- struct resource *port;
- int portrid;
- struct resource *drq;
- int drqrid;
- void **ih;
- device_t dev;
-};
-
-extern struct aha_softc *aha_softcs[]; /* XXX Config should handle this */
-extern u_long aha_unit;
-
-#define AHA_TEMP_UNIT 0xFF /* Unit for probes */
-struct aha_softc* aha_alloc(device_t, bus_space_tag_t, bus_space_handle_t);
-int aha_attach(struct aha_softc *);
-int aha_cmd(struct aha_softc *, aha_op_t, u_int8_t *,
- u_int, u_int8_t *, u_int, u_int);
-int aha_detach(struct aha_softc *);
-int aha_fetch_adapter_info(struct aha_softc *);
-void aha_find_probe_range(int, int *, int *);
-void aha_free(struct aha_softc *);
-int aha_init(struct aha_softc *);
-void aha_intr(void *);
-int aha_iop_from_bio(isa_compat_io_t);
-char * aha_name(struct aha_softc *);
-int aha_probe(struct aha_softc *);
-
-#define DEFAULT_CMD_TIMEOUT 10000 /* 1 sec */
-
-#define aha_inb(aha, port) \
- bus_space_read_1((aha)->tag, (aha)->bsh, port)
-
-#define aha_outb(aha, port, value) \
- bus_space_write_1((aha)->tag, (aha)->bsh, port, value)
-
-/* XXX BAD */
-#define EXTRA_AHA 4
-#define NAHATOT (NAHA + EXTRA_AHA)
-
-#define ADP0100_PNP 0x00019004 /* ADP0100 */
-#define AHA1540_PNP 0x40159004 /* ADP1540 */
-#define AHA1542_PNP 0x42159004 /* ADP1542 */
-#define AHA1542_PNPCOMPAT 0xA000D040 /* PNP00A0 */
-#define ICU0091_PNP 0X91005AA4 /* ICU0091 */
-
-#endif /* _AHA_H_ */
+++ /dev/null
-
-/*
- * Streamer tape driver for 386bsd and FreeBSD.
- * Supports Archive and Wangtek compatible QIC-02/QIC-36 boards.
- *
- * Copyright (C) 1993 by:
- * Sergey Ryzhkov <sir@kiae.su>
- * Serge Vakulenko <vak@zebub.msk.su>
- *
- * This software is distributed with NO WARRANTIES, not even the implied
- * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Authors grant any other persons or organisations permission to use
- * or modify this software as long as this message is kept with the software,
- * all derivative works or modified versions.
- *
- * This driver is derived from the old 386bsd Wangtek streamer tape driver,
- * made by Robert Baron at CMU, based on Intel sources.
- * Authors thank Robert Baron, CMU and Intel and retain here
- * the original CMU copyright notice.
- *
- * Version 1.3, Thu Nov 11 12:09:13 MSK 1993
- * $FreeBSD: src/sys/i386/isa/wt.c,v 1.57.2.1 2000/08/08 19:49:53 peter Exp $
- *
- */
-
-/*
- * Code for MTERASE added by John Lind (john@starfire.mn.org) 95/09/02.
- * This was very easy due to the excellent structure and clear coding
- * of the original driver.
- */
-
-/*
- * Copyright (c) 1989 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Authors: Robert Baron
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include "use_wt.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/mtio.h>
-#include <sys/conf.h>
-#include <sys/thread2.h>
-#include <sys/bus.h>
-
-#include <machine/clock.h>
-
-#include <bus/isa/isa_device.h>
-#include <bus/isa/isavar.h>
-#include "wtreg.h"
-
-
-/*
- * Uncomment this to enable internal device tracing.
- */
-#define TRACE(s) /* kprintf s */
-
-/*
- * Wangtek controller ports
- */
-#define WT_CTLPORT(base) ((base)+0) /* control, write only */
-#define WT_STATPORT(base) ((base)+0) /* status, read only */
-#define WT_CMDPORT(base) ((base)+1) /* command, write only */
-#define WT_DATAPORT(base) ((base)+1) /* data, read only */
-#define WT_NPORT 2 /* 2 i/o ports */
-
-/* status port bits */
-#define WT_BUSY 0x01 /* not ready bit define */
-#define WT_NOEXCEP 0x02 /* no exception bit define */
-#define WT_RESETMASK 0x07 /* to check after reset */
-#define WT_RESETVAL 0x05 /* state after reset */
-
-/* control port bits */
-#define WT_ONLINE 0x01 /* device selected */
-#define WT_RESET 0x02 /* reset command */
-#define WT_REQUEST 0x04 /* request command */
-#define WT_IEN 0x08 /* enable dma */
-
-/*
- * Archive controller ports
- */
-#define AV_DATAPORT(base) ((base)+0) /* data, read only */
-#define AV_CMDPORT(base) ((base)+0) /* command, write only */
-#define AV_STATPORT(base) ((base)+1) /* status, read only */
-#define AV_CTLPORT(base) ((base)+1) /* control, write only */
-#define AV_SDMAPORT(base) ((base)+2) /* start dma */
-#define AV_RDMAPORT(base) ((base)+3) /* reset dma */
-#define AV_NPORT 4 /* 4 i/o ports */
-
-/* status port bits */
-#define AV_BUSY 0x40 /* not ready bit define */
-#define AV_NOEXCEP 0x20 /* no exception bit define */
-#define AV_RESETMASK 0xf8 /* to check after reset */
-#define AV_RESETVAL 0x50 /* state after reset */
-
-/* control port bits */
-#define AV_RESET 0x80 /* reset command */
-#define AV_REQUEST 0x40 /* request command */
-#define AV_IEN 0x20 /* enable interrupts */
-
-enum wttype {
- UNKNOWN = 0, /* unknown type, driver disabled */
- ARCHIVE, /* Archive Viper SC499, SC402 etc */
- WANGTEK /* Wangtek */
-};
-
-typedef struct {
- unsigned short err; /* code for error encountered */
- unsigned short ercnt; /* number of error blocks */
- unsigned short urcnt; /* number of underruns */
-} wtstatus_t;
-
-typedef struct {
- enum wttype type; /* type of controller */
- unsigned unit; /* unit number */
- unsigned port; /* base i/o port */
- unsigned chan; /* dma channel number, 1..3 */
- unsigned flags; /* state of tape drive */
- unsigned dens; /* tape density */
- int bsize; /* tape block size */
- void *buf; /* internal i/o buffer */
-
- void *dmavaddr; /* virtual address of dma i/o buffer */
- unsigned dmatotal; /* size of i/o buffer */
- unsigned dmaflags; /* i/o direction, ISADMA_READ or ISADMA_WRITE */
- unsigned dmacount; /* resulting length of dma i/o */
-
- wtstatus_t error; /* status of controller */
-
- unsigned short DATAPORT, CMDPORT, STATPORT, CTLPORT, SDMAPORT, RDMAPORT;
- unsigned char BUSY, NOEXCEP, RESETMASK, RESETVAL;
- unsigned char ONLINE, RESET, REQUEST, IEN;
- struct callout timeout_ch;
-} wtinfo_t;
-
-static wtinfo_t wttab[NWT]; /* tape info by unit number */
-
-static int wtwait (wtinfo_t *t, int catch, char *msg);
-static int wtcmd (wtinfo_t *t, int cmd);
-static int wtstart (wtinfo_t *t, unsigned flags, void *vaddr, unsigned len);
-static void wtdma (wtinfo_t *t);
-static timeout_t wtimer;
-static void wtclock (wtinfo_t *t);
-static int wtreset (wtinfo_t *t);
-static int wtsense (wtinfo_t *t, int verb, int ignor);
-static int wtstatus (wtinfo_t *t);
-static void wtintr(void *);
-static void wtrewind (wtinfo_t *t);
-static int wtreadfm (wtinfo_t *t);
-static int wtwritefm (wtinfo_t *t);
-static int wtpoll (wtinfo_t *t, int mask, int bits);
-
-static d_open_t wtopen;
-static d_close_t wtclose;
-static d_ioctl_t wtioctl;
-static d_strategy_t wtstrategy;
-
-static struct dev_ops wt_ops = {
- { "wt", 0, 0 },
- .d_open = wtopen,
- .d_close = wtclose,
- .d_read = physread,
- .d_write = physwrite,
- .d_ioctl = wtioctl,
- .d_strategy = wtstrategy,
-};
-
-
-/*
- * Probe for the presence of the device.
- */
-static int
-wtprobe (struct isa_device *id)
-{
- wtinfo_t *t = wttab + id->id_unit;
-
- callout_init(&t->timeout_ch);
- t->unit = id->id_unit;
- t->chan = id->id_drq;
- t->port = id->id_iobase;
- if (t->chan<1 || t->chan>3) {
- kprintf ("wt%d: Bad drq=%d, should be 1..3\n", t->unit, t->chan);
- return (0);
- }
-
- /* Try Wangtek. */
- t->type = WANGTEK;
- t->CTLPORT = WT_CTLPORT (t->port); t->STATPORT = WT_STATPORT (t->port);
- t->CMDPORT = WT_CMDPORT (t->port); t->DATAPORT = WT_DATAPORT (t->port);
- t->SDMAPORT = 0; t->RDMAPORT = 0;
- t->BUSY = WT_BUSY; t->NOEXCEP = WT_NOEXCEP;
- t->RESETMASK = WT_RESETMASK; t->RESETVAL = WT_RESETVAL;
- t->ONLINE = WT_ONLINE; t->RESET = WT_RESET;
- t->REQUEST = WT_REQUEST; t->IEN = WT_IEN;
- if (wtreset (t))
- return (WT_NPORT);
-
- /* Try Archive. */
- t->type = ARCHIVE;
- t->CTLPORT = AV_CTLPORT (t->port); t->STATPORT = AV_STATPORT (t->port);
- t->CMDPORT = AV_CMDPORT (t->port); t->DATAPORT = AV_DATAPORT (t->port);
- t->SDMAPORT = AV_SDMAPORT (t->port); t->RDMAPORT = AV_RDMAPORT (t->port);
- t->BUSY = AV_BUSY; t->NOEXCEP = AV_NOEXCEP;
- t->RESETMASK = AV_RESETMASK; t->RESETVAL = AV_RESETVAL;
- t->ONLINE = 0; t->RESET = AV_RESET;
- t->REQUEST = AV_REQUEST; t->IEN = AV_IEN;
- if (wtreset (t))
- return (AV_NPORT);
-
- /* Tape controller not found. */
- t->type = UNKNOWN;
- return (0);
-}
-
-/*
- * Device is found, configure it.
- */
-static int
-wtattach (struct isa_device *id)
-{
- wtinfo_t *t = wttab + id->id_unit;
-
- id->id_intr = (inthand2_t *)wtintr;
- if (t->type == ARCHIVE) {
- kprintf ("wt%d: type <Archive>\n", t->unit);
- outb (t->RDMAPORT, 0); /* reset dma */
- } else
- kprintf ("wt%d: type <Wangtek>\n", t->unit);
- t->flags = TPSTART; /* tape is rewound */
- t->dens = -1; /* unknown density */
- isa_dmainit(t->chan, 1024);
-
- make_dev(&wt_ops, id->id_unit, 0, 0, 0600, "rwt%d", id->id_unit);
- return (1);
-}
-
-struct isa_driver wtdriver = { wtprobe, wtattach, "wt", };
-
-/*
- * Open routine, called on every device open.
- */
-static int
-wtopen (struct dev_open_args *ap)
-{
- cdev_t dev = ap->a_head.a_dev;
- int u = minor (dev) & T_UNIT;
- wtinfo_t *t = wttab + u;
- int error;
-
- if (u >= NWT || t->type == UNKNOWN)
- return (ENXIO);
-
- /* Check that device is not in use */
- if (t->flags & TPINUSE)
- return (EBUSY);
-
- /* If the tape is in rewound state, check the status and set density. */
- if (t->flags & TPSTART) {
- /* If rewind is going on, wait */
- error = wtwait (t, PCATCH, "wtrew");
- if (error)
- return (error);
-
- /* Check the controller status */
- if (! wtsense (t, 0, (ap->a_oflags & FWRITE) ? 0 : TP_WRP)) {
- /* Bad status, reset the controller */
- if (! wtreset (t))
- return (EIO);
- if (! wtsense (t, 1, (ap->a_oflags & FWRITE) ? 0 : TP_WRP))
- return (EIO);
- }
-
- /* Set up tape density. */
- if (t->dens != (minor (dev) & WT_DENSEL)) {
- int d = 0;
-
- switch (minor (dev) & WT_DENSEL) {
- case WT_DENSDFLT: default: break; /* default density */
- case WT_QIC11: d = QIC_FMT11; break; /* minor 010 */
- case WT_QIC24: d = QIC_FMT24; break; /* minor 020 */
- case WT_QIC120: d = QIC_FMT120; break; /* minor 030 */
- case WT_QIC150: d = QIC_FMT150; break; /* minor 040 */
- case WT_QIC300: d = QIC_FMT300; break; /* minor 050 */
- case WT_QIC600: d = QIC_FMT600; break; /* minor 060 */
- }
- if (d) {
- /* Change tape density. */
- if (! wtcmd (t, d))
- return (EIO);
- if (! wtsense (t, 1, TP_WRP | TP_ILL))
- return (EIO);
-
- /* Check the status of the controller. */
- if (t->error.err & TP_ILL) {
- kprintf ("wt%d: invalid tape density\n", t->unit);
- return (ENODEV);
- }
- }
- t->dens = minor (dev) & WT_DENSEL;
- }
- t->flags &= ~TPSTART;
- } else if (t->dens != (minor (dev) & WT_DENSEL))
- return (ENXIO);
-
- t->bsize = (minor (dev) & WT_BSIZE) ? 1024 : 512;
- t->buf = kmalloc (t->bsize, M_TEMP, M_WAITOK);
-
- if (isa_dma_acquire(t->chan))
- return(EBUSY);
-
- t->flags = TPINUSE;
-
- if (ap->a_oflags & FREAD)
- t->flags |= TPREAD;
- if (ap->a_oflags & FWRITE)
- t->flags |= TPWRITE;
- return (0);
-}
-
-/*
- * Close routine, called on last device close.
- */
-static int
-wtclose (struct dev_close_args *ap)
-{
- cdev_t dev = ap->a_head.a_dev;
- int u = minor (dev) & T_UNIT;
- wtinfo_t *t = wttab + u;
-
- if (u >= NWT || t->type == UNKNOWN)
- return (ENXIO);
-
- /* If rewind is pending, do nothing */
- if (t->flags & TPREW)
- goto done;
-
- /* If seek forward is pending and no rewind on close, do nothing */
- if (t->flags & TPRMARK) {
- if (minor (dev) & T_NOREWIND)
- goto done;
-
- /* If read file mark is going on, wait */
- wtwait (t, 0, "wtrfm");
- }
-
- if (t->flags & TPWANY)
- /* Tape was written. Write file mark. */
- wtwritefm (t);
-
- if (! (minor (dev) & T_NOREWIND)) {
- /* Rewind tape to beginning of tape. */
- /* Don't wait until rewind, though. */
- wtrewind (t);
- goto done;
- }
- if ((t->flags & TPRANY) && ! (t->flags & (TPVOL | TPWANY)))
- /* Space forward to after next file mark if no writing done. */
- /* Don't wait for completion. */
- wtreadfm (t);
-done:
- t->flags &= TPREW | TPRMARK | TPSTART | TPTIMER;
- kfree (t->buf, M_TEMP);
- isa_dma_release(t->chan);
- return (0);
-}
-
-/*
- * Ioctl routine. Compatible with BSD ioctls.
- * There are two possible ioctls:
- * ioctl (int fd, MTIOCGET, struct mtget *buf) -- get status
- * ioctl (int fd, MTIOCTOP, struct mtop *buf) -- do BSD-like op
- */
-static int
-wtioctl (struct dev_ioctl_args *ap)
-{
- cdev_t dev = ap->a_head.a_dev;
- caddr_t arg = ap->a_data;
- int u = minor (dev) & T_UNIT;
- wtinfo_t *t = wttab + u;
- int error, count, op;
-
- if (u >= NWT || t->type == UNKNOWN)
- return (ENXIO);
-
- switch (ap->a_cmd) {
- default:
- return (EINVAL);
- case MTIOCIEOT: /* ignore EOT errors */
- case MTIOCEEOT: /* enable EOT errors */
- return (0);
- case MTIOCGET:
- ((struct mtget*)arg)->mt_type =
- t->type == ARCHIVE ? MT_ISVIPER1 : 0x11;
- ((struct mtget*)arg)->mt_dsreg = t->flags; /* status */
- ((struct mtget*)arg)->mt_erreg = t->error.err; /* errors */
- ((struct mtget*)arg)->mt_resid = 0;
- ((struct mtget*)arg)->mt_fileno = 0; /* file */
- ((struct mtget*)arg)->mt_blkno = 0; /* block */
- return (0);
- case MTIOCTOP:
- break;
- }
- switch ((short) ((struct mtop*)arg)->mt_op) {
- default:
- case MTFSR: /* forward space record */
- case MTBSR: /* backward space record */
- case MTBSF: /* backward space file */
- break;
- case MTNOP: /* no operation, sets status only */
- case MTCACHE: /* enable controller cache */
- case MTNOCACHE: /* disable controller cache */
- return (0);
- case MTREW: /* rewind */
- case MTOFFL: /* rewind and put the drive offline */
- if (t->flags & TPREW) /* rewind is running */
- return (0);
- error = wtwait (t, PCATCH, "wtorew");
- if (error)
- return (error);
- wtrewind (t);
- return (0);
- case MTFSF: /* forward space file */
- for (count=((struct mtop*)arg)->mt_count; count>0; --count) {
- error = wtwait (t, PCATCH, "wtorfm");
- if (error)
- return (error);
- error = wtreadfm (t);
- if (error)
- return (error);
- }
- return (0);
- case MTWEOF: /* write an end-of-file record */
- if (! (t->flags & TPWRITE) || (t->flags & TPWP))
- return (EACCES);
- error = wtwait (t, PCATCH, "wtowfm");
- if (error)
- return (error);
- error = wtwritefm (t);
- if (error)
- return (error);
- return (0);
- case MTRETENS: /* re-tension tape */
- error = wtwait (t, PCATCH, "wtretens");
- if (error)
- return (error);
- op = QIC_RETENS;
- goto erase_retens;
-
- case MTERASE: /* erase to EOM */
- if (! (t->flags & TPWRITE) || (t->flags & TPWP))
- return (EACCES);
- error = wtwait (t, PCATCH, "wterase");
- if (error)
- return (error);
- op = QIC_ERASE;
- erase_retens:
- /* ERASE and RETENS operations work like REWIND. */
- /* Simulate the rewind operation here. */
- t->flags &= ~(TPRO | TPWO | TPVOL);
- if (! wtcmd (t, op))
- return (EIO);
- t->flags |= TPSTART | TPREW;
- t->flags |= TPWANY;
- wtclock (t);
- return (0);
- }
- return (EINVAL);
-}
-
-/*
- * Strategy routine.
- */
-static int
-wtstrategy (struct dev_strategy_args *ap)
-{
- cdev_t dev = ap->a_head.a_dev;
- struct bio *bio = ap->a_bio;
- struct buf *bp = bio->bio_buf;
- int u = minor(dev) & T_UNIT;
- wtinfo_t *t = wttab + u;
- unsigned flags;
-
- bp->b_resid = bp->b_bcount;
- if (u >= NWT || t->type == UNKNOWN) {
- bp->b_error = ENXIO;
- goto err2xit;
- }
-
- /* at file marks and end of tape, we just return '0 bytes available' */
- if (t->flags & TPVOL)
- goto xit;
-
- if (bp->b_bcount % t->bsize != 0) {
- bp->b_error = EINVAL;
- goto err2xit;
- }
-
- if (bp->b_cmd == BUF_CMD_READ) {
- /* Check read access and no previous write to this tape. */
- if (! (t->flags & TPREAD) || (t->flags & TPWANY))
- goto errxit;
-
- /* For now, we assume that all data will be copied out */
- /* If read command outstanding, just skip down */
- if (! (t->flags & TPRO)) {
- if (! wtsense (t, 1, TP_WRP)) /* clear status */
- goto errxit;
- if (! wtcmd (t, QIC_RDDATA)) { /* sed read mode */
- wtsense (t, 1, TP_WRP);
- goto errxit;
- }
- t->flags |= TPRO | TPRANY;
- }
- flags = ISADMA_READ;
- } else {
- /* Check write access and write protection. */
-