Revert r317446 and bring back cy(4).
Requested by: bde
This commit is contained in:
parent
0607c830b3
commit
32455e8912
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317509
@ -42,8 +42,6 @@
|
|||||||
OLD_FILES+=etc/rc.d/atm1
|
OLD_FILES+=etc/rc.d/atm1
|
||||||
OLD_FILES+=etc/rc.d/atm2
|
OLD_FILES+=etc/rc.d/atm2
|
||||||
OLD_FILES+=etc/rc.d/atm3
|
OLD_FILES+=etc/rc.d/atm3
|
||||||
# 20170426: Remove cy(4)
|
|
||||||
OLD_FILES+=usr/share/man/man4/cy.4.gz
|
|
||||||
# 20170424: NATM support removed
|
# 20170424: NATM support removed
|
||||||
OLD_FILES+=rescue/atmconfig
|
OLD_FILES+=rescue/atmconfig
|
||||||
OLD_FILES+=sbin/atmconfig
|
OLD_FILES+=sbin/atmconfig
|
||||||
|
@ -118,6 +118,7 @@ MAN= aac.4 \
|
|||||||
cxgb.4 \
|
cxgb.4 \
|
||||||
cxgbe.4 \
|
cxgbe.4 \
|
||||||
cxgbev.4 \
|
cxgbev.4 \
|
||||||
|
cy.4 \
|
||||||
cyapa.4 \
|
cyapa.4 \
|
||||||
da.4 \
|
da.4 \
|
||||||
dc.4 \
|
dc.4 \
|
||||||
|
257
share/man/man4/cy.4
Normal file
257
share/man/man4/cy.4
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
.\" 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.
|
@ -1425,6 +1425,9 @@ t6fw.fw optional cxgbe \
|
|||||||
compile-with "${NORMAL_FW}" \
|
compile-with "${NORMAL_FW}" \
|
||||||
no-obj no-implicit-rule \
|
no-obj no-implicit-rule \
|
||||||
clean "t6fw.fw"
|
clean "t6fw.fw"
|
||||||
|
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/cyapa/cyapa.c optional cyapa iicbus
|
||||||
dev/dc/if_dc.c optional dc pci
|
dev/dc/if_dc.c optional dc pci
|
||||||
dev/dc/dcphy.c optional dc pci
|
dev/dc/dcphy.c optional dc pci
|
||||||
|
2242
sys/dev/cy/cy.c
Normal file
2242
sys/dev/cy/cy.c
Normal file
File diff suppressed because it is too large
Load Diff
150
sys/dev/cy/cy_isa.c
Normal file
150
sys/dev/cy/cy_isa.c
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/*-
|
||||||
|
* cyclades cyclom-y serial driver
|
||||||
|
* Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
}
|
192
sys/dev/cy/cy_pci.c
Normal file
192
sys/dev/cy/cy_pci.c
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
/*-
|
||||||
|
* 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);
|
||||||
|
}
|
75
sys/dev/cy/cyreg.h
Normal file
75
sys/dev/cy/cyreg.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*-
|
||||||
|
* 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
|
36
sys/dev/cy/cyvar.h
Normal file
36
sys/dev/cy/cyvar.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*-
|
||||||
|
* 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);
|
Loading…
Reference in New Issue
Block a user