/* rio_linux.c -- Linux driver for the Specialix RIO series cards.
*
*
* (C) 1999 R.E.Wolff@BitWizard.nl
*
* Specialix pays for the development and support of this driver.
* Please DO contact support@specialix.co.uk if you require
* support. But please read the documentation (rio.txt) first.
*
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
* USA.
*
* */
#include <linux/module.h>
#include <linux/kdev_t.h>
#include <asm/io.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/serial.h>
#include <linux/fcntl.h>
#include <linux/major.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
#include <linux/generic_serial.h>
#include <asm/uaccess.h>
#include "linux_compat.h"
#include "pkt.h"
#include "daemon.h"
#include "rio.h"
#include "riospace.h"
#include "cmdpkt.h"
#include "map.h"
#include "rup.h"
#include "port.h"
#include "riodrvr.h"
#include "rioinfo.h"
#include "func.h"
#include "errors.h"
#include "pci.h"
#include "parmmap.h"
#include "unixrup.h"
#include "board.h"
#include "host.h"
#include "phb.h"
#include "link.h"
#include "cmdblk.h"
#include "route.h"
#include "cirrus.h"
#include "rioioctl.h"
#include "param.h"
#include "protsts.h"
#include "rioboard.h"
#include "rio_linux.h"
/* I don't think that this driver can handle more than 512 ports on
one machine. Specialix specifies max 4 boards in one machine. I don't
know why. If you want to try anyway you'll have to increase the number
of boards in rio.h. You'll have to allocate more majors if you need
more than 512 ports.... */
#ifndef RIO_NORMAL_MAJOR0
/* This allows overriding on the compiler commandline, or in a "major.h"
include or something like that */
#define RIO_NORMAL_MAJOR0 154
#define RIO_NORMAL_MAJOR1 156
#endif
#ifndef PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8
#define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
#endif
#ifndef RIO_WINDOW_LEN
#define RIO_WINDOW_LEN 0x10000
#endif
/* Configurable options:
(Don't be too sure that it'll work if you toggle them) */
/* Am I paranoid or not ? ;-) */
#undef RIO_PARANOIA_CHECK
/* 20 -> 2000 per second. The card should rate-limit interrupts at 1000
Hz, but it is user configurable. I don't recommend going above 1000
Hz. The interrupt ratelimit might trigger if the interrupt is
shared with a very active other device.
undef this if you want to disable the check....
*/
#define IRQ_RATE_LIMIT 200
/* These constants are derived from SCO Source */
static struct Conf
RIOConf = {
/* locator */ "RIO Config here",
/* startuptime */ HZ * 2,
/* how long to wait for card to run */
/* slowcook */ 0,
/* TRUE -> always use line disc. */
/* intrpolltime */ 1,
/* The frequency of OUR polls */
/* breakinterval */ 25,
/* x10 mS XXX: units seem to be 1ms not 10! -- REW */
/* timer */ 10,
/* mS */
/* RtaLoadBase */ 0x7000,
/* HostLoadBase */ 0x7C00,
/* XpHz */ 5,
/* number of Xprint hits per second */
/* XpCps */ 120,
/* Xprint characters per second */
/* XpOn */ "\033d#",
/* start Xprint for a wyse 60 */
/* XpOff */ "\024",
/* end Xprint for a wyse 60 */
/* MaxXpCps */ 2000,
/* highest Xprint speed */
/* MinXpCps */ 10,
/* slowest Xprint speed */
/* SpinCmds */ 1,
/* non-zero for mega fast boots */
/* First Addr */ 0x0A0000,
/* First address to look at */
/* Last Addr */ 0xFF0000,
/* Last address looked at */
/* BufferSize */ 1024,
/* Bytes per port of buffering */
/* LowWater */ 256,
/* how much data left before wakeup */
/* LineLength */ 80,
/* how wide is the console? */
/* CmdTimeout */ HZ,
/* how long a close command may take */
};
/* Function prototypes */
static void rio_disable_tx_interrupts(void *ptr);
static void rio_enable_tx_interrupts(void *ptr);
static void rio_disable_rx_interrupts(void *ptr);
static void rio_enable_rx_interrupts(void *ptr);
static int rio_carrier_raised(struct tty_port *