Creation of Cybook 2416 (actually Gen4) repository
This commit is contained in:
12
drivers/char/rio/Makefile
Normal file
12
drivers/char/rio/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Makefile for the linux rio-subsystem.
|
||||
#
|
||||
# (C) R.E.Wolff@BitWizard.nl
|
||||
#
|
||||
# This file is GPL. See other files for the full Blurb. I'm lazy today.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_RIO) += rio.o
|
||||
|
||||
rio-objs := rio_linux.o rioinit.o rioboot.o riocmd.o rioctrl.o riointr.o \
|
||||
rioparam.o rioroute.o riotable.o riotty.o
|
||||
132
drivers/char/rio/board.h
Normal file
132
drivers/char/rio/board.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : board.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:07
|
||||
** Retrieved : 11/6/98 11:34:20
|
||||
**
|
||||
** ident @(#)board.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_board_h__
|
||||
#define __rio_board_h__
|
||||
|
||||
/*
|
||||
** board.h contains the definitions for the *hardware* of the host cards.
|
||||
** It describes the memory overlay for the dual port RAM area.
|
||||
*/
|
||||
|
||||
#define DP_SRAM1_SIZE 0x7C00
|
||||
#define DP_SRAM2_SIZE 0x0200
|
||||
#define DP_SRAM3_SIZE 0x7000
|
||||
#define DP_SCRATCH_SIZE 0x1000
|
||||
#define DP_PARMMAP_ADDR 0x01FE /* offset into SRAM2 */
|
||||
#define DP_STARTUP_ADDR 0x01F8 /* offset into SRAM2 */
|
||||
|
||||
/*
|
||||
** The shape of the Host Control area, at offset 0x7C00, Write Only
|
||||
*/
|
||||
struct s_Ctrl {
|
||||
u8 DpCtl; /* 7C00 */
|
||||
u8 Dp_Unused2_[127];
|
||||
u8 DpIntSet; /* 7C80 */
|
||||
u8 Dp_Unused3_[127];
|
||||
u8 DpTpuReset; /* 7D00 */
|
||||
u8 Dp_Unused4_[127];
|
||||
u8 DpIntReset; /* 7D80 */
|
||||
u8 Dp_Unused5_[127];
|
||||
};
|
||||
|
||||
/*
|
||||
** The PROM data area on the host (0x7C00), Read Only
|
||||
*/
|
||||
struct s_Prom {
|
||||
u16 DpSlxCode[2];
|
||||
u16 DpRev;
|
||||
u16 Dp_Unused6_;
|
||||
u16 DpUniq[4];
|
||||
u16 DpJahre;
|
||||
u16 DpWoche;
|
||||
u16 DpHwFeature[5];
|
||||
u16 DpOemId;
|
||||
u16 DpSiggy[16];
|
||||
};
|
||||
|
||||
/*
|
||||
** Union of the Ctrl and Prom areas
|
||||
*/
|
||||
union u_CtrlProm { /* This is the control/PROM area (0x7C00) */
|
||||
struct s_Ctrl DpCtrl;
|
||||
struct s_Prom DpProm;
|
||||
};
|
||||
|
||||
/*
|
||||
** The top end of memory!
|
||||
*/
|
||||
struct s_ParmMapS { /* Area containing Parm Map Pointer */
|
||||
u8 Dp_Unused8_[DP_PARMMAP_ADDR];
|
||||
u16 DpParmMapAd;
|
||||
};
|
||||
|
||||
struct s_StartUpS {
|
||||
u8 Dp_Unused9_[DP_STARTUP_ADDR];
|
||||
u8 Dp_LongJump[0x4];
|
||||
u8 Dp_Unused10_[2];
|
||||
u8 Dp_ShortJump[0x2];
|
||||
};
|
||||
|
||||
union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */
|
||||
u8 DpSramMem[DP_SRAM2_SIZE];
|
||||
struct s_ParmMapS DpParmMapS;
|
||||
struct s_StartUpS DpStartUpS;
|
||||
};
|
||||
|
||||
/*
|
||||
** This is the DP RAM overlay.
|
||||
*/
|
||||
struct DpRam {
|
||||
u8 DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */
|
||||
union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */
|
||||
union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */
|
||||
u8 DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */
|
||||
u8 DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */
|
||||
};
|
||||
|
||||
#define DpControl DpCtrlProm.DpCtrl.DpCtl
|
||||
#define DpSetInt DpCtrlProm.DpCtrl.DpIntSet
|
||||
#define DpResetTpu DpCtrlProm.DpCtrl.DpTpuReset
|
||||
#define DpResetInt DpCtrlProm.DpCtrl.DpIntReset
|
||||
|
||||
#define DpSlx DpCtrlProm.DpProm.DpSlxCode
|
||||
#define DpRevision DpCtrlProm.DpProm.DpRev
|
||||
#define DpUnique DpCtrlProm.DpProm.DpUniq
|
||||
#define DpYear DpCtrlProm.DpProm.DpJahre
|
||||
#define DpWeek DpCtrlProm.DpProm.DpWoche
|
||||
#define DpSignature DpCtrlProm.DpProm.DpSiggy
|
||||
|
||||
#define DpParmMapR DpSram2ParmMap.DpParmMapS.DpParmMapAd
|
||||
#define DpSram2 DpSram2ParmMap.DpSramMem
|
||||
|
||||
#endif
|
||||
213
drivers/char/rio/cirrus.h
Normal file
213
drivers/char/rio/cirrus.h
Normal file
@@ -0,0 +1,213 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* CIRRUS.H *******
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Jeremy Rolls
|
||||
Date : 3 Aug 1990
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _cirrus_h
|
||||
#ifndef lint
|
||||
/* static char* _cirrus_h_sccs = "@(#)cirrus.h 1.16"; */
|
||||
#endif
|
||||
#define _cirrus_h 1
|
||||
|
||||
/* Bit fields for particular registers shared with driver */
|
||||
|
||||
/* COR1 - driver and RTA */
|
||||
#define COR1_ODD 0x80 /* Odd parity */
|
||||
#define COR1_EVEN 0x00 /* Even parity */
|
||||
#define COR1_NOP 0x00 /* No parity */
|
||||
#define COR1_FORCE 0x20 /* Force parity */
|
||||
#define COR1_NORMAL 0x40 /* With parity */
|
||||
#define COR1_1STOP 0x00 /* 1 stop bit */
|
||||
#define COR1_15STOP 0x04 /* 1.5 stop bits */
|
||||
#define COR1_2STOP 0x08 /* 2 stop bits */
|
||||
#define COR1_5BITS 0x00 /* 5 data bits */
|
||||
#define COR1_6BITS 0x01 /* 6 data bits */
|
||||
#define COR1_7BITS 0x02 /* 7 data bits */
|
||||
#define COR1_8BITS 0x03 /* 8 data bits */
|
||||
|
||||
#define COR1_HOST 0xef /* Safe host bits */
|
||||
|
||||
/* RTA only */
|
||||
#define COR1_CINPCK 0x00 /* Check parity of received characters */
|
||||
#define COR1_CNINPCK 0x10 /* Don't check parity */
|
||||
|
||||
/* COR2 bits for both RTA and driver use */
|
||||
#define COR2_IXANY 0x80 /* IXANY - any character is XON */
|
||||
#define COR2_IXON 0x40 /* IXON - enable tx soft flowcontrol */
|
||||
#define COR2_RTSFLOW 0x02 /* Enable tx hardware flow control */
|
||||
|
||||
/* Additional driver bits */
|
||||
#define COR2_HUPCL 0x20 /* Hang up on close */
|
||||
#define COR2_CTSFLOW 0x04 /* Enable rx hardware flow control */
|
||||
#define COR2_IXOFF 0x01 /* Enable rx software flow control */
|
||||
#define COR2_DTRFLOW 0x08 /* Enable tx hardware flow control */
|
||||
|
||||
/* RTA use only */
|
||||
#define COR2_ETC 0x20 /* Embedded transmit options */
|
||||
#define COR2_LOCAL 0x10 /* Local loopback mode */
|
||||
#define COR2_REMOTE 0x08 /* Remote loopback mode */
|
||||
#define COR2_HOST 0xc2 /* Safe host bits */
|
||||
|
||||
/* COR3 - RTA use only */
|
||||
#define COR3_SCDRNG 0x80 /* Enable special char detect for range */
|
||||
#define COR3_SCD34 0x40 /* Special character detect for SCHR's 3 + 4 */
|
||||
#define COR3_FCT 0x20 /* Flow control transparency */
|
||||
#define COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */
|
||||
#define COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */
|
||||
#define COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */
|
||||
#define COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */
|
||||
#define COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */
|
||||
|
||||
#define COR3_THRESHOLD COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */
|
||||
|
||||
#define COR3_DEFAULT (COR3_FCT | COR3_THRESHOLD)
|
||||
/* Default bits for COR3 */
|
||||
|
||||
/* COR4 driver and RTA use */
|
||||
#define COR4_IGNCR 0x80 /* Throw away CR's on input */
|
||||
#define COR4_ICRNL 0x40 /* Map CR -> NL on input */
|
||||
#define COR4_INLCR 0x20 /* Map NL -> CR on input */
|
||||
#define COR4_IGNBRK 0x10 /* Ignore Break */
|
||||
#define COR4_NBRKINT 0x08 /* No interrupt on break (-BRKINT) */
|
||||
#define COR4_RAISEMOD 0x01 /* Raise modem output lines on non-zero baud */
|
||||
|
||||
|
||||
/* COR4 driver only */
|
||||
#define COR4_IGNPAR 0x04 /* IGNPAR (ignore characters with errors) */
|
||||
#define COR4_PARMRK 0x02 /* PARMRK */
|
||||
|
||||
#define COR4_HOST 0xf8 /* Safe host bits */
|
||||
|
||||
/* COR4 RTA only */
|
||||
#define COR4_CIGNPAR 0x02 /* Thrown away bad characters */
|
||||
#define COR4_CPARMRK 0x04 /* PARMRK characters */
|
||||
#define COR4_CNPARMRK 0x03 /* Don't PARMRK */
|
||||
|
||||
/* COR5 driver and RTA use */
|
||||
#define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */
|
||||
#define COR5_LNE 0x40 /* Enable LNEXT processing */
|
||||
#define COR5_CMOE 0x20 /* Match good and errored characters */
|
||||
#define COR5_ONLCR 0x02 /* NL -> CR NL on output */
|
||||
#define COR5_OCRNL 0x01 /* CR -> NL on output */
|
||||
|
||||
/*
|
||||
** Spare bits - these are not used in the CIRRUS registers, so we use
|
||||
** them to set various other features.
|
||||
*/
|
||||
/*
|
||||
** tstop and tbusy indication
|
||||
*/
|
||||
#define COR5_TSTATE_ON 0x08 /* Turn on monitoring of tbusy and tstop */
|
||||
#define COR5_TSTATE_OFF 0x04 /* Turn off monitoring of tbusy and tstop */
|
||||
/*
|
||||
** TAB3
|
||||
*/
|
||||
#define COR5_TAB3 0x10 /* TAB3 mode */
|
||||
|
||||
#define COR5_HOST 0xc3 /* Safe host bits */
|
||||
|
||||
/* CCSR */
|
||||
#define CCSR_TXFLOFF 0x04 /* Tx is xoffed */
|
||||
|
||||
/* MSVR1 */
|
||||
/* NB. DTR / CD swapped from Cirrus spec as the pins are also reversed on the
|
||||
RTA. This is because otherwise DCD would get lost on the 1 parallel / 3
|
||||
serial option.
|
||||
*/
|
||||
#define MSVR1_CD 0x80 /* CD (DSR on Cirrus) */
|
||||
#define MSVR1_RTS 0x40 /* RTS (CTS on Cirrus) */
|
||||
#define MSVR1_RI 0x20 /* RI */
|
||||
#define MSVR1_DTR 0x10 /* DTR (CD on Cirrus) */
|
||||
#define MSVR1_CTS 0x01 /* CTS output pin (RTS on Cirrus) */
|
||||
/* Next two used to indicate state of tbusy and tstop to driver */
|
||||
#define MSVR1_TSTOP 0x08 /* Set if port flow controlled */
|
||||
#define MSVR1_TEMPTY 0x04 /* Set if port tx buffer empty */
|
||||
|
||||
#define MSVR1_HOST 0xf3 /* The bits the host wants */
|
||||
|
||||
/* Defines for the subscripts of a CONFIG packet */
|
||||
#define CONFIG_COR1 1 /* Option register 1 */
|
||||
#define CONFIG_COR2 2 /* Option register 2 */
|
||||
#define CONFIG_COR4 3 /* Option register 4 */
|
||||
#define CONFIG_COR5 4 /* Option register 5 */
|
||||
#define CONFIG_TXXON 5 /* Tx XON character */
|
||||
#define CONFIG_TXXOFF 6 /* Tx XOFF character */
|
||||
#define CONFIG_RXXON 7 /* Rx XON character */
|
||||
#define CONFIG_RXXOFF 8 /* Rx XOFF character */
|
||||
#define CONFIG_LNEXT 9 /* LNEXT character */
|
||||
#define CONFIG_TXBAUD 10 /* Tx baud rate */
|
||||
#define CONFIG_RXBAUD 11 /* Rx baud rate */
|
||||
|
||||
#define PRE_EMPTIVE 0x80 /* Pre-emptive bit in command field */
|
||||
|
||||
/* Packet types going from Host to remote - with the exception of OPEN, MOPEN,
|
||||
CONFIG, SBREAK and MEMDUMP the remaining bytes of the data array will not
|
||||
be used
|
||||
*/
|
||||
#define OPEN 0x00 /* Open a port */
|
||||
#define CONFIG 0x01 /* Configure a port */
|
||||
#define MOPEN 0x02 /* Modem open (block for DCD) */
|
||||
#define CLOSE 0x03 /* Close a port */
|
||||
#define WFLUSH (0x04 | PRE_EMPTIVE) /* Write flush */
|
||||
#define RFLUSH (0x05 | PRE_EMPTIVE) /* Read flush */
|
||||
#define RESUME (0x06 | PRE_EMPTIVE) /* Resume if xoffed */
|
||||
#define SBREAK 0x07 /* Start break */
|
||||
#define EBREAK 0x08 /* End break */
|
||||
#define SUSPEND (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */
|
||||
#define FCLOSE (0x0a | PRE_EMPTIVE) /* Force close */
|
||||
#define XPRINT 0x0b /* Xprint packet */
|
||||
#define MBIS (0x0c | PRE_EMPTIVE) /* Set modem lines */
|
||||
#define MBIC (0x0d | PRE_EMPTIVE) /* Clear modem lines */
|
||||
#define MSET (0x0e | PRE_EMPTIVE) /* Set modem lines */
|
||||
#define PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */
|
||||
#define MGET (0x10 | PRE_EMPTIVE) /* Force update of modem status */
|
||||
#define MEMDUMP (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */
|
||||
#define READ_REGISTER (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */
|
||||
|
||||
/* "Command" packets going from remote to host COMPLETE and MODEM_STATUS
|
||||
use data[4] / data[3] to indicate current state and modem status respectively
|
||||
*/
|
||||
|
||||
#define COMPLETE (0x20 | PRE_EMPTIVE)
|
||||
/* Command complete */
|
||||
#define BREAK_RECEIVED (0x21 | PRE_EMPTIVE)
|
||||
/* Break received */
|
||||
#define MODEM_STATUS (0x22 | PRE_EMPTIVE)
|
||||
/* Change in modem status */
|
||||
|
||||
/* "Command" packet that could go either way - handshake wake-up */
|
||||
#define HANDSHAKE (0x23 | PRE_EMPTIVE)
|
||||
/* Wake-up to HOST / RTA */
|
||||
|
||||
#endif
|
||||
59
drivers/char/rio/cmdblk.h
Normal file
59
drivers/char/rio/cmdblk.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : cmdblk.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:09
|
||||
** Retrieved : 11/6/98 11:34:20
|
||||
**
|
||||
** ident @(#)cmdblk.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_cmdblk_h__
|
||||
#define __rio_cmdblk_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** the structure of a command block, used to queue commands destined for
|
||||
** a rup.
|
||||
*/
|
||||
|
||||
struct CmdBlk {
|
||||
struct CmdBlk *NextP; /* Pointer to next command block */
|
||||
struct PKT Packet; /* A packet, to copy to the rup */
|
||||
/* The func to call to check if OK */
|
||||
int (*PreFuncP) (unsigned long, struct CmdBlk *);
|
||||
int PreArg; /* The arg for the func */
|
||||
/* The func to call when completed */
|
||||
int (*PostFuncP) (unsigned long, struct CmdBlk *);
|
||||
int PostArg; /* The arg for the func */
|
||||
};
|
||||
|
||||
#define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4))
|
||||
#endif
|
||||
183
drivers/char/rio/cmdpkt.h
Normal file
183
drivers/char/rio/cmdpkt.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : cmdpkt.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:09
|
||||
** Retrieved : 11/6/98 11:34:20
|
||||
**
|
||||
** ident @(#)cmdpkt.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __rio_cmdpkt_h__
|
||||
#define __rio_cmdpkt_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** overlays for the data area of a packet. Used in both directions
|
||||
** (to build a packet to send, and to interpret a packet that arrives)
|
||||
** and is very inconvenient for MIPS, so they appear as two separate
|
||||
** structures - those used for modifying/reading packets on the card
|
||||
** and those for modifying/reading packets in real memory, which have an _M
|
||||
** suffix.
|
||||
*/
|
||||
|
||||
#define RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2)
|
||||
|
||||
/*
|
||||
** The boot information packet looks like this:
|
||||
** This structure overlays a PktCmd->CmdData structure, and so starts
|
||||
** at Data[2] in the actual pkt!
|
||||
*/
|
||||
struct BootSequence {
|
||||
u16 NumPackets;
|
||||
u16 LoadBase;
|
||||
u16 CodeSize;
|
||||
};
|
||||
|
||||
#define BOOT_SEQUENCE_LEN 8
|
||||
|
||||
struct SamTop {
|
||||
u8 Unit;
|
||||
u8 Link;
|
||||
};
|
||||
|
||||
struct CmdHdr {
|
||||
u8 PcCommand;
|
||||
union {
|
||||
u8 PcPhbNum;
|
||||
u8 PcLinkNum;
|
||||
u8 PcIDNum;
|
||||
} U0;
|
||||
};
|
||||
|
||||
|
||||
struct PktCmd {
|
||||
union {
|
||||
struct {
|
||||
struct CmdHdr CmdHdr;
|
||||
struct BootSequence PcBootSequence;
|
||||
} S1;
|
||||
struct {
|
||||
u16 PcSequence;
|
||||
u8 PcBootData[RTA_BOOT_DATA_SIZE];
|
||||
} S2;
|
||||
struct {
|
||||
u16 __crud__;
|
||||
u8 PcUniqNum[4]; /* this is really a uint. */
|
||||
u8 PcModuleTypes; /* what modules are fitted */
|
||||
} S3;
|
||||
struct {
|
||||
struct CmdHdr CmdHdr;
|
||||
u8 __undefined__;
|
||||
u8 PcModemStatus;
|
||||
u8 PcPortStatus;
|
||||
u8 PcSubCommand; /* commands like mem or register dump */
|
||||
u16 PcSubAddr; /* Address for command */
|
||||
u8 PcSubData[64]; /* Date area for command */
|
||||
} S4;
|
||||
struct {
|
||||
struct CmdHdr CmdHdr;
|
||||
u8 PcCommandText[1];
|
||||
u8 __crud__[20];
|
||||
u8 PcIDNum2; /* It had to go somewhere! */
|
||||
} S5;
|
||||
struct {
|
||||
struct CmdHdr CmdHdr;
|
||||
struct SamTop Topology[LINKS_PER_UNIT];
|
||||
} S6;
|
||||
} U1;
|
||||
};
|
||||
|
||||
struct PktCmd_M {
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
u8 PcCommand;
|
||||
union {
|
||||
u8 PcPhbNum;
|
||||
u8 PcLinkNum;
|
||||
u8 PcIDNum;
|
||||
} U0;
|
||||
} CmdHdr;
|
||||
struct {
|
||||
u16 NumPackets;
|
||||
u16 LoadBase;
|
||||
u16 CodeSize;
|
||||
} PcBootSequence;
|
||||
} S1;
|
||||
struct {
|
||||
u16 PcSequence;
|
||||
u8 PcBootData[RTA_BOOT_DATA_SIZE];
|
||||
} S2;
|
||||
struct {
|
||||
u16 __crud__;
|
||||
u8 PcUniqNum[4]; /* this is really a uint. */
|
||||
u8 PcModuleTypes; /* what modules are fitted */
|
||||
} S3;
|
||||
struct {
|
||||
u16 __cmd_hdr__;
|
||||
u8 __undefined__;
|
||||
u8 PcModemStatus;
|
||||
u8 PcPortStatus;
|
||||
u8 PcSubCommand;
|
||||
u16 PcSubAddr;
|
||||
u8 PcSubData[64];
|
||||
} S4;
|
||||
struct {
|
||||
u16 __cmd_hdr__;
|
||||
u8 PcCommandText[1];
|
||||
u8 __crud__[20];
|
||||
u8 PcIDNum2; /* Tacked on end */
|
||||
} S5;
|
||||
struct {
|
||||
u16 __cmd_hdr__;
|
||||
struct Top Topology[LINKS_PER_UNIT];
|
||||
} S6;
|
||||
} U1;
|
||||
};
|
||||
|
||||
#define Command U1.S1.CmdHdr.PcCommand
|
||||
#define PhbNum U1.S1.CmdHdr.U0.PcPhbNum
|
||||
#define IDNum U1.S1.CmdHdr.U0.PcIDNum
|
||||
#define IDNum2 U1.S5.PcIDNum2
|
||||
#define LinkNum U1.S1.CmdHdr.U0.PcLinkNum
|
||||
#define Sequence U1.S2.PcSequence
|
||||
#define BootData U1.S2.PcBootData
|
||||
#define BootSequence U1.S1.PcBootSequence
|
||||
#define UniqNum U1.S3.PcUniqNum
|
||||
#define ModemStatus U1.S4.PcModemStatus
|
||||
#define PortStatus U1.S4.PcPortStatus
|
||||
#define SubCommand U1.S4.PcSubCommand
|
||||
#define SubAddr U1.S4.PcSubAddr
|
||||
#define SubData U1.S4.PcSubData
|
||||
#define CommandText U1.S5.PcCommandText
|
||||
#define RouteTopology U1.S6.Topology
|
||||
#define ModuleTypes U1.S3.PcModuleTypes
|
||||
|
||||
#endif
|
||||
313
drivers/char/rio/daemon.h
Normal file
313
drivers/char/rio/daemon.h
Normal file
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : daemon.h
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 11:34:09
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)daemon.h 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_daemon_h__
|
||||
#define __rio_daemon_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** structures used on /dev/rio
|
||||
*/
|
||||
|
||||
struct Error {
|
||||
unsigned int Error;
|
||||
unsigned int Entry;
|
||||
unsigned int Other;
|
||||
};
|
||||
|
||||
struct DownLoad {
|
||||
char __user *DataP;
|
||||
unsigned int Count;
|
||||
unsigned int ProductCode;
|
||||
};
|
||||
|
||||
/*
|
||||
** A few constants....
|
||||
*/
|
||||
#ifndef MAX_VERSION_LEN
|
||||
#define MAX_VERSION_LEN 256
|
||||
#endif
|
||||
|
||||
#ifndef MAX_XP_CTRL_LEN
|
||||
#define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */
|
||||
#endif
|
||||
|
||||
struct PortSetup {
|
||||
unsigned int From; /* Set/Clear XP & IXANY Control from this port.... */
|
||||
unsigned int To; /* .... to this port */
|
||||
unsigned int XpCps; /* at this speed */
|
||||
char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */
|
||||
char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */
|
||||
u8 IxAny; /* enable/disable IXANY */
|
||||
u8 IxOn; /* enable/disable IXON */
|
||||
u8 Lock; /* lock port params */
|
||||
u8 Store; /* store params across closes */
|
||||
u8 Drain; /* close only when drained */
|
||||
};
|
||||
|
||||
struct LpbReq {
|
||||
unsigned int Host;
|
||||
unsigned int Link;
|
||||
struct LPB __user *LpbP;
|
||||
};
|
||||
|
||||
struct RupReq {
|
||||
unsigned int HostNum;
|
||||
unsigned int RupNum;
|
||||
struct RUP __user *RupP;
|
||||
};
|
||||
|
||||
struct PortReq {
|
||||
unsigned int SysPort;
|
||||
struct Port __user *PortP;
|
||||
};
|
||||
|
||||
struct StreamInfo {
|
||||
unsigned int SysPort;
|
||||
int RQueue;
|
||||
int WQueue;
|
||||
};
|
||||
|
||||
struct HostReq {
|
||||
unsigned int HostNum;
|
||||
struct Host __user *HostP;
|
||||
};
|
||||
|
||||
struct HostDpRam {
|
||||
unsigned int HostNum;
|
||||
struct DpRam __user *DpRamP;
|
||||
};
|
||||
|
||||
struct DebugCtrl {
|
||||
unsigned int SysPort;
|
||||
unsigned int Debug;
|
||||
unsigned int Wait;
|
||||
};
|
||||
|
||||
struct MapInfo {
|
||||
unsigned int FirstPort; /* 8 ports, starting from this (tty) number */
|
||||
unsigned int RtaUnique; /* reside on this RTA (unique number) */
|
||||
};
|
||||
|
||||
struct MapIn {
|
||||
unsigned int NumEntries; /* How many port sets are we mapping? */
|
||||
struct MapInfo *MapInfoP; /* Pointer to (user space) info */
|
||||
};
|
||||
|
||||
struct SendPack {
|
||||
unsigned int PortNum;
|
||||
unsigned char Len;
|
||||
unsigned char Data[PKT_MAX_DATA_LEN];
|
||||
};
|
||||
|
||||
struct SpecialRupCmd {
|
||||
struct PKT Packet;
|
||||
unsigned short Host;
|
||||
unsigned short RupNum;
|
||||
};
|
||||
|
||||
struct IdentifyRta {
|
||||
unsigned long RtaUnique;
|
||||
u8 ID;
|
||||
};
|
||||
|
||||
struct KillNeighbour {
|
||||
unsigned long UniqueNum;
|
||||
u8 Link;
|
||||
};
|
||||
|
||||
struct rioVersion {
|
||||
char version[MAX_VERSION_LEN];
|
||||
char relid[MAX_VERSION_LEN];
|
||||
int buildLevel;
|
||||
char buildDate[MAX_VERSION_LEN];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** RIOC commands are for the daemon type operations
|
||||
**
|
||||
** 09.12.1998 ARG - ESIL 0776 part fix
|
||||
** Definition for 'RIOC' also appears in rioioctl.h, so we'd better do a
|
||||
** #ifndef here first.
|
||||
** rioioctl.h also now has #define 'RIO_QUICK_CHECK' as this ioctl is now
|
||||
** allowed to be used by customers.
|
||||
*/
|
||||
#ifndef RIOC
|
||||
#define RIOC ('R'<<8)|('i'<<16)|('o'<<24)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Boot stuff
|
||||
*/
|
||||
#define RIO_GET_TABLE (RIOC | 100)
|
||||
#define RIO_PUT_TABLE (RIOC | 101)
|
||||
#define RIO_ASSIGN_RTA (RIOC | 102)
|
||||
#define RIO_DELETE_RTA (RIOC | 103)
|
||||
#define RIO_HOST_FOAD (RIOC | 104)
|
||||
#define RIO_QUICK_CHECK (RIOC | 105)
|
||||
#define RIO_SIGNALS_ON (RIOC | 106)
|
||||
#define RIO_SIGNALS_OFF (RIOC | 107)
|
||||
#define RIO_CHANGE_NAME (RIOC | 108)
|
||||
#define RIO_DOWNLOAD (RIOC | 109)
|
||||
#define RIO_GET_LOG (RIOC | 110)
|
||||
#define RIO_SETUP_PORTS (RIOC | 111)
|
||||
#define RIO_ALL_MODEM (RIOC | 112)
|
||||
|
||||
/*
|
||||
** card state, debug stuff
|
||||
*/
|
||||
#define RIO_NUM_HOSTS (RIOC | 120)
|
||||
#define RIO_HOST_LPB (RIOC | 121)
|
||||
#define RIO_HOST_RUP (RIOC | 122)
|
||||
#define RIO_HOST_PORT (RIOC | 123)
|
||||
#define RIO_PARMS (RIOC | 124)
|
||||
#define RIO_HOST_REQ (RIOC | 125)
|
||||
#define RIO_READ_CONFIG (RIOC | 126)
|
||||
#define RIO_SET_CONFIG (RIOC | 127)
|
||||
#define RIO_VERSID (RIOC | 128)
|
||||
#define RIO_FLAGS (RIOC | 129)
|
||||
#define RIO_SETDEBUG (RIOC | 130)
|
||||
#define RIO_GETDEBUG (RIOC | 131)
|
||||
#define RIO_READ_LEVELS (RIOC | 132)
|
||||
#define RIO_SET_FAST_BUS (RIOC | 133)
|
||||
#define RIO_SET_SLOW_BUS (RIOC | 134)
|
||||
#define RIO_SET_BYTE_MODE (RIOC | 135)
|
||||
#define RIO_SET_WORD_MODE (RIOC | 136)
|
||||
#define RIO_STREAM_INFO (RIOC | 137)
|
||||
#define RIO_START_POLLER (RIOC | 138)
|
||||
#define RIO_STOP_POLLER (RIOC | 139)
|
||||
#define RIO_LAST_ERROR (RIOC | 140)
|
||||
#define RIO_TICK (RIOC | 141)
|
||||
#define RIO_TOCK (RIOC | 241) /* I did this on purpose, you know. */
|
||||
#define RIO_SEND_PACKET (RIOC | 142)
|
||||
#define RIO_SET_BUSY (RIOC | 143)
|
||||
#define SPECIAL_RUP_CMD (RIOC | 144)
|
||||
#define RIO_FOAD_RTA (RIOC | 145)
|
||||
#define RIO_ZOMBIE_RTA (RIOC | 146)
|
||||
#define RIO_IDENTIFY_RTA (RIOC | 147)
|
||||
#define RIO_KILL_NEIGHBOUR (RIOC | 148)
|
||||
#define RIO_DEBUG_MEM (RIOC | 149)
|
||||
/*
|
||||
** 150 - 167 used..... See below
|
||||
*/
|
||||
#define RIO_GET_PORT_SETUP (RIOC | 168)
|
||||
#define RIO_RESUME (RIOC | 169)
|
||||
#define RIO_MESG (RIOC | 170)
|
||||
#define RIO_NO_MESG (RIOC | 171)
|
||||
#define RIO_WHAT_MESG (RIOC | 172)
|
||||
#define RIO_HOST_DPRAM (RIOC | 173)
|
||||
#define RIO_MAP_B50_TO_50 (RIOC | 174)
|
||||
#define RIO_MAP_B50_TO_57600 (RIOC | 175)
|
||||
#define RIO_MAP_B110_TO_110 (RIOC | 176)
|
||||
#define RIO_MAP_B110_TO_115200 (RIOC | 177)
|
||||
#define RIO_GET_PORT_PARAMS (RIOC | 178)
|
||||
#define RIO_SET_PORT_PARAMS (RIOC | 179)
|
||||
#define RIO_GET_PORT_TTY (RIOC | 180)
|
||||
#define RIO_SET_PORT_TTY (RIOC | 181)
|
||||
#define RIO_SYSLOG_ONLY (RIOC | 182)
|
||||
#define RIO_SYSLOG_CONS (RIOC | 183)
|
||||
#define RIO_CONS_ONLY (RIOC | 184)
|
||||
#define RIO_BLOCK_OPENS (RIOC | 185)
|
||||
|
||||
/*
|
||||
** 02.03.1999 ARG - ESIL 0820 fix :
|
||||
** RIOBootMode is no longer use by the driver, so these ioctls
|
||||
** are now obsolete :
|
||||
**
|
||||
#define RIO_GET_BOOT_MODE (RIOC | 186)
|
||||
#define RIO_SET_BOOT_MODE (RIOC | 187)
|
||||
**
|
||||
*/
|
||||
|
||||
#define RIO_MEM_DUMP (RIOC | 189)
|
||||
#define RIO_READ_REGISTER (RIOC | 190)
|
||||
#define RIO_GET_MODTYPE (RIOC | 191)
|
||||
#define RIO_SET_TIMER (RIOC | 192)
|
||||
#define RIO_READ_CHECK (RIOC | 196)
|
||||
#define RIO_WAITING_FOR_RESTART (RIOC | 197)
|
||||
#define RIO_BIND_RTA (RIOC | 198)
|
||||
#define RIO_GET_BINDINGS (RIOC | 199)
|
||||
#define RIO_PUT_BINDINGS (RIOC | 200)
|
||||
|
||||
#define RIO_MAKE_DEV (RIOC | 201)
|
||||
#define RIO_MINOR (RIOC | 202)
|
||||
|
||||
#define RIO_IDENTIFY_DRIVER (RIOC | 203)
|
||||
#define RIO_DISPLAY_HOST_CFG (RIOC | 204)
|
||||
|
||||
|
||||
/*
|
||||
** MAKE_DEV / MINOR stuff
|
||||
*/
|
||||
#define RIO_DEV_DIRECT 0x0000
|
||||
#define RIO_DEV_MODEM 0x0200
|
||||
#define RIO_DEV_XPRINT 0x0400
|
||||
#define RIO_DEV_MASK 0x0600
|
||||
|
||||
/*
|
||||
** port management, xprint stuff
|
||||
*/
|
||||
#define rIOCN(N) (RIOC|(N))
|
||||
#define rIOCR(N,T) (RIOC|(N))
|
||||
#define rIOCW(N,T) (RIOC|(N))
|
||||
|
||||
#define RIO_GET_XP_ON rIOCR(150,char[16]) /* start xprint string */
|
||||
#define RIO_SET_XP_ON rIOCW(151,char[16])
|
||||
#define RIO_GET_XP_OFF rIOCR(152,char[16]) /* finish xprint string */
|
||||
#define RIO_SET_XP_OFF rIOCW(153,char[16])
|
||||
#define RIO_GET_XP_CPS rIOCR(154,int) /* xprint CPS */
|
||||
#define RIO_SET_XP_CPS rIOCW(155,int)
|
||||
#define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */
|
||||
#define RIO_SET_IXANY rIOCW(157,int)
|
||||
#define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */
|
||||
#define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */
|
||||
#define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */
|
||||
#define RIO_SET_MODEM rIOCW(161,int)
|
||||
#define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */
|
||||
#define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */
|
||||
#define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */
|
||||
#define RIO_SET_IXON rIOCW(165,int)
|
||||
#define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */
|
||||
#define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */
|
||||
|
||||
#define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */
|
||||
|
||||
#define RIO_IOCTL_UNKNOWN -2
|
||||
|
||||
#endif
|
||||
104
drivers/char/rio/errors.h
Normal file
104
drivers/char/rio/errors.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : errors.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:10
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)errors.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_errors_h__
|
||||
#define __rio_errors_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
static char *_errors_h_sccs_ = "@(#)errors.h 1.2";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** error codes
|
||||
*/
|
||||
|
||||
#define NOTHING_WRONG_AT_ALL 0
|
||||
#define BAD_CHARACTER_IN_NAME 1
|
||||
#define TABLE_ENTRY_ISNT_PROPERLY_NULL 2
|
||||
#define UNKNOWN_HOST_NUMBER 3
|
||||
#define ZERO_RTA_ID 4
|
||||
#define BAD_RTA_ID 5
|
||||
#define DUPLICATED_RTA_ID 6
|
||||
#define DUPLICATE_UNIQUE_NUMBER 7
|
||||
#define BAD_TTY_NUMBER 8
|
||||
#define TTY_NUMBER_IN_USE 9
|
||||
#define NAME_USED_TWICE 10
|
||||
#define HOST_ID_NOT_ZERO 11
|
||||
#define BOOT_IN_PROGRESS 12
|
||||
#define COPYIN_FAILED 13
|
||||
#define HOST_FILE_TOO_LARGE 14
|
||||
#define COPYOUT_FAILED 15
|
||||
#define NOT_SUPER_USER 16
|
||||
#define RIO_ALREADY_POLLING 17
|
||||
|
||||
#define ID_NUMBER_OUT_OF_RANGE 18
|
||||
#define PORT_NUMBER_OUT_OF_RANGE 19
|
||||
#define HOST_NUMBER_OUT_OF_RANGE 20
|
||||
#define RUP_NUMBER_OUT_OF_RANGE 21
|
||||
#define TTY_NUMBER_OUT_OF_RANGE 22
|
||||
#define LINK_NUMBER_OUT_OF_RANGE 23
|
||||
|
||||
#define HOST_NOT_RUNNING 24
|
||||
#define IOCTL_COMMAND_UNKNOWN 25
|
||||
#define RIO_SYSTEM_HALTED 26
|
||||
#define WAIT_FOR_DRAIN_BROKEN 27
|
||||
#define PORT_NOT_MAPPED_INTO_SYSTEM 28
|
||||
#define EXCLUSIVE_USE_SET 29
|
||||
#define WAIT_FOR_NOT_CLOSING_BROKEN 30
|
||||
#define WAIT_FOR_PORT_TO_OPEN_BROKEN 31
|
||||
#define WAIT_FOR_CARRIER_BROKEN 32
|
||||
#define WAIT_FOR_NOT_IN_USE_BROKEN 33
|
||||
#define WAIT_FOR_CAN_ADD_COMMAND_BROKEN 34
|
||||
#define WAIT_FOR_ADD_COMMAND_BROKEN 35
|
||||
#define WAIT_FOR_NOT_PARAM_BROKEN 36
|
||||
#define WAIT_FOR_RETRY_BROKEN 37
|
||||
#define HOST_HAS_ALREADY_BEEN_BOOTED 38
|
||||
#define UNIT_IS_IN_USE 39
|
||||
#define COULDNT_FIND_ENTRY 40
|
||||
#define RTA_UNIQUE_NUMBER_ZERO 41
|
||||
#define CLOSE_COMMAND_FAILED 42
|
||||
#define WAIT_FOR_CLOSE_BROKEN 43
|
||||
#define CPS_VALUE_OUT_OF_RANGE 44
|
||||
#define ID_ALREADY_IN_USE 45
|
||||
#define SIGNALS_ALREADY_SET 46
|
||||
#define NOT_RECEIVING_PROCESS 47
|
||||
#define RTA_NUMBER_WRONG 48
|
||||
#define NO_SUCH_PRODUCT 49
|
||||
#define HOST_SYSPORT_BAD 50
|
||||
#define ID_NOT_TENTATIVE 51
|
||||
#define XPRINT_CPS_OUT_OF_RANGE 52
|
||||
#define NOT_ENOUGH_CORE_FOR_PCI_COPY 53
|
||||
|
||||
|
||||
#endif /* __rio_errors_h__ */
|
||||
149
drivers/char/rio/func.h
Normal file
149
drivers/char/rio/func.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : func.h
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 11:34:10
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)func.h 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __func_h_def
|
||||
#define __func_h_def
|
||||
|
||||
#include <linux/kdev_t.h>
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
static char *_func_h_sccs_ = "@(#)func.h 1.3";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* rioboot.c */
|
||||
int RIOBootCodeRTA(struct rio_info *, struct DownLoad *);
|
||||
int RIOBootCodeHOST(struct rio_info *, struct DownLoad *);
|
||||
int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *);
|
||||
void msec_timeout(struct Host *);
|
||||
int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *);
|
||||
int RIOBootOk(struct rio_info *, struct Host *, unsigned long);
|
||||
int RIORtaBound(struct rio_info *, unsigned int);
|
||||
void rio_fill_host_slot(int, int, unsigned int, struct Host *);
|
||||
|
||||
/* riocmd.c */
|
||||
int RIOFoadRta(struct Host *, struct Map *);
|
||||
int RIOZombieRta(struct Host *, struct Map *);
|
||||
int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *));
|
||||
int RIOIdentifyRta(struct rio_info *, void __user *);
|
||||
int RIOKillNeighbour(struct rio_info *, void __user *);
|
||||
int RIOSuspendBootRta(struct Host *, int, int);
|
||||
int RIOFoadWakeup(struct rio_info *);
|
||||
struct CmdBlk *RIOGetCmdBlk(void);
|
||||
void RIOFreeCmdBlk(struct CmdBlk *);
|
||||
int RIOQueueCmdBlk(struct Host *, unsigned int, struct CmdBlk *);
|
||||
void RIOPollHostCommands(struct rio_info *, struct Host *);
|
||||
int RIOWFlushMark(unsigned long, struct CmdBlk *);
|
||||
int RIORFlushEnable(unsigned long, struct CmdBlk *);
|
||||
int RIOUnUse(unsigned long, struct CmdBlk *);
|
||||
|
||||
/* rioctrl.c */
|
||||
int riocontrol(struct rio_info *, dev_t, int, unsigned long, int);
|
||||
|
||||
int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char);
|
||||
|
||||
/* rioinit.c */
|
||||
void rioinit(struct rio_info *, struct RioHostInfo *);
|
||||
void RIOInitHosts(struct rio_info *, struct RioHostInfo *);
|
||||
void RIOISAinit(struct rio_info *, int);
|
||||
int RIODoAT(struct rio_info *, int, int);
|
||||
caddr_t RIOCheckForATCard(int);
|
||||
int RIOAssignAT(struct rio_info *, int, void __iomem *, int);
|
||||
int RIOBoardTest(unsigned long, void __iomem *, unsigned char, int);
|
||||
void RIOAllocDataStructs(struct rio_info *);
|
||||
void RIOSetupDataStructs(struct rio_info *);
|
||||
int RIODefaultName(struct rio_info *, struct Host *, unsigned int);
|
||||
struct rioVersion *RIOVersid(void);
|
||||
void RIOHostReset(unsigned int, struct DpRam __iomem *, unsigned int);
|
||||
|
||||
/* riointr.c */
|
||||
void RIOTxEnable(char *);
|
||||
void RIOServiceHost(struct rio_info *, struct Host *);
|
||||
int riotproc(struct rio_info *, struct ttystatics *, int, int);
|
||||
|
||||
/* rioparam.c */
|
||||
int RIOParam(struct Port *, int, int, int);
|
||||
int RIODelay(struct Port *PortP, int);
|
||||
int RIODelay_ni(struct Port *PortP, int);
|
||||
void ms_timeout(struct Port *);
|
||||
int can_add_transmit(struct PKT __iomem **, struct Port *);
|
||||
void add_transmit(struct Port *);
|
||||
void put_free_end(struct Host *, struct PKT __iomem *);
|
||||
int can_remove_receive(struct PKT __iomem **, struct Port *);
|
||||
void remove_receive(struct Port *);
|
||||
|
||||
/* rioroute.c */
|
||||
int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *);
|
||||
void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int);
|
||||
unsigned int GetUnitType(unsigned int);
|
||||
int RIOSetChange(struct rio_info *);
|
||||
int RIOFindFreeID(struct rio_info *, struct Host *, unsigned int *, unsigned int *);
|
||||
|
||||
|
||||
/* riotty.c */
|
||||
|
||||
int riotopen(struct tty_struct *tty, struct file *filp);
|
||||
int riotclose(void *ptr);
|
||||
int riotioctl(struct rio_info *, struct tty_struct *, int, caddr_t);
|
||||
void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg);
|
||||
|
||||
/* riotable.c */
|
||||
int RIONewTable(struct rio_info *);
|
||||
int RIOApel(struct rio_info *);
|
||||
int RIODeleteRta(struct rio_info *, struct Map *);
|
||||
int RIOAssignRta(struct rio_info *, struct Map *);
|
||||
int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *);
|
||||
int RIOChangeName(struct rio_info *, struct Map *);
|
||||
|
||||
#if 0
|
||||
/* riodrvr.c */
|
||||
struct rio_info *rio_install(struct RioHostInfo *);
|
||||
int rio_uninstall(struct rio_info *);
|
||||
int rio_open(struct rio_info *, int, struct file *);
|
||||
int rio_close(struct rio_info *, struct file *);
|
||||
int rio_read(struct rio_info *, struct file *, char *, int);
|
||||
int rio_write(struct rio_info *, struct file *f, char *, int);
|
||||
int rio_ioctl(struct rio_info *, struct file *, int, char *);
|
||||
int rio_select(struct rio_info *, struct file *f, int, struct sel *);
|
||||
int rio_intr(char *);
|
||||
int rio_isr_thread(char *);
|
||||
struct rio_info *rio_info_store(int cmd, struct rio_info *p);
|
||||
#endif
|
||||
|
||||
extern void rio_copy_to_card(void *from, void __iomem *to, int len);
|
||||
extern int rio_minor(struct tty_struct *tty);
|
||||
extern int rio_ismodem(struct tty_struct *tty);
|
||||
|
||||
extern void rio_start_card_running(struct Host *HostP);
|
||||
|
||||
#endif /* __func_h_def */
|
||||
123
drivers/char/rio/host.h
Normal file
123
drivers/char/rio/host.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : host.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:10
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)host.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_host_h__
|
||||
#define __rio_host_h__
|
||||
|
||||
/*
|
||||
** the host structure - one per host card in the system.
|
||||
*/
|
||||
|
||||
#define MAX_EXTRA_UNITS 64
|
||||
|
||||
/*
|
||||
** Host data structure. This is used for the software equiv. of
|
||||
** the host.
|
||||
*/
|
||||
struct Host {
|
||||
struct pci_dev *pdev;
|
||||
unsigned char Type; /* RIO_EISA, RIO_MCA, ... */
|
||||
unsigned char Ivec; /* POLLED or ivec number */
|
||||
unsigned char Mode; /* Control stuff */
|
||||
unsigned char Slot; /* Slot */
|
||||
void __iomem *Caddr; /* KV address of DPRAM */
|
||||
struct DpRam __iomem *CardP; /* KV address of DPRAM, with overlay */
|
||||
unsigned long PaddrP; /* Phys. address of DPRAM */
|
||||
char Name[MAX_NAME_LEN]; /* The name of the host */
|
||||
unsigned int UniqueNum; /* host unique number */
|
||||
spinlock_t HostLock; /* Lock structure for MPX */
|
||||
unsigned int WorkToBeDone; /* set to true each interrupt */
|
||||
unsigned int InIntr; /* Being serviced? */
|
||||
unsigned int IntSrvDone; /* host's interrupt has been serviced */
|
||||
void (*Copy) (void *, void __iomem *, int); /* copy func */
|
||||
struct timer_list timer;
|
||||
/*
|
||||
** I M P O R T A N T !
|
||||
**
|
||||
** The rest of this data structure is cleared to zero after
|
||||
** a RIO_HOST_FOAD command.
|
||||
*/
|
||||
|
||||
unsigned long Flags; /* Whats going down */
|
||||
#define RC_WAITING 0
|
||||
#define RC_STARTUP 1
|
||||
#define RC_RUNNING 2
|
||||
#define RC_STUFFED 3
|
||||
#define RC_READY 7
|
||||
#define RUN_STATE 7
|
||||
/*
|
||||
** Boot mode applies to the way in which hosts in this system will
|
||||
** boot RTAs
|
||||
*/
|
||||
#define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */
|
||||
#define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */
|
||||
#define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */
|
||||
|
||||
struct Top Topology[LINKS_PER_UNIT]; /* one per link */
|
||||
struct Map Mapping[MAX_RUP]; /* Mappings for host */
|
||||
struct PHB __iomem *PhbP; /* Pointer to the PHB array */
|
||||
unsigned short __iomem *PhbNumP; /* Ptr to Number of PHB's */
|
||||
struct LPB __iomem *LinkStrP; /* Link Structure Array */
|
||||
struct RUP __iomem *RupP; /* Sixteen real rups here */
|
||||
struct PARM_MAP __iomem *ParmMapP; /* points to the parmmap */
|
||||
unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
|
||||
unsigned int NumExtraBooted; /* how many of the above */
|
||||
/*
|
||||
** Twenty logical rups.
|
||||
** The first sixteen are the real Rup entries (above), the last four
|
||||
** are the link RUPs.
|
||||
*/
|
||||
struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT];
|
||||
int timeout_id; /* For calling 100 ms delays */
|
||||
int timeout_sem; /* For calling 100 ms delays */
|
||||
long locks; /* long req'd for set_bit --RR */
|
||||
char ____end_marker____;
|
||||
};
|
||||
#define Control CardP->DpControl
|
||||
#define SetInt CardP->DpSetInt
|
||||
#define ResetTpu CardP->DpResetTpu
|
||||
#define ResetInt CardP->DpResetInt
|
||||
#define Signature CardP->DpSignature
|
||||
#define Sram1 CardP->DpSram1
|
||||
#define Sram2 CardP->DpSram2
|
||||
#define Sram3 CardP->DpSram3
|
||||
#define Scratch CardP->DpScratch
|
||||
#define __ParmMapR CardP->DpParmMapR
|
||||
#define SLX CardP->DpSlx
|
||||
#define Revision CardP->DpRevision
|
||||
#define Unique CardP->DpUnique
|
||||
#define Year CardP->DpYear
|
||||
#define Week CardP->DpWeek
|
||||
|
||||
#define RIO_DUMBPARM 0x0860 /* what not to expect */
|
||||
|
||||
#endif
|
||||
96
drivers/char/rio/link.h
Normal file
96
drivers/char/rio/link.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* L I N K
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra / Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _link_h
|
||||
#define _link_h 1
|
||||
|
||||
/*************************************************
|
||||
* Define the Link Status stuff
|
||||
************************************************/
|
||||
/* Boot request stuff */
|
||||
#define BOOT_REQUEST ((ushort) 0) /* Request for a boot */
|
||||
#define BOOT_ABORT ((ushort) 1) /* Abort a boot */
|
||||
#define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets
|
||||
and load address */
|
||||
#define BOOT_COMPLETED ((ushort) 3) /* Boot completed */
|
||||
|
||||
|
||||
struct LPB {
|
||||
u16 link_number; /* Link Number */
|
||||
u16 in_ch; /* Link In Channel */
|
||||
u16 out_ch; /* Link Out Channel */
|
||||
u8 attached_serial[4]; /* Attached serial number */
|
||||
u8 attached_host_serial[4];
|
||||
/* Serial number of Host who
|
||||
booted the other end */
|
||||
u16 descheduled; /* Currently Descheduled */
|
||||
u16 state; /* Current state */
|
||||
u16 send_poll; /* Send a Poll Packet */
|
||||
u16 ltt_p; /* Process Descriptor */
|
||||
u16 lrt_p; /* Process Descriptor */
|
||||
u16 lrt_status; /* Current lrt status */
|
||||
u16 ltt_status; /* Current ltt status */
|
||||
u16 timeout; /* Timeout value */
|
||||
u16 topology; /* Topology bits */
|
||||
u16 mon_ltt;
|
||||
u16 mon_lrt;
|
||||
u16 WaitNoBoot; /* Secs to hold off booting */
|
||||
u16 add_packet_list; /* Add packets to here */
|
||||
u16 remove_packet_list; /* Send packets from here */
|
||||
|
||||
u16 lrt_fail_chan; /* Lrt's failure channel */
|
||||
u16 ltt_fail_chan; /* Ltt's failure channel */
|
||||
|
||||
/* RUP structure for HOST to driver communications */
|
||||
struct RUP rup;
|
||||
struct RUP link_rup; /* RUP for the link (POLL,
|
||||
topology etc.) */
|
||||
u16 attached_link; /* Number of attached link */
|
||||
u16 csum_errors; /* csum errors */
|
||||
u16 num_disconnects; /* number of disconnects */
|
||||
u16 num_sync_rcvd; /* # sync's received */
|
||||
u16 num_sync_rqst; /* # sync requests */
|
||||
u16 num_tx; /* Num pkts sent */
|
||||
u16 num_rx; /* Num pkts received */
|
||||
u16 module_attached; /* Module tpyes of attached */
|
||||
u16 led_timeout; /* LED timeout */
|
||||
u16 first_port; /* First port to service */
|
||||
u16 last_port; /* Last port to service */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
77
drivers/char/rio/linux_compat.h
Normal file
77
drivers/char/rio/linux_compat.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* (C) 2000 R.E.Wolff@BitWizard.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
|
||||
#define DEBUG_ALL
|
||||
|
||||
struct ttystatics {
|
||||
struct termios tm;
|
||||
};
|
||||
|
||||
extern int rio_debug;
|
||||
|
||||
#define RIO_DEBUG_INIT 0x000001
|
||||
#define RIO_DEBUG_BOOT 0x000002
|
||||
#define RIO_DEBUG_CMD 0x000004
|
||||
#define RIO_DEBUG_CTRL 0x000008
|
||||
#define RIO_DEBUG_INTR 0x000010
|
||||
#define RIO_DEBUG_PARAM 0x000020
|
||||
#define RIO_DEBUG_ROUTE 0x000040
|
||||
#define RIO_DEBUG_TABLE 0x000080
|
||||
#define RIO_DEBUG_TTY 0x000100
|
||||
#define RIO_DEBUG_FLOW 0x000200
|
||||
#define RIO_DEBUG_MODEMSIGNALS 0x000400
|
||||
#define RIO_DEBUG_PROBE 0x000800
|
||||
#define RIO_DEBUG_CLEANUP 0x001000
|
||||
#define RIO_DEBUG_IFLOW 0x002000
|
||||
#define RIO_DEBUG_PFE 0x004000
|
||||
#define RIO_DEBUG_REC 0x008000
|
||||
#define RIO_DEBUG_SPINLOCK 0x010000
|
||||
#define RIO_DEBUG_DELAY 0x020000
|
||||
#define RIO_DEBUG_MOD_COUNT 0x040000
|
||||
|
||||
|
||||
/* Copied over from riowinif.h . This is ugly. The winif file declares
|
||||
also much other stuff which is incompatible with the headers from
|
||||
the older driver. The older driver includes "brates.h" which shadows
|
||||
the definitions from Linux, and is incompatible... */
|
||||
|
||||
/* RxBaud and TxBaud definitions... */
|
||||
#define RIO_B0 0x00 /* RTS / DTR signals dropped */
|
||||
#define RIO_B50 0x01 /* 50 baud */
|
||||
#define RIO_B75 0x02 /* 75 baud */
|
||||
#define RIO_B110 0x03 /* 110 baud */
|
||||
#define RIO_B134 0x04 /* 134.5 baud */
|
||||
#define RIO_B150 0x05 /* 150 baud */
|
||||
#define RIO_B200 0x06 /* 200 baud */
|
||||
#define RIO_B300 0x07 /* 300 baud */
|
||||
#define RIO_B600 0x08 /* 600 baud */
|
||||
#define RIO_B1200 0x09 /* 1200 baud */
|
||||
#define RIO_B1800 0x0A /* 1800 baud */
|
||||
#define RIO_B2400 0x0B /* 2400 baud */
|
||||
#define RIO_B4800 0x0C /* 4800 baud */
|
||||
#define RIO_B9600 0x0D /* 9600 baud */
|
||||
#define RIO_B19200 0x0E /* 19200 baud */
|
||||
#define RIO_B38400 0x0F /* 38400 baud */
|
||||
#define RIO_B56000 0x10 /* 56000 baud */
|
||||
#define RIO_B57600 0x11 /* 57600 baud */
|
||||
#define RIO_B64000 0x12 /* 64000 baud */
|
||||
#define RIO_B115200 0x13 /* 115200 baud */
|
||||
#define RIO_B2000 0x14 /* 2000 baud */
|
||||
102
drivers/char/rio/map.h
Normal file
102
drivers/char/rio/map.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : map.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:11
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)map.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_map_h__
|
||||
#define __rio_map_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_map_h_sccs_ = "@(#)map.h 1.2";
|
||||
#endif
|
||||
|
||||
/*
|
||||
** mapping structure passed to and from the config.rio program to
|
||||
** determine the current topology of the world
|
||||
*/
|
||||
|
||||
#define MAX_MAP_ENTRY 17
|
||||
#define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS)
|
||||
#define MAX_NAME_LEN 32
|
||||
|
||||
struct Map {
|
||||
unsigned int HostUniqueNum; /* Supporting hosts unique number */
|
||||
unsigned int RtaUniqueNum; /* Unique number */
|
||||
/*
|
||||
** The next two IDs must be swapped on big-endian architectures
|
||||
** when using a v2.04 /etc/rio/config with a v3.00 driver (when
|
||||
** upgrading for example).
|
||||
*/
|
||||
unsigned short ID; /* ID used in the subnet */
|
||||
unsigned short ID2; /* ID of 2nd block of 8 for 16 port */
|
||||
unsigned long Flags; /* Booted, ID Given, Disconnected */
|
||||
unsigned long SysPort; /* First tty mapped to this port */
|
||||
struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */
|
||||
char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */
|
||||
};
|
||||
|
||||
/*
|
||||
** Flag values:
|
||||
*/
|
||||
#define RTA_BOOTED 0x00000001
|
||||
#define RTA_NEWBOOT 0x00000010
|
||||
#define MSG_DONE 0x00000020
|
||||
#define RTA_INTERCONNECT 0x00000040
|
||||
#define RTA16_SECOND_SLOT 0x00000080
|
||||
#define BEEN_HERE 0x00000100
|
||||
#define SLOT_TENTATIVE 0x40000000
|
||||
#define SLOT_IN_USE 0x80000000
|
||||
|
||||
/*
|
||||
** HostUniqueNum is the unique number from the host card that this RTA
|
||||
** is to be connected to.
|
||||
** RtaUniqueNum is the unique number of the RTA concerned. It will be ZERO
|
||||
** if the slot in the table is unused. If it is the same as the HostUniqueNum
|
||||
** then this slot represents a host card.
|
||||
** Flags contains current boot/route state info
|
||||
** SysPort is a value in the range 0-504, being the number of the first tty
|
||||
** on this RTA. Each RTA supports 8 ports. The SysPort value must be modulo 8.
|
||||
** SysPort 0-127 correspond to /dev/ttyr001 to /dev/ttyr128, with minor
|
||||
** numbers 0-127. SysPort 128-255 correspond to /dev/ttyr129 to /dev/ttyr256,
|
||||
** again with minor numbers 0-127, and so on for SysPorts 256-383 and 384-511
|
||||
** ID will be in the range 0-16 for a `known' RTA. ID will be 0xFFFF for an
|
||||
** unused slot/unknown ID etc.
|
||||
** The Topology array contains the ID of the unit connected to each of the
|
||||
** four links on this unit. The entry will be 0xFFFF if NOTHING is connected
|
||||
** to the link, or will be 0xFF00 if an UNKNOWN unit is connected to the link.
|
||||
** The Name field is a null-terminated string, upto 31 characters, containing
|
||||
** the 'cute' name that the sysadmin/users know the RTA by. It is permissible
|
||||
** for this string to contain any character in the range \040 to \176 inclusive.
|
||||
** In particular, ctrl sequences and DEL (0x7F, \177) are not allowed. The
|
||||
** special character '%' IS allowable, and needs no special action.
|
||||
**
|
||||
*/
|
||||
|
||||
#endif
|
||||
60
drivers/char/rio/param.h
Normal file
60
drivers/char/rio/param.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : param.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:12
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)param.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_param_h__
|
||||
#define __rio_param_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_param_h_sccs_ = "@(#)param.h 1.2";
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** the param command block, as used in OPEN and PARAM calls.
|
||||
*/
|
||||
|
||||
struct phb_param {
|
||||
u8 Cmd; /* It is very important that these line up */
|
||||
u8 Cor1; /* with what is expected at the other end. */
|
||||
u8 Cor2; /* to confirm that you've got it right, */
|
||||
u8 Cor4; /* check with cirrus/cirrus.h */
|
||||
u8 Cor5;
|
||||
u8 TxXon; /* Transmit X-On character */
|
||||
u8 TxXoff; /* Transmit X-Off character */
|
||||
u8 RxXon; /* Receive X-On character */
|
||||
u8 RxXoff; /* Receive X-Off character */
|
||||
u8 LNext; /* Literal-next character */
|
||||
u8 TxBaud; /* Transmit baudrate */
|
||||
u8 RxBaud; /* Receive baudrate */
|
||||
};
|
||||
|
||||
#endif
|
||||
88
drivers/char/rio/parmmap.h
Normal file
88
drivers/char/rio/parmmap.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* H O S T M E M O R Y M A P
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra / Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
6/4/1991 jonb Made changes to accommodate Mips R3230 bus
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _parmap_h
|
||||
#define _parmap_h
|
||||
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
/* static char *_rio_parmmap_h_sccs = "@(#)parmmap.h 1.4"; */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct PARM_MAP PARM_MAP;
|
||||
|
||||
struct PARM_MAP {
|
||||
u16 phb_ptr; /* Pointer to the PHB array */
|
||||
u16 phb_num_ptr; /* Ptr to Number of PHB's */
|
||||
u16 free_list; /* Free List pointer */
|
||||
u16 free_list_end; /* Free List End pointer */
|
||||
u16 q_free_list_ptr; /* Ptr to Q_BUF variable */
|
||||
u16 unit_id_ptr; /* Unit Id */
|
||||
u16 link_str_ptr; /* Link Structure Array */
|
||||
u16 bootloader_1; /* 1st Stage Boot Loader */
|
||||
u16 bootloader_2; /* 2nd Stage Boot Loader */
|
||||
u16 port_route_map_ptr; /* Port Route Map */
|
||||
u16 route_ptr; /* Unit Route Map */
|
||||
u16 map_present; /* Route Map present */
|
||||
s16 pkt_num; /* Total number of packets */
|
||||
s16 q_num; /* Total number of Q packets */
|
||||
u16 buffers_per_port; /* Number of buffers per port */
|
||||
u16 heap_size; /* Initial size of heap */
|
||||
u16 heap_left; /* Current Heap left */
|
||||
u16 error; /* Error code */
|
||||
u16 tx_max; /* Max number of tx pkts per phb */
|
||||
u16 rx_max; /* Max number of rx pkts per phb */
|
||||
u16 rx_limit; /* For high / low watermarks */
|
||||
s16 links; /* Links to use */
|
||||
s16 timer; /* Interrupts per second */
|
||||
u16 rups; /* Pointer to the RUPs */
|
||||
u16 max_phb; /* Mostly for debugging */
|
||||
u16 living; /* Just increments!! */
|
||||
u16 init_done; /* Initialisation over */
|
||||
u16 booting_link;
|
||||
u16 idle_count; /* Idle time counter */
|
||||
u16 busy_count; /* Busy counter */
|
||||
u16 idle_control; /* Control Idle Process */
|
||||
u16 tx_intr; /* TX interrupt pending */
|
||||
u16 rx_intr; /* RX interrupt pending */
|
||||
u16 rup_intr; /* RUP interrupt pending */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
76
drivers/char/rio/pci.h
Normal file
76
drivers/char/rio/pci.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : pci.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:12
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)pci.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_pci_h__
|
||||
#define __rio_pci_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_pci_h_sccs_ = "@(#)pci.h 1.2";
|
||||
#endif
|
||||
|
||||
/*
|
||||
** PCI stuff
|
||||
*/
|
||||
|
||||
#define PCITpFastClock 0x80
|
||||
#define PCITpSlowClock 0x00
|
||||
#define PCITpFastLinks 0x40
|
||||
#define PCITpSlowLinks 0x00
|
||||
#define PCITpIntEnable 0x04
|
||||
#define PCITpIntDisable 0x00
|
||||
#define PCITpBusEnable 0x02
|
||||
#define PCITpBusDisable 0x00
|
||||
#define PCITpBootFromRam 0x01
|
||||
#define PCITpBootFromLink 0x00
|
||||
|
||||
#define RIO_PCI_VENDOR 0x11CB
|
||||
#define RIO_PCI_DEVICE 0x8000
|
||||
#define RIO_PCI_BASE_CLASS 0x02
|
||||
#define RIO_PCI_SUB_CLASS 0x80
|
||||
#define RIO_PCI_PROG_IFACE 0x00
|
||||
|
||||
#define RIO_PCI_RID 0x0008
|
||||
#define RIO_PCI_BADR0 0x0010
|
||||
#define RIO_PCI_INTLN 0x003C
|
||||
#define RIO_PCI_INTPIN 0x003D
|
||||
|
||||
#define RIO_PCI_MEM_SIZE 65536
|
||||
|
||||
#define RIO_PCI_TURBO_TP 0x80
|
||||
#define RIO_PCI_FAST_LINKS 0x40
|
||||
#define RIO_PCI_INT_ENABLE 0x04
|
||||
#define RIO_PCI_TP_BUS_ENABLE 0x02
|
||||
#define RIO_PCI_BOOT_FROM_RAM 0x01
|
||||
|
||||
#define RIO_PCI_DEFAULT_MODE 0x05
|
||||
|
||||
#endif /* __rio_pci_h__ */
|
||||
142
drivers/char/rio/phb.h
Normal file
142
drivers/char/rio/phb.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* P H B H E A D E R *******
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra, Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _phb_h
|
||||
#define _phb_h 1
|
||||
|
||||
/*************************************************
|
||||
* Handshake asserted. Deasserted by the LTT(s)
|
||||
************************************************/
|
||||
#define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */
|
||||
|
||||
#define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */
|
||||
|
||||
#define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET)
|
||||
/* Reset by ltt */
|
||||
|
||||
|
||||
/*************************************************
|
||||
* Maximum number of PHB's
|
||||
************************************************/
|
||||
#define MAX_PHB ((ushort) 128) /* range 0-127 */
|
||||
|
||||
/*************************************************
|
||||
* Defines for the mode fields
|
||||
************************************************/
|
||||
#define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */
|
||||
#define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */
|
||||
#define TX_TAB3 0x0004 /* TAB3 mode */
|
||||
#define TX_OCRNL 0x0008 /* OCRNL mode */
|
||||
#define TX_ONLCR 0x0010 /* ONLCR mode */
|
||||
#define TX_SENDSPACES 0x0020 /* Send n spaces command needs
|
||||
completing */
|
||||
#define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */
|
||||
#define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */
|
||||
#define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel
|
||||
port */
|
||||
#define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL)
|
||||
#define TX_DTRFLOW 0x0200 /* DTR tx flow control */
|
||||
#define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data
|
||||
into the FIFO */
|
||||
#define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */
|
||||
#define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */
|
||||
|
||||
#define RX_SPARE 0x0001 /* SPARE */
|
||||
#define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */
|
||||
#define RX_ICRNL 0x0008 /* ICRNL mode */
|
||||
#define RX_INLCR 0x0010 /* INLCR mode */
|
||||
#define RX_IGNCR 0x0020 /* IGNCR mode */
|
||||
#define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */
|
||||
#define RX_IXOFF 0x0080 /* IXOFF enabled */
|
||||
#define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */
|
||||
#define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */
|
||||
#define RX_BUFFERED 0x0400 /* Try and pass on complete packets */
|
||||
|
||||
#define PORT_ISOPEN 0x0001 /* Port open? */
|
||||
#define PORT_HUPCL 0x0002 /* Hangup on close? */
|
||||
#define PORT_MOPENPEND 0x0004 /* Modem open pending */
|
||||
#define PORT_ISPARALLEL 0x0008 /* Parallel port */
|
||||
#define PORT_BREAK 0x0010 /* Port on break */
|
||||
#define PORT_STATUSPEND 0x0020 /* Status packet pending */
|
||||
#define PORT_BREAKPEND 0x0040 /* Break packet pending */
|
||||
#define PORT_MODEMPEND 0x0080 /* Modem status packet pending */
|
||||
#define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel
|
||||
port */
|
||||
#define PORT_FULLMODEM 0x0200 /* Full modem signals */
|
||||
#define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */
|
||||
#define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */
|
||||
|
||||
#define PORT_MODEMBITS 0x0600 /* Mask for modem fields */
|
||||
|
||||
#define PORT_WCLOSE 0x0800 /* Waiting for close */
|
||||
#define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */
|
||||
#define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */
|
||||
#define DUMPMODE 0x4000 /* Dump RTA mem */
|
||||
#define READ_REG 0x8000 /* Read CD1400 register */
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* PHB Structure
|
||||
* A few words.
|
||||
*
|
||||
* Normally Packets are added to the end of the list and removed from
|
||||
* the start. The pointer tx_add points to a SPACE to put a Packet.
|
||||
* The pointer tx_remove points to the next Packet to remove
|
||||
*************************************************************************/
|
||||
|
||||
struct PHB {
|
||||
u8 source;
|
||||
u8 handshake;
|
||||
u8 status;
|
||||
u16 timeout; /* Maximum of 1.9 seconds */
|
||||
u8 link; /* Send down this link */
|
||||
u8 destination;
|
||||
u16 tx_start;
|
||||
u16 tx_end;
|
||||
u16 tx_add;
|
||||
u16 tx_remove;
|
||||
|
||||
u16 rx_start;
|
||||
u16 rx_end;
|
||||
u16 rx_add;
|
||||
u16 rx_remove;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
77
drivers/char/rio/pkt.h
Normal file
77
drivers/char/rio/pkt.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* P A C K E T H E A D E R F I L E
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra / Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _pkt_h
|
||||
#define _pkt_h 1
|
||||
|
||||
#define PKT_CMD_BIT ((ushort) 0x080)
|
||||
#define PKT_CMD_DATA ((ushort) 0x080)
|
||||
|
||||
#define PKT_ACK ((ushort) 0x040)
|
||||
|
||||
#define PKT_TGL ((ushort) 0x020)
|
||||
|
||||
#define PKT_LEN_MASK ((ushort) 0x07f)
|
||||
|
||||
#define DATA_WNDW ((ushort) 0x10)
|
||||
#define PKT_TTL_MASK ((ushort) 0x0f)
|
||||
|
||||
#define PKT_MAX_DATA_LEN 72
|
||||
|
||||
#define PKT_LENGTH sizeof(struct PKT)
|
||||
#define SYNC_PKT_LENGTH (PKT_LENGTH + 4)
|
||||
|
||||
#define CONTROL_PKT_LEN_MASK PKT_LEN_MASK
|
||||
#define CONTROL_PKT_CMD_BIT PKT_CMD_BIT
|
||||
#define CONTROL_PKT_ACK (PKT_ACK << 8)
|
||||
#define CONTROL_PKT_TGL (PKT_TGL << 8)
|
||||
#define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8)
|
||||
#define CONTROL_DATA_WNDW (DATA_WNDW << 8)
|
||||
|
||||
struct PKT {
|
||||
u8 dest_unit; /* Destination Unit Id */
|
||||
u8 dest_port; /* Destination POrt */
|
||||
u8 src_unit; /* Source Unit Id */
|
||||
u8 src_port; /* Source POrt */
|
||||
u8 len;
|
||||
u8 control;
|
||||
u8 data[PKT_MAX_DATA_LEN];
|
||||
/* Actual data :-) */
|
||||
u16 csum; /* C-SUM */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
179
drivers/char/rio/port.h
Normal file
179
drivers/char/rio/port.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : port.h
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 11:34:12
|
||||
** Retrieved : 11/6/98 11:34:21
|
||||
**
|
||||
** ident @(#)port.h 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_port_h__
|
||||
#define __rio_port_h__
|
||||
|
||||
/*
|
||||
** Port data structure
|
||||
*/
|
||||
struct Port {
|
||||
struct gs_port gs;
|
||||
int PortNum; /* RIO port no., 0-511 */
|
||||
struct Host *HostP;
|
||||
void __iomem *Caddr;
|
||||
unsigned short HostPort; /* Port number on host card */
|
||||
unsigned char RupNum; /* Number of RUP for port */
|
||||
unsigned char ID2; /* Second ID of RTA for port */
|
||||
unsigned long State; /* FLAGS for open & xopen */
|
||||
#define RIO_LOPEN 0x00001 /* Local open */
|
||||
#define RIO_MOPEN 0x00002 /* Modem open */
|
||||
#define RIO_WOPEN 0x00004 /* Waiting for open */
|
||||
#define RIO_CLOSING 0x00008 /* The port is being close */
|
||||
#define RIO_XPBUSY 0x00010 /* Transparent printer busy */
|
||||
#define RIO_BREAKING 0x00020 /* Break in progress */
|
||||
#define RIO_DIRECT 0x00040 /* Doing Direct output */
|
||||
#define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */
|
||||
#define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */
|
||||
#define RIO_CARR_ON 0x00200 /* Stream has carrier present */
|
||||
#define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */
|
||||
#define RIO_RBLK 0x00800 /* Stream is read-blocked */
|
||||
#define RIO_BUSY 0x01000 /* Stream is BUSY for write */
|
||||
#define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */
|
||||
#define RIO_TXSTOP 0x04000 /* Stream output is stopped */
|
||||
#define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */
|
||||
#define RIO_DYNOROD 0x10000 /* Drain failed */
|
||||
#define RIO_DELETED 0x20000 /* RTA has been deleted */
|
||||
#define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */
|
||||
#define RIO_USING_EUC 0x100000 /* Using extended Unix chars */
|
||||
#define RIO_CAN_COOK 0x200000 /* This line can do cooking */
|
||||
#define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */
|
||||
#define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */
|
||||
#define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */
|
||||
#define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */
|
||||
|
||||
unsigned long Config; /* FLAGS for NOREAD.... */
|
||||
#define RIO_NOREAD 0x0001 /* Are not allowed to read port */
|
||||
#define RIO_NOWRITE 0x0002 /* Are not allowed to write port */
|
||||
#define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */
|
||||
#define RIO_NOMASK 0x0007 /* All not allowed things */
|
||||
#define RIO_IXANY 0x0008 /* Port is allowed ixany */
|
||||
#define RIO_MODEM 0x0010 /* Stream is a modem device */
|
||||
#define RIO_IXON 0x0020 /* Port is allowed ixon */
|
||||
#define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */
|
||||
#define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */
|
||||
#define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */
|
||||
|
||||
/*
|
||||
** 15.10.1998 ARG - ESIL 0761 prt fix
|
||||
** As LynxOS does not appear to support Hardware Flow Control .....
|
||||
** Define our own flow control flags in 'Config'.
|
||||
*/
|
||||
#define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */
|
||||
#define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */
|
||||
|
||||
|
||||
struct PHB __iomem *PhbP; /* pointer to PHB for port */
|
||||
u16 __iomem *TxAdd; /* Add packets here */
|
||||
u16 __iomem *TxStart; /* Start of add array */
|
||||
u16 __iomem *TxEnd; /* End of add array */
|
||||
u16 __iomem *RxRemove; /* Remove packets here */
|
||||
u16 __iomem *RxStart; /* Start of remove array */
|
||||
u16 __iomem *RxEnd; /* End of remove array */
|
||||
unsigned int RtaUniqueNum; /* Unique number of RTA */
|
||||
unsigned short PortState; /* status of port */
|
||||
unsigned short ModemState; /* status of modem lines */
|
||||
unsigned long ModemLines; /* Modem bits sent to RTA */
|
||||
unsigned char CookMode; /* who expands CR/LF? */
|
||||
unsigned char ParamSem; /* Prevent write during param */
|
||||
unsigned char Mapped; /* if port mapped onto host */
|
||||
unsigned char SecondBlock; /* if port belongs to 2nd block
|
||||
of 16 port RTA */
|
||||
unsigned char InUse; /* how many pre-emptive cmds */
|
||||
unsigned char Lock; /* if params locked */
|
||||
unsigned char Store; /* if params stored across closes */
|
||||
unsigned char FirstOpen; /* TRUE if first time port opened */
|
||||
unsigned char FlushCmdBodge; /* if doing a (non)flush */
|
||||
unsigned char MagicFlags; /* require intr processing */
|
||||
#define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */
|
||||
#define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */
|
||||
#define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */
|
||||
unsigned char WflushFlag; /* 1 How many WFLUSHs active */
|
||||
/*
|
||||
** Transparent print stuff
|
||||
*/
|
||||
struct Xprint {
|
||||
#ifndef MAX_XP_CTRL_LEN
|
||||
#define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */
|
||||
#endif
|
||||
unsigned int XpCps;
|
||||
char XpOn[MAX_XP_CTRL_LEN];
|
||||
char XpOff[MAX_XP_CTRL_LEN];
|
||||
unsigned short XpLen; /* strlen(XpOn)+strlen(XpOff) */
|
||||
unsigned char XpActive;
|
||||
unsigned char XpLastTickOk; /* TRUE if we can process */
|
||||
#define XP_OPEN 00001
|
||||
#define XP_RUNABLE 00002
|
||||
struct ttystatics *XttyP;
|
||||
} Xprint;
|
||||
unsigned char RxDataStart;
|
||||
unsigned char Cor2Copy; /* copy of COR2 */
|
||||
char *Name; /* points to the Rta's name */
|
||||
char *TxRingBuffer;
|
||||
unsigned short TxBufferIn; /* New data arrives here */
|
||||
unsigned short TxBufferOut; /* Intr removes data here */
|
||||
unsigned short OldTxBufferOut; /* Indicates if draining */
|
||||
int TimeoutId; /* Timeout ID */
|
||||
unsigned int Debug;
|
||||
unsigned char WaitUntilBooted; /* True if open should block */
|
||||
unsigned int statsGather; /* True if gathering stats */
|
||||
unsigned long txchars; /* Chars transmitted */
|
||||
unsigned long rxchars; /* Chars received */
|
||||
unsigned long opens; /* port open count */
|
||||
unsigned long closes; /* port close count */
|
||||
unsigned long ioctls; /* ioctl count */
|
||||
unsigned char LastRxTgl; /* Last state of rx toggle bit */
|
||||
spinlock_t portSem; /* Lock using this sem */
|
||||
int MonitorTstate; /* Monitoring ? */
|
||||
int timeout_id; /* For calling 100 ms delays */
|
||||
int timeout_sem; /* For calling 100 ms delays */
|
||||
int firstOpen; /* First time open ? */
|
||||
char *p; /* save the global struc here .. */
|
||||
};
|
||||
|
||||
struct ModuleInfo {
|
||||
char *Name;
|
||||
unsigned int Flags[4]; /* one per port on a module */
|
||||
};
|
||||
|
||||
/*
|
||||
** This struct is required because trying to grab an entire Port structure
|
||||
** runs into problems with differing struct sizes between driver and config.
|
||||
*/
|
||||
struct PortParams {
|
||||
unsigned int Port;
|
||||
unsigned long Config;
|
||||
unsigned long State;
|
||||
struct ttystatics *TtyP;
|
||||
};
|
||||
|
||||
#endif
|
||||
117
drivers/char/rio/protsts.h
Normal file
117
drivers/char/rio/protsts.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* P R O T O C O L S T A T U S S T R U C T U R E *******
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra / Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _protsts_h
|
||||
#define _protsts_h 1
|
||||
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
/* static char *_rio_protsts_h_sccs = "@(#)protsts.h 1.4"; */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*************************************************
|
||||
* ACK bit. Last Packet received OK. Set by
|
||||
* rxpkt to indicate that the Packet has been
|
||||
* received OK and that the LTT must set the ACK
|
||||
* bit in the next outward bound Packet
|
||||
* and re-set by LTT's after xmit.
|
||||
*
|
||||
* Gets shoved into rx_status
|
||||
************************************************/
|
||||
#define PHB_RX_LAST_PKT_ACKED ((ushort) 0x080)
|
||||
|
||||
/*******************************************************
|
||||
* The Rx TOGGLE bit.
|
||||
* Stuffed into rx_status by RXPKT
|
||||
******************************************************/
|
||||
#define PHB_RX_DATA_WNDW ((ushort) 0x040)
|
||||
|
||||
/*******************************************************
|
||||
* The Rx TOGGLE bit. Matches the setting in PKT.H
|
||||
* Stuffed into rx_status
|
||||
******************************************************/
|
||||
#define PHB_RX_TGL ((ushort) 0x2000)
|
||||
|
||||
|
||||
/*************************************************
|
||||
* This bit is set by the LRT to indicate that
|
||||
* an ACK (packet) must be returned.
|
||||
*
|
||||
* Gets shoved into tx_status
|
||||
************************************************/
|
||||
#define PHB_TX_SEND_PKT_ACK ((ushort) 0x08)
|
||||
|
||||
/*************************************************
|
||||
* Set by LTT to indicate that an ACK is required
|
||||
*************************************************/
|
||||
#define PHB_TX_ACK_RQRD ((ushort) 0x01)
|
||||
|
||||
|
||||
/*******************************************************
|
||||
* The Tx TOGGLE bit.
|
||||
* Stuffed into tx_status by RXPKT from the PKT WndW
|
||||
* field. Looked by the LTT when the NEXT Packet
|
||||
* is going to be sent.
|
||||
******************************************************/
|
||||
#define PHB_TX_DATA_WNDW ((ushort) 0x04)
|
||||
|
||||
|
||||
/*******************************************************
|
||||
* The Tx TOGGLE bit. Matches the setting in PKT.H
|
||||
* Stuffed into tx_status
|
||||
******************************************************/
|
||||
#define PHB_TX_TGL ((ushort) 0x02)
|
||||
|
||||
/*******************************************************
|
||||
* Request intr bit. Set when the queue has gone quiet
|
||||
* and the PHB has requested an interrupt.
|
||||
******************************************************/
|
||||
#define PHB_TX_INTR ((ushort) 0x100)
|
||||
|
||||
/*******************************************************
|
||||
* SET if the PHB cannot send any more data down the
|
||||
* Link
|
||||
******************************************************/
|
||||
#define PHB_TX_HANDSHAKE ((ushort) 0x010)
|
||||
|
||||
|
||||
#define RUP_SEND_WNDW ((ushort) 0x08) ;
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
208
drivers/char/rio/rio.h
Normal file
208
drivers/char/rio/rio.h
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 1998 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : rio.h
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 11:34:13
|
||||
** Retrieved : 11/6/98 11:34:22
|
||||
**
|
||||
** ident @(#)rio.h 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_rio_h__
|
||||
#define __rio_rio_h__
|
||||
|
||||
/*
|
||||
** Maximum numbers of things
|
||||
*/
|
||||
#define RIO_SLOTS 4 /* number of configuration slots */
|
||||
#define RIO_HOSTS 4 /* number of hosts that can be found */
|
||||
#define PORTS_PER_HOST 128 /* number of ports per host */
|
||||
#define LINKS_PER_UNIT 4 /* number of links from a host */
|
||||
#define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */
|
||||
#define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */
|
||||
#define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */
|
||||
#define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */
|
||||
/* number of modules on an RTA */
|
||||
#define MODULES_PER_RTA (PORTS_PER_RTA/PORTS_PER_MODULE)
|
||||
#define MAX_PRODUCT 16 /* numbr of different product codes */
|
||||
#define MAX_MODULE_TYPES 16 /* number of different types of module */
|
||||
|
||||
#define RIO_CONTROL_DEV 128 /* minor number of host/control device */
|
||||
#define RIO_INVALID_MAJOR 0 /* test first host card's major no for validity */
|
||||
|
||||
/*
|
||||
** number of RTAs that can be bound to a master
|
||||
*/
|
||||
#define MAX_RTA_BINDINGS (MAX_RUP * RIO_HOSTS)
|
||||
|
||||
/*
|
||||
** Unit types
|
||||
*/
|
||||
#define PC_RTA16 0x90000000
|
||||
#define PC_RTA8 0xe0000000
|
||||
#define TYPE_HOST 0
|
||||
#define TYPE_RTA8 1
|
||||
#define TYPE_RTA16 2
|
||||
|
||||
/*
|
||||
** Flag values returned by functions
|
||||
*/
|
||||
|
||||
#define RIO_FAIL -1
|
||||
|
||||
/*
|
||||
** SysPort value for something that hasn't any ports
|
||||
*/
|
||||
#define NO_PORT 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
** Unit ID Of all hosts
|
||||
*/
|
||||
#define HOST_ID 0
|
||||
|
||||
/*
|
||||
** Break bytes into nybles
|
||||
*/
|
||||
#define LONYBLE(X) ((X) & 0xF)
|
||||
#define HINYBLE(X) (((X)>>4) & 0xF)
|
||||
|
||||
/*
|
||||
** Flag values passed into some functions
|
||||
*/
|
||||
#define DONT_SLEEP 0
|
||||
#define OK_TO_SLEEP 1
|
||||
|
||||
#define DONT_PRINT 1
|
||||
#define DO_PRINT 0
|
||||
|
||||
#define PRINT_TO_LOG_CONS 0
|
||||
#define PRINT_TO_CONS 1
|
||||
#define PRINT_TO_LOG 2
|
||||
|
||||
/*
|
||||
** Timeout has trouble with times of less than 3 ticks...
|
||||
*/
|
||||
#define MIN_TIMEOUT 3
|
||||
|
||||
/*
|
||||
** Generally useful constants
|
||||
*/
|
||||
|
||||
#define HUNDRED_MS ((HZ/10)?(HZ/10):1)
|
||||
#define ONE_MEG 0x100000
|
||||
#define SIXTY_FOUR_K 0x10000
|
||||
|
||||
#define RIO_AT_MEM_SIZE SIXTY_FOUR_K
|
||||
#define RIO_EISA_MEM_SIZE SIXTY_FOUR_K
|
||||
#define RIO_MCA_MEM_SIZE SIXTY_FOUR_K
|
||||
|
||||
#define COOK_WELL 0
|
||||
#define COOK_MEDIUM 1
|
||||
#define COOK_RAW 2
|
||||
|
||||
/*
|
||||
** Pointer manipulation stuff
|
||||
** RIO_PTR takes hostp->Caddr and the offset into the DP RAM area
|
||||
** and produces a UNIX caddr_t (pointer) to the object
|
||||
** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and
|
||||
** returns the offset into the DP RAM area.
|
||||
*/
|
||||
#define RIO_PTR(C,O) (((unsigned char __iomem *)(C))+(0xFFFF&(O)))
|
||||
#define RIO_OFF(C,O) ((unsigned char __iomem *)(O)-(unsigned char __iomem *)(C))
|
||||
|
||||
/*
|
||||
** How to convert from various different device number formats:
|
||||
** DEV is a dev number, as passed to open, close etc - NOT a minor
|
||||
** number!
|
||||
**/
|
||||
|
||||
#define RIO_MODEM_MASK 0x1FF
|
||||
#define RIO_MODEM_BIT 0x200
|
||||
#define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK)
|
||||
#define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT)
|
||||
#define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \
|
||||
+ MINOR(DEV)
|
||||
#define CSUM(pkt_ptr) (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \
|
||||
((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \
|
||||
((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \
|
||||
((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \
|
||||
((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] )
|
||||
|
||||
#define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */
|
||||
/* prevent a really stupid race condition. */
|
||||
|
||||
#define NOT_INITIALISED 0
|
||||
#define INITIALISED 1
|
||||
|
||||
#define NOT_POLLING 0
|
||||
#define POLLING 1
|
||||
|
||||
#define NOT_CHANGED 0
|
||||
#define CHANGED 1
|
||||
|
||||
#define NOT_INUSE 0
|
||||
|
||||
#define DISCONNECT 0
|
||||
#define CONNECT 1
|
||||
|
||||
/* ------ Control Codes ------ */
|
||||
|
||||
#define CONTROL '^'
|
||||
#define IFOAD ( CONTROL + 1 )
|
||||
#define IDENTIFY ( CONTROL + 2 )
|
||||
#define ZOMBIE ( CONTROL + 3 )
|
||||
#define UFOAD ( CONTROL + 4 )
|
||||
#define IWAIT ( CONTROL + 5 )
|
||||
|
||||
#define IFOAD_MAGIC 0xF0AD /* of course */
|
||||
#define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */
|
||||
#define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */
|
||||
#define IWAIT_MAGIC 0xB1DE /* Bide your time */
|
||||
|
||||
/* ------ Error Codes ------ */
|
||||
|
||||
#define E_NO_ERROR ((ushort) 0)
|
||||
|
||||
/* ------ Free Lists ------ */
|
||||
|
||||
struct rio_free_list {
|
||||
u16 next;
|
||||
u16 prev;
|
||||
};
|
||||
|
||||
/* NULL for card side linked lists */
|
||||
#define TPNULL ((ushort)(0x8000))
|
||||
/* We can add another packet to a transmit queue if the packet pointer pointed
|
||||
* to by the TxAdd pointer has PKT_IN_USE clear in its address. */
|
||||
#define PKT_IN_USE 0x1
|
||||
|
||||
/* ------ Topology ------ */
|
||||
|
||||
struct Top {
|
||||
u8 Unit;
|
||||
u8 Link;
|
||||
};
|
||||
|
||||
#endif /* __rio_h__ */
|
||||
1218
drivers/char/rio/rio_linux.c
Normal file
1218
drivers/char/rio/rio_linux.c
Normal file
File diff suppressed because it is too large
Load Diff
197
drivers/char/rio/rio_linux.h
Normal file
197
drivers/char/rio/rio_linux.h
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
/*
|
||||
* rio_linux.h
|
||||
*
|
||||
* Copyright (C) 1998,1999,2000 R.E.Wolff@BitWizard.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* RIO serial driver.
|
||||
*
|
||||
* Version 1.0 -- July, 1999.
|
||||
*
|
||||
*/
|
||||
|
||||
#define RIO_NBOARDS 4
|
||||
#define RIO_PORTSPERBOARD 128
|
||||
#define RIO_NPORTS (RIO_NBOARDS * RIO_PORTSPERBOARD)
|
||||
|
||||
#define MODEM_SUPPORT
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define RIO_MAGIC 0x12345678
|
||||
|
||||
|
||||
struct vpd_prom {
|
||||
unsigned short id;
|
||||
char hwrev;
|
||||
char hwass;
|
||||
int uniqid;
|
||||
char myear;
|
||||
char mweek;
|
||||
char hw_feature[5];
|
||||
char oem_id;
|
||||
char identifier[16];
|
||||
};
|
||||
|
||||
|
||||
#define RIO_DEBUG_ALL 0xffffffff
|
||||
|
||||
#define O_OTHER(tty) \
|
||||
((O_OLCUC(tty)) ||\
|
||||
(O_ONLCR(tty)) ||\
|
||||
(O_OCRNL(tty)) ||\
|
||||
(O_ONOCR(tty)) ||\
|
||||
(O_ONLRET(tty)) ||\
|
||||
(O_OFILL(tty)) ||\
|
||||
(O_OFDEL(tty)) ||\
|
||||
(O_NLDLY(tty)) ||\
|
||||
(O_CRDLY(tty)) ||\
|
||||
(O_TABDLY(tty)) ||\
|
||||
(O_BSDLY(tty)) ||\
|
||||
(O_VTDLY(tty)) ||\
|
||||
(O_FFDLY(tty)))
|
||||
|
||||
/* Same for input. */
|
||||
#define I_OTHER(tty) \
|
||||
((I_INLCR(tty)) ||\
|
||||
(I_IGNCR(tty)) ||\
|
||||
(I_ICRNL(tty)) ||\
|
||||
(I_IUCLC(tty)) ||\
|
||||
(L_ISIG(tty)))
|
||||
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
||||
#define RIO_BOARD_INTR_LOCK 1
|
||||
|
||||
|
||||
#ifndef RIOCTL_MISC_MINOR
|
||||
/* Allow others to gather this into "major.h" or something like that */
|
||||
#define RIOCTL_MISC_MINOR 169
|
||||
#endif
|
||||
|
||||
|
||||
/* Allow us to debug "in the field" without requiring clients to
|
||||
recompile.... */
|
||||
#if 1
|
||||
#define rio_spin_lock_irqsave(sem, flags) do { \
|
||||
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \
|
||||
sem, __FILE__, __LINE__);\
|
||||
spin_lock_irqsave(sem, flags);\
|
||||
} while (0)
|
||||
|
||||
#define rio_spin_unlock_irqrestore(sem, flags) do { \
|
||||
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\
|
||||
sem, __FILE__, __LINE__);\
|
||||
spin_unlock_irqrestore(sem, flags);\
|
||||
} while (0)
|
||||
|
||||
#define rio_spin_lock(sem) do { \
|
||||
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\
|
||||
sem, __FILE__, __LINE__);\
|
||||
spin_lock(sem);\
|
||||
} while (0)
|
||||
|
||||
#define rio_spin_unlock(sem) do { \
|
||||
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\
|
||||
sem, __FILE__, __LINE__);\
|
||||
spin_unlock(sem);\
|
||||
} while (0)
|
||||
#else
|
||||
#define rio_spin_lock_irqsave(sem, flags) \
|
||||
spin_lock_irqsave(sem, flags)
|
||||
|
||||
#define rio_spin_unlock_irqrestore(sem, flags) \
|
||||
spin_unlock_irqrestore(sem, flags)
|
||||
|
||||
#define rio_spin_lock(sem) \
|
||||
spin_lock(sem)
|
||||
|
||||
#define rio_spin_unlock(sem) \
|
||||
spin_unlock(sem)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_RIO_OLDPCI
|
||||
static inline void __iomem *rio_memcpy_toio(void __iomem *dummy, void __iomem *dest, void *source, int n)
|
||||
{
|
||||
char __iomem *dst = dest;
|
||||
char *src = source;
|
||||
|
||||
while (n--) {
|
||||
writeb(*src++, dst++);
|
||||
(void) readb(dummy);
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline void __iomem *rio_copy_toio(void __iomem *dest, void *source, int n)
|
||||
{
|
||||
char __iomem *dst = dest;
|
||||
char *src = source;
|
||||
|
||||
while (n--)
|
||||
writeb(*src++, dst++);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n)
|
||||
{
|
||||
char *dst = dest;
|
||||
char __iomem *src = source;
|
||||
|
||||
while (n--)
|
||||
*dst++ = readb(src++);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#else
|
||||
#define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n)
|
||||
#define rio_copy_toio memcpy_toio
|
||||
#define rio_memcpy_fromio memcpy_fromio
|
||||
#endif
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
|
||||
/*
|
||||
This driver can spew a whole lot of debugging output at you. If you
|
||||
need maximum performance, you should disable the DEBUG define. To
|
||||
aid in debugging in the field, I'm leaving the compile-time debug
|
||||
features enabled, and disable them "runtime". That allows me to
|
||||
instruct people with problems to enable debugging without requiring
|
||||
them to recompile...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#define rio_dprintk(f, str...) do { if (rio_debug & f) printk (str);} while (0)
|
||||
#define func_enter() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s\n", __FUNCTION__)
|
||||
#define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__)
|
||||
#define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line)
|
||||
#else
|
||||
#define rio_dprintk(f, str...) /* nothing */
|
||||
#define func_enter()
|
||||
#define func_exit()
|
||||
#define func_enter2()
|
||||
#endif
|
||||
281
drivers/char/rio/rioboard.h
Normal file
281
drivers/char/rio/rioboard.h
Normal file
@@ -0,0 +1,281 @@
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Title : RIO Host Card Hardware Definitions */
|
||||
/* */
|
||||
/* Author : N.P.Vassallo */
|
||||
/* */
|
||||
/* Creation : 26th April 1999 */
|
||||
/* */
|
||||
/* Version : 1.0.0 */
|
||||
/* */
|
||||
/* Copyright : (c) Specialix International Ltd. 1999 *
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* */
|
||||
/* Description : Prototypes, structures and definitions */
|
||||
/* describing the RIO board hardware */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* History...
|
||||
|
||||
1.0.0 26/04/99 NPV Creation.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _rioboard_h /* If RIOBOARD.H not already defined */
|
||||
#define _rioboard_h 1
|
||||
|
||||
/*****************************************************************************
|
||||
*********************** ***********************
|
||||
*********************** Hardware Control Registers ***********************
|
||||
*********************** ***********************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Hardware Registers... */
|
||||
|
||||
#define RIO_REG_BASE 0x7C00 /* Base of control registers */
|
||||
|
||||
#define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */
|
||||
#define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */
|
||||
#define RIO_RESET RIO_REG_BASE + 0x0100 /* WRITE: Host Reset */
|
||||
#define RIO_INTRESET RIO_REG_BASE + 0x0180 /* WRITE: Interrupt Reset */
|
||||
|
||||
#define RIO_VPD_ROM RIO_REG_BASE + 0x0000 /* READ: Vital Product Data ROM */
|
||||
#define RIO_INTSTAT RIO_REG_BASE + 0x0080 /* READ: Interrupt Status (Jet boards only) */
|
||||
#define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */
|
||||
|
||||
/* RIO_VPD_ROM definitions... */
|
||||
#define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */
|
||||
#define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */
|
||||
#define VPD_HW_REV 0x02 /* READ: Hardware Revision */
|
||||
#define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */
|
||||
#define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */
|
||||
#define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */
|
||||
#define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */
|
||||
#define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */
|
||||
#define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */
|
||||
#define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */
|
||||
#define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */
|
||||
#define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */
|
||||
#define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */
|
||||
#define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */
|
||||
#define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */
|
||||
#define VPD_OEMID 0x0F /* READ: OEM Identifier */
|
||||
#define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */
|
||||
#define VPD_IDENT_LEN 0x10
|
||||
|
||||
/* VPD ROM Definitions... */
|
||||
#define SLX_ID1 0x4D
|
||||
#define SLX_ID2 0x98
|
||||
|
||||
#define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */
|
||||
|
||||
#define ID_SX_ISA 0x2
|
||||
#define ID_RIO_EISA 0x3
|
||||
#define ID_SX_PCI 0x5
|
||||
#define ID_SX_EISA 0x7
|
||||
#define ID_RIO_RTA16 0x9
|
||||
#define ID_RIO_ISA 0xA
|
||||
#define ID_RIO_MCA 0xB
|
||||
#define ID_RIO_SBUS 0xC
|
||||
#define ID_RIO_PCI 0xD
|
||||
#define ID_RIO_RTA8 0xE
|
||||
|
||||
/* Transputer bootstrap definitions... */
|
||||
|
||||
#define BOOTLOADADDR (0x8000 - 6)
|
||||
#define BOOTINDICATE (0x8000 - 2)
|
||||
|
||||
/* Firmware load position... */
|
||||
|
||||
#define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */
|
||||
|
||||
/*****************************************************************************
|
||||
***************************** *****************************
|
||||
***************************** RIO (Rev1) ISA *****************************
|
||||
***************************** *****************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_ISA_IDENT "JBJGPGGHINSMJPJR"
|
||||
|
||||
#define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */
|
||||
#define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */
|
||||
#define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */
|
||||
#define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */
|
||||
#define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */
|
||||
#define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */
|
||||
|
||||
/*****************************************************************************
|
||||
***************************** *****************************
|
||||
***************************** RIO (Rev2) ISA *****************************
|
||||
***************************** *****************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR"
|
||||
|
||||
#define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */
|
||||
#define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */
|
||||
#define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */
|
||||
#define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */
|
||||
#define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */
|
||||
#define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */
|
||||
#define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */
|
||||
#define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */
|
||||
#define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */
|
||||
|
||||
/*****************************************************************************
|
||||
***************************** ******************************
|
||||
***************************** RIO (Jet) ISA ******************************
|
||||
***************************** ******************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_ISA3_IDENT "JET HOST BY KEV#"
|
||||
|
||||
#define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */
|
||||
#define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */
|
||||
#define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */
|
||||
#define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */
|
||||
#define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */
|
||||
#define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */
|
||||
#define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */
|
||||
|
||||
/*****************************************************************************
|
||||
********************************* ********************************
|
||||
********************************* RIO MCA ********************************
|
||||
********************************* ********************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_MCA_IDENT "JBJGPGGHINSMJPJR"
|
||||
|
||||
#define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */
|
||||
|
||||
/*****************************************************************************
|
||||
******************************** ********************************
|
||||
******************************** RIO EISA ********************************
|
||||
******************************** ********************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* EISA Configuration Space Definitions... */
|
||||
#define EISA_PRODUCT_ID1 0xC80
|
||||
#define EISA_PRODUCT_ID2 0xC81
|
||||
#define EISA_PRODUCT_NUMBER 0xC82
|
||||
#define EISA_REVISION_NUMBER 0xC83
|
||||
#define EISA_CARD_ENABLE 0xC84
|
||||
#define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */
|
||||
#define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */
|
||||
#define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */
|
||||
#define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */
|
||||
#define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */
|
||||
#define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */
|
||||
#define EISA_MEM_ADDR_23_16 0xC00
|
||||
#define EISA_MEM_ADDR_31_24 0xC01
|
||||
#define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */
|
||||
#define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */
|
||||
#define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */
|
||||
#define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */
|
||||
#define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */
|
||||
#define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */
|
||||
#define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */
|
||||
#define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */
|
||||
#define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */
|
||||
#define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */
|
||||
#define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */
|
||||
#define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */
|
||||
#define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */
|
||||
#define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */
|
||||
#define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */
|
||||
#define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */
|
||||
#define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */
|
||||
|
||||
/*****************************************************************************
|
||||
******************************** ********************************
|
||||
******************************** RIO SBus ********************************
|
||||
******************************** ********************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0"
|
||||
|
||||
#define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */
|
||||
#define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */
|
||||
#define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */
|
||||
#define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */
|
||||
#define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */
|
||||
#define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */
|
||||
#define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */
|
||||
#define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */
|
||||
#define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */
|
||||
#define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */
|
||||
#define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */
|
||||
#define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */
|
||||
|
||||
/*****************************************************************************
|
||||
********************************* ********************************
|
||||
********************************* RIO PCI ********************************
|
||||
********************************* ********************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#"
|
||||
|
||||
#define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */
|
||||
#define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */
|
||||
#define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */
|
||||
#define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */
|
||||
|
||||
/* PCI Definitions... */
|
||||
#define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */
|
||||
#define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */
|
||||
#define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */
|
||||
#define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */
|
||||
#define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */
|
||||
|
||||
/*****************************************************************************
|
||||
***************************** ******************************
|
||||
***************************** RIO (Jet) PCI ******************************
|
||||
***************************** ******************************
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control Register Definitions... */
|
||||
#define RIO_PCI2_IDENT "JET HOST BY KEV#"
|
||||
|
||||
#define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */
|
||||
#define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */
|
||||
|
||||
/* PCI Definitions... */
|
||||
#define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */
|
||||
|
||||
#endif /*_rioboard_h */
|
||||
|
||||
/* End of RIOBOARD.H */
|
||||
1114
drivers/char/rio/rioboot.c
Normal file
1114
drivers/char/rio/rioboot.c
Normal file
File diff suppressed because it is too large
Load Diff
943
drivers/char/rio/riocmd.c
Normal file
943
drivers/char/rio/riocmd.c
Normal file
@@ -0,0 +1,943 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** ported from the existing SCO driver source
|
||||
**
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riocmd.c
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 10:33:41
|
||||
** Retrieved : 11/6/98 10:33:49
|
||||
**
|
||||
** ident @(#)riocmd.c 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/tty.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "rio_linux.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
|
||||
|
||||
static struct IdentifyRta IdRta;
|
||||
static struct KillNeighbour KillUnit;
|
||||
|
||||
int RIOFoadRta(struct Host *HostP, struct Map *MapP)
|
||||
{
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n");
|
||||
|
||||
CmdBlkP = RIOGetCmdBlk();
|
||||
|
||||
if (!CmdBlkP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
CmdBlkP->Packet.dest_unit = MapP->ID;
|
||||
CmdBlkP->Packet.dest_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.src_unit = 0;
|
||||
CmdBlkP->Packet.src_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.len = 0x84;
|
||||
CmdBlkP->Packet.data[0] = IFOAD;
|
||||
CmdBlkP->Packet.data[1] = 0;
|
||||
CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF;
|
||||
CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF;
|
||||
|
||||
if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RIOZombieRta(struct Host *HostP, struct Map *MapP)
|
||||
{
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n");
|
||||
|
||||
CmdBlkP = RIOGetCmdBlk();
|
||||
|
||||
if (!CmdBlkP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
CmdBlkP->Packet.dest_unit = MapP->ID;
|
||||
CmdBlkP->Packet.dest_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.src_unit = 0;
|
||||
CmdBlkP->Packet.src_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.len = 0x84;
|
||||
CmdBlkP->Packet.data[0] = ZOMBIE;
|
||||
CmdBlkP->Packet.data[1] = 0;
|
||||
CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF;
|
||||
CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF;
|
||||
|
||||
if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
|
||||
{
|
||||
unsigned int Host;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func);
|
||||
|
||||
if (!RtaUnique)
|
||||
return (0);
|
||||
|
||||
for (Host = 0; Host < p->RIONumHosts; Host++) {
|
||||
unsigned int Rta;
|
||||
struct Host *HostP = &p->RIOHosts[Host];
|
||||
|
||||
for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
|
||||
struct Map *MapP = &HostP->Mapping[Rta];
|
||||
|
||||
if (MapP->RtaUniqueNum == RtaUnique) {
|
||||
uint Link;
|
||||
|
||||
/*
|
||||
** now, lets just check we have a route to it...
|
||||
** IF the routing stuff is working, then one of the
|
||||
** topology entries for this unit will have a legit
|
||||
** route *somewhere*. We care not where - if its got
|
||||
** any connections, we can get to it.
|
||||
*/
|
||||
for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
|
||||
if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
|
||||
/*
|
||||
** Its worth trying the operation...
|
||||
*/
|
||||
return (*func) (HostP, MapP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
||||
int RIOIdentifyRta(struct rio_info *p, void __user * arg)
|
||||
{
|
||||
unsigned int Host;
|
||||
|
||||
if (copy_from_user(&IdRta, arg, sizeof(IdRta))) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
|
||||
p->RIOError.Error = COPYIN_FAILED;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
for (Host = 0; Host < p->RIONumHosts; Host++) {
|
||||
unsigned int Rta;
|
||||
struct Host *HostP = &p->RIOHosts[Host];
|
||||
|
||||
for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
|
||||
struct Map *MapP = &HostP->Mapping[Rta];
|
||||
|
||||
if (MapP->RtaUniqueNum == IdRta.RtaUnique) {
|
||||
uint Link;
|
||||
/*
|
||||
** now, lets just check we have a route to it...
|
||||
** IF the routing stuff is working, then one of the
|
||||
** topology entries for this unit will have a legit
|
||||
** route *somewhere*. We care not where - if its got
|
||||
** any connections, we can get to it.
|
||||
*/
|
||||
for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
|
||||
if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
|
||||
/*
|
||||
** Its worth trying the operation...
|
||||
*/
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n");
|
||||
|
||||
CmdBlkP = RIOGetCmdBlk();
|
||||
|
||||
if (!CmdBlkP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
CmdBlkP->Packet.dest_unit = MapP->ID;
|
||||
CmdBlkP->Packet.dest_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.src_unit = 0;
|
||||
CmdBlkP->Packet.src_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.len = 0x84;
|
||||
CmdBlkP->Packet.data[0] = IDENTIFY;
|
||||
CmdBlkP->Packet.data[1] = 0;
|
||||
CmdBlkP->Packet.data[2] = IdRta.ID;
|
||||
|
||||
if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
||||
int RIOKillNeighbour(struct rio_info *p, void __user * arg)
|
||||
{
|
||||
uint Host;
|
||||
uint ID;
|
||||
struct Host *HostP;
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
|
||||
|
||||
if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
|
||||
p->RIOError.Error = COPYIN_FAILED;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (KillUnit.Link > 3)
|
||||
return -ENXIO;
|
||||
|
||||
CmdBlkP = RIOGetCmdBlk();
|
||||
|
||||
if (!CmdBlkP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
CmdBlkP->Packet.dest_unit = 0;
|
||||
CmdBlkP->Packet.src_unit = 0;
|
||||
CmdBlkP->Packet.dest_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.src_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.len = 0x84;
|
||||
CmdBlkP->Packet.data[0] = UFOAD;
|
||||
CmdBlkP->Packet.data[1] = KillUnit.Link;
|
||||
CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF;
|
||||
CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF;
|
||||
|
||||
for (Host = 0; Host < p->RIONumHosts; Host++) {
|
||||
ID = 0;
|
||||
HostP = &p->RIOHosts[Host];
|
||||
|
||||
if (HostP->UniqueNum == KillUnit.UniqueNum) {
|
||||
if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (ID = 0; ID < RTAS_PER_HOST; ID++) {
|
||||
if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) {
|
||||
CmdBlkP->Packet.dest_unit = ID + 1;
|
||||
if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
RIOFreeCmdBlk(CmdBlkP);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
|
||||
{
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
|
||||
|
||||
CmdBlkP = RIOGetCmdBlk();
|
||||
|
||||
if (!CmdBlkP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
CmdBlkP->Packet.dest_unit = ID;
|
||||
CmdBlkP->Packet.dest_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.src_unit = 0;
|
||||
CmdBlkP->Packet.src_port = BOOT_RUP;
|
||||
CmdBlkP->Packet.len = 0x84;
|
||||
CmdBlkP->Packet.data[0] = IWAIT;
|
||||
CmdBlkP->Packet.data[1] = Link;
|
||||
CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF;
|
||||
CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF;
|
||||
|
||||
if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RIOFoadWakeup(struct rio_info *p)
|
||||
{
|
||||
int port;
|
||||
struct Port *PortP;
|
||||
unsigned long flags;
|
||||
|
||||
for (port = 0; port < RIO_PORTS; port++) {
|
||||
PortP = p->RIOPortp[port];
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
PortP->Config = 0;
|
||||
PortP->State = 0;
|
||||
PortP->InUse = NOT_INUSE;
|
||||
PortP->PortState = 0;
|
||||
PortP->FlushCmdBodge = 0;
|
||||
PortP->ModemLines = 0;
|
||||
PortP->ModemState = 0;
|
||||
PortP->CookMode = 0;
|
||||
PortP->ParamSem = 0;
|
||||
PortP->Mapped = 0;
|
||||
PortP->WflushFlag = 0;
|
||||
PortP->MagicFlags = 0;
|
||||
PortP->RxDataStart = 0;
|
||||
PortP->TxBufferIn = 0;
|
||||
PortP->TxBufferOut = 0;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
** Incoming command on the COMMAND_RUP to be processed.
|
||||
*/
|
||||
static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT __iomem *PacketP)
|
||||
{
|
||||
struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *)PacketP->data;
|
||||
struct Port *PortP;
|
||||
struct UnixRup *UnixRupP;
|
||||
unsigned short SysPort;
|
||||
unsigned short ReportedModemStatus;
|
||||
unsigned short rup;
|
||||
unsigned short subCommand;
|
||||
unsigned long flags;
|
||||
|
||||
func_enter();
|
||||
|
||||
/*
|
||||
** 16 port RTA note:
|
||||
** Command rup packets coming from the RTA will have pkt->data[1] (which
|
||||
** translates to PktCmdP->PhbNum) set to the host port number for the
|
||||
** particular unit. To access the correct BaseSysPort for a 16 port RTA,
|
||||
** we can use PhbNum to get the rup number for the appropriate 8 port
|
||||
** block (for the first block, this should be equal to 'Rup').
|
||||
*/
|
||||
rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA;
|
||||
UnixRupP = &HostP->UnixRups[rup];
|
||||
SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA);
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
|
||||
|
||||
if (UnixRupP->BaseSysPort == NO_PORT) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
|
||||
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
|
||||
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
|
||||
|
||||
if (Rup >= (unsigned short) MAX_RUP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
|
||||
} else
|
||||
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", readb(&PacketP->dest_unit), readb(&PacketP->dest_port));
|
||||
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", readb(&PacketP->src_unit), readb(&PacketP->src_port));
|
||||
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", readb(&PacketP->len), readb(&PacketP->len));
|
||||
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", readb(&PacketP->control), readb(&PacketP->control));
|
||||
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", readw(&PacketP->csum), readw(&PacketP->csum));
|
||||
rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", readb(&PktCmdP->PhbNum), readb(&PktCmdP->Command));
|
||||
return 1;
|
||||
}
|
||||
PortP = p->RIOPortp[SysPort];
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
switch (readb(&PktCmdP->Command)) {
|
||||
case BREAK_RECEIVED:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
|
||||
/* If the current line disc. is not multi-threading and
|
||||
the current processor is not the default, reset rup_intr
|
||||
and return 0 to ensure that the command packet is
|
||||
not freed. */
|
||||
/* Call tmgr HANGUP HERE */
|
||||
/* Fix this later when every thing works !!!! RAMRAJ */
|
||||
gs_got_break(&PortP->gs);
|
||||
break;
|
||||
|
||||
case COMPLETE:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts);
|
||||
subCommand = 1;
|
||||
switch (readb(&PktCmdP->SubCommand)) {
|
||||
case MEMDUMP:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr));
|
||||
break;
|
||||
case READ_REGISTER:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr));
|
||||
p->CdRegister = (readb(&PktCmdP->ModemStatus) & MSVR1_HOST);
|
||||
break;
|
||||
default:
|
||||
subCommand = 0;
|
||||
break;
|
||||
}
|
||||
if (subCommand)
|
||||
break;
|
||||
rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState);
|
||||
if (PortP->PortState != readb(&PktCmdP->PortStatus)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
|
||||
PortP->PortState = readb(&PktCmdP->PortStatus);
|
||||
/* What should we do here ...
|
||||
wakeup( &PortP->PortState );
|
||||
*/
|
||||
} else
|
||||
rio_dprintk(RIO_DEBUG_CMD, "No change\n");
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case MODEM_STATUS:
|
||||
/*
|
||||
** Knock out the tbusy and tstop bits, as these are not relevant
|
||||
** to the check for modem status change (they're just there because
|
||||
** it's a convenient place to put them!).
|
||||
*/
|
||||
ReportedModemStatus = readb(&PktCmdP->ModemStatus);
|
||||
if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
|
||||
/*
|
||||
** Update ModemState just in case tbusy or tstop states have
|
||||
** changed.
|
||||
*/
|
||||
PortP->ModemState = ReportedModemStatus;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus);
|
||||
PortP->ModemState = ReportedModemStatus;
|
||||
#ifdef MODEM_SUPPORT
|
||||
if (PortP->Mapped) {
|
||||
/***********************************************************\
|
||||
*************************************************************
|
||||
*** ***
|
||||
*** M O D E M S T A T E C H A N G E ***
|
||||
*** ***
|
||||
*************************************************************
|
||||
\***********************************************************/
|
||||
/*
|
||||
** If the device is a modem, then check the modem
|
||||
** carrier.
|
||||
*/
|
||||
if (PortP->gs.tty == NULL)
|
||||
break;
|
||||
if (PortP->gs.tty->termios == NULL)
|
||||
break;
|
||||
|
||||
if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
|
||||
/*
|
||||
** Is there a carrier?
|
||||
*/
|
||||
if (PortP->ModemState & MSVR1_CD) {
|
||||
/*
|
||||
** Has carrier just appeared?
|
||||
*/
|
||||
if (!(PortP->State & RIO_CARR_ON)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n");
|
||||
PortP->State |= RIO_CARR_ON;
|
||||
/*
|
||||
** wakeup anyone in WOPEN
|
||||
*/
|
||||
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
|
||||
wake_up_interruptible(&PortP->gs.open_wait);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** Has carrier just dropped?
|
||||
*/
|
||||
if (PortP->State & RIO_CARR_ON) {
|
||||
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
|
||||
tty_hangup(PortP->gs.tty);
|
||||
PortP->State &= ~RIO_CARR_ON;
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %Zd\n", readb(&PktCmdP->Command), HostP - p->RIOHosts);
|
||||
break;
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
|
||||
func_exit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** The command mechanism:
|
||||
** Each rup has a chain of commands associated with it.
|
||||
** This chain is maintained by routines in this file.
|
||||
** Periodically we are called and we run a quick check of all the
|
||||
** active chains to determine if there is a command to be executed,
|
||||
** and if the rup is ready to accept it.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** Allocate an empty command block.
|
||||
*/
|
||||
struct CmdBlk *RIOGetCmdBlk(void)
|
||||
{
|
||||
struct CmdBlk *CmdBlkP;
|
||||
|
||||
CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
|
||||
if (CmdBlkP)
|
||||
memset(CmdBlkP, 0, sizeof(struct CmdBlk));
|
||||
return CmdBlkP;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a block to the head of the free list.
|
||||
*/
|
||||
void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
|
||||
{
|
||||
kfree(CmdBlkP);
|
||||
}
|
||||
|
||||
/*
|
||||
** attach a command block to the list of commands to be performed for
|
||||
** a given rup.
|
||||
*/
|
||||
int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
|
||||
{
|
||||
struct CmdBlk **Base;
|
||||
struct UnixRup *UnixRupP;
|
||||
unsigned long flags;
|
||||
|
||||
if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
|
||||
RIOFreeCmdBlk(CmdBlkP);
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
UnixRupP = &HostP->UnixRups[Rup];
|
||||
|
||||
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
|
||||
/*
|
||||
** If the RUP is currently inactive, then put the request
|
||||
** straight on the RUP....
|
||||
*/
|
||||
if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
|
||||
: 1)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
|
||||
|
||||
/*
|
||||
** Whammy! blat that pack!
|
||||
*/
|
||||
HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT));
|
||||
|
||||
/*
|
||||
** place command packet on the pending position.
|
||||
*/
|
||||
UnixRupP->CmdPendingP = CmdBlkP;
|
||||
|
||||
/*
|
||||
** set the command register
|
||||
*/
|
||||
writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol);
|
||||
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n");
|
||||
|
||||
if (UnixRupP->CmdsWaitingP != NULL)
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
|
||||
if (UnixRupP->CmdPendingP != NULL)
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
|
||||
if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
|
||||
|
||||
Base = &UnixRupP->CmdsWaitingP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base);
|
||||
|
||||
while (*Base) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base);
|
||||
Base = &((*Base)->NextP);
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base);
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base);
|
||||
|
||||
*Base = CmdBlkP;
|
||||
|
||||
CmdBlkP->NextP = NULL;
|
||||
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Here we go - if there is an empty rup, fill it!
|
||||
** must be called at splrio() or higher.
|
||||
*/
|
||||
void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
|
||||
{
|
||||
struct CmdBlk *CmdBlkP;
|
||||
struct UnixRup *UnixRupP;
|
||||
struct PKT __iomem *PacketP;
|
||||
unsigned short Rup;
|
||||
unsigned long flags;
|
||||
|
||||
|
||||
Rup = MAX_RUP + LINKS_PER_UNIT;
|
||||
|
||||
do { /* do this loop for each RUP */
|
||||
/*
|
||||
** locate the rup we are processing & lock it
|
||||
*/
|
||||
UnixRupP = &HostP->UnixRups[--Rup];
|
||||
|
||||
spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
|
||||
/*
|
||||
** First check for incoming commands:
|
||||
*/
|
||||
if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
|
||||
int FreeMe;
|
||||
|
||||
PacketP = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt));
|
||||
|
||||
switch (readb(&PacketP->dest_port)) {
|
||||
case BOOT_RUP:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0]));
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
|
||||
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
break;
|
||||
|
||||
case COMMAND_RUP:
|
||||
/*
|
||||
** Free the RUP lock as loss of carrier causes a
|
||||
** ttyflush which will (eventually) call another
|
||||
** routine that uses the RUP lock.
|
||||
*/
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
|
||||
if (readb(&PacketP->data[5]) == MEMDUMP) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", readw(&(PacketP->data[6])));
|
||||
rio_memcpy_fromio(p->RIOMemDump, &(PacketP->data[8]), 32);
|
||||
}
|
||||
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
break;
|
||||
|
||||
case ROUTE_RUP:
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
FreeMe = RIORouteRup(p, Rup, HostP, PacketP);
|
||||
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
break;
|
||||
|
||||
default:
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port));
|
||||
FreeMe = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (FreeMe) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
|
||||
put_free_end(HostP, PacketP);
|
||||
|
||||
writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol);
|
||||
|
||||
if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
|
||||
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** IF a command was running on the port,
|
||||
** and it has completed, then tidy it up.
|
||||
*/
|
||||
if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
|
||||
(readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
|
||||
/*
|
||||
** we are idle.
|
||||
** there is a command in pending.
|
||||
** Therefore, this command has finished.
|
||||
** So, wakeup whoever is waiting for it (and tell them
|
||||
** what happened).
|
||||
*/
|
||||
if (CmdBlkP->Packet.dest_port == BOOT_RUP)
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP);
|
||||
|
||||
/*
|
||||
** Clear the Rup lock to prevent mutual exclusion.
|
||||
*/
|
||||
if (CmdBlkP->PostFuncP) {
|
||||
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
(*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP);
|
||||
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
** ....clear the pending flag....
|
||||
*/
|
||||
UnixRupP->CmdPendingP = NULL;
|
||||
|
||||
/*
|
||||
** ....and return the command block to the freelist.
|
||||
*/
|
||||
RIOFreeCmdBlk(CmdBlkP);
|
||||
}
|
||||
|
||||
/*
|
||||
** If there is a command for this rup, and the rup
|
||||
** is idle, then process the command
|
||||
*/
|
||||
if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
|
||||
(UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
|
||||
/*
|
||||
** if the pre-function is non-zero, call it.
|
||||
** If it returns RIO_FAIL then don't
|
||||
** send this command yet!
|
||||
*/
|
||||
if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : 1)) {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command %p\n", CmdBlkP);
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Start new command %p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]);
|
||||
/*
|
||||
** Whammy! blat that pack!
|
||||
*/
|
||||
HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT));
|
||||
|
||||
/*
|
||||
** remove the command from the rup command queue...
|
||||
*/
|
||||
UnixRupP->CmdsWaitingP = CmdBlkP->NextP;
|
||||
|
||||
/*
|
||||
** ...and place it on the pending position.
|
||||
*/
|
||||
UnixRupP->CmdPendingP = CmdBlkP;
|
||||
|
||||
/*
|
||||
** set the command register
|
||||
*/
|
||||
writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol);
|
||||
|
||||
/*
|
||||
** the command block will be freed
|
||||
** when the command has been processed.
|
||||
*/
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
|
||||
} while (Rup);
|
||||
}
|
||||
|
||||
int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP)
|
||||
{
|
||||
struct Port *PortP = (struct Port *) iPortP;
|
||||
unsigned long flags;
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
PortP->WflushFlag++;
|
||||
PortP->MagicFlags |= MAGIC_FLUSH;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return RIOUnUse(iPortP, CmdBlkP);
|
||||
}
|
||||
|
||||
int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP)
|
||||
{
|
||||
struct Port *PortP = (struct Port *) iPortP;
|
||||
struct PKT __iomem *PacketP;
|
||||
unsigned long flags;
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
while (can_remove_receive(&PacketP, PortP)) {
|
||||
remove_receive(PortP);
|
||||
put_free_end(PortP->HostP, PacketP);
|
||||
}
|
||||
|
||||
if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
|
||||
/*
|
||||
** MAGIC! (Basically, handshake the RX buffer, so that
|
||||
** the RTAs upstream can be re-enabled.)
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
|
||||
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return RIOUnUse(iPortP, CmdBlkP);
|
||||
}
|
||||
|
||||
int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP)
|
||||
{
|
||||
struct Port *PortP = (struct Port *) iPortP;
|
||||
unsigned long flags;
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
|
||||
|
||||
if (PortP->InUse) {
|
||||
if (--PortP->InUse != NOT_INUSE) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** While PortP->InUse is set (i.e. a preemptive command has been sent to
|
||||
** the RTA and is awaiting completion), any transmit data is prevented from
|
||||
** being transferred from the write queue into the transmit packets
|
||||
** (add_transmit) and no furthur transmit interrupt will be sent for that
|
||||
** data. The next interrupt will occur up to 500ms later (RIOIntr is called
|
||||
** twice a second as a saftey measure). This was the case when kermit was
|
||||
** used to send data into a RIO port. After each packet was sent, TCFLSH
|
||||
** was called to flush the read queue preemptively. PortP->InUse was
|
||||
** incremented, thereby blocking the 6 byte acknowledgement packet
|
||||
** transmitted back. This acknowledgment hung around for 500ms before
|
||||
** being sent, thus reducing input performance substantially!.
|
||||
** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
|
||||
** hanging around in the transmit buffer is sent immediately.
|
||||
*/
|
||||
writew(1, &PortP->HostP->ParmMapP->tx_intr);
|
||||
/* What to do here ..
|
||||
wakeup( (caddr_t)&(PortP->InUse) );
|
||||
*/
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
** How to use this file:
|
||||
**
|
||||
** To send a command down a rup, you need to allocate a command block, fill
|
||||
** in the packet information, fill in the command number, fill in the pre-
|
||||
** and post- functions and arguments, and then add the command block to the
|
||||
** queue of command blocks for the port in question. When the port is idle,
|
||||
** then the pre-function will be called. If this returns RIO_FAIL then the
|
||||
** command will be re-queued and tried again at a later date (probably in one
|
||||
** clock tick). If the pre-function returns NOT RIO_FAIL, then the command
|
||||
** packet will be queued on the RUP, and the txcontrol field set to the
|
||||
** command number. When the txcontrol field has changed from being the
|
||||
** command number, then the post-function will be called, with the argument
|
||||
** specified earlier, a pointer to the command block, and the value of
|
||||
** txcontrol.
|
||||
**
|
||||
** To allocate a command block, call RIOGetCmdBlk(). This returns a pointer
|
||||
** to the command block structure allocated, or NULL if there aren't any.
|
||||
** The block will have been zeroed for you.
|
||||
**
|
||||
** The structure has the following fields:
|
||||
**
|
||||
** struct CmdBlk
|
||||
** {
|
||||
** struct CmdBlk *NextP; ** Pointer to next command block **
|
||||
** struct PKT Packet; ** A packet, to copy to the rup **
|
||||
** int (*PreFuncP)(); ** The func to call to check if OK **
|
||||
** int PreArg; ** The arg for the func **
|
||||
** int (*PostFuncP)(); ** The func to call when completed **
|
||||
** int PostArg; ** The arg for the func **
|
||||
** };
|
||||
**
|
||||
** You need to fill in ALL fields EXCEPT NextP, which is used to link the
|
||||
** blocks together either on the free list or on the Rup list.
|
||||
**
|
||||
** Packet is an actual packet structure to be filled in with the packet
|
||||
** information associated with the command. You need to fill in everything,
|
||||
** as the command processor doesn't process the command packet in any way.
|
||||
**
|
||||
** The PreFuncP is called before the packet is enqueued on the host rup.
|
||||
** PreFuncP is called as (*PreFuncP)(PreArg, CmdBlkP);. PreFuncP must
|
||||
** return !RIO_FAIL to have the packet queued on the rup, and RIO_FAIL
|
||||
** if the packet is NOT to be queued.
|
||||
**
|
||||
** The PostFuncP is called when the command has completed. It is called
|
||||
** as (*PostFuncP)(PostArg, CmdBlkP, txcontrol);. PostFuncP is not expected
|
||||
** to return a value. PostFuncP does NOT need to free the command block,
|
||||
** as this happens automatically after PostFuncP returns.
|
||||
**
|
||||
** Once the command block has been filled in, it is attached to the correct
|
||||
** queue by calling RIOQueueCmdBlk( HostP, Rup, CmdBlkP ) where HostP is
|
||||
** a pointer to the struct Host, Rup is the NUMBER of the rup (NOT a pointer
|
||||
** to it!), and CmdBlkP is the pointer to the command block allocated using
|
||||
** RIOGetCmdBlk().
|
||||
**
|
||||
*/
|
||||
1505
drivers/char/rio/rioctrl.c
Normal file
1505
drivers/char/rio/rioctrl.c
Normal file
File diff suppressed because it is too large
Load Diff
142
drivers/char/rio/riodrvr.h
Normal file
142
drivers/char/rio/riodrvr.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riodrvr.h
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 09:22:46
|
||||
** Retrieved : 11/6/98 09:22:46
|
||||
**
|
||||
** ident @(#)riodrvr.h 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __riodrvr_h
|
||||
#define __riodrvr_h
|
||||
|
||||
#include <asm/param.h> /* for HZ */
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3";
|
||||
#endif
|
||||
|
||||
#define MEMDUMP_SIZE 32
|
||||
#define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT)
|
||||
|
||||
|
||||
struct rio_info {
|
||||
int mode; /* Intr or polled, word/byte */
|
||||
spinlock_t RIOIntrSem; /* Interrupt thread sem */
|
||||
int current_chan; /* current channel */
|
||||
int RIOFailed; /* Not initialised ? */
|
||||
int RIOInstallAttempts; /* no. of rio-install() calls */
|
||||
int RIOLastPCISearch; /* status of last search */
|
||||
int RIONumHosts; /* Number of RIO Hosts */
|
||||
struct Host *RIOHosts; /* RIO Host values */
|
||||
struct Port **RIOPortp; /* RIO port values */
|
||||
/*
|
||||
** 02.03.1999 ARG - ESIL 0820 fix
|
||||
** We no longer use RIOBootMode
|
||||
**
|
||||
int RIOBootMode; * RIO boot mode *
|
||||
**
|
||||
*/
|
||||
int RIOPrintDisabled; /* RIO printing disabled ? */
|
||||
int RIOPrintLogState; /* RIO printing state ? */
|
||||
int RIOPolling; /* Polling ? */
|
||||
/*
|
||||
** 09.12.1998 ARG - ESIL 0776 part fix
|
||||
** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted.
|
||||
** The fix for this ESIL introduces another member (RIORtaDisCons) here to be
|
||||
** updated in RIOConCon() - to keep track of RTA connections/disconnections.
|
||||
** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons.
|
||||
*/
|
||||
int RIOHalted; /* halted ? */
|
||||
int RIORtaDisCons; /* RTA connections/disconnections */
|
||||
unsigned int RIOReadCheck; /* Rio read check */
|
||||
unsigned int RIONoMessage; /* To display message or not */
|
||||
unsigned int RIONumBootPkts; /* how many packets for an RTA */
|
||||
unsigned int RIOBootCount; /* size of RTA code */
|
||||
unsigned int RIOBooting; /* count of outstanding boots */
|
||||
unsigned int RIOSystemUp; /* Booted ?? */
|
||||
unsigned int RIOCounting; /* for counting interrupts */
|
||||
unsigned int RIOIntCount; /* # of intr since last check */
|
||||
unsigned int RIOTxCount; /* number of xmit intrs */
|
||||
unsigned int RIORxCount; /* number of rx intrs */
|
||||
unsigned int RIORupCount; /* number of rup intrs */
|
||||
int RIXTimer;
|
||||
int RIOBufferSize; /* Buffersize */
|
||||
int RIOBufferMask; /* Buffersize */
|
||||
|
||||
int RIOFirstMajor; /* First host card's major no */
|
||||
|
||||
unsigned int RIOLastPortsMapped; /* highest port number known */
|
||||
unsigned int RIOFirstPortsMapped; /* lowest port number known */
|
||||
|
||||
unsigned int RIOLastPortsBooted; /* highest port number running */
|
||||
unsigned int RIOFirstPortsBooted; /* lowest port number running */
|
||||
|
||||
unsigned int RIOLastPortsOpened; /* highest port number running */
|
||||
unsigned int RIOFirstPortsOpened; /* lowest port number running */
|
||||
|
||||
/* Flag to say that the topology information has been changed. */
|
||||
unsigned int RIOQuickCheck;
|
||||
unsigned int CdRegister; /* ??? */
|
||||
int RIOSignalProcess; /* Signalling process */
|
||||
int rio_debug; /* To debug ... */
|
||||
int RIODebugWait; /* For what ??? */
|
||||
int tpri; /* Thread prio */
|
||||
int tid; /* Thread id */
|
||||
unsigned int _RIO_Polled; /* Counter for polling */
|
||||
unsigned int _RIO_Interrupted; /* Counter for interrupt */
|
||||
int intr_tid; /* iointset return value */
|
||||
int TxEnSem; /* TxEnable Semaphore */
|
||||
|
||||
|
||||
struct Error RIOError; /* to Identify what went wrong */
|
||||
struct Conf RIOConf; /* Configuration ??? */
|
||||
struct ttystatics channel[RIO_PORTS]; /* channel information */
|
||||
char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)]
|
||||
[RTA_BOOT_DATA_SIZE];
|
||||
struct Map RIOConnectTable[TOTAL_MAP_ENTRIES];
|
||||
struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
|
||||
|
||||
/* RTA to host binding table for master/slave operation */
|
||||
unsigned long RIOBindTab[MAX_RTA_BINDINGS];
|
||||
/* RTA memory dump variable */
|
||||
unsigned char RIOMemDump[MEMDUMP_SIZE];
|
||||
struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES];
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef linux
|
||||
#define debug(x) printk x
|
||||
#else
|
||||
#define debug(x) kkprintf x
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define RIO_RESET_INT 0x7d80
|
||||
|
||||
#endif /* __riodrvr.h */
|
||||
96
drivers/char/rio/rioinfo.h
Normal file
96
drivers/char/rio/rioinfo.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : rioinfo.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 14:07:49
|
||||
** Retrieved : 11/6/98 14:07:50
|
||||
**
|
||||
** ident @(#)rioinfo.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rioinfo_h
|
||||
#define __rioinfo_h
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h 1.2";
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Host card data structure
|
||||
*/
|
||||
struct RioHostInfo {
|
||||
long location; /* RIO Card Base I/O address */
|
||||
long vector; /* RIO Card IRQ vector */
|
||||
int bus; /* ISA/EISA/MCA/PCI */
|
||||
int mode; /* pointer to host mode - INTERRUPT / POLLED */
|
||||
struct old_sgttyb
|
||||
*Sg; /* pointer to default term characteristics */
|
||||
};
|
||||
|
||||
|
||||
/* Mode in rio device info */
|
||||
#define INTERRUPTED_MODE 0x01 /* Interrupt is generated */
|
||||
#define POLLED_MODE 0x02 /* No interrupt */
|
||||
#define AUTO_MODE 0x03 /* Auto mode */
|
||||
|
||||
#define WORD_ACCESS_MODE 0x10 /* Word Access Mode */
|
||||
#define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */
|
||||
|
||||
|
||||
/* Bus type that RIO supports */
|
||||
#define ISA_BUS 0x01 /* The card is ISA */
|
||||
#define EISA_BUS 0x02 /* The card is EISA */
|
||||
#define MCA_BUS 0x04 /* The card is MCA */
|
||||
#define PCI_BUS 0x08 /* The card is PCI */
|
||||
|
||||
/*
|
||||
** 11.11.1998 ARG - ESIL ???? part fix
|
||||
** Moved definition for 'CHAN' here from rioinfo.c (it is now
|
||||
** called 'DEF_TERM_CHARACTERISTICS').
|
||||
*/
|
||||
|
||||
#define DEF_TERM_CHARACTERISTICS \
|
||||
{ \
|
||||
B19200, B19200, /* input and output speed */ \
|
||||
'H' - '@', /* erase char */ \
|
||||
-1, /* 2nd erase char */ \
|
||||
'U' - '@', /* kill char */ \
|
||||
ECHO | CRMOD, /* mode */ \
|
||||
'C' - '@', /* interrupt character */ \
|
||||
'\\' - '@', /* quit char */ \
|
||||
'Q' - '@', /* start char */ \
|
||||
'S' - '@', /* stop char */ \
|
||||
'D' - '@', /* EOF */ \
|
||||
-1, /* brk */ \
|
||||
(LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ \
|
||||
'Z' - '@', /* process stop */ \
|
||||
'Y' - '@', /* delayed stop */ \
|
||||
'R' - '@', /* reprint line */ \
|
||||
'O' - '@', /* flush output */ \
|
||||
'W' - '@', /* word erase */ \
|
||||
'V' - '@' /* literal next char */ \
|
||||
}
|
||||
|
||||
#endif /* __rioinfo_h */
|
||||
426
drivers/char/rio/rioinit.c
Normal file
426
drivers/char/rio/rioinit.c
Normal file
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : rioinit.c
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 10:33:43
|
||||
** Retrieved : 11/6/98 10:33:49
|
||||
**
|
||||
** ident @(#)rioinit.c 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/delay.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
#include "rioioctl.h"
|
||||
#include "rio_linux.h"
|
||||
|
||||
int RIOPCIinit(struct rio_info *p, int Mode);
|
||||
|
||||
static int RIOScrub(int, u8 __iomem *, int);
|
||||
|
||||
|
||||
/**
|
||||
** RIOAssignAT :
|
||||
**
|
||||
** Fill out the fields in the p->RIOHosts structure now we know we know
|
||||
** we have a board present.
|
||||
**
|
||||
** bits < 0 indicates 8 bit operation requested,
|
||||
** bits > 0 indicates 16 bit operation.
|
||||
*/
|
||||
|
||||
int RIOAssignAT(struct rio_info *p, int Base, void __iomem *virtAddr, int mode)
|
||||
{
|
||||
int bits;
|
||||
struct DpRam __iomem *cardp = (struct DpRam __iomem *)virtAddr;
|
||||
|
||||
if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE))
|
||||
bits = BYTE_OPERATION;
|
||||
else
|
||||
bits = WORD_OPERATION;
|
||||
|
||||
/*
|
||||
** Board has passed its scrub test. Fill in all the
|
||||
** transient stuff.
|
||||
*/
|
||||
p->RIOHosts[p->RIONumHosts].Caddr = virtAddr;
|
||||
p->RIOHosts[p->RIONumHosts].CardP = virtAddr;
|
||||
|
||||
/*
|
||||
** Revision 01 AT host cards don't support WORD operations,
|
||||
*/
|
||||
if (readb(&cardp->DpRevision) == 01)
|
||||
bits = BYTE_OPERATION;
|
||||
|
||||
p->RIOHosts[p->RIONumHosts].Type = RIO_AT;
|
||||
p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card;
|
||||
/* set this later */
|
||||
p->RIOHosts[p->RIONumHosts].Slot = -1;
|
||||
p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits;
|
||||
writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE ,
|
||||
&p->RIOHosts[p->RIONumHosts].Control);
|
||||
writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
|
||||
writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE,
|
||||
&p->RIOHosts[p->RIONumHosts].Control);
|
||||
writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
|
||||
p->RIOHosts[p->RIONumHosts].UniqueNum =
|
||||
((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
|
||||
((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
|
||||
((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
|
||||
((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum);
|
||||
|
||||
p->RIONumHosts++;
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static u8 val[] = {
|
||||
#ifdef VERY_LONG_TEST
|
||||
0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||
0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36,
|
||||
#endif
|
||||
0xff, 0x00, 0x00 };
|
||||
|
||||
#define TEST_END sizeof(val)
|
||||
|
||||
/*
|
||||
** RAM test a board.
|
||||
** Nothing too complicated, just enough to check it out.
|
||||
*/
|
||||
int RIOBoardTest(unsigned long paddr, void __iomem *caddr, unsigned char type, int slot)
|
||||
{
|
||||
struct DpRam __iomem *DpRam = caddr;
|
||||
void __iomem *ram[4];
|
||||
int size[4];
|
||||
int op, bank;
|
||||
int nbanks;
|
||||
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=%p, slot=%d\n",
|
||||
type, DpRam, slot);
|
||||
|
||||
RIOHostReset(type, DpRam, slot);
|
||||
|
||||
/*
|
||||
** Scrub the memory. This comes in several banks:
|
||||
** DPsram1 - 7000h bytes
|
||||
** DPsram2 - 200h bytes
|
||||
** DPsram3 - 7000h bytes
|
||||
** scratch - 1000h bytes
|
||||
*/
|
||||
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Setup ram/size arrays\n");
|
||||
|
||||
size[0] = DP_SRAM1_SIZE;
|
||||
size[1] = DP_SRAM2_SIZE;
|
||||
size[2] = DP_SRAM3_SIZE;
|
||||
size[3] = DP_SCRATCH_SIZE;
|
||||
|
||||
ram[0] = DpRam->DpSram1;
|
||||
ram[1] = DpRam->DpSram2;
|
||||
ram[2] = DpRam->DpSram3;
|
||||
nbanks = (type == RIO_PCI) ? 3 : 4;
|
||||
if (nbanks == 4)
|
||||
ram[3] = DpRam->DpScratch;
|
||||
|
||||
|
||||
if (nbanks == 3) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: %p(0x%x), %p(0x%x), %p(0x%x)\n",
|
||||
ram[0], size[0], ram[1], size[1], ram[2], size[2]);
|
||||
} else {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: %p(0x%x), %p(0x%x), %p(0x%x), %p(0x%x)\n",
|
||||
ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]);
|
||||
}
|
||||
|
||||
/*
|
||||
** This scrub operation will test for crosstalk between
|
||||
** banks. TEST_END is a magic number, and relates to the offset
|
||||
** within the 'val' array used by Scrub.
|
||||
*/
|
||||
for (op=0; op<TEST_END; op++) {
|
||||
for (bank=0; bank<nbanks; bank++) {
|
||||
if (RIOScrub(op, ram[bank], size[bank]) == RIO_FAIL) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n",
|
||||
bank, op);
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rio_dprintk (RIO_DEBUG_INIT, "Test completed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Scrub an area of RAM.
|
||||
** Define PRETEST and POSTTEST for a more thorough checking of the
|
||||
** state of the memory.
|
||||
** Call with op set to an index into the above 'val' array to determine
|
||||
** which value will be written into memory.
|
||||
** Call with op set to zero means that the RAM will not be read and checked
|
||||
** before it is written.
|
||||
** Call with op not zero and the RAM will be read and compared with val[op-1]
|
||||
** to check that the data from the previous phase was retained.
|
||||
*/
|
||||
|
||||
static int RIOScrub(int op, u8 __iomem *ram, int size)
|
||||
{
|
||||
int off;
|
||||
unsigned char oldbyte;
|
||||
unsigned char newbyte;
|
||||
unsigned char invbyte;
|
||||
unsigned short oldword;
|
||||
unsigned short newword;
|
||||
unsigned short invword;
|
||||
unsigned short swapword;
|
||||
|
||||
if (op) {
|
||||
oldbyte = val[op-1];
|
||||
oldword = oldbyte | (oldbyte<<8);
|
||||
} else
|
||||
oldbyte = oldword = 0; /* Tell the compiler we've initilalized them. */
|
||||
newbyte = val[op];
|
||||
newword = newbyte | (newbyte<<8);
|
||||
invbyte = ~newbyte;
|
||||
invword = invbyte | (invbyte<<8);
|
||||
|
||||
/*
|
||||
** Check that the RAM contains the value that should have been left there
|
||||
** by the previous test (not applicable for pass zero)
|
||||
*/
|
||||
if (op) {
|
||||
for (off=0; off<size; off++) {
|
||||
if (readb(ram + off) != oldbyte) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
for (off=0; off<size; off+=2) {
|
||||
if (readw(ram + off) != oldword) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword, readw(ram + off));
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Now write the INVERSE of the test data into every location, using
|
||||
** BYTE write operations, first checking before each byte is written
|
||||
** that the location contains the old value still, and checking after
|
||||
** the write that the location contains the data specified - this is
|
||||
** the BYTE read/write test.
|
||||
*/
|
||||
for (off=0; off<size; off++) {
|
||||
if (op && (readb(ram + off) != oldbyte)) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
writeb(invbyte, ram + off);
|
||||
if (readb(ram + off) != invbyte) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, readb(ram + off));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** now, use WORD operations to write the test value into every location,
|
||||
** check as before that the location contains the previous test value
|
||||
** before overwriting, and that it contains the data value written
|
||||
** afterwards.
|
||||
** This is the WORD operation test.
|
||||
*/
|
||||
for (off=0; off<size; off+=2) {
|
||||
if (readw(ram + off) != invword) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, readw(ram + off));
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
writew(newword, ram + off);
|
||||
if ( readw(ram + off) != newword ) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off));
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** now run through the block of memory again, first in byte mode
|
||||
** then in word mode, and check that all the locations contain the
|
||||
** required test data.
|
||||
*/
|
||||
for (off=0; off<size; off++) {
|
||||
if (readb(ram + off) != newbyte) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
for (off=0; off<size; off+=2) {
|
||||
if (readw(ram + off) != newword ) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off));
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** time to check out byte swapping errors
|
||||
*/
|
||||
swapword = invbyte | (newbyte << 8);
|
||||
|
||||
for (off=0; off<size; off+=2) {
|
||||
writeb(invbyte, &ram[off]);
|
||||
writeb(newbyte, &ram[off+1]);
|
||||
}
|
||||
|
||||
for ( off=0; off<size; off+=2 ) {
|
||||
if (readw(ram + off) != swapword) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, readw(ram + off));
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
writew(~swapword, ram + off);
|
||||
}
|
||||
|
||||
for (off=0; off<size; off+=2) {
|
||||
if (readb(ram + off) != newbyte) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
if (readb(ram + off + 1) != invbyte) {
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, readb(ram + off + 1));
|
||||
return RIO_FAIL;
|
||||
}
|
||||
writew(newword, ram + off);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
|
||||
{
|
||||
memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17);
|
||||
HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
|
||||
if ((UnitId+1) > 9) {
|
||||
HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10);
|
||||
HostP->Mapping[UnitId].Name[15]='0'+((UnitId+1)%10);
|
||||
}
|
||||
else {
|
||||
HostP->Mapping[UnitId].Name[14]='1'+UnitId;
|
||||
HostP->Mapping[UnitId].Name[15]=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define RIO_RELEASE "Linux"
|
||||
#define RELEASE_ID "1.0"
|
||||
|
||||
static struct rioVersion stVersion;
|
||||
|
||||
struct rioVersion *RIOVersid(void)
|
||||
{
|
||||
strlcpy(stVersion.version, "RIO driver for linux V1.0",
|
||||
sizeof(stVersion.version));
|
||||
strlcpy(stVersion.buildDate, __DATE__,
|
||||
sizeof(stVersion.buildDate));
|
||||
|
||||
return &stVersion;
|
||||
}
|
||||
|
||||
void RIOHostReset(unsigned int Type, struct DpRam __iomem *DpRamP, unsigned int Slot)
|
||||
{
|
||||
/*
|
||||
** Reset the Tpu
|
||||
*/
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type);
|
||||
switch ( Type ) {
|
||||
case RIO_AT:
|
||||
rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n");
|
||||
writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION |
|
||||
SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl);
|
||||
writeb(0xFF, &DpRamP->DpResetTpu);
|
||||
udelay(3);
|
||||
rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n");
|
||||
writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE |
|
||||
BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl);
|
||||
writeb(0xFF, &DpRamP->DpResetTpu);
|
||||
udelay(3);
|
||||
break;
|
||||
case RIO_PCI:
|
||||
rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
|
||||
writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl);
|
||||
writeb(0xFF, &DpRamP->DpResetInt);
|
||||
writeb(0xFF, &DpRamP->DpResetTpu);
|
||||
udelay(100);
|
||||
break;
|
||||
default:
|
||||
rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
652
drivers/char/rio/riointr.c
Normal file
652
drivers/char/rio/riointr.c
Normal file
@@ -0,0 +1,652 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riointr.c
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 10:33:44
|
||||
** Retrieved : 11/6/98 10:33:49
|
||||
**
|
||||
** ident @(#)riointr.c 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
|
||||
#endif
|
||||
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/tty_flip.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "rio_linux.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
#include "rioioctl.h"
|
||||
|
||||
|
||||
static void RIOReceive(struct rio_info *, struct Port *);
|
||||
|
||||
|
||||
static char *firstchars(char *p, int nch)
|
||||
{
|
||||
static char buf[2][128];
|
||||
static int t = 0;
|
||||
t = !t;
|
||||
memcpy(buf[t], p, nch);
|
||||
buf[t][nch] = 0;
|
||||
return buf[t];
|
||||
}
|
||||
|
||||
|
||||
#define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask))
|
||||
/* Enable and start the transmission of packets */
|
||||
void RIOTxEnable(char *en)
|
||||
{
|
||||
struct Port *PortP;
|
||||
struct rio_info *p;
|
||||
struct tty_struct *tty;
|
||||
int c;
|
||||
struct PKT __iomem *PacketP;
|
||||
unsigned long flags;
|
||||
|
||||
PortP = (struct Port *) en;
|
||||
p = (struct rio_info *) PortP->p;
|
||||
tty = PortP->gs.tty;
|
||||
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
|
||||
|
||||
if (!PortP->gs.xmit_cnt)
|
||||
return;
|
||||
|
||||
|
||||
/* This routine is an order of magnitude simpler than the specialix
|
||||
version. One of the disadvantages is that this version will send
|
||||
an incomplete packet (usually 64 bytes instead of 72) once for
|
||||
every 4k worth of data. Let's just say that this won't influence
|
||||
performance significantly..... */
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
while (can_add_transmit(&PacketP, PortP)) {
|
||||
c = PortP->gs.xmit_cnt;
|
||||
if (c > PKT_MAX_DATA_LEN)
|
||||
c = PKT_MAX_DATA_LEN;
|
||||
|
||||
/* Don't copy past the end of the source buffer */
|
||||
if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail)
|
||||
c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
|
||||
|
||||
{
|
||||
int t;
|
||||
t = (c > 10) ? 10 : c;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", PortP->PortNum, c, firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail, t), firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail + c - t, t));
|
||||
}
|
||||
/* If for one reason or another, we can't copy more data,
|
||||
we're done! */
|
||||
if (c == 0)
|
||||
break;
|
||||
|
||||
rio_memcpy_toio(PortP->HostP->Caddr, PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
|
||||
/* udelay (1); */
|
||||
|
||||
writeb(c, &(PacketP->len));
|
||||
if (!(PortP->State & RIO_DELETED)) {
|
||||
add_transmit(PortP);
|
||||
/*
|
||||
** Count chars tx'd for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->txchars += c;
|
||||
}
|
||||
PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1);
|
||||
PortP->gs.xmit_cnt -= c;
|
||||
}
|
||||
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
|
||||
if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
|
||||
tty_wakeup(PortP->gs.tty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** RIO Host Service routine. Does all the work traditionally associated with an
|
||||
** interrupt.
|
||||
*/
|
||||
static int RupIntr;
|
||||
static int RxIntr;
|
||||
static int TxIntr;
|
||||
|
||||
void RIOServiceHost(struct rio_info *p, struct Host *HostP)
|
||||
{
|
||||
rio_spin_lock(&HostP->HostLock);
|
||||
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
|
||||
static int t = 0;
|
||||
rio_spin_unlock(&HostP->HostLock);
|
||||
if ((t++ % 200) == 0)
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags);
|
||||
return;
|
||||
}
|
||||
rio_spin_unlock(&HostP->HostLock);
|
||||
|
||||
if (readw(&HostP->ParmMapP->rup_intr)) {
|
||||
writew(0, &HostP->ParmMapP->rup_intr);
|
||||
p->RIORupCount++;
|
||||
RupIntr++;
|
||||
rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %Zd\n", HostP - p->RIOHosts);
|
||||
RIOPollHostCommands(p, HostP);
|
||||
}
|
||||
|
||||
if (readw(&HostP->ParmMapP->rx_intr)) {
|
||||
int port;
|
||||
|
||||
writew(0, &HostP->ParmMapP->rx_intr);
|
||||
p->RIORxCount++;
|
||||
RxIntr++;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %Zd\n", HostP - p->RIOHosts);
|
||||
/*
|
||||
** Loop through every port. If the port is mapped into
|
||||
** the system ( i.e. has /dev/ttyXXXX associated ) then it is
|
||||
** worth checking. If the port isn't open, grab any packets
|
||||
** hanging on its receive queue and stuff them on the free
|
||||
** list; check for commands on the way.
|
||||
*/
|
||||
for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
|
||||
struct Port *PortP = p->RIOPortp[port];
|
||||
struct tty_struct *ttyP;
|
||||
struct PKT __iomem *PacketP;
|
||||
|
||||
/*
|
||||
** not mapped in - most of the RIOPortp[] information
|
||||
** has not been set up!
|
||||
** Optimise: ports come in bundles of eight.
|
||||
*/
|
||||
if (!PortP->Mapped) {
|
||||
port += 7;
|
||||
continue; /* with the next port */
|
||||
}
|
||||
|
||||
/*
|
||||
** If the host board isn't THIS host board, check the next one.
|
||||
** optimise: ports come in bundles of eight.
|
||||
*/
|
||||
if (PortP->HostP != HostP) {
|
||||
port += 7;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
** Let us see - is the port open? If not, then don't service it.
|
||||
*/
|
||||
if (!(PortP->PortState & PORT_ISOPEN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
** find corresponding tty structure. The process of mapping
|
||||
** the ports puts these here.
|
||||
*/
|
||||
ttyP = PortP->gs.tty;
|
||||
|
||||
/*
|
||||
** Lock the port before we begin working on it.
|
||||
*/
|
||||
rio_spin_lock(&PortP->portSem);
|
||||
|
||||
/*
|
||||
** Process received data if there is any.
|
||||
*/
|
||||
if (can_remove_receive(&PacketP, PortP))
|
||||
RIOReceive(p, PortP);
|
||||
|
||||
/*
|
||||
** If there is no data left to be read from the port, and
|
||||
** it's handshake bit is set, then we must clear the handshake,
|
||||
** so that that downstream RTA is re-enabled.
|
||||
*/
|
||||
if (!can_remove_receive(&PacketP, PortP) && (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
|
||||
/*
|
||||
** MAGIC! ( Basically, handshake the RX buffer, so that
|
||||
** the RTAs upstream can be re-enabled. )
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
|
||||
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
|
||||
}
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
}
|
||||
}
|
||||
|
||||
if (readw(&HostP->ParmMapP->tx_intr)) {
|
||||
int port;
|
||||
|
||||
writew(0, &HostP->ParmMapP->tx_intr);
|
||||
|
||||
p->RIOTxCount++;
|
||||
TxIntr++;
|
||||
rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %Zd\n", HostP - p->RIOHosts);
|
||||
|
||||
/*
|
||||
** Loop through every port.
|
||||
** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
|
||||
** associated ) then it is worth checking.
|
||||
*/
|
||||
for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
|
||||
struct Port *PortP = p->RIOPortp[port];
|
||||
struct tty_struct *ttyP;
|
||||
struct PKT __iomem *PacketP;
|
||||
|
||||
/*
|
||||
** not mapped in - most of the RIOPortp[] information
|
||||
** has not been set up!
|
||||
*/
|
||||
if (!PortP->Mapped) {
|
||||
port += 7;
|
||||
continue; /* with the next port */
|
||||
}
|
||||
|
||||
/*
|
||||
** If the host board isn't running, then its data structures
|
||||
** are no use to us - continue quietly.
|
||||
*/
|
||||
if (PortP->HostP != HostP) {
|
||||
port += 7;
|
||||
continue; /* with the next port */
|
||||
}
|
||||
|
||||
/*
|
||||
** Let us see - is the port open? If not, then don't service it.
|
||||
*/
|
||||
if (!(PortP->PortState & PORT_ISOPEN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port);
|
||||
/*
|
||||
** Lock the port before we begin working on it.
|
||||
*/
|
||||
rio_spin_lock(&PortP->portSem);
|
||||
|
||||
/*
|
||||
** If we can't add anything to the transmit queue, then
|
||||
** we need do none of this processing.
|
||||
*/
|
||||
if (!can_add_transmit(&PacketP, PortP)) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n");
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
** find corresponding tty structure. The process of mapping
|
||||
** the ports puts these here.
|
||||
*/
|
||||
ttyP = PortP->gs.tty;
|
||||
/* If ttyP is NULL, the port is getting closed. Forget about it. */
|
||||
if (!ttyP) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
** If there is more room available we start up the transmit
|
||||
** data process again. This can be direct I/O, if the cookmode
|
||||
** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the
|
||||
** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch
|
||||
** characters via the line discipline. We must always call
|
||||
** the line discipline,
|
||||
** so that user input characters can be echoed correctly.
|
||||
**
|
||||
** ++++ Update +++++
|
||||
** With the advent of double buffering, we now see if
|
||||
** TxBufferOut-In is non-zero. If so, then we copy a packet
|
||||
** to the output place, and set it going. If this empties
|
||||
** the buffer, then we must issue a wakeup( ) on OUT.
|
||||
** If it frees space in the buffer then we must issue
|
||||
** a wakeup( ) on IN.
|
||||
**
|
||||
** ++++ Extra! Extra! If PortP->WflushFlag is set, then we
|
||||
** have to send a WFLUSH command down the PHB, to mark the
|
||||
** end point of a WFLUSH. We also need to clear out any
|
||||
** data from the double buffer! ( note that WflushFlag is a
|
||||
** *count* of the number of WFLUSH commands outstanding! )
|
||||
**
|
||||
** ++++ And there's more!
|
||||
** If an RTA is powered off, then on again, and rebooted,
|
||||
** whilst it has ports open, then we need to re-open the ports.
|
||||
** ( reasonable enough ). We can't do this when we spot the
|
||||
** re-boot, in interrupt time, because the queue is probably
|
||||
** full. So, when we come in here, we need to test if any
|
||||
** ports are in this condition, and re-open the port before
|
||||
** we try to send any more data to it. Now, the re-booted
|
||||
** RTA will be discarding packets from the PHB until it
|
||||
** receives this open packet, but don't worry tooo much
|
||||
** about that. The one thing that is interesting is the
|
||||
** combination of this effect and the WFLUSH effect!
|
||||
*/
|
||||
/* For now don't handle RTA reboots. -- REW.
|
||||
Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
|
||||
if (PortP->MagicFlags) {
|
||||
if (PortP->MagicFlags & MAGIC_REBOOT) {
|
||||
/*
|
||||
** well, the RTA has been rebooted, and there is room
|
||||
** on its queue to add the open packet that is required.
|
||||
**
|
||||
** The messy part of this line is trying to decide if
|
||||
** we need to call the Param function as a tty or as
|
||||
** a modem.
|
||||
** DONT USE CLOCAL AS A TEST FOR THIS!
|
||||
**
|
||||
** If we can't param the port, then move on to the
|
||||
** next port.
|
||||
*/
|
||||
PortP->InUse = NOT_INUSE;
|
||||
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? 1 : 0, DONT_SLEEP) == RIO_FAIL) {
|
||||
continue; /* with next port */
|
||||
}
|
||||
rio_spin_lock(&PortP->portSem);
|
||||
PortP->MagicFlags &= ~MAGIC_REBOOT;
|
||||
}
|
||||
|
||||
/*
|
||||
** As mentioned above, this is a tacky hack to cope
|
||||
** with WFLUSH
|
||||
*/
|
||||
if (PortP->WflushFlag) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n");
|
||||
|
||||
if (PortP->InUse)
|
||||
rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
|
||||
}
|
||||
|
||||
while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
|
||||
int p;
|
||||
struct PktCmd __iomem *PktCmdP;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
|
||||
/*
|
||||
** make it look just like a WFLUSH command
|
||||
*/
|
||||
PktCmdP = (struct PktCmd __iomem *) &PacketP->data[0];
|
||||
|
||||
writeb(WFLUSH, &PktCmdP->Command);
|
||||
|
||||
p = PortP->HostPort % (u16) PORTS_PER_RTA;
|
||||
|
||||
/*
|
||||
** If second block of ports for 16 port RTA, add 8
|
||||
** to index 8-15.
|
||||
*/
|
||||
if (PortP->SecondBlock)
|
||||
p += PORTS_PER_RTA;
|
||||
|
||||
writeb(p, &PktCmdP->PhbNum);
|
||||
|
||||
/*
|
||||
** to make debuggery easier
|
||||
*/
|
||||
writeb('W', &PacketP->data[2]);
|
||||
writeb('F', &PacketP->data[3]);
|
||||
writeb('L', &PacketP->data[4]);
|
||||
writeb('U', &PacketP->data[5]);
|
||||
writeb('S', &PacketP->data[6]);
|
||||
writeb('H', &PacketP->data[7]);
|
||||
writeb(' ', &PacketP->data[8]);
|
||||
writeb('0' + PortP->WflushFlag, &PacketP->data[9]);
|
||||
writeb(' ', &PacketP->data[10]);
|
||||
writeb(' ', &PacketP->data[11]);
|
||||
writeb('\0', &PacketP->data[12]);
|
||||
|
||||
/*
|
||||
** its two bytes long!
|
||||
*/
|
||||
writeb(PKT_CMD_BIT | 2, &PacketP->len);
|
||||
|
||||
/*
|
||||
** queue it!
|
||||
*/
|
||||
if (!(PortP->State & RIO_DELETED)) {
|
||||
add_transmit(PortP);
|
||||
/*
|
||||
** Count chars tx'd for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->txchars += 2;
|
||||
}
|
||||
|
||||
if (--(PortP->WflushFlag) == 0) {
|
||||
PortP->MagicFlags &= ~MAGIC_FLUSH;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag);
|
||||
}
|
||||
if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) {
|
||||
if (PortP->MagicFlags & MAGIC_FLUSH) {
|
||||
PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
|
||||
} else {
|
||||
if (!can_add_transmit(&PacketP, PortP)) {
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
continue;
|
||||
}
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
RIOTxEnable((char *) PortP);
|
||||
rio_spin_lock(&PortP->portSem);
|
||||
PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** If we can't add anything to the transmit queue, then
|
||||
** we need do none of the remaining processing.
|
||||
*/
|
||||
if (!can_add_transmit(&PacketP, PortP)) {
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
continue;
|
||||
}
|
||||
|
||||
rio_spin_unlock(&PortP->portSem);
|
||||
RIOTxEnable((char *) PortP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Routine for handling received data for tty drivers
|
||||
*/
|
||||
static void RIOReceive(struct rio_info *p, struct Port *PortP)
|
||||
{
|
||||
struct tty_struct *TtyP;
|
||||
unsigned short transCount;
|
||||
struct PKT __iomem *PacketP;
|
||||
register unsigned int DataCnt;
|
||||
unsigned char __iomem *ptr;
|
||||
unsigned char *buf;
|
||||
int copied = 0;
|
||||
|
||||
static int intCount, RxIntCnt;
|
||||
|
||||
/*
|
||||
** The receive data process is to remove packets from the
|
||||
** PHB until there aren't any more or the current cblock
|
||||
** is full. When this occurs, there will be some left over
|
||||
** data in the packet, that we must do something with.
|
||||
** As we haven't unhooked the packet from the read list
|
||||
** yet, we can just leave the packet there, having first
|
||||
** made a note of how far we got. This means that we need
|
||||
** a pointer per port saying where we start taking the
|
||||
** data from - this will normally be zero, but when we
|
||||
** run out of space it will be set to the offset of the
|
||||
** next byte to copy from the packet data area. The packet
|
||||
** length field is decremented by the number of bytes that
|
||||
** we successfully removed from the packet. When this reaches
|
||||
** zero, we reset the offset pointer to be zero, and free
|
||||
** the packet from the front of the queue.
|
||||
*/
|
||||
|
||||
intCount++;
|
||||
|
||||
TtyP = PortP->gs.tty;
|
||||
if (!TtyP) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (PortP->State & RIO_THROTTLE_RX) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (PortP->State & RIO_DELETED) {
|
||||
while (can_remove_receive(&PacketP, PortP)) {
|
||||
remove_receive(PortP);
|
||||
put_free_end(PortP->HostP, PacketP);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** loop, just so long as:
|
||||
** i ) there's some data ( i.e. can_remove_receive )
|
||||
** ii ) we haven't been blocked
|
||||
** iii ) there's somewhere to put the data
|
||||
** iv ) we haven't outstayed our welcome
|
||||
*/
|
||||
transCount = 1;
|
||||
while (can_remove_receive(&PacketP, PortP)
|
||||
&& transCount) {
|
||||
RxIntCnt++;
|
||||
|
||||
/*
|
||||
** check that it is not a command!
|
||||
*/
|
||||
if (readb(&PacketP->len) & PKT_CMD_BIT) {
|
||||
rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
|
||||
/* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */
|
||||
rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", readb(&PacketP->src_unit));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", readb(&PacketP->src_port));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", readb(&PacketP->len));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", readb(&PacketP->control));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", readw(&PacketP->csum));
|
||||
rio_dprintk(RIO_DEBUG_INTR, " data bytes: ");
|
||||
for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
|
||||
rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt]));
|
||||
remove_receive(PortP);
|
||||
put_free_end(PortP->HostP, PacketP);
|
||||
continue; /* with next packet */
|
||||
}
|
||||
|
||||
/*
|
||||
** How many characters can we move 'upstream' ?
|
||||
**
|
||||
** Determine the minimum of the amount of data
|
||||
** available and the amount of space in which to
|
||||
** put it.
|
||||
**
|
||||
** 1. Get the packet length by masking 'len'
|
||||
** for only the length bits.
|
||||
** 2. Available space is [buffer size] - [space used]
|
||||
**
|
||||
** Transfer count is the minimum of packet length
|
||||
** and available space.
|
||||
*/
|
||||
|
||||
transCount = tty_buffer_request_room(TtyP, readb(&PacketP->len) & PKT_LEN_MASK);
|
||||
rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
|
||||
/*
|
||||
** To use the following 'kkprintfs' for debugging - change the '#undef'
|
||||
** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
|
||||
** driver).
|
||||
*/
|
||||
ptr = (unsigned char __iomem *) PacketP->data + PortP->RxDataStart;
|
||||
|
||||
tty_prepare_flip_string(TtyP, &buf, transCount);
|
||||
rio_memcpy_fromio(buf, ptr, transCount);
|
||||
PortP->RxDataStart += transCount;
|
||||
writeb(readb(&PacketP->len)-transCount, &PacketP->len);
|
||||
copied += transCount;
|
||||
|
||||
|
||||
|
||||
if (readb(&PacketP->len) == 0) {
|
||||
/*
|
||||
** If we have emptied the packet, then we can
|
||||
** free it, and reset the start pointer for
|
||||
** the next packet.
|
||||
*/
|
||||
remove_receive(PortP);
|
||||
put_free_end(PortP->HostP, PacketP);
|
||||
PortP->RxDataStart = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copied) {
|
||||
rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied);
|
||||
tty_flip_buffer_push(TtyP);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
57
drivers/char/rio/rioioctl.h
Normal file
57
drivers/char/rio/rioioctl.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : rioioctl.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:13
|
||||
** Retrieved : 11/6/98 11:34:22
|
||||
**
|
||||
** ident @(#)rioioctl.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rioioctl_h__
|
||||
#define __rioioctl_h__
|
||||
|
||||
/*
|
||||
** RIO device driver - user ioctls and associated structures.
|
||||
*/
|
||||
|
||||
struct portStats {
|
||||
int port;
|
||||
int gather;
|
||||
unsigned long txchars;
|
||||
unsigned long rxchars;
|
||||
unsigned long opens;
|
||||
unsigned long closes;
|
||||
unsigned long ioctls;
|
||||
};
|
||||
|
||||
#define RIOC ('R'<<8)|('i'<<16)|('o'<<24)
|
||||
|
||||
#define RIO_QUICK_CHECK (RIOC | 105)
|
||||
#define RIO_GATHER_PORT_STATS (RIOC | 193)
|
||||
#define RIO_RESET_PORT_STATS (RIOC | 194)
|
||||
#define RIO_GET_PORT_STATS (RIOC | 195)
|
||||
|
||||
#endif /* __rioioctl_h__ */
|
||||
669
drivers/char/rio/rioparam.c
Normal file
669
drivers/char/rio/rioparam.c
Normal file
@@ -0,0 +1,669 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : rioparam.c
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 10:33:45
|
||||
** Retrieved : 11/6/98 10:33:50
|
||||
**
|
||||
** ident @(#)rioparam.c 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/tty.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "rio_linux.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
#include "rioioctl.h"
|
||||
#include "param.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** The Scam, based on email from jeremyr@bugs.specialix.co.uk....
|
||||
**
|
||||
** To send a command on a particular port, you put a packet with the
|
||||
** command bit set onto the port. The command bit is in the len field,
|
||||
** and gets ORed in with the actual byte count.
|
||||
**
|
||||
** When you send a packet with the command bit set the first
|
||||
** data byte (data[0]) is interpreted as the command to execute.
|
||||
** It also governs what data structure overlay should accompany the packet.
|
||||
** Commands are defined in cirrus/cirrus.h
|
||||
**
|
||||
** If you want the command to pre-emt data already on the queue for the
|
||||
** port, set the pre-emptive bit in conjunction with the command bit.
|
||||
** It is not defined what will happen if you set the preemptive bit
|
||||
** on a packet that is NOT a command.
|
||||
**
|
||||
** Pre-emptive commands should be queued at the head of the queue using
|
||||
** add_start(), whereas normal commands and data are enqueued using
|
||||
** add_end().
|
||||
**
|
||||
** Most commands do not use the remaining bytes in the data array. The
|
||||
** exceptions are OPEN MOPEN and CONFIG. (NB. As with the SI CONFIG and
|
||||
** OPEN are currently analogous). With these three commands the following
|
||||
** 11 data bytes are all used to pass config information such as baud rate etc.
|
||||
** The fields are also defined in cirrus.h. Some contain straightforward
|
||||
** information such as the transmit XON character. Two contain the transmit and
|
||||
** receive baud rates respectively. For most baud rates there is a direct
|
||||
** mapping between the rates defined in <sys/termio.h> and the byte in the
|
||||
** packet. There are additional (non UNIX-standard) rates defined in
|
||||
** /u/dos/rio/cirrus/h/brates.h.
|
||||
**
|
||||
** The rest of the data fields contain approximations to the Cirrus registers
|
||||
** that are used to program number of bits etc. Each registers bit fields is
|
||||
** defined in cirrus.h.
|
||||
**
|
||||
** NB. Only use those bits that are defined as being driver specific
|
||||
** or common to the RTA and the driver.
|
||||
**
|
||||
** All commands going from RTA->Host will be dealt with by the Host code - you
|
||||
** will never see them. As with the SI there will be three fields to look out
|
||||
** for in each phb (not yet defined - needs defining a.s.a.p).
|
||||
**
|
||||
** modem_status - current state of handshake pins.
|
||||
**
|
||||
** port_status - current port status - equivalent to hi_stat for SI, indicates
|
||||
** if port is IDLE_OPEN, IDLE_CLOSED etc.
|
||||
**
|
||||
** break_status - bit X set if break has been received.
|
||||
**
|
||||
** Happy hacking.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** RIOParam is used to open or configure a port. You pass it a PortP,
|
||||
** which will have a tty struct attached to it. You also pass a command,
|
||||
** either OPEN or CONFIG. The port's setup is taken from the t_ fields
|
||||
** of the tty struct inside the PortP, and the port is either opened
|
||||
** or re-configured. You must also tell RIOParam if the device is a modem
|
||||
** device or not (i.e. top bit of minor number set or clear - take special
|
||||
** care when deciding on this!).
|
||||
** RIOParam neither flushes nor waits for drain, and is NOT preemptive.
|
||||
**
|
||||
** RIOParam assumes it will be called at splrio(), and also assumes
|
||||
** that CookMode is set correctly in the port structure.
|
||||
**
|
||||
** NB. for MPX
|
||||
** tty lock must NOT have been previously acquired.
|
||||
*/
|
||||
int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
|
||||
{
|
||||
struct tty_struct *TtyP;
|
||||
int retval;
|
||||
struct phb_param __iomem *phb_param_ptr;
|
||||
struct PKT __iomem *PacketP;
|
||||
int res;
|
||||
u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
|
||||
u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
|
||||
u8 LNext = 0, TxBaud = 0, RxBaud = 0;
|
||||
int retries = 0xff;
|
||||
unsigned long flags;
|
||||
|
||||
func_enter();
|
||||
|
||||
TtyP = PortP->gs.tty;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
|
||||
|
||||
if (!TtyP) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n");
|
||||
|
||||
func_exit();
|
||||
|
||||
return RIO_FAIL;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
if (cmd == OPEN) {
|
||||
/*
|
||||
** If the port is set to store or lock the parameters, and it is
|
||||
** paramed with OPEN, we want to restore the saved port termio, but
|
||||
** only if StoredTermio has been saved, i.e. NOT 1st open after reboot.
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
** wait for space
|
||||
*/
|
||||
while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) {
|
||||
if (retries-- <= 0) {
|
||||
break;
|
||||
}
|
||||
if (PortP->InUse != NOT_INUSE) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n");
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n");
|
||||
}
|
||||
|
||||
if (SleepFlag != OK_TO_SLEEP) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n");
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
retval = RIODelay(PortP, HUNDRED_MS);
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
if (retval == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
return -EINTR;
|
||||
}
|
||||
if (PortP->State & RIO_DELETED) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res);
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP);
|
||||
|
||||
phb_param_ptr = (struct phb_param __iomem *) PacketP->data;
|
||||
|
||||
|
||||
switch (TtyP->termios->c_cflag & CSIZE) {
|
||||
case CS5:
|
||||
{
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n");
|
||||
Cor1 |= COR1_5BITS;
|
||||
break;
|
||||
}
|
||||
case CS6:
|
||||
{
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n");
|
||||
Cor1 |= COR1_6BITS;
|
||||
break;
|
||||
}
|
||||
case CS7:
|
||||
{
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n");
|
||||
Cor1 |= COR1_7BITS;
|
||||
break;
|
||||
}
|
||||
case CS8:
|
||||
{
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n");
|
||||
Cor1 |= COR1_8BITS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_cflag & CSTOPB) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n");
|
||||
Cor1 |= COR1_2STOP;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n");
|
||||
Cor1 |= COR1_1STOP;
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_cflag & PARENB) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n");
|
||||
Cor1 |= COR1_NORMAL;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n");
|
||||
Cor1 |= COR1_NOP;
|
||||
}
|
||||
if (TtyP->termios->c_cflag & PARODD) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n");
|
||||
Cor1 |= COR1_ODD;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n");
|
||||
Cor1 |= COR1_EVEN;
|
||||
}
|
||||
|
||||
/*
|
||||
** COR 2
|
||||
*/
|
||||
if (TtyP->termios->c_iflag & IXON) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n");
|
||||
Cor2 |= COR2_IXON;
|
||||
} else {
|
||||
if (PortP->Config & RIO_IXON) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
|
||||
Cor2 |= COR2_IXON;
|
||||
} else
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n");
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_iflag & IXANY) {
|
||||
if (PortP->Config & RIO_IXANY) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n");
|
||||
Cor2 |= COR2_IXANY;
|
||||
} else
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_iflag & IXOFF) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n");
|
||||
Cor2 |= COR2_IXOFF;
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_cflag & HUPCL) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n");
|
||||
Cor2 |= COR2_HUPCL;
|
||||
}
|
||||
|
||||
if (C_CRTSCTS(TtyP)) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n");
|
||||
Cor2 |= COR2_CTSFLOW;
|
||||
Cor2 |= COR2_RTSFLOW;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n");
|
||||
Cor2 &= ~COR2_CTSFLOW;
|
||||
Cor2 &= ~COR2_RTSFLOW;
|
||||
}
|
||||
|
||||
|
||||
if (TtyP->termios->c_cflag & CLOCAL) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Local line\n");
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n");
|
||||
}
|
||||
|
||||
/*
|
||||
** COR 4 (there is no COR 3)
|
||||
*/
|
||||
if (TtyP->termios->c_iflag & IGNBRK) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n");
|
||||
Cor4 |= COR4_IGNBRK;
|
||||
}
|
||||
if (!(TtyP->termios->c_iflag & BRKINT)) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n");
|
||||
Cor4 |= COR4_NBRKINT;
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on break condition\n");
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_iflag & INLCR) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n");
|
||||
Cor4 |= COR4_INLCR;
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_iflag & IGNCR) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n");
|
||||
Cor4 |= COR4_IGNCR;
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_iflag & ICRNL) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n");
|
||||
Cor4 |= COR4_ICRNL;
|
||||
}
|
||||
if (TtyP->termios->c_iflag & IGNPAR) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n");
|
||||
Cor4 |= COR4_IGNPAR;
|
||||
}
|
||||
if (TtyP->termios->c_iflag & PARMRK) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n");
|
||||
Cor4 |= COR4_PARMRK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the RAISEMOD flag to ensure that the modem lines are raised
|
||||
** on reception of a config packet.
|
||||
** The download code handles the zero baud condition.
|
||||
*/
|
||||
Cor4 |= COR4_RAISEMOD;
|
||||
|
||||
/*
|
||||
** COR 5
|
||||
*/
|
||||
|
||||
Cor5 = COR5_CMOE;
|
||||
|
||||
/*
|
||||
** Set to monitor tbusy/tstop (or not).
|
||||
*/
|
||||
|
||||
if (PortP->MonitorTstate)
|
||||
Cor5 |= COR5_TSTATE_ON;
|
||||
else
|
||||
Cor5 |= COR5_TSTATE_OFF;
|
||||
|
||||
/*
|
||||
** Could set LNE here if you wanted LNext processing. SVR4 will use it.
|
||||
*/
|
||||
if (TtyP->termios->c_iflag & ISTRIP) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n");
|
||||
if (!(PortP->State & RIO_TRIAD_MODE)) {
|
||||
Cor5 |= COR5_ISTRIP;
|
||||
}
|
||||
}
|
||||
|
||||
if (TtyP->termios->c_oflag & ONLCR) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n");
|
||||
if (PortP->CookMode == COOK_MEDIUM)
|
||||
Cor5 |= COR5_ONLCR;
|
||||
}
|
||||
if (TtyP->termios->c_oflag & OCRNL) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n");
|
||||
if (PortP->CookMode == COOK_MEDIUM)
|
||||
Cor5 |= COR5_OCRNL;
|
||||
}
|
||||
if ((TtyP->termios->c_oflag & TABDLY) == TAB3) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n");
|
||||
if (PortP->CookMode == COOK_MEDIUM)
|
||||
Cor5 |= COR5_TAB3;
|
||||
}
|
||||
|
||||
/*
|
||||
** Flow control bytes.
|
||||
*/
|
||||
TxXon = TtyP->termios->c_cc[VSTART];
|
||||
TxXoff = TtyP->termios->c_cc[VSTOP];
|
||||
RxXon = TtyP->termios->c_cc[VSTART];
|
||||
RxXoff = TtyP->termios->c_cc[VSTOP];
|
||||
/*
|
||||
** LNEXT byte
|
||||
*/
|
||||
LNext = 0;
|
||||
|
||||
/*
|
||||
** Baud rate bytes
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD);
|
||||
|
||||
switch (TtyP->termios->c_cflag & CBAUD) {
|
||||
#define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break
|
||||
e(50);
|
||||
e(75);
|
||||
e(110);
|
||||
e(134);
|
||||
e(150);
|
||||
e(200);
|
||||
e(300);
|
||||
e(600);
|
||||
e(1200);
|
||||
e(1800);
|
||||
e(2400);
|
||||
e(4800);
|
||||
e(9600);
|
||||
e(19200);
|
||||
e(38400);
|
||||
e(57600);
|
||||
e(115200); /* e(230400);e(460800); e(921600); */
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
|
||||
|
||||
|
||||
/*
|
||||
** Leftovers
|
||||
*/
|
||||
if (TtyP->termios->c_cflag & CREAD)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n");
|
||||
#ifdef RCV1EN
|
||||
if (TtyP->termios->c_cflag & RCV1EN)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n");
|
||||
#endif
|
||||
#ifdef XMT1EN
|
||||
if (TtyP->termios->c_cflag & XMT1EN)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n");
|
||||
#endif
|
||||
if (TtyP->termios->c_lflag & ISIG)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
|
||||
if (TtyP->termios->c_lflag & ICANON)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n");
|
||||
if (TtyP->termios->c_lflag & XCASE)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n");
|
||||
if (TtyP->termios->c_lflag & ECHO)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n");
|
||||
if (TtyP->termios->c_lflag & ECHOE)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n");
|
||||
if (TtyP->termios->c_lflag & ECHOK)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n");
|
||||
if (TtyP->termios->c_lflag & ECHONL)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n");
|
||||
if (TtyP->termios->c_lflag & NOFLSH)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n");
|
||||
#ifdef TOSTOP
|
||||
if (TtyP->termios->c_lflag & TOSTOP)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n");
|
||||
#endif
|
||||
#ifdef XCLUDE
|
||||
if (TtyP->termios->c_lflag & XCLUDE)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n");
|
||||
#endif
|
||||
if (TtyP->termios->c_iflag & IUCLC)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n");
|
||||
if (TtyP->termios->c_oflag & OPOST)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n");
|
||||
if (TtyP->termios->c_oflag & OLCUC)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n");
|
||||
if (TtyP->termios->c_oflag & ONOCR)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n");
|
||||
if (TtyP->termios->c_oflag & ONLRET)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n");
|
||||
if (TtyP->termios->c_oflag & OFILL)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n");
|
||||
if (TtyP->termios->c_oflag & OFDEL)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n");
|
||||
if (TtyP->termios->c_oflag & NLDLY)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n");
|
||||
if (TtyP->termios->c_oflag & CRDLY)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n");
|
||||
if (TtyP->termios->c_oflag & TABDLY)
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n");
|
||||
/*
|
||||
** These things are kind of useful in a later life!
|
||||
*/
|
||||
PortP->Cor2Copy = Cor2;
|
||||
|
||||
if (PortP->State & RIO_DELETED) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Actually write the info into the packet to be sent
|
||||
*/
|
||||
writeb(cmd, &phb_param_ptr->Cmd);
|
||||
writeb(Cor1, &phb_param_ptr->Cor1);
|
||||
writeb(Cor2, &phb_param_ptr->Cor2);
|
||||
writeb(Cor4, &phb_param_ptr->Cor4);
|
||||
writeb(Cor5, &phb_param_ptr->Cor5);
|
||||
writeb(TxXon, &phb_param_ptr->TxXon);
|
||||
writeb(RxXon, &phb_param_ptr->RxXon);
|
||||
writeb(TxXoff, &phb_param_ptr->TxXoff);
|
||||
writeb(RxXoff, &phb_param_ptr->RxXoff);
|
||||
writeb(LNext, &phb_param_ptr->LNext);
|
||||
writeb(TxBaud, &phb_param_ptr->TxBaud);
|
||||
writeb(RxBaud, &phb_param_ptr->RxBaud);
|
||||
|
||||
/*
|
||||
** Set the length/command field
|
||||
*/
|
||||
writeb(12 | PKT_CMD_BIT, &PacketP->len);
|
||||
|
||||
/*
|
||||
** The packet is formed - now, whack it off
|
||||
** to its final destination:
|
||||
*/
|
||||
add_transmit(PortP);
|
||||
/*
|
||||
** Count characters transmitted for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->txchars += 12;
|
||||
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n");
|
||||
/*
|
||||
** job done.
|
||||
*/
|
||||
func_exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** We can add another packet to a transmit queue if the packet pointer pointed
|
||||
** to by the TxAdd pointer has PKT_IN_USE clear in its address.
|
||||
*/
|
||||
int can_add_transmit(struct PKT __iomem **PktP, struct Port *PortP)
|
||||
{
|
||||
struct PKT __iomem *tp;
|
||||
|
||||
*PktP = tp = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd));
|
||||
|
||||
return !((unsigned long) tp & PKT_IN_USE);
|
||||
}
|
||||
|
||||
/*
|
||||
** To add a packet to the queue, you set the PKT_IN_USE bit in the address,
|
||||
** and then move the TxAdd pointer along one position to point to the next
|
||||
** packet pointer. You must wrap the pointer from the end back to the start.
|
||||
*/
|
||||
void add_transmit(struct Port *PortP)
|
||||
{
|
||||
if (readw(PortP->TxAdd) & PKT_IN_USE) {
|
||||
rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
|
||||
}
|
||||
writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd);
|
||||
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
|
||||
writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add);
|
||||
}
|
||||
|
||||
/****************************************
|
||||
* Put a packet onto the end of the
|
||||
* free list
|
||||
****************************************/
|
||||
void put_free_end(struct Host *HostP, struct PKT __iomem *PktP)
|
||||
{
|
||||
struct rio_free_list __iomem *tmp_pointer;
|
||||
unsigned short old_end, new_end;
|
||||
unsigned long flags;
|
||||
|
||||
rio_spin_lock_irqsave(&HostP->HostLock, flags);
|
||||
|
||||
/*************************************************
|
||||
* Put a packet back onto the back of the free list
|
||||
*
|
||||
************************************************/
|
||||
|
||||
rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP);
|
||||
|
||||
if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) {
|
||||
new_end = RIO_OFF(HostP->Caddr, PktP);
|
||||
tmp_pointer = (struct rio_free_list __iomem *) RIO_PTR(HostP->Caddr, old_end);
|
||||
writew(new_end, &tmp_pointer->next);
|
||||
writew(old_end, &((struct rio_free_list __iomem *) PktP)->prev);
|
||||
writew(TPNULL, &((struct rio_free_list __iomem *) PktP)->next);
|
||||
writew(new_end, &HostP->ParmMapP->free_list_end);
|
||||
} else { /* First packet on the free list this should never happen! */
|
||||
rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
|
||||
writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end);
|
||||
tmp_pointer = (struct rio_free_list __iomem *) PktP;
|
||||
writew(TPNULL, &tmp_pointer->prev);
|
||||
writew(TPNULL, &tmp_pointer->next);
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
|
||||
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
** can_remove_receive(PktP,P) returns non-zero if PKT_IN_USE is set
|
||||
** for the next packet on the queue. It will also set PktP to point to the
|
||||
** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
|
||||
** then can_remove_receive() returns 0.
|
||||
*/
|
||||
int can_remove_receive(struct PKT __iomem **PktP, struct Port *PortP)
|
||||
{
|
||||
if (readw(PortP->RxRemove) & PKT_IN_USE) {
|
||||
*PktP = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** To remove a packet from the receive queue you clear its PKT_IN_USE bit,
|
||||
** and then bump the pointers. Once the pointers get to the end, they must
|
||||
** be wrapped back to the start.
|
||||
*/
|
||||
void remove_receive(struct Port *PortP)
|
||||
{
|
||||
writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove);
|
||||
PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
|
||||
writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove);
|
||||
}
|
||||
1044
drivers/char/rio/rioroute.c
Normal file
1044
drivers/char/rio/rioroute.c
Normal file
File diff suppressed because it is too large
Load Diff
158
drivers/char/rio/riospace.h
Normal file
158
drivers/char/rio/riospace.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riospace.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:13
|
||||
** Retrieved : 11/6/98 11:34:22
|
||||
**
|
||||
** ident @(#)riospace.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_riospace_h__
|
||||
#define __rio_riospace_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2";
|
||||
#endif
|
||||
|
||||
#define RIO_LOCATOR_LEN 16
|
||||
#define MAX_RIO_BOARDS 4
|
||||
|
||||
/*
|
||||
** DONT change this file. At all. Unless you can rebuild the entire
|
||||
** device driver, which you probably can't, then the rest of the
|
||||
** driver won't see any changes you make here. So don't make any.
|
||||
** In particular, it won't be able to see changes to RIO_SLOTS
|
||||
*/
|
||||
|
||||
struct Conf {
|
||||
char Locator[24];
|
||||
unsigned int StartupTime;
|
||||
unsigned int SlowCook;
|
||||
unsigned int IntrPollTime;
|
||||
unsigned int BreakInterval;
|
||||
unsigned int Timer;
|
||||
unsigned int RtaLoadBase;
|
||||
unsigned int HostLoadBase;
|
||||
unsigned int XpHz;
|
||||
unsigned int XpCps;
|
||||
char *XpOn;
|
||||
char *XpOff;
|
||||
unsigned int MaxXpCps;
|
||||
unsigned int MinXpCps;
|
||||
unsigned int SpinCmds;
|
||||
unsigned int FirstAddr;
|
||||
unsigned int LastAddr;
|
||||
unsigned int BufferSize;
|
||||
unsigned int LowWater;
|
||||
unsigned int LineLength;
|
||||
unsigned int CmdTime;
|
||||
};
|
||||
|
||||
/*
|
||||
** Board types - these MUST correspond to product codes!
|
||||
*/
|
||||
#define RIO_EMPTY 0x0
|
||||
#define RIO_EISA 0x3
|
||||
#define RIO_RTA_16 0x9
|
||||
#define RIO_AT 0xA
|
||||
#define RIO_MCA 0xB
|
||||
#define RIO_PCI 0xD
|
||||
#define RIO_RTA 0xE
|
||||
|
||||
/*
|
||||
** Board data structure. This is used for configuration info
|
||||
*/
|
||||
struct Brd {
|
||||
unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */
|
||||
unsigned char Ivec; /* POLLED or ivec number */
|
||||
unsigned char Mode; /* Control stuff, see below */
|
||||
};
|
||||
|
||||
struct Board {
|
||||
char Locator[RIO_LOCATOR_LEN];
|
||||
int NumSlots;
|
||||
struct Brd Boards[MAX_RIO_BOARDS];
|
||||
};
|
||||
|
||||
#define BOOT_FROM_LINK 0x00
|
||||
#define BOOT_FROM_RAM 0x01
|
||||
#define EXTERNAL_BUS_OFF 0x00
|
||||
#define EXTERNAL_BUS_ON 0x02
|
||||
#define INTERRUPT_DISABLE 0x00
|
||||
#define INTERRUPT_ENABLE 0x04
|
||||
#define BYTE_OPERATION 0x00
|
||||
#define WORD_OPERATION 0x08
|
||||
#define POLLED INTERRUPT_DISABLE
|
||||
#define IRQ_15 (0x00 | INTERRUPT_ENABLE)
|
||||
#define IRQ_12 (0x10 | INTERRUPT_ENABLE)
|
||||
#define IRQ_11 (0x20 | INTERRUPT_ENABLE)
|
||||
#define IRQ_9 (0x30 | INTERRUPT_ENABLE)
|
||||
#define SLOW_LINKS 0x00
|
||||
#define FAST_LINKS 0x40
|
||||
#define SLOW_AT_BUS 0x00
|
||||
#define FAST_AT_BUS 0x80
|
||||
#define SLOW_PCI_TP 0x00
|
||||
#define FAST_PCI_TP 0x80
|
||||
/*
|
||||
** Debug levels
|
||||
*/
|
||||
#define DBG_NONE 0x00000000
|
||||
|
||||
#define DBG_INIT 0x00000001
|
||||
#define DBG_OPEN 0x00000002
|
||||
#define DBG_CLOSE 0x00000004
|
||||
#define DBG_IOCTL 0x00000008
|
||||
|
||||
#define DBG_READ 0x00000010
|
||||
#define DBG_WRITE 0x00000020
|
||||
#define DBG_INTR 0x00000040
|
||||
#define DBG_PROC 0x00000080
|
||||
|
||||
#define DBG_PARAM 0x00000100
|
||||
#define DBG_CMD 0x00000200
|
||||
#define DBG_XPRINT 0x00000400
|
||||
#define DBG_POLL 0x00000800
|
||||
|
||||
#define DBG_DAEMON 0x00001000
|
||||
#define DBG_FAIL 0x00002000
|
||||
#define DBG_MODEM 0x00004000
|
||||
#define DBG_LIST 0x00008000
|
||||
|
||||
#define DBG_ROUTE 0x00010000
|
||||
#define DBG_UTIL 0x00020000
|
||||
#define DBG_BOOT 0x00040000
|
||||
#define DBG_BUFFER 0x00080000
|
||||
|
||||
#define DBG_MON 0x00100000
|
||||
#define DBG_SPECIAL 0x00200000
|
||||
#define DBG_VPIX 0x00400000
|
||||
#define DBG_FLUSH 0x00800000
|
||||
|
||||
#define DBG_QENABLE 0x01000000
|
||||
|
||||
#define DBG_ALWAYS 0x80000000
|
||||
|
||||
#endif /* __rio_riospace_h__ */
|
||||
944
drivers/char/rio/riotable.c
Normal file
944
drivers/char/rio/riotable.c
Normal file
@@ -0,0 +1,944 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riotable.c
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 10:33:47
|
||||
** Retrieved : 11/6/98 10:33:50
|
||||
**
|
||||
** ident @(#)riotable.c 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "rio_linux.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
#include "rioioctl.h"
|
||||
#include "param.h"
|
||||
#include "protsts.h"
|
||||
|
||||
/*
|
||||
** A configuration table has been loaded. It is now up to us
|
||||
** to sort it out and use the information contained therein.
|
||||
*/
|
||||
int RIONewTable(struct rio_info *p)
|
||||
{
|
||||
int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
|
||||
struct Map *MapP;
|
||||
struct Map *HostMapP;
|
||||
struct Host *HostP;
|
||||
|
||||
char *cptr;
|
||||
|
||||
/*
|
||||
** We have been sent a new table to install. We need to break
|
||||
** it down into little bits and spread it around a bit to see
|
||||
** what we have got.
|
||||
*/
|
||||
/*
|
||||
** Things to check:
|
||||
** (things marked 'xx' aren't checked any more!)
|
||||
** (1) That there are no booted Hosts/RTAs out there.
|
||||
** (2) That the names are properly formed
|
||||
** (3) That blank entries really are.
|
||||
** xx (4) That hosts mentioned in the table actually exist. xx
|
||||
** (5) That the IDs are unique (per host).
|
||||
** (6) That host IDs are zero
|
||||
** (7) That port numbers are valid
|
||||
** (8) That port numbers aren't duplicated
|
||||
** (9) That names aren't duplicated
|
||||
** xx (10) That hosts that actually exist are mentioned in the table. xx
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n");
|
||||
if (p->RIOSystemUp) { /* (1) */
|
||||
p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
p->RIOError.Error = NOTHING_WRONG_AT_ALL;
|
||||
p->RIOError.Entry = -1;
|
||||
p->RIOError.Other = -1;
|
||||
|
||||
for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
|
||||
MapP = &p->RIOConnectTable[Entry];
|
||||
if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n");
|
||||
cptr = MapP->Name; /* (2) */
|
||||
cptr[MAX_NAME_LEN - 1] = '\0';
|
||||
if (cptr[0] == '\0') {
|
||||
memcpy(MapP->Name, MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", 8);
|
||||
MapP->Name[5] = '0' + Entry / 10;
|
||||
MapP->Name[6] = '0' + Entry % 10;
|
||||
}
|
||||
while (*cptr) {
|
||||
if (*cptr < ' ' || *cptr > '~') {
|
||||
p->RIOError.Error = BAD_CHARACTER_IN_NAME;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
cptr++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** If the entry saved was a tentative entry then just forget
|
||||
** about it.
|
||||
*/
|
||||
if (MapP->Flags & SLOT_TENTATIVE) {
|
||||
MapP->HostUniqueNum = 0;
|
||||
MapP->RtaUniqueNum = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n");
|
||||
if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */
|
||||
if (MapP->ID || MapP->SysPort || MapP->Flags) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name);
|
||||
p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n");
|
||||
for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */
|
||||
if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) {
|
||||
HostP = &p->RIOHosts[Host];
|
||||
/*
|
||||
** having done the lookup, we don't really want to do
|
||||
** it again, so hang the host number in a safe place
|
||||
*/
|
||||
MapP->Topology[0].Unit = Host;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Host >= p->RIONumHosts) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum);
|
||||
MapP->HostUniqueNum = 0;
|
||||
/* MapP->RtaUniqueNum = 0; */
|
||||
/* MapP->ID = 0; */
|
||||
/* MapP->Flags = 0; */
|
||||
/* MapP->SysPort = 0; */
|
||||
/* MapP->Name[0] = 0; */
|
||||
continue;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n");
|
||||
if (MapP->RtaUniqueNum) { /* (5) */
|
||||
if (!MapP->ID) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name);
|
||||
p->RIOError.Error = ZERO_RTA_ID;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
if (MapP->ID > MAX_RUP) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID);
|
||||
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
|
||||
if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name);
|
||||
p->RIOError.Error = DUPLICATED_RTA_ID;
|
||||
p->RIOError.Entry = Entry;
|
||||
p->RIOError.Other = SubEnt;
|
||||
return -ENXIO;
|
||||
}
|
||||
/*
|
||||
** If the RtaUniqueNum is the same, it may be looking at both
|
||||
** entries for a 16 port RTA, so check the ids
|
||||
*/
|
||||
if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum)
|
||||
&& (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name);
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name);
|
||||
p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER;
|
||||
p->RIOError.Entry = Entry;
|
||||
p->RIOError.Other = SubEnt;
|
||||
return -ENXIO;
|
||||
}
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n");
|
||||
/* (7a) */
|
||||
if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", (int) MapP->SysPort, MapP->Name, PORTS_PER_RTA);
|
||||
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n");
|
||||
/* (7b) */
|
||||
if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name);
|
||||
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
|
||||
if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT)
|
||||
continue;
|
||||
if (p->RIOConnectTable[SubEnt].RtaUniqueNum) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n");
|
||||
/* (8) */
|
||||
if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort);
|
||||
p->RIOError.Error = TTY_NUMBER_IN_USE;
|
||||
p->RIOError.Entry = Entry;
|
||||
p->RIOError.Other = SubEnt;
|
||||
return -ENXIO;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
|
||||
if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
|
||||
p->RIOError.Error = NAME_USED_TWICE;
|
||||
p->RIOError.Entry = Entry;
|
||||
p->RIOError.Other = SubEnt;
|
||||
return -ENXIO;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { /* (6) */
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n");
|
||||
if (MapP->ID) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name);
|
||||
p->RIOError.Error = HOST_ID_NOT_ZERO;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
if (MapP->SysPort != NO_PORT) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name);
|
||||
p->RIOError.Error = HOST_SYSPORT_BAD;
|
||||
p->RIOError.Entry = Entry;
|
||||
return -ENXIO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** wow! if we get here then it's a goody!
|
||||
*/
|
||||
|
||||
/*
|
||||
** Zero the (old) entries for each host...
|
||||
*/
|
||||
for (Host = 0; Host < RIO_HOSTS; Host++) {
|
||||
for (Entry = 0; Entry < MAX_RUP; Entry++) {
|
||||
memset(&p->RIOHosts[Host].Mapping[Entry], 0, sizeof(struct Map));
|
||||
}
|
||||
memset(&p->RIOHosts[Host].Name[0], 0, sizeof(p->RIOHosts[Host].Name));
|
||||
}
|
||||
|
||||
/*
|
||||
** Copy in the new table entries
|
||||
*/
|
||||
for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry);
|
||||
MapP = &p->RIOConnectTable[Entry];
|
||||
|
||||
/*
|
||||
** Now, if it is an empty slot ignore it!
|
||||
*/
|
||||
if (MapP->HostUniqueNum == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
** we saved the host number earlier, so grab it back
|
||||
*/
|
||||
HostP = &p->RIOHosts[MapP->Topology[0].Unit];
|
||||
|
||||
/*
|
||||
** If it is a host, then we only need to fill in the name field.
|
||||
*/
|
||||
if (MapP->ID == 0) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name);
|
||||
memcpy(HostP->Name, MapP->Name, MAX_NAME_LEN);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
** Its an RTA entry, so fill in the host mapping entries for it
|
||||
** and the port mapping entries. Notice that entry zero is for
|
||||
** ID one.
|
||||
*/
|
||||
HostMapP = &HostP->Mapping[MapP->ID - 1];
|
||||
|
||||
if (MapP->Flags & SLOT_IN_USE) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name);
|
||||
/*
|
||||
** structure assign, then sort out the bits we shouldn't have done
|
||||
*/
|
||||
*HostMapP = *MapP;
|
||||
|
||||
HostMapP->Flags = SLOT_IN_USE;
|
||||
if (MapP->Flags & RTA16_SECOND_SLOT)
|
||||
HostMapP->Flags |= RTA16_SECOND_SLOT;
|
||||
|
||||
RIOReMapPorts(p, HostP, HostMapP);
|
||||
} else {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
|
||||
p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry];
|
||||
}
|
||||
|
||||
for (Host = 0; Host < p->RIONumHosts; Host++) {
|
||||
for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
|
||||
p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
|
||||
p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK;
|
||||
}
|
||||
for (Entry = 0; Entry < MAX_RUP; Entry++) {
|
||||
for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
|
||||
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
|
||||
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK;
|
||||
}
|
||||
}
|
||||
if (!p->RIOHosts[Host].Name[0]) {
|
||||
memcpy(p->RIOHosts[Host].Name, "HOST 1", 7);
|
||||
p->RIOHosts[Host].Name[5] += Host;
|
||||
}
|
||||
/*
|
||||
** Check that default name assigned is unique.
|
||||
*/
|
||||
Host1 = Host;
|
||||
NameIsUnique = 0;
|
||||
while (!NameIsUnique) {
|
||||
NameIsUnique = 1;
|
||||
for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) {
|
||||
if (Host2 == Host)
|
||||
continue;
|
||||
if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name)
|
||||
== 0) {
|
||||
NameIsUnique = 0;
|
||||
Host1++;
|
||||
if (Host1 >= p->RIONumHosts)
|
||||
Host1 = 0;
|
||||
p->RIOHosts[Host].Name[5] = '1' + Host1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Rename host if name already used.
|
||||
*/
|
||||
if (Host1 != Host) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name);
|
||||
memcpy(p->RIOHosts[Host].Name, "HOST 1", 7);
|
||||
p->RIOHosts[Host].Name[5] += Host1;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** User process needs the config table - build it from first
|
||||
** principles.
|
||||
**
|
||||
* FIXME: SMP locking
|
||||
*/
|
||||
int RIOApel(struct rio_info *p)
|
||||
{
|
||||
int Host;
|
||||
int link;
|
||||
int Rup;
|
||||
int Next = 0;
|
||||
struct Map *MapP;
|
||||
struct Host *HostP;
|
||||
unsigned long flags;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
|
||||
|
||||
memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES);
|
||||
|
||||
for (Host = 0; Host < RIO_HOSTS; Host++) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
|
||||
HostP = &p->RIOHosts[Host];
|
||||
rio_spin_lock_irqsave(&HostP->HostLock, flags);
|
||||
|
||||
MapP = &p->RIOConnectTable[Next++];
|
||||
MapP->HostUniqueNum = HostP->UniqueNum;
|
||||
if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
|
||||
continue;
|
||||
MapP->RtaUniqueNum = 0;
|
||||
MapP->ID = 0;
|
||||
MapP->Flags = SLOT_IN_USE;
|
||||
MapP->SysPort = NO_PORT;
|
||||
for (link = 0; link < LINKS_PER_UNIT; link++)
|
||||
MapP->Topology[link] = HostP->Topology[link];
|
||||
memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN);
|
||||
for (Rup = 0; Rup < MAX_RUP; Rup++) {
|
||||
if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
|
||||
p->RIOConnectTable[Next] = HostP->Mapping[Rup];
|
||||
if (HostP->Mapping[Rup].Flags & SLOT_IN_USE)
|
||||
p->RIOConnectTable[Next].Flags |= SLOT_IN_USE;
|
||||
if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
|
||||
p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE;
|
||||
if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT)
|
||||
p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT;
|
||||
Next++;
|
||||
}
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** config.rio has taken a dislike to one of the gross maps entries.
|
||||
** if the entry is suitably inactive, then we can gob on it and remove
|
||||
** it from the table.
|
||||
*/
|
||||
int RIODeleteRta(struct rio_info *p, struct Map *MapP)
|
||||
{
|
||||
int host, entry, port, link;
|
||||
int SysPort;
|
||||
struct Host *HostP;
|
||||
struct Map *HostMapP;
|
||||
struct Port *PortP;
|
||||
int work_done = 0;
|
||||
unsigned long lock_flags, sem_flags;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum);
|
||||
|
||||
for (host = 0; host < p->RIONumHosts; host++) {
|
||||
HostP = &p->RIOHosts[host];
|
||||
|
||||
rio_spin_lock_irqsave(&HostP->HostLock, lock_flags);
|
||||
|
||||
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
|
||||
rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (entry = 0; entry < MAX_RUP; entry++) {
|
||||
if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) {
|
||||
HostMapP = &HostP->Mapping[entry];
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name);
|
||||
|
||||
/*
|
||||
** Check all four links of the unit are disconnected
|
||||
*/
|
||||
for (link = 0; link < LINKS_PER_UNIT; link++) {
|
||||
if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
|
||||
p->RIOError.Error = UNIT_IS_IN_USE;
|
||||
rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Slot has been allocated, BUT not booted/routed/
|
||||
** connected/selected or anything else-ed
|
||||
*/
|
||||
SysPort = HostMapP->SysPort;
|
||||
|
||||
if (SysPort != NO_PORT) {
|
||||
for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) {
|
||||
PortP = p->RIOPortp[port];
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n");
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, sem_flags);
|
||||
|
||||
PortP->Mapped = 0;
|
||||
|
||||
if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n");
|
||||
PortP->TxBufferIn = PortP->TxBufferOut = 0;
|
||||
/* What should I do
|
||||
wakeup( &PortP->TxBufferIn );
|
||||
wakeup( &PortP->TxBufferOut);
|
||||
*/
|
||||
PortP->InUse = NOT_INUSE;
|
||||
/* What should I do
|
||||
wakeup( &PortP->InUse );
|
||||
signal(PortP->TtyP->t_pgrp,SIGKILL);
|
||||
ttyflush(PortP->TtyP,(FREAD|FWRITE));
|
||||
*/
|
||||
PortP->State |= RIO_CLOSING | RIO_DELETED;
|
||||
}
|
||||
|
||||
/*
|
||||
** For the second slot of a 16 port RTA, the
|
||||
** driver needs to reset the changes made to
|
||||
** the phb to port mappings in RIORouteRup.
|
||||
*/
|
||||
if (PortP->SecondBlock) {
|
||||
u16 dest_unit = HostMapP->ID;
|
||||
u16 dest_port = port - SysPort;
|
||||
u16 __iomem *TxPktP;
|
||||
struct PKT __iomem *Pkt;
|
||||
|
||||
for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
|
||||
/*
|
||||
** *TxPktP is the pointer to the
|
||||
** transmit packet on the host card.
|
||||
** This needs to be translated into
|
||||
** a 32 bit pointer so it can be
|
||||
** accessed from the driver.
|
||||
*/
|
||||
Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&*TxPktP));
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", readw(TxPktP), readb(&Pkt->dest_unit), readb(&Pkt->dest_port), dest_unit, dest_port);
|
||||
writew(dest_unit, &Pkt->dest_unit);
|
||||
writew(dest_port, &Pkt->dest_port);
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, readb(&PortP->PhbP->destination) & 0xff, (readb(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
|
||||
writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination);
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
|
||||
}
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n");
|
||||
memset(HostMapP, 0, sizeof(struct Map));
|
||||
work_done++;
|
||||
}
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
|
||||
}
|
||||
|
||||
/* XXXXX lock me up */
|
||||
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
|
||||
if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
|
||||
memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map));
|
||||
work_done++;
|
||||
}
|
||||
if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
|
||||
memset(&p->RIOConnectTable[entry], 0, sizeof(struct Map));
|
||||
work_done++;
|
||||
}
|
||||
}
|
||||
if (work_done)
|
||||
return 0;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n");
|
||||
p->RIOError.Error = COULDNT_FIND_ENTRY;
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
int RIOAssignRta(struct rio_info *p, struct Map *MapP)
|
||||
{
|
||||
int host;
|
||||
struct Map *HostMapP;
|
||||
char *sptr;
|
||||
int link;
|
||||
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
|
||||
|
||||
if ((MapP->ID != (u16) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
|
||||
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
|
||||
return -EINVAL;
|
||||
}
|
||||
if (MapP->RtaUniqueNum == 0) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
|
||||
p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA);
|
||||
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort);
|
||||
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Copy the name across to the map entry.
|
||||
*/
|
||||
MapP->Name[MAX_NAME_LEN - 1] = '\0';
|
||||
sptr = MapP->Name;
|
||||
while (*sptr) {
|
||||
if (*sptr < ' ' || *sptr > '~') {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
|
||||
p->RIOError.Error = BAD_CHARACTER_IN_NAME;
|
||||
return -EINVAL;
|
||||
}
|
||||
sptr++;
|
||||
}
|
||||
|
||||
for (host = 0; host < p->RIONumHosts; host++) {
|
||||
if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
|
||||
if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
|
||||
p->RIOError.Error = HOST_NOT_RUNNING;
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
/*
|
||||
** Now we have a host we need to allocate an ID
|
||||
** if the entry does not already have one.
|
||||
*/
|
||||
if (MapP->ID == (u16) - 1) {
|
||||
int nNewID;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name);
|
||||
/*
|
||||
** The idea here is to allow RTA's to be assigned
|
||||
** before they actually appear on the network.
|
||||
** This allows the addition of RTA's without having
|
||||
** to plug them in.
|
||||
** What we do is:
|
||||
** - Find a free ID and allocate it to the RTA.
|
||||
** - If this map entry is the second half of a
|
||||
** 16 port entry then find the other half and
|
||||
** make sure the 2 cross reference each other.
|
||||
*/
|
||||
if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) {
|
||||
p->RIOError.Error = COULDNT_FIND_ENTRY;
|
||||
return -EBUSY;
|
||||
}
|
||||
MapP->ID = (u16) nNewID + 1;
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
|
||||
HostMapP = &p->RIOHosts[host].Mapping[nNewID];
|
||||
HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
|
||||
HostMapP->HostUniqueNum = MapP->HostUniqueNum;
|
||||
HostMapP->ID = MapP->ID;
|
||||
for (link = 0; link < LINKS_PER_UNIT; link++) {
|
||||
HostMapP->Topology[link].Unit = ROUTE_DISCONNECT;
|
||||
HostMapP->Topology[link].Link = NO_LINK;
|
||||
}
|
||||
if (MapP->Flags & RTA16_SECOND_SLOT) {
|
||||
int unit;
|
||||
|
||||
for (unit = 0; unit < MAX_RUP; unit++)
|
||||
if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum)
|
||||
break;
|
||||
if (unit == MAX_RUP) {
|
||||
p->RIOError.Error = COULDNT_FIND_ENTRY;
|
||||
return -EBUSY;
|
||||
}
|
||||
HostMapP->Flags |= RTA16_SECOND_SLOT;
|
||||
HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
|
||||
p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID;
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID);
|
||||
}
|
||||
}
|
||||
|
||||
HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
|
||||
|
||||
if (HostMapP->Flags & SLOT_IN_USE) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
|
||||
p->RIOError.Error = ID_ALREADY_IN_USE;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/*
|
||||
** Assign the sys ports and the name, and mark the slot as
|
||||
** being in use.
|
||||
*/
|
||||
HostMapP->SysPort = MapP->SysPort;
|
||||
if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
|
||||
memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN);
|
||||
HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
|
||||
#ifdef NEED_TO_FIX
|
||||
RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]);
|
||||
#endif
|
||||
if (MapP->Flags & RTA16_SECOND_SLOT)
|
||||
HostMapP->Flags |= RTA16_SECOND_SLOT;
|
||||
|
||||
RIOReMapPorts(p, &p->RIOHosts[host], HostMapP);
|
||||
/*
|
||||
** Adjust 2nd block of 8 phbs
|
||||
*/
|
||||
if (MapP->Flags & RTA16_SECOND_SLOT)
|
||||
RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1);
|
||||
|
||||
if (HostMapP->SysPort != NO_PORT) {
|
||||
if (HostMapP->SysPort < p->RIOFirstPortsBooted)
|
||||
p->RIOFirstPortsBooted = HostMapP->SysPort;
|
||||
if (HostMapP->SysPort > p->RIOLastPortsBooted)
|
||||
p->RIOLastPortsBooted = HostMapP->SysPort;
|
||||
}
|
||||
if (MapP->Flags & RTA16_SECOND_SLOT)
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
|
||||
else
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
p->RIOError.Error = UNKNOWN_HOST_NUMBER;
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
||||
int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP)
|
||||
{
|
||||
struct Port *PortP;
|
||||
unsigned int SubEnt;
|
||||
unsigned int HostPort;
|
||||
unsigned int SysPort;
|
||||
u16 RtaType;
|
||||
unsigned long flags;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
|
||||
|
||||
/*
|
||||
** We need to tell the UnixRups which sysport the rup corresponds to
|
||||
*/
|
||||
HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort;
|
||||
|
||||
if (HostMapP->SysPort == NO_PORT)
|
||||
return (0);
|
||||
|
||||
RtaType = GetUnitType(HostMapP->RtaUniqueNum);
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1);
|
||||
|
||||
/*
|
||||
** now map each of its eight ports
|
||||
*/
|
||||
for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort);
|
||||
SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */
|
||||
/* portnumber on host */
|
||||
|
||||
HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
|
||||
PortP = p->RIOPortp[SysPort];
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Map port\n");
|
||||
|
||||
/*
|
||||
** Point at all the real neat data structures
|
||||
*/
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
PortP->HostP = HostP;
|
||||
PortP->Caddr = HostP->Caddr;
|
||||
|
||||
/*
|
||||
** The PhbP cannot be filled in yet
|
||||
** unless the host has been booted
|
||||
*/
|
||||
if ((HostP->Flags & RUN_STATE) == RC_RUNNING) {
|
||||
struct PHB __iomem *PhbP = PortP->PhbP = &HostP->PhbP[HostPort];
|
||||
PortP->TxAdd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add));
|
||||
PortP->TxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start));
|
||||
PortP->TxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end));
|
||||
PortP->RxRemove = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove));
|
||||
PortP->RxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start));
|
||||
PortP->RxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end));
|
||||
} else
|
||||
PortP->PhbP = NULL;
|
||||
|
||||
/*
|
||||
** port related flags
|
||||
*/
|
||||
PortP->HostPort = HostPort;
|
||||
/*
|
||||
** For each part of a 16 port RTA, RupNum is ID - 1.
|
||||
*/
|
||||
PortP->RupNum = HostMapP->ID - 1;
|
||||
if (HostMapP->Flags & RTA16_SECOND_SLOT) {
|
||||
PortP->ID2 = HostMapP->ID2 - 1;
|
||||
PortP->SecondBlock = 1;
|
||||
} else {
|
||||
PortP->ID2 = 0;
|
||||
PortP->SecondBlock = 0;
|
||||
}
|
||||
PortP->RtaUniqueNum = HostMapP->RtaUniqueNum;
|
||||
|
||||
/*
|
||||
** If the port was already mapped then thats all we need to do.
|
||||
*/
|
||||
if (PortP->Mapped) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
continue;
|
||||
} else
|
||||
HostMapP->Flags &= ~RTA_NEWBOOT;
|
||||
|
||||
PortP->State = 0;
|
||||
PortP->Config = 0;
|
||||
/*
|
||||
** Check out the module type - if it is special (read only etc.)
|
||||
** then we need to set flags in the PortP->Config.
|
||||
** Note: For 16 port RTA, all ports are of the same type.
|
||||
*/
|
||||
if (RtaType == TYPE_RTA16) {
|
||||
PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
|
||||
} else {
|
||||
if (SubEnt < PORTS_PER_MODULE)
|
||||
PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
|
||||
else
|
||||
PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
|
||||
}
|
||||
|
||||
/*
|
||||
** more port related flags
|
||||
*/
|
||||
PortP->PortState = 0;
|
||||
PortP->ModemLines = 0;
|
||||
PortP->ModemState = 0;
|
||||
PortP->CookMode = COOK_WELL;
|
||||
PortP->ParamSem = 0;
|
||||
PortP->FlushCmdBodge = 0;
|
||||
PortP->WflushFlag = 0;
|
||||
PortP->MagicFlags = 0;
|
||||
PortP->Lock = 0;
|
||||
PortP->Store = 0;
|
||||
PortP->FirstOpen = 1;
|
||||
|
||||
/*
|
||||
** Buffers 'n things
|
||||
*/
|
||||
PortP->RxDataStart = 0;
|
||||
PortP->Cor2Copy = 0;
|
||||
PortP->Name = &HostMapP->Name[0];
|
||||
PortP->statsGather = 0;
|
||||
PortP->txchars = 0;
|
||||
PortP->rxchars = 0;
|
||||
PortP->opens = 0;
|
||||
PortP->closes = 0;
|
||||
PortP->ioctls = 0;
|
||||
if (PortP->TxRingBuffer)
|
||||
memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
|
||||
else if (p->RIOBufferSize) {
|
||||
PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL);
|
||||
memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
|
||||
}
|
||||
PortP->TxBufferOut = 0;
|
||||
PortP->TxBufferIn = 0;
|
||||
PortP->Debug = 0;
|
||||
/*
|
||||
** LastRxTgl stores the state of the rx toggle bit for this
|
||||
** port, to be compared with the state of the next pkt received.
|
||||
** If the same, we have received the same rx pkt from the RTA
|
||||
** twice. Initialise to a value not equal to PHB_RX_TGL or 0.
|
||||
*/
|
||||
PortP->LastRxTgl = ~(u8) PHB_RX_TGL;
|
||||
|
||||
/*
|
||||
** and mark the port as usable
|
||||
*/
|
||||
PortP->Mapped = 1;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
}
|
||||
if (HostMapP->SysPort < p->RIOFirstPortsMapped)
|
||||
p->RIOFirstPortsMapped = HostMapP->SysPort;
|
||||
if (HostMapP->SysPort > p->RIOLastPortsMapped)
|
||||
p->RIOLastPortsMapped = HostMapP->SysPort;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RIOChangeName(struct rio_info *p, struct Map *MapP)
|
||||
{
|
||||
int host;
|
||||
struct Map *HostMapP;
|
||||
char *sptr;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
|
||||
|
||||
if (MapP->ID > MAX_RUP) {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
|
||||
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
MapP->Name[MAX_NAME_LEN - 1] = '\0';
|
||||
sptr = MapP->Name;
|
||||
|
||||
while (*sptr) {
|
||||
if (*sptr < ' ' || *sptr > '~') {
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
|
||||
p->RIOError.Error = BAD_CHARACTER_IN_NAME;
|
||||
return -EINVAL;
|
||||
}
|
||||
sptr++;
|
||||
}
|
||||
|
||||
for (host = 0; host < p->RIONumHosts; host++) {
|
||||
if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
|
||||
if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
|
||||
p->RIOError.Error = HOST_NOT_RUNNING;
|
||||
return -ENXIO;
|
||||
}
|
||||
if (MapP->ID == 0) {
|
||||
memcpy(p->RIOHosts[host].Name, MapP->Name, MAX_NAME_LEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
|
||||
|
||||
if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) {
|
||||
p->RIOError.Error = RTA_NUMBER_WRONG;
|
||||
return -ENXIO;
|
||||
}
|
||||
memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
p->RIOError.Error = UNKNOWN_HOST_NUMBER;
|
||||
rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
|
||||
return -ENXIO;
|
||||
}
|
||||
654
drivers/char/rio/riotty.c
Normal file
654
drivers/char/rio/riotty.c
Normal file
@@ -0,0 +1,654 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : riotty.c
|
||||
** SID : 1.3
|
||||
** Last Modified : 11/6/98 10:33:47
|
||||
** Retrieved : 11/6/98 10:33:50
|
||||
**
|
||||
** ident @(#)riotty.c 1.3
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
|
||||
#endif
|
||||
|
||||
|
||||
#define __EXPLICIT_DEF_H__
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/string.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include <linux/termios.h>
|
||||
|
||||
#include <linux/serial.h>
|
||||
|
||||
#include <linux/generic_serial.h>
|
||||
|
||||
|
||||
#include "linux_compat.h"
|
||||
#include "rio_linux.h"
|
||||
#include "pkt.h"
|
||||
#include "daemon.h"
|
||||
#include "rio.h"
|
||||
#include "riospace.h"
|
||||
#include "cmdpkt.h"
|
||||
#include "map.h"
|
||||
#include "rup.h"
|
||||
#include "port.h"
|
||||
#include "riodrvr.h"
|
||||
#include "rioinfo.h"
|
||||
#include "func.h"
|
||||
#include "errors.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include "parmmap.h"
|
||||
#include "unixrup.h"
|
||||
#include "board.h"
|
||||
#include "host.h"
|
||||
#include "phb.h"
|
||||
#include "link.h"
|
||||
#include "cmdblk.h"
|
||||
#include "route.h"
|
||||
#include "cirrus.h"
|
||||
#include "rioioctl.h"
|
||||
#include "param.h"
|
||||
|
||||
static void RIOClearUp(struct Port *PortP);
|
||||
|
||||
/* Below belongs in func.h */
|
||||
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
|
||||
|
||||
|
||||
extern struct rio_info *p;
|
||||
|
||||
|
||||
int riotopen(struct tty_struct *tty, struct file *filp)
|
||||
{
|
||||
unsigned int SysPort;
|
||||
int repeat_this = 250;
|
||||
struct Port *PortP; /* pointer to the port structure */
|
||||
unsigned long flags;
|
||||
int retval = 0;
|
||||
|
||||
func_enter();
|
||||
|
||||
/* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close
|
||||
is going to oops.
|
||||
*/
|
||||
tty->driver_data = NULL;
|
||||
|
||||
SysPort = rio_minor(tty);
|
||||
|
||||
if (p->RIOFailed) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
|
||||
func_exit();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (mapped:%d)\n", SysPort, p->RIOPortp[SysPort]->Mapped);
|
||||
|
||||
/*
|
||||
** Validate that we have received a legitimate request.
|
||||
** Currently, just check that we are opening a port on
|
||||
** a host card that actually exists, and that the port
|
||||
** has been mapped onto a host.
|
||||
*/
|
||||
if (SysPort >= RIO_PORTS) { /* out of range ? */
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort);
|
||||
func_exit();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
/*
|
||||
** Grab pointer to the port stucture
|
||||
*/
|
||||
PortP = p->RIOPortp[SysPort]; /* Get control struc */
|
||||
rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
|
||||
if (!PortP->Mapped) { /* we aren't mapped yet! */
|
||||
/*
|
||||
** The system doesn't know which RTA this port
|
||||
** corresponds to.
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n");
|
||||
func_exit();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
tty->driver_data = PortP;
|
||||
|
||||
PortP->gs.tty = tty;
|
||||
PortP->gs.count++;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
|
||||
|
||||
retval = gs_init_port(&PortP->gs);
|
||||
if (retval) {
|
||||
PortP->gs.count--;
|
||||
return -ENXIO;
|
||||
}
|
||||
/*
|
||||
** If the host hasn't been booted yet, then
|
||||
** fail
|
||||
*/
|
||||
if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Host not running\n");
|
||||
func_exit();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the RTA has not booted yet and the user has choosen to block
|
||||
** until the RTA is present then we must spin here waiting for
|
||||
** the RTA to boot.
|
||||
*/
|
||||
/* I find the above code a bit hairy. I find the below code
|
||||
easier to read and shorter. Now, if it works too that would
|
||||
be great... -- REW
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n");
|
||||
while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
|
||||
if (!PortP->WaitUntilBooted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
|
||||
func_exit();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
/* Under Linux you'd normally use a wait instead of this
|
||||
busy-waiting. I'll stick with the old implementation for
|
||||
now. --REW
|
||||
*/
|
||||
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n");
|
||||
func_exit();
|
||||
return -EINTR;
|
||||
}
|
||||
if (repeat_this-- <= 0) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
|
||||
func_exit();
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
if (p->RIOHalted) {
|
||||
goto bombout;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the port is in the final throws of being closed,
|
||||
** we should wait here (politely), waiting
|
||||
** for it to finish, so that it doesn't close us!
|
||||
*/
|
||||
while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n");
|
||||
if (repeat_this-- <= 0) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
retval = -EINTR;
|
||||
goto bombout;
|
||||
}
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
retval = -EINTR;
|
||||
goto bombout;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
}
|
||||
|
||||
if (!PortP->Mapped) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n");
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
retval = -ENXIO;
|
||||
func_exit();
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (p->RIOHalted) {
|
||||
goto bombout;
|
||||
}
|
||||
|
||||
/*
|
||||
** 15.10.1998 ARG - ESIL 0761 part fix
|
||||
** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,
|
||||
** we need to make sure that the flags are clear when the port is opened.
|
||||
*/
|
||||
/* Uh? Suppose I turn these on and then another process opens
|
||||
the port again? The flags get cleared! Not good. -- REW */
|
||||
if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
|
||||
PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
|
||||
}
|
||||
|
||||
if (!(PortP->firstOpen)) { /* First time ? */
|
||||
rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n");
|
||||
|
||||
|
||||
PortP->firstOpen++;
|
||||
PortP->CookMode = 0; /* XXX RIOCookMode(tp); */
|
||||
PortP->InUse = NOT_INUSE;
|
||||
|
||||
/* Tentative fix for bug PR27. Didn't work. */
|
||||
/* PortP->gs.xmit_cnt = 0; */
|
||||
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
|
||||
/* Someone explain to me why this delay/config is
|
||||
here. If I read the docs correctly the "open"
|
||||
command piggybacks the parameters immediately.
|
||||
-- REW */
|
||||
RIOParam(PortP, OPEN, 1, OK_TO_SLEEP); /* Open the port */
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
/*
|
||||
** wait for the port to be not closed.
|
||||
*/
|
||||
while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState);
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
func_exit();
|
||||
return -EINTR;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
}
|
||||
|
||||
if (p->RIOHalted) {
|
||||
retval = -EIO;
|
||||
bombout:
|
||||
/* RIOClearUp( PortP ); */
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return retval;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n");
|
||||
/*
|
||||
** ACTION
|
||||
** insert test for carrier here. -- ???
|
||||
** I already see that test here. What's the deal? -- REW
|
||||
*/
|
||||
if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
|
||||
/*
|
||||
tp->tm.c_state |= CARR_ON;
|
||||
wakeup((caddr_t) &tp->tm.c_canq);
|
||||
*/
|
||||
PortP->State |= RIO_CARR_ON;
|
||||
wake_up_interruptible(&PortP->gs.open_wait);
|
||||
} else { /* no carrier - wait for DCD */
|
||||
/*
|
||||
while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
|
||||
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
|
||||
*/
|
||||
while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
|
||||
/*
|
||||
PortP->gs.tty->termios->c_state |= WOPEN;
|
||||
*/
|
||||
PortP->State |= RIO_WOPEN;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
/*
|
||||
** ACTION: verify that this is a good thing
|
||||
** to do here. -- ???
|
||||
** I think it's OK. -- REW
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
/*
|
||||
tp->tm.c_state &= ~WOPEN;
|
||||
*/
|
||||
PortP->State &= ~RIO_WOPEN;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
func_exit();
|
||||
return -EINTR;
|
||||
}
|
||||
}
|
||||
PortP->State &= ~RIO_WOPEN;
|
||||
}
|
||||
if (p->RIOHalted)
|
||||
goto bombout;
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
|
||||
PortP->State |= RIO_MOPEN;
|
||||
|
||||
if (p->RIOHalted)
|
||||
goto bombout;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "high level open done\n");
|
||||
|
||||
/*
|
||||
** Count opens for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->opens++;
|
||||
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n");
|
||||
func_exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** RIOClose the port.
|
||||
** The operating system thinks that this is last close for the device.
|
||||
** As there are two interfaces to the port (Modem and tty), we need to
|
||||
** check that both are closed before we close the device.
|
||||
*/
|
||||
int riotclose(void *ptr)
|
||||
{
|
||||
struct Port *PortP = ptr; /* pointer to the port structure */
|
||||
int deleted = 0;
|
||||
int try = -1; /* Disable the timeouts by setting them to -1 */
|
||||
int repeat_this = -1; /* Congrats to those having 15 years of
|
||||
uptime! (You get to break the driver.) */
|
||||
unsigned long end_time;
|
||||
struct tty_struct *tty;
|
||||
unsigned long flags;
|
||||
int rv = 0;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
|
||||
|
||||
/* PortP = p->RIOPortp[SysPort]; */
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
|
||||
/* tp = PortP->TtyP; *//* Get tty */
|
||||
tty = PortP->gs.tty;
|
||||
rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
|
||||
|
||||
if (PortP->gs.closing_wait)
|
||||
end_time = jiffies + PortP->gs.closing_wait;
|
||||
else
|
||||
end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
|
||||
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
/*
|
||||
** Setting this flag will make any process trying to open
|
||||
** this port block until we are complete closing it.
|
||||
*/
|
||||
PortP->State |= RIO_CLOSING;
|
||||
|
||||
if ((PortP->State & RIO_DELETED)) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n");
|
||||
deleted = 1;
|
||||
}
|
||||
|
||||
if (p->RIOHalted) {
|
||||
RIOClearUp(PortP);
|
||||
rv = -EIO;
|
||||
goto close_end;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n");
|
||||
/*
|
||||
** clear the open bits for this device
|
||||
*/
|
||||
PortP->State &= ~RIO_MOPEN;
|
||||
PortP->State &= ~RIO_CARR_ON;
|
||||
PortP->ModemState &= ~MSVR1_CD;
|
||||
/*
|
||||
** If the device was open as both a Modem and a tty line
|
||||
** then we need to wimp out here, as the port has not really
|
||||
** been finally closed (gee, whizz!) The test here uses the
|
||||
** bit for the OTHER mode of operation, to see if THAT is
|
||||
** still active!
|
||||
*/
|
||||
if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
|
||||
/*
|
||||
** The port is still open for the other task -
|
||||
** return, pretending that we are still active.
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum);
|
||||
PortP->State &= ~RIO_CLOSING;
|
||||
if (PortP->firstOpen)
|
||||
PortP->firstOpen--;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n");
|
||||
|
||||
PortP->State &= ~RIO_DYNOROD;
|
||||
|
||||
/*
|
||||
** This is where we wait for the port
|
||||
** to drain down before closing. Bye-bye....
|
||||
** (We never meant to do this)
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n");
|
||||
|
||||
if (!deleted)
|
||||
while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
|
||||
if (repeat_this-- <= 0) {
|
||||
rv = -EINTR;
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
goto close_end;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
|
||||
rv = -EINTR;
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
goto close_end;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
}
|
||||
|
||||
PortP->TxBufferIn = PortP->TxBufferOut = 0;
|
||||
repeat_this = 0xff;
|
||||
|
||||
PortP->InUse = 0;
|
||||
if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
|
||||
/*
|
||||
** The port has been re-opened for the other task -
|
||||
** return, pretending that we are still active.
|
||||
*/
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum);
|
||||
PortP->State &= ~RIO_CLOSING;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (PortP->firstOpen)
|
||||
PortP->firstOpen--;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (p->RIOHalted) {
|
||||
RIOClearUp(PortP);
|
||||
goto close_end;
|
||||
}
|
||||
|
||||
/* Can't call RIOShortCommand with the port locked. */
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
|
||||
if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
goto close_end;
|
||||
}
|
||||
|
||||
if (!deleted)
|
||||
while (try && (PortP->PortState & PORT_ISOPEN)) {
|
||||
try--;
|
||||
if (time_after(jiffies, end_time)) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n");
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
break;
|
||||
}
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
|
||||
|
||||
if (p->RIOHalted) {
|
||||
RIOClearUp(PortP);
|
||||
goto close_end;
|
||||
}
|
||||
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
|
||||
RIOPreemptiveCmd(p, PortP, FCLOSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try);
|
||||
|
||||
/* RIOPreemptiveCmd(p, PortP, FCLOSE); */
|
||||
|
||||
/*
|
||||
** 15.10.1998 ARG - ESIL 0761 part fix
|
||||
** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened.
|
||||
*/
|
||||
PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
|
||||
|
||||
/*
|
||||
** Count opens for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->closes++;
|
||||
|
||||
close_end:
|
||||
/* XXX: Why would a "DELETED" flag be reset here? I'd have
|
||||
thought that a "deleted" flag means that the port was
|
||||
permanently gone, but here we can make it reappear by it
|
||||
being in close during the "deletion".
|
||||
*/
|
||||
PortP->State &= ~(RIO_CLOSING | RIO_DELETED);
|
||||
if (PortP->firstOpen)
|
||||
PortP->firstOpen--;
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Return from close\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void RIOClearUp(struct Port *PortP)
|
||||
{
|
||||
rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n");
|
||||
PortP->Config = 0; /* Direct semaphore */
|
||||
PortP->PortState = 0;
|
||||
PortP->firstOpen = 0;
|
||||
PortP->FlushCmdBodge = 0;
|
||||
PortP->ModemState = PortP->CookMode = 0;
|
||||
PortP->Mapped = 0;
|
||||
PortP->WflushFlag = 0;
|
||||
PortP->MagicFlags = 0;
|
||||
PortP->RxDataStart = 0;
|
||||
PortP->TxBufferIn = 0;
|
||||
PortP->TxBufferOut = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Put a command onto a port.
|
||||
** The PortPointer, command, length and arg are passed.
|
||||
** The len is the length *inclusive* of the command byte,
|
||||
** and so for a command that takes no data, len==1.
|
||||
** The arg is a single byte, and is only used if len==2.
|
||||
** Other values of len aren't allowed, and will cause
|
||||
** a panic.
|
||||
*/
|
||||
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
|
||||
{
|
||||
struct PKT __iomem *PacketP;
|
||||
int retries = 20; /* at 10 per second -> 2 seconds */
|
||||
unsigned long flags;
|
||||
|
||||
rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
|
||||
|
||||
if (PortP->State & RIO_DELETED) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
|
||||
return RIO_FAIL;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
|
||||
/*
|
||||
** If the port is in use for pre-emptive command, then wait for it to
|
||||
** be free again.
|
||||
*/
|
||||
while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries);
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (retries-- <= 0) {
|
||||
return RIO_FAIL;
|
||||
}
|
||||
if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
return RIO_FAIL;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
}
|
||||
if (PortP->State & RIO_DELETED) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries);
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
if (retries-- <= 0) {
|
||||
rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n");
|
||||
return RIO_FAIL;
|
||||
}
|
||||
if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
|
||||
return RIO_FAIL;
|
||||
}
|
||||
rio_spin_lock_irqsave(&PortP->portSem, flags);
|
||||
}
|
||||
|
||||
if (p->RIOHalted) {
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return RIO_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
** set the command byte and the argument byte
|
||||
*/
|
||||
writeb(command, &PacketP->data[0]);
|
||||
|
||||
if (len == 2)
|
||||
writeb(arg, &PacketP->data[1]);
|
||||
|
||||
/*
|
||||
** set the length of the packet and set the command bit.
|
||||
*/
|
||||
writeb(PKT_CMD_BIT | len, &PacketP->len);
|
||||
|
||||
add_transmit(PortP);
|
||||
/*
|
||||
** Count characters transmitted for port statistics reporting
|
||||
*/
|
||||
if (PortP->statsGather)
|
||||
PortP->txchars += len;
|
||||
|
||||
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
|
||||
return p->RIOHalted ? RIO_FAIL : ~RIO_FAIL;
|
||||
}
|
||||
|
||||
|
||||
107
drivers/char/rio/route.h
Normal file
107
drivers/char/rio/route.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* R O U T E H E A D E R
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra / Jeremy Rolls
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _route_h
|
||||
#define _route_h
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
#ifndef lint
|
||||
/* static char *_rio_route_h_sccs = "@(#)route.h 1.3"; */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MAX_LINKS 4
|
||||
#define MAX_NODES 17 /* Maximum nodes in a subnet */
|
||||
#define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for
|
||||
1 bit per node */
|
||||
#define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete
|
||||
info about cost etc. */
|
||||
#define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE)
|
||||
/* Number of nodes we can squeeze
|
||||
into one packet */
|
||||
#define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1)
|
||||
/************************************************
|
||||
* Define the types of command for the ROUTE RUP.
|
||||
************************************************/
|
||||
#define ROUTE_REQUEST 0 /* Request an ID */
|
||||
#define ROUTE_FOAD 1 /* Kill the RTA */
|
||||
#define ROUTE_ALREADY 2 /* ID given already */
|
||||
#define ROUTE_USED 3 /* All ID's used */
|
||||
#define ROUTE_ALLOCATE 4 /* Here it is */
|
||||
#define ROUTE_REQ_TOP 5 /* I bet you didn't expect....
|
||||
the Topological Inquisition */
|
||||
#define ROUTE_TOPOLOGY 6 /* Topology request answered FD */
|
||||
/*******************************************************************
|
||||
* Define the Route Map Structure
|
||||
*
|
||||
* The route map gives a pointer to a Link Structure to use.
|
||||
* This allows Disconnected Links to be checked quickly
|
||||
******************************************************************/
|
||||
typedef struct COST_ROUTE COST_ROUTE;
|
||||
struct COST_ROUTE {
|
||||
unsigned char cost; /* Cost down this link */
|
||||
unsigned char route[NODE_BYTES]; /* Nodes thorough this route */
|
||||
};
|
||||
|
||||
typedef struct ROUTE_STR ROUTE_STR;
|
||||
struct ROUTE_STR {
|
||||
COST_ROUTE cost_route[MAX_LINKS];
|
||||
/* cost / route for this link */
|
||||
ushort favoured; /* favoured link */
|
||||
};
|
||||
|
||||
|
||||
#define NO_LINK (short) 5 /* Link unattached */
|
||||
#define ROUTE_NO_ID (short) 100 /* No Id */
|
||||
#define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */
|
||||
#define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */
|
||||
|
||||
|
||||
#define SYNC_RUP (ushort) 255
|
||||
#define COMMAND_RUP (ushort) 254
|
||||
#define ERROR_RUP (ushort) 253
|
||||
#define POLL_RUP (ushort) 252
|
||||
#define BOOT_RUP (ushort) 251
|
||||
#define ROUTE_RUP (ushort) 250
|
||||
#define STATUS_RUP (ushort) 249
|
||||
#define POWER_RUP (ushort) 248
|
||||
|
||||
#define HIGHEST_RUP (ushort) 255 /* Set to Top one */
|
||||
#define LOWEST_RUP (ushort) 248 /* Set to bottom one */
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
69
drivers/char/rio/rup.h
Normal file
69
drivers/char/rio/rup.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
******* *******
|
||||
******* R U P S T R U C T U R E
|
||||
******* *******
|
||||
****************************************************************************
|
||||
|
||||
Author : Ian Nandhra
|
||||
Date :
|
||||
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Version : 0.01
|
||||
|
||||
|
||||
Mods
|
||||
----------------------------------------------------------------------------
|
||||
Date By Description
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _rup_h
|
||||
#define _rup_h 1
|
||||
|
||||
#define MAX_RUP ((short) 16)
|
||||
#define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */
|
||||
|
||||
/*************************************************
|
||||
* Define all the packet request stuff
|
||||
************************************************/
|
||||
#define TX_RUP_INACTIVE 0 /* Nothing to transmit */
|
||||
#define TX_PACKET_READY 1 /* Transmit packet ready */
|
||||
#define TX_LOCK_RUP 2 /* Transmit side locked */
|
||||
|
||||
#define RX_RUP_INACTIVE 0 /* Nothing received */
|
||||
#define RX_PACKET_READY 1 /* Packet received */
|
||||
|
||||
#define RUP_NO_OWNER 0xff /* RUP not owned by any process */
|
||||
|
||||
struct RUP {
|
||||
u16 txpkt; /* Outgoing packet */
|
||||
u16 rxpkt; /* Incoming packet */
|
||||
u16 link; /* Which link to send down? */
|
||||
u8 rup_dest_unit[2]; /* Destination unit */
|
||||
u16 handshake; /* For handshaking */
|
||||
u16 timeout; /* Timeout */
|
||||
u16 status; /* Status */
|
||||
u16 txcontrol; /* Transmit control */
|
||||
u16 rxcontrol; /* Receive control */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*********** end of file ***********/
|
||||
55
drivers/char/rio/unixrup.h
Normal file
55
drivers/char/rio/unixrup.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
** -----------------------------------------------------------------------------
|
||||
**
|
||||
** Perle Specialix driver for Linux
|
||||
** Ported from existing RIO Driver for SCO sources.
|
||||
*
|
||||
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**
|
||||
** Module : unixrup.h
|
||||
** SID : 1.2
|
||||
** Last Modified : 11/6/98 11:34:20
|
||||
** Retrieved : 11/6/98 11:34:22
|
||||
**
|
||||
** ident @(#)unixrup.h 1.2
|
||||
**
|
||||
** -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __rio_unixrup_h__
|
||||
#define __rio_unixrup_h__
|
||||
|
||||
#ifdef SCCS_LABELS
|
||||
static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2";
|
||||
#endif
|
||||
|
||||
/*
|
||||
** UnixRup data structure. This contains pointers to actual RUPs on the
|
||||
** host card, and all the command/boot control stuff.
|
||||
*/
|
||||
struct UnixRup {
|
||||
struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */
|
||||
struct CmdBlk *CmdPendingP; /* The command currently being sent */
|
||||
struct RUP __iomem *RupP; /* the Rup to send it to */
|
||||
unsigned int Id; /* Id number */
|
||||
unsigned int BaseSysPort; /* SysPort of first tty on this RTA */
|
||||
unsigned int ModTypes; /* Modules on this RTA */
|
||||
spinlock_t RupLock; /* Lock structure for MPX */
|
||||
/* struct lockb RupLock; *//* Lock structure for MPX */
|
||||
};
|
||||
|
||||
#endif /* __rio_unixrup_h__ */
|
||||
Reference in New Issue
Block a user