remove some long abandonded serial drivers (cy, rc, rp) since 2008

Reviewed by:	phk (earlier version)
Reviewed by:	emaste (earlier version)
Reviewed by:	bcr (earlier version)
Reviewed by:	zeising (earlier version)
Differential Revision:	https://reviews.freebsd.org/D25874
This commit is contained in:
John-Mark Gurney 2020-07-30 00:53:56 +00:00
parent 1b778ba260
commit aa6ea9b6ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363683
20 changed files with 5 additions and 7789 deletions

View File

@ -36,6 +36,11 @@
# xargs -n1 | sort | uniq -d;
# done
# 20200729: remove long expired serial drivers
OLD_FILES+=usr/share/man/man4/cy.4.gz
OLD_FILES+=usr/share/man/man4/rc.4.gz
OLD_FILES+=usr/share/man/man4/rp.4.gz
# 20200715: rework of devstat(9) man page
OLD_FILES+=usr/share/man/man9/devstat_add_entry.9.gz

View File

@ -121,7 +121,6 @@ MAN= aac.4 \
cxgb.4 \
cxgbe.4 \
cxgbev.4 \
cy.4 \
cyapa.4 \
da.4 \
dc.4 \
@ -434,7 +433,6 @@ MAN= aac.4 \
${_qlnxe.4} \
ral.4 \
random.4 \
rc.4 \
rctl.4 \
re.4 \
rgephy.4 \
@ -442,7 +440,6 @@ MAN= aac.4 \
rl.4 \
rndtest.4 \
route.4 \
rp.4 \
rtwn.4 \
rtwnfw.4 \
rtwn_pci.4 \

View File

@ -1,257 +0,0 @@
.\" 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. 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.16 1995/06/26 06:05:30 bde Exp $
.\" $FreeBSD$
.\"
.Dd May 24, 2004
.Dt CY 4
.Os
.Sh NAME
.Nm cy
.Nd Cyclades Cyclom-Y serial driver
.Sh SYNOPSIS
For one ISA card:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.cy.0.at="isa"
.Cd hint.cy.0.irq="10"
.Cd hint.cy.0.maddr="0xd4000"
.Cd hint.cy.0.msize="0x2000"
.Ed
.Pp
For two ISA cards:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.cy.0.at="isa"
.Cd hint.cy.0.irq="10"
.Cd hint.cy.0.maddr="0xd4000"
.Cd hint.cy.0.msize="0x2000"
.Cd hint.cy.1.at="isa"
.Cd hint.cy.1.irq="11"
.Cd hint.cy.1.maddr="0xd6000"
.Cd hint.cy.1.msize="0x2000"
.Ed
.Pp
For PCI cards:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Cd "options CY_PCI_FASTINTR"
.Pp
No lines are required in
.Pa /boot/device.hints
for PCI cards.
.Ed
.Pp
Minor numbering:
.Bd -literal -offset indent -compact
0b\fIMMMMMMMMMMMMMMMMxxxxxxxxOLIMMMMM\fR
call\fBO\fRut
\fBL\fRock
\fBI\fRnitial
\fBMMMMMMMMMMMMMMMM MMMMMM\fRinor
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for Cirrus Logic CD1400-based
.Tn EIA
.Tn RS-232C
.Pf ( Tn CCITT
.Tn V.24 )
communications interfaces (ports) on Cyclades Cyclom-Y boards.
Each CD1400 provides 4 ports.
Cyclom-Y boards with various numbers of CD1400's are available.
This driver supports up to 8 CD1400's (32 ports) per board.
.Pp
Input and output for each line may set independently
to the following speeds:
50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
19200, 38400, 57600, or 115200 bps.
Other speeds of up to 150000 are supported by the termios interface
but not by the sgttyb compatibility interface.
The CD1400 is not fast enough to handle speeds above 115200 bps
effectively.
It can transmit on a single line at slightly more than 115200 bps,
but when 4 lines are active in both directions its limit is about
90000 bps on each line.
.\" 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 change was s/sio/cy/g.
.Pp
Serial ports controlled by the
.Nm
driver can be used for both `callin' and `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 "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
CRTSCTS, use
.Em "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
work with almost arbitrary initial states and almost 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., CRTSCTS should be locked on for devices that support
RTS/CTS handshaking at all times and off for devices that do not
support it at all.
CLOCAL should be locked on for devices
that do not support carrier.
HUPCL may be locked off if you do not
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
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.
.Ss Kernel Configuration Options
The
.Em CY_PCI_FASTINTR
option should be used to avoid suboptimal interrupt handling for
PCI Cyclades boards.
The PCI BIOS must be configured with the
.Nm
interrupt not shared with any other active device
for this option to work.
This option is not the default because it is currently harmful in
certain cases where it does not work.
.Sh FILES
.\" XXX more cloning: s/d/c/g and add a ? for the card number.
.Bl -tag -width /dev/ttyic?? -compact
.It Pa /dev/ttyc??
for callin ports
.It Pa /dev/ttyic??
.It Pa /dev/ttylc??
corresponding callin initial-state and lock-state devices
.Pp
.\" XXX more cloning: s/a/c/g. No consistency :-(.
.It Pa /dev/cuac??
for callout ports
.It Pa /dev/cuaic??
.It Pa /dev/cualc??
corresponding callout initial-state and lock-state devices
.El
.Pp
.Bl -tag -width /etc/rc.serial -compact
.It Pa /etc/rc.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
.Bl -diag
.\" XXX back to s/sio/cy/g.
.It cy%d: silo overflow.
Problem in the interrupt handler.
.El
.Bl -diag
.It cy%d: interrupt-level buffer overflow.
Problem in the bottom half of the driver.
.El
.Bl -diag
.It cy%d: tty-level buffer overflow.
Problem in the application.
Input has arrived faster than the given module could process it
and some has been lost.
.El
.\" .Bl -diag
.\" .It sio%d: reduced fifo trigger level to %d.
.\" Attempting to avoid further silo overflows.
.\" .El
.Sh SEE ALSO
.Xr stty 1 ,
.Xr termios 4 ,
.Xr tty 4 ,
.Xr comcontrol 8 ,
.Xr pstat 8
.Sh HISTORY
The
.Nm
driver is derived from the
.Nm sio
driver and the
.Nx
.Nm
driver and is
.Ud
.Sh BUGS
Serial consoles are not implemented.

View File

@ -1,124 +0,0 @@
.\"
.\" 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$
.\"
.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.
The jumper-selectable hardware interrupt level may be set to
be detected during system
initialization using settings found in the
.Pa /boot/device.hints
file.
.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/rc/rc.c
file can be consulted for more information.
.El
.Sh SEE ALSO
.Xr tty 1 ,
.Xr ttyname 3 ,
.Xr tty 4 ,
.Xr device.hints 5 ,
.Xr comcontrol 8 ,
.Xr getty 8 ,
.Xr mutex 9 ,
.Xr splx 9
.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 Mt trhodes@FreeBSD.org .
.Sh BUGS
The
.Nm
driver code still uses the
.Xr spl 9
functions.
These should be replaced by
.Xr mutex 9
functions.
.Pp
The various
.Fn ttyld_*
functions should be documented.

