summaryrefslogtreecommitdiff
path: root/drivers/char/ip2
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/ip2
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/ip2')
-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
14 files changed, 0 insertions, 9873 deletions
diff --git a/drivers/char/ip2/Makefile b/drivers/char/ip2/Makefile
deleted file mode 100644
index 7b78e0dfc5b0..000000000000
--- a/drivers/char/ip2/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Makefile for the Computone IntelliPort Plus Driver
-#
-
-obj-$(CONFIG_COMPUTONE) += ip2.o
-
-ip2-y := ip2main.o
-
diff --git a/drivers/char/ip2/i2cmd.c b/drivers/char/ip2/i2cmd.c
deleted file mode 100644
index e7af647800b6..000000000000
--- a/drivers/char/ip2/i2cmd.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Definition table for In-line and Bypass commands. Applicable
-* only when the standard loadware is active. (This is included
-* source code, not a separate compilation module.)
-*
-*******************************************************************************/
-
-//------------------------------------------------------------------------------
-//
-// Revision History:
-//
-// 10 October 1991 MAG First Draft
-// 7 November 1991 MAG Reflects additional commands.
-// 24 February 1992 MAG Additional commands for 1.4.x loadware
-// 11 March 1992 MAG Additional commands
-// 30 March 1992 MAG Additional command: CMD_DSS_NOW
-// 18 May 1992 MAG Discovered commands 39 & 40 must be at the end of a
-// packet: affects implementation.
-//------------------------------------------------------------------------------
-
-//************
-//* Includes *
-//************
-
-#include "i2cmd.h" /* To get some bit-defines */
-
-//------------------------------------------------------------------------------
-// Here is the table of global arrays which represent each type of command
-// supported in the IntelliPort standard loadware. See also i2cmd.h
-// for a more complete explanation of what is going on.
-//------------------------------------------------------------------------------
-
-// Here are the various globals: note that the names are not used except through
-// the macros defined in i2cmd.h. Also note that although they are character
-// arrays here (for extendability) they are cast to structure pointers in the
-// i2cmd.h macros. See i2cmd.h for flags definitions.
-
-// Length Flags Command
-static UCHAR ct02[] = { 1, BTH, 0x02 }; // DTR UP
-static UCHAR ct03[] = { 1, BTH, 0x03 }; // DTR DN
-static UCHAR ct04[] = { 1, BTH, 0x04 }; // RTS UP
-static UCHAR ct05[] = { 1, BTH, 0x05 }; // RTS DN
-static UCHAR ct06[] = { 1, BYP, 0x06 }; // START FL
-static UCHAR ct07[] = { 2, BTH, 0x07,0 }; // BAUD
-static UCHAR ct08[] = { 2, BTH, 0x08,0 }; // BITS
-static UCHAR ct09[] = { 2, BTH, 0x09,0 }; // STOP
-static UCHAR ct10[] = { 2, BTH, 0x0A,0 }; // PARITY
-static UCHAR ct11[] = { 2, BTH, 0x0B,0 }; // XON
-static UCHAR ct12[] = { 2, BTH, 0x0C,0 }; // XOFF
-static UCHAR ct13[] = { 1, BTH, 0x0D }; // STOP FL
-static UCHAR ct14[] = { 1, BYP|VIP, 0x0E }; // ACK HOTK
-//static UCHAR ct15[]={ 2, BTH|VIP, 0x0F,0 }; // IRQ SET
-static UCHAR ct16[] = { 2, INL, 0x10,0 }; // IXONOPTS
-static UCHAR ct17[] = { 2, INL, 0x11,0 }; // OXONOPTS
-static UCHAR ct18[] = { 1, INL, 0x12 }; // CTSENAB
-static UCHAR ct19[] = { 1, BTH, 0x13 }; // CTSDSAB
-static UCHAR ct20[] = { 1, INL, 0x14 }; // DCDENAB
-static UCHAR ct21[] = { 1, BTH, 0x15 }; // DCDDSAB
-static UCHAR ct22[] = { 1, BTH, 0x16 }; // DSRENAB
-static UCHAR ct23[] = { 1, BTH, 0x17 }; // DSRDSAB
-static UCHAR ct24[] = { 1, BTH, 0x18 }; // RIENAB
-static UCHAR ct25[] = { 1, BTH, 0x19 }; // RIDSAB
-static UCHAR ct26[] = { 2, BTH, 0x1A,0 }; // BRKENAB
-static UCHAR ct27[] = { 1, BTH, 0x1B }; // BRKDSAB
-//static UCHAR ct28[]={ 2, BTH, 0x1C,0 }; // MAXBLOKSIZE
-//static UCHAR ct29[]={ 2, 0, 0x1D,0 }; // reserved
-static UCHAR ct30[] = { 1, INL, 0x1E }; // CTSFLOWENAB
-static UCHAR ct31[] = { 1, INL, 0x1F }; // CTSFLOWDSAB
-static UCHAR ct32[] = { 1, INL, 0x20 }; // RTSFLOWENAB
-static UCHAR ct33[] = { 1, INL, 0x21 }; // RTSFLOWDSAB
-static UCHAR ct34[] = { 2, BTH, 0x22,0 }; // ISTRIPMODE
-static UCHAR ct35[] = { 2, BTH|END, 0x23,0 }; // SENDBREAK
-static UCHAR ct36[] = { 2, BTH, 0x24,0 }; // SETERRMODE
-//static UCHAR ct36a[]={ 3, INL, 0x24,0,0 }; // SET_REPLACE
-
-// The following is listed for completeness, but should never be sent directly
-// by user-level code. It is sent only by library routines in response to data
-// movement.
-//static UCHAR ct37[]={ 5, BYP|VIP, 0x25,0,0,0,0 }; // FLOW PACKET
-
-// Back to normal
-//static UCHAR ct38[] = {11, BTH|VAR, 0x26,0,0,0,0,0,0,0,0,0,0 }; // DEF KEY SEQ
-//static UCHAR ct39[]={ 3, BTH|END, 0x27,0,0 }; // OPOSTON
-//static UCHAR ct40[]={ 1, BTH|END, 0x28 }; // OPOSTOFF
-static UCHAR ct41[] = { 1, BYP, 0x29 }; // RESUME
-//static UCHAR ct42[]={ 2, BTH, 0x2A,0 }; // TXBAUD
-//static UCHAR ct43[]={ 2, BTH, 0x2B,0 }; // RXBAUD
-//static UCHAR ct44[]={ 2, BTH, 0x2C,0 }; // MS PING
-//static UCHAR ct45[]={ 1, BTH, 0x2D }; // HOTENAB
-//static UCHAR ct46[]={ 1, BTH, 0x2E }; // HOTDSAB
-//static UCHAR ct47[]={ 7, BTH, 0x2F,0,0,0,0,0,0 }; // UNIX FLAGS
-//static UCHAR ct48[]={ 1, BTH, 0x30 }; // DSRFLOWENAB
-//static UCHAR ct49[]={ 1, BTH, 0x31 }; // DSRFLOWDSAB
-//static UCHAR ct50[]={ 1, BTH, 0x32 }; // DTRFLOWENAB
-//static UCHAR ct51[]={ 1, BTH, 0x33 }; // DTRFLOWDSAB
-//static UCHAR ct52[]={ 1, BTH, 0x34 }; // BAUDTABRESET
-//static UCHAR ct53[] = { 3, BTH, 0x35,0,0 }; // BAUDREMAP
-static UCHAR ct54[] = { 3, BTH, 0x36,0,0 }; // CUSTOMBAUD1
-static UCHAR ct55[] = { 3, BTH, 0x37,0,0 }; // CUSTOMBAUD2
-static UCHAR ct56[] = { 2, BTH|END, 0x38,0 }; // PAUSE
-static UCHAR ct57[] = { 1, BYP, 0x39 }; // SUSPEND
-static UCHAR ct58[] = { 1, BYP, 0x3A }; // UNSUSPEND
-static UCHAR ct59[] = { 2, BTH, 0x3B,0 }; // PARITYCHK
-static UCHAR ct60[] = { 1, INL|VIP, 0x3C }; // BOOKMARKREQ
-//static UCHAR ct61[]={ 2, BTH, 0x3D,0 }; // INTERNALLOOP
-//static UCHAR ct62[]={ 2, BTH, 0x3E,0 }; // HOTKTIMEOUT
-static UCHAR ct63[] = { 2, INL, 0x3F,0 }; // SETTXON
-static UCHAR ct64[] = { 2, INL, 0x40,0 }; // SETTXOFF
-//static UCHAR ct65[]={ 2, BTH, 0x41,0 }; // SETAUTORTS
-//static UCHAR ct66[]={ 2, BTH, 0x42,0 }; // SETHIGHWAT
-//static UCHAR ct67[]={ 2, BYP, 0x43,0 }; // STARTSELFL
-//static UCHAR ct68[]={ 2, INL, 0x44,0 }; // ENDSELFL
-//static UCHAR ct69[]={ 1, BYP, 0x45 }; // HWFLOW_OFF
-//static UCHAR ct70[]={ 1, BTH, 0x46 }; // ODSRFL_ENAB
-//static UCHAR ct71[]={ 1, BTH, 0x47 }; // ODSRFL_DSAB
-//static UCHAR ct72[]={ 1, BTH, 0x48 }; // ODCDFL_ENAB
-//static UCHAR ct73[]={ 1, BTH, 0x49 }; // ODCDFL_DSAB
-//static UCHAR ct74[]={ 2, BTH, 0x4A,0 }; // LOADLEVEL
-//static UCHAR ct75[]={ 2, BTH, 0x4B,0 }; // STATDATA
-//static UCHAR ct76[]={ 1, BYP, 0x4C }; // BREAK_ON
-//static UCHAR ct77[]={ 1, BYP, 0x4D }; // BREAK_OFF
-//static UCHAR ct78[]={ 1, BYP, 0x4E }; // GETFC
-static UCHAR ct79[] = { 2, BYP, 0x4F,0 }; // XMIT_NOW
-//static UCHAR ct80[]={ 4, BTH, 0x50,0,0,0 }; // DIVISOR_LATCH
-//static UCHAR ct81[]={ 1, BYP, 0x51 }; // GET_STATUS
-//static UCHAR ct82[]={ 1, BYP, 0x52 }; // GET_TXCNT
-//static UCHAR ct83[]={ 1, BYP, 0x53 }; // GET_RXCNT
-//static UCHAR ct84[]={ 1, BYP, 0x54 }; // GET_BOXIDS
-//static UCHAR ct85[]={10, BYP, 0x55,0,0,0,0,0,0,0,0,0 }; // ENAB_MULT
-//static UCHAR ct86[]={ 2, BTH, 0x56,0 }; // RCV_ENABLE
-static UCHAR ct87[] = { 1, BYP, 0x57 }; // HW_TEST
-//static UCHAR ct88[]={ 3, BTH, 0x58,0,0 }; // RCV_THRESHOLD
-//static UCHAR ct90[]={ 3, BYP, 0x5A,0,0 }; // Set SILO
-//static UCHAR ct91[]={ 2, BYP, 0x5B,0 }; // timed break
-
-// Some composite commands as well
-//static UCHAR cc01[]={ 2, BTH, 0x02,0x04 }; // DTR & RTS UP
-//static UCHAR cc02[]={ 2, BTH, 0x03,0x05 }; // DTR & RTS DN
-
-//********
-//* Code *
-//********
-
-//******************************************************************************
-// Function: i2cmdUnixFlags(iflag, cflag, lflag)
-// Parameters: Unix tty flags
-//
-// Returns: Pointer to command structure
-//
-// Description:
-//
-// This routine sets the parameters of command 47 and returns a pointer to the
-// appropriate structure.
-//******************************************************************************
-#if 0
-cmdSyntaxPtr
-i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag)
-{
- cmdSyntaxPtr pCM = (cmdSyntaxPtr) ct47;
-
- pCM->cmd[1] = (unsigned char) iflag;
- pCM->cmd[2] = (unsigned char) (iflag >> 8);
- pCM->cmd[3] = (unsigned char) cflag;
- pCM->cmd[4] = (unsigned char) (cflag >> 8);
- pCM->cmd[5] = (unsigned char) lflag;
- pCM->cmd[6] = (unsigned char) (lflag >> 8);
- return pCM;
-}
-#endif /* 0 */
-
-//******************************************************************************
-// Function: i2cmdBaudDef(which, rate)
-// Parameters: ?
-//
-// Returns: Pointer to command structure
-//
-// Description:
-//
-// This routine sets the parameters of commands 54 or 55 (according to the
-// argument which), and returns a pointer to the appropriate structure.
-//******************************************************************************
-static cmdSyntaxPtr
-i2cmdBaudDef(int which, unsigned short rate)
-{
- cmdSyntaxPtr pCM;
-
- switch(which)
- {
- case 1:
- pCM = (cmdSyntaxPtr) ct54;
- break;
- default:
- case 2:
- pCM = (cmdSyntaxPtr) ct55;
- break;
- }
- pCM->cmd[1] = (unsigned char) rate;
- pCM->cmd[2] = (unsigned char) (rate >> 8);
- return pCM;
-}
-
diff --git a/drivers/char/ip2/i2cmd.h b/drivers/char/ip2/i2cmd.h
deleted file mode 100644
index 29277ec6b8ed..000000000000
--- a/drivers/char/ip2/i2cmd.h
+++ /dev/null
@@ -1,630 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1999 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Definitions and support for In-line and Bypass commands.
-* Applicable only when the standard loadware is active.
-*
-*******************************************************************************/
-//------------------------------------------------------------------------------
-// Revision History:
-//
-// 10 October 1991 MAG First Draft
-// 7 November 1991 MAG Reflects some new commands
-// 20 February 1992 MAG CMD_HOTACK corrected: no argument.
-// 24 February 1992 MAG Support added for new commands for 1.4.x loadware.
-// 11 March 1992 MAG Additional commands.
-// 16 March 1992 MAG Additional commands.
-// 30 March 1992 MAG Additional command: CMD_DSS_NOW
-// 18 May 1992 MAG Changed CMD_OPOST
-//
-//------------------------------------------------------------------------------
-#ifndef I2CMD_H // To prevent multiple includes
-#define I2CMD_H 1
-
-#include "ip2types.h"
-
-// This module is designed to provide a uniform method of sending commands to
-// the board through command packets. The difficulty is, some commands take
-// parameters, others do not. Furthermore, it is often useful to send several
-// commands to the same channel as part of the same packet. (See also i2pack.h.)
-//
-// This module is designed so that the caller should not be responsible for
-// remembering the exact syntax of each command, or at least so that the
-// compiler could check things somewhat. I'll explain as we go...
-//
-// First, a structure which can embody the syntax of each type of command.
-//
-typedef struct _cmdSyntax
-{
- UCHAR length; // Number of bytes in the command
- UCHAR flags; // Information about the command (see below)
-
- // The command and its parameters, which may be of arbitrary length. Don't
- // worry yet how the parameters will be initialized; macros later take care
- // of it. Also, don't worry about the arbitrary length issue; this structure
- // is never used to allocate space (see i2cmd.c).
- UCHAR cmd[2];
-} cmdSyntax, *cmdSyntaxPtr;
-
-// Bit assignments for flags
-
-#define INL 1 // Set if suitable for inline commands
-#define BYP 2 // Set if suitable for bypass commands
-#define BTH (INL|BYP) // suitable for either!
-#define END 4 // Set if this must be the last command in a block
-#define VIP 8 // Set if this command is special in some way and really
- // should only be sent from the library-level and not
- // directly from user-level
-#define VAR 0x10 // This command is of variable length!
-
-// Declarations for the global arrays used to bear the commands and their
-// arguments.
-//
-// Note: Since these are globals and the arguments might change, it is important
-// that the library routine COPY these into buffers from whence they would be
-// sent, rather than merely storing the pointers. In multi-threaded
-// environments, important that the copy should obtain before any context switch
-// is allowed. Also, for parameterized commands, DO NOT ISSUE THE SAME COMMAND
-// MORE THAN ONCE WITH THE SAME PARAMETERS in the same call.
-//
-static UCHAR ct02[];
-static UCHAR ct03[];
-static UCHAR ct04[];
-static UCHAR ct05[];
-static UCHAR ct06[];
-static UCHAR ct07[];
-static UCHAR ct08[];
-static UCHAR ct09[];
-static UCHAR ct10[];
-static UCHAR ct11[];
-static UCHAR ct12[];
-static UCHAR ct13[];
-static UCHAR ct14[];
-static UCHAR ct15[];
-static UCHAR ct16[];
-static UCHAR ct17[];
-static UCHAR ct18[];
-static UCHAR ct19[];
-static UCHAR ct20[];
-static UCHAR ct21[];
-static UCHAR ct22[];
-static UCHAR ct23[];
-static UCHAR ct24[];
-static UCHAR ct25[];
-static UCHAR ct26[];
-static UCHAR ct27[];
-static UCHAR ct28[];
-static UCHAR ct29[];
-static UCHAR ct30[];
-static UCHAR ct31[];
-static UCHAR ct32[];
-static UCHAR ct33[];
-static UCHAR ct34[];
-static UCHAR ct35[];
-static UCHAR ct36[];
-static UCHAR ct36a[];
-static UCHAR ct41[];
-static UCHAR ct42[];
-static UCHAR ct43[];
-static UCHAR ct44[];
-static UCHAR ct45[];
-static UCHAR ct46[];
-static UCHAR ct48[];
-static UCHAR ct49[];
-static UCHAR ct50[];
-static UCHAR ct51[];
-static UCHAR ct52[];
-static UCHAR ct56[];
-static UCHAR ct57[];
-static UCHAR ct58[];
-static UCHAR ct59[];
-static UCHAR ct60[];
-static UCHAR ct61[];
-static UCHAR ct62[];
-static UCHAR ct63[];
-static UCHAR ct64[];
-static UCHAR ct65[];
-static UCHAR ct66[];
-static UCHAR ct67[];
-static UCHAR ct68[];
-static UCHAR ct69[];
-static UCHAR ct70[];
-static UCHAR ct71[];
-static UCHAR ct72[];
-static UCHAR ct73[];
-static UCHAR ct74[];
-static UCHAR ct75[];
-static UCHAR ct76[];
-static UCHAR ct77[];
-static UCHAR ct78[];
-static UCHAR ct79[];
-static UCHAR ct80[];
-static UCHAR ct81[];
-static UCHAR ct82[];
-static UCHAR ct83[];
-static UCHAR ct84[];
-static UCHAR ct85[];
-static UCHAR ct86[];
-static UCHAR ct87[];
-static UCHAR ct88[];
-static UCHAR ct89[];
-static UCHAR ct90[];
-static UCHAR ct91[];
-static UCHAR cc01[];
-static UCHAR cc02[];
-
-// Now, refer to i2cmd.c, and see the character arrays defined there. They are
-// cast here to cmdSyntaxPtr.
-//
-// There are library functions for issuing bypass or inline commands. These
-// functions take one or more arguments of the type cmdSyntaxPtr. The routine
-// then can figure out how long each command is supposed to be and easily add it
-// to the list.
-//
-// For ease of use, we define manifests which return pointers to appropriate
-// cmdSyntaxPtr things. But some commands also take arguments. If a single
-// argument is used, we define a macro which performs the single assignment and
-// (through the expedient of a comma expression) references the appropriate
-// pointer. For commands requiring several arguments, we actually define a
-// function to perform the assignments.
-
-#define CMD_DTRUP (cmdSyntaxPtr)(ct02) // Raise DTR
-#define CMD_DTRDN (cmdSyntaxPtr)(ct03) // Lower DTR
-#define CMD_RTSUP (cmdSyntaxPtr)(ct04) // Raise RTS
-#define CMD_RTSDN (cmdSyntaxPtr)(ct05) // Lower RTS
-#define CMD_STARTFL (cmdSyntaxPtr)(ct06) // Start Flushing Data
-
-#define CMD_DTRRTS_UP (cmdSyntaxPtr)(cc01) // Raise DTR and RTS
-#define CMD_DTRRTS_DN (cmdSyntaxPtr)(cc02) // Lower DTR and RTS
-
-// Set Baud Rate for transmit and receive
-#define CMD_SETBAUD(arg) \
- (((cmdSyntaxPtr)(ct07))->cmd[1] = (arg),(cmdSyntaxPtr)(ct07))
-
-#define CBR_50 1
-#define CBR_75 2
-#define CBR_110 3
-#define CBR_134 4
-#define CBR_150 5
-#define CBR_200 6
-#define CBR_300 7
-#define CBR_600 8
-#define CBR_1200 9
-#define CBR_1800 10
-#define CBR_2400 11
-#define CBR_4800 12
-#define CBR_9600 13
-#define CBR_19200 14
-#define CBR_38400 15
-#define CBR_2000 16
-#define CBR_3600 17
-#define CBR_7200 18
-#define CBR_56000 19
-#define CBR_57600 20
-#define CBR_64000 21
-#define CBR_76800 22
-#define CBR_115200 23
-#define CBR_C1 24 // Custom baud rate 1
-#define CBR_C2 25 // Custom baud rate 2
-#define CBR_153600 26
-#define CBR_230400 27
-#define CBR_307200 28
-#define CBR_460800 29
-#define CBR_921600 30
-
-// Set Character size
-//
-#define CMD_SETBITS(arg) \
- (((cmdSyntaxPtr)(ct08))->cmd[1] = (arg),(cmdSyntaxPtr)(ct08))
-
-#define CSZ_5 0
-#define CSZ_6 1
-#define CSZ_7 2
-#define CSZ_8 3
-
-// Set number of stop bits
-//
-#define CMD_SETSTOP(arg) \
- (((cmdSyntaxPtr)(ct09))->cmd[1] = (arg),(cmdSyntaxPtr)(ct09))
-
-#define CST_1 0
-#define CST_15 1 // 1.5 stop bits
-#define CST_2 2
-
-// Set parity option
-//
-#define CMD_SETPAR(arg) \
- (((cmdSyntaxPtr)(ct10))->cmd[1] = (arg),(cmdSyntaxPtr)(ct10))
-
-#define CSP_NP 0 // no parity
-#define CSP_OD 1 // odd parity
-#define CSP_EV 2 // Even parity
-#define CSP_SP 3 // Space parity
-#define CSP_MK 4 // Mark parity
-
-// Define xon char for transmitter flow control
-//
-#define CMD_DEF_IXON(arg) \
- (((cmdSyntaxPtr)(ct11))->cmd[1] = (arg),(cmdSyntaxPtr)(ct11))
-
-// Define xoff char for transmitter flow control
-//
-#define CMD_DEF_IXOFF(arg) \
- (((cmdSyntaxPtr)(ct12))->cmd[1] = (arg),(cmdSyntaxPtr)(ct12))
-
-#define CMD_STOPFL (cmdSyntaxPtr)(ct13) // Stop Flushing data
-
-// Acknowledge receipt of hotkey signal
-//
-#define CMD_HOTACK (cmdSyntaxPtr)(ct14)
-
-// Define irq level to use. Should actually be sent by library-level code, not
-// directly from user...
-//
-#define CMDVALUE_IRQ 15 // For library use at initialization. Until this command
- // is sent, board processing doesn't really start.
-#define CMD_SET_IRQ(arg) \
- (((cmdSyntaxPtr)(ct15))->cmd[1] = (arg),(cmdSyntaxPtr)(ct15))
-
-#define CIR_POLL 0 // No IRQ - Poll
-#define CIR_3 3 // IRQ 3
-#define CIR_4 4 // IRQ 4
-#define CIR_5 5 // IRQ 5
-#define CIR_7 7 // IRQ 7
-#define CIR_10 10 // IRQ 10
-#define CIR_11 11 // IRQ 11
-#define CIR_12 12 // IRQ 12
-#define CIR_15 15 // IRQ 15
-
-// Select transmit flow xon/xoff options
-//
-#define CMD_IXON_OPT(arg) \
- (((cmdSyntaxPtr)(ct16))->cmd[1] = (arg),(cmdSyntaxPtr)(ct16))
-
-#define CIX_NONE 0 // Incoming Xon/Xoff characters not special
-#define CIX_XON 1 // Xoff disable, Xon enable
-#define CIX_XANY 2 // Xoff disable, any key enable
-
-// Select receive flow xon/xoff options
-//
-#define CMD_OXON_OPT(arg) \
- (((cmdSyntaxPtr)(ct17))->cmd[1] = (arg),(cmdSyntaxPtr)(ct17))
-
-#define COX_NONE 0 // Don't send Xon/Xoff
-#define COX_XON 1 // Send xon/xoff to start/stop incoming data
-
-
-#define CMD_CTS_REP (cmdSyntaxPtr)(ct18) // Enable CTS reporting
-#define CMD_CTS_NREP (cmdSyntaxPtr)(ct19) // Disable CTS reporting
-
-#define CMD_DCD_REP (cmdSyntaxPtr)(ct20) // Enable DCD reporting
-#define CMD_DCD_NREP (cmdSyntaxPtr)(ct21) // Disable DCD reporting
-
-#define CMD_DSR_REP (cmdSyntaxPtr)(ct22) // Enable DSR reporting
-#define CMD_DSR_NREP (cmdSyntaxPtr)(ct23) // Disable DSR reporting
-
-#define CMD_RI_REP (cmdSyntaxPtr)(ct24) // Enable RI reporting
-#define CMD_RI_NREP (cmdSyntaxPtr)(ct25) // Disable RI reporting
-
-// Enable break reporting and select style
-//
-#define CMD_BRK_REP(arg) \
- (((cmdSyntaxPtr)(ct26))->cmd[1] = (arg),(cmdSyntaxPtr)(ct26))
-
-#define CBK_STAT 0x00 // Report breaks as a status (exception,irq)
-#define CBK_NULL 0x01 // Report breaks as a good null
-#define CBK_STAT_SEQ 0x02 // Report breaks as a status AND as in-band character
- // sequence FFh, 01h, 10h
-#define CBK_SEQ 0x03 // Report breaks as the in-band
- //sequence FFh, 01h, 10h ONLY.
-#define CBK_FLSH 0x04 // if this bit set also flush input data
-#define CBK_POSIX 0x08 // if this bit set report as FF,0,0 sequence
-#define CBK_SINGLE 0x10 // if this bit set with CBK_SEQ or CBK_STAT_SEQ
- //then reports single null instead of triple
-
-#define CMD_BRK_NREP (cmdSyntaxPtr)(ct27) // Disable break reporting
-
-// Specify maximum block size for received data
-//
-#define CMD_MAX_BLOCK(arg) \
- (((cmdSyntaxPtr)(ct28))->cmd[1] = (arg),(cmdSyntaxPtr)(ct28))
-
-// -- COMMAND 29 is reserved --
-
-#define CMD_CTSFL_ENAB (cmdSyntaxPtr)(ct30) // Enable CTS flow control
-#define CMD_CTSFL_DSAB (cmdSyntaxPtr)(ct31) // Disable CTS flow control
-#define CMD_RTSFL_ENAB (cmdSyntaxPtr)(ct32) // Enable RTS flow control
-#define CMD_RTSFL_DSAB (cmdSyntaxPtr)(ct33) // Disable RTS flow control
-
-// Specify istrip option
-//
-#define CMD_ISTRIP_OPT(arg) \
- (((cmdSyntaxPtr)(ct34))->cmd[1] = (arg),(cmdSyntaxPtr)(ct34))
-
-#define CIS_NOSTRIP 0 // Strip characters to character size
-#define CIS_STRIP 1 // Strip any 8-bit characters to 7 bits
-
-// Send a break of arg milliseconds
-//
-#define CMD_SEND_BRK(arg) \
- (((cmdSyntaxPtr)(ct35))->cmd[1] = (arg),(cmdSyntaxPtr)(ct35))
-
-// Set error reporting mode
-//
-#define CMD_SET_ERROR(arg) \
- (((cmdSyntaxPtr)(ct36))->cmd[1] = (arg),(cmdSyntaxPtr)(ct36))
-
-#define CSE_ESTAT 0 // Report error in a status packet
-#define CSE_NOREP 1 // Treat character as though it were good
-#define CSE_DROP 2 // Discard the character
-#define CSE_NULL 3 // Replace with a null
-#define CSE_MARK 4 // Replace with a 3-character sequence (as Unix)
-
-#define CSE_REPLACE 0x8 // Replace the errored character with the
- // replacement character defined here
-
-#define CSE_STAT_REPLACE 0x18 // Replace the errored character with the
- // replacement character defined here AND
- // report the error as a status packet (as in
- // CSE_ESTAT).
-
-
-// COMMAND 37, to send flow control packets, is handled only by low-level
-// library code in response to data movement and shouldn't ever be sent by the
-// user code. See i2pack.h and the body of i2lib.c for details.
-
-// Enable on-board post-processing, using options given in oflag argument.
-// Formerly, this command was automatically preceded by a CMD_OPOST_OFF command
-// because the loadware does not permit sending back-to-back CMD_OPOST_ON
-// commands without an intervening CMD_OPOST_OFF. BUT, WE LEARN 18 MAY 92, that
-// CMD_OPOST_ON and CMD_OPOST_OFF must each be at the end of a packet (or in a
-// solo packet). This means the caller must specify separately CMD_OPOST_OFF,
-// CMD_OPOST_ON(parm) when he calls i2QueueCommands(). That function will ensure
-// each gets a separate packet. Extra CMD_OPOST_OFF's are always ok.
-//
-#define CMD_OPOST_ON(oflag) \
- (*(USHORT *)(((cmdSyntaxPtr)(ct39))->cmd[1]) = (oflag), \
- (cmdSyntaxPtr)(ct39))
-
-#define CMD_OPOST_OFF (cmdSyntaxPtr)(ct40) // Disable on-board post-proc
-
-#define CMD_RESUME (cmdSyntaxPtr)(ct41) // Resume: behave as though an XON
- // were received;
-
-// Set Transmit baud rate (see command 7 for arguments)
-//
-#define CMD_SETBAUD_TX(arg) \
- (((cmdSyntaxPtr)(ct42))->cmd[1] = (arg),(cmdSyntaxPtr)(ct42))
-
-// Set Receive baud rate (see command 7 for arguments)
-//
-#define CMD_SETBAUD_RX(arg) \
- (((cmdSyntaxPtr)(ct43))->cmd[1] = (arg),(cmdSyntaxPtr)(ct43))
-
-// Request interrupt from board each arg milliseconds. Interrupt will specify
-// "received data", even though there may be no data present. If arg == 0,
-// disables any such interrupts.
-//
-#define CMD_PING_REQ(arg) \
- (((cmdSyntaxPtr)(ct44))->cmd[1] = (arg),(cmdSyntaxPtr)(ct44))
-
-#define CMD_HOT_ENAB (cmdSyntaxPtr)(ct45) // Enable Hot-key checking
-#define CMD_HOT_DSAB (cmdSyntaxPtr)(ct46) // Disable Hot-key checking
-
-#if 0
-// COMMAND 47: Send Protocol info via Unix flags:
-// iflag = Unix tty t_iflag
-// cflag = Unix tty t_cflag
-// lflag = Unix tty t_lflag
-// See System V Unix/Xenix documentation for the meanings of the bit fields
-// within these flags
-//
-#define CMD_UNIX_FLAGS(iflag,cflag,lflag) i2cmdUnixFlags(iflag,cflag,lflag)
-#endif /* 0 */
-
-#define CMD_DSRFL_ENAB (cmdSyntaxPtr)(ct48) // Enable DSR receiver ctrl
-#define CMD_DSRFL_DSAB (cmdSyntaxPtr)(ct49) // Disable DSR receiver ctrl
-#define CMD_DTRFL_ENAB (cmdSyntaxPtr)(ct50) // Enable DTR flow control
-#define CMD_DTRFL_DSAB (cmdSyntaxPtr)(ct51) // Disable DTR flow control
-#define CMD_BAUD_RESET (cmdSyntaxPtr)(ct52) // Reset baudrate table
-
-// COMMAND 54: Define custom rate #1
-// rate = (short) 1/10 of the desired baud rate
-//
-#define CMD_BAUD_DEF1(rate) i2cmdBaudDef(1,rate)
-
-// COMMAND 55: Define custom rate #2
-// rate = (short) 1/10 of the desired baud rate
-//
-#define CMD_BAUD_DEF2(rate) i2cmdBaudDef(2,rate)
-
-// Pause arg hundredths of seconds. (Note, this is NOT milliseconds.)
-//
-#define CMD_PAUSE(arg) \
- (((cmdSyntaxPtr)(ct56))->cmd[1] = (arg),(cmdSyntaxPtr)(ct56))
-
-#define CMD_SUSPEND (cmdSyntaxPtr)(ct57) // Suspend output
-#define CMD_UNSUSPEND (cmdSyntaxPtr)(ct58) // Un-Suspend output
-
-// Set parity-checking options
-//
-#define CMD_PARCHK(arg) \
- (((cmdSyntaxPtr)(ct59))->cmd[1] = (arg),(cmdSyntaxPtr)(ct59))
-
-#define CPK_ENAB 0 // Enable parity checking on input
-#define CPK_DSAB 1 // Disable parity checking on input
-
-#define CMD_BMARK_REQ (cmdSyntaxPtr)(ct60) // Bookmark request
-
-
-// Enable/Disable internal loopback mode
-//
-#define CMD_INLOOP(arg) \
- (((cmdSyntaxPtr)(ct61))->cmd[1] = (arg),(cmdSyntaxPtr)(ct61))
-
-#define CIN_DISABLE 0 // Normal operation (default)
-#define CIN_ENABLE 1 // Internal (local) loopback
-#define CIN_REMOTE 2 // Remote loopback
-
-// Specify timeout for hotkeys: Delay will be (arg x 10) milliseconds, arg == 0
-// --> no timeout: wait forever.
-//
-#define CMD_HOT_TIME(arg) \
- (((cmdSyntaxPtr)(ct62))->cmd[1] = (arg),(cmdSyntaxPtr)(ct62))
-
-
-// Define (outgoing) xon for receive flow control
-//
-#define CMD_DEF_OXON(arg) \
- (((cmdSyntaxPtr)(ct63))->cmd[1] = (arg),(cmdSyntaxPtr)(ct63))
-
-// Define (outgoing) xoff for receiver flow control
-//
-#define CMD_DEF_OXOFF(arg) \
- (((cmdSyntaxPtr)(ct64))->cmd[1] = (arg),(cmdSyntaxPtr)(ct64))
-
-// Enable/Disable RTS on transmit (1/2 duplex-style)
-//
-#define CMD_RTS_XMIT(arg) \
- (((cmdSyntaxPtr)(ct65))->cmd[1] = (arg),(cmdSyntaxPtr)(ct65))
-
-#define CHD_DISABLE 0
-#define CHD_ENABLE 1
-
-// Set high-water-mark level (debugging use only)
-//
-#define CMD_SETHIGHWAT(arg) \
- (((cmdSyntaxPtr)(ct66))->cmd[1] = (arg),(cmdSyntaxPtr)(ct66))
-
-// Start flushing tagged data (tag = 0-14)
-//
-#define CMD_START_SELFL(tag) \
- (((cmdSyntaxPtr)(ct67))->cmd[1] = (tag),(cmdSyntaxPtr)(ct67))
-
-// End flushing tagged data (tag = 0-14)
-//
-#define CMD_END_SELFL(tag) \
- (((cmdSyntaxPtr)(ct68))->cmd[1] = (tag),(cmdSyntaxPtr)(ct68))
-
-#define CMD_HWFLOW_OFF (cmdSyntaxPtr)(ct69) // Disable HW TX flow control
-#define CMD_ODSRFL_ENAB (cmdSyntaxPtr)(ct70) // Enable DSR output f/c
-#define CMD_ODSRFL_DSAB (cmdSyntaxPtr)(ct71) // Disable DSR output f/c
-#define CMD_ODCDFL_ENAB (cmdSyntaxPtr)(ct72) // Enable DCD output f/c
-#define CMD_ODCDFL_DSAB (cmdSyntaxPtr)(ct73) // Disable DCD output f/c
-
-// Set transmit interrupt load level. Count should be an even value 2-12
-//
-#define CMD_LOADLEVEL(count) \
- (((cmdSyntaxPtr)(ct74))->cmd[1] = (count),(cmdSyntaxPtr)(ct74))
-
-// If reporting DSS changes, map to character sequence FFh, 2, MSR
-//
-#define CMD_STATDATA(arg) \
- (((cmdSyntaxPtr)(ct75))->cmd[1] = (arg),(cmdSyntaxPtr)(ct75))
-
-#define CSTD_DISABLE// Report DSS changes as status packets only (default)
-#define CSTD_ENABLE // Report DSS changes as in-band data sequence as well as
- // by status packet.
-
-#define CMD_BREAK_ON (cmdSyntaxPtr)(ct76)// Set break and stop xmit
-#define CMD_BREAK_OFF (cmdSyntaxPtr)(ct77)// End break and restart xmit
-#define CMD_GETFC (cmdSyntaxPtr)(ct78)// Request for flow control packet
- // from board.
-
-// Transmit this character immediately
-//
-#define CMD_XMIT_NOW(ch) \
- (((cmdSyntaxPtr)(ct79))->cmd[1] = (ch),(cmdSyntaxPtr)(ct79))
-
-// Set baud rate via "divisor latch"
-//
-#define CMD_DIVISOR_LATCH(which,value) \
- (((cmdSyntaxPtr)(ct80))->cmd[1] = (which), \
- *(USHORT *)(((cmdSyntaxPtr)(ct80))->cmd[2]) = (value), \
- (cmdSyntaxPtr)(ct80))
-
-#define CDL_RX 1 // Set receiver rate
-#define CDL_TX 2 // Set transmit rate
- // (CDL_TX | CDL_RX) Set both rates
-
-// Request for special diagnostic status pkt from the board.
-//
-#define CMD_GET_STATUS (cmdSyntaxPtr)(ct81)
-
-// Request time-stamped transmit character count packet.
-//
-#define CMD_GET_TXCNT (cmdSyntaxPtr)(ct82)
-
-// Request time-stamped receive character count packet.
-//
-#define CMD_GET_RXCNT (cmdSyntaxPtr)(ct83)
-
-// Request for box/board I.D. packet.
-#define CMD_GET_BOXIDS (cmdSyntaxPtr)(ct84)
-
-// Enable or disable multiple channels according to bit-mapped ushorts box 1-4
-//
-#define CMD_ENAB_MULT(enable, box1, box2, box3, box4) \
- (((cmdSytaxPtr)(ct85))->cmd[1] = (enable), \
- *(USHORT *)(((cmdSyntaxPtr)(ct85))->cmd[2]) = (box1), \
- *(USHORT *)(((cmdSyntaxPtr)(ct85))->cmd[4]) = (box2), \
- *(USHORT *)(((cmdSyntaxPtr)(ct85))->cmd[6]) = (box3), \
- *(USHORT *)(((cmdSyntaxPtr)(ct85))->cmd[8]) = (box4), \
- (cmdSyntaxPtr)(ct85))
-
-#define CEM_DISABLE 0
-#define CEM_ENABLE 1
-
-// Enable or disable receiver or receiver interrupts (default both enabled)
-//
-#define CMD_RCV_ENABLE(ch) \
- (((cmdSyntaxPtr)(ct86))->cmd[1] = (ch),(cmdSyntaxPtr)(ct86))
-
-#define CRE_OFF 0 // Disable the receiver
-#define CRE_ON 1 // Enable the receiver
-#define CRE_INTOFF 2 // Disable receiver interrupts (to loadware)
-#define CRE_INTON 3 // Enable receiver interrupts (to loadware)
-
-// Starts up a hardware test process, which runs transparently, and sends a
-// STAT_HWFAIL packet in case a hardware failure is detected.
-//
-#define CMD_HW_TEST (cmdSyntaxPtr)(ct87)
-
-// Change receiver threshold and timeout value:
-// Defaults: timeout = 20mS
-// threshold count = 8 when DTRflow not in use,
-// threshold count = 5 when DTRflow in use.
-//
-#define CMD_RCV_THRESHOLD(count,ms) \
- (((cmdSyntaxPtr)(ct88))->cmd[1] = (count), \
- ((cmdSyntaxPtr)(ct88))->cmd[2] = (ms), \
- (cmdSyntaxPtr)(ct88))
-
-// Makes the loadware report DSS signals for this channel immediately.
-//
-#define CMD_DSS_NOW (cmdSyntaxPtr)(ct89)
-
-// Set the receive silo parameters
-// timeout is ms idle wait until delivery (~VTIME)
-// threshold is max characters cause interrupt (~VMIN)
-//
-#define CMD_SET_SILO(timeout,threshold) \
- (((cmdSyntaxPtr)(ct90))->cmd[1] = (timeout), \
- ((cmdSyntaxPtr)(ct90))->cmd[2] = (threshold), \
- (cmdSyntaxPtr)(ct90))
-
-// Set timed break in decisecond (1/10s)
-//
-#define CMD_LBREAK(ds) \
- (((cmdSyntaxPtr)(ct91))->cmd[1] = (ds),(cmdSyntaxPtr)(ct66))
-
-
-
-#endif // I2CMD_H
diff --git a/drivers/char/ip2/i2ellis.c b/drivers/char/ip2/i2ellis.c
deleted file mode 100644
index 29db44de399f..000000000000
--- a/drivers/char/ip2/i2ellis.c
+++ /dev/null
@@ -1,1403 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Low-level interface code for the device driver
-* (This is included source code, not a separate compilation
-* module.)
-*
-*******************************************************************************/
-//---------------------------------------------
-// Function declarations private to this module
-//---------------------------------------------
-// Functions called only indirectly through i2eBordStr entries.
-
-static int iiWriteBuf16(i2eBordStrPtr, unsigned char *, int);
-static int iiWriteBuf8(i2eBordStrPtr, unsigned char *, int);
-static int iiReadBuf16(i2eBordStrPtr, unsigned char *, int);
-static int iiReadBuf8(i2eBordStrPtr, unsigned char *, int);
-
-static unsigned short iiReadWord16(i2eBordStrPtr);
-static unsigned short iiReadWord8(i2eBordStrPtr);
-static void iiWriteWord16(i2eBordStrPtr, unsigned short);
-static void iiWriteWord8(i2eBordStrPtr, unsigned short);
-
-static int iiWaitForTxEmptyII(i2eBordStrPtr, int);
-static int iiWaitForTxEmptyIIEX(i2eBordStrPtr, int);
-static int iiTxMailEmptyII(i2eBordStrPtr);
-static int iiTxMailEmptyIIEX(i2eBordStrPtr);
-static int iiTrySendMailII(i2eBordStrPtr, unsigned char);
-static int iiTrySendMailIIEX(i2eBordStrPtr, unsigned char);
-
-static unsigned short iiGetMailII(i2eBordStrPtr);
-static unsigned short iiGetMailIIEX(i2eBordStrPtr);
-
-static void iiEnableMailIrqII(i2eBordStrPtr);
-static void iiEnableMailIrqIIEX(i2eBordStrPtr);
-static void iiWriteMaskII(i2eBordStrPtr, unsigned char);
-static void iiWriteMaskIIEX(i2eBordStrPtr, unsigned char);
-
-static void ii2Nop(void);
-
-//***************
-//* Static Data *
-//***************
-
-static int ii2Safe; // Safe I/O address for delay routine
-
-static int iiDelayed; // Set when the iiResetDelay function is
- // called. Cleared when ANY board is reset.
-static DEFINE_RWLOCK(Dl_spinlock);
-
-//********
-//* Code *
-//********
-
-//=======================================================
-// Initialization Routines
-//
-// iiSetAddress
-// iiReset
-// iiResetDelay
-// iiInitialize
-//=======================================================
-
-//******************************************************************************
-// Function: iiSetAddress(pB, address, delay)
-// Parameters: pB - pointer to the board structure
-// address - the purported I/O address of the board
-// delay - pointer to the 1-ms delay function to use
-// in this and any future operations to this board
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// This routine (roughly) checks for address validity, sets the i2eValid OK and
-// sets the state to II_STATE_COLD which means that we haven't even sent a reset
-// yet.
-//
-//******************************************************************************
-static int
-iiSetAddress( i2eBordStrPtr pB, int address, delayFunc_t delay )
-{
- // Should any failure occur before init is finished...
- pB->i2eValid = I2E_INCOMPLETE;
-
- // Cannot check upper limit except extremely: Might be microchannel
- // Address must be on an 8-byte boundary
-
- if ((unsigned int)address <= 0x100
- || (unsigned int)address >= 0xfff8
- || (address & 0x7)
- )
- {
- I2_COMPLETE(pB, I2EE_BADADDR);
- }
-
- // Initialize accelerators
- pB->i2eBase = address;
- pB->i2eData = address + FIFO_DATA;
- pB->i2eStatus = address + FIFO_STATUS;
- pB->i2ePointer = address + FIFO_PTR;
- pB->i2eXMail = address + FIFO_MAIL;
- pB->i2eXMask = address + FIFO_MASK;
-
- // Initialize i/o address for ii2DelayIO
- ii2Safe = address + FIFO_NOP;
-
- // Initialize the delay routine
- pB->i2eDelay = ((delay != (delayFunc_t)NULL) ? delay : (delayFunc_t)ii2Nop);
-
- pB->i2eValid = I2E_MAGIC;
- pB->i2eState = II_STATE_COLD;
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiReset(pB)
-// Parameters: pB - pointer to the board structure
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Attempts to reset the board (see also i2hw.h). Normally, we would use this to
-// reset a board immediately after iiSetAddress(), but it is valid to reset a
-// board from any state, say, in order to change or re-load loadware. (Under
-// such circumstances, no reason to re-run iiSetAddress(), which is why it is a
-// separate routine and not included in this routine.
-//
-//******************************************************************************
-static int
-iiReset(i2eBordStrPtr pB)
-{
- // Magic number should be set, else even the address is suspect
- if (pB->i2eValid != I2E_MAGIC)
- {
- I2_COMPLETE(pB, I2EE_BADMAGIC);
- }
-
- outb(0, pB->i2eBase + FIFO_RESET); /* Any data will do */
- iiDelay(pB, 50); // Pause between resets
- outb(0, pB->i2eBase + FIFO_RESET); /* Second reset */
-
- // We must wait before even attempting to read anything from the FIFO: the
- // board's P.O.S.T may actually attempt to read and write its end of the
- // FIFO in order to check flags, loop back (where supported), etc. On
- // completion of this testing it would reset the FIFO, and on completion
- // of all // P.O.S.T., write the message. We must not mistake data which
- // might have been sent for testing as part of the reset message. To
- // better utilize time, say, when resetting several boards, we allow the
- // delay to be performed externally; in this way the caller can reset
- // several boards, delay a single time, then call the initialization
- // routine for all.
-
- pB->i2eState = II_STATE_RESET;
-
- iiDelayed = 0; // i.e., the delay routine hasn't been called since the most
- // recent reset.
-
- // Ensure anything which would have been of use to standard loadware is
- // blanked out, since board has now forgotten everything!.
-
- pB->i2eUsingIrq = I2_IRQ_UNDEFINED; /* to not use an interrupt so far */
- pB->i2eWaitingForEmptyFifo = 0;
- pB->i2eOutMailWaiting = 0;
- pB->i2eChannelPtr = NULL;
- pB->i2eChannelCnt = 0;
-
- pB->i2eLeadoffWord[0] = 0;
- pB->i2eFifoInInts = 0;
- pB->i2eFifoOutInts = 0;
- pB->i2eFatalTrap = NULL;
- pB->i2eFatal = 0;
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiResetDelay(pB)
-// Parameters: pB - pointer to the board structure
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Using the delay defined in board structure, waits two seconds (for board to
-// reset).
-//
-//******************************************************************************
-static int
-iiResetDelay(i2eBordStrPtr pB)
-{
- if (pB->i2eValid != I2E_MAGIC) {
- I2_COMPLETE(pB, I2EE_BADMAGIC);
- }
- if (pB->i2eState != II_STATE_RESET) {
- I2_COMPLETE(pB, I2EE_BADSTATE);
- }
- iiDelay(pB,2000); /* Now we wait for two seconds. */
- iiDelayed = 1; /* Delay has been called: ok to initialize */
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiInitialize(pB)
-// Parameters: pB - pointer to the board structure
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Attempts to read the Power-on reset message. Initializes any remaining fields
-// in the pB structure.
-//
-// This should be called as the third step of a process beginning with
-// iiReset(), then iiResetDelay(). This routine checks to see that the structure
-// is "valid" and in the reset state, also confirms that the delay routine has
-// been called since the latest reset (to any board! overly strong!).
-//
-//******************************************************************************
-static int
-iiInitialize(i2eBordStrPtr pB)
-{
- int itemp;
- unsigned char c;
- unsigned short utemp;
- unsigned int ilimit;
-
- if (pB->i2eValid != I2E_MAGIC)
- {
- I2_COMPLETE(pB, I2EE_BADMAGIC);
- }
-
- if (pB->i2eState != II_STATE_RESET || !iiDelayed)
- {
- I2_COMPLETE(pB, I2EE_BADSTATE);
- }
-
- // In case there is a failure short of our completely reading the power-up
- // message.
- pB->i2eValid = I2E_INCOMPLETE;
-
-
- // Now attempt to read the message.
-
- for (itemp = 0; itemp < sizeof(porStr); itemp++)
- {
- // We expect the entire message is ready.
- if (!I2_HAS_INPUT(pB)) {
- pB->i2ePomSize = itemp;
- I2_COMPLETE(pB, I2EE_PORM_SHORT);
- }
-
- pB->i2ePom.c[itemp] = c = inb(pB->i2eData);
-
- // We check the magic numbers as soon as they are supposed to be read
- // (rather than after) to minimize effect of reading something we
- // already suspect can't be "us".
- if ( (itemp == POR_1_INDEX && c != POR_MAGIC_1) ||
- (itemp == POR_2_INDEX && c != POR_MAGIC_2))
- {
- pB->i2ePomSize = itemp+1;
- I2_COMPLETE(pB, I2EE_BADMAGIC);
- }
- }
-
- pB->i2ePomSize = itemp;
-
- // Ensure that this was all the data...
- if (I2_HAS_INPUT(pB))
- I2_COMPLETE(pB, I2EE_PORM_LONG);
-
- // For now, we'll fail to initialize if P.O.S.T reports bad chip mapper:
- // Implying we will not be able to download any code either: That's ok: the
- // condition is pretty explicit.
- if (pB->i2ePom.e.porDiag1 & POR_BAD_MAPPER)
- {
- I2_COMPLETE(pB, I2EE_POSTERR);
- }
-
- // Determine anything which must be done differently depending on the family
- // of boards!
- switch (pB->i2ePom.e.porID & POR_ID_FAMILY)
- {
- case POR_ID_FII: // IntelliPort-II
-
- pB->i2eFifoStyle = FIFO_II;
- pB->i2eFifoSize = 512; // 512 bytes, always
- pB->i2eDataWidth16 = false;
-
- pB->i2eMaxIrq = 15; // Because board cannot tell us it is in an 8-bit
- // slot, we do allow it to be done (documentation!)
-
- pB->i2eGoodMap[1] =
- pB->i2eGoodMap[2] =
- pB->i2eGoodMap[3] =
- pB->i2eChannelMap[1] =
- pB->i2eChannelMap[2] =
- pB->i2eChannelMap[3] = 0;
-
- switch (pB->i2ePom.e.porID & POR_ID_SIZE)
- {
- case POR_ID_II_4:
- pB->i2eGoodMap[0] =
- pB->i2eChannelMap[0] = 0x0f; // four-port
-
- // Since porPorts1 is based on the Hardware ID register, the numbers
- // should always be consistent for IntelliPort-II. Ditto below...
- if (pB->i2ePom.e.porPorts1 != 4)
- {
- I2_COMPLETE(pB, I2EE_INCONSIST);
- }
- break;
-
- case POR_ID_II_8:
- case POR_ID_II_8R:
- pB->i2eGoodMap[0] =
- pB->i2eChannelMap[0] = 0xff; // Eight port
- if (pB->i2ePom.e.porPorts1 != 8)
- {
- I2_COMPLETE(pB, I2EE_INCONSIST);
- }
- break;
-
- case POR_ID_II_6:
- pB->i2eGoodMap[0] =
- pB->i2eChannelMap[0] = 0x3f; // Six Port
- if (pB->i2ePom.e.porPorts1 != 6)
- {
- I2_COMPLETE(pB, I2EE_INCONSIST);
- }
- break;
- }
-
- // Fix up the "good channel list based on any errors reported.
- if (pB->i2ePom.e.porDiag1 & POR_BAD_UART1)
- {
- pB->i2eGoodMap[0] &= ~0x0f;
- }
-
- if (pB->i2ePom.e.porDiag1 & POR_BAD_UART2)
- {
- pB->i2eGoodMap[0] &= ~0xf0;
- }
-
- break; // POR_ID_FII case
-
- case POR_ID_FIIEX: // IntelliPort-IIEX
-
- pB->i2eFifoStyle = FIFO_IIEX;
-
- itemp = pB->i2ePom.e.porFifoSize;
-
- // Implicit assumption that fifo would not grow beyond 32k,
- // nor would ever be less than 256.
-
- if (itemp < 8 || itemp > 15)
- {
- I2_COMPLETE(pB, I2EE_INCONSIST);
- }
- pB->i2eFifoSize = (1 << itemp);
-
- // These are based on what P.O.S.T thinks should be there, based on
- // box ID registers
- ilimit = pB->i2ePom.e.porNumBoxes;
- if (ilimit > ABS_MAX_BOXES)
- {
- ilimit = ABS_MAX_BOXES;
- }
-
- // For as many boxes as EXIST, gives the type of box.
- // Added 8/6/93: check for the ISA-4 (asic) which looks like an
- // expandable but for whom "8 or 16?" is not the right question.
-
- utemp = pB->i2ePom.e.porFlags;
- if (utemp & POR_CEX4)
- {
- pB->i2eChannelMap[0] = 0x000f;
- } else {
- utemp &= POR_BOXES;
- for (itemp = 0; itemp < ilimit; itemp++)
- {
- pB->i2eChannelMap[itemp] =
- ((utemp & POR_BOX_16) ? 0xffff : 0x00ff);
- utemp >>= 1;
- }
- }
-
- // These are based on what P.O.S.T actually found.
-
- utemp = (pB->i2ePom.e.porPorts2 << 8) + pB->i2ePom.e.porPorts1;
-
- for (itemp = 0; itemp < ilimit; itemp++)
- {
- pB->i2eGoodMap[itemp] = 0;
- if (utemp & 1) pB->i2eGoodMap[itemp] |= 0x000f;
- if (utemp & 2) pB->i2eGoodMap[itemp] |= 0x00f0;
- if (utemp & 4) pB->i2eGoodMap[itemp] |= 0x0f00;
- if (utemp & 8) pB->i2eGoodMap[itemp] |= 0xf000;
- utemp >>= 4;
- }
-
- // Now determine whether we should transfer in 8 or 16-bit mode.
- switch (pB->i2ePom.e.porBus & (POR_BUS_SLOT16 | POR_BUS_DIP16) )
- {
- case POR_BUS_SLOT16 | POR_BUS_DIP16:
- pB->i2eDataWidth16 = true;
- pB->i2eMaxIrq = 15;
- break;
-
- case POR_BUS_SLOT16:
- pB->i2eDataWidth16 = false;
- pB->i2eMaxIrq = 15;
- break;
-
- case 0:
- case POR_BUS_DIP16: // In an 8-bit slot, DIP switch don't care.
- default:
- pB->i2eDataWidth16 = false;
- pB->i2eMaxIrq = 7;
- break;
- }
- break; // POR_ID_FIIEX case
-
- default: // Unknown type of board
- I2_COMPLETE(pB, I2EE_BAD_FAMILY);
- break;
- } // End the switch based on family
-
- // Temporarily, claim there is no room in the outbound fifo.
- // We will maintain this whenever we check for an empty outbound FIFO.
- pB->i2eFifoRemains = 0;
-
- // Now, based on the bus type, should we expect to be able to re-configure
- // interrupts (say, for testing purposes).
- switch (pB->i2ePom.e.porBus & POR_BUS_TYPE)
- {
- case POR_BUS_T_ISA:
- case POR_BUS_T_UNK: // If the type of bus is undeclared, assume ok.
- case POR_BUS_T_MCA:
- case POR_BUS_T_EISA:
- break;
- default:
- I2_COMPLETE(pB, I2EE_BADBUS);
- }
-
- if (pB->i2eDataWidth16)
- {
- pB->i2eWriteBuf = iiWriteBuf16;
- pB->i2eReadBuf = iiReadBuf16;
- pB->i2eWriteWord = iiWriteWord16;
- pB->i2eReadWord = iiReadWord16;
- } else {
- pB->i2eWriteBuf = iiWriteBuf8;
- pB->i2eReadBuf = iiReadBuf8;
- pB->i2eWriteWord = iiWriteWord8;
- pB->i2eReadWord = iiReadWord8;
- }
-
- switch(pB->i2eFifoStyle)
- {
- case FIFO_II:
- pB->i2eWaitForTxEmpty = iiWaitForTxEmptyII;
- pB->i2eTxMailEmpty = iiTxMailEmptyII;
- pB->i2eTrySendMail = iiTrySendMailII;
- pB->i2eGetMail = iiGetMailII;
- pB->i2eEnableMailIrq = iiEnableMailIrqII;
- pB->i2eWriteMask = iiWriteMaskII;
-
- break;
-
- case FIFO_IIEX:
- pB->i2eWaitForTxEmpty = iiWaitForTxEmptyIIEX;
- pB->i2eTxMailEmpty = iiTxMailEmptyIIEX;
- pB->i2eTrySendMail = iiTrySendMailIIEX;
- pB->i2eGetMail = iiGetMailIIEX;
- pB->i2eEnableMailIrq = iiEnableMailIrqIIEX;
- pB->i2eWriteMask = iiWriteMaskIIEX;
-
- break;
-
- default:
- I2_COMPLETE(pB, I2EE_INCONSIST);
- }
-
- // Initialize state information.
- pB->i2eState = II_STATE_READY; // Ready to load loadware.
-
- // Some Final cleanup:
- // For some boards, the bootstrap firmware may perform some sort of test
- // resulting in a stray character pending in the incoming mailbox. If one is
- // there, it should be read and discarded, especially since for the standard
- // firmware, it's the mailbox that interrupts the host.
-
- pB->i2eStartMail = iiGetMail(pB);
-
- // Throw it away and clear the mailbox structure element
- pB->i2eStartMail = NO_MAIL_HERE;
-
- // Everything is ok now, return with good status/
-
- pB->i2eValid = I2E_MAGIC;
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: ii2DelayTimer(mseconds)
-// Parameters: mseconds - number of milliseconds to delay
-//
-// Returns: Nothing
-//
-// Description:
-//
-// This routine delays for approximately mseconds milliseconds and is intended
-// to be called indirectly through i2Delay field in i2eBordStr. It uses the
-// Linux timer_list mechanism.
-//
-// The Linux timers use a unit called "jiffies" which are 10mS in the Intel
-// architecture. This function rounds the delay period up to the next "jiffy".
-// In the Alpha architecture the "jiffy" is 1mS, but this driver is not intended
-// for Alpha platforms at this time.
-//
-//******************************************************************************
-static void
-ii2DelayTimer(unsigned int mseconds)
-{
- msleep_interruptible(mseconds);
-}
-
-#if 0
-//static void ii2DelayIO(unsigned int);
-//******************************************************************************
-// !!! Not Used, this is DOS crap, some of you young folks may be interested in
-// in how things were done in the stone age of caculating machines !!!
-// Function: ii2DelayIO(mseconds)
-// Parameters: mseconds - number of milliseconds to delay
-//
-// Returns: Nothing
-//
-// Description:
-//
-// This routine delays for approximately mseconds milliseconds and is intended
-// to be called indirectly through i2Delay field in i2eBordStr. It is intended
-// for use where a clock-based function is impossible: for example, DOS drivers.
-//
-// This function uses the IN instruction to place bounds on the timing and
-// assumes that ii2Safe has been set. This is because I/O instructions are not
-// subject to caching and will therefore take a certain minimum time. To ensure
-// the delay is at least long enough on fast machines, it is based on some
-// fastest-case calculations. On slower machines this may cause VERY long
-// delays. (3 x fastest case). In the fastest case, everything is cached except
-// the I/O instruction itself.
-//
-// Timing calculations:
-// The fastest bus speed for I/O operations is likely to be 10 MHz. The I/O
-// operation in question is a byte operation to an odd address. For 8-bit
-// operations, the architecture generally enforces two wait states. At 10 MHz, a
-// single cycle time is 100nS. A read operation at two wait states takes 6
-// cycles for a total time of 600nS. Therefore approximately 1666 iterations
-// would be required to generate a single millisecond delay. The worst
-// (reasonable) case would be an 8MHz system with no cacheing. In this case, the
-// I/O instruction would take 125nS x 6 cyles = 750 nS. More importantly, code
-// fetch of other instructions in the loop would take time (zero wait states,
-// however) and would be hard to estimate. This is minimized by using in-line
-// assembler for the in inner loop of IN instructions. This consists of just a
-// few bytes. So we'll guess about four code fetches per loop. Each code fetch
-// should take four cycles, so we have 125nS * 8 = 1000nS. Worst case then is
-// that what should have taken 1 mS takes instead 1666 * (1750) = 2.9 mS.
-//
-// So much for theoretical timings: results using 1666 value on some actual
-// machines:
-// IBM 286 6MHz 3.15 mS
-// Zenith 386 33MHz 2.45 mS
-// (brandX) 386 33MHz 1.90 mS (has cache)
-// (brandY) 486 33MHz 2.35 mS
-// NCR 486 ?? 1.65 mS (microchannel)
-//
-// For most machines, it is probably safe to scale this number back (remember,
-// for robust operation use an actual timed delay if possible), so we are using
-// a value of 1190. This yields 1.17 mS for the fastest machine in our sample,
-// 1.75 mS for typical 386 machines, and 2.25 mS the absolute slowest machine.
-//
-// 1/29/93:
-// The above timings are too slow. Actual cycle times might be faster. ISA cycle
-// times could approach 500 nS, and ...
-// The IBM model 77 being microchannel has no wait states for 8-bit reads and
-// seems to be accessing the I/O at 440 nS per access (from start of one to
-// start of next). This would imply we need 1000/.440 = 2272 iterations to
-// guarantee we are fast enough. In actual testing, we see that 2 * 1190 are in
-// fact enough. For diagnostics, we keep the level at 1190, but developers note
-// this needs tuning.
-//
-// Safe assumption: 2270 i/o reads = 1 millisecond
-//
-//******************************************************************************
-
-
-static int ii2DelValue = 1190; // See timing calculations below
- // 1666 for fastest theoretical machine
- // 1190 safe for most fast 386 machines
- // 1000 for fastest machine tested here
- // 540 (sic) for AT286/6Mhz
-static void
-ii2DelayIO(unsigned int mseconds)
-{
- if (!ii2Safe)
- return; /* Do nothing if this variable uninitialized */
-
- while(mseconds--) {
- int i = ii2DelValue;
- while ( i-- ) {
- inb(ii2Safe);
- }
- }
-}
-#endif
-
-//******************************************************************************
-// Function: ii2Nop()
-// Parameters: None
-//
-// Returns: Nothing
-//
-// Description:
-//
-// iiInitialize will set i2eDelay to this if the delay parameter is NULL. This
-// saves checking for a NULL pointer at every call.
-//******************************************************************************
-static void
-ii2Nop(void)
-{
- return; // no mystery here
-}
-
-//=======================================================
-// Routines which are available in 8/16-bit versions, or
-// in different fifo styles. These are ALL called
-// indirectly through the board structure.
-//=======================================================
-
-//******************************************************************************
-// Function: iiWriteBuf16(pB, address, count)
-// Parameters: pB - pointer to board structure
-// address - address of data to write
-// count - number of data bytes to write
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Writes 'count' bytes from 'address' to the data fifo specified by the board
-// structure pointer pB. Should count happen to be odd, an extra pad byte is
-// sent (identity unknown...). Uses 16-bit (word) operations. Is called
-// indirectly through pB->i2eWriteBuf.
-//
-//******************************************************************************
-static int
-iiWriteBuf16(i2eBordStrPtr pB, unsigned char *address, int count)
-{
- // Rudimentary sanity checking here.
- if (pB->i2eValid != I2E_MAGIC)
- I2_COMPLETE(pB, I2EE_INVALID);
-
- I2_OUTSW(pB->i2eData, address, count);
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiWriteBuf8(pB, address, count)
-// Parameters: pB - pointer to board structure
-// address - address of data to write
-// count - number of data bytes to write
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Writes 'count' bytes from 'address' to the data fifo specified by the board
-// structure pointer pB. Should count happen to be odd, an extra pad byte is
-// sent (identity unknown...). This is to be consistent with the 16-bit version.
-// Uses 8-bit (byte) operations. Is called indirectly through pB->i2eWriteBuf.
-//
-//******************************************************************************
-static int
-iiWriteBuf8(i2eBordStrPtr pB, unsigned char *address, int count)
-{
- /* Rudimentary sanity checking here */
- if (pB->i2eValid != I2E_MAGIC)
- I2_COMPLETE(pB, I2EE_INVALID);
-
- I2_OUTSB(pB->i2eData, address, count);
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiReadBuf16(pB, address, count)
-// Parameters: pB - pointer to board structure
-// address - address to put data read
-// count - number of data bytes to read
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Reads 'count' bytes into 'address' from the data fifo specified by the board
-// structure pointer pB. Should count happen to be odd, an extra pad byte is
-// received (identity unknown...). Uses 16-bit (word) operations. Is called
-// indirectly through pB->i2eReadBuf.
-//
-//******************************************************************************
-static int
-iiReadBuf16(i2eBordStrPtr pB, unsigned char *address, int count)
-{
- // Rudimentary sanity checking here.
- if (pB->i2eValid != I2E_MAGIC)
- I2_COMPLETE(pB, I2EE_INVALID);
-
- I2_INSW(pB->i2eData, address, count);
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiReadBuf8(pB, address, count)
-// Parameters: pB - pointer to board structure
-// address - address to put data read
-// count - number of data bytes to read
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Reads 'count' bytes into 'address' from the data fifo specified by the board
-// structure pointer pB. Should count happen to be odd, an extra pad byte is
-// received (identity unknown...). This to match the 16-bit behaviour. Uses
-// 8-bit (byte) operations. Is called indirectly through pB->i2eReadBuf.
-//
-//******************************************************************************
-static int
-iiReadBuf8(i2eBordStrPtr pB, unsigned char *address, int count)
-{
- // Rudimentary sanity checking here.
- if (pB->i2eValid != I2E_MAGIC)
- I2_COMPLETE(pB, I2EE_INVALID);
-
- I2_INSB(pB->i2eData, address, count);
-
- I2_COMPLETE(pB, I2EE_GOOD);
-}
-
-//******************************************************************************
-// Function: iiReadWord16(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Returns the word read from the data fifo specified by the board-structure
-// pointer pB. Uses a 16-bit operation. Is called indirectly through
-// pB->i2eReadWord.
-//
-//******************************************************************************
-static unsigned short
-iiReadWord16(i2eBordStrPtr pB)
-{
- return inw(pB->i2eData);
-}
-
-//******************************************************************************
-// Function: iiReadWord8(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Returns the word read from the data fifo specified by the board-structure
-// pointer pB. Uses two 8-bit operations. Bytes are assumed to be LSB first. Is
-// called indirectly through pB->i2eReadWord.
-//
-//******************************************************************************
-static unsigned short
-iiReadWord8(i2eBordStrPtr pB)
-{
- unsigned short urs;
-
- urs = inb(pB->i2eData);
-
- return (inb(pB->i2eData) << 8) | urs;
-}
-
-//******************************************************************************
-// Function: iiWriteWord16(pB, value)
-// Parameters: pB - pointer to board structure
-// value - data to write
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Writes the word 'value' to the data fifo specified by the board-structure
-// pointer pB. Uses 16-bit operation. Is called indirectly through
-// pB->i2eWriteWord.
-//
-//******************************************************************************
-static void
-iiWriteWord16(i2eBordStrPtr pB, unsigned short value)
-{
- outw((int)value, pB->i2eData);
-}
-
-//******************************************************************************
-// Function: iiWriteWord8(pB, value)
-// Parameters: pB - pointer to board structure
-// value - data to write
-//
-// Returns: True if everything appears copacetic.
-// False if there is any error: the pB->i2eError field has the error
-//
-// Description:
-//
-// Writes the word 'value' to the data fifo specified by the board-structure
-// pointer pB. Uses two 8-bit operations (writes LSB first). Is called
-// indirectly through pB->i2eWriteWord.
-//
-//******************************************************************************
-static void
-iiWriteWord8(i2eBordStrPtr pB, unsigned short value)
-{
- outb((char)value, pB->i2eData);
- outb((char)(value >> 8), pB->i2eData);
-}
-
-//******************************************************************************
-// Function: iiWaitForTxEmptyII(pB, mSdelay)
-// Parameters: pB - pointer to board structure
-// mSdelay - period to wait before returning
-//
-// Returns: True if the FIFO is empty.
-// False if it not empty in the required time: the pB->i2eError
-// field has the error.
-//
-// Description:
-//
-// Waits up to "mSdelay" milliseconds for the outgoing FIFO to become empty; if
-// not empty by the required time, returns false and error in pB->i2eError,
-// otherwise returns true.
-//
-// mSdelay == 0 is taken to mean must be empty on the first test.
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-// Note this routine is organized so that if status is ok there is no delay at
-// all called either before or after the test. Is called indirectly through
-// pB->i2eWaitForTxEmpty.
-//
-//******************************************************************************
-static int
-iiWaitForTxEmptyII(i2eBordStrPtr pB, int mSdelay)
-{
- unsigned long flags;
- int itemp;
-
- for (;;)
- {
- // This routine hinges on being able to see the "other" status register
- // (as seen by the local processor). His incoming fifo is our outgoing
- // FIFO.
- //
- // By the nature of this routine, you would be using this as part of a
- // larger atomic context: i.e., you would use this routine to ensure the
- // fifo empty, then act on this information. Between these two halves,
- // you will generally not want to service interrupts or in any way
- // disrupt the assumptions implicit in the larger context.
- //
- // Even worse, however, this routine "shifts" the status register to
- // point to the local status register which is not the usual situation.
- // Therefore for extra safety, we force the critical section to be
- // completely atomic, and pick up after ourselves before allowing any
- // interrupts of any kind.
-
-
- write_lock_irqsave(&Dl_spinlock, flags);
- outb(SEL_COMMAND, pB->i2ePointer);
- outb(SEL_CMD_SH, pB->i2ePointer);
-
- itemp = inb(pB->i2eStatus);
-
- outb(SEL_COMMAND, pB->i2ePointer);
- outb(SEL_CMD_UNSH, pB->i2ePointer);
-
- if (itemp & ST_IN_EMPTY)
- {
- I2_UPDATE_FIFO_ROOM(pB);
- write_unlock_irqrestore(&Dl_spinlock, flags);
- I2_COMPLETE(pB, I2EE_GOOD);
- }
-
- write_unlock_irqrestore(&Dl_spinlock, flags);
-
- if (mSdelay-- == 0)
- break;
-
- iiDelay(pB, 1); /* 1 mS granularity on checking condition */
- }
- I2_COMPLETE(pB, I2EE_TXE_TIME);
-}
-
-//******************************************************************************
-// Function: iiWaitForTxEmptyIIEX(pB, mSdelay)
-// Parameters: pB - pointer to board structure
-// mSdelay - period to wait before returning
-//
-// Returns: True if the FIFO is empty.
-// False if it not empty in the required time: the pB->i2eError
-// field has the error.
-//
-// Description:
-//
-// Waits up to "mSdelay" milliseconds for the outgoing FIFO to become empty; if
-// not empty by the required time, returns false and error in pB->i2eError,
-// otherwise returns true.
-//
-// mSdelay == 0 is taken to mean must be empty on the first test.
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-// Note this routine is organized so that if status is ok there is no delay at
-// all called either before or after the test. Is called indirectly through
-// pB->i2eWaitForTxEmpty.
-//
-//******************************************************************************
-static int
-iiWaitForTxEmptyIIEX(i2eBordStrPtr pB, int mSdelay)
-{
- unsigned long flags;
-
- for (;;)
- {
- // By the nature of this routine, you would be using this as part of a
- // larger atomic context: i.e., you would use this routine to ensure the
- // fifo empty, then act on this information. Between these two halves,
- // you will generally not want to service interrupts or in any way
- // disrupt the assumptions implicit in the larger context.
-
- write_lock_irqsave(&Dl_spinlock, flags);
-
- if (inb(pB->i2eStatus) & STE_OUT_MT) {
- I2_UPDATE_FIFO_ROOM(pB);
- write_unlock_irqrestore(&Dl_spinlock, flags);
- I2_COMPLETE(pB, I2EE_GOOD);
- }
- write_unlock_irqrestore(&Dl_spinlock, flags);
-
- if (mSdelay-- == 0)
- break;
-
- iiDelay(pB, 1); // 1 mS granularity on checking condition
- }
- I2_COMPLETE(pB, I2EE_TXE_TIME);
-}
-
-//******************************************************************************
-// Function: iiTxMailEmptyII(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: True if the transmit mailbox is empty.
-// False if it not empty.
-//
-// Description:
-//
-// Returns true or false according to whether the transmit mailbox is empty (and
-// therefore able to accept more mail)
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-//******************************************************************************
-static int
-iiTxMailEmptyII(i2eBordStrPtr pB)
-{
- int port = pB->i2ePointer;
- outb(SEL_OUTMAIL, port);
- return inb(port) == 0;
-}
-
-//******************************************************************************
-// Function: iiTxMailEmptyIIEX(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: True if the transmit mailbox is empty.
-// False if it not empty.
-//
-// Description:
-//
-// Returns true or false according to whether the transmit mailbox is empty (and
-// therefore able to accept more mail)
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-//******************************************************************************
-static int
-iiTxMailEmptyIIEX(i2eBordStrPtr pB)
-{
- return !(inb(pB->i2eStatus) & STE_OUT_MAIL);
-}
-
-//******************************************************************************
-// Function: iiTrySendMailII(pB,mail)
-// Parameters: pB - pointer to board structure
-// mail - value to write to mailbox
-//
-// Returns: True if the transmit mailbox is empty, and mail is sent.
-// False if it not empty.
-//
-// Description:
-//
-// If outgoing mailbox is empty, sends mail and returns true. If outgoing
-// mailbox is not empty, returns false.
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-//******************************************************************************
-static int
-iiTrySendMailII(i2eBordStrPtr pB, unsigned char mail)
-{
- int port = pB->i2ePointer;
-
- outb(SEL_OUTMAIL, port);
- if (inb(port) == 0) {
- outb(SEL_OUTMAIL, port);
- outb(mail, port);
- return 1;
- }
- return 0;
-}
-
-//******************************************************************************
-// Function: iiTrySendMailIIEX(pB,mail)
-// Parameters: pB - pointer to board structure
-// mail - value to write to mailbox
-//
-// Returns: True if the transmit mailbox is empty, and mail is sent.
-// False if it not empty.
-//
-// Description:
-//
-// If outgoing mailbox is empty, sends mail and returns true. If outgoing
-// mailbox is not empty, returns false.
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-//******************************************************************************
-static int
-iiTrySendMailIIEX(i2eBordStrPtr pB, unsigned char mail)
-{
- if (inb(pB->i2eStatus) & STE_OUT_MAIL)
- return 0;
- outb(mail, pB->i2eXMail);
- return 1;
-}
-
-//******************************************************************************
-// Function: iiGetMailII(pB,mail)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Mailbox data or NO_MAIL_HERE.
-//
-// Description:
-//
-// If no mail available, returns NO_MAIL_HERE otherwise returns the data from
-// the mailbox, which is guaranteed != NO_MAIL_HERE.
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-//******************************************************************************
-static unsigned short
-iiGetMailII(i2eBordStrPtr pB)
-{
- if (I2_HAS_MAIL(pB)) {
- outb(SEL_INMAIL, pB->i2ePointer);
- return inb(pB->i2ePointer);
- } else {
- return NO_MAIL_HERE;
- }
-}
-
-//******************************************************************************
-// Function: iiGetMailIIEX(pB,mail)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Mailbox data or NO_MAIL_HERE.
-//
-// Description:
-//
-// If no mail available, returns NO_MAIL_HERE otherwise returns the data from
-// the mailbox, which is guaranteed != NO_MAIL_HERE.
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-//******************************************************************************
-static unsigned short
-iiGetMailIIEX(i2eBordStrPtr pB)
-{
- if (I2_HAS_MAIL(pB))
- return inb(pB->i2eXMail);
- else
- return NO_MAIL_HERE;
-}
-
-//******************************************************************************
-// Function: iiEnableMailIrqII(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Nothing
-//
-// Description:
-//
-// Enables board to interrupt host (only) by writing to host's in-bound mailbox.
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-//******************************************************************************
-static void
-iiEnableMailIrqII(i2eBordStrPtr pB)
-{
- outb(SEL_MASK, pB->i2ePointer);
- outb(ST_IN_MAIL, pB->i2ePointer);
-}
-
-//******************************************************************************
-// Function: iiEnableMailIrqIIEX(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Nothing
-//
-// Description:
-//
-// Enables board to interrupt host (only) by writing to host's in-bound mailbox.
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-//******************************************************************************
-static void
-iiEnableMailIrqIIEX(i2eBordStrPtr pB)
-{
- outb(MX_IN_MAIL, pB->i2eXMask);
-}
-
-//******************************************************************************
-// Function: iiWriteMaskII(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Nothing
-//
-// Description:
-//
-// Writes arbitrary value to the mask register.
-//
-// This version operates on IntelliPort-II - style FIFO's
-//
-//******************************************************************************
-static void
-iiWriteMaskII(i2eBordStrPtr pB, unsigned char value)
-{
- outb(SEL_MASK, pB->i2ePointer);
- outb(value, pB->i2ePointer);
-}
-
-//******************************************************************************
-// Function: iiWriteMaskIIEX(pB)
-// Parameters: pB - pointer to board structure
-//
-// Returns: Nothing
-//
-// Description:
-//
-// Writes arbitrary value to the mask register.
-//
-// This version operates on IntelliPort-IIEX - style FIFO's
-//
-//******************************************************************************
-static void
-iiWriteMaskIIEX(i2eBordStrPtr pB, unsigned char value)
-{
- outb(value, pB->i2eXMask);
-}
-
-//******************************************************************************
-// Function: iiDownloadBlock(pB, pSource, isStandard)
-// Parameters: pB - pointer to board structure
-// pSource - loadware block to download
-// isStandard - True if "standard" loadware, else false.
-//
-// Returns: Success or Failure
-//
-// Description:
-//
-// Downloads a single block (at pSource)to the board referenced by pB. Caller
-// sets isStandard to true/false according to whether the "standard" loadware is
-// what's being loaded. The normal process, then, is to perform an iiInitialize
-// to the board, then perform some number of iiDownloadBlocks using the returned
-// state to determine when download is complete.
-//
-// Possible return values: (see I2ELLIS.H)
-// II_DOWN_BADVALID
-// II_DOWN_BADFILE
-// II_DOWN_CONTINUING
-// II_DOWN_GOOD
-// II_DOWN_BAD
-// II_DOWN_BADSTATE
-// II_DOWN_TIMEOUT
-//
-// Uses the i2eState and i2eToLoad fields (initialized at iiInitialize) to
-// determine whether this is the first block, whether to check for magic
-// numbers, how many blocks there are to go...
-//
-//******************************************************************************
-static int
-iiDownloadBlock ( i2eBordStrPtr pB, loadHdrStrPtr pSource, int isStandard)
-{
- int itemp;
- int loadedFirst;
-
- if (pB->i2eValid != I2E_MAGIC) return II_DOWN_BADVALID;
-
- switch(pB->i2eState)
- {
- case II_STATE_READY:
-
- // Loading the first block after reset. Must check the magic number of the
- // loadfile, store the number of blocks we expect to load.
- if (pSource->e.loadMagic != MAGIC_LOADFILE)
- {
- return II_DOWN_BADFILE;
- }
-
- // Next we store the total number of blocks to load, including this one.
- pB->i2eToLoad = 1 + pSource->e.loadBlocksMore;
-
- // Set the state, store the version numbers. ('Cause this may have come
- // from a file - we might want to report these versions and revisions in
- // case of an error!
- pB->i2eState = II_STATE_LOADING;
- pB->i2eLVersion = pSource->e.loadVersion;
- pB->i2eLRevision = pSource->e.loadRevision;
- pB->i2eLSub = pSource->e.loadSubRevision;
-
- // The time and date of compilation is also available but don't bother
- // storing it for normal purposes.
- loadedFirst = 1;
- break;
-
- case II_STATE_LOADING:
- loadedFirst = 0;
- break;
-
- default:
- return II_DOWN_BADSTATE;
- }
-
- // Now we must be in the II_STATE_LOADING state, and we assume i2eToLoad
- // must be positive still, because otherwise we would have cleaned up last
- // time and set the state to II_STATE_LOADED.
- if (!iiWaitForTxEmpty(pB, MAX_DLOAD_READ_TIME)) {
- return II_DOWN_TIMEOUT;
- }
-
- if (!iiWriteBuf(pB, pSource->c, LOADWARE_BLOCK_SIZE)) {
- return II_DOWN_BADVALID;
- }
-
- // If we just loaded the first block, wait for the fifo to empty an extra
- // long time to allow for any special startup code in the firmware, like
- // sending status messages to the LCD's.
-
- if (loadedFirst) {
- if (!iiWaitForTxEmpty(pB, MAX_DLOAD_START_TIME)) {
- return II_DOWN_TIMEOUT;
- }
- }
-
- // Determine whether this was our last block!
- if (--(pB->i2eToLoad)) {
- return II_DOWN_CONTINUING; // more to come...
- }
-
- // It WAS our last block: Clean up operations...
- // ...Wait for last buffer to drain from the board...
- if (!iiWaitForTxEmpty(pB, MAX_DLOAD_READ_TIME)) {
- return II_DOWN_TIMEOUT;
- }
- // If there were only a single block written, this would come back
- // immediately and be harmless, though not strictly necessary.
- itemp = MAX_DLOAD_ACK_TIME/10;
- while (--itemp) {
- if (I2_HAS_INPUT(pB)) {
- switch (inb(pB->i2eData)) {
- case LOADWARE_OK:
- pB->i2eState =
- isStandard ? II_STATE_STDLOADED :II_STATE_LOADED;
-
- // Some revisions of the bootstrap firmware (e.g. ISA-8 1.0.2)
- // will, // if there is a debug port attached, require some
- // time to send information to the debug port now. It will do
- // this before // executing any of the code we just downloaded.
- // It may take up to 700 milliseconds.
- if (pB->i2ePom.e.porDiag2 & POR_DEBUG_PORT) {
- iiDelay(pB, 700);
- }
-
- return II_DOWN_GOOD;
-
- case LOADWARE_BAD:
- default:
- return II_DOWN_BAD;
- }
- }
-
- iiDelay(pB, 10); // 10 mS granularity on checking condition
- }
-
- // Drop-through --> timed out waiting for firmware confirmation
-
- pB->i2eState = II_STATE_BADLOAD;
- return II_DOWN_TIMEOUT;
-}
-
-//******************************************************************************
-// Function: iiDownloadAll(pB, pSource, isStandard, size)
-// Parameters: pB - pointer to board structure
-// pSource - loadware block to download
-// isStandard - True if "standard" loadware, else false.
-// size - size of data to download (in bytes)
-//
-// Returns: Success or Failure
-//
-// Description:
-//
-// Given a pointer to a board structure, a pointer to the beginning of some
-// loadware, whether it is considered the "standard loadware", and the size of
-// the array in bytes loads the entire array to the board as loadware.
-//
-// Assumes the board has been freshly reset and the power-up reset message read.
-// (i.e., in II_STATE_READY). Complains if state is bad, or if there seems to be
-// too much or too little data to load, or if iiDownloadBlock complains.
-//******************************************************************************
-static int
-iiDownloadAll(i2eBordStrPtr pB, loadHdrStrPtr pSource, int isStandard, int size)
-{
- int status;
-
- // We know (from context) board should be ready for the first block of
- // download. Complain if not.
- if (pB->i2eState != II_STATE_READY) return II_DOWN_BADSTATE;
-
- while (size > 0) {
- size -= LOADWARE_BLOCK_SIZE; // How much data should there be left to
- // load after the following operation ?
-
- // Note we just bump pSource by "one", because its size is actually that
- // of an entire block, same as LOADWARE_BLOCK_SIZE.
- status = iiDownloadBlock(pB, pSource++, isStandard);
-
- switch(status)
- {
- case II_DOWN_GOOD:
- return ( (size > 0) ? II_DOWN_OVER : II_DOWN_GOOD);
-
- case II_DOWN_CONTINUING:
- break;
-
- default:
- return status;
- }
- }
-
- // We shouldn't drop out: it means "while" caught us with nothing left to
- // download, yet the previous DownloadBlock did not return complete. Ergo,
- // not enough data to match the size byte in the header.
- return II_DOWN_UNDER;
-}
diff --git a/drivers/char/ip2/i2ellis.h b/drivers/char/ip2/i2ellis.h
deleted file mode 100644
index fb6df2456018..000000000000
--- a/drivers/char/ip2/i2ellis.h
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1999 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Mainline code for the device driver
-*
-*******************************************************************************/
-//------------------------------------------------------------------------------
-// i2ellis.h
-//
-// IntelliPort-II and IntelliPort-IIEX
-//
-// Extremely
-// Low
-// Level
-// Interface
-// Services
-//
-// Structure Definitions and declarations for "ELLIS" service routines found in
-// i2ellis.c
-//
-// These routines are based on properties of the IntelliPort-II and -IIEX
-// hardware and bootstrap firmware, and are not sensitive to particular
-// conventions of any particular loadware.
-//
-// Unlike i2hw.h, which provides IRONCLAD hardware definitions, the material
-// here and in i2ellis.c is intended to provice a useful, but not required,
-// layer of insulation from the hardware specifics.
-//------------------------------------------------------------------------------
-#ifndef I2ELLIS_H /* To prevent multiple includes */
-#define I2ELLIS_H 1
-//------------------------------------------------
-// Revision History:
-//
-// 30 September 1991 MAG First Draft Started
-// 12 October 1991 ...continued...
-//
-// 20 December 1996 AKM Linux version
-//-------------------------------------------------
-
-//----------------------
-// Mandatory Includes:
-//----------------------
-#include "ip2types.h"
-#include "i2hw.h" // The hardware definitions
-
-//------------------------------------------
-// STAT_BOXIDS packets
-//------------------------------------------
-#define MAX_BOX 4
-
-typedef struct _bidStat
-{
- unsigned char bid_value[MAX_BOX];
-} bidStat, *bidStatPtr;
-
-// This packet is sent in response to a CMD_GET_BOXIDS bypass command. For -IIEX
-// boards, reports the hardware-specific "asynchronous resource register" on
-// each expansion box. Boxes not present report 0xff. For -II boards, the first
-// element contains 0x80 for 8-port, 0x40 for 4-port boards.
-
-// Box IDs aka ARR or Async Resource Register (more than you want to know)
-// 7 6 5 4 3 2 1 0
-// F F N N L S S S
-// =============================
-// F F - Product Family Designator
-// =====+++++++++++++++++++++++++++++++
-// 0 0 - Intelliport II EX / ISA-8
-// 1 0 - IntelliServer
-// 0 1 - SAC - Port Device (Intelliport III ??? )
-// =====+++++++++++++++++++++++++++++++++++++++
-// N N - Number of Ports
-// 0 0 - 8 (eight)
-// 0 1 - 4 (four)
-// 1 0 - 12 (twelve)
-// 1 1 - 16 (sixteen)
-// =++++++++++++++++++++++++++++++++++
-// L - LCD Display Module Present
-// 0 - No
-// 1 - LCD module present
-// =========+++++++++++++++++++++++++++++++++++++
-// S S S - Async Signals Supported Designator
-// 0 0 0 - 8dss, Mod DCE DB25 Female
-// 0 0 1 - 6dss, RJ-45
-// 0 1 0 - RS-232/422 dss, DB25 Female
-// 0 1 1 - RS-232/422 dss, separate 232/422 DB25 Female
-// 1 0 0 - 6dss, 921.6 I/F with ST654's
-// 1 0 1 - RS-423/232 8dss, RJ-45 10Pin
-// 1 1 0 - 6dss, Mod DCE DB25 Female
-// 1 1 1 - NO BOX PRESENT
-
-#define FF(c) ((c & 0xC0) >> 6)
-#define NN(c) ((c & 0x30) >> 4)
-#define L(c) ((c & 0x08) >> 3)
-#define SSS(c) (c & 0x07)
-
-#define BID_HAS_654(x) (SSS(x) == 0x04)
-#define BID_NO_BOX 0xff /* no box */
-#define BID_8PORT 0x80 /* IP2-8 port */
-#define BID_4PORT 0x81 /* IP2-4 port */
-#define BID_EXP_MASK 0x30 /* IP2-EX */
-#define BID_EXP_8PORT 0x00 /* 8, */
-#define BID_EXP_4PORT 0x10 /* 4, */
-#define BID_EXP_UNDEF 0x20 /* UNDEF, */
-#define BID_EXP_16PORT 0x30 /* 16, */
-#define BID_LCD_CTRL 0x08 /* LCD Controller */
-#define BID_LCD_NONE 0x00 /* - no controller present */
-#define BID_LCD_PRES 0x08 /* - controller present */
-#define BID_CON_MASK 0x07 /* - connector pinouts */
-#define BID_CON_DB25 0x00 /* - DB-25 F */
-#define BID_CON_RJ45 0x01 /* - rj45 */
-
-//------------------------------------------------------------------------------
-// i2eBordStr
-//
-// This structure contains all the information the ELLIS routines require in
-// dealing with a particular board.
-//------------------------------------------------------------------------------
-// There are some queues here which are guaranteed to never contain the entry
-// for a single channel twice. So they must be slightly larger to allow
-// unambiguous full/empty management
-//
-#define CH_QUEUE_SIZE ABS_MOST_PORTS+2
-
-typedef struct _i2eBordStr
-{
- porStr i2ePom; // Structure containing the power-on message.
-
- unsigned short i2ePomSize;
- // The number of bytes actually read if
- // different from sizeof i2ePom, indicates
- // there is an error!
-
- unsigned short i2eStartMail;
- // Contains whatever inbound mailbox data
- // present at startup. NO_MAIL_HERE indicates
- // nothing was present. No special
- // significance as of this writing, but may be
- // useful for diagnostic reasons.
-
- unsigned short i2eValid;
- // Indicates validity of the structure; if
- // i2eValid == I2E_MAGIC, then we can trust
- // the other fields. Some (especially
- // initialization) functions are good about
- // checking for validity. Many functions do
- // not, it being assumed that the larger
- // context assures we are using a valid
- // i2eBordStrPtr.
-
- unsigned short i2eError;
- // Used for returning an error condition from
- // several functions which use i2eBordStrPtr
- // as an argument.
-
- // Accelerators to characterize separate features of a board, derived from a
- // number of sources.
-
- unsigned short i2eFifoSize;
- // Always, the size of the FIFO. For
- // IntelliPort-II, always the same, for -IIEX
- // taken from the Power-On reset message.
-
- volatile
- unsigned short i2eFifoRemains;
- // Used during normal operation to indicate a
- // lower bound on the amount of data which
- // might be in the outbound fifo.
-
- unsigned char i2eFifoStyle;
- // Accelerator which tells which style (-II or
- // -IIEX) FIFO we are using.
-
- unsigned char i2eDataWidth16;
- // Accelerator which tells whether we should
- // do 8 or 16-bit data transfers.
-
- unsigned char i2eMaxIrq;
- // The highest allowable IRQ, based on the
- // slot size.
-
- // Accelerators for various addresses on the board
- int i2eBase; // I/O Address of the Board
- int i2eData; // From here data transfers happen
- int i2eStatus; // From here status reads happen
- int i2ePointer; // (IntelliPort-II: pointer/commands)
- int i2eXMail; // (IntelliPOrt-IIEX: mailboxes
- int i2eXMask; // (IntelliPort-IIEX: mask write
-
- //-------------------------------------------------------
- // Information presented in a common format across boards
- // For each box, bit map of the channels present. Box closest to
- // the host is box 0. LSB is channel 0. IntelliPort-II (non-expandable)
- // is taken to be box 0. These are derived from product i.d. registers.
-
- unsigned short i2eChannelMap[ABS_MAX_BOXES];
-
- // Same as above, except each is derived from firmware attempting to detect
- // the uart presence (by reading a valid GFRCR register). If bits are set in
- // i2eChannelMap and not in i2eGoodMap, there is a potential problem.
-
- unsigned short i2eGoodMap[ABS_MAX_BOXES];
-
- // ---------------------------
- // For indirect function calls
-
- // Routine to cause an N-millisecond delay: Patched by the ii2Initialize
- // function.
-
- void (*i2eDelay)(unsigned int);
-
- // Routine to write N bytes to the board through the FIFO. Returns true if
- // all copacetic, otherwise returns false and error is in i2eError field.
- // IF COUNT IS ODD, ROUNDS UP TO THE NEXT EVEN NUMBER.
-
- int (*i2eWriteBuf)(struct _i2eBordStr *, unsigned char *, int);
-
- // Routine to read N bytes from the board through the FIFO. Returns true if
- // copacetic, otherwise returns false and error in i2eError.
- // IF COUNT IS ODD, ROUNDS UP TO THE NEXT EVEN NUMBER.
-
- int (*i2eReadBuf)(struct _i2eBordStr *, unsigned char *, int);
-
- // Returns a word from FIFO. Will use 2 byte operations if needed.
-
- unsigned short (*i2eReadWord)(struct _i2eBordStr *);
-
- // Writes a word to FIFO. Will use 2 byte operations if needed.
-
- void (*i2eWriteWord)(struct _i2eBordStr *, unsigned short);
-
- // Waits specified time for the Transmit FIFO to go empty. Returns true if
- // ok, otherwise returns false and error in i2eError.
-
- int (*i2eWaitForTxEmpty)(struct _i2eBordStr *, int);
-
- // Returns true or false according to whether the outgoing mailbox is empty.
-
- int (*i2eTxMailEmpty)(struct _i2eBordStr *);
-
- // Checks whether outgoing mailbox is empty. If so, sends mail and returns
- // true. Otherwise returns false.
-
- int (*i2eTrySendMail)(struct _i2eBordStr *, unsigned char);
-
- // If no mail available, returns NO_MAIL_HERE, else returns the value in the
- // mailbox (guaranteed can't be NO_MAIL_HERE).
-
- unsigned short (*i2eGetMail)(struct _i2eBordStr *);
-
- // Enables the board to interrupt the host when it writes to the mailbox.
- // Irqs will not occur, however, until the loadware separately enables
- // interrupt generation to the host. The standard loadware does this in
- // response to a command packet sent by the host. (Also, disables
- // any other potential interrupt sources from the board -- other than the
- // inbound mailbox).
-
- void (*i2eEnableMailIrq)(struct _i2eBordStr *);
-
- // Writes an arbitrary value to the mask register.
-
- void (*i2eWriteMask)(struct _i2eBordStr *, unsigned char);
-
-
- // State information
-
- // During downloading, indicates the number of blocks remaining to download
- // to the board.
-
- short i2eToLoad;
-
- // State of board (see manifests below) (e.g., whether in reset condition,
- // whether standard loadware is installed, etc.
-
- unsigned char i2eState;
-
- // These three fields are only valid when there is loadware running on the
- // board. (i2eState == II_STATE_LOADED or i2eState == II_STATE_STDLOADED )
-
- unsigned char i2eLVersion; // Loadware version
- unsigned char i2eLRevision; // Loadware revision
- unsigned char i2eLSub; // Loadware subrevision
-
- // Flags which only have meaning in the context of the standard loadware.
- // Somewhat violates the layering concept, but there is so little additional
- // needed at the board level (while much additional at the channel level),
- // that this beats maintaining two different per-board structures.
-
- // Indicates which IRQ the board has been initialized (from software) to use
- // For MicroChannel boards, any value different from IRQ_UNDEFINED means
- // that the software command has been sent to enable interrupts (or specify
- // they are disabled). Special value: IRQ_UNDEFINED indicates that the
- // software command to select the interrupt has not yet been sent, therefore
- // (since the standard loadware insists that it be sent before any other
- // packets are sent) no other packets should be sent yet.
-
- unsigned short i2eUsingIrq;
-
- // This is set when we hit the MB_OUT_STUFFED mailbox, which prevents us
- // putting more in the mailbox until an appropriate mailbox message is
- // received.
-
- unsigned char i2eWaitingForEmptyFifo;
-
- // Any mailbox bits waiting to be sent to the board are OR'ed in here.
-
- unsigned char i2eOutMailWaiting;
-
- // The head of any incoming packet is read into here, is then examined and
- // we dispatch accordingly.
-
- unsigned short i2eLeadoffWord[1];
-
- // Running counter of interrupts where the mailbox indicated incoming data.
-
- unsigned short i2eFifoInInts;
-
- // Running counter of interrupts where the mailbox indicated outgoing data
- // had been stripped.
-
- unsigned short i2eFifoOutInts;
-
- // If not void, gives the address of a routine to call if fatal board error
- // is found (only applies to standard l/w).
-
- void (*i2eFatalTrap)(struct _i2eBordStr *);
-
- // Will point to an array of some sort of channel structures (whose format
- // is unknown at this level, being a function of what loadware is
- // installed and the code configuration (max sizes of buffers, etc.)).
-
- void *i2eChannelPtr;
-
- // Set indicates that the board has gone fatal.
-
- unsigned short i2eFatal;
-
- // The number of elements pointed to by i2eChannelPtr.
-
- unsigned short i2eChannelCnt;
-
- // Ring-buffers of channel structures whose channels have particular needs.
-
- rwlock_t Fbuf_spinlock;
- volatile
- unsigned short i2Fbuf_strip; // Strip index
- volatile
- unsigned short i2Fbuf_stuff; // Stuff index
- void *i2Fbuf[CH_QUEUE_SIZE]; // An array of channel pointers
- // of channels who need to send
- // flow control packets.
- rwlock_t Dbuf_spinlock;
- volatile
- unsigned short i2Dbuf_strip; // Strip index
- volatile
- unsigned short i2Dbuf_stuff; // Stuff index
- void *i2Dbuf[CH_QUEUE_SIZE]; // An array of channel pointers
- // of channels who need to send
- // data or in-line command packets.
- rwlock_t Bbuf_spinlock;
- volatile
- unsigned short i2Bbuf_strip; // Strip index
- volatile
- unsigned short i2Bbuf_stuff; // Stuff index
- void *i2Bbuf[CH_QUEUE_SIZE]; // An array of channel pointers
- // of channels who need to send
- // bypass command packets.
-
- /*
- * A set of flags to indicate that certain events have occurred on at least
- * one of the ports on this board. We use this to decide whether to spin
- * through the channels looking for breaks, etc.
- */
- int got_input;
- int status_change;
- bidStat channelBtypes;
-
- /*
- * Debugging counters, etc.
- */
- unsigned long debugFlowQueued;
- unsigned long debugInlineQueued;
- unsigned long debugDataQueued;
- unsigned long debugBypassQueued;
- unsigned long debugFlowCount;
- unsigned long debugInlineCount;
- unsigned long debugBypassCount;
-
- rwlock_t read_fifo_spinlock;
- rwlock_t write_fifo_spinlock;
-
-// For queuing interrupt bottom half handlers. /\/\|=mhw=|\/\/
- struct work_struct tqueue_interrupt;
-
- struct timer_list SendPendingTimer; // Used by iiSendPending
- unsigned int SendPendingRetry;
-} i2eBordStr, *i2eBordStrPtr;
-
-//-------------------------------------------------------------------
-// Macro Definitions for the indirect calls defined in the i2eBordStr
-//-------------------------------------------------------------------
-//
-#define iiDelay(a,b) (*(a)->i2eDelay)(b)
-#define iiWriteBuf(a,b,c) (*(a)->i2eWriteBuf)(a,b,c)
-#define iiReadBuf(a,b,c) (*(a)->i2eReadBuf)(a,b,c)
-
-#define iiWriteWord(a,b) (*(a)->i2eWriteWord)(a,b)
-#define iiReadWord(a) (*(a)->i2eReadWord)(a)
-
-#define iiWaitForTxEmpty(a,b) (*(a)->i2eWaitForTxEmpty)(a,b)
-
-#define iiTxMailEmpty(a) (*(a)->i2eTxMailEmpty)(a)
-#define iiTrySendMail(a,b) (*(a)->i2eTrySendMail)(a,b)
-
-#define iiGetMail(a) (*(a)->i2eGetMail)(a)
-#define iiEnableMailIrq(a) (*(a)->i2eEnableMailIrq)(a)
-#define iiDisableMailIrq(a) (*(a)->i2eWriteMask)(a,0)
-#define iiWriteMask(a,b) (*(a)->i2eWriteMask)(a,b)
-
-//-------------------------------------------
-// Manifests for i2eBordStr:
-//-------------------------------------------
-
-typedef void (*delayFunc_t)(unsigned int);
-
-// i2eValid
-//
-#define I2E_MAGIC 0x4251 // Structure is valid.
-#define I2E_INCOMPLETE 0x1122 // Structure failed during init.
-
-
-// i2eError
-//
-#define I2EE_GOOD 0 // Operation successful
-#define I2EE_BADADDR 1 // Address out of range
-#define I2EE_BADSTATE 2 // Attempt to perform a function when the board
- // structure was in the incorrect state
-#define I2EE_BADMAGIC 3 // Bad magic number from Power On test (i2ePomSize
- // reflects what was read
-#define I2EE_PORM_SHORT 4 // Power On message too short
-#define I2EE_PORM_LONG 5 // Power On message too long
-#define I2EE_BAD_FAMILY 6 // Un-supported board family type
-#define I2EE_INCONSIST 7 // Firmware reports something impossible,
- // e.g. unexpected number of ports... Almost no
- // excuse other than bad FIFO...
-#define I2EE_POSTERR 8 // Power-On self test reported a bad error
-#define I2EE_BADBUS 9 // Unknown Bus type declared in message
-#define I2EE_TXE_TIME 10 // Timed out waiting for TX Fifo to empty
-#define I2EE_INVALID 11 // i2eValid field does not indicate a valid and
- // complete board structure (for functions which
- // require this be so.)
-#define I2EE_BAD_PORT 12 // Discrepancy between channels actually found and
- // what the product is supposed to have. Check
- // i2eGoodMap vs i2eChannelMap for details.
-#define I2EE_BAD_IRQ 13 // Someone specified an unsupported IRQ
-#define I2EE_NOCHANNELS 14 // No channel structures have been defined (for
- // functions requiring this).
-
-// i2eFifoStyle
-//
-#define FIFO_II 0 /* IntelliPort-II style: see also i2hw.h */
-#define FIFO_IIEX 1 /* IntelliPort-IIEX style */
-
-// i2eGetMail
-//
-#define NO_MAIL_HERE 0x1111 // Since mail is unsigned char, cannot possibly
- // promote to 0x1111.
-// i2eState
-//
-#define II_STATE_COLD 0 // Addresses have been defined, but board not even
- // reset yet.
-#define II_STATE_RESET 1 // Board,if it exists, has just been reset
-#define II_STATE_READY 2 // Board ready for its first block
-#define II_STATE_LOADING 3 // Board continuing load
-#define II_STATE_LOADED 4 // Board has finished load: status ok
-#define II_STATE_BADLOAD 5 // Board has finished load: failed!
-#define II_STATE_STDLOADED 6 // Board has finished load: standard firmware
-
-// i2eUsingIrq
-//
-#define I2_IRQ_UNDEFINED 0x1352 /* No valid irq (or polling = 0) can
- * ever promote to this! */
-//------------------------------------------
-// Handy Macros for i2ellis.c and others
-// Note these are common to -II and -IIEX
-//------------------------------------------
-
-// Given a pointer to the board structure, does the input FIFO have any data or
-// not?
-//
-#define I2_HAS_INPUT(pB) !(inb(pB->i2eStatus) & ST_IN_EMPTY)
-
-// Given a pointer to the board structure, is there anything in the incoming
-// mailbox?
-//
-#define I2_HAS_MAIL(pB) (inb(pB->i2eStatus) & ST_IN_MAIL)
-
-#define I2_UPDATE_FIFO_ROOM(pB) ((pB)->i2eFifoRemains = (pB)->i2eFifoSize)
-
-//------------------------------------------
-// Function Declarations for i2ellis.c
-//------------------------------------------
-//
-// Functions called directly
-//
-// Initialization of a board & structure is in four (five!) parts:
-//
-// 1) iiSetAddress() - Define the board address & delay function for a board.
-// 2) iiReset() - Reset the board (provided it exists)
-// -- Note you may do this to several boards --
-// 3) iiResetDelay() - Delay for 2 seconds (once for all boards)
-// 4) iiInitialize() - Attempt to read Power-up message; further initialize
-// accelerators
-//
-// Then you may use iiDownloadAll() or iiDownloadFile() (in i2file.c) to write
-// loadware. To change loadware, you must begin again with step 2, resetting
-// the board again (step 1 not needed).
-
-static int iiSetAddress(i2eBordStrPtr, int, delayFunc_t );
-static int iiReset(i2eBordStrPtr);
-static int iiResetDelay(i2eBordStrPtr);
-static int iiInitialize(i2eBordStrPtr);
-
-// Routine to validate that all channels expected are there.
-//
-extern int iiValidateChannels(i2eBordStrPtr);
-
-// Routine used to download a block of loadware.
-//
-static int iiDownloadBlock(i2eBordStrPtr, loadHdrStrPtr, int);
-
-// Return values given by iiDownloadBlock, iiDownloadAll, iiDownloadFile:
-//
-#define II_DOWN_BADVALID 0 // board structure is invalid
-#define II_DOWN_CONTINUING 1 // So far, so good, firmware expects more
-#define II_DOWN_GOOD 2 // Download complete, CRC good
-#define II_DOWN_BAD 3 // Download complete, but CRC bad
-#define II_DOWN_BADFILE 4 // Bad magic number in loadware file
-#define II_DOWN_BADSTATE 5 // Board is in an inappropriate state for
- // downloading loadware. (see i2eState)
-#define II_DOWN_TIMEOUT 6 // Timeout waiting for firmware
-#define II_DOWN_OVER 7 // Too much data
-#define II_DOWN_UNDER 8 // Not enough data
-#define II_DOWN_NOFILE 9 // Loadware file not found
-
-// Routine to download an entire loadware module: Return values are a subset of
-// iiDownloadBlock's, excluding, of course, II_DOWN_CONTINUING
-//
-static int iiDownloadAll(i2eBordStrPtr, loadHdrStrPtr, int, int);
-
-// Many functions defined here return True if good, False otherwise, with an
-// error code in i2eError field. Here is a handy macro for setting the error
-// code and returning.
-//
-#define I2_COMPLETE(pB,code) do { \
- pB->i2eError = code; \
- return (code == I2EE_GOOD);\
- } while (0)
-
-#endif // I2ELLIS_H
diff --git a/drivers/char/ip2/i2hw.h b/drivers/char/ip2/i2hw.h
deleted file mode 100644
index c0ba6c05f0cd..000000000000
--- a/drivers/char/ip2/i2hw.h
+++ /dev/null
@@ -1,652 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1999 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Definitions limited to properties of the hardware or the
-* bootstrap firmware. As such, they are applicable regardless of
-* operating system or loadware (standard or diagnostic).
-*
-*******************************************************************************/
-#ifndef I2HW_H
-#define I2HW_H 1
-//------------------------------------------------------------------------------
-// Revision History:
-//
-// 23 September 1991 MAG First Draft Started...through...
-// 11 October 1991 ... Continuing development...
-// 6 August 1993 Added support for ISA-4 (asic) which is architected
-// as an ISA-CEX with a single 4-port box.
-//
-// 20 December 1996 AKM Version for Linux
-//
-//------------------------------------------------------------------------------
-/*------------------------------------------------------------------------------
-
-HARDWARE DESCRIPTION:
-
-Introduction:
-
-The IntelliPort-II and IntelliPort-IIEX products occupy a block of eight (8)
-addresses in the host's I/O space.
-
-Some addresses are used to transfer data to/from the board, some to transfer
-so-called "mailbox" messages, and some to read bit-mapped status information.
-While all the products in the line are functionally similar, some use a 16-bit
-data path to transfer data while others use an 8-bit path. Also, the use of
-command /status/mailbox registers differs slightly between the II and IIEX
-branches of the family.
-
-The host determines what type of board it is dealing with by reading a string of
-sixteen characters from the board. These characters are always placed in the
-fifo by the board's local processor whenever the board is reset (either from
-power-on or under software control) and are known as the "Power-on Reset
-Message." In order that this message can be read from either type of board, the
-hardware registers used in reading this message are the same. Once this message
-has been read by the host, then it has the information required to operate.
-
-General Differences between boards:
-
-The greatest structural difference is between the -II and -IIEX families of
-product. The -II boards use the Am4701 dual 512x8 bidirectional fifo to support
-the data path, mailbox registers, and status registers. This chip contains some
-features which are not used in the IntelliPort-II products; a description of
-these is omitted here. Because of these many features, it contains many
-registers, too many to access directly within a small address space. They are
-accessed by first writing a value to a "pointer" register. This value selects
-the register to be accessed. The next read or write to that address accesses
-the selected register rather than the pointer register.
-
-The -IIEX boards use a proprietary design similar to the Am4701 in function. But
-because of a simpler, more streamlined design it doesn't require so many
-registers. This means they can be accessed directly in single operations rather
-than through a pointer register.
-
-Besides these differences, there are differences in whether 8-bit or 16-bit
-transfers are used to move data to the board.
-
-The -II boards are capable only of 8-bit data transfers, while the -IIEX boards
-may be configured for either 8-bit or 16-bit data transfers. If the on-board DIP
-switch #8 is ON, and the card has been installed in a 16-bit slot, 16-bit
-transfers are supported (and will be expected by the standard loadware). The
-on-board firmware can determine the position of the switch, and whether the
-board is installed in a 16-bit slot; it supplies this information to the host as
-part of the power-up reset message.
-
-The configuration switch (#8) and slot selection do not directly configure the
-hardware. It is up to the on-board loadware and host-based drivers to act
-according to the selected options. That is, loadware and drivers could be
-written to perform 8-bit transfers regardless of the state of the DIP switch or
-slot (and in a diagnostic environment might well do so). Likewise, 16-bit
-transfers could be performed as long as the card is in a 16-bit slot.
-
-Note the slot selection and DIP switch selection are provided separately: a
-board running in 8-bit mode in a 16-bit slot has a greater range of possible
-interrupts to choose from; information of potential use to the host.
-
-All 8-bit data transfers are done in the same way, regardless of whether on a
--II board or a -IIEX board.
-
-The host must consider two things then: 1) whether a -II or -IIEX product is
-being used, and 2) whether an 8-bit or 16-bit data path is used.
-
-A further difference is that -II boards always have a 512-byte fifo operating in
-each direction. -IIEX boards may use fifos of varying size; this size is
-reported as part of the power-up message.
-
-I/O Map Of IntelliPort-II and IntelliPort-IIEX boards:
-(Relative to the chosen base address)
-
-Addr R/W IntelliPort-II IntelliPort-IIEX
----- --- -------------- ----------------
-0 R/W Data Port (byte) Data Port (byte or word)
-1 R/W (Not used) (MSB of word-wide data written to Data Port)
-2 R Status Register Status Register
-2 W Pointer Register Interrupt Mask Register
-3 R/W (Not used) Mailbox Registers (6 bits: 11111100)
-4,5 -- Reserved for future products
-6 -- Reserved for future products
-7 R Guaranteed to have no effect
-7 W Hardware reset of board.
-
-
-Rules:
-All data transfers are performed using the even i/o address. If byte-wide data
-transfers are being used, do INB/OUTB operations on the data port. If word-wide
-transfers are used, do INW/OUTW operations. In some circumstances (such as
-reading the power-up message) you will do INB from the data port, but in this
-case the MSB of each word read is lost. When accessing all other unreserved
-registers, use byte operations only.
-------------------------------------------------------------------------------*/
-
-//------------------------------------------------
-// Mandatory Includes:
-//------------------------------------------------
-//
-#include "ip2types.h"
-
-//-------------------------------------------------------------------------
-// Manifests for the I/O map:
-//-------------------------------------------------------------------------
-// R/W: Data port (byte) for IntelliPort-II,
-// R/W: Data port (byte or word) for IntelliPort-IIEX
-// Incoming or outgoing data passes through a FIFO, the status of which is
-// available in some of the bits in FIFO_STATUS. This (bidirectional) FIFO is
-// the primary means of transferring data, commands, flow-control, and status
-// information between the host and board.
-//
-#define FIFO_DATA 0
-
-// Another way of passing information between the board and the host is
-// through "mailboxes". Unlike a FIFO, a mailbox holds only a single byte of
-// data. Writing data to the mailbox causes a status bit to be set, and
-// potentially interrupting the intended receiver. The sender has some way to
-// determine whether the data has been read yet; as soon as it has, it may send
-// more. The mailboxes are handled differently on -II and -IIEX products, as
-// suggested below.
-//------------------------------------------------------------------------------
-// Read: Status Register for IntelliPort-II or -IIEX
-// The presence of any bit set here will cause an interrupt to the host,
-// provided the corresponding bit has been unmasked in the interrupt mask
-// register. Furthermore, interrupts to the host are disabled globally until the
-// loadware selects the irq line to use. With the exception of STN_MR, the bits
-// remain set so long as the associated condition is true.
-//
-#define FIFO_STATUS 2
-
-// Bit map of status bits which are identical for -II and -IIEX
-//
-#define ST_OUT_FULL 0x40 // Outbound FIFO full
-#define ST_IN_EMPTY 0x20 // Inbound FIFO empty
-#define ST_IN_MAIL 0x04 // Inbound Mailbox full
-
-// The following exists only on the Intelliport-IIEX, and indicates that the
-// board has not read the last outgoing mailbox data yet. In the IntelliPort-II,
-// the outgoing mailbox may be read back: a zero indicates the board has read
-// the data.
-//
-#define STE_OUT_MAIL 0x80 // Outbound mailbox full (!)
-
-// The following bits are defined differently for -II and -IIEX boards. Code
-// which relies on these bits will need to be functionally different for the two
-// types of boards and should be generally avoided because of the additional
-// complexity this creates:
-
-// Bit map of status bits only on -II
-
-// Fifo has been RESET (cleared when the status register is read). Note that
-// this condition cannot be masked and would always interrupt the host, except
-// that the hardware reset also disables interrupts globally from the board
-// until re-enabled by loadware. This could also arise from the
-// Am4701-supported command to reset the chip, but this command is generally not
-// used here.
-//
-#define STN_MR 0x80
-
-// See the AMD Am4701 data sheet for details on the following four bits. They
-// are not presently used by Computone drivers.
-//
-#define STN_OUT_AF 0x10 // Outbound FIFO almost full (programmable)
-#define STN_IN_AE 0x08 // Inbound FIFO almost empty (programmable)
-#define STN_BD 0x02 // Inbound byte detected
-#define STN_PE 0x01 // Parity/Framing condition detected
-
-// Bit-map of status bits only on -IIEX
-//
-#define STE_OUT_HF 0x10 // Outbound FIFO half full
-#define STE_IN_HF 0x08 // Inbound FIFO half full
-#define STE_IN_FULL 0x02 // Inbound FIFO full
-#define STE_OUT_MT 0x01 // Outbound FIFO empty
-
-//------------------------------------------------------------------------------
-
-// Intelliport-II -- Write Only: the pointer register.
-// Values are written to this register to select the Am4701 internal register to
-// be accessed on the next operation.
-//
-#define FIFO_PTR 0x02
-
-// Values for the pointer register
-//
-#define SEL_COMMAND 0x1 // Selects the Am4701 command register
-
-// Some possible commands:
-//
-#define SEL_CMD_MR 0x80 // Am4701 command to reset the chip
-#define SEL_CMD_SH 0x40 // Am4701 command to map the "other" port into the
- // status register.
-#define SEL_CMD_UNSH 0 // Am4701 command to "unshift": port maps into its
- // own status register.
-#define SEL_MASK 0x2 // Selects the Am4701 interrupt mask register. The
- // interrupt mask register is bit-mapped to match
- // the status register (FIFO_STATUS) except for
- // STN_MR. (See above.)
-#define SEL_BYTE_DET 0x3 // Selects the Am4701 byte-detect register. (Not
- // normally used except in diagnostics.)
-#define SEL_OUTMAIL 0x4 // Selects the outbound mailbox (R/W). Reading back
- // a value of zero indicates that the mailbox has
- // been read by the board and is available for more
- // data./ Writing to the mailbox optionally
- // interrupts the board, depending on the loadware's
- // setting of its interrupt mask register.
-#define SEL_AEAF 0x5 // Selects AE/AF threshold register.
-#define SEL_INMAIL 0x6 // Selects the inbound mailbox (Read)
-
-//------------------------------------------------------------------------------
-// IntelliPort-IIEX -- Write Only: interrupt mask (and misc flags) register:
-// Unlike IntelliPort-II, bit assignments do NOT match those of the status
-// register.
-//
-#define FIFO_MASK 0x2
-
-// Mailbox readback select:
-// If set, reads to FIFO_MAIL will read the OUTBOUND mailbox (host to board). If
-// clear (default on reset) reads to FIFO_MAIL will read the INBOUND mailbox.
-// This is the normal situation. The clearing of a mailbox is determined on
-// -IIEX boards by waiting for the STE_OUT_MAIL bit to clear. Readback
-// capability is provided for diagnostic purposes only.
-//
-#define MX_OUTMAIL_RSEL 0x80
-
-#define MX_IN_MAIL 0x40 // Enables interrupts when incoming mailbox goes
- // full (ST_IN_MAIL set).
-#define MX_IN_FULL 0x20 // Enables interrupts when incoming FIFO goes full
- // (STE_IN_FULL).
-#define MX_IN_MT 0x08 // Enables interrupts when incoming FIFO goes empty
- // (ST_IN_MT).
-#define MX_OUT_FULL 0x04 // Enables interrupts when outgoing FIFO goes full
- // (ST_OUT_FULL).
-#define MX_OUT_MT 0x01 // Enables interrupts when outgoing FIFO goes empty
- // (STE_OUT_MT).
-
-// Any remaining bits are reserved, and should be written to ZERO for
-// compatibility with future Computone products.
-
-//------------------------------------------------------------------------------
-// IntelliPort-IIEX: -- These are only 6-bit mailboxes !!! -- 11111100 (low two
-// bits always read back 0).
-// Read: One of the mailboxes, usually Inbound.
-// Inbound Mailbox (MX_OUTMAIL_RSEL = 0)
-// Outbound Mailbox (MX_OUTMAIL_RSEL = 1)
-// Write: Outbound Mailbox
-// For the IntelliPort-II boards, the outbound mailbox is read back to determine
-// whether the board has read the data (0 --> data has been read). For the
-// IntelliPort-IIEX, this is done by reading a status register. To determine
-// whether mailbox is available for more outbound data, use the STE_OUT_MAIL bit
-// in FIFO_STATUS. Moreover, although the Outbound Mailbox can be read back by
-// setting MX_OUTMAIL_RSEL, it is NOT cleared when the board reads it, as is the
-// case with the -II boards. For this reason, FIFO_MAIL is normally used to read
-// the inbound FIFO, and MX_OUTMAIL_RSEL kept clear. (See above for
-// MX_OUTMAIL_RSEL description.)
-//
-#define FIFO_MAIL 0x3
-
-//------------------------------------------------------------------------------
-// WRITE ONLY: Resets the board. (Data doesn't matter).
-//
-#define FIFO_RESET 0x7
-
-//------------------------------------------------------------------------------
-// READ ONLY: Will have no effect. (Data is undefined.)
-// Actually, there will be an effect, in that the operation is sure to generate
-// a bus cycle: viz., an I/O byte Read. This fact can be used to enforce short
-// delays when no comparable time constant is available.
-//
-#define FIFO_NOP 0x7
-
-//------------------------------------------------------------------------------
-// RESET & POWER-ON RESET MESSAGE
-/*------------------------------------------------------------------------------
-RESET:
-
-The IntelliPort-II and -IIEX boards are reset in three ways: Power-up, channel
-reset, and via a write to the reset register described above. For products using
-the ISA bus, these three sources of reset are equvalent. For MCA and EISA buses,
-the Power-up and channel reset sources cause additional hardware initialization
-which should only occur at system startup time.
-
-The third type of reset, called a "command reset", is done by writing any data
-to the FIFO_RESET address described above. This resets the on-board processor,
-FIFO, UARTS, and associated hardware.
-
-This passes control of the board to the bootstrap firmware, which performs a
-Power-On Self Test and which detects its current configuration. For example,
--IIEX products determine the size of FIFO which has been installed, and the
-number and type of expansion boxes attached.
-
-This and other information is then written to the FIFO in a 16-byte data block
-to be read by the host. This block is guaranteed to be present within two (2)
-seconds of having received the command reset. The firmware is now ready to
-receive loadware from the host.
-
-It is good practice to perform a command reset to the board explicitly as part
-of your software initialization. This allows your code to properly restart from
-a soft boot. (Many systems do not issue channel reset on soft boot).
-
-Because of a hardware reset problem on some of the Cirrus Logic 1400's which are
-used on the product, it is recommended that you reset the board twice, separated
-by an approximately 50 milliseconds delay. (VERY approximately: probably ok to
-be off by a factor of five. The important point is that the first command reset
-in fact generates a reset pulse on the board. This pulse is guaranteed to last
-less than 10 milliseconds. The additional delay ensures the 1400 has had the
-chance to respond sufficiently to the first reset. Why not a longer delay? Much
-more than 50 milliseconds gets to be noticable, but the board would still work.
-
-Once all 16 bytes of the Power-on Reset Message have been read, the bootstrap
-firmware is ready to receive loadware.
-
-Note on Power-on Reset Message format:
-The various fields have been designed with future expansion in view.
-Combinations of bitfields and values have been defined which define products
-which may not currently exist. This has been done to allow drivers to anticipate
-the possible introduction of products in a systematic fashion. This is not
-intended to suggest that each potential product is actually under consideration.
-------------------------------------------------------------------------------*/
-
-//----------------------------------------
-// Format of Power-on Reset Message
-//----------------------------------------
-
-typedef union _porStr // "por" stands for Power On Reset
-{
- unsigned char c[16]; // array used when considering the message as a
- // string of undifferentiated characters
-
- struct // Elements used when considering values
- {
- // The first two bytes out of the FIFO are two magic numbers. These are
- // intended to establish that there is indeed a member of the
- // IntelliPort-II(EX) family present. The remaining bytes may be
- // expected // to be valid. When reading the Power-on Reset message,
- // if the magic numbers do not match it is probably best to stop
- // reading immediately. You are certainly not reading our board (unless
- // hardware is faulty), and may in fact be reading some other piece of
- // hardware.
-
- unsigned char porMagic1; // magic number: first byte == POR_MAGIC_1
- unsigned char porMagic2; // magic number: second byte == POR_MAGIC_2
-
- // The Version, Revision, and Subrevision are stored as absolute numbers
- // and would normally be displayed in the format V.R.S (e.g. 1.0.2)
-
- unsigned char porVersion; // Bootstrap firmware version number
- unsigned char porRevision; // Bootstrap firmware revision number
- unsigned char porSubRev; // Bootstrap firmware sub-revision number
-
- unsigned char porID; // Product ID: Bit-mapped according to
- // conventions described below. Among other
- // things, this allows us to distinguish
- // IntelliPort-II boards from IntelliPort-IIEX
- // boards.
-
- unsigned char porBus; // IntelliPort-II: Unused
- // IntelliPort-IIEX: Bus Information:
- // Bit-mapped below
-
- unsigned char porMemory; // On-board DRAM size: in 32k blocks
-
- // porPorts1 (and porPorts2) are used to determine the ports which are
- // available to the board. For non-expandable product, a single number
- // is sufficient. For expandable product, the board may be connected
- // to as many as four boxes. Each box may be (so far) either a 16-port
- // or an 8-port size. Whenever an 8-port box is used, the remaining 8
- // ports leave gaps between existing channels. For that reason,
- // expandable products must report a MAP of available channels. Since
- // each UART supports four ports, we represent each UART found by a
- // single bit. Using two bytes to supply the mapping information we
- // report the presense or absense of up to 16 UARTS, or 64 ports in
- // steps of 4 ports. For -IIEX products, the ports are numbered
- // starting at the box closest to the controller in the "chain".
-
- // Interpreted Differently for IntelliPort-II and -IIEX.
- // -II: Number of ports (Derived actually from product ID). See
- // Diag1&2 to indicate if uart was actually detected.
- // -IIEX: Bit-map of UARTS found, LSB (see below for MSB of this). This
- // bitmap is based on detecting the uarts themselves;
- // see porFlags for information from the box i.d's.
- unsigned char porPorts1;
-
- unsigned char porDiag1; // Results of on-board P.O.S.T, 1st byte
- unsigned char porDiag2; // Results of on-board P.O.S.T, 2nd byte
- unsigned char porSpeed; // Speed of local CPU: given as MHz x10
- // e.g., 16.0 MHz CPU is reported as 160
- unsigned char porFlags; // Misc information (see manifests below)
- // Bit-mapped: CPU type, UART's present
-
- unsigned char porPorts2; // -II: Undefined
- // -IIEX: Bit-map of UARTS found, MSB (see
- // above for LSB)
-
- // IntelliPort-II: undefined
- // IntelliPort-IIEX: 1 << porFifoSize gives the size, in bytes, of the
- // host interface FIFO, in each direction. When running the -IIEX in
- // 8-bit mode, fifo capacity is halved. The bootstrap firmware will
- // have already accounted for this fact in generating this number.
- unsigned char porFifoSize;
-
- // IntelliPort-II: undefined
- // IntelliPort-IIEX: The number of boxes connected. (Presently 1-4)
- unsigned char porNumBoxes;
- } e;
-} porStr, *porStrPtr;
-
-//--------------------------
-// Values for porStr fields
-//--------------------------
-
-//---------------------
-// porMagic1, porMagic2
-//----------------------
-//
-#define POR_MAGIC_1 0x96 // The only valid value for porMagic1
-#define POR_MAGIC_2 0x35 // The only valid value for porMagic2
-#define POR_1_INDEX 0 // Byte position of POR_MAGIC_1
-#define POR_2_INDEX 1 // Ditto for POR_MAGIC_2
-
-//----------------------
-// porID
-//----------------------
-//
-#define POR_ID_FAMILY 0xc0 // These bits indicate the general family of
- // product.
-#define POR_ID_FII 0x00 // Family is "IntelliPort-II"
-#define POR_ID_FIIEX 0x40 // Family is "IntelliPort-IIEX"
-
-// These bits are reserved, presently zero. May be used at a later date to
-// convey other product information.
-//
-#define POR_ID_RESERVED 0x3c
-
-#define POR_ID_SIZE 0x03 // Remaining bits indicate number of ports &
- // Connector information.
-#define POR_ID_II_8 0x00 // For IntelliPort-II, indicates 8-port using
- // standard brick.
-#define POR_ID_II_8R 0x01 // For IntelliPort-II, indicates 8-port using
- // RJ11's (no CTS)
-#define POR_ID_II_6 0x02 // For IntelliPort-II, indicates 6-port using
- // RJ45's
-#define POR_ID_II_4 0x03 // For IntelliPort-II, indicates 4-port using
- // 4xRJ45 connectors
-#define POR_ID_EX 0x00 // For IntelliPort-IIEX, indicates standard
- // expandable controller (other values reserved)
-
-//----------------------
-// porBus
-//----------------------
-
-// IntelliPort-IIEX only: Board is installed in a 16-bit slot
-//
-#define POR_BUS_SLOT16 0x20
-
-// IntelliPort-IIEX only: DIP switch #8 is on, selecting 16-bit host interface
-// operation.
-//
-#define POR_BUS_DIP16 0x10
-
-// Bits 0-2 indicate type of bus: This information is stored in the bootstrap
-// loadware, different loadware being used on different products for different
-// buses. For most situations, the drivers do not need this information; but it
-// is handy in a diagnostic environment. For example, on microchannel boards,
-// you would not want to try to test several interrupts, only the one for which
-// you were configured.
-//
-#define POR_BUS_TYPE 0x07
-
-// Unknown: this product doesn't know what bus it is running in. (e.g. if same
-// bootstrap firmware were wanted for two different buses.)
-//
-#define POR_BUS_T_UNK 0
-
-// Note: existing firmware for ISA-8 and MC-8 currently report the POR_BUS_T_UNK
-// state, since the same bootstrap firmware is used for each.
-
-#define POR_BUS_T_MCA 1 // MCA BUS */
-#define POR_BUS_T_EISA 2 // EISA BUS */
-#define POR_BUS_T_ISA 3 // ISA BUS */
-
-// Values 4-7 Reserved
-
-// Remaining bits are reserved
-
-//----------------------
-// porDiag1
-//----------------------
-
-#define POR_BAD_MAPPER 0x80 // HW failure on P.O.S.T: Chip mapper failed
-
-// These two bits valid only for the IntelliPort-II
-//
-#define POR_BAD_UART1 0x01 // First 1400 bad
-#define POR_BAD_UART2 0x02 // Second 1400 bad
-
-//----------------------
-// porDiag2
-//----------------------
-
-#define POR_DEBUG_PORT 0x80 // debug port was detected by the P.O.S.T
-#define POR_DIAG_OK 0x00 // Indicates passage: Failure codes not yet
- // available.
- // Other bits undefined.
-//----------------------
-// porFlags
-//----------------------
-
-#define POR_CPU 0x03 // These bits indicate supposed CPU type
-#define POR_CPU_8 0x01 // Board uses an 80188 (no such thing yet)
-#define POR_CPU_6 0x02 // Board uses an 80186 (all existing products)
-#define POR_CEX4 0x04 // If set, this is an ISA-CEX/4: An ISA-4 (asic)
- // which is architected like an ISA-CEX connected
- // to a (hitherto impossible) 4-port box.
-#define POR_BOXES 0xf0 // Valid for IntelliPort-IIEX only: Map of Box
- // sizes based on box I.D.
-#define POR_BOX_16 0x10 // Set indicates 16-port, clear 8-port
-
-//-------------------------------------
-// LOADWARE and DOWNLOADING CODE
-//-------------------------------------
-
-/*
-Loadware may be sent to the board in two ways:
-1) It may be read from a (binary image) data file block by block as each block
- is sent to the board. This is only possible when the initialization is
- performed by code which can access your file system. This is most suitable
- for diagnostics and appications which use the interface library directly.
-
-2) It may be hard-coded into your source by including a .h file (typically
- supplied by Computone), which declares a data array and initializes every
- element. This achieves the same result as if an entire loadware file had
- been read into the array.
-
- This requires more data space in your program, but access to the file system
- is not required. This method is more suited to driver code, which typically
- is running at a level too low to access the file system directly.
-
-At present, loadware can only be generated at Computone.
-
-All Loadware begins with a header area which has a particular format. This
-includes a magic number which identifies the file as being (purportedly)
-loadware, CRC (for the loader), and version information.
-*/
-
-
-//-----------------------------------------------------------------------------
-// Format of loadware block
-//
-// This is defined as a union so we can pass a pointer to one of these items
-// and (if it is the first block) pick out the version information, etc.
-//
-// Otherwise, to deal with this as a simple character array
-//------------------------------------------------------------------------------
-
-#define LOADWARE_BLOCK_SIZE 512 // Number of bytes in each block of loadware
-
-typedef union _loadHdrStr
-{
- unsigned char c[LOADWARE_BLOCK_SIZE]; // Valid for every block
-
- struct // These fields are valid for only the first block of loadware.
- {
- unsigned char loadMagic; // Magic number: see below
- unsigned char loadBlocksMore; // How many more blocks?
- unsigned char loadCRC[2]; // Two CRC bytes: used by loader
- unsigned char loadVersion; // Version number
- unsigned char loadRevision; // Revision number
- unsigned char loadSubRevision; // Sub-revision number
- unsigned char loadSpares[9]; // Presently unused
- unsigned char loadDates[32]; // Null-terminated string which can give
- // date and time of compilation
- } e;
-} loadHdrStr, *loadHdrStrPtr;
-
-//------------------------------------
-// Defines for downloading code:
-//------------------------------------
-
-// The loadMagic field in the first block of the loadfile must be this, else the
-// file is not valid.
-//
-#define MAGIC_LOADFILE 0x3c
-
-// How do we know the load was successful? On completion of the load, the
-// bootstrap firmware returns a code to indicate whether it thought the download
-// was valid and intends to execute it. These are the only possible valid codes:
-//
-#define LOADWARE_OK 0xc3 // Download was ok
-#define LOADWARE_BAD 0x5a // Download was bad (CRC error)
-
-// Constants applicable to writing blocks of loadware:
-// The first block of loadware might take 600 mS to load, in extreme cases.
-// (Expandable board: worst case for sending startup messages to the LCD's).
-// The 600mS figure is not really a calculation, but a conservative
-// guess/guarantee. Usually this will be within 100 mS, like subsequent blocks.
-//
-#define MAX_DLOAD_START_TIME 1000 // 1000 mS
-#define MAX_DLOAD_READ_TIME 100 // 100 mS
-
-// Firmware should respond with status (see above) within this long of host
-// having sent the final block.
-//
-#define MAX_DLOAD_ACK_TIME 100 // 100 mS, again!
-
-//------------------------------------------------------
-// MAXIMUM NUMBER OF PORTS PER BOARD:
-// This is fixed for now (with the expandable), but may
-// be expanding according to even newer products.
-//------------------------------------------------------
-//
-#define ABS_MAX_BOXES 4 // Absolute most boxes per board
-#define ABS_BIGGEST_BOX 16 // Absolute the most ports per box
-#define ABS_MOST_PORTS (ABS_MAX_BOXES * ABS_BIGGEST_BOX)
-
-#define I2_OUTSW(port, addr, count) outsw((port), (addr), (((count)+1)/2))
-#define I2_OUTSB(port, addr, count) outsb((port), (addr), (((count)+1))&-2)
-#define I2_INSW(port, addr, count) insw((port), (addr), (((count)+1)/2))
-#define I2_INSB(port, addr, count) insb((port), (addr), (((count)+1))&-2)
-
-#endif // I2HW_H
-
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
deleted file mode 100644
index 0d10b89218ed..000000000000
--- a/drivers/char/ip2/i2lib.c
+++ /dev/null
@@ -1,2214 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1999 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: High-level interface code for the device driver. Uses the
-* Extremely Low Level Interface Support (i2ellis.c). Provides an
-* interface to the standard loadware, to support drivers or
-* application code. (This is included source code, not a separate
-* compilation module.)
-*
-*******************************************************************************/
-//------------------------------------------------------------------------------
-// Note on Strategy:
-// Once the board has been initialized, it will interrupt us when:
-// 1) It has something in the fifo for us to read (incoming data, flow control
-// packets, or whatever).
-// 2) It has stripped whatever we have sent last time in the FIFO (and
-// consequently is ready for more).
-//
-// Note also that the buffer sizes declared in i2lib.h are VERY SMALL. This
-// worsens performance considerably, but is done so that a great many channels
-// might use only a little memory.
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// Revision History:
-//
-// 0.00 - 4/16/91 --- First Draft
-// 0.01 - 4/29/91 --- 1st beta release
-// 0.02 - 6/14/91 --- Changes to allow small model compilation
-// 0.03 - 6/17/91 MAG Break reporting protected from interrupts routines with
-// in-line asm added for moving data to/from ring buffers,
-// replacing a variety of methods used previously.
-// 0.04 - 6/21/91 MAG Initial flow-control packets not queued until
-// i2_enable_interrupts time. Former versions would enqueue
-// them at i2_init_channel time, before we knew how many
-// channels were supposed to exist!
-// 0.05 - 10/12/91 MAG Major changes: works through the ellis.c routines now;
-// supports new 16-bit protocol and expandable boards.
-// - 10/24/91 MAG Most changes in place and stable.
-// 0.06 - 2/20/92 MAG Format of CMD_HOTACK corrected: the command takes no
-// argument.
-// 0.07 -- 3/11/92 MAG Support added to store special packet types at interrupt
-// level (mostly responses to specific commands.)
-// 0.08 -- 3/30/92 MAG Support added for STAT_MODEM packet
-// 0.09 -- 6/24/93 MAG i2Link... needed to update number of boards BEFORE
-// turning on the interrupt.
-// 0.10 -- 6/25/93 MAG To avoid gruesome death from a bad board, we sanity check
-// some incoming.
-//
-// 1.1 - 12/25/96 AKM Linux version.
-// - 10/09/98 DMC Revised Linux version.
-//------------------------------------------------------------------------------
-
-//************
-//* Includes *
-//************
-
-#include <linux/sched.h>
-#include "i2lib.h"
-
-
-//***********************
-//* Function Prototypes *
-//***********************
-static void i2QueueNeeds(i2eBordStrPtr, i2ChanStrPtr, int);
-static i2ChanStrPtr i2DeQueueNeeds(i2eBordStrPtr, int );
-static void i2StripFifo(i2eBordStrPtr);
-static void i2StuffFifoBypass(i2eBordStrPtr);
-static void i2StuffFifoFlow(i2eBordStrPtr);
-static void i2StuffFifoInline(i2eBordStrPtr);
-static int i2RetryFlushOutput(i2ChanStrPtr);
-
-// Not a documented part of the library routines (careful...) but the Diagnostic
-// i2diag.c finds them useful to help the throughput in certain limited
-// single-threaded operations.
-static void iiSendPendingMail(i2eBordStrPtr);
-static void serviceOutgoingFifo(i2eBordStrPtr);
-
-// Functions defined in ip2.c as part of interrupt handling
-static void do_input(struct work_struct *);
-static void do_status(struct work_struct *);
-
-//***************
-//* Debug Data *
-//***************
-#ifdef DEBUG_FIFO
-
-unsigned char DBGBuf[0x4000];
-unsigned short I = 0;
-
-static void
-WriteDBGBuf(char *s, unsigned char *src, unsigned short n )
-{
- char *p = src;
-
- // XXX: We need a spin lock here if we ever use this again
-
- while (*s) { // copy label
- DBGBuf[I] = *s++;
- I = I++ & 0x3fff;
- }
- while (n--) { // copy data
- DBGBuf[I] = *p++;
- I = I++ & 0x3fff;
- }
-}
-
-static void
-fatality(i2eBordStrPtr pB )
-{
- int i;
-
- for (i=0;i<sizeof(DBGBuf);i++) {
- if ((i%16) == 0)
- printk("\n%4x:",i);
- printk("%02x ",DBGBuf[i]);
- }
- printk("\n");
- for (i=0;i<sizeof(DBGBuf);i++) {
- if ((i%16) == 0)
- printk("\n%4x:",i);
- if (DBGBuf[i] >= ' ' && DBGBuf[i] <= '~') {
- printk(" %c ",DBGBuf[i]);
- } else {
- printk(" . ");
- }
- }
- printk("\n");
- printk("Last index %x\n",I);
-}
-#endif /* DEBUG_FIFO */
-
-//********
-//* Code *
-//********
-
-static inline int
-i2Validate ( i2ChanStrPtr pCh )
-{
- //ip2trace(pCh->port_index, ITRC_VERIFY,ITRC_ENTER,2,pCh->validity,
- // (CHANNEL_MAGIC | CHANNEL_SUPPORT));
- return ((pCh->validity & (CHANNEL_MAGIC_BITS | CHANNEL_SUPPORT))
- == (CHANNEL_MAGIC | CHANNEL_SUPPORT));
-}
-
-static void iiSendPendingMail_t(unsigned long data)
-{
- i2eBordStrPtr pB = (i2eBordStrPtr)data;
-
- iiSendPendingMail(pB);
-}
-
-//******************************************************************************
-// Function: iiSendPendingMail(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// If any outgoing mail bits are set and there is outgoing mailbox is empty,
-// send the mail and clear the bits.
-//******************************************************************************
-static void
-iiSendPendingMail(i2eBordStrPtr pB)
-{
- if (pB->i2eOutMailWaiting && (!pB->i2eWaitingForEmptyFifo) )
- {
- if (iiTrySendMail(pB, pB->i2eOutMailWaiting))
- {
- /* If we were already waiting for fifo to empty,
- * or just sent MB_OUT_STUFFED, then we are
- * still waiting for it to empty, until we should
- * receive an MB_IN_STRIPPED from the board.
- */
- pB->i2eWaitingForEmptyFifo |=
- (pB->i2eOutMailWaiting & MB_OUT_STUFFED);
- pB->i2eOutMailWaiting = 0;
- pB->SendPendingRetry = 0;
- } else {
-/* The only time we hit this area is when "iiTrySendMail" has
- failed. That only occurs when the outbound mailbox is
- still busy with the last message. We take a short breather
- to let the board catch up with itself and then try again.
- 16 Retries is the limit - then we got a borked board.
- /\/\|=mhw=|\/\/ */
-
- if( ++pB->SendPendingRetry < 16 ) {
- setup_timer(&pB->SendPendingTimer,
- iiSendPendingMail_t, (unsigned long)pB);
- mod_timer(&pB->SendPendingTimer, jiffies + 1);
- } else {
- printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" );
- }
- }
- }
-}
-
-//******************************************************************************
-// Function: i2InitChannels(pB, nChannels, pCh)
-// Parameters: Pointer to Ellis Board structure
-// Number of channels to initialize
-// Pointer to first element in an array of channel structures
-// Returns: Success or failure
-//
-// Description:
-//
-// This function patches pointers, back-pointers, and initializes all the
-// elements in the channel structure array.
-//
-// This should be run after the board structure is initialized, through having
-// loaded the standard loadware (otherwise it complains).
-//
-// In any case, it must be done before any serious work begins initializing the
-// irq's or sending commands...
-//
-//******************************************************************************
-static int
-i2InitChannels ( i2eBordStrPtr pB, int nChannels, i2ChanStrPtr pCh)
-{
- int index, stuffIndex;
- i2ChanStrPtr *ppCh;
-
- if (pB->i2eValid != I2E_MAGIC) {
- I2_COMPLETE(pB, I2EE_BADMAGIC);
- }
- if (pB->i2eState != II_STATE_STDLOADED) {
- I2_COMPLETE(pB, I2EE_BADSTATE);
- }
-
- rwlock_init(&pB->read_fifo_spinlock);
- rwlock_init(&pB->write_fifo_spinlock);
- rwlock_init(&pB->Dbuf_spinlock);
- rwlock_init(&pB->Bbuf_spinlock);
- rwlock_init(&pB->Fbuf_spinlock);
-
- // NO LOCK needed yet - this is init
-
- pB->i2eChannelPtr = pCh;
- pB->i2eChannelCnt = nChannels;
-
- pB->i2Fbuf_strip = pB->i2Fbuf_stuff = 0;
- pB->i2Dbuf_strip = pB->i2Dbuf_stuff = 0;
- pB->i2Bbuf_strip = pB->i2Bbuf_stuff = 0;
-
- pB->SendPendingRetry = 0;
-
- memset ( pCh, 0, sizeof (i2ChanStr) * nChannels );
-
- for (index = stuffIndex = 0, ppCh = (i2ChanStrPtr *)(pB->i2Fbuf);
- nChannels && index < ABS_MOST_PORTS;
- index++)
- {
- if ( !(pB->i2eChannelMap[index >> 4] & (1 << (index & 0xf)) ) ) {
- continue;
- }
- rwlock_init(&pCh->Ibuf_spinlock);
- rwlock_init(&pCh->Obuf_spinlock);
- rwlock_init(&pCh->Cbuf_spinlock);
- rwlock_init(&pCh->Pbuf_spinlock);
- // NO LOCK needed yet - this is init
- // Set up validity flag according to support level
- if (pB->i2eGoodMap[index >> 4] & (1 << (index & 0xf)) ) {
- pCh->validity = CHANNEL_MAGIC | CHANNEL_SUPPORT;
- } else {
- pCh->validity = CHANNEL_MAGIC;
- }
- pCh->pMyBord = pB; /* Back-pointer */
-
- // Prepare an outgoing flow-control packet to send as soon as the chance
- // occurs.
- if ( pCh->validity & CHANNEL_SUPPORT ) {
- pCh->infl.hd.i2sChannel = index;
- pCh->infl.hd.i2sCount = 5;
- pCh->infl.hd.i2sType = PTYPE_BYPASS;
- pCh->infl.fcmd = 37;
- pCh->infl.asof = 0;
- pCh->infl.room = IBUF_SIZE - 1;
-
- pCh->whenSendFlow = (IBUF_SIZE/5)*4; // when 80% full
-
- // The following is similar to calling i2QueueNeeds, except that this
- // is done in longhand, since we are setting up initial conditions on
- // many channels at once.
- pCh->channelNeeds = NEED_FLOW; // Since starting from scratch
- pCh->sinceLastFlow = 0; // No bytes received since last flow
- // control packet was queued
- stuffIndex++;
- *ppCh++ = pCh; // List this channel as needing
- // initial flow control packet sent
- }
-
- // Don't allow anything to be sent until the status packets come in from
- // the board.
-
- pCh->outfl.asof = 0;
- pCh->outfl.room = 0;
-
- // Initialize all the ring buffers
-
- pCh->Ibuf_stuff = pCh->Ibuf_strip = 0;
- pCh->Obuf_stuff = pCh->Obuf_strip = 0;
- pCh->Cbuf_stuff = pCh->Cbuf_strip = 0;
-
- memset( &pCh->icount, 0, sizeof (struct async_icount) );
- pCh->hotKeyIn = HOT_CLEAR;
- pCh->channelOptions = 0;
- pCh->bookMarks = 0;
- init_waitqueue_head(&pCh->pBookmarkWait);
-
- init_waitqueue_head(&pCh->open_wait);
- init_waitqueue_head(&pCh->close_wait);
- init_waitqueue_head(&pCh->delta_msr_wait);
-
- // Set base and divisor so default custom rate is 9600
- pCh->BaudBase = 921600; // MAX for ST654, changed after we get
- pCh->BaudDivisor = 96; // the boxids (UART types) later
-
- pCh->dataSetIn = 0;
- pCh->dataSetOut = 0;
-
- pCh->wopen = 0;
- pCh->throttled = 0;
-
- pCh->speed = CBR_9600;
-
- pCh->flags = 0;
-
- pCh->ClosingDelay = 5*HZ/10;
- pCh->ClosingWaitTime = 30*HZ;
-
- // Initialize task queue objects
- INIT_WORK(&pCh->tqueue_input, do_input);
- INIT_WORK(&pCh->tqueue_status, do_status);
-
-#ifdef IP2DEBUG_TRACE
- pCh->trace = ip2trace;
-#endif
-
- ++pCh;
- --nChannels;
- }
- // No need to check for wrap here; this is initialization.
- pB->i2Fbuf_stuff = stuffIndex;
- I2_COMPLETE(pB, I2EE_GOOD);
-
-}
-
-//******************************************************************************
-// Function: i2DeQueueNeeds(pB, type)
-// Parameters: Pointer to a board structure
-// type bit map: may include NEED_INLINE, NEED_BYPASS, or NEED_FLOW
-// Returns:
-// Pointer to a channel structure
-//
-// Description: Returns pointer struct of next channel that needs service of
-// the type specified. Otherwise returns a NULL reference.
-//
-//******************************************************************************
-static i2ChanStrPtr
-i2DeQueueNeeds(i2eBordStrPtr pB, int type)
-{
- unsigned short queueIndex;
- unsigned long flags;
-
- i2ChanStrPtr pCh = NULL;
-
- switch(type) {
-
- case NEED_INLINE:
-
- write_lock_irqsave(&pB->Dbuf_spinlock, flags);
- if ( pB->i2Dbuf_stuff != pB->i2Dbuf_strip)
- {
- queueIndex = pB->i2Dbuf_strip;
- pCh = pB->i2Dbuf[queueIndex];
- queueIndex++;
- if (queueIndex >= CH_QUEUE_SIZE) {
- queueIndex = 0;
- }
- pB->i2Dbuf_strip = queueIndex;
- pCh->channelNeeds &= ~NEED_INLINE;
- }
- write_unlock_irqrestore(&pB->Dbuf_spinlock, flags);
- break;
-
- case NEED_BYPASS:
-
- write_lock_irqsave(&pB->Bbuf_spinlock, flags);
- if (pB->i2Bbuf_stuff != pB->i2Bbuf_strip)
- {
- queueIndex = pB->i2Bbuf_strip;
- pCh = pB->i2Bbuf[queueIndex];
- queueIndex++;
- if (queueIndex >= CH_QUEUE_SIZE) {
- queueIndex = 0;
- }
- pB->i2Bbuf_strip = queueIndex;
- pCh->channelNeeds &= ~NEED_BYPASS;
- }
- write_unlock_irqrestore(&pB->Bbuf_spinlock, flags);
- break;
-
- case NEED_FLOW:
-
- write_lock_irqsave(&pB->Fbuf_spinlock, flags);
- if (pB->i2Fbuf_stuff != pB->i2Fbuf_strip)
- {
- queueIndex = pB->i2Fbuf_strip;
- pCh = pB->i2Fbuf[queueIndex];
- queueIndex++;
- if (queueIndex >= CH_QUEUE_SIZE) {
- queueIndex = 0;
- }
- pB->i2Fbuf_strip = queueIndex;
- pCh->channelNeeds &= ~NEED_FLOW;
- }
- write_unlock_irqrestore(&pB->Fbuf_spinlock, flags);
- break;
- default:
- printk(KERN_ERR "i2DeQueueNeeds called with bad type:%x\n",type);
- break;
- }
- return pCh;
-}
-
-//******************************************************************************
-// Function: i2QueueNeeds(pB, pCh, type)
-// Parameters: Pointer to a board structure
-// Pointer to a channel structure
-// type bit map: may include NEED_INLINE, NEED_BYPASS, or NEED_FLOW
-// Returns: Nothing
-//
-// Description:
-// For each type of need selected, if the given channel is not already in the
-// queue, adds it, and sets the flag indicating it is in the queue.
-//******************************************************************************
-static void
-i2QueueNeeds(i2eBordStrPtr pB, i2ChanStrPtr pCh, int type)
-{
- unsigned short queueIndex;
- unsigned long flags;
-
- // We turn off all the interrupts during this brief process, since the
- // interrupt-level code might want to put things on the queue as well.
-
- switch (type) {
-
- case NEED_INLINE:
-
- write_lock_irqsave(&pB->Dbuf_spinlock, flags);
- if ( !(pCh->channelNeeds & NEED_INLINE) )
- {
- pCh->channelNeeds |= NEED_INLINE;
- queueIndex = pB->i2Dbuf_stuff;
- pB->i2Dbuf[queueIndex++] = pCh;
- if (queueIndex >= CH_QUEUE_SIZE)
- queueIndex = 0;
- pB->i2Dbuf_stuff = queueIndex;
- }
- write_unlock_irqrestore(&pB->Dbuf_spinlock, flags);
- break;
-
- case NEED_BYPASS:
-
- write_lock_irqsave(&pB->Bbuf_spinlock, flags);
- if ((type & NEED_BYPASS) && !(pCh->channelNeeds & NEED_BYPASS))
- {
- pCh->channelNeeds |= NEED_BYPASS;
- queueIndex = pB->i2Bbuf_stuff;
- pB->i2Bbuf[queueIndex++] = pCh;
- if (queueIndex >= CH_QUEUE_SIZE)
- queueIndex = 0;
- pB->i2Bbuf_stuff = queueIndex;
- }
- write_unlock_irqrestore(&pB->Bbuf_spinlock, flags);
- break;
-
- case NEED_FLOW:
-
- write_lock_irqsave(&pB->Fbuf_spinlock, flags);
- if ((type & NEED_FLOW) && !(pCh->channelNeeds & NEED_FLOW))
- {
- pCh->channelNeeds |= NEED_FLOW;
- queueIndex = pB->i2Fbuf_stuff;
- pB->i2Fbuf[queueIndex++] = pCh;
- if (queueIndex >= CH_QUEUE_SIZE)
- queueIndex = 0;
- pB->i2Fbuf_stuff = queueIndex;
- }
- write_unlock_irqrestore(&pB->Fbuf_spinlock, flags);
- break;
-
- case NEED_CREDIT:
- pCh->channelNeeds |= NEED_CREDIT;
- break;
- default:
- printk(KERN_ERR "i2QueueNeeds called with bad type:%x\n",type);
- break;
- }
- return;
-}
-
-//******************************************************************************
-// Function: i2QueueCommands(type, pCh, timeout, nCommands, pCs,...)
-// Parameters: type - PTYPE_BYPASS or PTYPE_INLINE
-// pointer to the channel structure
-// maximum period to wait
-// number of commands (n)
-// n commands
-// Returns: Number of commands sent, or -1 for error
-//
-// get board lock before calling
-//
-// Description:
-// Queues up some commands to be sent to a channel. To send possibly several
-// bypass or inline commands to the given channel. The timeout parameter
-// indicates how many HUNDREDTHS OF SECONDS to wait until there is room:
-// 0 = return immediately if no room, -ive = wait forever, +ive = number of
-// 1/100 seconds to wait. Return values:
-// -1 Some kind of nasty error: bad channel structure or invalid arguments.
-// 0 No room to send all the commands
-// (+) Number of commands sent
-//******************************************************************************
-static int
-i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
- cmdSyntaxPtr pCs0,...)
-{
- int totalsize = 0;
- int blocksize;
- int lastended;
- cmdSyntaxPtr *ppCs;
- cmdSyntaxPtr pCs;
- int count;
- int flag;
- i2eBordStrPtr pB;
-
- unsigned short maxBlock;
- unsigned short maxBuff;
- short bufroom;
- unsigned short stuffIndex;
- unsigned char *pBuf;
- unsigned char *pInsert;
- unsigned char *pDest, *pSource;
- unsigned short channel;
- int cnt;
- unsigned long flags = 0;
- rwlock_t *lock_var_p = NULL;
-
- // Make sure the channel exists, otherwise do nothing
- if ( !i2Validate ( pCh ) ) {
- return -1;
- }
-
- ip2trace (CHANN, ITRC_QUEUE, ITRC_ENTER, 0 );
-
- pB = pCh->pMyBord;
-
- // Board must also exist, and THE INTERRUPT COMMAND ALREADY SENT
- if (pB->i2eValid != I2E_MAGIC || pB->i2eUsingIrq == I2_IRQ_UNDEFINED)
- return -2;
- // If the board has gone fatal, return bad, and also hit the trap routine if
- // it exists.
- if (pB->i2eFatal) {
- if ( pB->i2eFatalTrap ) {
- (*(pB)->i2eFatalTrap)(pB);
- }
- return -3;
- }
- // Set up some variables, Which buffers are we using? How big are they?
- switch(type)
- {
- case PTYPE_INLINE:
- flag = INL;
- maxBlock = MAX_OBUF_BLOCK;
- maxBuff = OBUF_SIZE;
- pBuf = pCh->Obuf;
- break;
- case PTYPE_BYPASS:
- flag = BYP;
- maxBlock = MAX_CBUF_BLOCK;
- maxBuff = CBUF_SIZE;
- pBuf = pCh->Cbuf;
- break;
- default:
- return -4;
- }
- // Determine the total size required for all the commands
- totalsize = blocksize = sizeof(i2CmdHeader);
- lastended = 0;
- ppCs = &pCs0;
- for ( count = nCommands; count; count--, ppCs++)
- {
- pCs = *ppCs;
- cnt = pCs->length;
- // Will a new block be needed for this one?
- // Two possible reasons: too
- // big or previous command has to be at the end of a packet.
- if ((blocksize + cnt > maxBlock) || lastended) {
- blocksize = sizeof(i2CmdHeader);
- totalsize += sizeof(i2CmdHeader);
- }
- totalsize += cnt;
- blocksize += cnt;
-
- // If this command had to end a block, then we will make sure to
- // account for it should there be any more blocks.
- lastended = pCs->flags & END;
- }
- for (;;) {
- // Make sure any pending flush commands go out before we add more data.
- if ( !( pCh->flush_flags && i2RetryFlushOutput( pCh ) ) ) {
- // How much room (this time through) ?
- switch(type) {
- case PTYPE_INLINE:
- lock_var_p = &pCh->Obuf_spinlock;
- write_lock_irqsave(lock_var_p, flags);
- stuffIndex = pCh->Obuf_stuff;
- bufroom = pCh->Obuf_strip - stuffIndex;
- break;
- case PTYPE_BYPASS:
- lock_var_p = &pCh->Cbuf_spinlock;
- write_lock_irqsave(lock_var_p, flags);
- stuffIndex = pCh->Cbuf_stuff;
- bufroom = pCh->Cbuf_strip - stuffIndex;
- break;
- default:
- return -5;
- }
- if (--bufroom < 0) {
- bufroom += maxBuff;
- }
-
- ip2trace (CHANN, ITRC_QUEUE, 2, 1, bufroom );
-
- // Check for overflow
- if (totalsize <= bufroom) {
- // Normal Expected path - We still hold LOCK
- break; /* from for()- Enough room: goto proceed */
- }
- ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
- write_unlock_irqrestore(lock_var_p, flags);
- } else
- ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
-
- /* Prepare to wait for buffers to empty */
- serviceOutgoingFifo(pB); // Dump what we got
-
- if (timeout == 0) {
- return 0; // Tired of waiting
- }
- if (timeout > 0)
- timeout--; // So negative values == forever
-
- if (!in_interrupt()) {
- schedule_timeout_interruptible(1); // short nap
- } else {
- // we cannot sched/sleep in interrupt silly
- return 0;
- }
- if (signal_pending(current)) {
- return 0; // Wake up! Time to die!!!
- }
-
- ip2trace (CHANN, ITRC_QUEUE, 4, 0 );
-
- } // end of for(;;)
-
- // At this point we have room and the lock - stick them in.
- channel = pCh->infl.hd.i2sChannel;
- pInsert = &pBuf[stuffIndex]; // Pointer to start of packet
- pDest = CMD_OF(pInsert); // Pointer to start of command
-
- // When we start counting, the block is the size of the header
- for (blocksize = sizeof(i2CmdHeader), count = nCommands,
- lastended = 0, ppCs = &pCs0;
- count;
- count--, ppCs++)
- {
- pCs = *ppCs; // Points to command protocol structure
-
- // If this is a bookmark request command, post the fact that a bookmark
- // request is pending. NOTE THIS TRICK ONLY WORKS BECAUSE CMD_BMARK_REQ
- // has no parameters! The more general solution would be to reference
- // pCs->cmd[0].
- if (pCs == CMD_BMARK_REQ) {
- pCh->bookMarks++;
-
- ip2trace (CHANN, ITRC_DRAIN, 30, 1, pCh->bookMarks );
-
- }
- cnt = pCs->length;
-
- // If this command would put us over the maximum block size or
- // if the last command had to be at the end of a block, we end
- // the existing block here and start a new one.
- if ((blocksize + cnt > maxBlock) || lastended) {
-
- ip2trace (CHANN, ITRC_QUEUE, 5, 0 );
-
- PTYPE_OF(pInsert) = type;
- CHANNEL_OF(pInsert) = channel;
- // count here does not include the header
- CMD_COUNT_OF(pInsert) = blocksize - sizeof(i2CmdHeader);
- stuffIndex += blocksize;
- if(stuffIndex >= maxBuff) {
- stuffIndex = 0;
- pInsert = pBuf;
- }
- pInsert = &pBuf[stuffIndex]; // Pointer to start of next pkt
- pDest = CMD_OF(pInsert);
- blocksize = sizeof(i2CmdHeader);
- }
- // Now we know there is room for this one in the current block
-
- blocksize += cnt; // Total bytes in this command
- pSource = pCs->cmd; // Copy the command into the buffer
- while (cnt--) {
- *pDest++ = *pSource++;
- }
- // If this command had to end a block, then we will make sure to account
- // for it should there be any more blocks.
- lastended = pCs->flags & END;
- } // end for
- // Clean up the final block by writing header, etc
-
- PTYPE_OF(pInsert) = type;
- CHANNEL_OF(pInsert) = channel;
- // count here does not include the header
- CMD_COUNT_OF(pInsert) = blocksize - sizeof(i2CmdHeader);
- stuffIndex += blocksize;
- if(stuffIndex >= maxBuff) {
- stuffIndex = 0;
- pInsert = pBuf;
- }
- // Updates the index, and post the need for service. When adding these to
- // the queue of channels, we turn off the interrupt while doing so,
- // because at interrupt level we might want to push a channel back to the
- // end of the queue.
- switch(type)
- {
- case PTYPE_INLINE:
- pCh->Obuf_stuff = stuffIndex; // Store buffer pointer
- write_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
-
- pB->debugInlineQueued++;
- // Add the channel pointer to list of channels needing service (first
- // come...), if it's not already there.
- i2QueueNeeds(pB, pCh, NEED_INLINE);
- break;
-
- case PTYPE_BYPASS:
- pCh->Cbuf_stuff = stuffIndex; // Store buffer pointer
- write_unlock_irqrestore(&pCh->Cbuf_spinlock, flags);
-
- pB->debugBypassQueued++;
- // Add the channel pointer to list of channels needing service (first
- // come...), if it's not already there.
- i2QueueNeeds(pB, pCh, NEED_BYPASS);
- break;
- }
-
- ip2trace (CHANN, ITRC_QUEUE, ITRC_RETURN, 1, nCommands );
-
- return nCommands; // Good status: number of commands sent
-}
-
-//******************************************************************************
-// Function: i2GetStatus(pCh,resetBits)
-// Parameters: Pointer to a channel structure
-// Bit map of status bits to clear
-// Returns: Bit map of current status bits
-//
-// Description:
-// Returns the state of data set signals, and whether a break has been received,
-// (see i2lib.h for bit-mapped result). resetBits is a bit-map of any status
-// bits to be cleared: I2_BRK, I2_PAR, I2_FRA, I2_OVR,... These are cleared
-// AFTER the condition is passed. If pCh does not point to a valid channel,
-// returns -1 (which would be impossible otherwise.
-//******************************************************************************
-static int
-i2GetStatus(i2ChanStrPtr pCh, int resetBits)
-{
- unsigned short status;
- i2eBordStrPtr pB;
-
- ip2trace (CHANN, ITRC_STATUS, ITRC_ENTER, 2, pCh->dataSetIn, resetBits );
-
- // Make sure the channel exists, otherwise do nothing */
- if ( !i2Validate ( pCh ) )
- return -1;
-
- pB = pCh->pMyBord;
-
- status = pCh->dataSetIn;
-
- // Clear any specified error bits: but note that only actual error bits can
- // be cleared, regardless of the value passed.
- if (resetBits)
- {
- pCh->dataSetIn &= ~(resetBits & (I2_BRK | I2_PAR | I2_FRA | I2_OVR));
- pCh->dataSetIn &= ~(I2_DDCD | I2_DCTS | I2_DDSR | I2_DRI);
- }
-
- ip2trace (CHANN, ITRC_STATUS, ITRC_RETURN, 1, pCh->dataSetIn );
-
- return status;
-}
-
-//******************************************************************************
-// Function: i2Input(pChpDest,count)
-// Parameters: Pointer to a channel structure
-// Pointer to data buffer
-// Number of bytes to read
-// Returns: Number of bytes read, or -1 for error
-//
-// Description:
-// Strips data from the input buffer and writes it to pDest. If there is a
-// collosal blunder, (invalid structure pointers or the like), returns -1.
-// Otherwise, returns the number of bytes read.
-//******************************************************************************
-static int
-i2Input(i2ChanStrPtr pCh)
-{
- int amountToMove;
- unsigned short stripIndex;
- int count;
- unsigned long flags = 0;
-
- ip2trace (CHANN, ITRC_INPUT, ITRC_ENTER, 0);
-
- // Ensure channel structure seems real
- if ( !i2Validate( pCh ) ) {
- count = -1;
- goto i2Input_exit;
- }
- write_lock_irqsave(&pCh->Ibuf_spinlock, flags);
-
- // initialize some accelerators and private copies
- stripIndex = pCh->Ibuf_strip;
-
- count = pCh->Ibuf_stuff - stripIndex;
-
- // If buffer is empty or requested data count was 0, (trivial case) return
- // without any further thought.
- if ( count == 0 ) {
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- goto i2Input_exit;
- }
- // Adjust for buffer wrap
- if ( count < 0 ) {
- count += IBUF_SIZE;
- }
- // Don't give more than can be taken by the line discipline
- amountToMove = pCh->pTTY->receive_room;
- if (count > amountToMove) {
- count = amountToMove;
- }
- // How much could we copy without a wrap?
- amountToMove = IBUF_SIZE - stripIndex;
-
- if (amountToMove > count) {
- amountToMove = count;
- }
- // Move the first block
- pCh->pTTY->ldisc->ops->receive_buf( pCh->pTTY,
- &(pCh->Ibuf[stripIndex]), NULL, amountToMove );
- // If we needed to wrap, do the second data move
- if (count > amountToMove) {
- pCh->pTTY->ldisc->ops->receive_buf( pCh->pTTY,
- pCh->Ibuf, NULL, count - amountToMove );
- }
- // Bump and wrap the stripIndex all at once by the amount of data read. This
- // method is good regardless of whether the data was in one or two pieces.
- stripIndex += count;
- if (stripIndex >= IBUF_SIZE) {
- stripIndex -= IBUF_SIZE;
- }
- pCh->Ibuf_strip = stripIndex;
-
- // Update our flow control information and possibly queue ourselves to send
- // it, depending on how much data has been stripped since the last time a
- // packet was sent.
- pCh->infl.asof += count;
-
- if ((pCh->sinceLastFlow += count) >= pCh->whenSendFlow) {
- pCh->sinceLastFlow -= pCh->whenSendFlow;
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- i2QueueNeeds(pCh->pMyBord, pCh, NEED_FLOW);
- } else {
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- }
-
-i2Input_exit:
-
- ip2trace (CHANN, ITRC_INPUT, ITRC_RETURN, 1, count);
-
- return count;
-}
-
-//******************************************************************************
-// Function: i2InputFlush(pCh)
-// Parameters: Pointer to a channel structure
-// Returns: Number of bytes stripped, or -1 for error
-//
-// Description:
-// Strips any data from the input buffer. If there is a collosal blunder,
-// (invalid structure pointers or the like), returns -1. Otherwise, returns the
-// number of bytes stripped.
-//******************************************************************************
-static int
-i2InputFlush(i2ChanStrPtr pCh)
-{
- int count;
- unsigned long flags;
-
- // Ensure channel structure seems real
- if ( !i2Validate ( pCh ) )
- return -1;
-
- ip2trace (CHANN, ITRC_INPUT, 10, 0);
-
- write_lock_irqsave(&pCh->Ibuf_spinlock, flags);
- count = pCh->Ibuf_stuff - pCh->Ibuf_strip;
-
- // Adjust for buffer wrap
- if (count < 0) {
- count += IBUF_SIZE;
- }
-
- // Expedient way to zero out the buffer
- pCh->Ibuf_strip = pCh->Ibuf_stuff;
-
-
- // Update our flow control information and possibly queue ourselves to send
- // it, depending on how much data has been stripped since the last time a
- // packet was sent.
-
- pCh->infl.asof += count;
-
- if ( (pCh->sinceLastFlow += count) >= pCh->whenSendFlow )
- {
- pCh->sinceLastFlow -= pCh->whenSendFlow;
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- i2QueueNeeds(pCh->pMyBord, pCh, NEED_FLOW);
- } else {
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- }
-
- ip2trace (CHANN, ITRC_INPUT, 19, 1, count);
-
- return count;
-}
-
-//******************************************************************************
-// Function: i2InputAvailable(pCh)
-// Parameters: Pointer to a channel structure
-// Returns: Number of bytes available, or -1 for error
-//
-// Description:
-// If there is a collosal blunder, (invalid structure pointers or the like),
-// returns -1. Otherwise, returns the number of bytes stripped. Otherwise,
-// returns the number of bytes available in the buffer.
-//******************************************************************************
-#if 0
-static int
-i2InputAvailable(i2ChanStrPtr pCh)
-{
- int count;
-
- // Ensure channel structure seems real
- if ( !i2Validate ( pCh ) ) return -1;
-
-
- // initialize some accelerators and private copies
- read_lock_irqsave(&pCh->Ibuf_spinlock, flags);
- count = pCh->Ibuf_stuff - pCh->Ibuf_strip;
- read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
-
- // Adjust for buffer wrap
- if (count < 0)
- {
- count += IBUF_SIZE;
- }
-
- return count;
-}
-#endif
-
-//******************************************************************************
-// Function: i2Output(pCh, pSource, count)
-// Parameters: Pointer to channel structure
-// Pointer to source data
-// Number of bytes to send
-// Returns: Number of bytes sent, or -1 for error
-//
-// Description:
-// Queues the data at pSource to be sent as data packets to the board. If there
-// is a collosal blunder, (invalid structure pointers or the like), returns -1.
-// Otherwise, returns the number of bytes written. What if there is not enough
-// room for all the data? If pCh->channelOptions & CO_NBLOCK_WRITE is set, then
-// we transfer as many characters as we can now, then return. If this bit is
-// clear (default), routine will spin along until all the data is buffered.
-// Should this occur, the 1-ms delay routine is called while waiting to avoid
-// applications that one cannot break out of.
-//******************************************************************************
-static int
-i2Output(i2ChanStrPtr pCh, const char *pSource, int count)
-{
- i2eBordStrPtr pB;
- unsigned char *pInsert;
- int amountToMove;
- int countOriginal = count;
- unsigned short channel;
- unsigned short stuffIndex;
- unsigned long flags;
-
- int bailout = 10;
-
- ip2trace (CHANN, ITRC_OUTPUT, ITRC_ENTER, 2, count, 0 );
-
- // Ensure channel structure seems real
- if ( !i2Validate ( pCh ) )
- return -1;
-
- // initialize some accelerators and private copies
- pB = pCh->pMyBord;
- channel = pCh->infl.hd.i2sChannel;
-
- // If the board has gone fatal, return bad, and also hit the trap routine if
- // it exists.
- if (pB->i2eFatal) {
- if (pB->i2eFatalTrap) {
- (*(pB)->i2eFatalTrap)(pB);
- }
- return -1;
- }
- // Proceed as though we would do everything
- while ( count > 0 ) {
-
- // How much room in output buffer is there?
- read_lock_irqsave(&pCh->Obuf_spinlock, flags);
- amountToMove = pCh->Obuf_strip - pCh->Obuf_stuff - 1;
- read_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
- if (amountToMove < 0) {
- amountToMove += OBUF_SIZE;
- }
- // Subtract off the headers size and see how much room there is for real
- // data. If this is negative, we will discover later.
- amountToMove -= sizeof (i2DataHeader);
-
- // Don't move more (now) than can go in a single packet
- if ( amountToMove > (int)(MAX_OBUF_BLOCK - sizeof(i2DataHeader)) ) {
- amountToMove = MAX_OBUF_BLOCK - sizeof(i2DataHeader);
- }
- // Don't move more than the count we were given
- if (amountToMove > count) {
- amountToMove = count;
- }
- // Now we know how much we must move: NB because the ring buffers have
- // an overflow area at the end, we needn't worry about wrapping in the
- // middle of a packet.
-
-// Small WINDOW here with no LOCK but I can't call Flush with LOCK
-// We would be flushing (or ending flush) anyway
-
- ip2trace (CHANN, ITRC_OUTPUT, 10, 1, amountToMove );
-
- if ( !(pCh->flush_flags && i2RetryFlushOutput(pCh) )
- && amountToMove > 0 )
- {
- write_lock_irqsave(&pCh->Obuf_spinlock, flags);
- stuffIndex = pCh->Obuf_stuff;
-
- // Had room to move some data: don't know whether the block size,
- // buffer space, or what was the limiting factor...
- pInsert = &(pCh->Obuf[stuffIndex]);
-
- // Set up the header
- CHANNEL_OF(pInsert) = channel;
- PTYPE_OF(pInsert) = PTYPE_DATA;
- TAG_OF(pInsert) = 0;
- ID_OF(pInsert) = ID_ORDINARY_DATA;
- DATA_COUNT_OF(pInsert) = amountToMove;
-
- // Move the data
- memcpy( (char*)(DATA_OF(pInsert)), pSource, amountToMove );
- // Adjust pointers and indices
- pSource += amountToMove;
- pCh->Obuf_char_count += amountToMove;
- stuffIndex += amountToMove + sizeof(i2DataHeader);
- count -= amountToMove;
-
- if (stuffIndex >= OBUF_SIZE) {
- stuffIndex = 0;
- }
- pCh->Obuf_stuff = stuffIndex;
-
- write_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
-
- ip2trace (CHANN, ITRC_OUTPUT, 13, 1, stuffIndex );
-
- } else {
-
- // Cannot move data
- // becuz we need to stuff a flush
- // or amount to move is <= 0
-
- ip2trace(CHANN, ITRC_OUTPUT, 14, 3,
- amountToMove, pB->i2eFifoRemains,
- pB->i2eWaitingForEmptyFifo );
-
- // Put this channel back on queue
- // this ultimatly gets more data or wakes write output
- i2QueueNeeds(pB, pCh, NEED_INLINE);
-
- if ( pB->i2eWaitingForEmptyFifo ) {
-
- ip2trace (CHANN, ITRC_OUTPUT, 16, 0 );
-
- // or schedule
- if (!in_interrupt()) {
-
- ip2trace (CHANN, ITRC_OUTPUT, 61, 0 );
-
- schedule_timeout_interruptible(2);
- if (signal_pending(current)) {
- break;
- }
- continue;
- } else {
-
- ip2trace (CHANN, ITRC_OUTPUT, 62, 0 );
-
- // let interrupt in = WAS restore_flags()
- // We hold no lock nor is irq off anymore???
-
- break;
- }
- break; // from while(count)
- }
- else if ( pB->i2eFifoRemains < 32 && !pB->i2eTxMailEmpty ( pB ) )
- {
- ip2trace (CHANN, ITRC_OUTPUT, 19, 2,
- pB->i2eFifoRemains,
- pB->i2eTxMailEmpty );
-
- break; // from while(count)
- } else if ( pCh->channelNeeds & NEED_CREDIT ) {
-
- ip2trace (CHANN, ITRC_OUTPUT, 22, 0 );
-
- break; // from while(count)
- } else if ( --bailout) {
-
- // Try to throw more things (maybe not us) in the fifo if we're
- // not already waiting for it.
-
- ip2trace (CHANN, ITRC_OUTPUT, 20, 0 );
-
- serviceOutgoingFifo(pB);
- //break; CONTINUE;
- } else {
- ip2trace (CHANN, ITRC_OUTPUT, 21, 3,
- pB->i2eFifoRemains,
- pB->i2eOutMailWaiting,
- pB->i2eWaitingForEmptyFifo );
-
- break; // from while(count)
- }
- }
- } // End of while(count)
-
- i2QueueNeeds(pB, pCh, NEED_INLINE);
-
- // We drop through either when the count expires, or when there is some
- // count left, but there was a non-blocking write.
- if (countOriginal > count) {
-
- ip2trace (CHANN, ITRC_OUTPUT, 17, 2, countOriginal, count );
-
- serviceOutgoingFifo( pB );
- }
-
- ip2trace (CHANN, ITRC_OUTPUT, ITRC_RETURN, 2, countOriginal, count );
-
- return countOriginal - count;
-}
-
-//******************************************************************************
-// Function: i2FlushOutput(pCh)
-// Parameters: Pointer to a channel structure
-// Returns: Nothing
-//
-// Description:
-// Sends bypass command to start flushing (waiting possibly forever until there
-// is room), then sends inline command to stop flushing output, (again waiting
-// possibly forever).
-//******************************************************************************
-static inline void
-i2FlushOutput(i2ChanStrPtr pCh)
-{
-
- ip2trace (CHANN, ITRC_FLUSH, 1, 1, pCh->flush_flags );
-
- if (pCh->flush_flags)
- return;
-
- if ( 1 != i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_STARTFL) ) {
- pCh->flush_flags = STARTFL_FLAG; // Failed - flag for later
-
- ip2trace (CHANN, ITRC_FLUSH, 2, 0 );
-
- } else if ( 1 != i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) ) {
- pCh->flush_flags = STOPFL_FLAG; // Failed - flag for later
-
- ip2trace (CHANN, ITRC_FLUSH, 3, 0 );
- }
-}
-
-static int
-i2RetryFlushOutput(i2ChanStrPtr pCh)
-{
- int old_flags = pCh->flush_flags;
-
- ip2trace (CHANN, ITRC_FLUSH, 14, 1, old_flags );
-
- pCh->flush_flags = 0; // Clear flag so we can avoid recursion
- // and queue the commands
-
- if ( old_flags & STARTFL_FLAG ) {
- if ( 1 == i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_STARTFL) ) {
- old_flags = STOPFL_FLAG; //Success - send stop flush
- } else {
- old_flags = STARTFL_FLAG; //Failure - Flag for retry later
- }
-
- ip2trace (CHANN, ITRC_FLUSH, 15, 1, old_flags );
-
- }
- if ( old_flags & STOPFL_FLAG ) {
- if (1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)) {
- old_flags = 0; // Success - clear flags
- }
-
- ip2trace (CHANN, ITRC_FLUSH, 16, 1, old_flags );
- }
- pCh->flush_flags = old_flags;
-
- ip2trace (CHANN, ITRC_FLUSH, 17, 1, old_flags );
-
- return old_flags;
-}
-
-//******************************************************************************
-// Function: i2DrainOutput(pCh,timeout)
-// Parameters: Pointer to a channel structure
-// Maximum period to wait
-// Returns: ?
-//
-// Description:
-// Uses the bookmark request command to ask the board to send a bookmark back as
-// soon as all the data is completely sent.
-//******************************************************************************
-static void
-i2DrainWakeup(unsigned long d)
-{
- i2ChanStrPtr pCh = (i2ChanStrPtr)d;
-
- ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires );
-
- pCh->BookmarkTimer.expires = 0;
- wake_up_interruptible( &pCh->pBookmarkWait );
-}
-
-static void
-i2DrainOutput(i2ChanStrPtr pCh, int timeout)
-{
- wait_queue_t wait;
- i2eBordStrPtr pB;
-
- ip2trace (CHANN, ITRC_DRAIN, ITRC_ENTER, 1, pCh->BookmarkTimer.expires);
-
- pB = pCh->pMyBord;
- // If the board has gone fatal, return bad,
- // and also hit the trap routine if it exists.
- if (pB->i2eFatal) {
- if (pB->i2eFatalTrap) {
- (*(pB)->i2eFatalTrap)(pB);
- }
- return;
- }
- if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) {
- // One per customer (channel)
- setup_timer(&pCh->BookmarkTimer, i2DrainWakeup,
- (unsigned long)pCh);
-
- ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires );
-
- mod_timer(&pCh->BookmarkTimer, jiffies + timeout);
- }
-
- i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ );
-
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&(pCh->pBookmarkWait), &wait);
- set_current_state( TASK_INTERRUPTIBLE );
-
- serviceOutgoingFifo( pB );
-
- schedule(); // Now we take our interruptible sleep on
-
- // Clean up the queue
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&(pCh->pBookmarkWait), &wait);
-
- // if expires == 0 then timer poped, then do not need to del_timer
- if ((timeout > 0) && pCh->BookmarkTimer.expires &&
- time_before(jiffies, pCh->BookmarkTimer.expires)) {
- del_timer( &(pCh->BookmarkTimer) );
- pCh->BookmarkTimer.expires = 0;
-
- ip2trace (CHANN, ITRC_DRAIN, 3, 1, pCh->BookmarkTimer.expires );
-
- }
- ip2trace (CHANN, ITRC_DRAIN, ITRC_RETURN, 1, pCh->BookmarkTimer.expires );
- return;
-}
-
-//******************************************************************************
-// Function: i2OutputFree(pCh)
-// Parameters: Pointer to a channel structure
-// Returns: Space in output buffer
-//
-// Description:
-// Returns -1 if very gross error. Otherwise returns the amount of bytes still
-// free in the output buffer.
-//******************************************************************************
-static int
-i2OutputFree(i2ChanStrPtr pCh)
-{
- int amountToMove;
- unsigned long flags;
-
- // Ensure channel structure seems real
- if ( !i2Validate ( pCh ) ) {
- return -1;
- }
- read_lock_irqsave(&pCh->Obuf_spinlock, flags);
- amountToMove = pCh->Obuf_strip - pCh->Obuf_stuff - 1;
- read_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
-
- if (amountToMove < 0) {
- amountToMove += OBUF_SIZE;
- }
- // If this is negative, we will discover later
- amountToMove -= sizeof(i2DataHeader);
-
- return (amountToMove < 0) ? 0 : amountToMove;
-}
-static void
-
-ip2_owake( PTTY tp)
-{
- i2ChanStrPtr pCh;
-
- if (tp == NULL) return;
-
- pCh = tp->driver_data;
-
- ip2trace (CHANN, ITRC_SICMD, 10, 2, tp->flags,
- (1 << TTY_DO_WRITE_WAKEUP) );
-
- tty_wakeup(tp);
-}
-
-static inline void
-set_baud_params(i2eBordStrPtr pB)
-{
- int i,j;
- i2ChanStrPtr *pCh;
-
- pCh = (i2ChanStrPtr *) pB->i2eChannelPtr;
-
- for (i = 0; i < ABS_MAX_BOXES; i++) {
- if (pB->channelBtypes.bid_value[i]) {
- if (BID_HAS_654(pB->channelBtypes.bid_value[i])) {
- for (j = 0; j < ABS_BIGGEST_BOX; j++) {
- if (pCh[i*16+j] == NULL)
- break;
- (pCh[i*16+j])->BaudBase = 921600; // MAX for ST654
- (pCh[i*16+j])->BaudDivisor = 96;
- }
- } else { // has cirrus cd1400
- for (j = 0; j < ABS_BIGGEST_BOX; j++) {
- if (pCh[i*16+j] == NULL)
- break;
- (pCh[i*16+j])->BaudBase = 115200; // MAX for CD1400
- (pCh[i*16+j])->BaudDivisor = 12;
- }
- }
- }
- }
-}
-
-//******************************************************************************
-// Function: i2StripFifo(pB)
-// Parameters: Pointer to a board structure
-// Returns: ?
-//
-// Description:
-// Strips all the available data from the incoming FIFO, identifies the type of
-// packet, and either buffers the data or does what needs to be done.
-//
-// Note there is no overflow checking here: if the board sends more data than it
-// ought to, we will not detect it here, but blindly overflow...
-//******************************************************************************
-
-// A buffer for reading in blocks for unknown channels
-static unsigned char junkBuffer[IBUF_SIZE];
-
-// A buffer to read in a status packet. Because of the size of the count field
-// for these things, the maximum packet size must be less than MAX_CMD_PACK_SIZE
-static unsigned char cmdBuffer[MAX_CMD_PACK_SIZE + 4];
-
-// This table changes the bit order from MSR order given by STAT_MODEM packet to
-// status bits used in our library.
-static char xlatDss[16] = {
-0 | 0 | 0 | 0 ,
-0 | 0 | 0 | I2_CTS ,
-0 | 0 | I2_DSR | 0 ,
-0 | 0 | I2_DSR | I2_CTS ,
-0 | I2_RI | 0 | 0 ,
-0 | I2_RI | 0 | I2_CTS ,
-0 | I2_RI | I2_DSR | 0 ,
-0 | I2_RI | I2_DSR | I2_CTS ,
-I2_DCD | 0 | 0 | 0 ,
-I2_DCD | 0 | 0 | I2_CTS ,
-I2_DCD | 0 | I2_DSR | 0 ,
-I2_DCD | 0 | I2_DSR | I2_CTS ,
-I2_DCD | I2_RI | 0 | 0 ,
-I2_DCD | I2_RI | 0 | I2_CTS ,
-I2_DCD | I2_RI | I2_DSR | 0 ,
-I2_DCD | I2_RI | I2_DSR | I2_CTS };
-
-static inline void
-i2StripFifo(i2eBordStrPtr pB)
-{
- i2ChanStrPtr pCh;
- int channel;
- int count;
- unsigned short stuffIndex;
- int amountToRead;
- unsigned char *pc, *pcLimit;
- unsigned char uc;
- unsigned char dss_change;
- unsigned long bflags,cflags;
-
-// ip2trace (ITRC_NO_PORT, ITRC_SFIFO, ITRC_ENTER, 0 );
-
- while (I2_HAS_INPUT(pB)) {
-// ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 2, 0 );
-
- // Process packet from fifo a one atomic unit
- write_lock_irqsave(&pB->read_fifo_spinlock, bflags);
-
- // The first word (or two bytes) will have channel number and type of
- // packet, possibly other information
- pB->i2eLeadoffWord[0] = iiReadWord(pB);
-
- switch(PTYPE_OF(pB->i2eLeadoffWord))
- {
- case PTYPE_DATA:
- pB->got_input = 1;
-
-// ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 3, 0 );
-
- channel = CHANNEL_OF(pB->i2eLeadoffWord); /* Store channel */
- count = iiReadWord(pB); /* Count is in the next word */
-
-// NEW: Check the count for sanity! Should the hardware fail, our death
-// is more pleasant. While an oversize channel is acceptable (just more
-// than the driver supports), an over-length count clearly means we are
-// sick!
- if ( ((unsigned int)count) > IBUF_SIZE ) {
- pB->i2eFatal = 2;
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
- return; /* Bail out ASAP */
- }
- // Channel is illegally big ?
- if ((channel >= pB->i2eChannelCnt) ||
- (NULL==(pCh = ((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])))
- {
- iiReadBuf(pB, junkBuffer, count);
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
- break; /* From switch: ready for next packet */
- }
-
- // Channel should be valid, then
-
- // If this is a hot-key, merely post its receipt for now. These are
- // always supposed to be 1-byte packets, so we won't even check the
- // count. Also we will post an acknowledgement to the board so that
- // more data can be forthcoming. Note that we are not trying to use
- // these sequences in this driver, merely to robustly ignore them.
- if(ID_OF(pB->i2eLeadoffWord) == ID_HOT_KEY)
- {
- pCh->hotKeyIn = iiReadWord(pB) & 0xff;
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
- i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_HOTACK);
- break; /* From the switch: ready for next packet */
- }
-
- // Normal data! We crudely assume there is room for the data in our
- // buffer because the board wouldn't have exceeded his credit limit.
- write_lock_irqsave(&pCh->Ibuf_spinlock, cflags);
- // We have 2 locks now
- stuffIndex = pCh->Ibuf_stuff;
- amountToRead = IBUF_SIZE - stuffIndex;
- if (amountToRead > count)
- amountToRead = count;
-
- // stuffIndex would have been already adjusted so there would
- // always be room for at least one, and count is always at least
- // one.
-
- iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead);
- pCh->icount.rx += amountToRead;
-
- // Update the stuffIndex by the amount of data moved. Note we could
- // never ask for more data than would just fit. However, we might
- // have read in one more byte than we wanted because the read
- // rounds up to even bytes. If this byte is on the end of the
- // packet, and is padding, we ignore it. If the byte is part of
- // the actual data, we need to move it.
-
- stuffIndex += amountToRead;
-
- if (stuffIndex >= IBUF_SIZE) {
- if ((amountToRead & 1) && (count > amountToRead)) {
- pCh->Ibuf[0] = pCh->Ibuf[IBUF_SIZE];
- amountToRead++;
- stuffIndex = 1;
- } else {
- stuffIndex = 0;
- }
- }
-
- // If there is anything left over, read it as well
- if (count > amountToRead) {
- amountToRead = count - amountToRead;
- iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead);
- pCh->icount.rx += amountToRead;
- stuffIndex += amountToRead;
- }
-
- // Update stuff index
- pCh->Ibuf_stuff = stuffIndex;
- write_unlock_irqrestore(&pCh->Ibuf_spinlock, cflags);
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
-
-#ifdef USE_IQ
- schedule_work(&pCh->tqueue_input);
-#else
- do_input(&pCh->tqueue_input);
-#endif
-
- // Note we do not need to maintain any flow-control credits at this
- // time: if we were to increment .asof and decrement .room, there
- // would be no net effect. Instead, when we strip data, we will
- // increment .asof and leave .room unchanged.
-
- break; // From switch: ready for next packet
-
- case PTYPE_STATUS:
- ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 4, 0 );
-
- count = CMD_COUNT_OF(pB->i2eLeadoffWord);
-
- iiReadBuf(pB, cmdBuffer, count);
- // We can release early with buffer grab
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
-
- pc = cmdBuffer;
- pcLimit = &(cmdBuffer[count]);
-
- while (pc < pcLimit) {
- channel = *pc++;
-
- ip2trace (channel, ITRC_SFIFO, 7, 2, channel, *pc );
-
- /* check for valid channel */
- if (channel < pB->i2eChannelCnt
- &&
- (pCh = (((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])) != NULL
- )
- {
- dss_change = 0;
-
- switch (uc = *pc++)
- {
- /* Breaks and modem signals are easy: just update status */
- case STAT_CTS_UP:
- if ( !(pCh->dataSetIn & I2_CTS) )
- {
- pCh->dataSetIn |= I2_DCTS;
- pCh->icount.cts++;
- dss_change = 1;
- }
- pCh->dataSetIn |= I2_CTS;
- break;
-
- case STAT_CTS_DN:
- if ( pCh->dataSetIn & I2_CTS )
- {
- pCh->dataSetIn |= I2_DCTS;
- pCh->icount.cts++;
- dss_change = 1;
- }
- pCh->dataSetIn &= ~I2_CTS;
- break;
-
- case STAT_DCD_UP:
- ip2trace (channel, ITRC_MODEM, 1, 1, pCh->dataSetIn );
-
- if ( !(pCh->dataSetIn & I2_DCD) )
- {
- ip2trace (CHANN, ITRC_MODEM, 2, 0 );
- pCh->dataSetIn |= I2_DDCD;
- pCh->icount.dcd++;
- dss_change = 1;
- }
- pCh->dataSetIn |= I2_DCD;
-
- ip2trace (channel, ITRC_MODEM, 3, 1, pCh->dataSetIn );
- break;
-
- case STAT_DCD_DN:
- ip2trace (channel, ITRC_MODEM, 4, 1, pCh->dataSetIn );
- if ( pCh->dataSetIn & I2_DCD )
- {
- ip2trace (channel, ITRC_MODEM, 5, 0 );
- pCh->dataSetIn |= I2_DDCD;
- pCh->icount.dcd++;
- dss_change = 1;
- }
- pCh->dataSetIn &= ~I2_DCD;
-
- ip2trace (channel, ITRC_MODEM, 6, 1, pCh->dataSetIn );
- break;
-
- case STAT_DSR_UP:
- if ( !(pCh->dataSetIn & I2_DSR) )
- {
- pCh->dataSetIn |= I2_DDSR;
- pCh->icount.dsr++;
- dss_change = 1;
- }
- pCh->dataSetIn |= I2_DSR;
- break;
-
- case STAT_DSR_DN:
- if ( pCh->dataSetIn & I2_DSR )
- {
- pCh->dataSetIn |= I2_DDSR;
- pCh->icount.dsr++;
- dss_change = 1;
- }
- pCh->dataSetIn &= ~I2_DSR;
- break;
-
- case STAT_RI_UP:
- if ( !(pCh->dataSetIn & I2_RI) )
- {
- pCh->dataSetIn |= I2_DRI;
- pCh->icount.rng++;
- dss_change = 1;
- }
- pCh->dataSetIn |= I2_RI ;
- break;
-
- case STAT_RI_DN:
- // to be compat with serial.c
- //if ( pCh->dataSetIn & I2_RI )
- //{
- // pCh->dataSetIn |= I2_DRI;
- // pCh->icount.rng++;
- // dss_change = 1;
- //}
- pCh->dataSetIn &= ~I2_RI ;
- break;
-
- case STAT_BRK_DET:
- pCh->dataSetIn |= I2_BRK;
- pCh->icount.brk++;
- dss_change = 1;
- break;
-
- // Bookmarks? one less request we're waiting for
- case STAT_BMARK:
- pCh->bookMarks--;
- if (pCh->bookMarks <= 0 ) {
- pCh->bookMarks = 0;
- wake_up_interruptible( &pCh->pBookmarkWait );
-
- ip2trace (channel, ITRC_DRAIN, 20, 1, pCh->BookmarkTimer.expires );
- }
- break;
-
- // Flow control packets? Update the new credits, and if
- // someone was waiting for output, queue him up again.
- case STAT_FLOW:
- pCh->outfl.room =
- ((flowStatPtr)pc)->room -
- (pCh->outfl.asof - ((flowStatPtr)pc)->asof);
-
- ip2trace (channel, ITRC_STFLW, 1, 1, pCh->outfl.room );
-
- if (pCh->channelNeeds & NEED_CREDIT)
- {
- ip2trace (channel, ITRC_STFLW, 2, 1, pCh->channelNeeds);
-
- pCh->channelNeeds &= ~NEED_CREDIT;
- i2QueueNeeds(pB, pCh, NEED_INLINE);
- if ( pCh->pTTY )
- ip2_owake(pCh->pTTY);
- }
-
- ip2trace (channel, ITRC_STFLW, 3, 1, pCh->channelNeeds);
-
- pc += sizeof(flowStat);
- break;
-
- /* Special packets: */
- /* Just copy the information into the channel structure */
-
- case STAT_STATUS:
-
- pCh->channelStatus = *((debugStatPtr)pc);
- pc += sizeof(debugStat);
- break;
-
- case STAT_TXCNT:
-
- pCh->channelTcount = *((cntStatPtr)pc);
- pc += sizeof(cntStat);
- break;
-
- case STAT_RXCNT:
-
- pCh->channelRcount = *((cntStatPtr)pc);
- pc += sizeof(cntStat);
- break;
-
- case STAT_BOXIDS:
- pB->channelBtypes = *((bidStatPtr)pc);
- pc += sizeof(bidStat);
- set_baud_params(pB);
- break;
-
- case STAT_HWFAIL:
- i2QueueCommands (PTYPE_INLINE, pCh, 0, 1, CMD_HW_TEST);
- pCh->channelFail = *((failStatPtr)pc);
- pc += sizeof(failStat);
- break;
-
- /* No explicit match? then
- * Might be an error packet...
- */
- default:
- switch (uc & STAT_MOD_ERROR)
- {
- case STAT_ERROR:
- if (uc & STAT_E_PARITY) {
- pCh->dataSetIn |= I2_PAR;
- pCh->icount.parity++;
- }
- if (uc & STAT_E_FRAMING){
- pCh->dataSetIn |= I2_FRA;
- pCh->icount.frame++;
- }
- if (uc & STAT_E_OVERRUN){
- pCh->dataSetIn |= I2_OVR;
- pCh->icount.overrun++;
- }
- break;
-
- case STAT_MODEM:
- // the answer to DSS_NOW request (not change)
- pCh->dataSetIn = (pCh->dataSetIn
- & ~(I2_RI | I2_CTS | I2_DCD | I2_DSR) )
- | xlatDss[uc & 0xf];
- wake_up_interruptible ( &pCh->dss_now_wait );
- default:
- break;
- }
- } /* End of switch on status type */
- if (dss_change) {
-#ifdef USE_IQ
- schedule_work(&pCh->tqueue_status);
-#else
- do_status(&pCh->tqueue_status);
-#endif
- }
- }
- else /* Or else, channel is invalid */
- {
- // Even though the channel is invalid, we must test the
- // status to see how much additional data it has (to be
- // skipped)
- switch (*pc++)
- {
- case STAT_FLOW:
- pc += 4; /* Skip the data */
- break;
-
- default:
- break;
- }
- }
- } // End of while (there is still some status packet left)
- break;
-
- default: // Neither packet? should be impossible
- ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 5, 1,
- PTYPE_OF(pB->i2eLeadoffWord) );
- write_unlock_irqrestore(&pB->read_fifo_spinlock,
- bflags);
-
- break;
- } // End of switch on type of packets
- } /*while(board I2_HAS_INPUT)*/
-
- ip2trace (ITRC_NO_PORT, ITRC_SFIFO, ITRC_RETURN, 0 );
-
- // Send acknowledgement to the board even if there was no data!
- pB->i2eOutMailWaiting |= MB_IN_STRIPPED;
- return;
-}
-
-//******************************************************************************
-// Function: i2Write2Fifo(pB,address,count)
-// Parameters: Pointer to a board structure, source address, byte count
-// Returns: bytes written
-//
-// Description:
-// Writes count bytes to board io address(implied) from source
-// Adjusts count, leaves reserve for next time around bypass cmds
-//******************************************************************************
-static int
-i2Write2Fifo(i2eBordStrPtr pB, unsigned char *source, int count,int reserve)
-{
- int rc = 0;
- unsigned long flags;
- write_lock_irqsave(&pB->write_fifo_spinlock, flags);
- if (!pB->i2eWaitingForEmptyFifo) {
- if (pB->i2eFifoRemains > (count+reserve)) {
- pB->i2eFifoRemains -= count;
- iiWriteBuf(pB, source, count);
- pB->i2eOutMailWaiting |= MB_OUT_STUFFED;
- rc = count;
- }
- }
- write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
- return rc;
-}
-//******************************************************************************
-// Function: i2StuffFifoBypass(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// Stuffs as many bypass commands into the fifo as possible. This is simpler
-// than stuffing data or inline commands to fifo, since we do not have
-// flow-control to deal with.
-//******************************************************************************
-static inline void
-i2StuffFifoBypass(i2eBordStrPtr pB)
-{
- i2ChanStrPtr pCh;
- unsigned char *pRemove;
- unsigned short stripIndex;
- unsigned short packetSize;
- unsigned short paddedSize;
- unsigned short notClogged = 1;
- unsigned long flags;
-
- int bailout = 1000;
-
- // Continue processing so long as there are entries, or there is room in the
- // fifo. Each entry represents a channel with something to do.
- while ( --bailout && notClogged &&
- (NULL != (pCh = i2DeQueueNeeds(pB,NEED_BYPASS))))
- {
- write_lock_irqsave(&pCh->Cbuf_spinlock, flags);
- stripIndex = pCh->Cbuf_strip;
-
- // as long as there are packets for this channel...
-
- while (stripIndex != pCh->Cbuf_stuff) {
- pRemove = &(pCh->Cbuf[stripIndex]);
- packetSize = CMD_COUNT_OF(pRemove) + sizeof(i2CmdHeader);
- paddedSize = roundup(packetSize, 2);
-
- if (paddedSize > 0) {
- if ( 0 == i2Write2Fifo(pB, pRemove, paddedSize,0)) {
- notClogged = 0; /* fifo full */
- i2QueueNeeds(pB, pCh, NEED_BYPASS); // Put back on queue
- break; // Break from the channel
- }
- }
-#ifdef DEBUG_FIFO
-WriteDBGBuf("BYPS", pRemove, paddedSize);
-#endif /* DEBUG_FIFO */
- pB->debugBypassCount++;
-
- pRemove += packetSize;
- stripIndex += packetSize;
- if (stripIndex >= CBUF_SIZE) {
- stripIndex = 0;
- pRemove = pCh->Cbuf;
- }
- }
- // Done with this channel. Move to next, removing this one from
- // the queue of channels if we cleaned it out (i.e., didn't get clogged.
- pCh->Cbuf_strip = stripIndex;
- write_unlock_irqrestore(&pCh->Cbuf_spinlock, flags);
- } // Either clogged or finished all the work
-
-#ifdef IP2DEBUG_TRACE
- if ( !bailout ) {
- ip2trace (ITRC_NO_PORT, ITRC_ERROR, 1, 0 );
- }
-#endif
-}
-
-//******************************************************************************
-// Function: i2StuffFifoFlow(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// Stuffs as many flow control packets into the fifo as possible. This is easier
-// even than doing normal bypass commands, because there is always at most one
-// packet, already assembled, for each channel.
-//******************************************************************************
-static inline void
-i2StuffFifoFlow(i2eBordStrPtr pB)
-{
- i2ChanStrPtr pCh;
- unsigned short paddedSize = roundup(sizeof(flowIn), 2);
-
- ip2trace (ITRC_NO_PORT, ITRC_SFLOW, ITRC_ENTER, 2,
- pB->i2eFifoRemains, paddedSize );
-
- // Continue processing so long as there are entries, or there is room in the
- // fifo. Each entry represents a channel with something to do.
- while ( (NULL != (pCh = i2DeQueueNeeds(pB,NEED_FLOW)))) {
- pB->debugFlowCount++;
-
- // NO Chan LOCK needed ???
- if ( 0 == i2Write2Fifo(pB,(unsigned char *)&(pCh->infl),paddedSize,0)) {
- break;
- }
-#ifdef DEBUG_FIFO
- WriteDBGBuf("FLOW",(unsigned char *) &(pCh->infl), paddedSize);
-#endif /* DEBUG_FIFO */
-
- } // Either clogged or finished all the work
-
- ip2trace (ITRC_NO_PORT, ITRC_SFLOW, ITRC_RETURN, 0 );
-}
-
-//******************************************************************************
-// Function: i2StuffFifoInline(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// Stuffs as much data and inline commands into the fifo as possible. This is
-// the most complex fifo-stuffing operation, since there if now the channel
-// flow-control issue to deal with.
-//******************************************************************************
-static inline void
-i2StuffFifoInline(i2eBordStrPtr pB)
-{
- i2ChanStrPtr pCh;
- unsigned char *pRemove;
- unsigned short stripIndex;
- unsigned short packetSize;
- unsigned short paddedSize;
- unsigned short notClogged = 1;
- unsigned short flowsize;
- unsigned long flags;
-
- int bailout = 1000;
- int bailout2;
-
- ip2trace (ITRC_NO_PORT, ITRC_SICMD, ITRC_ENTER, 3, pB->i2eFifoRemains,
- pB->i2Dbuf_strip, pB->i2Dbuf_stuff );
-
- // Continue processing so long as there are entries, or there is room in the
- // fifo. Each entry represents a channel with something to do.
- while ( --bailout && notClogged &&
- (NULL != (pCh = i2DeQueueNeeds(pB,NEED_INLINE))) )
- {
- write_lock_irqsave(&pCh->Obuf_spinlock, flags);
- stripIndex = pCh->Obuf_strip;
-
- ip2trace (CHANN, ITRC_SICMD, 3, 2, stripIndex, pCh->Obuf_stuff );
-
- // as long as there are packets for this channel...
- bailout2 = 1000;
- while ( --bailout2 && stripIndex != pCh->Obuf_stuff) {
- pRemove = &(pCh->Obuf[stripIndex]);
-
- // Must determine whether this be a data or command packet to
- // calculate correctly the header size and the amount of
- // flow-control credit this type of packet will use.
- if (PTYPE_OF(pRemove) == PTYPE_DATA) {
- flowsize = DATA_COUNT_OF(pRemove);
- packetSize = flowsize + sizeof(i2DataHeader);
- } else {
- flowsize = CMD_COUNT_OF(pRemove);
- packetSize = flowsize + sizeof(i2CmdHeader);
- }
- flowsize = CREDIT_USAGE(flowsize);
- paddedSize = roundup(packetSize, 2);
-
- ip2trace (CHANN, ITRC_SICMD, 4, 2, pB->i2eFifoRemains, paddedSize );
-
- // If we don't have enough credits from the board to send the data,
- // flag the channel that we are waiting for flow control credit, and
- // break out. This will clean up this channel and remove us from the
- // queue of hot things to do.
-
- ip2trace (CHANN, ITRC_SICMD, 5, 2, pCh->outfl.room, flowsize );
-
- if (pCh->outfl.room <= flowsize) {
- // Do Not have the credits to send this packet.
- i2QueueNeeds(pB, pCh, NEED_CREDIT);
- notClogged = 0;
- break; // So to do next channel
- }
- if ( (paddedSize > 0)
- && ( 0 == i2Write2Fifo(pB, pRemove, paddedSize, 128))) {
- // Do Not have room in fifo to send this packet.
- notClogged = 0;
- i2QueueNeeds(pB, pCh, NEED_INLINE);
- break; // Break from the channel
- }
-#ifdef DEBUG_FIFO
-WriteDBGBuf("DATA", pRemove, paddedSize);
-#endif /* DEBUG_FIFO */
- pB->debugInlineCount++;
-
- pCh->icount.tx += flowsize;
- // Update current credits
- pCh->outfl.room -= flowsize;
- pCh->outfl.asof += flowsize;
- if (PTYPE_OF(pRemove) == PTYPE_DATA) {
- pCh->Obuf_char_count -= DATA_COUNT_OF(pRemove);
- }
- pRemove += packetSize;
- stripIndex += packetSize;
-
- ip2trace (CHANN, ITRC_SICMD, 6, 2, stripIndex, pCh->Obuf_strip);
-
- if (stripIndex >= OBUF_SIZE) {
- stripIndex = 0;
- pRemove = pCh->Obuf;
-
- ip2trace (CHANN, ITRC_SICMD, 7, 1, stripIndex );
-
- }
- } /* while */
- if ( !bailout2 ) {
- ip2trace (CHANN, ITRC_ERROR, 3, 0 );
- }
- // Done with this channel. Move to next, removing this one from the
- // queue of channels if we cleaned it out (i.e., didn't get clogged.
- pCh->Obuf_strip = stripIndex;
- write_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
- if ( notClogged )
- {
-
- ip2trace (CHANN, ITRC_SICMD, 8, 0 );
-
- if ( pCh->pTTY ) {
- ip2_owake(pCh->pTTY);
- }
- }
- } // Either clogged or finished all the work
-
- if ( !bailout ) {
- ip2trace (ITRC_NO_PORT, ITRC_ERROR, 4, 0 );
- }
-
- ip2trace (ITRC_NO_PORT, ITRC_SICMD, ITRC_RETURN, 1,pB->i2Dbuf_strip);
-}
-
-//******************************************************************************
-// Function: serviceOutgoingFifo(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// Helper routine to put data in the outgoing fifo, if we aren't already waiting
-// for something to be there. If the fifo has only room for a very little data,
-// go head and hit the board with a mailbox hit immediately. Otherwise, it will
-// have to happen later in the interrupt processing. Since this routine may be
-// called both at interrupt and foreground time, we must turn off interrupts
-// during the entire process.
-//******************************************************************************
-static void
-serviceOutgoingFifo(i2eBordStrPtr pB)
-{
- // If we aren't currently waiting for the board to empty our fifo, service
- // everything that is pending, in priority order (especially, Bypass before
- // Inline).
- if ( ! pB->i2eWaitingForEmptyFifo )
- {
- i2StuffFifoFlow(pB);
- i2StuffFifoBypass(pB);
- i2StuffFifoInline(pB);
-
- iiSendPendingMail(pB);
- }
-}
-
-//******************************************************************************
-// Function: i2ServiceBoard(pB)
-// Parameters: Pointer to a board structure
-// Returns: Nothing
-//
-// Description:
-// Normally this is called from interrupt level, but there is deliberately
-// nothing in here specific to being called from interrupt level. All the
-// hardware-specific, interrupt-specific things happen at the outer levels.
-//
-// For example, a timer interrupt could drive this routine for some sort of
-// polled operation. The only requirement is that the programmer deal with any
-// atomiticity/concurrency issues that result.
-//
-// This routine responds to the board's having sent mailbox information to the
-// host (which would normally cause an interrupt). This routine reads the
-// incoming mailbox. If there is no data in it, this board did not create the
-// interrupt and/or has nothing to be done to it. (Except, if we have been
-// waiting to write mailbox data to it, we may do so.
-//
-// Based on the value in the mailbox, we may take various actions.
-//
-// No checking here of pB validity: after all, it shouldn't have been called by
-// the handler unless pB were on the list.
-//******************************************************************************
-static inline int
-i2ServiceBoard ( i2eBordStrPtr pB )
-{
- unsigned inmail;
- unsigned long flags;
-
-
- /* This should be atomic because of the way we are called... */
- if (NO_MAIL_HERE == ( inmail = pB->i2eStartMail ) ) {
- inmail = iiGetMail(pB);
- }
- pB->i2eStartMail = NO_MAIL_HERE;
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, 2, 1, inmail );
-
- if (inmail != NO_MAIL_HERE) {
- // If the board has gone fatal, nothing to do but hit a bit that will
- // alert foreground tasks to protest!
- if ( inmail & MB_FATAL_ERROR ) {
- pB->i2eFatal = 1;
- goto exit_i2ServiceBoard;
- }
-
- /* Assuming no fatal condition, we proceed to do work */
- if ( inmail & MB_IN_STUFFED ) {
- pB->i2eFifoInInts++;
- i2StripFifo(pB); /* There might be incoming packets */
- }
-
- if (inmail & MB_OUT_STRIPPED) {
- pB->i2eFifoOutInts++;
- write_lock_irqsave(&pB->write_fifo_spinlock, flags);
- pB->i2eFifoRemains = pB->i2eFifoSize;
- pB->i2eWaitingForEmptyFifo = 0;
- write_unlock_irqrestore(&pB->write_fifo_spinlock,
- flags);
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, 30, 1, pB->i2eFifoRemains );
-
- }
- serviceOutgoingFifo(pB);
- }
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, 8, 0 );
-
-exit_i2ServiceBoard:
-
- return 0;
-}
diff --git a/drivers/char/ip2/i2lib.h b/drivers/char/ip2/i2lib.h
deleted file mode 100644
index e559e9bac06d..000000000000
--- a/drivers/char/ip2/i2lib.h
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Header file for high level library functions
-*
-*******************************************************************************/
-#ifndef I2LIB_H
-#define I2LIB_H 1
-//------------------------------------------------------------------------------
-// I2LIB.H
-//
-// IntelliPort-II and IntelliPort-IIEX
-//
-// Defines, structure definitions, and external declarations for i2lib.c
-//------------------------------------------------------------------------------
-//--------------------------------------
-// Mandatory Includes:
-//--------------------------------------
-#include "ip2types.h"
-#include "i2ellis.h"
-#include "i2pack.h"
-#include "i2cmd.h"
-#include <linux/workqueue.h>
-
-//------------------------------------------------------------------------------
-// i2ChanStr -- Channel Structure:
-// Used to track per-channel information for the library routines using standard
-// loadware. Note also, a pointer to an array of these structures is patched
-// into the i2eBordStr (see i2ellis.h)
-//------------------------------------------------------------------------------
-//
-// If we make some limits on the maximum block sizes, we can avoid dealing with
-// buffer wrap. The wrapping of the buffer is based on where the start of the
-// packet is. Then there is always room for the packet contiguously.
-//
-// Maximum total length of an outgoing data or in-line command block. The limit
-// of 36 on data is quite arbitrary and based more on DOS memory limitations
-// than the board interface. However, for commands, the maximum packet length is
-// MAX_CMD_PACK_SIZE, because the field size for the count is only a few bits
-// (see I2PACK.H) in such packets. For data packets, the count field size is not
-// the limiting factor. As of this writing, MAX_OBUF_BLOCK < MAX_CMD_PACK_SIZE,
-// but be careful if wanting to modify either.
-//
-#define MAX_OBUF_BLOCK 36
-
-// Another note on maximum block sizes: we are buffering packets here. Data is
-// put into the buffer (if there is room) regardless of the credits from the
-// board. The board sends new credits whenever it has removed from his buffers a
-// number of characters equal to 80% of total buffer size. (Of course, the total
-// buffer size is what is reported when the very first set of flow control
-// status packets are received from the board. Therefore, to be robust, you must
-// always fill the board to at least 80% of the current credit limit, else you
-// might not give it enough to trigger a new report. These conditions are
-// obtained here so long as the maximum output block size is less than 20% the
-// size of the board's output buffers. This is true at present by "coincidence"
-// or "infernal knowledge": the board's output buffers are at least 700 bytes
-// long (20% = 140 bytes, at least). The 80% figure is "official", so the safest
-// strategy might be to trap the first flow control report and guarantee that
-// the effective maxObufBlock is the minimum of MAX_OBUF_BLOCK and 20% of first
-// reported buffer credit.
-//
-#define MAX_CBUF_BLOCK 6 // Maximum total length of a bypass command block
-
-#define IBUF_SIZE 512 // character capacity of input buffer per channel
-#define OBUF_SIZE 1024// character capacity of output buffer per channel
-#define CBUF_SIZE 10 // character capacity of output bypass buffer
-
-typedef struct _i2ChanStr
-{
- // First, back-pointers so that given a pointer to this structure, you can
- // determine the correct board and channel number to reference, (say, when
- // issuing commands, etc. (Note, channel number is in infl.hd.i2sChannel.)
-
- int port_index; // Index of port in channel structure array attached
- // to board structure.
- PTTY pTTY; // Pointer to tty structure for port (OS specific)
- USHORT validity; // Indicates whether the given channel has been
- // initialized, really exists (or is a missing
- // channel, e.g. channel 9 on an 8-port box.)
-
- i2eBordStrPtr pMyBord; // Back-pointer to this channel's board structure
-
- int wopen; // waiting fer carrier
-
- int throttled; // Set if upper layer can take no data
-
- int flags; // Defined in tty.h
-
- PWAITQ open_wait; // Pointer for OS sleep function.
- PWAITQ close_wait; // Pointer for OS sleep function.
- PWAITQ delta_msr_wait;// Pointer for OS sleep function.
- PWAITQ dss_now_wait; // Pointer for OS sleep function.
-
- struct timer_list BookmarkTimer; // Used by i2DrainOutput
- wait_queue_head_t pBookmarkWait; // Used by i2DrainOutput
-
- int BaudBase;
- int BaudDivisor;
-
- USHORT ClosingDelay;
- USHORT ClosingWaitTime;
-
- volatile
- flowIn infl; // This structure is initialized as a completely
- // formed flow-control command packet, and as such
- // has the channel number, also the capacity and
- // "as-of" data needed continuously.
-
- USHORT sinceLastFlow; // Counts the number of characters read from input
- // buffers, since the last time flow control info
- // was sent.
-
- USHORT whenSendFlow; // Determines when new flow control is to be sent to
- // the board. Note unlike earlier manifestations of
- // the driver, these packets can be sent from
- // in-place.
-
- USHORT channelNeeds; // Bit map of important things which must be done
- // for this channel. (See bits below )
-
- volatile
- flowStat outfl; // Same type of structure is used to hold current
- // flow control information used to control our
- // output. "asof" is kept updated as data is sent,
- // and "room" never goes to zero.
-
- // The incoming ring buffer
- // Unlike the outgoing buffers, this holds raw data, not packets. The two
- // extra bytes are used to hold the byte-padding when there is room for an
- // odd number of bytes before we must wrap.
- //
- UCHAR Ibuf[IBUF_SIZE + 2];
- volatile
- USHORT Ibuf_stuff; // Stuffing index
- volatile
- USHORT Ibuf_strip; // Stripping index
-
- // The outgoing ring-buffer: Holds Data and command packets. N.B., even
- // though these are in the channel structure, the channel is also written
- // here, the easier to send it to the fifo when ready. HOWEVER, individual
- // packets here are NOT padded to even length: the routines for writing
- // blocks to the fifo will pad to even byte counts.
- //
- UCHAR Obuf[OBUF_SIZE+MAX_OBUF_BLOCK+4];
- volatile
- USHORT Obuf_stuff; // Stuffing index
- volatile
- USHORT Obuf_strip; // Stripping index
- int Obuf_char_count;
-
- // The outgoing bypass-command buffer. Unlike earlier manifestations, the
- // flow control packets are sent directly from the structures. As above, the
- // channel number is included in the packet, but they are NOT padded to even
- // size.
- //
- UCHAR Cbuf[CBUF_SIZE+MAX_CBUF_BLOCK+2];
- volatile
- USHORT Cbuf_stuff; // Stuffing index
- volatile
- USHORT Cbuf_strip; // Stripping index
-
- // The temporary buffer for the Linux tty driver PutChar entry.
- //
- UCHAR Pbuf[MAX_OBUF_BLOCK - sizeof (i2DataHeader)];
- volatile
- USHORT Pbuf_stuff; // Stuffing index
-
- // The state of incoming data-set signals
- //
- USHORT dataSetIn; // Bit-mapped according to below. Also indicates
- // whether a break has been detected since last
- // inquiry.
-
- // The state of outcoming data-set signals (as far as we can tell!)
- //
- USHORT dataSetOut; // Bit-mapped according to below.
-
- // Most recent hot-key identifier detected
- //
- USHORT hotKeyIn; // Hot key as sent by the board, HOT_CLEAR indicates
- // no hot key detected since last examined.
-
- // Counter of outstanding requests for bookmarks
- //
- short bookMarks; // Number of outstanding bookmark requests, (+ive
- // whenever a bookmark request if queued up, -ive
- // whenever a bookmark is received).
-
- // Misc options
- //
- USHORT channelOptions; // See below
-
- // To store various incoming special packets
- //
- debugStat channelStatus;
- cntStat channelRcount;
- cntStat channelTcount;
- failStat channelFail;
-
- // To store the last values for line characteristics we sent to the board.
- //
- int speed;
-
- int flush_flags;
-
- void (*trace)(unsigned short,unsigned char,unsigned char,unsigned long,...);
-
- /*
- * Kernel counters for the 4 input interrupts
- */
- struct async_icount icount;
-
- /*
- * Task queues for processing input packets from the board.
- */
- struct work_struct tqueue_input;
- struct work_struct tqueue_status;
- struct work_struct tqueue_hangup;
-
- rwlock_t Ibuf_spinlock;
- rwlock_t Obuf_spinlock;
- rwlock_t Cbuf_spinlock;
- rwlock_t Pbuf_spinlock;
-
-} i2ChanStr, *i2ChanStrPtr;
-
-//---------------------------------------------------
-// Manifests and bit-maps for elements in i2ChanStr
-//---------------------------------------------------
-//
-// flush flags
-//
-#define STARTFL_FLAG 1
-#define STOPFL_FLAG 2
-
-// validity
-//
-#define CHANNEL_MAGIC_BITS 0xff00
-#define CHANNEL_MAGIC 0x5300 // (validity & CHANNEL_MAGIC_BITS) ==
- // CHANNEL_MAGIC --> structure good
-
-#define CHANNEL_SUPPORT 0x0001 // Indicates channel is supported, exists,
- // and passed P.O.S.T.
-
-// channelNeeds
-//
-#define NEED_FLOW 1 // Indicates flow control has been queued
-#define NEED_INLINE 2 // Indicates inline commands or data queued
-#define NEED_BYPASS 4 // Indicates bypass commands queued
-#define NEED_CREDIT 8 // Indicates would be sending except has not sufficient
- // credit. The data is still in the channel structure,
- // but the channel is not enqueued in the board
- // structure again until there is a credit received from
- // the board.
-
-// dataSetIn (Also the bits for i2GetStatus return value)
-//
-#define I2_DCD 1
-#define I2_CTS 2
-#define I2_DSR 4
-#define I2_RI 8
-
-// dataSetOut (Also the bits for i2GetStatus return value)
-//
-#define I2_DTR 1
-#define I2_RTS 2
-
-// i2GetStatus() can optionally clear these bits
-//
-#define I2_BRK 0x10 // A break was detected
-#define I2_PAR 0x20 // A parity error was received
-#define I2_FRA 0x40 // A framing error was received
-#define I2_OVR 0x80 // An overrun error was received
-
-// i2GetStatus() automatically clears these bits */
-//
-#define I2_DDCD 0x100 // DCD changed from its former value
-#define I2_DCTS 0x200 // CTS changed from its former value
-#define I2_DDSR 0x400 // DSR changed from its former value
-#define I2_DRI 0x800 // RI changed from its former value
-
-// hotKeyIn
-//
-#define HOT_CLEAR 0x1322 // Indicates that no hot-key has been detected
-
-// channelOptions
-//
-#define CO_NBLOCK_WRITE 1 // Writes don't block waiting for buffer. (Default
- // is, they do wait.)
-
-// fcmodes
-//
-#define I2_OUTFLOW_CTS 0x0001
-#define I2_INFLOW_RTS 0x0002
-#define I2_INFLOW_DSR 0x0004
-#define I2_INFLOW_DTR 0x0008
-#define I2_OUTFLOW_DSR 0x0010
-#define I2_OUTFLOW_DTR 0x0020
-#define I2_OUTFLOW_XON 0x0040
-#define I2_OUTFLOW_XANY 0x0080
-#define I2_INFLOW_XON 0x0100
-
-#define I2_CRTSCTS (I2_OUTFLOW_CTS|I2_INFLOW_RTS)
-#define I2_IXANY_MODE (I2_OUTFLOW_XON|I2_OUTFLOW_XANY)
-
-//-------------------------------------------
-// Macros used from user level like functions
-//-------------------------------------------
-
-// Macros to set and clear channel options
-//
-#define i2SetOption(pCh, option) pCh->channelOptions |= option
-#define i2ClrOption(pCh, option) pCh->channelOptions &= ~option
-
-// Macro to set fatal-error trap
-//
-#define i2SetFatalTrap(pB, routine) pB->i2eFatalTrap = routine
-
-//--------------------------------------------
-// Declarations and prototypes for i2lib.c
-//--------------------------------------------
-//
-static int i2InitChannels(i2eBordStrPtr, int, i2ChanStrPtr);
-static int i2QueueCommands(int, i2ChanStrPtr, int, int, cmdSyntaxPtr,...);
-static int i2GetStatus(i2ChanStrPtr, int);
-static int i2Input(i2ChanStrPtr);
-static int i2InputFlush(i2ChanStrPtr);
-static int i2Output(i2ChanStrPtr, const char *, int);
-static int i2OutputFree(i2ChanStrPtr);
-static int i2ServiceBoard(i2eBordStrPtr);
-static void i2DrainOutput(i2ChanStrPtr, int);
-
-#ifdef IP2DEBUG_TRACE
-void ip2trace(unsigned short,unsigned char,unsigned char,unsigned long,...);
-#else
-#define ip2trace(a,b,c,d...) do {} while (0)
-#endif
-
-// Argument to i2QueueCommands
-//
-#define C_IN_LINE 1
-#define C_BYPASS 0
-
-#endif // I2LIB_H
diff --git a/drivers/char/ip2/i2pack.h b/drivers/char/ip2/i2pack.h
deleted file mode 100644
index 00342a677c90..000000000000
--- a/drivers/char/ip2/i2pack.h
+++ /dev/null
@@ -1,364 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Definitions of the packets used to transfer data and commands
-* Host <--> Board. Information provided here is only applicable
-* when the standard loadware is active.
-*
-*******************************************************************************/
-#ifndef I2PACK_H
-#define I2PACK_H 1
-
-//-----------------------------------------------
-// Revision History:
-//
-// 10 October 1991 MAG First draft
-// 24 February 1992 MAG Additions for 1.4.x loadware
-// 11 March 1992 MAG New status packets
-//
-//-----------------------------------------------
-
-//------------------------------------------------------------------------------
-// Packet Formats:
-//
-// Information passes between the host and board through the FIFO in packets.
-// These have headers which indicate the type of packet. Because the fifo data
-// path may be 16-bits wide, the protocol is constrained such that each packet
-// is always padded to an even byte count. (The lower-level interface routines
-// -- i2ellis.c -- are designed to do this).
-//
-// The sender (be it host or board) must place some number of complete packets
-// in the fifo, then place a message in the mailbox that packets are available.
-// Placing such a message interrupts the "receiver" (be it board or host), who
-// reads the mailbox message and determines that there are incoming packets
-// ready. Since there are no partial packets, and the length of a packet is
-// given in the header, the remainder of the packet can be read without checking
-// for FIFO empty condition. The process is repeated, packet by packet, until
-// the incoming FIFO is empty. Then the receiver uses the outbound mailbox to
-// signal the board that it has read the data. Only then can the sender place
-// additional data in the fifo.
-//------------------------------------------------------------------------------
-//
-//------------------------------------------------
-// Definition of Packet Header Area
-//------------------------------------------------
-//
-// Caution: these only define header areas. In actual use the data runs off
-// beyond the end of these structures.
-//
-// Since these structures are based on sequences of bytes which go to the board,
-// there cannot be ANY padding between the elements.
-#pragma pack(1)
-
-//----------------------------
-// DATA PACKETS
-//----------------------------
-
-typedef struct _i2DataHeader
-{
- unsigned char i2sChannel; /* The channel number: 0-255 */
-
- // -- Bitfields are allocated LSB first --
-
- // For incoming data, indicates whether this is an ordinary packet or a
- // special one (e.g., hot key hit).
- unsigned i2sId : 2 __attribute__ ((__packed__));
-
- // For tagging data packets. There are flush commands which flush only data
- // packets bearing a particular tag. (used in implementing IntelliView and
- // IntelliPrint). THE TAG VALUE 0xf is RESERVED and must not be used (it has
- // meaning internally to the loadware).
- unsigned i2sTag : 4;
-
- // These two bits determine the type of packet sent/received.
- unsigned i2sType : 2;
-
- // The count of data to follow: does not include the possible additional
- // padding byte. MAXIMUM COUNT: 4094. The top four bits must be 0.
- unsigned short i2sCount;
-
-} i2DataHeader, *i2DataHeaderPtr;
-
-// Structure is immediately followed by the data, proper.
-
-//----------------------------
-// NON-DATA PACKETS
-//----------------------------
-
-typedef struct _i2CmdHeader
-{
- unsigned char i2sChannel; // The channel number: 0-255 (Except where noted
- // - see below
-
- // Number of bytes of commands, status or whatever to follow
- unsigned i2sCount : 6;
-
- // These two bits determine the type of packet sent/received.
- unsigned i2sType : 2;
-
-} i2CmdHeader, *i2CmdHeaderPtr;
-
-// Structure is immediately followed by the applicable data.
-
-//---------------------------------------
-// Flow Control Packets (Outbound)
-//---------------------------------------
-
-// One type of outbound command packet is so important that the entire structure
-// is explicitly defined here. That is the flow-control packet. This is never
-// sent by user-level code (as would be the commands to raise/lower DTR, for
-// example). These are only sent by the library routines in response to reading
-// incoming data into the buffers.
-//
-// The parameters inside the command block are maintained in place, then the
-// block is sent at the appropriate time.
-
-typedef struct _flowIn
-{
- i2CmdHeader hd; // Channel #, count, type (see above)
- unsigned char fcmd; // The flow control command (37)
- unsigned short asof; // As of byte number "asof" (LSB first!) I have room
- // for "room" bytes
- unsigned short room;
-} flowIn, *flowInPtr;
-
-//----------------------------------------
-// (Incoming) Status Packets
-//----------------------------------------
-
-// Incoming packets which are non-data packets are status packets. In this case,
-// the channel number in the header is unimportant. What follows are one or more
-// sub-packets, the first word of which consists of the channel (first or low
-// byte) and the status indicator (second or high byte), followed by possibly
-// more data.
-
-#define STAT_CTS_UP 0 /* CTS raised (no other bytes) */
-#define STAT_CTS_DN 1 /* CTS dropped (no other bytes) */
-#define STAT_DCD_UP 2 /* DCD raised (no other bytes) */
-#define STAT_DCD_DN 3 /* DCD dropped (no other bytes) */
-#define STAT_DSR_UP 4 /* DSR raised (no other bytes) */
-#define STAT_DSR_DN 5 /* DSR dropped (no other bytes) */
-#define STAT_RI_UP 6 /* RI raised (no other bytes) */
-#define STAT_RI_DN 7 /* RI dropped (no other bytes) */
-#define STAT_BRK_DET 8 /* BRK detect (no other bytes) */
-#define STAT_FLOW 9 /* Flow control(-- more: see below */
-#define STAT_BMARK 10 /* Bookmark (no other bytes)
- * Bookmark is sent as a response to
- * a command 60: request for bookmark
- */
-#define STAT_STATUS 11 /* Special packet: see below */
-#define STAT_TXCNT 12 /* Special packet: see below */
-#define STAT_RXCNT 13 /* Special packet: see below */
-#define STAT_BOXIDS 14 /* Special packet: see below */
-#define STAT_HWFAIL 15 /* Special packet: see below */
-
-#define STAT_MOD_ERROR 0xc0
-#define STAT_MODEM 0xc0/* If status & STAT_MOD_ERROR:
- * == STAT_MODEM, then this is a modem
- * status packet, given in response to a
- * CMD_DSS_NOW command.
- * The low nibble has each data signal:
- */
-#define STAT_MOD_DCD 0x8
-#define STAT_MOD_RI 0x4
-#define STAT_MOD_DSR 0x2
-#define STAT_MOD_CTS 0x1
-
-#define STAT_ERROR 0x80/* If status & STAT_MOD_ERROR
- * == STAT_ERROR, then
- * sort of error on the channel.
- * The remaining seven bits indicate
- * what sort of error it is.
- */
-/* The low three bits indicate parity, framing, or overrun errors */
-
-#define STAT_E_PARITY 4 /* Parity error */
-#define STAT_E_FRAMING 2 /* Framing error */
-#define STAT_E_OVERRUN 1 /* (uxart) overrun error */
-
-//---------------------------------------
-// STAT_FLOW packets
-//---------------------------------------
-
-typedef struct _flowStat
-{
- unsigned short asof;
- unsigned short room;
-}flowStat, *flowStatPtr;
-
-// flowStat packets are received from the board to regulate the flow of outgoing
-// data. A local copy of this structure is also kept to track the amount of
-// credits used and credits remaining. "room" is the amount of space in the
-// board's buffers, "as of" having received a certain byte number. When sending
-// data to the fifo, you must calculate how much buffer space your packet will
-// use. Add this to the current "asof" and subtract it from the current "room".
-//
-// The calculation for the board's buffer is given by CREDIT_USAGE, where size
-// is the un-rounded count of either data characters or command characters.
-// (Which is to say, the count rounded up, plus two).
-
-#define CREDIT_USAGE(size) (((size) + 3) & ~1)
-
-//---------------------------------------
-// STAT_STATUS packets
-//---------------------------------------
-
-typedef struct _debugStat
-{
- unsigned char d_ccsr;
- unsigned char d_txinh;
- unsigned char d_stat1;
- unsigned char d_stat2;
-} debugStat, *debugStatPtr;
-
-// debugStat packets are sent to the host in response to a CMD_GET_STATUS
-// command. Each byte is bit-mapped as described below:
-
-#define D_CCSR_XON 2 /* Has received XON, ready to transmit */
-#define D_CCSR_XOFF 4 /* Has received XOFF, not transmitting */
-#define D_CCSR_TXENAB 8 /* Transmitter is enabled */
-#define D_CCSR_RXENAB 0x80 /* Receiver is enabled */
-
-#define D_TXINH_BREAK 1 /* We are sending a break */
-#define D_TXINH_EMPTY 2 /* No data to send */
-#define D_TXINH_SUSP 4 /* Output suspended via command 57 */
-#define D_TXINH_CMD 8 /* We are processing an in-line command */
-#define D_TXINH_LCD 0x10 /* LCD diagnostics are running */
-#define D_TXINH_PAUSE 0x20 /* We are processing a PAUSE command */
-#define D_TXINH_DCD 0x40 /* DCD is low, preventing transmission */
-#define D_TXINH_DSR 0x80 /* DSR is low, preventing transmission */
-
-#define D_STAT1_TXEN 1 /* Transmit INTERRUPTS enabled */
-#define D_STAT1_RXEN 2 /* Receiver INTERRUPTS enabled */
-#define D_STAT1_MDEN 4 /* Modem (data set sigs) interrupts enabled */
-#define D_STAT1_RLM 8 /* Remote loopback mode selected */
-#define D_STAT1_LLM 0x10 /* Local internal loopback mode selected */
-#define D_STAT1_CTS 0x20 /* CTS is low, preventing transmission */
-#define D_STAT1_DTR 0x40 /* DTR is low, to stop remote transmission */
-#define D_STAT1_RTS 0x80 /* RTS is low, to stop remote transmission */
-
-#define D_STAT2_TXMT 1 /* Transmit buffers are all empty */
-#define D_STAT2_RXMT 2 /* Receive buffers are all empty */
-#define D_STAT2_RXINH 4 /* Loadware has tried to inhibit remote
- * transmission: dropped DTR, sent XOFF,
- * whatever...
- */
-#define D_STAT2_RXFLO 8 /* Loadware can send no more data to host
- * until it receives a flow-control packet
- */
-//-----------------------------------------
-// STAT_TXCNT and STAT_RXCNT packets
-//----------------------------------------
-
-typedef struct _cntStat
-{
- unsigned short cs_time; // (Assumes host is little-endian!)
- unsigned short cs_count;
-} cntStat, *cntStatPtr;
-
-// These packets are sent in response to a CMD_GET_RXCNT or a CMD_GET_TXCNT
-// bypass command. cs_time is a running 1 Millisecond counter which acts as a
-// time stamp. cs_count is a running counter of data sent or received from the
-// uxarts. (Not including data added by the chip itself, as with CRLF
-// processing).
-//------------------------------------------
-// STAT_HWFAIL packets
-//------------------------------------------
-
-typedef struct _failStat
-{
- unsigned char fs_written;
- unsigned char fs_read;
- unsigned short fs_address;
-} failStat, *failStatPtr;
-
-// This packet is sent whenever the on-board diagnostic process detects an
-// error. At startup, this process is dormant. The host can wake it up by
-// issuing the bypass command CMD_HW_TEST. The process runs at low priority and
-// performs continuous hardware verification; writing data to certain on-board
-// registers, reading it back, and comparing. If it detects an error, this
-// packet is sent to the host, and the process goes dormant again until the host
-// sends another CMD_HW_TEST. It then continues with the next register to be
-// tested.
-
-//------------------------------------------------------------------------------
-// Macros to deal with the headers more easily! Note that these are defined so
-// they may be used as "left" as well as "right" expressions.
-//------------------------------------------------------------------------------
-
-// Given a pointer to the packet, reference the channel number
-//
-#define CHANNEL_OF(pP) ((i2DataHeaderPtr)(pP))->i2sChannel
-
-// Given a pointer to the packet, reference the Packet type
-//
-#define PTYPE_OF(pP) ((i2DataHeaderPtr)(pP))->i2sType
-
-// The possible types of packets
-//
-#define PTYPE_DATA 0 /* Host <--> Board */
-#define PTYPE_BYPASS 1 /* Host ---> Board */
-#define PTYPE_INLINE 2 /* Host ---> Board */
-#define PTYPE_STATUS 2 /* Host <--- Board */
-
-// Given a pointer to a Data packet, reference the Tag
-//
-#define TAG_OF(pP) ((i2DataHeaderPtr)(pP))->i2sTag
-
-// Given a pointer to a Data packet, reference the data i.d.
-//
-#define ID_OF(pP) ((i2DataHeaderPtr)(pP))->i2sId
-
-// The possible types of ID's
-//
-#define ID_ORDINARY_DATA 0
-#define ID_HOT_KEY 1
-
-// Given a pointer to a Data packet, reference the count
-//
-#define DATA_COUNT_OF(pP) ((i2DataHeaderPtr)(pP))->i2sCount
-
-// Given a pointer to a Data packet, reference the beginning of data
-//
-#define DATA_OF(pP) &((unsigned char *)(pP))[4] // 4 = size of header
-
-// Given a pointer to a Non-Data packet, reference the count
-//
-#define CMD_COUNT_OF(pP) ((i2CmdHeaderPtr)(pP))->i2sCount
-
-#define MAX_CMD_PACK_SIZE 62 // Maximum size of such a count
-
-// Given a pointer to a Non-Data packet, reference the beginning of data
-//
-#define CMD_OF(pP) &((unsigned char *)(pP))[2] // 2 = size of header
-
-//--------------------------------
-// MailBox Bits:
-//--------------------------------
-
-//--------------------------
-// Outgoing (host to board)
-//--------------------------
-//
-#define MB_OUT_STUFFED 0x80 // Host has placed output in fifo
-#define MB_IN_STRIPPED 0x40 // Host has read in all input from fifo
-
-//--------------------------
-// Incoming (board to host)
-//--------------------------
-//
-#define MB_IN_STUFFED 0x80 // Board has placed input in fifo
-#define MB_OUT_STRIPPED 0x40 // Board has read all output from fifo
-#define MB_FATAL_ERROR 0x20 // Board has encountered a fatal error
-
-#pragma pack() // Reset padding to command-line default
-
-#endif // I2PACK_H
-
diff --git a/drivers/char/ip2/ip2.h b/drivers/char/ip2/ip2.h
deleted file mode 100644
index 936ccc533949..000000000000
--- a/drivers/char/ip2/ip2.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Driver constants for configuration and tuning
-*
-* NOTES:
-*
-*******************************************************************************/
-#ifndef IP2_H
-#define IP2_H
-
-#include "ip2types.h"
-#include "i2cmd.h"
-
-/*************/
-/* Constants */
-/*************/
-
-/* Device major numbers - since version 2.0.26. */
-#define IP2_TTY_MAJOR 71
-#define IP2_CALLOUT_MAJOR 72
-#define IP2_IPL_MAJOR 73
-
-/* Board configuration array.
- * This array defines the hardware irq and address for up to IP2_MAX_BOARDS
- * (4 supported per ip2_types.h) ISA board addresses and irqs MUST be specified,
- * PCI and EISA boards are probed for and automagicly configed
- * iff the addresses are set to 1 and 2 respectivily.
- * 0x0100 - 0x03f0 == ISA
- * 1 == PCI
- * 2 == EISA
- * 0 == (skip this board)
- * This array defines the hardware addresses for them. Special
- * addresses are EISA and PCI which go sniffing for boards.
-
- * In a multiboard system the position in the array determines which port
- * devices are assigned to each board:
- * board 0 is assigned ttyF0.. to ttyF63,
- * board 1 is assigned ttyF64 to ttyF127,
- * board 2 is assigned ttyF128 to ttyF191,
- * board 3 is assigned ttyF192 to ttyF255.
- *
- * In PCI and EISA bus systems each range is mapped to card in
- * monotonically increasing slot number order, ISA position is as specified
- * here.
-
- * If the irqs are ALL set to 0,0,0,0 all boards operate in
- * polled mode. For interrupt operation ISA boards require that the IRQ be
- * specified, while PCI and EISA boards any nonzero entry
- * will enable interrupts using the BIOS configured irq for the board.
- * An invalid irq entry will default to polled mode for that card and print
- * console warning.
-
- * When the driver is loaded as a module these setting can be overridden on the
- * modprobe command line or on an option line in /etc/modprobe.conf.
- * If the driver is built-in the configuration must be
- * set here for ISA cards and address set to 1 and 2 for PCI and EISA.
- *
- * Here is an example that shows most if not all possibe combinations:
-
- *static ip2config_t ip2config =
- *{
- * {11,1,0,0}, // irqs
- * { // Addresses
- * 0x0308, // Board 0, ttyF0 - ttyF63// ISA card at io=0x308, irq=11
- * 0x0001, // Board 1, ttyF64 - ttyF127//PCI card configured by BIOS
- * 0x0000, // Board 2, ttyF128 - ttyF191// Slot skipped
- * 0x0002 // Board 3, ttyF192 - ttyF255//EISA card configured by BIOS
- * // but polled not irq driven
- * }
- *};
- */
-
- /* this structure is zeroed out because the suggested method is to configure
- * the driver as a module, set up the parameters with an options line in
- * /etc/modprobe.conf and load with modprobe or kmod, the kernel
- * module loader
- */
-
- /* This structure is NOW always initialized when the driver is initialized.
- * Compiled in defaults MUST be added to the io and irq arrays in
- * ip2.c. Those values are configurable from insmod parameters in the
- * case of modules or from command line parameters (ip2=io,irq) when
- * compiled in.
- */
-
-static ip2config_t ip2config =
-{
- {0,0,0,0}, // irqs
- { // Addresses
- /* Do NOT set compile time defaults HERE! Use the arrays in
- ip2.c! These WILL be overwritten! =mhw= */
- 0x0000, // Board 0, ttyF0 - ttyF63
- 0x0000, // Board 1, ttyF64 - ttyF127
- 0x0000, // Board 2, ttyF128 - ttyF191
- 0x0000 // Board 3, ttyF192 - ttyF255
- }
-};
-
-#endif
diff --git a/drivers/char/ip2/ip2ioctl.h b/drivers/char/ip2/ip2ioctl.h
deleted file mode 100644
index aa0a9da85e05..000000000000
--- a/drivers/char/ip2/ip2ioctl.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Driver constants for configuration and tuning
-*
-* NOTES:
-*
-*******************************************************************************/
-
-#ifndef IP2IOCTL_H
-#define IP2IOCTL_H
-
-//*************
-//* Constants *
-//*************
-
-// High baud rates (if not defined elsewhere.
-#ifndef B153600
-# define B153600 0010005
-#endif
-#ifndef B307200
-# define B307200 0010006
-#endif
-#ifndef B921600
-# define B921600 0010007
-#endif
-
-#endif
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
deleted file mode 100644
index ea7a8fb08283..000000000000
--- a/drivers/char/ip2/ip2main.c
+++ /dev/null
@@ -1,3234 +0,0 @@
-/*
-*
-* (c) 1999 by Computone Corporation
-*
-********************************************************************************
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Mainline code for the device driver
-*
-*******************************************************************************/
-// ToDo:
-//
-// Fix the immediate DSS_NOW problem.
-// Work over the channel stats return logic in ip2_ipl_ioctl so they
-// make sense for all 256 possible channels and so the user space
-// utilities will compile and work properly.
-//
-// Done:
-//
-// 1.2.14 /\/\|=mhw=|\/\/
-// Added bounds checking to ip2_ipl_ioctl to avoid potential terroristic acts.
-// Changed the definition of ip2trace to be more consistent with kernel style
-// Thanks to Andreas Dilger <adilger@turbolabs.com> for these updates
-//
-// 1.2.13 /\/\|=mhw=|\/\/
-// DEVFS: Renamed ttf/{n} to tts/F{n} and cuf/{n} to cua/F{n} to conform
-// to agreed devfs serial device naming convention.
-//
-// 1.2.12 /\/\|=mhw=|\/\/
-// Cleaned up some remove queue cut and paste errors
-//
-// 1.2.11 /\/\|=mhw=|\/\/
-// Clean up potential NULL pointer dereferences
-// Clean up devfs registration
-// Add kernel command line parsing for io and irq
-// Compile defaults for io and irq are now set in ip2.c not ip2.h!
-// Reworked poll_only hack for explicit parameter setting
-// You must now EXPLICITLY set poll_only = 1 or set all irqs to 0
-// Merged ip2_loadmain and old_ip2_init
-// Converted all instances of interruptible_sleep_on into queue calls
-// Most of these had no race conditions but better to clean up now
-//
-// 1.2.10 /\/\|=mhw=|\/\/
-// Fixed the bottom half interrupt handler and enabled USE_IQI
-// to split the interrupt handler into a formal top-half / bottom-half
-// Fixed timing window on high speed processors that queued messages to
-// the outbound mail fifo faster than the board could handle.
-//
-// 1.2.9
-// Four box EX was barfing on >128k kmalloc, made structure smaller by
-// reducing output buffer size
-//
-// 1.2.8
-// Device file system support (MHW)
-//
-// 1.2.7
-// Fixed
-// Reload of ip2 without unloading ip2main hangs system on cat of /proc/modules
-//
-// 1.2.6
-//Fixes DCD problems
-// DCD was not reported when CLOCAL was set on call to TIOCMGET
-//
-//Enhancements:
-// TIOCMGET requests and waits for status return
-// No DSS interrupts enabled except for DCD when needed
-//
-// For internal use only
-//
-//#define IP2DEBUG_INIT
-//#define IP2DEBUG_OPEN
-//#define IP2DEBUG_WRITE
-//#define IP2DEBUG_READ
-//#define IP2DEBUG_IOCTL
-//#define IP2DEBUG_IPL
-
-//#define IP2DEBUG_TRACE
-//#define DEBUG_FIFO
-
-/************/
-/* Includes */
-/************/
-
-#include <linux/ctype.h>
-#include <linux/string.h>
-#include <linux/fcntl.h>
-#include <linux/errno.h>
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/major.h>
-#include <linux/wait.h>
-#include <linux/device.h>
-#include <linux/mutex.h>
-#include <linux/firmware.h>
-#include <linux/platform_device.h>
-
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/termios.h>
-#include <linux/tty_driver.h>
-#include <linux/serial.h>
-#include <linux/ptrace.h>
-#include <linux/ioport.h>
-
-#include <linux/cdk.h>
-#include <linux/comstats.h>
-#include <linux/delay.h>
-#include <linux/bitops.h>
-
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-
-#include <linux/vmalloc.h>
-#include <linux/init.h>
-
-#include <asm/uaccess.h>
-
-#include "ip2types.h"
-#include "ip2trace.h"
-#include "ip2ioctl.h"
-#include "ip2.h"
-#include "i2ellis.h"
-#include "i2lib.h"
-
-/*****************
- * /proc/ip2mem *
- *****************/
-
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-
-static DEFINE_MUTEX(ip2_mutex);
-static const struct file_operations ip2mem_proc_fops;
-static const struct file_operations ip2_proc_fops;
-
-/********************/
-/* Type Definitions */
-/********************/
-
-/*************/
-/* Constants */
-/*************/
-
-/* String constants to identify ourselves */
-static const char pcName[] = "Computone IntelliPort Plus multiport driver";
-static const char pcVersion[] = "1.2.14";
-
-/* String constants for port names */
-static const char pcDriver_name[] = "ip2";
-static const char pcIpl[] = "ip2ipl";
-
-/***********************/
-/* Function Prototypes */
-/***********************/
-
-/* Global module entry functions */
-
-/* Private (static) functions */
-static int ip2_open(PTTY, struct file *);
-static void ip2_close(PTTY, struct file *);
-static int ip2_write(PTTY, const unsigned char *, int);
-static int ip2_putchar(PTTY, unsigned char);
-static void ip2_flush_chars(PTTY);
-static int ip2_write_room(PTTY);
-static int ip2_chars_in_buf(PTTY);
-static void ip2_flush_buffer(PTTY);
-static int ip2_ioctl(PTTY, UINT, ULONG);
-static void ip2_set_termios(PTTY, struct ktermios *);
-static void ip2_set_line_discipline(PTTY);
-static void ip2_throttle(PTTY);
-static void ip2_unthrottle(PTTY);
-static void ip2_stop(PTTY);
-static void ip2_start(PTTY);
-static void ip2_hangup(PTTY);
-static int ip2_tiocmget(struct tty_struct *tty);
-static int ip2_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear);
-static int ip2_get_icount(struct tty_struct *tty,
- struct serial_icounter_struct *icount);
-
-static void set_irq(int, int);
-static void ip2_interrupt_bh(struct work_struct *work);
-static irqreturn_t ip2_interrupt(int irq, void *dev_id);
-static void ip2_poll(unsigned long arg);
-static inline void service_all_boards(void);
-static void do_input(struct work_struct *);
-static void do_status(struct work_struct *);
-
-static void ip2_wait_until_sent(PTTY,int);
-
-static void set_params (i2ChanStrPtr, struct ktermios *);
-static int get_serial_info(i2ChanStrPtr, struct serial_struct __user *);
-static int set_serial_info(i2ChanStrPtr, struct serial_struct __user *);
-
-static ssize_t ip2_ipl_read(struct file *, char __user *, size_t, loff_t *);
-static ssize_t ip2_ipl_write(struct file *, const char __user *, size_t, loff_t *);
-static long ip2_ipl_ioctl(struct file *, UINT, ULONG);
-static int ip2_ipl_open(struct inode *, struct file *);
-
-static int DumpTraceBuffer(char __user *, int);
-static int DumpFifoBuffer( char __user *, int);
-
-static void ip2_init_board(int, const struct firmware *);
-static unsigned short find_eisa_board(int);
-static int ip2_setup(char *str);
-
-/***************/
-/* Static Data */
-/***************/
-
-static struct tty_driver *ip2_tty_driver;
-
-/* Here, then is a table of board pointers which the interrupt routine should
- * scan through to determine who it must service.
- */
-static unsigned short i2nBoards; // Number of boards here
-
-static i2eBordStrPtr i2BoardPtrTable[IP2_MAX_BOARDS];
-
-static i2ChanStrPtr DevTable[IP2_MAX_PORTS];
-//DevTableMem just used to save addresses for kfree
-static void *DevTableMem[IP2_MAX_BOARDS];
-
-/* This is the driver descriptor for the ip2ipl device, which is used to
- * download the loadware to the boards.
- */
-static const struct file_operations ip2_ipl = {
- .owner = THIS_MODULE,
- .read = ip2_ipl_read,
- .write = ip2_ipl_write,
- .unlocked_ioctl = ip2_ipl_ioctl,
- .open = ip2_ipl_open,
- .llseek = noop_llseek,
-};
-
-static unsigned long irq_counter;
-static unsigned long bh_counter;
-
-// Use immediate queue to service interrupts
-#define USE_IQI
-//#define USE_IQ // PCI&2.2 needs work
-
-/* The timer_list entry for our poll routine. If interrupt operation is not
- * selected, the board is serviced periodically to see if anything needs doing.
- */
-#define POLL_TIMEOUT (jiffies + 1)
-static DEFINE_TIMER(PollTimer, ip2_poll, 0, 0);
-
-#ifdef IP2DEBUG_TRACE
-/* Trace (debug) buffer data */
-#define TRACEMAX 1000
-static unsigned long tracebuf[TRACEMAX];
-static int tracestuff;
-static int tracestrip;
-static int tracewrap;
-#endif
-
-/**********/
-/* Macros */
-/**********/
-
-#ifdef IP2DEBUG_OPEN
-#define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] ttyc=%d, modc=%x -> %s\n", \
- tty->name,(pCh->flags), \
- tty->count,/*GET_USE_COUNT(module)*/0,s)
-#else
-#define DBG_CNT(s)
-#endif
-
-/********/
-/* Code */
-/********/
-
-#include "i2ellis.c" /* Extremely low-level interface services */
-#include "i2cmd.c" /* Standard loadware command definitions */
-#include "i2lib.c" /* High level interface services */
-
-/* Configuration area for modprobe */
-
-MODULE_AUTHOR("Doug McNash");
-MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
-MODULE_LICENSE("GPL");
-
-#define MAX_CMD_STR 50
-
-static int poll_only;
-static char cmd[MAX_CMD_STR];
-
-static int Eisa_irq;
-static int Eisa_slot;
-
-static int iindx;
-static char rirqs[IP2_MAX_BOARDS];
-static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
-
-/* Note: Add compiled in defaults to these arrays, not to the structure
- in ip2.h any longer. That structure WILL get overridden
- by these values, or command line values, or insmod values!!! =mhw=
-*/
-static int io[IP2_MAX_BOARDS];
-static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
-
-MODULE_AUTHOR("Doug McNash");
-MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
-module_param_array(irq, int, NULL, 0);
-MODULE_PARM_DESC(irq, "Interrupts for IntelliPort Cards");
-module_param_array(io, int, NULL, 0);
-MODULE_PARM_DESC(io, "I/O ports for IntelliPort Cards");
-module_param(poll_only, bool, 0);
-MODULE_PARM_DESC(poll_only, "Do not use card interrupts");
-module_param_string(ip2, cmd, MAX_CMD_STR, 0);
-MODULE_PARM_DESC(ip2, "Contains module parameter passed with 'ip2='");
-
-/* for sysfs class support */
-static struct class *ip2_class;
-
-/* Some functions to keep track of what irqs we have */
-
-static int __init is_valid_irq(int irq)
-{
- int *i = Valid_Irqs;
-
- while (*i != 0 && *i != irq)
- i++;
-
- return *i;
-}
-
-static void __init mark_requested_irq(char irq)
-{
- rirqs[iindx++] = irq;
-}
-
-static int __exit clear_requested_irq(char irq)
-{
- int i;
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- if (rirqs[i] == irq) {
- rirqs[i] = 0;
- return 1;
- }
- }
- return 0;
-}
-
-static int have_requested_irq(char irq)
-{
- /* array init to zeros so 0 irq will not be requested as a side
- * effect */
- int i;
- for (i = 0; i < IP2_MAX_BOARDS; ++i)
- if (rirqs[i] == irq)
- return 1;
- return 0;
-}
-
-/******************************************************************************/
-/* Function: cleanup_module() */
-/* Parameters: None */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This is a required entry point for an installable module. It has to return */
-/* the device and the driver to a passive state. It should not be necessary */
-/* to reset the board fully, especially as the loadware is downloaded */
-/* externally rather than in the driver. We just want to disable the board */
-/* and clear the loadware to a reset state. To allow this there has to be a */
-/* way to detect whether the board has the loadware running at init time to */
-/* handle subsequent installations of the driver. All memory allocated by the */
-/* driver should be returned since it may be unloaded from memory. */
-/******************************************************************************/
-static void __exit ip2_cleanup_module(void)
-{
- int err;
- int i;
-
- del_timer_sync(&PollTimer);
-
- /* Reset the boards we have. */
- for (i = 0; i < IP2_MAX_BOARDS; i++)
- if (i2BoardPtrTable[i])
- iiReset(i2BoardPtrTable[i]);
-
- /* The following is done at most once, if any boards were installed. */
- for (i = 0; i < IP2_MAX_BOARDS; i++) {
- if (i2BoardPtrTable[i]) {
- iiResetDelay(i2BoardPtrTable[i]);
- /* free io addresses and Tibet */
- release_region(ip2config.addr[i], 8);
- device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i));
- device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR,
- 4 * i + 1));
- }
- /* Disable and remove interrupt handler. */
- if (ip2config.irq[i] > 0 &&
- have_requested_irq(ip2config.irq[i])) {
- free_irq(ip2config.irq[i], (void *)&pcName);
- clear_requested_irq(ip2config.irq[i]);
- }
- }
- class_destroy(ip2_class);
- err = tty_unregister_driver(ip2_tty_driver);
- if (err)
- printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n",
- err);
- put_tty_driver(ip2_tty_driver);
- unregister_chrdev(IP2_IPL_MAJOR, pcIpl);
- remove_proc_entry("ip2mem", NULL);
-
- /* free memory */
- for (i = 0; i < IP2_MAX_BOARDS; i++) {
- void *pB;
-#ifdef CONFIG_PCI
- if (ip2config.type[i] == PCI && ip2config.pci_dev[i]) {
- pci_disable_device(ip2config.pci_dev[i]);
- pci_dev_put(ip2config.pci_dev[i]);
- ip2config.pci_dev[i] = NULL;
- }
-#endif
- pB = i2BoardPtrTable[i];
- if (pB != NULL) {
- kfree(pB);
- i2BoardPtrTable[i] = NULL;
- }
- if (DevTableMem[i] != NULL) {
- kfree(DevTableMem[i]);
- DevTableMem[i] = NULL;
- }
- }
-}
-module_exit(ip2_cleanup_module);
-
-static const struct tty_operations ip2_ops = {
- .open = ip2_open,
- .close = ip2_close,
- .write = ip2_write,
- .put_char = ip2_putchar,
- .flush_chars = ip2_flush_chars,
- .write_room = ip2_write_room,
- .chars_in_buffer = ip2_chars_in_buf,
- .flush_buffer = ip2_flush_buffer,
- .ioctl = ip2_ioctl,
- .throttle = ip2_throttle,
- .unthrottle = ip2_unthrottle,
- .set_termios = ip2_set_termios,
- .set_ldisc = ip2_set_line_discipline,
- .stop = ip2_stop,
- .start = ip2_start,
- .hangup = ip2_hangup,
- .tiocmget = ip2_tiocmget,
- .tiocmset = ip2_tiocmset,
- .get_icount = ip2_get_icount,
- .proc_fops = &ip2_proc_fops,
-};
-
-/******************************************************************************/
-/* Function: ip2_loadmain() */
-/* Parameters: irq, io from command line of insmod et. al. */
-/* pointer to fip firmware and firmware size for boards */
-/* Returns: Success (0) */
-/* */
-/* Description: */
-/* This was the required entry point for all drivers (now in ip2.c) */
-/* It performs all */
-/* initialisation of the devices and driver structures, and registers itself */
-/* with the relevant kernel modules. */
-/******************************************************************************/
-/* IRQF_DISABLED - if set blocks all interrupts else only this line */
-/* IRQF_SHARED - for shared irq PCI or maybe EISA only */
-/* SA_RANDOM - can be source for cert. random number generators */
-#define IP2_SA_FLAGS 0
-
-
-static const struct firmware *ip2_request_firmware(void)
-{
- struct platform_device *pdev;
- const struct firmware *fw;
-
- pdev = platform_device_register_simple("ip2", 0, NULL, 0);
- if (IS_ERR(pdev)) {
- printk(KERN_ERR "Failed to register platform device for ip2\n");
- return NULL;
- }
- if (request_firmware(&fw, "intelliport2.bin", &pdev->dev)) {
- printk(KERN_ERR "Failed to load firmware 'intelliport2.bin'\n");
- fw = NULL;
- }
- platform_device_unregister(pdev);
- return fw;
-}
-
-/******************************************************************************
- * ip2_setup:
- * str: kernel command line string
- *
- * Can't autoprobe the boards so user must specify configuration on
- * kernel command line. Sane people build it modular but the others
- * come here.
- *
- * Alternating pairs of io,irq for up to 4 boards.
- * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
- *
- * io=0 => No board
- * io=1 => PCI
- * io=2 => EISA
- * else => ISA I/O address
- *
- * irq=0 or invalid for ISA will revert to polling mode
- *
- * Any value = -1, do not overwrite compiled in value.
- *
- ******************************************************************************/
-static int __init ip2_setup(char *str)
-{
- int j, ints[10]; /* 4 boards, 2 parameters + 2 */
- unsigned int i;
-
- str = get_options(str, ARRAY_SIZE(ints), ints);
-
- for (i = 0, j = 1; i < 4; i++) {
- if (j > ints[0])
- break;
- if (ints[j] >= 0)
- io[i] = ints[j];
- j++;
- if (j > ints[0])
- break;
- if (ints[j] >= 0)
- irq[i] = ints[j];
- j++;
- }
- return 1;
-}
-__setup("ip2=", ip2_setup);
-
-static int __init ip2_loadmain(void)
-{
- int i, j, box;
- int err = 0;
- i2eBordStrPtr pB = NULL;
- int rc = -1;
- const struct firmware *fw = NULL;
- char *str;
-
- str = cmd;
-
- if (poll_only) {
- /* Hard lock the interrupts to zero */
- irq[0] = irq[1] = irq[2] = irq[3] = poll_only = 0;
- }
-
- /* Check module parameter with 'ip2=' has been passed or not */
- if (!poll_only && (!strncmp(str, "ip2=", 4)))
- ip2_setup(str);
-
- ip2trace(ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0);
-
- /* process command line arguments to modprobe or
- insmod i.e. iop & irqp */
- /* irqp and iop should ALWAYS be specified now... But we check
- them individually just to be sure, anyways... */
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- ip2config.addr[i] = io[i];
- if (irq[i] >= 0)
- ip2config.irq[i] = irq[i];
- else
- ip2config.irq[i] = 0;
- /* This is a little bit of a hack. If poll_only=1 on command
- line back in ip2.c OR all IRQs on all specified boards are
- explicitly set to 0, then drop to poll only mode and override
- PCI or EISA interrupts. This superceeds the old hack of
- triggering if all interrupts were zero (like da default).
- Still a hack but less prone to random acts of terrorism.
-
- What we really should do, now that the IRQ default is set
- to -1, is to use 0 as a hard coded, do not probe.
-
- /\/\|=mhw=|\/\/
- */
- poll_only |= irq[i];
- }
- poll_only = !poll_only;
-
- /* Announce our presence */
- printk(KERN_INFO "%s version %s\n", pcName, pcVersion);
-
- ip2_tty_driver = alloc_tty_driver(IP2_MAX_PORTS);
- if (!ip2_tty_driver)
- return -ENOMEM;
-
- /* Initialise all the boards we can find (up to the maximum). */
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- switch (ip2config.addr[i]) {
- case 0: /* skip this slot even if card is present */
- break;
- default: /* ISA */
- /* ISA address must be specified */
- if (ip2config.addr[i] < 0x100 ||
- ip2config.addr[i] > 0x3f8) {
- printk(KERN_ERR "IP2: Bad ISA board %d "
- "address %x\n", i,
- ip2config.addr[i]);
- ip2config.addr[i] = 0;
- break;
- }
- ip2config.type[i] = ISA;
-
- /* Check for valid irq argument, set for polling if
- * invalid */
- if (ip2config.irq[i] &&
- !is_valid_irq(ip2config.irq[i])) {
- printk(KERN_ERR "IP2: Bad IRQ(%d) specified\n",
- ip2config.irq[i]);
- /* 0 is polling and is valid in that sense */
- ip2config.irq[i] = 0;
- }
- break;
- case PCI:
-#ifdef CONFIG_PCI
- {
- struct pci_dev *pdev = NULL;
- u32 addr;
- int status;
-
- pdev = pci_get_device(PCI_VENDOR_ID_COMPUTONE,
- PCI_DEVICE_ID_COMPUTONE_IP2EX, pdev);
- if (pdev == NULL) {
- ip2config.addr[i] = 0;
- printk(KERN_ERR "IP2: PCI board %d not "
- "found\n", i);
- break;
- }
-
- if (pci_enable_device(pdev)) {
- dev_err(&pdev->dev, "can't enable device\n");
- goto out;
- }
- ip2config.type[i] = PCI;
- ip2config.pci_dev[i] = pci_dev_get(pdev);
- status = pci_read_config_dword(pdev, PCI_BASE_ADDRESS_1,
- &addr);
- if (addr & 1)
- ip2config.addr[i] = (USHORT)(addr & 0xfffe);
- else
- dev_err(&pdev->dev, "I/O address error\n");
-
- ip2config.irq[i] = pdev->irq;
-out:
- pci_dev_put(pdev);
- }
-#else
- printk(KERN_ERR "IP2: PCI card specified but PCI "
- "support not enabled.\n");
- printk(KERN_ERR "IP2: Recompile kernel with CONFIG_PCI "
- "defined!\n");
-#endif /* CONFIG_PCI */
- break;
- case EISA:
- ip2config.addr[i] = find_eisa_board(Eisa_slot + 1);
- if (ip2config.addr[i] != 0) {
- /* Eisa_irq set as side effect, boo */
- ip2config.type[i] = EISA;
- }
- ip2config.irq[i] = Eisa_irq;
- break;
- } /* switch */
- } /* for */
-
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- if (ip2config.addr[i]) {
- pB = kzalloc(sizeof(i2eBordStr), GFP_KERNEL);
- if (pB) {
- i2BoardPtrTable[i] = pB;
- iiSetAddress(pB, ip2config.addr[i],
- ii2DelayTimer);
- iiReset(pB);
- } else
- printk(KERN_ERR "IP2: board memory allocation "
- "error\n");
- }
- }
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- pB = i2BoardPtrTable[i];
- if (pB != NULL) {
- iiResetDelay(pB);
- break;
- }
- }
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- /* We don't want to request the firmware unless we have at
- least one board */
- if (i2BoardPtrTable[i] != NULL) {
- if (!fw)
- fw = ip2_request_firmware();
- if (!fw)
- break;
- ip2_init_board(i, fw);
- }
- }
- if (fw)
- release_firmware(fw);
-
- ip2trace(ITRC_NO_PORT, ITRC_INIT, 2, 0);
-
- ip2_tty_driver->owner = THIS_MODULE;
- ip2_tty_driver->name = "ttyF";
- ip2_tty_driver->driver_name = pcDriver_name;
- ip2_tty_driver->major = IP2_TTY_MAJOR;
- ip2_tty_driver->minor_start = 0;
- ip2_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
- ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL;
- ip2_tty_driver->init_termios = tty_std_termios;
- ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL;
- ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW |
- TTY_DRIVER_DYNAMIC_DEV;
- tty_set_operations(ip2_tty_driver, &ip2_ops);
-
- ip2trace(ITRC_NO_PORT, ITRC_INIT, 3, 0);
-
- err = tty_register_driver(ip2_tty_driver);
- if (err) {
- printk(KERN_ERR "IP2: failed to register tty driver\n");
- put_tty_driver(ip2_tty_driver);
- return err; /* leaking resources */
- }
-
- err = register_chrdev(IP2_IPL_MAJOR, pcIpl, &ip2_ipl);
- if (err) {
- printk(KERN_ERR "IP2: failed to register IPL device (%d)\n",
- err);
- } else {
- /* create the sysfs class */
- ip2_class = class_create(THIS_MODULE, "ip2");
- if (IS_ERR(ip2_class)) {
- err = PTR_ERR(ip2_class);
- goto out_chrdev;
- }
- }
- /* Register the read_procmem thing */
- if (!proc_create("ip2mem",0,NULL,&ip2mem_proc_fops)) {
- printk(KERN_ERR "IP2: failed to register read_procmem\n");
- return -EIO; /* leaking resources */
- }
-
- ip2trace(ITRC_NO_PORT, ITRC_INIT, 4, 0);
- /* Register the interrupt handler or poll handler, depending upon the
- * specified interrupt.
- */
-
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- if (ip2config.addr[i] == 0)
- continue;
-
- pB = i2BoardPtrTable[i];
- if (pB != NULL) {
- device_create(ip2_class, NULL,
- MKDEV(IP2_IPL_MAJOR, 4 * i),
- NULL, "ipl%d", i);
- device_create(ip2_class, NULL,
- MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
- NULL, "stat%d", i);
-
- for (box = 0; box < ABS_MAX_BOXES; box++)
- for (j = 0; j < ABS_BIGGEST_BOX; j++)
- if (pB->i2eChannelMap[box] & (1 << j))
- tty_register_device(
- ip2_tty_driver,
- j + ABS_BIGGEST_BOX *
- (box+i*ABS_MAX_BOXES),
- NULL);
- }
-
- if (poll_only) {
- /* Poll only forces driver to only use polling and
- to ignore the probed PCI or EISA interrupts. */
- ip2config.irq[i] = CIR_POLL;
- }
- if (ip2config.irq[i] == CIR_POLL) {
-retry:
- if (!timer_pending(&PollTimer)) {
- mod_timer(&PollTimer, POLL_TIMEOUT);
- printk(KERN_INFO "IP2: polling\n");
- }
- } else {
- if (have_requested_irq(ip2config.irq[i]))
- continue;
- rc = request_irq(ip2config.irq[i], ip2_interrupt,
- IP2_SA_FLAGS |
- (ip2config.type[i] == PCI ? IRQF_SHARED : 0),
- pcName, i2BoardPtrTable[i]);
- if (rc) {
- printk(KERN_ERR "IP2: request_irq failed: "
- "error %d\n", rc);
- ip2config.irq[i] = CIR_POLL;
- printk(KERN_INFO "IP2: Polling %ld/sec.\n",
- (POLL_TIMEOUT - jiffies));
- goto retry;
- }
- mark_requested_irq(ip2config.irq[i]);
- /* Initialise the interrupt handler bottom half
- * (aka slih). */
- }
- }
-
- for (i = 0; i < IP2_MAX_BOARDS; ++i) {
- if (i2BoardPtrTable[i]) {
- /* set and enable board interrupt */
- set_irq(i, ip2config.irq[i]);
- }
- }
-
- ip2trace(ITRC_NO_PORT, ITRC_INIT, ITRC_RETURN, 0);
-
- return 0;
-
-out_chrdev:
- unregister_chrdev(IP2_IPL_MAJOR, "ip2");
- /* unregister and put tty here */
- return err;
-}
-module_init(ip2_loadmain);
-
-/******************************************************************************/
-/* Function: ip2_init_board() */
-/* Parameters: Index of board in configuration structure */
-/* Returns: Success (0) */
-/* */
-/* Description: */
-/* This function initializes the specified board. The loadware is copied to */
-/* the board, the channel structures are initialized, and the board details */
-/* are reported on the console. */
-/******************************************************************************/
-static void
-ip2_init_board(int boardnum, const struct firmware *fw)
-{
- int i;
- int nports = 0, nboxes = 0;
- i2ChanStrPtr pCh;
- i2eBordStrPtr pB = i2BoardPtrTable[boardnum];
-
- if ( !iiInitialize ( pB ) ) {
- printk ( KERN_ERR "IP2: Failed to initialize board at 0x%x, error %d\n",
- pB->i2eBase, pB->i2eError );
- goto err_initialize;
- }
- printk(KERN_INFO "IP2: Board %d: addr=0x%x irq=%d\n", boardnum + 1,
- ip2config.addr[boardnum], ip2config.irq[boardnum] );
-
- if (!request_region( ip2config.addr[boardnum], 8, pcName )) {
- printk(KERN_ERR "IP2: bad addr=0x%x\n", ip2config.addr[boardnum]);
- goto err_initialize;
- }
-
- if ( iiDownloadAll ( pB, (loadHdrStrPtr)fw->data, 1, fw->size )
- != II_DOWN_GOOD ) {
- printk ( KERN_ERR "IP2: failed to download loadware\n" );
- goto err_release_region;
- } else {
- printk ( KERN_INFO "IP2: fv=%d.%d.%d lv=%d.%d.%d\n",
- pB->i2ePom.e.porVersion,
- pB->i2ePom.e.porRevision,
- pB->i2ePom.e.porSubRev, pB->i2eLVersion,
- pB->i2eLRevision, pB->i2eLSub );
- }
-
- switch ( pB->i2ePom.e.porID & ~POR_ID_RESERVED ) {
-
- default:
- printk( KERN_ERR "IP2: Unknown board type, ID = %x\n",
- pB->i2ePom.e.porID );
- nports = 0;
- goto err_release_region;
- break;
-
- case POR_ID_II_4: /* IntelliPort-II, ISA-4 (4xRJ45) */
- printk ( KERN_INFO "IP2: ISA-4\n" );
- nports = 4;
- break;
-
- case POR_ID_II_8: /* IntelliPort-II, 8-port using standard brick. */
- printk ( KERN_INFO "IP2: ISA-8 std\n" );
- nports = 8;
- break;
-
- case POR_ID_II_8R: /* IntelliPort-II, 8-port using RJ11's (no CTS) */
- printk ( KERN_INFO "IP2: ISA-8 RJ11\n" );
- nports = 8;
- break;
-
- case POR_ID_FIIEX: /* IntelliPort IIEX */
- {
- int portnum = IP2_PORTS_PER_BOARD * boardnum;
- int box;
-
- for( box = 0; box < ABS_MAX_BOXES; ++box ) {
- if ( pB->i2eChannelMap[box] != 0 ) {
- ++nboxes;
- }
- for( i = 0; i < ABS_BIGGEST_BOX; ++i ) {
- if ( pB->i2eChannelMap[box] & 1<< i ) {
- ++nports;
- }
- }
- }
- DevTableMem[boardnum] = pCh =
- kmalloc( sizeof(i2ChanStr) * nports, GFP_KERNEL );
- if ( !pCh ) {
- printk ( KERN_ERR "IP2: (i2_init_channel:) Out of memory.\n");
- goto err_release_region;
- }
- if ( !i2InitChannels( pB, nports, pCh ) ) {
- printk(KERN_ERR "IP2: i2InitChannels failed: %d\n",pB->i2eError);
- kfree ( pCh );
- goto err_release_region;
- }
- pB->i2eChannelPtr = &DevTable[portnum];
- pB->i2eChannelCnt = ABS_MOST_PORTS;
-
- for( box = 0; box < ABS_MAX_BOXES; ++box, portnum += ABS_BIGGEST_BOX ) {
- for( i = 0; i < ABS_BIGGEST_BOX; ++i ) {
- if ( pB->i2eChannelMap[box] & (1 << i) ) {
- DevTable[portnum + i] = pCh;
- pCh->port_index = portnum + i;
- pCh++;
- }
- }
- }
- printk(KERN_INFO "IP2: EX box=%d ports=%d %d bit\n",
- nboxes, nports, pB->i2eDataWidth16 ? 16 : 8 );
- }
- goto ex_exit;
- }
- DevTableMem[boardnum] = pCh =
- kmalloc ( sizeof (i2ChanStr) * nports, GFP_KERNEL );
- if ( !pCh ) {
- printk ( KERN_ERR "IP2: (i2_init_channel:) Out of memory.\n");
- goto err_release_region;
- }
- pB->i2eChannelPtr = pCh;
- pB->i2eChannelCnt = nports;
- if ( !i2InitChannels( pB, nports, pCh ) ) {
- printk(KERN_ERR "IP2: i2InitChannels failed: %d\n",pB->i2eError);
- kfree ( pCh );
- goto err_release_region;
- }
- pB->i2eChannelPtr = &DevTable[IP2_PORTS_PER_BOARD * boardnum];
-
- for( i = 0; i < pB->i2eChannelCnt; ++i ) {
- DevTable[IP2_PORTS_PER_BOARD * boardnum + i] = pCh;
- pCh->port_index = (IP2_PORTS_PER_BOARD * boardnum) + i;
- pCh++;
- }
-ex_exit:
- INIT_WORK(&pB->tqueue_interrupt, ip2_interrupt_bh);
- return;
-
-err_release_region:
- release_region(ip2config.addr[boardnum], 8);
-err_initialize:
- kfree ( pB );
- i2BoardPtrTable[boardnum] = NULL;
- return;
-}
-
-/******************************************************************************/
-/* Function: find_eisa_board ( int start_slot ) */
-/* Parameters: First slot to check */
-/* Returns: Address of EISA IntelliPort II controller */
-/* */
-/* Description: */
-/* This function searches for an EISA IntelliPort controller, starting */
-/* from the specified slot number. If the motherboard is not identified as an */
-/* EISA motherboard, or no valid board ID is selected it returns 0. Otherwise */
-/* it returns the base address of the controller. */
-/******************************************************************************/
-static unsigned short
-find_eisa_board( int start_slot )
-{
- int i, j;
- unsigned int idm = 0;
- unsigned int idp = 0;
- unsigned int base = 0;
- unsigned int value;
- int setup_address;
- int setup_irq;
- int ismine = 0;
-
- /*
- * First a check for an EISA motherboard, which we do by comparing the
- * EISA ID registers for the system board and the first couple of slots.
- * No slot ID should match the system board ID, but on an ISA or PCI
- * machine the odds are that an empty bus will return similar values for
- * each slot.
- */
- i = 0x0c80;
- value = (inb(i) << 24) + (inb(i+1) << 16) + (inb(i+2) << 8) + inb(i+3);
- for( i = 0x1c80; i <= 0x4c80; i += 0x1000 ) {
- j = (inb(i)<<24)+(inb(i+1)<<16)+(inb(i+2)<<8)+inb(i+3);
- if ( value == j )
- return 0;
- }
-
- /*
- * OK, so we are inclined to believe that this is an EISA machine. Find
- * an IntelliPort controller.
- */
- for( i = start_slot; i < 16; i++ ) {
- base = i << 12;
- idm = (inb(base + 0xc80) << 8) | (inb(base + 0xc81) & 0xff);
- idp = (inb(base + 0xc82) << 8) | (inb(base + 0xc83) & 0xff);
- ismine = 0;
- if ( idm == 0x0e8e ) {
- if ( idp == 0x0281 || idp == 0x0218 ) {
- ismine = 1;
- } else if ( idp == 0x0282 || idp == 0x0283 ) {
- ismine = 3; /* Can do edge-trigger */
- }
- if ( ismine ) {
- Eisa_slot = i;
- break;
- }
- }
- }
- if ( !ismine )
- return 0;
-
- /* It's some sort of EISA card, but at what address is it configured? */
-
- setup_address = base + 0xc88;
- value = inb(base + 0xc86);
- setup_irq = (value & 8) ? Valid_Irqs[value & 7] : 0;
-
- if ( (ismine & 2) && !(value & 0x10) ) {
- ismine = 1; /* Could be edging, but not */
- }
-
- if ( Eisa_irq == 0 ) {
- Eisa_irq = setup_irq;
- } else if ( Eisa_irq != setup_irq ) {
- printk ( KERN_ERR "IP2: EISA irq mismatch between EISA controllers\n" );
- }
-
-#ifdef IP2DEBUG_INIT
-printk(KERN_DEBUG "Computone EISA board in slot %d, I.D. 0x%x%x, Address 0x%x",
- base >> 12, idm, idp, setup_address);
- if ( Eisa_irq ) {
- printk(KERN_DEBUG ", Interrupt %d %s\n",
- setup_irq, (ismine & 2) ? "(edge)" : "(level)");
- } else {
- printk(KERN_DEBUG ", (polled)\n");
- }
-#endif
- return setup_address;
-}
-
-/******************************************************************************/
-/* Function: set_irq() */
-/* Parameters: index to board in board table */
-/* IRQ to use */
-/* Returns: Success (0) */
-/* */
-/* Description: */
-/******************************************************************************/
-static void
-set_irq( int boardnum, int boardIrq )
-{
- unsigned char tempCommand[16];
- i2eBordStrPtr pB = i2BoardPtrTable[boardnum];
- unsigned long flags;
-
- /*
- * Notify the boards they may generate interrupts. This is done by
- * sending an in-line command to channel 0 on each board. This is why
- * the channels have to be defined already. For each board, if the
- * interrupt has never been defined, we must do so NOW, directly, since
- * board will not send flow control or even give an interrupt until this
- * is done. If polling we must send 0 as the interrupt parameter.
- */
-
- // We will get an interrupt here at the end of this function
-
- iiDisableMailIrq(pB);
-
- /* We build up the entire packet header. */
- CHANNEL_OF(tempCommand) = 0;
- PTYPE_OF(tempCommand) = PTYPE_INLINE;
- CMD_COUNT_OF(tempCommand) = 2;
- (CMD_OF(tempCommand))[0] = CMDVALUE_IRQ;
- (CMD_OF(tempCommand))[1] = boardIrq;
- /*
- * Write to FIFO; don't bother to adjust fifo capacity for this, since
- * board will respond almost immediately after SendMail hit.
- */
- write_lock_irqsave(&pB->write_fifo_spinlock, flags);
- iiWriteBuf(pB, tempCommand, 4);
- write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
- pB->i2eUsingIrq = boardIrq;
- pB->i2eOutMailWaiting |= MB_OUT_STUFFED;
-
- /* Need to update number of boards before you enable mailbox int */
- ++i2nBoards;
-
- CHANNEL_OF(tempCommand) = 0;
- PTYPE_OF(tempCommand) = PTYPE_BYPASS;
- CMD_COUNT_OF(tempCommand) = 6;
- (CMD_OF(tempCommand))[0] = 88; // SILO
- (CMD_OF(tempCommand))[1] = 64; // chars
- (CMD_OF(tempCommand))[2] = 32; // ms
-
- (CMD_OF(tempCommand))[3] = 28; // MAX_BLOCK
- (CMD_OF(tempCommand))[4] = 64; // chars
-
- (CMD_OF(tempCommand))[5] = 87; // HW_TEST
- write_lock_irqsave(&pB->write_fifo_spinlock, flags);
- iiWriteBuf(pB, tempCommand, 8);
- write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
-
- CHANNEL_OF(tempCommand) = 0;
- PTYPE_OF(tempCommand) = PTYPE_BYPASS;
- CMD_COUNT_OF(tempCommand) = 1;
- (CMD_OF(tempCommand))[0] = 84; /* get BOX_IDS */
- iiWriteBuf(pB, tempCommand, 3);
-
-#ifdef XXX
- // enable heartbeat for test porpoises
- CHANNEL_OF(tempCommand) = 0;
- PTYPE_OF(tempCommand) = PTYPE_BYPASS;
- CMD_COUNT_OF(tempCommand) = 2;
- (CMD_OF(tempCommand))[0] = 44; /* get ping */
- (CMD_OF(tempCommand))[1] = 200; /* 200 ms */
- write_lock_irqsave(&pB->write_fifo_spinlock, flags);
- iiWriteBuf(pB, tempCommand, 4);
- write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
-#endif
-
- iiEnableMailIrq(pB);
- iiSendPendingMail(pB);
-}
-
-/******************************************************************************/
-/* Interrupt Handler Section */
-/******************************************************************************/
-
-static inline void
-service_all_boards(void)
-{
- int i;
- i2eBordStrPtr pB;
-
- /* Service every board on the list */
- for( i = 0; i < IP2_MAX_BOARDS; ++i ) {
- pB = i2BoardPtrTable[i];
- if ( pB ) {
- i2ServiceBoard( pB );
- }
- }
-}
-
-
-/******************************************************************************/
-/* Function: ip2_interrupt_bh(work) */
-/* Parameters: work - pointer to the board structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* Service the board in a bottom half interrupt handler and then */
-/* reenable the board's interrupts if it has an IRQ number */
-/* */
-/******************************************************************************/
-static void
-ip2_interrupt_bh(struct work_struct *work)
-{
- i2eBordStrPtr pB = container_of(work, i2eBordStr, tqueue_interrupt);
-// pB better well be set or we have a problem! We can only get
-// here from the IMMEDIATE queue. Here, we process the boards.
-// Checking pB doesn't cost much and it saves us from the sanity checkers.
-
- bh_counter++;
-
- if ( pB ) {
- i2ServiceBoard( pB );
- if( pB->i2eUsingIrq ) {
-// Re-enable his interrupts
- iiEnableMailIrq(pB);
- }
- }
-}
-
-
-/******************************************************************************/
-/* Function: ip2_interrupt(int irq, void *dev_id) */
-/* Parameters: irq - interrupt number */
-/* pointer to optional device ID structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* Our task here is simply to identify each board which needs servicing. */
-/* If we are queuing then, queue it to be serviced, and disable its irq */
-/* mask otherwise process the board directly. */
-/* */
-/* We could queue by IRQ but that just complicates things on both ends */
-/* with very little gain in performance (how many instructions does */
-/* it take to iterate on the immediate queue). */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_irq_work(i2eBordStrPtr pB)
-{
-#ifdef USE_IQI
- if (NO_MAIL_HERE != ( pB->i2eStartMail = iiGetMail(pB))) {
-// Disable his interrupt (will be enabled when serviced)
-// This is mostly to protect from reentrancy.
- iiDisableMailIrq(pB);
-
-// Park the board on the immediate queue for processing.
- schedule_work(&pB->tqueue_interrupt);
-
-// Make sure the immediate queue is flagged to fire.
- }
-#else
-
-// We are using immediate servicing here. This sucks and can
-// cause all sorts of havoc with ppp and others. The failsafe
-// check on iiSendPendingMail could also throw a hairball.
-
- i2ServiceBoard( pB );
-
-#endif /* USE_IQI */
-}
-
-static void
-ip2_polled_interrupt(void)
-{
- int i;
- i2eBordStrPtr pB;
-
- ip2trace(ITRC_NO_PORT, ITRC_INTR, 99, 1, 0);
-
- /* Service just the boards on the list using this irq */
- for( i = 0; i < i2nBoards; ++i ) {
- pB = i2BoardPtrTable[i];
-
-// Only process those boards which match our IRQ.
-// IRQ = 0 for polled boards, we won't poll "IRQ" boards
-
- if (pB && pB->i2eUsingIrq == 0)
- ip2_irq_work(pB);
- }
-
- ++irq_counter;
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 );
-}
-
-static irqreturn_t
-ip2_interrupt(int irq, void *dev_id)
-{
- i2eBordStrPtr pB = dev_id;
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, pB->i2eUsingIrq );
-
- ip2_irq_work(pB);
-
- ++irq_counter;
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 );
- return IRQ_HANDLED;
-}
-
-/******************************************************************************/
-/* Function: ip2_poll(unsigned long arg) */
-/* Parameters: ? */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This function calls the library routine i2ServiceBoard for each board in */
-/* the board table. This is used instead of the interrupt routine when polled */
-/* mode is specified. */
-/******************************************************************************/
-static void
-ip2_poll(unsigned long arg)
-{
- ip2trace (ITRC_NO_PORT, ITRC_INTR, 100, 0 );
-
- // Just polled boards, IRQ = 0 will hit all non-interrupt boards.
- // It will NOT poll boards handled by hard interrupts.
- // The issue of queued BH interrupts is handled in ip2_interrupt().
- ip2_polled_interrupt();
-
- mod_timer(&PollTimer, POLL_TIMEOUT);
-
- ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 );
-}
-
-static void do_input(struct work_struct *work)
-{
- i2ChanStrPtr pCh = container_of(work, i2ChanStr, tqueue_input);
- unsigned long flags;
-
- ip2trace(CHANN, ITRC_INPUT, 21, 0 );
-
- // Data input
- if ( pCh->pTTY != NULL ) {
- read_lock_irqsave(&pCh->Ibuf_spinlock, flags);
- if (!pCh->throttled && (pCh->Ibuf_stuff != pCh->Ibuf_strip)) {
- read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- i2Input( pCh );
- } else
- read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
- } else {
- ip2trace(CHANN, ITRC_INPUT, 22, 0 );
-
- i2InputFlush( pCh );
- }
-}
-
-// code duplicated from n_tty (ldisc)
-static inline void isig(int sig, struct tty_struct *tty, int flush)
-{
- /* FIXME: This is completely bogus */
- if (tty->pgrp)
- kill_pgrp(tty->pgrp, sig, 1);
- if (flush || !L_NOFLSH(tty)) {
- if ( tty->ldisc->ops->flush_buffer )
- tty->ldisc->ops->flush_buffer(tty);
- i2InputFlush( tty->driver_data );
- }
-}
-
-static void do_status(struct work_struct *work)
-{
- i2ChanStrPtr pCh = container_of(work, i2ChanStr, tqueue_status);
- int status;
-
- status = i2GetStatus( pCh, (I2_BRK|I2_PAR|I2_FRA|I2_OVR) );
-
- ip2trace (CHANN, ITRC_STATUS, 21, 1, status );
-
- if (pCh->pTTY && (status & (I2_BRK|I2_PAR|I2_FRA|I2_OVR)) ) {
- if ( (status & I2_BRK) ) {
- // code duplicated from n_tty (ldisc)
- if (I_IGNBRK(pCh->pTTY))
- goto skip_this;
- if (I_BRKINT(pCh->pTTY)) {
- isig(SIGINT, pCh->pTTY, 1);
- goto skip_this;
- }
- wake_up_interruptible(&pCh->pTTY->read_wait);
- }
-#ifdef NEVER_HAPPENS_AS_SETUP_XXX
- // and can't work because we don't know the_char
- // as the_char is reported on a separate path
- // The intelligent board does this stuff as setup
- {
- char brkf = TTY_NORMAL;
- unsigned char brkc = '\0';
- unsigned char tmp;
- if ( (status & I2_BRK) ) {
- brkf = TTY_BREAK;
- brkc = '\0';
- }
- else if (status & I2_PAR) {
- brkf = TTY_PARITY;
- brkc = the_char;
- } else if (status & I2_FRA) {
- brkf = TTY_FRAME;
- brkc = the_char;
- } else if (status & I2_OVR) {
- brkf = TTY_OVERRUN;
- brkc = the_char;
- }
- tmp = pCh->pTTY->real_raw;
- pCh->pTTY->real_raw = 0;
- pCh->pTTY->ldisc->ops.receive_buf( pCh->pTTY, &brkc, &brkf, 1 );
- pCh->pTTY->real_raw = tmp;
- }
-#endif /* NEVER_HAPPENS_AS_SETUP_XXX */
- }
-skip_this:
-
- if ( status & (I2_DDCD | I2_DDSR | I2_DCTS | I2_DRI) ) {
- wake_up_interruptible(&pCh->delta_msr_wait);
-
- if ( (pCh->flags & ASYNC_CHECK_CD) && (status & I2_DDCD) ) {
- if ( status & I2_DCD ) {
- if ( pCh->wopen ) {
- wake_up_interruptible ( &pCh->open_wait );
- }
- } else {
- if (pCh->pTTY && (!(pCh->pTTY->termios->c_cflag & CLOCAL)) ) {
- tty_hangup( pCh->pTTY );
- }
- }
- }
- }
-
- ip2trace (CHANN, ITRC_STATUS, 26, 0 );
-}
-
-/******************************************************************************/
-/* Device Open/Close/Ioctl Entry Point Section */
-/******************************************************************************/
-
-/******************************************************************************/
-/* Function: open_sanity_check() */
-/* Parameters: Pointer to tty structure */
-/* Pointer to file structure */
-/* Returns: Success or failure */
-/* */
-/* Description: */
-/* Verifies the structure magic numbers and cross links. */
-/******************************************************************************/
-#ifdef IP2DEBUG_OPEN
-static void
-open_sanity_check( i2ChanStrPtr pCh, i2eBordStrPtr pBrd )
-{
- if ( pBrd->i2eValid != I2E_MAGIC ) {
- printk(KERN_ERR "IP2: invalid board structure\n" );
- } else if ( pBrd != pCh->pMyBord ) {
- printk(KERN_ERR "IP2: board structure pointer mismatch (%p)\n",
- pCh->pMyBord );
- } else if ( pBrd->i2eChannelCnt < pCh->port_index ) {
- printk(KERN_ERR "IP2: bad device index (%d)\n", pCh->port_index );
- } else if (&((i2ChanStrPtr)pBrd->i2eChannelPtr)[pCh->port_index] != pCh) {
- } else {
- printk(KERN_INFO "IP2: all pointers check out!\n" );
- }
-}
-#endif
-
-
-/******************************************************************************/
-/* Function: ip2_open() */
-/* Parameters: Pointer to tty structure */
-/* Pointer to file structure */
-/* Returns: Success or failure */
-/* */
-/* Description: (MANDATORY) */
-/* A successful device open has to run a gauntlet of checks before it */
-/* completes. After some sanity checking and pointer setup, the function */
-/* blocks until all conditions are satisfied. It then initialises the port to */
-/* the default characteristics and returns. */
-/******************************************************************************/
-static int
-ip2_open( PTTY tty, struct file *pFile )
-{
- wait_queue_t wait;
- int rc = 0;
- int do_clocal = 0;
- i2ChanStrPtr pCh = DevTable[tty->index];
-
- ip2trace (tty->index, ITRC_OPEN, ITRC_ENTER, 0 );
-
- if ( pCh == NULL ) {
- return -ENODEV;
- }
- /* Setup pointer links in device and tty structures */
- pCh->pTTY = tty;
- tty->driver_data = pCh;
-
-#ifdef IP2DEBUG_OPEN
- printk(KERN_DEBUG \
- "IP2:open(tty=%p,pFile=%p):dev=%s,ch=%d,idx=%d\n",
- tty, pFile, tty->name, pCh->infl.hd.i2sChannel, pCh->port_index);
- open_sanity_check ( pCh, pCh->pMyBord );
-#endif
-
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 3, CMD_DTRUP,CMD_RTSUP,CMD_DCD_REP);
- pCh->dataSetOut |= (I2_DTR | I2_RTS);
- serviceOutgoingFifo( pCh->pMyBord );
-
- /* Block here until the port is ready (per serial and istallion) */
- /*
- * 1. If the port is in the middle of closing wait for the completion
- * and then return the appropriate error.
- */
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&pCh->close_wait, &wait);
- set_current_state( TASK_INTERRUPTIBLE );
-
- if ( tty_hung_up_p(pFile) || ( pCh->flags & ASYNC_CLOSING )) {
- if ( pCh->flags & ASYNC_CLOSING ) {
- tty_unlock();
- schedule();
- tty_lock();
- }
- if ( tty_hung_up_p(pFile) ) {
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->close_wait, &wait);
- return( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS;
- }
- }
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->close_wait, &wait);
-
- /*
- * 3. Handle a non-blocking open of a normal port.
- */
- if ( (pFile->f_flags & O_NONBLOCK) || (tty->flags & (1<<TTY_IO_ERROR) )) {
- pCh->flags |= ASYNC_NORMAL_ACTIVE;
- goto noblock;
- }
- /*
- * 4. Now loop waiting for the port to be free and carrier present
- * (if required).
- */
- if ( tty->termios->c_cflag & CLOCAL )
- do_clocal = 1;
-
-#ifdef IP2DEBUG_OPEN
- printk(KERN_DEBUG "OpenBlock: do_clocal = %d\n", do_clocal);
-#endif
-
- ++pCh->wopen;
-
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&pCh->open_wait, &wait);
-
- for(;;) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_DTRUP, CMD_RTSUP);
- pCh->dataSetOut |= (I2_DTR | I2_RTS);
- set_current_state( TASK_INTERRUPTIBLE );
- serviceOutgoingFifo( pCh->pMyBord );
- if ( tty_hung_up_p(pFile) ) {
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->open_wait, &wait);
- return ( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EBUSY : -ERESTARTSYS;
- }
- if (!(pCh->flags & ASYNC_CLOSING) &&
- (do_clocal || (pCh->dataSetIn & I2_DCD) )) {
- rc = 0;
- break;
- }
-
-#ifdef IP2DEBUG_OPEN
- printk(KERN_DEBUG "ASYNC_CLOSING = %s\n",
- (pCh->flags & ASYNC_CLOSING)?"True":"False");
- printk(KERN_DEBUG "OpenBlock: waiting for CD or signal\n");
-#endif
- ip2trace (CHANN, ITRC_OPEN, 3, 2, 0,
- (pCh->flags & ASYNC_CLOSING) );
- /* check for signal */
- if (signal_pending(current)) {
- rc = (( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS);
- break;
- }
- tty_unlock();
- schedule();
- tty_lock();
- }
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->open_wait, &wait);
-
- --pCh->wopen; //why count?
-
- ip2trace (CHANN, ITRC_OPEN, 4, 0 );
-
- if (rc != 0 ) {
- return rc;
- }
- pCh->flags |= ASYNC_NORMAL_ACTIVE;
-
-noblock:
-
- /* first open - Assign termios structure to port */
- if ( tty->count == 1 ) {
- i2QueueCommands(PTYPE_INLINE, pCh, 0, 2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);
- /* Now we must send the termios settings to the loadware */
- set_params( pCh, NULL );
- }
-
- /*
- * Now set any i2lib options. These may go away if the i2lib code ends
- * up rolled into the mainline.
- */
- pCh->channelOptions |= CO_NBLOCK_WRITE;
-
-#ifdef IP2DEBUG_OPEN
- printk (KERN_DEBUG "IP2: open completed\n" );
-#endif
- serviceOutgoingFifo( pCh->pMyBord );
-
- ip2trace (CHANN, ITRC_OPEN, ITRC_RETURN, 0 );
-
- return 0;
-}
-
-/******************************************************************************/
-/* Function: ip2_close() */
-/* Parameters: Pointer to tty structure */
-/* Pointer to file structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_close( PTTY tty, struct file *pFile )
-{
- i2ChanStrPtr pCh = tty->driver_data;
-
- if ( !pCh ) {
- return;
- }
-
- ip2trace (CHANN, ITRC_CLOSE, ITRC_ENTER, 0 );
-
-#ifdef IP2DEBUG_OPEN
- printk(KERN_DEBUG "IP2:close %s:\n",tty->name);
-#endif
-
- if ( tty_hung_up_p ( pFile ) ) {
-
- ip2trace (CHANN, ITRC_CLOSE, 2, 1, 2 );
-
- return;
- }
- if ( tty->count > 1 ) { /* not the last close */
-
- ip2trace (CHANN, ITRC_CLOSE, 2, 1, 3 );
-
- return;
- }
- pCh->flags |= ASYNC_CLOSING; // last close actually
-
- tty->closing = 1;
-
- if (pCh->ClosingWaitTime != ASYNC_CLOSING_WAIT_NONE) {
- /*
- * Before we drop DTR, make sure the transmitter has completely drained.
- * This uses an timeout, after which the close
- * completes.
- */
- ip2_wait_until_sent(tty, pCh->ClosingWaitTime );
- }
- /*
- * At this point we stop accepting input. Here we flush the channel
- * input buffer which will allow the board to send up more data. Any
- * additional input is tossed at interrupt/poll time.
- */
- i2InputFlush( pCh );
-
- /* disable DSS reporting */
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 4,
- CMD_DCD_NREP, CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
- if (tty->termios->c_cflag & HUPCL) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);
- pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
- i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
- }
-
- serviceOutgoingFifo ( pCh->pMyBord );
-
- tty_ldisc_flush(tty);
- tty_driver_flush_buffer(tty);
- tty->closing = 0;
-
- pCh->pTTY = NULL;
-
- if (pCh->wopen) {
- if (pCh->ClosingDelay) {
- msleep_interruptible(jiffies_to_msecs(pCh->ClosingDelay));
- }
- wake_up_interruptible(&pCh->open_wait);
- }
-
- pCh->flags &=~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
- wake_up_interruptible(&pCh->close_wait);
-
-#ifdef IP2DEBUG_OPEN
- DBG_CNT("ip2_close: after wakeups--");
-#endif
-
-
- ip2trace (CHANN, ITRC_CLOSE, ITRC_RETURN, 1, 1 );
-
- return;
-}
-
-/******************************************************************************/
-/* Function: ip2_hangup() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_hangup ( PTTY tty )
-{
- i2ChanStrPtr pCh = tty->driver_data;
-
- if( !pCh ) {
- return;
- }
-
- ip2trace (CHANN, ITRC_HANGUP, ITRC_ENTER, 0 );
-
- ip2_flush_buffer(tty);
-
- /* disable DSS reporting */
-
- i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_DCD_NREP);
- i2QueueCommands(PTYPE_INLINE, pCh, 0, 2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);
- if ( (tty->termios->c_cflag & HUPCL) ) {
- i2QueueCommands(PTYPE_BYPASS, pCh, 0, 2, CMD_RTSDN, CMD_DTRDN);
- pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
- i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
- }
- i2QueueCommands(PTYPE_INLINE, pCh, 1, 3,
- CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
- serviceOutgoingFifo ( pCh->pMyBord );
-
- wake_up_interruptible ( &pCh->delta_msr_wait );
-
- pCh->flags &= ~ASYNC_NORMAL_ACTIVE;
- pCh->pTTY = NULL;
- wake_up_interruptible ( &pCh->open_wait );
-
- ip2trace (CHANN, ITRC_HANGUP, ITRC_RETURN, 0 );
-}
-
-/******************************************************************************/
-/******************************************************************************/
-/* Device Output Section */
-/******************************************************************************/
-/******************************************************************************/
-
-/******************************************************************************/
-/* Function: ip2_write() */
-/* Parameters: Pointer to tty structure */
-/* Flag denoting data is in user (1) or kernel (0) space */
-/* Pointer to data */
-/* Number of bytes to write */
-/* Returns: Number of bytes actually written */
-/* */
-/* Description: (MANDATORY) */
-/* */
-/* */
-/******************************************************************************/
-static int
-ip2_write( PTTY tty, const unsigned char *pData, int count)
-{
- i2ChanStrPtr pCh = tty->driver_data;
- int bytesSent = 0;
- unsigned long flags;
-
- ip2trace (CHANN, ITRC_WRITE, ITRC_ENTER, 2, count, -1 );
-
- /* Flush out any buffered data left over from ip2_putchar() calls. */
- ip2_flush_chars( tty );
-
- /* This is the actual move bit. Make sure it does what we need!!!!! */
- write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- bytesSent = i2Output( pCh, pData, count);
- write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
-
- ip2trace (CHANN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent );
-
- return bytesSent > 0 ? bytesSent : 0;
-}
-
-/******************************************************************************/
-/* Function: ip2_putchar() */
-/* Parameters: Pointer to tty structure */
-/* Character to write */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static int
-ip2_putchar( PTTY tty, unsigned char ch )
-{
- i2ChanStrPtr pCh = tty->driver_data;
- unsigned long flags;
-
-// ip2trace (CHANN, ITRC_PUTC, ITRC_ENTER, 1, ch );
-
- write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- pCh->Pbuf[pCh->Pbuf_stuff++] = ch;
- if ( pCh->Pbuf_stuff == sizeof pCh->Pbuf ) {
- write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
- ip2_flush_chars( tty );
- } else
- write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
- return 1;
-
-// ip2trace (CHANN, ITRC_PUTC, ITRC_RETURN, 1, ch );
-}
-
-/******************************************************************************/
-/* Function: ip2_flush_chars() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/******************************************************************************/
-static void
-ip2_flush_chars( PTTY tty )
-{
- int strip;
- i2ChanStrPtr pCh = tty->driver_data;
- unsigned long flags;
-
- write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- if ( pCh->Pbuf_stuff ) {
-
-// ip2trace (CHANN, ITRC_PUTC, 10, 1, strip );
-
- //
- // We may need to restart i2Output if it does not fullfill this request
- //
- strip = i2Output( pCh, pCh->Pbuf, pCh->Pbuf_stuff);
- if ( strip != pCh->Pbuf_stuff ) {
- memmove( pCh->Pbuf, &pCh->Pbuf[strip], pCh->Pbuf_stuff - strip );
- }
- pCh->Pbuf_stuff -= strip;
- }
- write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
-}
-
-/******************************************************************************/
-/* Function: ip2_write_room() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Number of bytes that the driver can accept */
-/* */
-/* Description: */
-/* */
-/******************************************************************************/
-static int
-ip2_write_room ( PTTY tty )
-{
- int bytesFree;
- i2ChanStrPtr pCh = tty->driver_data;
- unsigned long flags;
-
- read_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- bytesFree = i2OutputFree( pCh ) - pCh->Pbuf_stuff;
- read_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
-
- ip2trace (CHANN, ITRC_WRITE, 11, 1, bytesFree );
-
- return ((bytesFree > 0) ? bytesFree : 0);
-}
-
-/******************************************************************************/
-/* Function: ip2_chars_in_buf() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Number of bytes queued for transmission */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static int
-ip2_chars_in_buf ( PTTY tty )
-{
- i2ChanStrPtr pCh = tty->driver_data;
- int rc;
- unsigned long flags;
-
- ip2trace (CHANN, ITRC_WRITE, 12, 1, pCh->Obuf_char_count + pCh->Pbuf_stuff );
-
-#ifdef IP2DEBUG_WRITE
- printk (KERN_DEBUG "IP2: chars in buffer = %d (%d,%d)\n",
- pCh->Obuf_char_count + pCh->Pbuf_stuff,
- pCh->Obuf_char_count, pCh->Pbuf_stuff );
-#endif
- read_lock_irqsave(&pCh->Obuf_spinlock, flags);
- rc = pCh->Obuf_char_count;
- read_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
- read_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- rc += pCh->Pbuf_stuff;
- read_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
- return rc;
-}
-
-/******************************************************************************/
-/* Function: ip2_flush_buffer() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_flush_buffer( PTTY tty )
-{
- i2ChanStrPtr pCh = tty->driver_data;
- unsigned long flags;
-
- ip2trace (CHANN, ITRC_FLUSH, ITRC_ENTER, 0 );
-
-#ifdef IP2DEBUG_WRITE
- printk (KERN_DEBUG "IP2: flush buffer\n" );
-#endif
- write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
- pCh->Pbuf_stuff = 0;
- write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
- i2FlushOutput( pCh );
- ip2_owake(tty);
-
- ip2trace (CHANN, ITRC_FLUSH, ITRC_RETURN, 0 );
-
-}
-
-/******************************************************************************/
-/* Function: ip2_wait_until_sent() */
-/* Parameters: Pointer to tty structure */
-/* Timeout for wait. */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This function is used in place of the normal tty_wait_until_sent, which */
-/* only waits for the driver buffers to be empty (or rather, those buffers */
-/* reported by chars_in_buffer) which doesn't work for IP2 due to the */
-/* indeterminate number of bytes buffered on the board. */
-/******************************************************************************/
-static void
-ip2_wait_until_sent ( PTTY tty, int timeout )
-{
- int i = jiffies;
- i2ChanStrPtr pCh = tty->driver_data;
-
- tty_wait_until_sent(tty, timeout );
- if ( (i = timeout - (jiffies -i)) > 0)
- i2DrainOutput( pCh, i );
-}
-
-/******************************************************************************/
-/******************************************************************************/
-/* Device Input Section */
-/******************************************************************************/
-/******************************************************************************/
-
-/******************************************************************************/
-/* Function: ip2_throttle() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_throttle ( PTTY tty )
-{
- i2ChanStrPtr pCh = tty->driver_data;
-
-#ifdef IP2DEBUG_READ
- printk (KERN_DEBUG "IP2: throttle\n" );
-#endif
- /*
- * Signal the poll/interrupt handlers not to forward incoming data to
- * the line discipline. This will cause the buffers to fill up in the
- * library and thus cause the library routines to send the flow control
- * stuff.
- */
- pCh->throttled = 1;
-}
-
-/******************************************************************************/
-/* Function: ip2_unthrottle() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_unthrottle ( PTTY tty )
-{
- i2ChanStrPtr pCh = tty->driver_data;
- unsigned long flags;
-
-#ifdef IP2DEBUG_READ
- printk (KERN_DEBUG "IP2: unthrottle\n" );
-#endif
-
- /* Pass incoming data up to the line discipline again. */
- pCh->throttled = 0;
- i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME);
- serviceOutgoingFifo( pCh->pMyBord );
- read_lock_irqsave(&pCh->Ibuf_spinlock, flags);
- if ( pCh->Ibuf_stuff != pCh->Ibuf_strip ) {
- read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
-#ifdef IP2DEBUG_READ
- printk (KERN_DEBUG "i2Input called from unthrottle\n" );
-#endif
- i2Input( pCh );
- } else
- read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
-}
-
-static void
-ip2_start ( PTTY tty )
-{
- i2ChanStrPtr pCh = DevTable[tty->index];
-
- i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME);
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_UNSUSPEND);
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_RESUME);
-#ifdef IP2DEBUG_WRITE
- printk (KERN_DEBUG "IP2: start tx\n" );
-#endif
-}
-
-static void
-ip2_stop ( PTTY tty )
-{
- i2ChanStrPtr pCh = DevTable[tty->index];
-
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_SUSPEND);
-#ifdef IP2DEBUG_WRITE
- printk (KERN_DEBUG "IP2: stop tx\n" );
-#endif
-}
-
-/******************************************************************************/
-/* Device Ioctl Section */
-/******************************************************************************/
-
-static int ip2_tiocmget(struct tty_struct *tty)
-{
- i2ChanStrPtr pCh = DevTable[tty->index];
-#ifdef ENABLE_DSSNOW
- wait_queue_t wait;
-#endif
-
- if (pCh == NULL)
- return -ENODEV;
-
-/*
- FIXME - the following code is causing a NULL pointer dereference in
- 2.3.51 in an interrupt handler. It's suppose to prompt the board
- to return the DSS signal status immediately. Why doesn't it do
- the same thing in 2.2.14?
-*/
-
-/* This thing is still busted in the 1.2.12 driver on 2.4.x
- and even hoses the serial console so the oops can be trapped.
- /\/\|=mhw=|\/\/ */
-
-#ifdef ENABLE_DSSNOW
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DSS_NOW);
-
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&pCh->dss_now_wait, &wait);
- set_current_state( TASK_INTERRUPTIBLE );
-
- serviceOutgoingFifo( pCh->pMyBord );
-
- schedule();
-
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->dss_now_wait, &wait);
-
- if (signal_pending(current)) {
- return -EINTR;
- }
-#endif
- return ((pCh->dataSetOut & I2_RTS) ? TIOCM_RTS : 0)
- | ((pCh->dataSetOut & I2_DTR) ? TIOCM_DTR : 0)
- | ((pCh->dataSetIn & I2_DCD) ? TIOCM_CAR : 0)
- | ((pCh->dataSetIn & I2_RI) ? TIOCM_RNG : 0)
- | ((pCh->dataSetIn & I2_DSR) ? TIOCM_DSR : 0)
- | ((pCh->dataSetIn & I2_CTS) ? TIOCM_CTS : 0);
-}
-
-static int ip2_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear)
-{
- i2ChanStrPtr pCh = DevTable[tty->index];
-
- if (pCh == NULL)
- return -ENODEV;
-
- if (set & TIOCM_RTS) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_RTSUP);
- pCh->dataSetOut |= I2_RTS;
- }
- if (set & TIOCM_DTR) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DTRUP);
- pCh->dataSetOut |= I2_DTR;
- }
-
- if (clear & TIOCM_RTS) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_RTSDN);
- pCh->dataSetOut &= ~I2_RTS;
- }
- if (clear & TIOCM_DTR) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DTRDN);
- pCh->dataSetOut &= ~I2_DTR;
- }
- serviceOutgoingFifo( pCh->pMyBord );
- return 0;
-}
-
-/******************************************************************************/
-/* Function: ip2_ioctl() */
-/* Parameters: Pointer to tty structure */
-/* Pointer to file structure */
-/* Command */
-/* Argument */
-/* Returns: Success or failure */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static int
-ip2_ioctl ( PTTY tty, UINT cmd, ULONG arg )
-{
- wait_queue_t wait;
- i2ChanStrPtr pCh = DevTable[tty->index];
- i2eBordStrPtr pB;
- struct async_icount cprev, cnow; /* kernel counter temps */
- int rc = 0;
- unsigned long flags;
- void __user *argp = (void __user *)arg;
-
- if ( pCh == NULL )
- return -ENODEV;
-
- pB = pCh->pMyBord;
-
- ip2trace (CHANN, ITRC_IOCTL, ITRC_ENTER, 2, cmd, arg );
-
-#ifdef IP2DEBUG_IOCTL
- printk(KERN_DEBUG "IP2: ioctl cmd (%x), arg (%lx)\n", cmd, arg );
-#endif
-
- switch(cmd) {
- case TIOCGSERIAL:
-
- ip2trace (CHANN, ITRC_IOCTL, 2, 1, rc );
-
- rc = get_serial_info(pCh, argp);
- if (rc)
- return rc;
- break;
-
- case TIOCSSERIAL:
-
- ip2trace (CHANN, ITRC_IOCTL, 3, 1, rc );
-
- rc = set_serial_info(pCh, argp);
- if (rc)
- return rc;
- break;
-
- case TCXONC:
- rc = tty_check_change(tty);
- if (rc)
- return rc;
- switch (arg) {
- case TCOOFF:
- //return -ENOIOCTLCMD;
- break;
- case TCOON:
- //return -ENOIOCTLCMD;
- break;
- case TCIOFF:
- if (STOP_CHAR(tty) != __DISABLED_CHAR) {
- i2QueueCommands( PTYPE_BYPASS, pCh, 100, 1,
- CMD_XMIT_NOW(STOP_CHAR(tty)));
- }
- break;
- case TCION:
- if (START_CHAR(tty) != __DISABLED_CHAR) {
- i2QueueCommands( PTYPE_BYPASS, pCh, 100, 1,
- CMD_XMIT_NOW(START_CHAR(tty)));
- }
- break;
- default:
- return -EINVAL;
- }
- return 0;
-
- case TCSBRK: /* SVID version: non-zero arg --> no break */
- rc = tty_check_change(tty);
-
- ip2trace (CHANN, ITRC_IOCTL, 4, 1, rc );
-
- if (!rc) {
- ip2_wait_until_sent(tty,0);
- if (!arg) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_SEND_BRK(250));
- serviceOutgoingFifo( pCh->pMyBord );
- }
- }
- break;
-
- case TCSBRKP: /* support for POSIX tcsendbreak() */
- rc = tty_check_change(tty);
-
- ip2trace (CHANN, ITRC_IOCTL, 5, 1, rc );
-
- if (!rc) {
- ip2_wait_until_sent(tty,0);
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1,
- CMD_SEND_BRK(arg ? arg*100 : 250));
- serviceOutgoingFifo ( pCh->pMyBord );
- }
- break;
-
- case TIOCGSOFTCAR:
-
- ip2trace (CHANN, ITRC_IOCTL, 6, 1, rc );
-
- rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp);
- if (rc)
- return rc;
- break;
-
- case TIOCSSOFTCAR:
-
- ip2trace (CHANN, ITRC_IOCTL, 7, 1, rc );
-
- rc = get_user(arg,(unsigned long __user *) argp);
- if (rc)
- return rc;
- tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL)
- | (arg ? CLOCAL : 0));
-
- break;
-
- /*
- * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change - mask
- * passed in arg for lines of interest (use |'ed TIOCM_RNG/DSR/CD/CTS
- * for masking). Caller should use TIOCGICOUNT to see which one it was
- */
- case TIOCMIWAIT:
- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
- cprev = pCh->icount; /* note the counters on entry */
- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4,
- CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP);
- init_waitqueue_entry(&wait, current);
- add_wait_queue(&pCh->delta_msr_wait, &wait);
- set_current_state( TASK_INTERRUPTIBLE );
-
- serviceOutgoingFifo( pCh->pMyBord );
- for(;;) {
- ip2trace (CHANN, ITRC_IOCTL, 10, 0 );
-
- schedule();
-
- ip2trace (CHANN, ITRC_IOCTL, 11, 0 );
-
- /* see if a signal did it */
- if (signal_pending(current)) {
- rc = -ERESTARTSYS;
- break;
- }
- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
- cnow = pCh->icount; /* atomic copy */
- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
- if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
- cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
- rc = -EIO; /* no change => rc */
- break;
- }
- if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
- ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
- ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
- ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) {
- rc = 0;
- break;
- }
- cprev = cnow;
- }
- set_current_state( TASK_RUNNING );
- remove_wait_queue(&pCh->delta_msr_wait, &wait);
-
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 3,
- CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
- if ( ! (pCh->flags & ASYNC_CHECK_CD)) {
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DCD_NREP);
- }
- serviceOutgoingFifo( pCh->pMyBord );
- return rc;
- break;
-
- /*
- * The rest are not supported by this driver. By returning -ENOIOCTLCMD they
- * will be passed to the line discipline for it to handle.
- */
- case TIOCSERCONFIG:
- case TIOCSERGWILD:
- case TIOCSERGETLSR:
- case TIOCSERSWILD:
- case TIOCSERGSTRUCT:
- case TIOCSERGETMULTI:
- case TIOCSERSETMULTI:
-
- default:
- ip2trace (CHANN, ITRC_IOCTL, 12, 0 );
-
- rc = -ENOIOCTLCMD;
- break;
- }
-
- ip2trace (CHANN, ITRC_IOCTL, ITRC_RETURN, 0 );
-
- return rc;
-}
-
-static int ip2_get_icount(struct tty_struct *tty,
- struct serial_icounter_struct *icount)
-{
- i2ChanStrPtr pCh = DevTable[tty->index];
- i2eBordStrPtr pB;
- struct async_icount cnow; /* kernel counter temp */
- unsigned long flags;
-
- if ( pCh == NULL )
- return -ENODEV;
-
- pB = pCh->pMyBord;
-
- /*
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
- * Return: write counters to the user passed counter struct
- * NB: both 1->0 and 0->1 transitions are counted except for RI where
- * only 0->1 is counted. The controller is quite capable of counting
- * both, but this done to preserve compatibility with the standard
- * serial driver.
- */
-
- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
- cnow = pCh->icount;
- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
-
- icount->cts = cnow.cts;
- icount->dsr = cnow.dsr;
- icount->rng = cnow.rng;
- icount->dcd = cnow.dcd;
- icount->rx = cnow.rx;
- icount->tx = cnow.tx;
- icount->frame = cnow.frame;
- icount->overrun = cnow.overrun;
- icount->parity = cnow.parity;
- icount->brk = cnow.brk;
- icount->buf_overrun = cnow.buf_overrun;
- return 0;
-}
-
-/******************************************************************************/
-/* Function: GetSerialInfo() */
-/* Parameters: Pointer to channel structure */
-/* Pointer to old termios structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This is to support the setserial command, and requires processing of the */
-/* standard Linux serial structure. */
-/******************************************************************************/
-static int
-get_serial_info ( i2ChanStrPtr pCh, struct serial_struct __user *retinfo )
-{
- struct serial_struct tmp;
-
- memset ( &tmp, 0, sizeof(tmp) );
- tmp.type = pCh->pMyBord->channelBtypes.bid_value[(pCh->port_index & (IP2_PORTS_PER_BOARD-1))/16];
- if (BID_HAS_654(tmp.type)) {
- tmp.type = PORT_16650;
- } else {
- tmp.type = PORT_CIRRUS;
- }
- tmp.line = pCh->port_index;
- tmp.port = pCh->pMyBord->i2eBase;
- tmp.irq = ip2config.irq[pCh->port_index/64];
- tmp.flags = pCh->flags;
- tmp.baud_base = pCh->BaudBase;
- tmp.close_delay = pCh->ClosingDelay;
- tmp.closing_wait = pCh->ClosingWaitTime;
- tmp.custom_divisor = pCh->BaudDivisor;
- return copy_to_user(retinfo,&tmp,sizeof(*retinfo));
-}
-
-/******************************************************************************/
-/* Function: SetSerialInfo() */
-/* Parameters: Pointer to channel structure */
-/* Pointer to old termios structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This function provides support for setserial, which uses the TIOCSSERIAL */
-/* ioctl. Not all setserial parameters are relevant. If the user attempts to */
-/* change the IRQ, address or type of the port the ioctl fails. */
-/******************************************************************************/
-static int
-set_serial_info( i2ChanStrPtr pCh, struct serial_struct __user *new_info )
-{
- struct serial_struct ns;
- int old_flags, old_baud_divisor;
-
- if (copy_from_user(&ns, new_info, sizeof (ns)))
- return -EFAULT;
-
- /*
- * We don't allow setserial to change IRQ, board address, type or baud
- * base. Also line nunber as such is meaningless but we use it for our
- * array index so it is fixed also.
- */
- if ( (ns.irq != ip2config.irq[pCh->port_index])
- || ((int) ns.port != ((int) (pCh->pMyBord->i2eBase)))
- || (ns.baud_base != pCh->BaudBase)
- || (ns.line != pCh->port_index) ) {
- return -EINVAL;
- }
-
- old_flags = pCh->flags;
- old_baud_divisor = pCh->BaudDivisor;
-
- if ( !capable(CAP_SYS_ADMIN) ) {
- if ( ( ns.close_delay != pCh->ClosingDelay ) ||
- ( (ns.flags & ~ASYNC_USR_MASK) !=
- (pCh->flags & ~ASYNC_USR_MASK) ) ) {
- return -EPERM;
- }
-
- pCh->flags = (pCh->flags & ~ASYNC_USR_MASK) |
- (ns.flags & ASYNC_USR_MASK);
- pCh->BaudDivisor = ns.custom_divisor;
- } else {
- pCh->flags = (pCh->flags & ~ASYNC_FLAGS) |
- (ns.flags & ASYNC_FLAGS);
- pCh->BaudDivisor = ns.custom_divisor;
- pCh->ClosingDelay = ns.close_delay * HZ/100;
- pCh->ClosingWaitTime = ns.closing_wait * HZ/100;
- }
-
- if ( ( (old_flags & ASYNC_SPD_MASK) != (pCh->flags & ASYNC_SPD_MASK) )
- || (old_baud_divisor != pCh->BaudDivisor) ) {
- // Invalidate speed and reset parameters
- set_params( pCh, NULL );
- }
-
- return 0;
-}
-
-/******************************************************************************/
-/* Function: ip2_set_termios() */
-/* Parameters: Pointer to tty structure */
-/* Pointer to old termios structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_set_termios( PTTY tty, struct ktermios *old_termios )
-{
- i2ChanStrPtr pCh = (i2ChanStrPtr)tty->driver_data;
-
-#ifdef IP2DEBUG_IOCTL
- printk (KERN_DEBUG "IP2: set termios %p\n", old_termios );
-#endif
-
- set_params( pCh, old_termios );
-}
-
-/******************************************************************************/
-/* Function: ip2_set_line_discipline() */
-/* Parameters: Pointer to tty structure */
-/* Returns: Nothing */
-/* */
-/* Description: Does nothing */
-/* */
-/* */
-/******************************************************************************/
-static void
-ip2_set_line_discipline ( PTTY tty )
-{
-#ifdef IP2DEBUG_IOCTL
- printk (KERN_DEBUG "IP2: set line discipline\n" );
-#endif
-
- ip2trace (((i2ChanStrPtr)tty->driver_data)->port_index, ITRC_IOCTL, 16, 0 );
-
-}
-
-/******************************************************************************/
-/* Function: SetLine Characteristics() */
-/* Parameters: Pointer to channel structure */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* This routine is called to update the channel structure with the new line */
-/* characteristics, and send the appropriate commands to the board when they */
-/* change. */
-/******************************************************************************/
-static void
-set_params( i2ChanStrPtr pCh, struct ktermios *o_tios )
-{
- tcflag_t cflag, iflag, lflag;
- char stop_char, start_char;
- struct ktermios dummy;
-
- lflag = pCh->pTTY->termios->c_lflag;
- cflag = pCh->pTTY->termios->c_cflag;
- iflag = pCh->pTTY->termios->c_iflag;
-
- if (o_tios == NULL) {
- dummy.c_lflag = ~lflag;
- dummy.c_cflag = ~cflag;
- dummy.c_iflag = ~iflag;
- o_tios = &dummy;
- }
-
- {
- switch ( cflag & CBAUD ) {
- case B0:
- i2QueueCommands( PTYPE_BYPASS, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);
- pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
- i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
- pCh->pTTY->termios->c_cflag |= (CBAUD & o_tios->c_cflag);
- goto service_it;
- break;
- case B38400:
- /*
- * This is the speed that is overloaded with all the other high
- * speeds, depending upon the flag settings.
- */
- if ( ( pCh->flags & ASYNC_SPD_MASK ) == ASYNC_SPD_HI ) {
- pCh->speed = CBR_57600;
- } else if ( (pCh->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI ) {
- pCh->speed = CBR_115200;
- } else if ( (pCh->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST ) {
- pCh->speed = CBR_C1;
- } else {
- pCh->speed = CBR_38400;
- }
- break;
- case B50: pCh->speed = CBR_50; break;
- case B75: pCh->speed = CBR_75; break;
- case B110: pCh->speed = CBR_110; break;
- case B134: pCh->speed = CBR_134; break;
- case B150: pCh->speed = CBR_150; break;
- case B200: pCh->speed = CBR_200; break;
- case B300: pCh->speed = CBR_300; break;
- case B600: pCh->speed = CBR_600; break;
- case B1200: pCh->speed = CBR_1200; break;
- case B1800: pCh->speed = CBR_1800; break;
- case B2400: pCh->speed = CBR_2400; break;
- case B4800: pCh->speed = CBR_4800; break;
- case B9600: pCh->speed = CBR_9600; break;
- case B19200: pCh->speed = CBR_19200; break;
- case B57600: pCh->speed = CBR_57600; break;
- case B115200: pCh->speed = CBR_115200; break;
- case B153600: pCh->speed = CBR_153600; break;
- case B230400: pCh->speed = CBR_230400; break;
- case B307200: pCh->speed = CBR_307200; break;
- case B460800: pCh->speed = CBR_460800; break;
- case B921600: pCh->speed = CBR_921600; break;
- default: pCh->speed = CBR_9600; break;
- }
- if ( pCh->speed == CBR_C1 ) {
- // Process the custom speed parameters.
- int bps = pCh->BaudBase / pCh->BaudDivisor;
- if ( bps == 921600 ) {
- pCh->speed = CBR_921600;
- } else {
- bps = bps/10;
- i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_BAUD_DEF1(bps) );
- }
- }
- i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_SETBAUD(pCh->speed));
-
- i2QueueCommands ( PTYPE_INLINE, pCh, 100, 2, CMD_DTRUP, CMD_RTSUP);
- pCh->dataSetOut |= (I2_DTR | I2_RTS);
- }
- if ( (CSTOPB & cflag) ^ (CSTOPB & o_tios->c_cflag))
- {
- i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1,
- CMD_SETSTOP( ( cflag & CSTOPB ) ? CST_2 : CST_1));
- }
- if (((PARENB|PARODD) & cflag) ^ ((PARENB|PARODD) & o_tios->c_cflag))
- {
- i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1,
- CMD_SETPAR(
- (cflag & PARENB ? (cflag & PARODD ? CSP_OD : CSP_EV) : CSP_NP)
- )
- );
- }
- /* byte size and parity */
- if ( (CSIZE & cflag)^(CSIZE & o_tios->c_cflag))
- {
- int datasize;
- switch ( cflag & CSIZE ) {
- case CS5: datasize = CSZ_5; break;
- case CS6: datasize = CSZ_6; break;
- case CS7: datasize = CSZ_7; break;
- case CS8: datasize = CSZ_8; break;
- default: datasize = CSZ_5; break; /* as per serial.c */
- }
- i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1, CMD_SETBITS(datasize) );
- }
- /* Process CTS flow control flag setting */
- if ( (cflag & CRTSCTS) ) {
- i2QueueCommands(PTYPE_INLINE, pCh, 100,
- 2, CMD_CTSFL_ENAB, CMD_RTSFL_ENAB);
- } else {
- i2QueueCommands(PTYPE_INLINE, pCh, 100,
- 2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);
- }
- //
- // Process XON/XOFF flow control flags settings
- //
- stop_char = STOP_CHAR(pCh->pTTY);
- start_char = START_CHAR(pCh->pTTY);
-
- //////////// can't be \000
- if (stop_char == __DISABLED_CHAR )
- {
- stop_char = ~__DISABLED_CHAR;
- }
- if (start_char == __DISABLED_CHAR )
- {
- start_char = ~__DISABLED_CHAR;
- }
- /////////////////////////////////
-
- if ( o_tios->c_cc[VSTART] != start_char )
- {
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DEF_IXON(start_char));
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DEF_OXON(start_char));
- }
- if ( o_tios->c_cc[VSTOP] != stop_char )
- {
- i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DEF_IXOFF(stop_char));
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DEF_OXOFF(stop_char));
- }
- if (stop_char == __DISABLED_CHAR )
- {
- stop_char = ~__DISABLED_CHAR; //TEST123
- goto no_xoff;
- }
- if ((iflag & (IXOFF))^(o_tios->c_iflag & (IXOFF)))
- {
- if ( iflag & IXOFF ) { // Enable XOFF output flow control
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_OXON_OPT(COX_XON));
- } else { // Disable XOFF output flow control
-no_xoff:
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_OXON_OPT(COX_NONE));
- }
- }
- if (start_char == __DISABLED_CHAR )
- {
- goto no_xon;
- }
- if ((iflag & (IXON|IXANY)) ^ (o_tios->c_iflag & (IXON|IXANY)))
- {
- if ( iflag & IXON ) {
- if ( iflag & IXANY ) { // Enable XON/XANY output flow control
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_XANY));
- } else { // Enable XON output flow control
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_XON));
- }
- } else { // Disable XON output flow control
-no_xon:
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_NONE));
- }
- }
- if ( (iflag & ISTRIP) ^ ( o_tios->c_iflag & (ISTRIP)) )
- {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1,
- CMD_ISTRIP_OPT((iflag & ISTRIP ? 1 : 0)));
- }
- if ( (iflag & INPCK) ^ ( o_tios->c_iflag & (INPCK)) )
- {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1,
- CMD_PARCHK((iflag & INPCK) ? CPK_ENAB : CPK_DSAB));
- }
-
- if ( (iflag & (IGNBRK|PARMRK|BRKINT|IGNPAR))
- ^ ( o_tios->c_iflag & (IGNBRK|PARMRK|BRKINT|IGNPAR)) )
- {
- char brkrpt = 0;
- char parrpt = 0;
-
- if ( iflag & IGNBRK ) { /* Ignore breaks altogether */
- /* Ignore breaks altogether */
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_BRK_NREP);
- } else {
- if ( iflag & BRKINT ) {
- if ( iflag & PARMRK ) {
- brkrpt = 0x0a; // exception an inline triple
- } else {
- brkrpt = 0x1a; // exception and NULL
- }
- brkrpt |= 0x04; // flush input
- } else {
- if ( iflag & PARMRK ) {
- brkrpt = 0x0b; //POSIX triple \0377 \0 \0
- } else {
- brkrpt = 0x01; // Null only
- }
- }
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_BRK_REP(brkrpt));
- }
-
- if (iflag & IGNPAR) {
- parrpt = 0x20;
- /* would be 2 for not cirrus bug */
- /* would be 0x20 cept for cirrus bug */
- } else {
- if ( iflag & PARMRK ) {
- /*
- * Replace error characters with 3-byte sequence (\0377,\0,char)
- */
- parrpt = 0x04 ;
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_ISTRIP_OPT((char)0));
- } else {
- parrpt = 0x03;
- }
- }
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_SET_ERROR(parrpt));
- }
- if (cflag & CLOCAL) {
- // Status reporting fails for DCD if this is off
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DCD_NREP);
- pCh->flags &= ~ASYNC_CHECK_CD;
- } else {
- i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DCD_REP);
- pCh->flags |= ASYNC_CHECK_CD;
- }
-
-service_it:
- i2DrainOutput( pCh, 100 );
-}
-
-/******************************************************************************/
-/* IPL Device Section */
-/******************************************************************************/
-
-/******************************************************************************/
-/* Function: ip2_ipl_read() */
-/* Parameters: Pointer to device inode */
-/* Pointer to file structure */
-/* Pointer to data */
-/* Number of bytes to read */
-/* Returns: Success or failure */
-/* */
-/* Description: Ugly */
-/* */
-/* */
-/******************************************************************************/
-
-static
-ssize_t
-ip2_ipl_read(struct file *pFile, char __user *pData, size_t count, loff_t *off )
-{
- unsigned int minor = iminor(pFile->f_path.dentry->d_inode);
- int rc = 0;
-
-#ifdef IP2DEBUG_IPL
- printk (KERN_DEBUG "IP2IPL: read %p, %d bytes\n", pData, count );
-#endif
-
- switch( minor ) {
- case 0: // IPL device
- rc = -EINVAL;
- break;
- case 1: // Status dump
- rc = -EINVAL;
- break;
- case 2: // Ping device
- rc = -EINVAL;
- break;
- case 3: // Trace device
- rc = DumpTraceBuffer ( pData, count );
- break;
- case 4: // Trace device
- rc = DumpFifoBuffer ( pData, count );
- break;
- default:
- rc = -ENODEV;
- break;
- }
- return rc;
-}
-
-static int
-DumpFifoBuffer ( char __user *pData, int count )
-{
-#ifdef DEBUG_FIFO
- int rc;
- rc = copy_to_user(pData, DBGBuf, count);
-
- printk(KERN_DEBUG "Last index %d\n", I );
-
- return count;
-#endif /* DEBUG_FIFO */
- return 0;
-}
-
-static int
-DumpTraceBuffer ( char __user *pData, int count )
-{
-#ifdef IP2DEBUG_TRACE
- int rc;
- int dumpcount;
- int chunk;
- int *pIndex = (int __user *)pData;
-
- if ( count < (sizeof(int) * 6) ) {
- return -EIO;
- }
- rc = put_user(tracewrap, pIndex );
- rc = put_user(TRACEMAX, ++pIndex );
- rc = put_user(tracestrip, ++pIndex );
- rc = put_user(tracestuff, ++pIndex );
- pData += sizeof(int) * 6;
- count -= sizeof(int) * 6;
-
- dumpcount = tracestuff - tracestrip;
- if ( dumpcount < 0 ) {
- dumpcount += TRACEMAX;
- }
- if ( dumpcount > count ) {
- dumpcount = count;
- }
- chunk = TRACEMAX - tracestrip;
- if ( dumpcount > chunk ) {
- rc = copy_to_user(pData, &tracebuf[tracestrip],
- chunk * sizeof(tracebuf[0]) );
- pData += chunk * sizeof(tracebuf[0]);
- tracestrip = 0;
- chunk = dumpcount - chunk;
- } else {
- chunk = dumpcount;
- }
- rc = copy_to_user(pData, &tracebuf[tracestrip],
- chunk * sizeof(tracebuf[0]) );
- tracestrip += chunk;
- tracewrap = 0;
-
- rc = put_user(tracestrip, ++pIndex );
- rc = put_user(tracestuff, ++pIndex );
-
- return dumpcount;
-#else
- return 0;
-#endif
-}
-
-/******************************************************************************/
-/* Function: ip2_ipl_write() */
-/* Parameters: */
-/* Pointer to file structure */
-/* Pointer to data */
-/* Number of bytes to write */
-/* Returns: Success or failure */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static ssize_t
-ip2_ipl_write(struct file *pFile, const char __user *pData, size_t count, loff_t *off)
-{
-#ifdef IP2DEBUG_IPL
- printk (KERN_DEBUG "IP2IPL: write %p, %d bytes\n", pData, count );
-#endif
- return 0;
-}
-
-/******************************************************************************/
-/* Function: ip2_ipl_ioctl() */
-/* Parameters: Pointer to device inode */
-/* Pointer to file structure */
-/* Command */
-/* Argument */
-/* Returns: Success or failure */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static long
-ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
-{
- unsigned int iplminor = iminor(pFile->f_path.dentry->d_inode);
- int rc = 0;
- void __user *argp = (void __user *)arg;
- ULONG __user *pIndex = argp;
- i2eBordStrPtr pB = i2BoardPtrTable[iplminor / 4];
- i2ChanStrPtr pCh;
-
-#ifdef IP2DEBUG_IPL
- printk (KERN_DEBUG "IP2IPL: ioctl cmd %d, arg %ld\n", cmd, arg );
-#endif
-
- mutex_lock(&ip2_mutex);
-
- switch ( iplminor ) {
- case 0: // IPL device
- rc = -EINVAL;
- break;
- case 1: // Status dump
- case 5:
- case 9:
- case 13:
- switch ( cmd ) {
- case 64: /* Driver - ip2stat */
- rc = put_user(-1, pIndex++ );
- rc = put_user(irq_counter, pIndex++ );
- rc = put_user(bh_counter, pIndex++ );
- break;
-
- case 65: /* Board - ip2stat */
- if ( pB ) {
- rc = copy_to_user(argp, pB, sizeof(i2eBordStr));
- rc = put_user(inb(pB->i2eStatus),
- (ULONG __user *)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) );
- } else {
- rc = -ENODEV;
- }
- break;
-
- default:
- if (cmd < IP2_MAX_PORTS) {
- pCh = DevTable[cmd];
- if ( pCh )
- {
- rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
- if (rc)
- rc = -EFAULT;
- } else {
- rc = -ENODEV;
- }
- } else {
- rc = -EINVAL;
- }
- }
- break;
-
- case 2: // Ping device
- rc = -EINVAL;
- break;
- case 3: // Trace device
- /*
- * akpm: This used to write a whole bunch of function addresses
- * to userspace, which generated lots of put_user() warnings.
- * I killed it all. Just return "success" and don't do
- * anything.
- */
- if (cmd == 1)
- rc = 0;
- else
- rc = -EINVAL;
- break;
-
- default:
- rc = -ENODEV;
- break;
- }
- mutex_unlock(&ip2_mutex);
- return rc;
-}
-
-/******************************************************************************/
-/* Function: ip2_ipl_open() */
-/* Parameters: Pointer to device inode */
-/* Pointer to file structure */
-/* Returns: Success or failure */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-static int
-ip2_ipl_open( struct inode *pInode, struct file *pFile )
-{
-
-#ifdef IP2DEBUG_IPL
- printk (KERN_DEBUG "IP2IPL: open\n" );
-#endif
- return 0;
-}
-
-static int
-proc_ip2mem_show(struct seq_file *m, void *v)
-{
- i2eBordStrPtr pB;
- i2ChanStrPtr pCh;
- PTTY tty;
- int i;
-
-#define FMTLINE "%3d: 0x%08x 0x%08x 0%011o 0%011o\n"
-#define FMTLIN2 " 0x%04x 0x%04x tx flow 0x%x\n"
-#define FMTLIN3 " 0x%04x 0x%04x rc flow\n"
-
- seq_printf(m,"\n");
-
- for( i = 0; i < IP2_MAX_BOARDS; ++i ) {
- pB = i2BoardPtrTable[i];
- if ( pB ) {
- seq_printf(m,"board %d:\n",i);
- seq_printf(m,"\tFifo rem: %d mty: %x outM %x\n",
- pB->i2eFifoRemains,pB->i2eWaitingForEmptyFifo,pB->i2eOutMailWaiting);
- }
- }
-
- seq_printf(m,"#: tty flags, port flags, cflags, iflags\n");
- for (i=0; i < IP2_MAX_PORTS; i++) {
- pCh = DevTable[i];
- if (pCh) {
- tty = pCh->pTTY;
- if (tty && tty->count) {
- seq_printf(m,FMTLINE,i,(int)tty->flags,pCh->flags,
- tty->termios->c_cflag,tty->termios->c_iflag);
-
- seq_printf(m,FMTLIN2,
- pCh->outfl.asof,pCh->outfl.room,pCh->channelNeeds);
- seq_printf(m,FMTLIN3,pCh->infl.asof,pCh->infl.room);
- }
- }
- }
- return 0;
-}
-
-static int proc_ip2mem_open(struct inode *inode, struct file *file)
-{
- return single_open(file, proc_ip2mem_show, NULL);
-}
-
-static const struct file_operations ip2mem_proc_fops = {
- .owner = THIS_MODULE,
- .open = proc_ip2mem_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-/*
- * This is the handler for /proc/tty/driver/ip2
- *
- * This stretch of code has been largely plagerized from at least three
- * different sources including ip2mkdev.c and a couple of other drivers.
- * The bugs are all mine. :-) =mhw=
- */
-static int ip2_proc_show(struct seq_file *m, void *v)
-{
- int i, j, box;
- int boxes = 0;
- int ports = 0;
- int tports = 0;
- i2eBordStrPtr pB;
- char *sep;
-
- seq_printf(m, "ip2info: 1.0 driver: %s\n", pcVersion);
- seq_printf(m, "Driver: SMajor=%d CMajor=%d IMajor=%d MaxBoards=%d MaxBoxes=%d MaxPorts=%d\n",
- IP2_TTY_MAJOR, IP2_CALLOUT_MAJOR, IP2_IPL_MAJOR,
- IP2_MAX_BOARDS, ABS_MAX_BOXES, ABS_BIGGEST_BOX);
-
- for( i = 0; i < IP2_MAX_BOARDS; ++i ) {
- /* This need to be reset for a board by board count... */
- boxes = 0;
- pB = i2BoardPtrTable[i];
- if( pB ) {
- switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
- {
- case POR_ID_FIIEX:
- seq_printf(m, "Board %d: EX ports=", i);
- sep = "";
- for( box = 0; box < ABS_MAX_BOXES; ++box )
- {
- ports = 0;
-
- if( pB->i2eChannelMap[box] != 0 ) ++boxes;
- for( j = 0; j < ABS_BIGGEST_BOX; ++j )
- {
- if( pB->i2eChannelMap[box] & 1<< j ) {
- ++ports;
- }
- }
- seq_printf(m, "%s%d", sep, ports);
- sep = ",";
- tports += ports;
- }
- seq_printf(m, " boxes=%d width=%d", boxes, pB->i2eDataWidth16 ? 16 : 8);
- break;
-
- case POR_ID_II_4:
- seq_printf(m, "Board %d: ISA-4 ports=4 boxes=1", i);
- tports = ports = 4;
- break;
-
- case POR_ID_II_8:
- seq_printf(m, "Board %d: ISA-8-std ports=8 boxes=1", i);
- tports = ports = 8;
- break;
-
- case POR_ID_II_8R:
- seq_printf(m, "Board %d: ISA-8-RJ11 ports=8 boxes=1", i);
- tports = ports = 8;
- break;
-
- default:
- seq_printf(m, "Board %d: unknown", i);
- /* Don't try and probe for minor numbers */
- tports = ports = 0;
- }
-
- } else {
- /* Don't try and probe for minor numbers */
- seq_printf(m, "Board %d: vacant", i);
- tports = ports = 0;
- }
-
- if( tports ) {
- seq_puts(m, " minors=");
- sep = "";
- for ( box = 0; box < ABS_MAX_BOXES; ++box )
- {
- for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
- {
- if ( pB->i2eChannelMap[box] & (1 << j) )
- {
- seq_printf(m, "%s%d", sep,
- j + ABS_BIGGEST_BOX *
- (box+i*ABS_MAX_BOXES));
- sep = ",";
- }
- }
- }
- }
- seq_putc(m, '\n');
- }
- return 0;
- }
-
-static int ip2_proc_open(struct inode *inode, struct file *file)
-{
- return single_open(file, ip2_proc_show, NULL);
-}
-
-static const struct file_operations ip2_proc_fops = {
- .owner = THIS_MODULE,
- .open = ip2_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-/******************************************************************************/
-/* Function: ip2trace() */
-/* Parameters: Value to add to trace buffer */
-/* Returns: Nothing */
-/* */
-/* Description: */
-/* */
-/* */
-/******************************************************************************/
-#ifdef IP2DEBUG_TRACE
-void
-ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned long codes, ...)
-{
- long flags;
- unsigned long *pCode = &codes;
- union ip2breadcrumb bc;
- i2ChanStrPtr pCh;
-
-
- tracebuf[tracestuff++] = jiffies;
- if ( tracestuff == TRACEMAX ) {
- tracestuff = 0;
- }
- if ( tracestuff == tracestrip ) {
- if ( ++tracestrip == TRACEMAX ) {
- tracestrip = 0;
- }
- ++tracewrap;
- }
-
- bc.hdr.port = 0xff & pn;
- bc.hdr.cat = cat;
- bc.hdr.codes = (unsigned char)( codes & 0xff );
- bc.hdr.label = label;
- tracebuf[tracestuff++] = bc.value;
-
- for (;;) {
- if ( tracestuff == TRACEMAX ) {
- tracestuff = 0;
- }
- if ( tracestuff == tracestrip ) {
- if ( ++tracestrip == TRACEMAX ) {
- tracestrip = 0;
- }
- ++tracewrap;
- }
-
- if ( !codes-- )
- break;
-
- tracebuf[tracestuff++] = *++pCode;
- }
-}
-#endif
-
-
-MODULE_LICENSE("GPL");
-
-static struct pci_device_id ip2main_pci_tbl[] __devinitdata __used = {
- { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) },
- { }
-};
-
-MODULE_DEVICE_TABLE(pci, ip2main_pci_tbl);
-
-MODULE_FIRMWARE("intelliport2.bin");
diff --git a/drivers/char/ip2/ip2trace.h b/drivers/char/ip2/ip2trace.h
deleted file mode 100644
index da20435dc8a6..000000000000
--- a/drivers/char/ip2/ip2trace.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-union ip2breadcrumb
-{
- struct {
- unsigned char port, cat, codes, label;
- } __attribute__ ((packed)) hdr;
- unsigned long value;
-};
-
-#define ITRC_NO_PORT 0xFF
-#define CHANN (pCh->port_index)
-
-#define ITRC_ERROR '!'
-#define ITRC_INIT 'A'
-#define ITRC_OPEN 'B'
-#define ITRC_CLOSE 'C'
-#define ITRC_DRAIN 'D'
-#define ITRC_IOCTL 'E'
-#define ITRC_FLUSH 'F'
-#define ITRC_STATUS 'G'
-#define ITRC_HANGUP 'H'
-#define ITRC_INTR 'I'
-#define ITRC_SFLOW 'J'
-#define ITRC_SBCMD 'K'
-#define ITRC_SICMD 'L'
-#define ITRC_MODEM 'M'
-#define ITRC_INPUT 'N'
-#define ITRC_OUTPUT 'O'
-#define ITRC_PUTC 'P'
-#define ITRC_QUEUE 'Q'
-#define ITRC_STFLW 'R'
-#define ITRC_SFIFO 'S'
-#define ITRC_VERIFY 'V'
-#define ITRC_WRITE 'W'
-
-#define ITRC_ENTER 0x00
-#define ITRC_RETURN 0xFF
-
-#define ITRC_QUEUE_ROOM 2
-#define ITRC_QUEUE_CMD 6
-
diff --git a/drivers/char/ip2/ip2types.h b/drivers/char/ip2/ip2types.h
deleted file mode 100644
index 9d67b260b2f6..000000000000
--- a/drivers/char/ip2/ip2types.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
-*
-* (c) 1998 by Computone Corporation
-*
-********************************************************************************
-*
-*
-* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
-* serial I/O controllers.
-*
-* DESCRIPTION: Driver constants and type definitions.
-*
-* NOTES:
-*
-*******************************************************************************/
-#ifndef IP2TYPES_H
-#define IP2TYPES_H
-
-//*************
-//* Constants *
-//*************
-
-// Define some limits for this driver. Ports per board is a hardware limitation
-// that will not change. Current hardware limits this to 64 ports per board.
-// Boards per driver is a self-imposed limit.
-//
-#define IP2_MAX_BOARDS 4
-#define IP2_PORTS_PER_BOARD ABS_MOST_PORTS
-#define IP2_MAX_PORTS (IP2_MAX_BOARDS*IP2_PORTS_PER_BOARD)
-
-#define ISA 0
-#define PCI 1
-#define EISA 2
-
-//********************
-//* Type Definitions *
-//********************
-
-typedef struct tty_struct * PTTY;
-typedef wait_queue_head_t PWAITQ;
-
-typedef unsigned char UCHAR;
-typedef unsigned int UINT;
-typedef unsigned short USHORT;
-typedef unsigned long ULONG;
-
-typedef struct
-{
- short irq[IP2_MAX_BOARDS];
- unsigned short addr[IP2_MAX_BOARDS];
- int type[IP2_MAX_BOARDS];
-#ifdef CONFIG_PCI
- struct pci_dev *pci_dev[IP2_MAX_BOARDS];
-#endif
-} ip2config_t;
-
-#endif