summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-02-22 16:57:21 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-22 16:57:21 -0800
commit4a6514e6d096716fb7bedf238efaaca877e2a7e8 (patch)
treee3601ee168cca90307ac91e750a86d6ed04eab01 /drivers/char
parent282361a046edd9d58a134f358a3f65a7cb8655d9 (diff)
tty: move obsolete and broken tty drivers to drivers/staging/tty/
As planned by Arnd Bergmann, this moves the following drivers to the drivers/staging/tty/ directory where they will be removed after 2.6.41 if no one steps up to claim them. epca epca ip2 istallion riscom8 serial167 specialix stallion Cc: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig79
-rw-r--r--drivers/char/Makefile7
-rw-r--r--drivers/char/epca.c2784
-rw-r--r--drivers/char/epca.h158
-rw-r--r--drivers/char/epcaconfig.h7
-rw-r--r--drivers/char/ip2/Makefile8
-rw-r--r--drivers/char/ip2/i2cmd.c210
-rw-r--r--drivers/char/ip2/i2cmd.h630
-rw-r--r--drivers/char/ip2/i2ellis.c1403
-rw-r--r--drivers/char/ip2/i2ellis.h566
-rw-r--r--drivers/char/ip2/i2hw.h652
-rw-r--r--drivers/char/ip2/i2lib.c2214
-rw-r--r--drivers/char/ip2/i2lib.h351
-rw-r--r--drivers/char/ip2/i2pack.h364
-rw-r--r--drivers/char/ip2/ip2.h107
-rw-r--r--drivers/char/ip2/ip2ioctl.h35
-rw-r--r--drivers/char/ip2/ip2main.c3234
-rw-r--r--drivers/char/ip2/ip2trace.h42
-rw-r--r--drivers/char/ip2/ip2types.h57
-rw-r--r--drivers/char/istallion.c4507
-rw-r--r--drivers/char/riscom8.c1560
-rw-r--r--drivers/char/riscom8.h91
-rw-r--r--drivers/char/riscom8_reg.h254
-rw-r--r--drivers/char/serial167.c2489
-rw-r--r--drivers/char/specialix.c2368
-rw-r--r--drivers/char/specialix_io8.h140
-rw-r--r--drivers/char/stallion.c4651
27 files changed, 0 insertions, 28968 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 1adfac6a7b0b..7b8cf0295f6c 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -15,63 +15,6 @@ config DEVKMEM
kind of kernel debugging operations.
When in doubt, say "N".
-config COMPUTONE
- tristate "Computone IntelliPort Plus serial support"
- depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
- ---help---
- This driver supports the entire family of Intelliport II/Plus
- controllers with the exception of the MicroChannel controllers and
- products previous to the Intelliport II. These are multiport cards,
- which give you many serial ports. You would need something like this
- to connect more than two modems to your Linux box, for instance in
- order to become a dial-in server. If you have a card like that, say
- Y here and read <file:Documentation/serial/computone.txt>.
-
- To compile this driver as module, choose M here: the
- module will be called ip2.
-
-config DIGIEPCA
- tristate "Digiboard Intelligent Async Support"
- depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
- ---help---
- This is a driver for Digi International's Xx, Xeve, and Xem series
- of cards which provide multiple serial ports. You would need
- something like this to connect more than two modems to your Linux
- box, for instance in order to become a dial-in server. This driver
- supports the original PC (ISA) boards as well as PCI, and EISA. If
- you have a card like this, say Y here and read the file
- <file:Documentation/serial/digiepca.txt>.
-
- To compile this driver as a module, choose M here: the
- module will be called epca.
-
-config RISCOM8
- tristate "SDL RISCom/8 card support"
- depends on SERIAL_NONSTANDARD
- help
- This is a driver for the SDL Communications RISCom/8 multiport card,
- which gives you many serial ports. You would need something like
- this to connect more than two modems to your Linux box, for instance
- in order to become a dial-in server. If you have a card like that,
- say Y here and read the file <file:Documentation/serial/riscom8.txt>.
-
- Also it's possible to say M here and compile this driver as kernel
- loadable module; the module will be called riscom8.
-
-config SPECIALIX
- tristate "Specialix IO8+ card support"
- depends on SERIAL_NONSTANDARD
- help
- This is a driver for the Specialix IO8+ multiport card (both the
- ISA and the PCI version) which gives you many serial ports. You
- would need something like this to connect more than two modems to
- your Linux box, for instance in order to become a dial-in server.
-
- If you have a card like that, say Y here and read the file
- <file:Documentation/serial/specialix.txt>. Also it's possible to say
- M here and compile this driver as kernel loadable module which will be
- called specialix.
-
config SX
tristate "Specialix SX (and SI) card support"
depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
@@ -112,28 +55,6 @@ config STALDRV
in this case. If you have never heard about all this, it's safe to
say N.
-config STALLION
- tristate "Stallion EasyIO or EC8/32 support"
- depends on STALDRV && (ISA || EISA || PCI)
- help
- If you have an EasyIO or EasyConnection 8/32 multiport Stallion
- card, then this is for you; say Y. Make sure to read
- <file:Documentation/serial/stallion.txt>.
-
- To compile this driver as a module, choose M here: the
- module will be called stallion.
-
-config ISTALLION
- tristate "Stallion EC8/64, ONboard, Brumby support"
- depends on STALDRV && (ISA || EISA || PCI)
- help
- If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
- serial multiport card, say Y here. Make sure to read
- <file:Documentation/serial/stallion.txt>.
-
- To compile this driver as a module, choose M here: the
- module will be called istallion.
-
config A2232
tristate "Commodore A2232 serial support (EXPERIMENTAL)"
depends on EXPERIMENTAL && ZORRO && BROKEN
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index f5dc7c9bce6b..48bb8acbea49 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -8,15 +8,8 @@ obj-y += misc.o
obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
-obj-$(CONFIG_SERIAL167) += serial167.o
-obj-$(CONFIG_STALLION) += stallion.o
-obj-$(CONFIG_ISTALLION) += istallion.o
-obj-$(CONFIG_DIGIEPCA) += epca.o
-obj-$(CONFIG_SPECIALIX) += specialix.o
obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
-obj-$(CONFIG_COMPUTONE) += ip2/
-obj-$(CONFIG_RISCOM8) += riscom8.o
obj-$(CONFIG_SX) += sx.o generic_serial.o
obj-$(CONFIG_RIO) += rio/ generic_serial.o
obj-$(CONFIG_RAW_DRIVER) += raw.o
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
deleted file mode 100644
index 7ad3638967ae..000000000000
--- a/drivers/char/epca.c
+++ /dev/null
@@ -1,2784 +0,0 @@
-/*
- Copyright (C) 1996 Digi International.
-
- For technical support please email digiLinux@dgii.com or
- call Digi tech support at (612) 912-3456
-
- ** This driver is no longer supported by Digi **
-
- Much of this design and code came from epca.c which was
- copyright (C) 1994, 1995 Troy De Jongh, and subsquently
- modified by David Nugent, Christoph Lameter, Mike McLagan.
-
- 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.
-*/
-/* See README.epca for change history --DAT*/
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/serial.h>
-#include <linux/delay.h>
-#include <linux/ctype.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/interrupt.h>
-#include <linux/uaccess.h>
-#include <linux/io.h>
-#include <linux/spinlock.h>
-#include <linux/pci.h>
-#include "digiPCI.h"
-
-
-#include "digi1.h"
-#include "digiFep1.h"
-#include "epca.h"
-#include "epcaconfig.h"
-
-#define VERSION "1.3.0.1-LK2.6"
-
-/* This major needs to be submitted to Linux to join the majors list */
-#define DIGIINFOMAJOR 35 /* For Digi specific ioctl */
-
-
-#define MAXCARDS 7
-#define epcaassert(x, msg) if (!(x)) epca_error(__LINE__, msg)
-
-#define PFX "epca: "
-
-static int nbdevs, num_cards, liloconfig;
-static int digi_poller_inhibited = 1 ;
-
-static int setup_error_code;
-static int invalid_lilo_config;
-
-/*
- * The ISA boards do window flipping into the same spaces so its only sane with
- * a single lock. It's still pretty efficient. This lock guards the hardware
- * and the tty_port lock guards the kernel side stuff like use counts. Take
- * this lock inside the port lock if you must take both.
- */
-static DEFINE_SPINLOCK(epca_lock);
-
-/* MAXBOARDS is typically 12, but ISA and EISA cards are restricted
- to 7 below. */
-static struct board_info boards[MAXBOARDS];
-
-static struct tty_driver *pc_driver;
-static struct tty_driver *pc_info;
-
-/* ------------------ Begin Digi specific structures -------------------- */
-
-/*
- * digi_channels represents an array of structures that keep track of each
- * channel of the Digi product. Information such as transmit and receive
- * pointers, termio data, and signal definitions (DTR, CTS, etc ...) are stored
- * here. This structure is NOT used to overlay the cards physical channel
- * structure.
- */
-static struct channel digi_channels[MAX_ALLOC];
-
-/*
- * card_ptr is an array used to hold the address of the first channel structure
- * of each card. This array will hold the addresses of various channels located
- * in digi_channels.
- */
-static struct channel *card_ptr[MAXCARDS];
-
-static struct timer_list epca_timer;
-
-/*
- * Begin generic memory functions. These functions will be alias (point at)
- * more specific functions dependent on the board being configured.
- */
-static void memwinon(struct board_info *b, unsigned int win);
-static void memwinoff(struct board_info *b, unsigned int win);
-static void globalwinon(struct channel *ch);
-static void rxwinon(struct channel *ch);
-static void txwinon(struct channel *ch);
-static void memoff(struct channel *ch);
-static void assertgwinon(struct channel *ch);
-static void assertmemoff(struct channel *ch);
-
-/* ---- Begin more 'specific' memory functions for cx_like products --- */
-
-static void pcxem_memwinon(struct board_info *b, unsigned int win);
-static void pcxem_memwinoff(struct board_info *b, unsigned int win);
-static void pcxem_globalwinon(struct channel *ch);
-static void pcxem_rxwinon(struct channel *ch);
-static void pcxem_txwinon(struct channel *ch);
-static void pcxem_memoff(struct channel *ch);
-
-/* ------ Begin more 'specific' memory functions for the pcxe ------- */
-
-static void pcxe_memwinon(struct board_info *b, unsigned int win);
-static void pcxe_memwinoff(struct board_info *b, unsigned int win);
-static void pcxe_globalwinon(struct channel *ch);
-static void pcxe_rxwinon(struct channel *ch);
-static void pcxe_txwinon(struct channel *ch);
-static void pcxe_memoff(struct channel *ch);
-
-/* ---- Begin more 'specific' memory functions for the pc64xe and pcxi ---- */
-/* Note : pc64xe and pcxi share the same windowing routines */
-
-static void pcxi_memwinon(struct board_info *b, unsigned int win);
-static void pcxi_memwinoff(struct board_info *b, unsigned int win);
-static void pcxi_globalwinon(struct channel *ch);
-static void pcxi_rxwinon(struct channel *ch);
-static void pcxi_txwinon(struct channel *ch);
-static void pcxi_memoff(struct channel *ch);
-
-/* - Begin 'specific' do nothing memory functions needed for some cards - */
-
-static void dummy_memwinon(struct board_info *b, unsigned int win);
-static void dummy_memwinoff(struct board_info *b, unsigned int win);
-static void dummy_globalwinon(struct channel *ch);
-static void dummy_rxwinon(struct channel *ch);
-static void dummy_txwinon(struct channel *ch);
-static void dummy_memoff(struct channel *ch);
-static void dummy_assertgwinon(struct channel *ch);
-static void dummy_assertmemoff(struct channel *ch);
-
-static struct channel *verifyChannel(struct tty_struct *);
-static void pc_sched_event(struct channel *, int);
-static void epca_error(int, char *);
-static void pc_close(struct tty_struct *, struct file *);
-static void shutdown(struct channel *, struct tty_struct *tty);
-static void pc_hangup(struct tty_struct *);
-static int pc_write_room(struct tty_struct *);
-static int pc_chars_in_buffer(struct tty_struct *);
-static void pc_flush_buffer(struct tty_struct *);
-static void pc_flush_chars(struct tty_struct *);
-static int pc_open(struct tty_struct *, struct file *);
-static void post_fep_init(unsigned int crd);
-static void epcapoll(unsigned long);
-static void doevent(int);
-static void fepcmd(struct channel *, int, int, int, int, int);
-static unsigned termios2digi_h(struct channel *ch, unsigned);
-static unsigned termios2digi_i(struct channel *ch, unsigned);
-static unsigned termios2digi_c(struct channel *ch, unsigned);
-static void epcaparam(struct tty_struct *, struct channel *);
-static void receive_data(struct channel *, struct tty_struct *tty);
-static int pc_ioctl(struct tty_struct *,
- unsigned int, unsigned long);
-static int info_ioctl(struct tty_struct *,
- unsigned int, unsigned long);
-static void pc_set_termios(struct tty_struct *, struct ktermios *);
-static void do_softint(struct work_struct *work);
-static void pc_stop(struct tty_struct *);
-static void pc_start(struct tty_struct *);
-static void pc_throttle(struct tty_struct *tty);
-static void pc_unthrottle(struct tty_struct *tty);
-static int pc_send_break(struct tty_struct *tty, int msec);
-static void setup_empty_event(struct tty_struct *tty, struct channel *ch);
-
-static int pc_write(struct tty_struct *, const unsigned char *, int);
-static int pc_init(void);
-static int init_PCI(void);
-
-/*
- * Table of functions for each board to handle memory. Mantaining parallelism
- * is a *very* good idea here. The idea is for the runtime code to blindly call
- * these functions, not knowing/caring about the underlying hardware. This
- * stuff should contain no conditionals; if more functionality is needed a
- * different entry should be established. These calls are the interface calls
- * and are the only functions that should be accessed. Anyone caught making
- * direct calls deserves what they get.
- */
-static void memwinon(struct board_info *b, unsigned int win)
-{
- b->memwinon(b, win);
-}
-
-static void memwinoff(struct board_info *b, unsigned int win)
-{
- b->memwinoff(b, win);
-}
-
-static void globalwinon(struct channel *ch)
-{
- ch->board->globalwinon(ch);
-}
-
-static void rxwinon(struct channel *ch)
-{
- ch->board->rxwinon(ch);
-}
-
-static void txwinon(struct channel *ch)
-{
- ch->board->txwinon(ch);
-}
-
-static void memoff(struct channel *ch)
-{
- ch->board->memoff(ch);
-}
-static void assertgwinon(struct channel *ch)
-{
- ch->board->assertgwinon(ch);
-}
-
-static void assertmemoff(struct channel *ch)
-{
- ch->board->assertmemoff(ch);
-}
-
-/* PCXEM windowing is the same as that used in the PCXR and CX series cards. */
-static void pcxem_memwinon(struct board_info *b, unsigned int win)
-{
- outb_p(FEPWIN | win, b->port + 1);
-}
-
-static void pcxem_memwinoff(struct board_info *b, unsigned int win)
-{
- outb_p(0, b->port + 1);
-}
-
-static void pcxem_globalwinon(struct channel *ch)
-{
- outb_p(FEPWIN, (int)ch->board->port + 1);
-}
-
-static void pcxem_rxwinon(struct channel *ch)
-{
- outb_p(ch->rxwin, (int)ch->board->port + 1);
-}
-
-static void pcxem_txwinon(struct channel *ch)
-{
- outb_p(ch->txwin, (int)ch->board->port + 1);
-}
-
-static void pcxem_memoff(struct channel *ch)
-{
- outb_p(0, (int)ch->board->port + 1);
-}
-
-/* ----------------- Begin pcxe memory window stuff ------------------ */
-static void pcxe_memwinon(struct board_info *b, unsigned int win)
-{
- outb_p(FEPWIN | win, b->port + 1);
-}
-
-static void pcxe_memwinoff(struct board_info *b, unsigned int win)
-{
- outb_p(inb(b->port) & ~FEPMEM, b->port + 1);
- outb_p(0, b->port + 1);
-}
-
-static void pcxe_globalwinon(struct channel *ch)
-{
- outb_p(FEPWIN, (int)ch->board->port + 1);
-}
-
-static void pcxe_rxwinon(struct channel *ch)
-{
- outb_p(ch->rxwin, (int)ch->board->port + 1);
-}
-
-static void pcxe_txwinon(struct channel *ch)
-{
- outb_p(ch->txwin, (int)ch->board->port + 1);
-}
-
-static void pcxe_memoff(struct channel *ch)
-{
- outb_p(0, (int)ch->board->port);
- outb_p(0, (int)ch->board->port + 1);
-}
-
-/* ------------- Begin pc64xe and pcxi memory window stuff -------------- */
-static void pcxi_memwinon(struct board_info *b, unsigned int win)
-{
- outb_p(inb(b->port) | FEPMEM, b->port);
-}
-
-static void pcxi_memwinoff(struct board_info *b, unsigned int win)
-{
- outb_p(inb(b->port) & ~FEPMEM, b->port);
-}
-
-static void pcxi_globalwinon(struct channel *ch)
-{
- outb_p(FEPMEM, ch->board->port);
-}
-
-static void pcxi_rxwinon(struct channel *ch)
-{
- outb_p(FEPMEM, ch->board->port);
-}
-
-static void pcxi_txwinon(struct channel *ch)
-{
- outb_p(FEPMEM, ch->board->port);
-}
-
-static void pcxi_memoff(struct channel *ch)
-{
- outb_p(0, ch->board->port);
-}
-
-static void pcxi_assertgwinon(struct channel *ch)
-{
- epcaassert(inb(ch->board->port) & FEPMEM, "Global memory off");
-}
-
-static void pcxi_assertmemoff(struct channel *ch)
-{
- epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on");
-}
-
-/*
- * Not all of the cards need specific memory windowing routines. Some cards
- * (Such as PCI) needs no windowing routines at all. We provide these do
- * nothing routines so that the same code base can be used. The driver will
- * ALWAYS call a windowing routine if it thinks it needs to; regardless of the
- * card. However, dependent on the card the routine may or may not do anything.
- */
-static void dummy_memwinon(struct board_info *b, unsigned int win)
-{
-}
-
-static void dummy_memwinoff(struct board_info *b, unsigned int win)
-{
-}
-
-static void dummy_globalwinon(struct channel *ch)
-{
-}
-
-static void dummy_rxwinon(struct channel *ch)
-{
-}
-
-static void dummy_txwinon(struct channel *ch)
-{
-}
-
-static void dummy_memoff(struct channel *ch)
-{
-}
-
-static void dummy_assertgwinon(struct channel *ch)
-{
-}
-
-static void dummy_assertmemoff(struct channel *ch)
-{
-}
-
-static struct channel *verifyChannel(struct tty_struct *tty)
-{
- /*
- * This routine basically provides a sanity check. It insures that the
- * channel returned is within the proper range of addresses as well as
- * properly initialized. If some bogus info gets passed in
- * through tty->driver_data this should catch it.
- */
- if (tty) {
- struct channel *ch = tty->driver_data;
- if (ch >= &digi_channels[0] && ch < &digi_channels[nbdevs]) {
- if (ch->magic == EPCA_MAGIC)
- return ch;
- }
- }
- return NULL;
-}
-
-static void pc_sched_event(struct channel *ch, int event)
-{
- /*
- * We call this to schedule interrupt processing on some event. The
- * kernel sees our request and calls the related routine in OUR driver.
- */
- ch->event |= 1 << event;
- schedule_work(&ch->tqueue);
-}
-
-static void epca_error(int line, char *msg)
-{
- printk(KERN_ERR "epca_error (Digi): line = %d %s\n", line, msg);
-}
-
-static void pc_close(struct tty_struct *tty, struct file *filp)
-{
- struct channel *ch;
- struct tty_port *port;
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch == NULL)
- return;
- port = &ch->port;
-
- if (tty_port_close_start(port, tty, filp) == 0)
- return;
-
- pc_flush_buffer(tty);
- shutdown(ch, tty);
-
- tty_port_close_end(port, tty);
- ch->event = 0; /* FIXME: review ch->event locking */
- tty_port_tty_set(port, NULL);
-}
-
-static void shutdown(struct channel *ch, struct tty_struct *tty)
-{
- unsigned long flags;
- struct board_chan __iomem *bc;
- struct tty_port *port = &ch->port;
-
- if (!(port->flags & ASYNC_INITIALIZED))
- return;
-
- spin_lock_irqsave(&epca_lock, flags);
-
- globalwinon(ch);
- bc = ch->brdchan;
-
- /*
- * In order for an event to be generated on the receipt of data the
- * idata flag must be set. Since we are shutting down, this is not
- * necessary clear this flag.
- */
- if (bc)
- writeb(0, &bc->idata);
-
- /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */
- if (tty->termios->c_cflag & HUPCL) {
- ch->omodem &= ~(ch->m_rts | ch->m_dtr);
- fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1);
- }
- memoff(ch);
-
- /*
- * The channel has officialy been closed. The next time it is opened it
- * will have to reinitialized. Set a flag to indicate this.
- */
- /* Prevent future Digi programmed interrupts from coming active */
- port->flags &= ~ASYNC_INITIALIZED;
- spin_unlock_irqrestore(&epca_lock, flags);
-}
-
-static void pc_hangup(struct tty_struct *tty)
-{
- struct channel *ch;
-
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch != NULL) {
- pc_flush_buffer(tty);
- tty_ldisc_flush(tty);
- shutdown(ch, tty);
-
- ch->event = 0; /* FIXME: review locking of ch->event */
- tty_port_hangup(&ch->port);
- }
-}
-
-static int pc_write(struct tty_struct *tty,
- const unsigned char *buf, int bytesAvailable)
-{
- unsigned int head, tail;
- int dataLen;
- int size;
- int amountCopied;
- struct channel *ch;
- unsigned long flags;
- int remain;
- struct board_chan __iomem *bc;
-
- /*
- * pc_write is primarily called directly by the kernel routine
- * tty_write (Though it can also be called by put_char) found in
- * tty_io.c. pc_write is passed a line discipline buffer where the data
- * to be written out is stored. The line discipline implementation
- * itself is done at the kernel level and is not brought into the
- * driver.
- */
-
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch == NULL)
- return 0;
-
- /* Make a pointer to the channel data structure found on the board. */
- bc = ch->brdchan;
- size = ch->txbufsize;
- amountCopied = 0;
-
- spin_lock_irqsave(&epca_lock, flags);
- globalwinon(ch);
-
- head = readw(&bc->tin) & (size - 1);
- tail = readw(&bc->tout);
-
- if (tail != readw(&bc->tout))
- tail = readw(&bc->tout);
- tail &= (size - 1);
-
- if (head >= tail) {
- /* head has not wrapped */
- /*
- * remain (much like dataLen above) represents the total amount
- * of space available on the card for data. Here dataLen
- * represents the space existing between the head pointer and
- * the end of buffer. This is important because a memcpy cannot
- * be told to automatically wrap around when it hits the buffer
- * end.
- */
- dataLen = size - head;
- remain = size - (head - tail) - 1;
- } else {
- /* head has wrapped around */
- remain = tail - head - 1;
- dataLen = remain;
- }
- /*
- * Check the space on the card. If we have more data than space; reduce
- * the amount of data to fit the space.
- */
- bytesAvailable = min(remain, bytesAvailable);
- txwinon(ch);
- while (bytesAvailable > 0) {
- /* there is data to copy onto card */
-
- /*
- * If head is not wrapped, the below will make sure the first
- * data copy fills to the end of card buffer.
- */
- dataLen = min(bytesAvailable, dataLen);
- memcpy_toio(ch->txptr + head, buf, dataLen);
- buf += dataLen;
- head += dataLen;
- amountCopied += dataLen;
- bytesAvailable -= dataLen;
-
- if (head >= size) {
- head = 0;
- dataLen = tail;
- }
- }
- ch->statusflags |= TXBUSY;
- globalwinon(ch);
- writew(head, &bc->tin);
-
- if ((ch->statusflags & LOWWAIT) == 0) {
- ch->statusflags |= LOWWAIT;
- writeb(1, &bc->ilow);
- }
- memoff(ch);
- spin_unlock_irqrestore(&epca_lock, flags);
- return amountCopied;
-}
-
-static int pc_write_room(struct tty_struct *tty)
-{
- int remain = 0;
- struct channel *ch;
- unsigned long flags;
- unsigned int head, tail;
- struct board_chan __iomem *bc;
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch != NULL) {
- spin_lock_irqsave(&epca_lock, flags);
- globalwinon(ch);
-
- bc = ch->brdchan;
- head = readw(&bc->tin) & (ch->txbufsize - 1);
- tail = readw(&bc->tout);
-
- if (tail != readw(&bc->tout))
- tail = readw(&bc->tout);
- /* Wrap tail if necessary */
- tail &= (ch->txbufsize - 1);
- remain = tail - head - 1;
- if (remain < 0)
- remain += ch->txbufsize;
-
- if (remain && (ch->statusflags & LOWWAIT) == 0) {
- ch->statusflags |= LOWWAIT;
- writeb(1, &bc->ilow);
- }
- memoff(ch);
- spin_unlock_irqrestore(&epca_lock, flags);
- }
- /* Return how much room is left on card */
- return remain;
-}
-
-static int pc_chars_in_buffer(struct tty_struct *tty)
-{
- int chars;
- unsigned int ctail, head, tail;
- int remain;
- unsigned long flags;
- struct channel *ch;
- struct board_chan __iomem *bc;
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch == NULL)
- return 0;
-
- spin_lock_irqsave(&epca_lock, flags);
- globalwinon(ch);
-
- bc = ch->brdchan;
- tail = readw(&bc->tout);
- head = readw(&bc->tin);
- ctail = readw(&ch->mailbox->cout);
-
- if (tail == head && readw(&ch->mailbox->cin) == ctail &&
- readb(&bc->tbusy) == 0)
- chars = 0;
- else { /* Begin if some space on the card has been used */
- head = readw(&bc->tin) & (ch->txbufsize - 1);
- tail &= (ch->txbufsize - 1);
- /*
- * The logic here is basically opposite of the above
- * pc_write_room here we are finding the amount of bytes in the
- * buffer filled. Not the amount of bytes empty.
- */
- remain = tail - head - 1;
- if (remain < 0)
- remain += ch->txbufsize;
- chars = (int)(ch->txbufsize - remain);
- /*
- * Make it possible to wakeup anything waiting for output in
- * tty_ioctl.c, etc.
- *
- * If not already set. Setup an event to indicate when the
- * transmit buffer empties.
- */
- if (!(ch->statusflags & EMPTYWAIT))
- setup_empty_event(tty, ch);
- } /* End if some space on the card has been used */
- memoff(ch);
- spin_unlock_irqrestore(&epca_lock, flags);
- /* Return number of characters residing on card. */
- return chars;
-}
-
-static void pc_flush_buffer(struct tty_struct *tty)
-{
- unsigned int tail;
- unsigned long flags;
- struct channel *ch;
- struct board_chan __iomem *bc;
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch == NULL)
- return;
-
- spin_lock_irqsave(&epca_lock, flags);
- globalwinon(ch);
- bc = ch->brdchan;
- tail = readw(&bc->tout);
- /* Have FEP move tout pointer; effectively flushing transmit buffer */
- fepcmd(ch, STOUT, (unsigned) tail, 0, 0, 0);
- memoff(ch);
- spin_unlock_irqrestore(&epca_lock, flags);
- tty_wakeup(tty);
-}
-
-static void pc_flush_chars(struct tty_struct *tty)
-{
- struct channel *ch;
- /*
- * verifyChannel returns the channel from the tty struct if it is
- * valid. This serves as a sanity check.
- */
- ch = verifyChannel(tty);
- if (ch != NULL) {
- unsigned long flags;
- spin_lock_irqsave(&epca_lock, flags);
- /*
- * If not already set and the transmitter is busy setup an
- * event to indicate when the transmit empties.
- */
- if ((ch->statusflags & TXBUSY) &&
- !(ch->statusflags & EMPTYWAIT))
- setup_empty_event(tty, ch);
- spin_unlock_irqrestore(&epca_lock, flags);
- }
-}
-
-static int epca_carrier_raised(struct tty_port *port)
-{
- struct channel *ch = container_of(port, struct channel, port);
- if (ch->imodem & ch->dcd)
- return 1;
- return 0;
-}
-
-static void epca_dtr_rts(struct tty_port *port, int onoff)
-{
-}
-
-static int pc_open(struct tty_struct *tty, struct file *filp)
-{
- struct channel *ch;
- struct tty_port *port;
- unsigned long flags;
- int line, retval, boardnum;
- struct board_chan __iomem *bc;
- unsigned int head;
-
- line = tty->index;
- if (line < 0 || line >= nbdevs)
- return -ENODEV;
-
- ch = &digi_channels[line];
- port = &ch->port;
- boardnum = ch->boardnum;
-
- /* Check status of board configured in system. */
-
- /*
- * I check to see if the epca_setup routine detected a user error. It
- * might be better to put this in pc_init, but for the moment it go