View File

@ -1,195 +0,0 @@
.\" Copyright (c) 1995 Comtrol, Inc.
.\" All rights reserved.
.\"
.\" $FreeBSD$
.Dd November 15, 1995
.Dt RP 4
.Os
.Sh NAME
.Nm rp
.Nd "driver for Comtrol RocketPort Intelligent Serial Port Cards"
.Sh SYNOPSIS
.Cd "device rp"
.Pp
For ISA cards, you must specify the port address in
.Pa /boot/device.hints :
.Cd hint.rp.0.at="isa"
.Cd hint.rp.0.port="0x100"
.Sh DESCRIPTION
This driver provides a kernel device driver for the
.Tn RocketPort
and
.Tn RocketPort RA
serial boards.
These boards provide 8, 16, or 32 high-speed serial ports
while requiring only 68 bytes of I/O space for all 8, 16,
or 32 ports, and do not require an interrupt channel.
This driver supports up to four
.Tn RocketPort
or
.Tn RocketPort RA
boards in one machine simultaneously.
If you are using four 32 port
.Tn RocketPort
boards, you can put as many as 128 intelligent serial ports
on your system.
.Pp
The
.Nm
driver supports the following speeds: 50, 75, 110, 134, 150,
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 7200,
14400, 57600, 76800, 115200, and 230400.
(You must use
.Xr termios 4 ,
rather than the old style ioctl interface to use non-traditional
speeds.)
.Pp
An open on the
.Nm
driver will block until carrier is present, unless
.Dv O_NONBLOCK
or
.Dv CLOCAL
is set.
.Sh HARDWARE CONFIGURATION
The first
.Tn RocketPort
or
.Tn RocketPort RA
card requires a 68-byte contiguous block of I/O addresses,
starting at one of the following:
0x100h, 0x140h, 0x180h, 0x200h, 0x240h, 0x280h, 0x300h, 0x340h,
0x380h.
The second, third, and fourth
.Tn RocketPort
cards require only a
64-byte contiguous block of I/O addresses, starting at one of the
above address ranges.
The I/O address range used by any of the
.Tn RocketPort
cards must not conflict with any other cards in the system,
including other
.Tn RocketPort
cards.
The starting range of the I/O ports used by each card
must match with the I/O address specified in
.Pa /boot/device.hints .
.Pp
Since the first
.Tn RocketPort
uses 68 I/O addresses, if the first card is
set to use an I/O block starting at 0x100,
it will occupy the I/O ports between 0x100 and 0x143.
This means that the second, third, or fourth
.Tn RocketPort
board may not use the block of addresses starting at 0x140,
since the first three I/O addresses of that range
are used by the first board.
This is an important point to keep in mind.
.Pp
If you have two ISA cards, one installed at 0x100 and the
second installed at 0x180, then you should add the following to
.Pa /boot/device.hints :
.Pp
.Dl hint.rp.0.at="isa"
.Dl hint.rp.0.port="0x100"
.Dl hint.rp.1.at="isa"
.Dl hint.rp.1.port="0x180"
.Pp
The configuration of the
.Tn RocketPort
cards is done via the set of 8 DIP switches,
labeled SW1 on the
.Tn RocketPort
card:
.Bd -literal -offset indent
+-------------------------------+
| 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
+-------+-------+---------------+
| Unused| Card | I/O Port Block|
+-------------------------------+
.Ed
.Pp
DIP switches 7 and 8 are unused, and must be left on.
.Pp
DIP switches 6 and 5 identify the card number of each
.Tn RocketPort
card.
The first card installed in the system must have its DIP switches set
as card number one; the second card installed in the system must have
its DIP switches set as card number two; and so on.
As shipped from
the factory, DIP switches 6 and 5 are both on by default, indicating
that this is the first card installed on the system:
.Bd -literal -offset indent
DIP Switches
6 5
===================
On On First Card
On Off Second Card
Off On Third Card
Off Off Fourth Card
.Ed
.Pp
DIP switches 4, 3, 2, and 1 indicate the I/O address range used by the
first
.Tn RocketPort
card.
If there are more than one
.Tn RocketPort
cards installed in a system,
the second, third and fourth
.Tn RocketPort
cards must
also be set to the I/O address range used by the first
.Tn RocketPort
card;
all cards must have these DIP switches set identically
for proper operation.
As shipped from the factory, DIP switch 4 is on,
and switches 3, 2, and 1 are off by default,
indicating an I/O address range used by the first
card which starts at 0x180 and extends to 0x1C3.
.Bd -literal -offset indent
DIP Switches I/O Address Range
4 3 2 1 Used by the First Card
=====================================
On Off On Off 100-143
On Off Off On 140-183
On Off Off Off 180-1C3
Off On On Off 200-243
Off On Off On 240-283
Off On Off Off 280-2C3
Off Off On Off 300-343
Off Off Off On 340-383
Off Off Off Off 380-3C3
.Ed
.Sh FILES
.Bl -tag -width ".Pa /dev/ttyR[0-4][0-9a-f]"
.It Pa /dev/ttyR[0-4][0-9a-f]
.El
.Sh AUTHORS
.An Theodore Ts'o Aq Mt tytso@mit.edu
.Pp
This driver was written under contract for Comtrol Corporation.
For dealer, distributor and other information regarding Comtrol
.Tn RocketPort ,
contact Comtrol Corporation at (800) 926-6876 or send email to
.Aq Mt info@comtrol.com .
To report bugs for this driver, please send email to
.Aq Mt bug-bsdi-rocketport@comtrol.com .
.Sh BUGS
If incoming software flow control is enabled on a 486 or Pentium
machine, and the flow control is very heavily exercised, on rare occasions
a character will get dropped.
This problem does not occur on a 386, and
it is not currently known whether the bug is in the
.Nm
driver
or in the
.Bsx
tty layer.
.\" (Although my bet is that it's in the higher-level tty layer;
.\" given the bugs I found while writing this driver, it's clear
.\" the BSD software flow control code has not been tested very much
.\" at all! -- TYT)

View File

@ -1541,9 +1541,6 @@ t6fw.fw optional cxgbe \
clean "t6fw.fw"
dev/cxgbe/crypto/t4_crypto.c optional ccr \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
dev/cy/cy.c optional cy
dev/cy/cy_isa.c optional cy isa
dev/cy/cy_pci.c optional cy pci
dev/cyapa/cyapa.c optional cyapa iicbus
dev/dc/if_dc.c optional dc pci
dev/dc/dcphy.c optional dc pci
@ -2775,14 +2772,10 @@ dev/random/random_harvestq.c standard
dev/random/randomdev.c optional !random_loadable
dev/random/fortuna.c optional !random_loadable
dev/random/hash.c optional !random_loadable
dev/rc/rc.c optional rc
dev/rccgpio/rccgpio.c optional rccgpio gpio
dev/re/if_re.c optional re
dev/rl/if_rl.c optional rl pci
dev/rndtest/rndtest.c optional rndtest
dev/rp/rp.c optional rp
dev/rp/rp_isa.c optional rp isa
dev/rp/rp_pci.c optional rp pci
#
dev/rtwn/if_rtwn.c optional rtwn
dev/rtwn/if_rtwn_beacon.c optional rtwn

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +0,0 @@
/*-
* cyclades cyclom-y serial driver
* Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1993 Andrew Herbert.
* 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 Andrew Herbert may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ``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 I 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.
*/
/*
* Cyclades Y ISA serial interface driver
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <isa/isavar.h>
#include <dev/cy/cyreg.h>
#include <dev/cy/cyvar.h>
static int cy_isa_attach(device_t dev);
static int cy_isa_probe(device_t dev);
static device_method_t cy_isa_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, cy_isa_probe),
DEVMETHOD(device_attach, cy_isa_attach),
{ 0, 0 }
};
static driver_t cy_isa_driver = {
cy_driver_name,
cy_isa_methods,
0,
};
DRIVER_MODULE(cy, isa, cy_isa_driver, cy_devclass, 0, 0);
static int
cy_isa_probe(device_t dev)
{
struct resource *mem_res;
cy_addr iobase;
int error, mem_rid;
if (isa_get_logicalid(dev) != 0) /* skip PnP probes */
return (ENXIO);
mem_rid = 0;
mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mem_rid,
RF_ACTIVE);
if (mem_res == NULL) {
device_printf(dev, "ioport resource allocation failed\n");
return (ENXIO);
}
iobase = rman_get_virtual(mem_res);
/* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */
cy_inb(iobase, CY16_RESET, 0); /* XXX? */
DELAY(500); /* wait for the board to get its act together */
/* this is needed to get the board out of reset */
cy_outb(iobase, CY_CLEAR_INTR, 0, 0);
DELAY(500);
error = (cy_units(iobase, 0) == 0 ? ENXIO : 0);
bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res);
return (error);
}
static int
cy_isa_attach(device_t dev)
{
struct resource *irq_res, *mem_res;
void *irq_cookie, *vaddr, *vsc;
int irq_rid, mem_rid;
irq_res = NULL;
mem_res = NULL;
mem_rid = 0;
mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mem_rid,
RF_ACTIVE);
if (mem_res == NULL) {
device_printf(dev, "memory resource allocation failed\n");
goto fail;
}
vaddr = rman_get_virtual(mem_res);
vsc = cyattach_common(vaddr, 0);
if (vsc == NULL) {
device_printf(dev, "no ports found!\n");
goto fail;
}
irq_rid = 0;
irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irq_rid,
RF_SHAREABLE | RF_ACTIVE);
if (irq_res == NULL) {
device_printf(dev, "interrupt resource allocation failed\n");
goto fail;
}
if (bus_setup_intr(dev, irq_res, INTR_TYPE_TTY,
cyintr, NULL, vsc, &irq_cookie) != 0) {
device_printf(dev, "interrupt setup failed\n");
goto fail;
}
return (0);
fail:
if (irq_res != NULL)
bus_release_resource(dev, SYS_RES_IRQ, irq_rid, irq_res);
if (mem_res != NULL)
bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res);
return (ENXIO);
}

View File

@ -1,194 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1996, David Greenman
* 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 unmodified, 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.
*/
/*
* Cyclades Y PCI serial interface driver
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_cy_pci_fastintr.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <dev/pci/pcivar.h>
#include <dev/cy/cyvar.h>
#define CY_PCI_BASE_ADDR0 0x10
#define CY_PCI_BASE_ADDR1 0x14
#define CY_PCI_BASE_ADDR2 0x18
#define CY_PLX_9050_ICS 0x4c
#define CY_PLX_9060_ICS 0x68
#define CY_PLX_9050_ICS_IENABLE 0x040
#define CY_PLX_9050_ICS_LOCAL_IENABLE 0x001
#define CY_PLX_9050_ICS_LOCAL_IPOLARITY 0x002
#define CY_PLX_9060_ICS_IENABLE 0x100
#define CY_PLX_9060_ICS_LOCAL_IENABLE 0x800
/* Cyclom-Y Custom Register for PLX ID. */
#define PLX_VER 0x3400
#define PLX_9050 0x0b
#define PLX_9060 0x0c
#define PLX_9080 0x0d
static int cy_pci_attach(device_t dev);
static int cy_pci_probe(device_t dev);
static device_method_t cy_pci_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, cy_pci_probe),
DEVMETHOD(device_attach, cy_pci_attach),
{ 0, 0 }
};
static driver_t cy_pci_driver = {
cy_driver_name,
cy_pci_methods,
0,
};
DRIVER_MODULE(cy, pci, cy_pci_driver, cy_devclass, 0, 0);
MODULE_DEPEND(cy, pci, 1, 1, 1);
static int
cy_pci_probe(dev)
device_t dev;
{
u_int32_t device_id;
device_id = pci_get_devid(dev);
device_id &= ~0x00060000;
if (device_id != 0x0100120e && device_id != 0x0101120e)
return (ENXIO);
device_set_desc(dev, "Cyclades Cyclom-Y Serial Adapter");
return (BUS_PROBE_DEFAULT);
}
static int
cy_pci_attach(dev)
device_t dev;
{
struct resource *ioport_res, *irq_res, *mem_res;
void *irq_cookie, *vaddr, *vsc;
u_int32_t ioport;
int irq_setup, ioport_rid, irq_rid, mem_rid;
u_char plx_ver;
ioport_res = NULL;
irq_res = NULL;
mem_res = NULL;
ioport_rid = CY_PCI_BASE_ADDR1;
ioport_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &ioport_rid,
RF_ACTIVE);
if (ioport_res == NULL) {
device_printf(dev, "ioport resource allocation failed\n");
goto fail;
}
ioport = rman_get_start(ioport_res);
mem_rid = CY_PCI_BASE_ADDR2;
mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mem_rid,
RF_ACTIVE);
if (mem_res == NULL) {
device_printf(dev, "memory resource allocation failed\n");
goto fail;
}
vaddr = rman_get_virtual(mem_res);
vsc = cyattach_common(vaddr, 1);
if (vsc == NULL) {
device_printf(dev, "no ports found!\n");
goto fail;
}
irq_rid = 0;
irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irq_rid,
RF_SHAREABLE | RF_ACTIVE);
if (irq_res == NULL) {
device_printf(dev, "interrupt resource allocation failed\n");
goto fail;
}
#ifdef CY_PCI_FASTINTR
irq_setup = bus_setup_intr(dev, irq_res, INTR_TYPE_TTY,
cyintr, NULL, vsc, &irq_cookie);
#else
irq_setup = ENXIO;
#endif
if (irq_setup != 0)
irq_setup = bus_setup_intr(dev, irq_res, INTR_TYPE_TTY,
NULL, (driver_intr_t *)cyintr, vsc, &irq_cookie);
if (irq_setup != 0) {
device_printf(dev, "interrupt setup failed\n");
goto fail;
}
/*
* Enable the "local" interrupt input to generate a
* PCI interrupt.
*/
plx_ver = *((u_char *)vaddr + PLX_VER) & 0x0f;
switch (plx_ver) {
case PLX_9050:
outw(ioport + CY_PLX_9050_ICS,
CY_PLX_9050_ICS_IENABLE | CY_PLX_9050_ICS_LOCAL_IENABLE |
CY_PLX_9050_ICS_LOCAL_IPOLARITY);
break;
case PLX_9060:
case PLX_9080:
default: /* Old board, use PLX_9060 values. */
outw(ioport + CY_PLX_9060_ICS,
inw(ioport + CY_PLX_9060_ICS) | CY_PLX_9060_ICS_IENABLE |
CY_PLX_9060_ICS_LOCAL_IENABLE);
break;
}
return (0);
fail:
if (ioport_res != NULL)
bus_release_resource(dev, SYS_RES_IOPORT, ioport_rid,
ioport_res);
if (irq_res != NULL)
bus_release_resource(dev, SYS_RES_IRQ, irq_rid, irq_res);
if (mem_res != NULL)
bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res);
return (ENXIO);
}

View File

@ -1,77 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1995 Bruce Evans.
* 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. Neither the name of the author nor the names of contributors
* may 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$
*/
/*
* Definitions for Cyclades Cyclom-Y serial boards.
*/
/*
* Cyclades register offsets. These are physical offsets for ISA boards
* and physical offsets divided by 2 for PCI boards.
*/
#define CY8_SVCACKR 0x100 /* (r) */
#define CY8_SVCACKT 0x200 /* (r) */
#define CY8_SVCACKM 0x300 /* (r) */
#define CY16_RESET 0x1400 /* (r) */
#define CY_CLEAR_INTR 0x1800 /* intr ack address (w) */
#define CY_MAX_CD1400s 8 /* for Cyclom-32Y */
#define CY_CLOCK(version) ((version) >= 0x48 ? 60000000 : 25000000)
#define CY_RTS_DTR_SWAPPED(version) ((version) >= 0x48)
/*
* The `cd' macros are for access to cd1400 registers. The `cy' macros
* are for access to Cyclades registers. Both sets of macros scale the
* register number to get an offset, but the scales are different for
* mostly historical reasons.
*/
#ifdef CyDebug
#define cd_inb(iobase, reg, cy_align) \
(++cd_inbs, *((iobase) + (2 * (reg) << (cy_align))))
#define cy_inb(iobase, reg, cy_align) \
(++cy_inbs, *((iobase) + ((reg) << (cy_align))))
#define cd_outb(iobase, reg, cy_align, val) \
(++cd_outbs, (void)(*((iobase) + (2 * (reg) << (cy_align))) = (val)))
#define cy_outb(iobase, reg, cy_align, val) \
(++cy_outbs, (void)(*((iobase) + ((reg) << (cy_align))) = (val)))
#else
#define cd_inb(iobase, reg, cy_align) \
(*((iobase) + (2 * (reg) << (cy_align))))
#define cy_inb(iobase, reg, cy_align) \
(*((iobase) + ((reg) << (cy_align))))
#define cd_outb(iobase, reg, cy_align, val) \
((void)(*((iobase) + (2 * (reg) << (cy_align))) = (val)))
#define cy_outb(iobase, reg, cy_align, val) \
((void)(*((iobase) + ((reg) << (cy_align))) = (val)))
#endif

View File

@ -1,38 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2004 Bruce D. Evans
* 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$
*/
typedef u_char volatile *cy_addr;
extern devclass_t cy_devclass;
extern char cy_driver_name[];
void *cyattach_common(cy_addr cy_iobase, int cy_align);
driver_filter_t cyintr;
int cy_units(cy_addr cy_iobase, int cy_align);

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (C) 1995 by Pavel Antonov, Moscow, Russia.
* Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia.
* All rights reserved.
* Copyright (C) 2002 by John Baldwin <jhb@FreeBSD.org>
*
* 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 AUTHORS ``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.
*
* $FreeBSD$
*/
/*
* Cirrus Logic CD180 -based RISCom/8 board definitions
*/
/* Oscillator frequency - 19660.08Mhz / 2 */
#define RC_OSCFREQ 9830400
#define RC_BRD(s) ((s) == 0 ? 0 : \
(((RC_OSCFREQ + (s) / 2) / (s)) + CD180_CTICKS/2) / CD180_CTICKS)
/* Riscom/8 board ISA I/O mapping */
#define RC_IOMAP(r) ((((r) & 07) << 1) | (((r) & ~07) << 7))
/* I/O commands */
#define RC_OUT(sc, addr, value) \
bus_space_write_1((sc)->sc_bt, (sc)->sc_bh, RC_IOMAP(addr), (value))
#define RC_IN(sc, addr) \
bus_space_read_1((sc)->sc_bt, (sc)->sc_bh, RC_IOMAP(addr))
/* Riscom on-board registers (mapping assumed) */
#define RC_RIREG 0x100 /* Ring Indicator Register (read-only) */
#define RC_DTREG 0x100 /* DTR Register (write-only) */
#define RC_BSR 0x101 /* Board Status Register (read-only) */
#define RC_CTOUT 0x101 /* Clear Timeout (write-only) */
/* Board Status Register */
#define RC_BSR_TOUT 0x08 /* Timeout */
#define RC_BSR_RXINT 0x04 /* Receiver Interrupt */
#define RC_BSR_TXINT 0x02 /* Transmitter Interrupt */
#define RC_BSR_MOINT 0x01 /* Modem Control Interrupt */
/* Interrupt groups */
#define RC_MODEMGRP 0x01 /* Modem interrupt group */
#define RC_RXGRP 0x02 /* Receiver interrupt group */
#define RC_TXGRP 0x04 /* Transmitter interrupt group */
/* Priority Interrupt Level definitions */
#define RC_PILR_MODEM (0x80 | RC_MODEMGRP)
#define RC_PILR_RX (0x80 | RC_RXGRP )
#define RC_PILR_TX (0x80 | RC_TXGRP )

File diff suppressed because it is too large Load Diff

View File

@ -1,508 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) Comtrol Corporation <support@comtrol.com>
* All rights reserved.
*
* ISA-specific part separated from:
* sys/i386/isa/rp.c,v 1.33 1999/09/28 11:45:27 phk Exp
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted prodived that the follwoing conditions
* are met.
* 1. Redistributions of source code must retain the above copyright
* notive, this list of conditions and the following disclainer.
* 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 prodided 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 Comtrol Corporation.
* 4. The name of Comtrol Corporation may not be used to endorse or
* promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY COMTROL CORPORATION ``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 COMTROL CORPORATION 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, LIFE 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.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/bus.h>
#include <sys/rman.h>
#define ROCKET_C
#include <dev/rp/rpreg.h>
#include <dev/rp/rpvar.h>
#include <isa/isavar.h>
/* ISA-specific part of CONTROLLER_t */
struct ISACONTROLLER_T {
int MBaseIO; /* rid of the Mudbac controller for this controller */
int MReg0IO; /* offset0 of the Mudbac controller for this controller */
int MReg1IO; /* offset1 of the Mudbac controller for this controller */
int MReg2IO; /* offset2 of the Mudbac controller for this controller */
int MReg3IO; /* offset3 of the Mudbac controller for this controller */
Byte_t MReg2;
Byte_t MReg3;
};
typedef struct ISACONTROLLER_T ISACONTROLLER_t;
#define ISACTL(ctlp) ((ISACONTROLLER_t *)((ctlp)->bus_ctlp))
/***************************************************************************
Function: sControllerEOI
Purpose: Strobe the MUDBAC's End Of Interrupt bit.
Call: sControllerEOI(MudbacCtlP,CtlP)
CONTROLLER_T *MudbacCtlP; Ptr to Mudbac controller structure
CONTROLLER_T *CtlP; Ptr to controller structure
*/
#define sControllerEOI(MudbacCtlP,CtlP) \
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg2IO,ISACTL(CtlP)->MReg2 | INT_STROB)
/***************************************************************************
Function: sDisAiop
Purpose: Disable I/O access to an AIOP
Call: sDisAiop(MudbacCtlP,CtlP)
CONTROLLER_T *MudbacCtlP; Ptr to Mudbac controller structure
CONTROLLER_T *CtlP; Ptr to controller structure
int AiopNum; Number of AIOP on controller
*/
#define sDisAiop(MudbacCtlP,CtlP,AIOPNUM) \
{ \
ISACTL(CtlP)->MReg3 &= rp_sBitMapClrTbl[AIOPNUM]; \
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg3IO,ISACTL(CtlP)->MReg3); \
}
/***************************************************************************
Function: sEnAiop
Purpose: Enable I/O access to an AIOP
Call: sEnAiop(MudbacCtlP,CtlP)
CONTROLLER_T *MudbacCtlP; Ptr to Mudbac controller structure
CONTROLLER_T *CtlP; Ptr to controller structure
int AiopNum; Number of AIOP on controller
*/
#define sEnAiop(MudbacCtlP,CtlP,AIOPNUM) \
{ \
ISACTL(CtlP)->MReg3 |= rp_sBitMapSetTbl[AIOPNUM]; \
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg3IO,ISACTL(CtlP)->MReg3); \
}
/***************************************************************************
Function: sGetControllerIntStatus
Purpose: Get the controller interrupt status
Call: sGetControllerIntStatus(MudbacCtlP,CtlP)
CONTROLLER_T *MudbacCtlP; Ptr to Mudbac controller structure
CONTROLLER_T *CtlP; Ptr to controller structure
Return: Byte_t: The controller interrupt status in the lower 4
bits. Bits 0 through 3 represent AIOP's 0
through 3 respectively. If a bit is set that
AIOP is interrupting. Bits 4 through 7 will
always be cleared.
*/
#define sGetControllerIntStatus(MudbacCtlP,CtlP) \
(rp_readio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg1IO) & 0x0f)
static devclass_t rp_devclass;
static CONTROLLER_t *rp_controller;
static int rp_nisadevs;
static int rp_probe(device_t dev);
static int rp_attach(device_t dev);
static void rp_isareleaseresource(CONTROLLER_t *ctlp);
static int sInitController(CONTROLLER_T *CtlP,
CONTROLLER_T *MudbacCtlP,
int AiopNum,
int IRQNum,
Byte_t Frequency,
int PeriodicOnly);
static rp_aiop2rid_t rp_isa_aiop2rid;
static rp_aiop2off_t rp_isa_aiop2off;
static rp_ctlmask_t rp_isa_ctlmask;
static int
rp_probe(device_t dev)
{
int unit;
CONTROLLER_t *controller;
int num_aiops;
CONTROLLER_t *ctlp;
int retval;
/*
* We have no PnP RocketPort cards.
* (At least according to LINT)
*/
if (isa_get_logicalid(dev) != 0)
return (ENXIO);
/* We need IO port resource to configure an ISA device. */
if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 0)
return (ENXIO);
unit = device_get_unit(dev);
if (unit >= 4) {
device_printf(dev, "rpprobe: unit number %d invalid.\n", unit);
return (ENXIO);
}
device_printf(dev, "probing for RocketPort(ISA) unit %d.\n", unit);
ctlp = device_get_softc(dev);
bzero(ctlp, sizeof(*ctlp));
ctlp->dev = dev;
ctlp->aiop2rid = rp_isa_aiop2rid;
ctlp->aiop2off = rp_isa_aiop2off;
ctlp->ctlmask = rp_isa_ctlmask;
/* The IO ports of AIOPs for an ISA controller are discrete. */
ctlp->io_num = 1;
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
device_printf(dev, "rp_attach: Out of memory.\n");
retval = ENOMEM;
goto nogo;
}
ctlp->bus_ctlp = malloc(sizeof(ISACONTROLLER_t) * 1, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->bus_ctlp == NULL) {
device_printf(dev, "rp_attach: Out of memory.\n");
retval = ENOMEM;
goto nogo;
}
ctlp->io_rid[0] = 0;
if (rp_controller != NULL) {
controller = rp_controller;
ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x40, RF_ACTIVE);
} else {
controller = rp_controller = ctlp;
ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x44, RF_ACTIVE);
}
if (ctlp->io[0] == NULL) {
device_printf(dev, "rp_attach: Resource not available.\n");
retval = ENXIO;
goto nogo;
}
num_aiops = sInitController(ctlp,
controller,
MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0);
if (num_aiops <= 0) {
device_printf(dev, "board%d init failed.\n", unit);
retval = ENXIO;
goto nogo;
}
if (rp_controller == NULL)
rp_controller = controller;
rp_nisadevs++;
device_set_desc(dev, "RocketPort ISA");
return (0);
nogo:
rp_isareleaseresource(ctlp);
return (retval);
}
static int
rp_attach(device_t dev)
{
int unit;
int num_ports, num_aiops;
int aiop;
CONTROLLER_t *ctlp;
int retval;
unit = device_get_unit(dev);
ctlp = device_get_softc(dev);
#ifdef notdef
num_aiops = sInitController(ctlp,
rp_controller,
MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0);
#else
num_aiops = ctlp->NumAiop;
#endif /* notdef */
num_ports = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
sResetAiopByNum(ctlp, aiop);
sEnAiop(rp_controller, ctlp, aiop);
num_ports += sGetAiopNumChan(ctlp, aiop);
}
retval = rp_attachcommon(ctlp, num_aiops, num_ports);
if (retval != 0)
goto nogo;
return (0);
nogo:
rp_isareleaseresource(ctlp);
return (retval);
}
static void
rp_isareleaseresource(CONTROLLER_t *ctlp)
{
int i;
rp_releaseresource(ctlp);
if (ctlp == rp_controller)
rp_controller = NULL;
if (ctlp->io != NULL) {
for (i = 0 ; i < MAX_AIOPS_PER_BOARD ; i++)
if (ctlp->io[i] != NULL)
bus_release_resource(ctlp->dev, SYS_RES_IOPORT, ctlp->io_rid[i], ctlp->io[i]);
free(ctlp->io, M_DEVBUF);
}
if (ctlp->io_rid != NULL)
free(ctlp->io_rid, M_DEVBUF);
if (rp_controller != NULL && rp_controller->io[ISACTL(ctlp)->MBaseIO] != NULL) {
bus_release_resource(rp_controller->dev, SYS_RES_IOPORT, rp_controller->io_rid[ISACTL(ctlp)->MBaseIO], rp_controller->io[ISACTL(ctlp)->MBaseIO]);
rp_controller->io[ISACTL(ctlp)->MBaseIO] = NULL;
rp_controller->io_rid[ISACTL(ctlp)->MBaseIO] = 0;
}
if (ctlp->bus_ctlp != NULL)
free(ctlp->bus_ctlp, M_DEVBUF);
}
/***************************************************************************
Function: sInitController
Purpose: Initialization of controller global registers and controller
structure.
Call: sInitController(CtlP,MudbacCtlP,AiopNum,
IRQNum,Frequency,PeriodicOnly)
CONTROLLER_T *CtlP; Ptr to controller structure
CONTROLLER_T *MudbacCtlP; Ptr to Mudbac controller structure
int AiopNum; Number of Aiops
int IRQNum; Interrupt Request number. Can be any of the following:
0: Disable global interrupts
3: IRQ 3
4: IRQ 4
5: IRQ 5
9: IRQ 9
10: IRQ 10
11: IRQ 11
12: IRQ 12
15: IRQ 15
Byte_t Frequency: A flag identifying the frequency
of the periodic interrupt, can be any one of the following:
FREQ_DIS - periodic interrupt disabled
FREQ_137HZ - 137 Hertz
FREQ_69HZ - 69 Hertz
FREQ_34HZ - 34 Hertz
FREQ_17HZ - 17 Hertz
FREQ_9HZ - 9 Hertz
FREQ_4HZ - 4 Hertz
If IRQNum is set to 0 the Frequency parameter is
overidden, it is forced to a value of FREQ_DIS.
int PeriodicOnly: TRUE if all interrupts except the periodic
interrupt are to be blocked.
FALSE is both the periodic interrupt and
other channel interrupts are allowed.
If IRQNum is set to 0 the PeriodicOnly parameter is
overidden, it is forced to a value of FALSE.
Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
initialization failed.
Comments:
If periodic interrupts are to be disabled but AIOP interrupts
are allowed, set Frequency to FREQ_DIS and PeriodicOnly to FALSE.
If interrupts are to be completely disabled set IRQNum to 0.
Setting Frequency to FREQ_DIS and PeriodicOnly to TRUE is an
invalid combination.
This function performs initialization of global interrupt modes,
but it does not actually enable global interrupts. To enable
and disable global interrupts use functions sEnGlobalInt() and
sDisGlobalInt(). Enabling of global interrupts is normally not
done until all other initializations are complete.
Even if interrupts are globally enabled, they must also be
individually enabled for each channel that is to generate
interrupts.
Warnings: No range checking on any of the parameters is done.
No context switches are allowed while executing this function.
After this function all AIOPs on the controller are disabled,
they can be enabled with sEnAiop().
*/
static int
sInitController( CONTROLLER_T *CtlP,
CONTROLLER_T *MudbacCtlP,
int AiopNum,
int IRQNum,
Byte_t Frequency,
int PeriodicOnly)
{
int i;
int ctl_base, aiop_base, aiop_size;
CtlP->CtlID = CTLID_0001; /* controller release 1 */
ISACTL(CtlP)->MBaseIO = rp_nisadevs;
if (MudbacCtlP->io[ISACTL(CtlP)->MBaseIO] != NULL) {
ISACTL(CtlP)->MReg0IO = 0x40 + 0;
ISACTL(CtlP)->MReg1IO = 0x40 + 1;
ISACTL(CtlP)->MReg2IO = 0x40 + 2;
ISACTL(CtlP)->MReg3IO = 0x40 + 3;
} else {
MudbacCtlP->io_rid[ISACTL(CtlP)->MBaseIO] = ISACTL(CtlP)->MBaseIO;
ctl_base = rman_get_start(MudbacCtlP->io[0]) + 0x40 + 0x400 * rp_nisadevs;
MudbacCtlP->io[ISACTL(CtlP)->MBaseIO] = bus_alloc_resource(MudbacCtlP->dev, SYS_RES_IOPORT, &CtlP->io_rid[ISACTL(CtlP)->MBaseIO], ctl_base, ctl_base + 3, 4, RF_ACTIVE);
ISACTL(CtlP)->MReg0IO = 0;
ISACTL(CtlP)->MReg1IO = 1;
ISACTL(CtlP)->MReg2IO = 2;
ISACTL(CtlP)->MReg3IO = 3;
}
#if 1
ISACTL(CtlP)->MReg2 = 0; /* interrupt disable */
ISACTL(CtlP)->MReg3 = 0; /* no periodic interrupts */
#else
if(sIRQMap[IRQNum] == 0) /* interrupts globally disabled */
{
ISACTL(CtlP)->MReg2 = 0; /* interrupt disable */
ISACTL(CtlP)->MReg3 = 0; /* no periodic interrupts */
}
else
{
ISACTL(CtlP)->MReg2 = sIRQMap[IRQNum]; /* set IRQ number */
ISACTL(CtlP)->MReg3 = Frequency; /* set frequency */
if(PeriodicOnly) /* periodic interrupt only */
{
ISACTL(CtlP)->MReg3 |= PERIODIC_ONLY;
}
}
#endif
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg2IO,ISACTL(CtlP)->MReg2);
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,ISACTL(CtlP)->MReg3IO,ISACTL(CtlP)->MReg3);
sControllerEOI(MudbacCtlP,CtlP); /* clear EOI if warm init */
/* Init AIOPs */
CtlP->NumAiop = 0;
for(i=0; i < AiopNum; i++)
{
if (CtlP->io[i] == NULL) {
CtlP->io_rid[i] = i;
aiop_base = rman_get_start(CtlP->io[0]) + 0x400 * i;
if (rp_nisadevs == 0)
aiop_size = 0x44;
else
aiop_size = 0x40;
CtlP->io[i] = bus_alloc_resource(CtlP->dev, SYS_RES_IOPORT, &CtlP->io_rid[i], aiop_base, aiop_base + aiop_size - 1, aiop_size, RF_ACTIVE);
} else
aiop_base = rman_get_start(CtlP->io[i]);
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,
ISACTL(CtlP)->MReg2IO,
ISACTL(CtlP)->MReg2 | (i & 0x03)); /* AIOP index */
rp_writeio1(MudbacCtlP,ISACTL(CtlP)->MBaseIO,
ISACTL(CtlP)->MReg0IO,
(Byte_t)(aiop_base >> 6)); /* set up AIOP I/O in MUDBAC */
sEnAiop(MudbacCtlP,CtlP,i); /* enable the AIOP */
CtlP->AiopID[i] = sReadAiopID(CtlP, i); /* read AIOP ID */
if(CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
{
sDisAiop(MudbacCtlP,CtlP,i); /* disable AIOP */
bus_release_resource(CtlP->dev, SYS_RES_IOPORT, CtlP->io_rid[i], CtlP->io[i]);
CtlP->io[i] = NULL;
break; /* done looking for AIOPs */
}
CtlP->AiopNumChan[i] = sReadAiopNumChan(CtlP, i); /* num channels in AIOP */
rp_writeaiop2(CtlP,i,_INDX_ADDR,_CLK_PRE); /* clock prescaler */
rp_writeaiop1(CtlP,i,_INDX_DATA,CLOCK_PRESC);
CtlP->NumAiop++; /* bump count of AIOPs */
sDisAiop(MudbacCtlP,CtlP,i); /* disable AIOP */
}
if(CtlP->NumAiop == 0)
return(-1);
else
return(CtlP->NumAiop);
}
/*
* ARGSUSED
* Maps (aiop, offset) to rid.
*/
static int
rp_isa_aiop2rid(int aiop, int offset)
{
/* rid equals to aiop for an ISA controller. */
return aiop;
}
/*
* ARGSUSED
* Maps (aiop, offset) to the offset of resource.
*/
static int
rp_isa_aiop2off(int aiop, int offset)
{
/* Each aiop has its own resource. */
return offset;
}
/* Read the int status for an ISA controller. */
static unsigned char
rp_isa_ctlmask(CONTROLLER_t *ctlp)
{
return sGetControllerIntStatus(rp_controller,ctlp);
}
static device_method_t rp_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, rp_probe),
DEVMETHOD(device_attach, rp_attach),
{ 0, 0 }
};
static driver_t rp_driver = {
"rp",
rp_methods,
sizeof(CONTROLLER_t),
};
/*
* rp can be attached to an isa bus.
*/
DRIVER_MODULE(rp, isa, rp_driver, rp_devclass, 0, 0);

View File

@ -1,368 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) Comtrol Corporation <support@comtrol.com>
* All rights reserved.
*
* PCI-specific part separated from:
* sys/i386/isa/rp.c,v 1.33 1999/09/28 11:45:27 phk Exp
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted prodived that the follwoing conditions
* are met.
* 1. Redistributions of source code must retain the above copyright
* notive, this list of conditions and the following disclainer.
* 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 prodided 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 Comtrol Corporation.
* 4. The name of Comtrol Corporation may not be used to endorse or
* promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY COMTROL CORPORATION ``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 COMTROL CORPORATION 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, LIFE 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/bus.h>
#include <sys/rman.h>
#define ROCKET_C
#include <dev/rp/rpreg.h>
#include <dev/rp/rpvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
/* PCI IDs */
#define RP_VENDOR_ID 0x11FE
#define RP_DEVICE_ID_32I 0x0001
#define RP_DEVICE_ID_8I 0x0002
#define RP_DEVICE_ID_16I 0x0003
#define RP_DEVICE_ID_4Q 0x0004
#define RP_DEVICE_ID_8O 0x0005
#define RP_DEVICE_ID_8J 0x0006
#define RP_DEVICE_ID_4J 0x0007
#define RP_DEVICE_ID_6M 0x000C
#define RP_DEVICE_ID_4M 0x000D
#define RP_DEVICE_ID_UPCI_32 0x0801
#define RP_DEVICE_ID_UPCI_16 0x0803
#define RP_DEVICE_ID_UPCI_8O 0x0805
/**************************************************************************
MUDBAC remapped for PCI
**************************************************************************/
#define _CFG_INT_PCI 0x40
#define _PCI_INT_FUNC 0x3A
#define PCI_STROB 0x2000
#define INTR_EN_PCI 0x0010
/***************************************************************************
Function: sPCIControllerEOI
Purpose: Strobe the MUDBAC's End Of Interrupt bit.
Call: sPCIControllerEOI(CtlP)
CONTROLLER_T *CtlP; Ptr to controller structure
*/
#define sPCIControllerEOI(CtlP) rp_writeio2(CtlP, 0, _PCI_INT_FUNC, PCI_STROB)
/***************************************************************************
Function: sPCIGetControllerIntStatus
Purpose: Get the controller interrupt status
Call: sPCIGetControllerIntStatus(CtlP)
CONTROLLER_T *CtlP; Ptr to controller structure
Return: Byte_t: The controller interrupt status in the lower 4
bits. Bits 0 through 3 represent AIOP's 0
through 3 respectively. If a bit is set that
AIOP is interrupting. Bits 4 through 7 will
always be cleared.
*/
#define sPCIGetControllerIntStatus(CTLP) ((rp_readio2(CTLP, 0, _PCI_INT_FUNC) >> 8) & 0x1f)
static devclass_t rp_devclass;
static int rp_pciprobe(device_t dev);
static int rp_pciattach(device_t dev);
#ifdef notdef
static int rp_pcidetach(device_t dev);
static int rp_pcishutdown(device_t dev);
#endif /* notdef */
static void rp_pcireleaseresource(CONTROLLER_t *ctlp);
static int sPCIInitController( CONTROLLER_t *CtlP,
int AiopNum,
int IRQNum,
Byte_t Frequency,
int PeriodicOnly,
int VendorDevice);
static rp_aiop2rid_t rp_pci_aiop2rid;
static rp_aiop2off_t rp_pci_aiop2off;
static rp_ctlmask_t rp_pci_ctlmask;
/*
* The following functions are the pci-specific part
* of rp driver.
*/
static int
rp_pciprobe(device_t dev)
{
char *s;
s = NULL;
if (pci_get_vendor(dev) == RP_VENDOR_ID)
s = "RocketPort PCI";
if (s != NULL) {
device_set_desc(dev, s);
return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
}
static int
rp_pciattach(device_t dev)
{
int num_ports, num_aiops;
int aiop;
CONTROLLER_t *ctlp;
int unit;
int retval;
ctlp = device_get_softc(dev);
bzero(ctlp, sizeof(*ctlp));
ctlp->dev = dev;
unit = device_get_unit(dev);
ctlp->aiop2rid = rp_pci_aiop2rid;
ctlp->aiop2off = rp_pci_aiop2off;
ctlp->ctlmask = rp_pci_ctlmask;
/* The IO ports of AIOPs for a PCI controller are continuous. */
ctlp->io_num = 1;
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
device_printf(dev, "rp_pciattach: Out of memory.\n");
retval = ENOMEM;
goto nogo;
}
ctlp->bus_ctlp = NULL;
switch (pci_get_device(dev)) {
case RP_DEVICE_ID_UPCI_16:
case RP_DEVICE_ID_UPCI_32:
case RP_DEVICE_ID_UPCI_8O:
ctlp->io_rid[0] = PCIR_BAR(2);
break;
default:
ctlp->io_rid[0] = PCIR_BAR(0);
break;
}
ctlp->io[0] = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
&ctlp->io_rid[0], RF_ACTIVE);
if(ctlp->io[0] == NULL) {
device_printf(dev, "ioaddr mapping failed for RocketPort(PCI).\n");
retval = ENXIO;
goto nogo;
}
num_aiops = sPCIInitController(ctlp,
MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0, pci_get_device(dev));
num_ports = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
sResetAiopByNum(ctlp, aiop);
num_ports += sGetAiopNumChan(ctlp, aiop);
}
retval = rp_attachcommon(ctlp, num_aiops, num_ports);
if (retval != 0)
goto nogo;
return (0);
nogo:
rp_pcireleaseresource(ctlp);
return (retval);
}
static int
rp_pcidetach(device_t dev)
{
CONTROLLER_t *ctlp;
ctlp = device_get_softc(dev);
rp_pcireleaseresource(ctlp);
return (0);
}
static int
rp_pcishutdown(device_t dev)
{
CONTROLLER_t *ctlp;
ctlp = device_get_softc(dev);
rp_pcireleaseresource(ctlp);
return (0);
}
static void
rp_pcireleaseresource(CONTROLLER_t *ctlp)
{
rp_releaseresource(ctlp);
if (ctlp->io != NULL) {
if (ctlp->io[0] != NULL)
bus_release_resource(ctlp->dev, SYS_RES_IOPORT, ctlp->io_rid[0], ctlp->io[0]);
free(ctlp->io, M_DEVBUF);
ctlp->io = NULL;
}
if (ctlp->io_rid != NULL) {
free(ctlp->io_rid, M_DEVBUF);
ctlp->io = NULL;
}
}
static int
sPCIInitController( CONTROLLER_t *CtlP,
int AiopNum,
int IRQNum,
Byte_t Frequency,
int PeriodicOnly,
int VendorDevice)
{
int i;
CtlP->CtlID = CTLID_0001; /* controller release 1 */
sPCIControllerEOI(CtlP);
/* Init AIOPs */
CtlP->NumAiop = 0;
for(i=0; i < AiopNum; i++)
{
/*device_printf(CtlP->dev, "aiop %d.\n", i);*/
CtlP->AiopID[i] = sReadAiopID(CtlP, i); /* read AIOP ID */
/*device_printf(CtlP->dev, "ID = %d.\n", CtlP->AiopID[i]);*/
if(CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
{
break; /* done looking for AIOPs */
}
switch( VendorDevice ) {
case RP_DEVICE_ID_4Q:
case RP_DEVICE_ID_4J:
case RP_DEVICE_ID_4M:
CtlP->AiopNumChan[i] = 4;
break;
case RP_DEVICE_ID_6M:
CtlP->AiopNumChan[i] = 6;
break;
case RP_DEVICE_ID_8O:
case RP_DEVICE_ID_8J:
case RP_DEVICE_ID_8I:
case RP_DEVICE_ID_16I:
case RP_DEVICE_ID_32I:
CtlP->AiopNumChan[i] = 8;
break;
default:
#ifdef notdef
CtlP->AiopNumChan[i] = 8;
#else
CtlP->AiopNumChan[i] = sReadAiopNumChan(CtlP, i);
#endif /* notdef */
break;
}
/*device_printf(CtlP->dev, "%d channels.\n", CtlP->AiopNumChan[i]);*/
rp_writeaiop2(CtlP, i, _INDX_ADDR,_CLK_PRE); /* clock prescaler */
/*device_printf(CtlP->dev, "configuring clock prescaler.\n");*/
rp_writeaiop1(CtlP, i, _INDX_DATA,CLOCK_PRESC);
/*device_printf(CtlP->dev, "configured clock prescaler.\n");*/
CtlP->NumAiop++; /* bump count of AIOPs */
}
if(CtlP->NumAiop == 0)
return(-1);
else
return(CtlP->NumAiop);
}
/*
* ARGSUSED
* Maps (aiop, offset) to rid.
*/
static int
rp_pci_aiop2rid(int aiop, int offset)
{
/* Always return zero for a PCI controller. */
return 0;
}
/*
* ARGSUSED
* Maps (aiop, offset) to the offset of resource.
*/
static int
rp_pci_aiop2off(int aiop, int offset)
{
/* Each AIOP reserves 0x40 bytes. */
return aiop * 0x40 + offset;
}
/* Read the int status for a PCI controller. */
static unsigned char
rp_pci_ctlmask(CONTROLLER_t *ctlp)
{
return sPCIGetControllerIntStatus(ctlp);
}
static device_method_t rp_pcimethods[] = {
/* Device interface */
DEVMETHOD(device_probe, rp_pciprobe),
DEVMETHOD(device_attach, rp_pciattach),
DEVMETHOD(device_detach, rp_pcidetach),
DEVMETHOD(device_shutdown, rp_pcishutdown),
{ 0, 0 }
};
static driver_t rp_pcidriver = {
"rp",
rp_pcimethods,
sizeof(CONTROLLER_t),
};
/*
* rp can be attached to a pci bus.
*/
DRIVER_MODULE(rp, pci, rp_pcidriver, rp_devclass, 0, 0);

File diff suppressed because it is too large Load Diff

View File

@ -1,76 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) Comtrol Corporation <support@comtrol.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted prodived that the follwoing conditions
* are met.
* 1. Redistributions of source code must retain the above copyright
* notive, this list of conditions and the following disclainer.
* 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 prodided 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 Comtrol Corporation.
* 4. The name of Comtrol Corporation may not be used to endorse or
* promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY COMTROL CORPORATION ``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 COMTROL CORPORATION 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, LIFE 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$
*/
/*
* rpvar.h --- RocketPort data structure includes for FreeBSD
*/
#define RP_UNIT(x) dv_unit(x)
#define RP_PORT(x) (dev2unit(x) & 0x3f)
#define MAX_RP_PORTS 128
struct rp_port {
struct tty * rp_tty; /* cross reference */
struct callout rp_timer;
unsigned char state; /* state of dtr */
int rp_port;
int rp_flags;
int rp_unit:2;
int rp_aiop:2;
int rp_chan:3;
int rp_intmask;
int rp_imask; /* Input mask */
int rp_fifo_lw;
int rp_restart;
int rp_overflows;
int rp_rts_iflow:1;
int rp_disable_writes:1;
int rp_cts:1;
int rp_waiting:1;
int rp_xmit_stopped:1;
CONTROLLER_t * rp_ctlp;
CHANNEL_t rp_channel;
unsigned char TxBuf[TXFIFO_SIZE];
unsigned char RxBuf[RXFIFO_SIZE];
};
/* Actually not used */
#ifdef notdef
extern struct termios deftermios;
#endif /* notdef */

View File

@ -1,8 +0,0 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/rc
KMOD= rc
SRCS= rc.c device_if.h bus_if.h isa_if.h
.include <bsd.kmod.mk>

View File

@ -1,8 +0,0 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/rp
KMOD= rp
SRCS= rp.c rp_pci.c device_if.h bus_if.h pci_if.h
.include <bsd.kmod.mk>