diff options
Diffstat (limited to 'drivers/char/rio')
39 files changed, 0 insertions, 12707 deletions
diff --git a/drivers/char/rio/Makefile b/drivers/char/rio/Makefile deleted file mode 100644 index 1661875883fb..000000000000 --- a/drivers/char/rio/Makefile +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux rio-subsystem. | ||
3 | # | ||
4 | # (C) R.E.Wolff@BitWizard.nl | ||
5 | # | ||
6 | # This file is GPL. See other files for the full Blurb. I'm lazy today. | ||
7 | # | ||
8 | |||
9 | obj-$(CONFIG_RIO) += rio.o | ||
10 | |||
11 | rio-y := rio_linux.o rioinit.o rioboot.o riocmd.o rioctrl.o riointr.o \ | ||
12 | rioparam.o rioroute.o riotable.o riotty.o | ||
diff --git a/drivers/char/rio/board.h b/drivers/char/rio/board.h deleted file mode 100644 index bdea633a9076..000000000000 --- a/drivers/char/rio/board.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : board.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:07 | ||
26 | ** Retrieved : 11/6/98 11:34:20 | ||
27 | ** | ||
28 | ** ident @(#)board.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_board_h__ | ||
34 | #define __rio_board_h__ | ||
35 | |||
36 | /* | ||
37 | ** board.h contains the definitions for the *hardware* of the host cards. | ||
38 | ** It describes the memory overlay for the dual port RAM area. | ||
39 | */ | ||
40 | |||
41 | #define DP_SRAM1_SIZE 0x7C00 | ||
42 | #define DP_SRAM2_SIZE 0x0200 | ||
43 | #define DP_SRAM3_SIZE 0x7000 | ||
44 | #define DP_SCRATCH_SIZE 0x1000 | ||
45 | #define DP_PARMMAP_ADDR 0x01FE /* offset into SRAM2 */ | ||
46 | #define DP_STARTUP_ADDR 0x01F8 /* offset into SRAM2 */ | ||
47 | |||
48 | /* | ||
49 | ** The shape of the Host Control area, at offset 0x7C00, Write Only | ||
50 | */ | ||
51 | struct s_Ctrl { | ||
52 | u8 DpCtl; /* 7C00 */ | ||
53 | u8 Dp_Unused2_[127]; | ||
54 | u8 DpIntSet; /* 7C80 */ | ||
55 | u8 Dp_Unused3_[127]; | ||
56 | u8 DpTpuReset; /* 7D00 */ | ||
57 | u8 Dp_Unused4_[127]; | ||
58 | u8 DpIntReset; /* 7D80 */ | ||
59 | u8 Dp_Unused5_[127]; | ||
60 | }; | ||
61 | |||
62 | /* | ||
63 | ** The PROM data area on the host (0x7C00), Read Only | ||
64 | */ | ||
65 | struct s_Prom { | ||
66 | u16 DpSlxCode[2]; | ||
67 | u16 DpRev; | ||
68 | u16 Dp_Unused6_; | ||
69 | u16 DpUniq[4]; | ||
70 | u16 DpJahre; | ||
71 | u16 DpWoche; | ||
72 | u16 DpHwFeature[5]; | ||
73 | u16 DpOemId; | ||
74 | u16 DpSiggy[16]; | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | ** Union of the Ctrl and Prom areas | ||
79 | */ | ||
80 | union u_CtrlProm { /* This is the control/PROM area (0x7C00) */ | ||
81 | struct s_Ctrl DpCtrl; | ||
82 | struct s_Prom DpProm; | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | ** The top end of memory! | ||
87 | */ | ||
88 | struct s_ParmMapS { /* Area containing Parm Map Pointer */ | ||
89 | u8 Dp_Unused8_[DP_PARMMAP_ADDR]; | ||
90 | u16 DpParmMapAd; | ||
91 | }; | ||
92 | |||
93 | struct s_StartUpS { | ||
94 | u8 Dp_Unused9_[DP_STARTUP_ADDR]; | ||
95 | u8 Dp_LongJump[0x4]; | ||
96 | u8 Dp_Unused10_[2]; | ||
97 | u8 Dp_ShortJump[0x2]; | ||
98 | }; | ||
99 | |||
100 | union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */ | ||
101 | u8 DpSramMem[DP_SRAM2_SIZE]; | ||
102 | struct s_ParmMapS DpParmMapS; | ||
103 | struct s_StartUpS DpStartUpS; | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | ** This is the DP RAM overlay. | ||
108 | */ | ||
109 | struct DpRam { | ||
110 | u8 DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ | ||
111 | union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ | ||
112 | union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ | ||
113 | u8 DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ | ||
114 | u8 DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ | ||
115 | }; | ||
116 | |||
117 | #define DpControl DpCtrlProm.DpCtrl.DpCtl | ||
118 | #define DpSetInt DpCtrlProm.DpCtrl.DpIntSet | ||
119 | #define DpResetTpu DpCtrlProm.DpCtrl.DpTpuReset | ||
120 | #define DpResetInt DpCtrlProm.DpCtrl.DpIntReset | ||
121 | |||
122 | #define DpSlx DpCtrlProm.DpProm.DpSlxCode | ||
123 | #define DpRevision DpCtrlProm.DpProm.DpRev | ||
124 | #define DpUnique DpCtrlProm.DpProm.DpUniq | ||
125 | #define DpYear DpCtrlProm.DpProm.DpJahre | ||
126 | #define DpWeek DpCtrlProm.DpProm.DpWoche | ||
127 | #define DpSignature DpCtrlProm.DpProm.DpSiggy | ||
128 | |||
129 | #define DpParmMapR DpSram2ParmMap.DpParmMapS.DpParmMapAd | ||
130 | #define DpSram2 DpSram2ParmMap.DpSramMem | ||
131 | |||
132 | #endif | ||
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h deleted file mode 100644 index 5ab51679caa2..000000000000 --- a/drivers/char/rio/cirrus.h +++ /dev/null | |||
@@ -1,210 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* CIRRUS.H ******* | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Jeremy Rolls | ||
8 | Date : 3 Aug 1990 | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _cirrus_h | ||
38 | #define _cirrus_h 1 | ||
39 | |||
40 | /* Bit fields for particular registers shared with driver */ | ||
41 | |||
42 | /* COR1 - driver and RTA */ | ||
43 | #define RIOC_COR1_ODD 0x80 /* Odd parity */ | ||
44 | #define RIOC_COR1_EVEN 0x00 /* Even parity */ | ||
45 | #define RIOC_COR1_NOP 0x00 /* No parity */ | ||
46 | #define RIOC_COR1_FORCE 0x20 /* Force parity */ | ||
47 | #define RIOC_COR1_NORMAL 0x40 /* With parity */ | ||
48 | #define RIOC_COR1_1STOP 0x00 /* 1 stop bit */ | ||
49 | #define RIOC_COR1_15STOP 0x04 /* 1.5 stop bits */ | ||
50 | #define RIOC_COR1_2STOP 0x08 /* 2 stop bits */ | ||
51 | #define RIOC_COR1_5BITS 0x00 /* 5 data bits */ | ||
52 | #define RIOC_COR1_6BITS 0x01 /* 6 data bits */ | ||
53 | #define RIOC_COR1_7BITS 0x02 /* 7 data bits */ | ||
54 | #define RIOC_COR1_8BITS 0x03 /* 8 data bits */ | ||
55 | |||
56 | #define RIOC_COR1_HOST 0xef /* Safe host bits */ | ||
57 | |||
58 | /* RTA only */ | ||
59 | #define RIOC_COR1_CINPCK 0x00 /* Check parity of received characters */ | ||
60 | #define RIOC_COR1_CNINPCK 0x10 /* Don't check parity */ | ||
61 | |||
62 | /* COR2 bits for both RTA and driver use */ | ||
63 | #define RIOC_COR2_IXANY 0x80 /* IXANY - any character is XON */ | ||
64 | #define RIOC_COR2_IXON 0x40 /* IXON - enable tx soft flowcontrol */ | ||
65 | #define RIOC_COR2_RTSFLOW 0x02 /* Enable tx hardware flow control */ | ||
66 | |||
67 | /* Additional driver bits */ | ||
68 | #define RIOC_COR2_HUPCL 0x20 /* Hang up on close */ | ||
69 | #define RIOC_COR2_CTSFLOW 0x04 /* Enable rx hardware flow control */ | ||
70 | #define RIOC_COR2_IXOFF 0x01 /* Enable rx software flow control */ | ||
71 | #define RIOC_COR2_DTRFLOW 0x08 /* Enable tx hardware flow control */ | ||
72 | |||
73 | /* RTA use only */ | ||
74 | #define RIOC_COR2_ETC 0x20 /* Embedded transmit options */ | ||
75 | #define RIOC_COR2_LOCAL 0x10 /* Local loopback mode */ | ||
76 | #define RIOC_COR2_REMOTE 0x08 /* Remote loopback mode */ | ||
77 | #define RIOC_COR2_HOST 0xc2 /* Safe host bits */ | ||
78 | |||
79 | /* COR3 - RTA use only */ | ||
80 | #define RIOC_COR3_SCDRNG 0x80 /* Enable special char detect for range */ | ||
81 | #define RIOC_COR3_SCD34 0x40 /* Special character detect for SCHR's 3 + 4 */ | ||
82 | #define RIOC_COR3_FCT 0x20 /* Flow control transparency */ | ||
83 | #define RIOC_COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */ | ||
84 | #define RIOC_COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */ | ||
85 | #define RIOC_COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */ | ||
86 | #define RIOC_COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */ | ||
87 | #define RIOC_COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */ | ||
88 | |||
89 | #define RIOC_COR3_THRESHOLD RIOC_COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */ | ||
90 | |||
91 | #define RIOC_COR3_DEFAULT (RIOC_COR3_FCT | RIOC_COR3_THRESHOLD) | ||
92 | /* Default bits for COR3 */ | ||
93 | |||
94 | /* COR4 driver and RTA use */ | ||
95 | #define RIOC_COR4_IGNCR 0x80 /* Throw away CR's on input */ | ||
96 | #define RIOC_COR4_ICRNL 0x40 /* Map CR -> NL on input */ | ||
97 | #define RIOC_COR4_INLCR 0x20 /* Map NL -> CR on input */ | ||
98 | #define RIOC_COR4_IGNBRK 0x10 /* Ignore Break */ | ||
99 | #define RIOC_COR4_NBRKINT 0x08 /* No interrupt on break (-BRKINT) */ | ||
100 | #define RIOC_COR4_RAISEMOD 0x01 /* Raise modem output lines on non-zero baud */ | ||
101 | |||
102 | |||
103 | /* COR4 driver only */ | ||
104 | #define RIOC_COR4_IGNPAR 0x04 /* IGNPAR (ignore characters with errors) */ | ||
105 | #define RIOC_COR4_PARMRK 0x02 /* PARMRK */ | ||
106 | |||
107 | #define RIOC_COR4_HOST 0xf8 /* Safe host bits */ | ||
108 | |||
109 | /* COR4 RTA only */ | ||
110 | #define RIOC_COR4_CIGNPAR 0x02 /* Thrown away bad characters */ | ||
111 | #define RIOC_COR4_CPARMRK 0x04 /* PARMRK characters */ | ||
112 | #define RIOC_COR4_CNPARMRK 0x03 /* Don't PARMRK */ | ||
113 | |||
114 | /* COR5 driver and RTA use */ | ||
115 | #define RIOC_COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ | ||
116 | #define RIOC_COR5_LNE 0x40 /* Enable LNEXT processing */ | ||
117 | #define RIOC_COR5_CMOE 0x20 /* Match good and errored characters */ | ||
118 | #define RIOC_COR5_ONLCR 0x02 /* NL -> CR NL on output */ | ||
119 | #define RIOC_COR5_OCRNL 0x01 /* CR -> NL on output */ | ||
120 | |||
121 | /* | ||
122 | ** Spare bits - these are not used in the CIRRUS registers, so we use | ||
123 | ** them to set various other features. | ||
124 | */ | ||
125 | /* | ||
126 | ** tstop and tbusy indication | ||
127 | */ | ||
128 | #define RIOC_COR5_TSTATE_ON 0x08 /* Turn on monitoring of tbusy and tstop */ | ||
129 | #define RIOC_COR5_TSTATE_OFF 0x04 /* Turn off monitoring of tbusy and tstop */ | ||
130 | /* | ||
131 | ** TAB3 | ||
132 | */ | ||
133 | #define RIOC_COR5_TAB3 0x10 /* TAB3 mode */ | ||
134 | |||
135 | #define RIOC_COR5_HOST 0xc3 /* Safe host bits */ | ||
136 | |||
137 | /* CCSR */ | ||
138 | #define RIOC_CCSR_TXFLOFF 0x04 /* Tx is xoffed */ | ||
139 | |||
140 | /* MSVR1 */ | ||
141 | /* NB. DTR / CD swapped from Cirrus spec as the pins are also reversed on the | ||
142 | RTA. This is because otherwise DCD would get lost on the 1 parallel / 3 | ||
143 | serial option. | ||
144 | */ | ||
145 | #define RIOC_MSVR1_CD 0x80 /* CD (DSR on Cirrus) */ | ||
146 | #define RIOC_MSVR1_RTS 0x40 /* RTS (CTS on Cirrus) */ | ||
147 | #define RIOC_MSVR1_RI 0x20 /* RI */ | ||
148 | #define RIOC_MSVR1_DTR 0x10 /* DTR (CD on Cirrus) */ | ||
149 | #define RIOC_MSVR1_CTS 0x01 /* CTS output pin (RTS on Cirrus) */ | ||
150 | /* Next two used to indicate state of tbusy and tstop to driver */ | ||
151 | #define RIOC_MSVR1_TSTOP 0x08 /* Set if port flow controlled */ | ||
152 | #define RIOC_MSVR1_TEMPTY 0x04 /* Set if port tx buffer empty */ | ||
153 | |||
154 | #define RIOC_MSVR1_HOST 0xf3 /* The bits the host wants */ | ||
155 | |||
156 | /* Defines for the subscripts of a CONFIG packet */ | ||
157 | #define RIOC_CONFIG_COR1 1 /* Option register 1 */ | ||
158 | #define RIOC_CONFIG_COR2 2 /* Option register 2 */ | ||
159 | #define RIOC_CONFIG_COR4 3 /* Option register 4 */ | ||
160 | #define RIOC_CONFIG_COR5 4 /* Option register 5 */ | ||
161 | #define RIOC_CONFIG_TXXON 5 /* Tx XON character */ | ||
162 | #define RIOC_CONFIG_TXXOFF 6 /* Tx XOFF character */ | ||
163 | #define RIOC_CONFIG_RXXON 7 /* Rx XON character */ | ||
164 | #define RIOC_CONFIG_RXXOFF 8 /* Rx XOFF character */ | ||
165 | #define RIOC_CONFIG_LNEXT 9 /* LNEXT character */ | ||
166 | #define RIOC_CONFIG_TXBAUD 10 /* Tx baud rate */ | ||
167 | #define RIOC_CONFIG_RXBAUD 11 /* Rx baud rate */ | ||
168 | |||
169 | #define RIOC_PRE_EMPTIVE 0x80 /* Pre-emptive bit in command field */ | ||
170 | |||
171 | /* Packet types going from Host to remote - with the exception of OPEN, MOPEN, | ||
172 | CONFIG, SBREAK and MEMDUMP the remaining bytes of the data array will not | ||
173 | be used | ||
174 | */ | ||
175 | #define RIOC_OPEN 0x00 /* Open a port */ | ||
176 | #define RIOC_CONFIG 0x01 /* Configure a port */ | ||
177 | #define RIOC_MOPEN 0x02 /* Modem open (block for DCD) */ | ||
178 | #define RIOC_CLOSE 0x03 /* Close a port */ | ||
179 | #define RIOC_WFLUSH (0x04 | RIOC_PRE_EMPTIVE) /* Write flush */ | ||
180 | #define RIOC_RFLUSH (0x05 | RIOC_PRE_EMPTIVE) /* Read flush */ | ||
181 | #define RIOC_RESUME (0x06 | RIOC_PRE_EMPTIVE) /* Resume if xoffed */ | ||
182 | #define RIOC_SBREAK 0x07 /* Start break */ | ||
183 | #define RIOC_EBREAK 0x08 /* End break */ | ||
184 | #define RIOC_SUSPEND (0x09 | RIOC_PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */ | ||
185 | #define RIOC_FCLOSE (0x0a | RIOC_PRE_EMPTIVE) /* Force close */ | ||
186 | #define RIOC_XPRINT 0x0b /* Xprint packet */ | ||
187 | #define RIOC_MBIS (0x0c | RIOC_PRE_EMPTIVE) /* Set modem lines */ | ||
188 | #define RIOC_MBIC (0x0d | RIOC_PRE_EMPTIVE) /* Clear modem lines */ | ||
189 | #define RIOC_MSET (0x0e | RIOC_PRE_EMPTIVE) /* Set modem lines */ | ||
190 | #define RIOC_PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */ | ||
191 | #define RIOC_MGET (0x10 | RIOC_PRE_EMPTIVE) /* Force update of modem status */ | ||
192 | #define RIOC_MEMDUMP (0x11 | RIOC_PRE_EMPTIVE) /* Send back mem from addr supplied */ | ||
193 | #define RIOC_READ_REGISTER (0x12 | RIOC_PRE_EMPTIVE) /* Read CD1400 register (debug) */ | ||
194 | |||
195 | /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS | ||
196 | use data[4] / data[3] to indicate current state and modem status respectively | ||
197 | */ | ||
198 | |||
199 | #define RIOC_COMPLETE (0x20 | RIOC_PRE_EMPTIVE) | ||
200 | /* Command complete */ | ||
201 | #define RIOC_BREAK_RECEIVED (0x21 | RIOC_PRE_EMPTIVE) | ||
202 | /* Break received */ | ||
203 | #define RIOC_MODEM_STATUS (0x22 | RIOC_PRE_EMPTIVE) | ||
204 | /* Change in modem status */ | ||
205 | |||
206 | /* "Command" packet that could go either way - handshake wake-up */ | ||
207 | #define RIOC_HANDSHAKE (0x23 | RIOC_PRE_EMPTIVE) | ||
208 | /* Wake-up to HOST / RTA */ | ||
209 | |||
210 | #endif | ||
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h deleted file mode 100644 index 9ed4f861675a..000000000000 --- a/drivers/char/rio/cmdblk.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : cmdblk.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:09 | ||
26 | ** Retrieved : 11/6/98 11:34:20 | ||
27 | ** | ||
28 | ** ident @(#)cmdblk.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_cmdblk_h__ | ||
34 | #define __rio_cmdblk_h__ | ||
35 | |||
36 | /* | ||
37 | ** the structure of a command block, used to queue commands destined for | ||
38 | ** a rup. | ||
39 | */ | ||
40 | |||
41 | struct CmdBlk { | ||
42 | struct CmdBlk *NextP; /* Pointer to next command block */ | ||
43 | struct PKT Packet; /* A packet, to copy to the rup */ | ||
44 | /* The func to call to check if OK */ | ||
45 | int (*PreFuncP) (unsigned long, struct CmdBlk *); | ||
46 | int PreArg; /* The arg for the func */ | ||
47 | /* The func to call when completed */ | ||
48 | int (*PostFuncP) (unsigned long, struct CmdBlk *); | ||
49 | int PostArg; /* The arg for the func */ | ||
50 | }; | ||
51 | |||
52 | #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4)) | ||
53 | #endif | ||
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h deleted file mode 100644 index c1e7a2798070..000000000000 --- a/drivers/char/rio/cmdpkt.h +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : cmdpkt.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:09 | ||
26 | ** Retrieved : 11/6/98 11:34:20 | ||
27 | ** | ||
28 | ** ident @(#)cmdpkt.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | #ifndef __rio_cmdpkt_h__ | ||
33 | #define __rio_cmdpkt_h__ | ||
34 | |||
35 | /* | ||
36 | ** overlays for the data area of a packet. Used in both directions | ||
37 | ** (to build a packet to send, and to interpret a packet that arrives) | ||
38 | ** and is very inconvenient for MIPS, so they appear as two separate | ||
39 | ** structures - those used for modifying/reading packets on the card | ||
40 | ** and those for modifying/reading packets in real memory, which have an _M | ||
41 | ** suffix. | ||
42 | */ | ||
43 | |||
44 | #define RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2) | ||
45 | |||
46 | /* | ||
47 | ** The boot information packet looks like this: | ||
48 | ** This structure overlays a PktCmd->CmdData structure, and so starts | ||
49 | ** at Data[2] in the actual pkt! | ||
50 | */ | ||
51 | struct BootSequence { | ||
52 | u16 NumPackets; | ||
53 | u16 LoadBase; | ||
54 | u16 CodeSize; | ||
55 | }; | ||
56 | |||
57 | #define BOOT_SEQUENCE_LEN 8 | ||
58 | |||
59 | struct SamTop { | ||
60 | u8 Unit; | ||
61 | u8 Link; | ||
62 | }; | ||
63 | |||
64 | struct CmdHdr { | ||
65 | u8 PcCommand; | ||
66 | union { | ||
67 | u8 PcPhbNum; | ||
68 | u8 PcLinkNum; | ||
69 | u8 PcIDNum; | ||
70 | } U0; | ||
71 | }; | ||
72 | |||
73 | |||
74 | struct PktCmd { | ||
75 | union { | ||
76 | struct { | ||
77 | struct CmdHdr CmdHdr; | ||
78 | struct BootSequence PcBootSequence; | ||
79 | } S1; | ||
80 | struct { | ||
81 | u16 PcSequence; | ||
82 | u8 PcBootData[RTA_BOOT_DATA_SIZE]; | ||
83 | } S2; | ||
84 | struct { | ||
85 | u16 __crud__; | ||
86 | u8 PcUniqNum[4]; /* this is really a uint. */ | ||
87 | u8 PcModuleTypes; /* what modules are fitted */ | ||
88 | } S3; | ||
89 | struct { | ||
90 | struct CmdHdr CmdHdr; | ||
91 | u8 __undefined__; | ||
92 | u8 PcModemStatus; | ||
93 | u8 PcPortStatus; | ||
94 | u8 PcSubCommand; /* commands like mem or register dump */ | ||
95 | u16 PcSubAddr; /* Address for command */ | ||
96 | u8 PcSubData[64]; /* Date area for command */ | ||
97 | } S4; | ||
98 | struct { | ||
99 | struct CmdHdr CmdHdr; | ||
100 | u8 PcCommandText[1]; | ||
101 | u8 __crud__[20]; | ||
102 | u8 PcIDNum2; /* It had to go somewhere! */ | ||
103 | } S5; | ||
104 | struct { | ||
105 | struct CmdHdr CmdHdr; | ||
106 | struct SamTop Topology[LINKS_PER_UNIT]; | ||
107 | } S6; | ||
108 | } U1; | ||
109 | }; | ||
110 | |||
111 | struct PktCmd_M { | ||
112 | union { | ||
113 | struct { | ||
114 | struct { | ||
115 | u8 PcCommand; | ||
116 | union { | ||
117 | u8 PcPhbNum; | ||
118 | u8 PcLinkNum; | ||
119 | u8 PcIDNum; | ||
120 | } U0; | ||
121 | } CmdHdr; | ||
122 | struct { | ||
123 | u16 NumPackets; | ||
124 | u16 LoadBase; | ||
125 | u16 CodeSize; | ||
126 | } PcBootSequence; | ||
127 | } S1; | ||
128 | struct { | ||
129 | u16 PcSequence; | ||
130 | u8 PcBootData[RTA_BOOT_DATA_SIZE]; | ||
131 | } S2; | ||
132 | struct { | ||
133 | u16 __crud__; | ||
134 | u8 PcUniqNum[4]; /* this is really a uint. */ | ||
135 | u8 PcModuleTypes; /* what modules are fitted */ | ||
136 | } S3; | ||
137 | struct { | ||
138 | u16 __cmd_hdr__; | ||
139 | u8 __undefined__; | ||
140 | u8 PcModemStatus; | ||
141 | u8 PcPortStatus; | ||
142 | u8 PcSubCommand; | ||
143 | u16 PcSubAddr; | ||
144 | u8 PcSubData[64]; | ||
145 | } S4; | ||
146 | struct { | ||
147 | u16 __cmd_hdr__; | ||
148 | u8 PcCommandText[1]; | ||
149 | u8 __crud__[20]; | ||
150 | u8 PcIDNum2; /* Tacked on end */ | ||
151 | } S5; | ||
152 | struct { | ||
153 | u16 __cmd_hdr__; | ||
154 | struct Top Topology[LINKS_PER_UNIT]; | ||
155 | } S6; | ||
156 | } U1; | ||
157 | }; | ||
158 | |||
159 | #define Command U1.S1.CmdHdr.PcCommand | ||
160 | #define PhbNum U1.S1.CmdHdr.U0.PcPhbNum | ||
161 | #define IDNum U1.S1.CmdHdr.U0.PcIDNum | ||
162 | #define IDNum2 U1.S5.PcIDNum2 | ||
163 | #define LinkNum U1.S1.CmdHdr.U0.PcLinkNum | ||
164 | #define Sequence U1.S2.PcSequence | ||
165 | #define BootData U1.S2.PcBootData | ||
166 | #define BootSequence U1.S1.PcBootSequence | ||
167 | #define UniqNum U1.S3.PcUniqNum | ||
168 | #define ModemStatus U1.S4.PcModemStatus | ||
169 | #define PortStatus U1.S4.PcPortStatus | ||
170 | #define SubCommand U1.S4.PcSubCommand | ||
171 | #define SubAddr U1.S4.PcSubAddr | ||
172 | #define SubData U1.S4.PcSubData | ||
173 | #define CommandText U1.S5.PcCommandText | ||
174 | #define RouteTopology U1.S6.Topology | ||
175 | #define ModuleTypes U1.S3.PcModuleTypes | ||
176 | |||
177 | #endif | ||
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h deleted file mode 100644 index 4af90323fd00..000000000000 --- a/drivers/char/rio/daemon.h +++ /dev/null | |||
@@ -1,307 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : daemon.h | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 11:34:09 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)daemon.h 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_daemon_h__ | ||
34 | #define __rio_daemon_h__ | ||
35 | |||
36 | |||
37 | /* | ||
38 | ** structures used on /dev/rio | ||
39 | */ | ||
40 | |||
41 | struct Error { | ||
42 | unsigned int Error; | ||
43 | unsigned int Entry; | ||
44 | unsigned int Other; | ||
45 | }; | ||
46 | |||
47 | struct DownLoad { | ||
48 | char __user *DataP; | ||
49 | unsigned int Count; | ||
50 | unsigned int ProductCode; | ||
51 | }; | ||
52 | |||
53 | /* | ||
54 | ** A few constants.... | ||
55 | */ | ||
56 | #ifndef MAX_VERSION_LEN | ||
57 | #define MAX_VERSION_LEN 256 | ||
58 | #endif | ||
59 | |||
60 | #ifndef MAX_XP_CTRL_LEN | ||
61 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ | ||
62 | #endif | ||
63 | |||
64 | struct PortSetup { | ||
65 | unsigned int From; /* Set/Clear XP & IXANY Control from this port.... */ | ||
66 | unsigned int To; /* .... to this port */ | ||
67 | unsigned int XpCps; /* at this speed */ | ||
68 | char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ | ||
69 | char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ | ||
70 | u8 IxAny; /* enable/disable IXANY */ | ||
71 | u8 IxOn; /* enable/disable IXON */ | ||
72 | u8 Lock; /* lock port params */ | ||
73 | u8 Store; /* store params across closes */ | ||
74 | u8 Drain; /* close only when drained */ | ||
75 | }; | ||
76 | |||
77 | struct LpbReq { | ||
78 | unsigned int Host; | ||
79 | unsigned int Link; | ||
80 | struct LPB __user *LpbP; | ||
81 | }; | ||
82 | |||
83 | struct RupReq { | ||
84 | unsigned int HostNum; | ||
85 | unsigned int RupNum; | ||
86 | struct RUP __user *RupP; | ||
87 | }; | ||
88 | |||
89 | struct PortReq { | ||
90 | unsigned int SysPort; | ||
91 | struct Port __user *PortP; | ||
92 | }; | ||
93 | |||
94 | struct StreamInfo { | ||
95 | unsigned int SysPort; | ||
96 | int RQueue; | ||
97 | int WQueue; | ||
98 | }; | ||
99 | |||
100 | struct HostReq { | ||
101 | unsigned int HostNum; | ||
102 | struct Host __user *HostP; | ||
103 | }; | ||
104 | |||
105 | struct HostDpRam { | ||
106 | unsigned int HostNum; | ||
107 | struct DpRam __user *DpRamP; | ||
108 | }; | ||
109 | |||
110 | struct DebugCtrl { | ||
111 | unsigned int SysPort; | ||
112 | unsigned int Debug; | ||
113 | unsigned int Wait; | ||
114 | }; | ||
115 | |||
116 | struct MapInfo { | ||
117 | unsigned int FirstPort; /* 8 ports, starting from this (tty) number */ | ||
118 | unsigned int RtaUnique; /* reside on this RTA (unique number) */ | ||
119 | }; | ||
120 | |||
121 | struct MapIn { | ||
122 | unsigned int NumEntries; /* How many port sets are we mapping? */ | ||
123 | struct MapInfo *MapInfoP; /* Pointer to (user space) info */ | ||
124 | }; | ||
125 | |||
126 | struct SendPack { | ||
127 | unsigned int PortNum; | ||
128 | unsigned char Len; | ||
129 | unsigned char Data[PKT_MAX_DATA_LEN]; | ||
130 | }; | ||
131 | |||
132 | struct SpecialRupCmd { | ||
133 | struct PKT Packet; | ||
134 | unsigned short Host; | ||
135 | unsigned short RupNum; | ||
136 | }; | ||
137 | |||
138 | struct IdentifyRta { | ||
139 | unsigned long RtaUnique; | ||
140 | u8 ID; | ||
141 | }; | ||
142 | |||
143 | struct KillNeighbour { | ||
144 | unsigned long UniqueNum; | ||
145 | u8 Link; | ||
146 | }; | ||
147 | |||
148 | struct rioVersion { | ||
149 | char version[MAX_VERSION_LEN]; | ||
150 | char relid[MAX_VERSION_LEN]; | ||
151 | int buildLevel; | ||
152 | char buildDate[MAX_VERSION_LEN]; | ||
153 | }; | ||
154 | |||
155 | |||
156 | /* | ||
157 | ** RIOC commands are for the daemon type operations | ||
158 | ** | ||
159 | ** 09.12.1998 ARG - ESIL 0776 part fix | ||
160 | ** Definition for 'RIOC' also appears in rioioctl.h, so we'd better do a | ||
161 | ** #ifndef here first. | ||
162 | ** rioioctl.h also now has #define 'RIO_QUICK_CHECK' as this ioctl is now | ||
163 | ** allowed to be used by customers. | ||
164 | */ | ||
165 | #ifndef RIOC | ||
166 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) | ||
167 | #endif | ||
168 | |||
169 | /* | ||
170 | ** Boot stuff | ||
171 | */ | ||
172 | #define RIO_GET_TABLE (RIOC | 100) | ||
173 | #define RIO_PUT_TABLE (RIOC | 101) | ||
174 | #define RIO_ASSIGN_RTA (RIOC | 102) | ||
175 | #define RIO_DELETE_RTA (RIOC | 103) | ||
176 | #define RIO_HOST_FOAD (RIOC | 104) | ||
177 | #define RIO_QUICK_CHECK (RIOC | 105) | ||
178 | #define RIO_SIGNALS_ON (RIOC | 106) | ||
179 | #define RIO_SIGNALS_OFF (RIOC | 107) | ||
180 | #define RIO_CHANGE_NAME (RIOC | 108) | ||
181 | #define RIO_DOWNLOAD (RIOC | 109) | ||
182 | #define RIO_GET_LOG (RIOC | 110) | ||
183 | #define RIO_SETUP_PORTS (RIOC | 111) | ||
184 | #define RIO_ALL_MODEM (RIOC | 112) | ||
185 | |||
186 | /* | ||
187 | ** card state, debug stuff | ||
188 | */ | ||
189 | #define RIO_NUM_HOSTS (RIOC | 120) | ||
190 | #define RIO_HOST_LPB (RIOC | 121) | ||
191 | #define RIO_HOST_RUP (RIOC | 122) | ||
192 | #define RIO_HOST_PORT (RIOC | 123) | ||
193 | #define RIO_PARMS (RIOC | 124) | ||
194 | #define RIO_HOST_REQ (RIOC | 125) | ||
195 | #define RIO_READ_CONFIG (RIOC | 126) | ||
196 | #define RIO_SET_CONFIG (RIOC | 127) | ||
197 | #define RIO_VERSID (RIOC | 128) | ||
198 | #define RIO_FLAGS (RIOC | 129) | ||
199 | #define RIO_SETDEBUG (RIOC | 130) | ||
200 | #define RIO_GETDEBUG (RIOC | 131) | ||
201 | #define RIO_READ_LEVELS (RIOC | 132) | ||
202 | #define RIO_SET_FAST_BUS (RIOC | 133) | ||
203 | #define RIO_SET_SLOW_BUS (RIOC | 134) | ||
204 | #define RIO_SET_BYTE_MODE (RIOC | 135) | ||
205 | #define RIO_SET_WORD_MODE (RIOC | 136) | ||
206 | #define RIO_STREAM_INFO (RIOC | 137) | ||
207 | #define RIO_START_POLLER (RIOC | 138) | ||
208 | #define RIO_STOP_POLLER (RIOC | 139) | ||
209 | #define RIO_LAST_ERROR (RIOC | 140) | ||
210 | #define RIO_TICK (RIOC | 141) | ||
211 | #define RIO_TOCK (RIOC | 241) /* I did this on purpose, you know. */ | ||
212 | #define RIO_SEND_PACKET (RIOC | 142) | ||
213 | #define RIO_SET_BUSY (RIOC | 143) | ||
214 | #define SPECIAL_RUP_CMD (RIOC | 144) | ||
215 | #define RIO_FOAD_RTA (RIOC | 145) | ||
216 | #define RIO_ZOMBIE_RTA (RIOC | 146) | ||
217 | #define RIO_IDENTIFY_RTA (RIOC | 147) | ||
218 | #define RIO_KILL_NEIGHBOUR (RIOC | 148) | ||
219 | #define RIO_DEBUG_MEM (RIOC | 149) | ||
220 | /* | ||
221 | ** 150 - 167 used..... See below | ||
222 | */ | ||
223 | #define RIO_GET_PORT_SETUP (RIOC | 168) | ||
224 | #define RIO_RESUME (RIOC | 169) | ||
225 | #define RIO_MESG (RIOC | 170) | ||
226 | #define RIO_NO_MESG (RIOC | 171) | ||
227 | #define RIO_WHAT_MESG (RIOC | 172) | ||
228 | #define RIO_HOST_DPRAM (RIOC | 173) | ||
229 | #define RIO_MAP_B50_TO_50 (RIOC | 174) | ||
230 | #define RIO_MAP_B50_TO_57600 (RIOC | 175) | ||
231 | #define RIO_MAP_B110_TO_110 (RIOC | 176) | ||
232 | #define RIO_MAP_B110_TO_115200 (RIOC | 177) | ||
233 | #define RIO_GET_PORT_PARAMS (RIOC | 178) | ||
234 | #define RIO_SET_PORT_PARAMS (RIOC | 179) | ||
235 | #define RIO_GET_PORT_TTY (RIOC | 180) | ||
236 | #define RIO_SET_PORT_TTY (RIOC | 181) | ||
237 | #define RIO_SYSLOG_ONLY (RIOC | 182) | ||
238 | #define RIO_SYSLOG_CONS (RIOC | 183) | ||
239 | #define RIO_CONS_ONLY (RIOC | 184) | ||
240 | #define RIO_BLOCK_OPENS (RIOC | 185) | ||
241 | |||
242 | /* | ||
243 | ** 02.03.1999 ARG - ESIL 0820 fix : | ||
244 | ** RIOBootMode is no longer use by the driver, so these ioctls | ||
245 | ** are now obsolete : | ||
246 | ** | ||
247 | #define RIO_GET_BOOT_MODE (RIOC | 186) | ||
248 | #define RIO_SET_BOOT_MODE (RIOC | 187) | ||
249 | ** | ||
250 | */ | ||
251 | |||
252 | #define RIO_MEM_DUMP (RIOC | 189) | ||
253 | #define RIO_READ_REGISTER (RIOC | 190) | ||
254 | #define RIO_GET_MODTYPE (RIOC | 191) | ||
255 | #define RIO_SET_TIMER (RIOC | 192) | ||
256 | #define RIO_READ_CHECK (RIOC | 196) | ||
257 | #define RIO_WAITING_FOR_RESTART (RIOC | 197) | ||
258 | #define RIO_BIND_RTA (RIOC | 198) | ||
259 | #define RIO_GET_BINDINGS (RIOC | 199) | ||
260 | #define RIO_PUT_BINDINGS (RIOC | 200) | ||
261 | |||
262 | #define RIO_MAKE_DEV (RIOC | 201) | ||
263 | #define RIO_MINOR (RIOC | 202) | ||
264 | |||
265 | #define RIO_IDENTIFY_DRIVER (RIOC | 203) | ||
266 | #define RIO_DISPLAY_HOST_CFG (RIOC | 204) | ||
267 | |||
268 | |||
269 | /* | ||
270 | ** MAKE_DEV / MINOR stuff | ||
271 | */ | ||
272 | #define RIO_DEV_DIRECT 0x0000 | ||
273 | #define RIO_DEV_MODEM 0x0200 | ||
274 | #define RIO_DEV_XPRINT 0x0400 | ||
275 | #define RIO_DEV_MASK 0x0600 | ||
276 | |||
277 | /* | ||
278 | ** port management, xprint stuff | ||
279 | */ | ||
280 | #define rIOCN(N) (RIOC|(N)) | ||
281 | #define rIOCR(N,T) (RIOC|(N)) | ||
282 | #define rIOCW(N,T) (RIOC|(N)) | ||
283 | |||
284 | #define RIO_GET_XP_ON rIOCR(150,char[16]) /* start xprint string */ | ||
285 | #define RIO_SET_XP_ON rIOCW(151,char[16]) | ||
286 | #define RIO_GET_XP_OFF rIOCR(152,char[16]) /* finish xprint string */ | ||
287 | #define RIO_SET_XP_OFF rIOCW(153,char[16]) | ||
288 | #define RIO_GET_XP_CPS rIOCR(154,int) /* xprint CPS */ | ||
289 | #define RIO_SET_XP_CPS rIOCW(155,int) | ||
290 | #define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */ | ||
291 | #define RIO_SET_IXANY rIOCW(157,int) | ||
292 | #define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */ | ||
293 | #define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */ | ||
294 | #define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */ | ||
295 | #define RIO_SET_MODEM rIOCW(161,int) | ||
296 | #define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */ | ||
297 | #define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */ | ||
298 | #define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */ | ||
299 | #define RIO_SET_IXON rIOCW(165,int) | ||
300 | #define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */ | ||
301 | #define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */ | ||
302 | |||
303 | #define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */ | ||
304 | |||
305 | #define RIO_IOCTL_UNKNOWN -2 | ||
306 | |||
307 | #endif | ||
diff --git a/drivers/char/rio/errors.h b/drivers/char/rio/errors.h deleted file mode 100644 index bdb05234090a..000000000000 --- a/drivers/char/rio/errors.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : errors.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:10 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)errors.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_errors_h__ | ||
34 | #define __rio_errors_h__ | ||
35 | |||
36 | /* | ||
37 | ** error codes | ||
38 | */ | ||
39 | |||
40 | #define NOTHING_WRONG_AT_ALL 0 | ||
41 | #define BAD_CHARACTER_IN_NAME 1 | ||
42 | #define TABLE_ENTRY_ISNT_PROPERLY_NULL 2 | ||
43 | #define UNKNOWN_HOST_NUMBER 3 | ||
44 | #define ZERO_RTA_ID 4 | ||
45 | #define BAD_RTA_ID 5 | ||
46 | #define DUPLICATED_RTA_ID 6 | ||
47 | #define DUPLICATE_UNIQUE_NUMBER 7 | ||
48 | #define BAD_TTY_NUMBER 8 | ||
49 | #define TTY_NUMBER_IN_USE 9 | ||
50 | #define NAME_USED_TWICE 10 | ||
51 | #define HOST_ID_NOT_ZERO 11 | ||
52 | #define BOOT_IN_PROGRESS 12 | ||
53 | #define COPYIN_FAILED 13 | ||
54 | #define HOST_FILE_TOO_LARGE 14 | ||
55 | #define COPYOUT_FAILED 15 | ||
56 | #define NOT_SUPER_USER 16 | ||
57 | #define RIO_ALREADY_POLLING 17 | ||
58 | |||
59 | #define ID_NUMBER_OUT_OF_RANGE 18 | ||
60 | #define PORT_NUMBER_OUT_OF_RANGE 19 | ||
61 | #define HOST_NUMBER_OUT_OF_RANGE 20 | ||
62 | #define RUP_NUMBER_OUT_OF_RANGE 21 | ||
63 | #define TTY_NUMBER_OUT_OF_RANGE 22 | ||
64 | #define LINK_NUMBER_OUT_OF_RANGE 23 | ||
65 | |||
66 | #define HOST_NOT_RUNNING 24 | ||
67 | #define IOCTL_COMMAND_UNKNOWN 25 | ||
68 | #define RIO_SYSTEM_HALTED 26 | ||
69 | #define WAIT_FOR_DRAIN_BROKEN 27 | ||
70 | #define PORT_NOT_MAPPED_INTO_SYSTEM 28 | ||
71 | #define EXCLUSIVE_USE_SET 29 | ||
72 | #define WAIT_FOR_NOT_CLOSING_BROKEN 30 | ||
73 | #define WAIT_FOR_PORT_TO_OPEN_BROKEN 31 | ||
74 | #define WAIT_FOR_CARRIER_BROKEN 32 | ||
75 | #define WAIT_FOR_NOT_IN_USE_BROKEN 33 | ||
76 | #define WAIT_FOR_CAN_ADD_COMMAND_BROKEN 34 | ||
77 | #define WAIT_FOR_ADD_COMMAND_BROKEN 35 | ||
78 | #define WAIT_FOR_NOT_PARAM_BROKEN 36 | ||
79 | #define WAIT_FOR_RETRY_BROKEN 37 | ||
80 | #define HOST_HAS_ALREADY_BEEN_BOOTED 38 | ||
81 | #define UNIT_IS_IN_USE 39 | ||
82 | #define COULDNT_FIND_ENTRY 40 | ||
83 | #define RTA_UNIQUE_NUMBER_ZERO 41 | ||
84 | #define CLOSE_COMMAND_FAILED 42 | ||
85 | #define WAIT_FOR_CLOSE_BROKEN 43 | ||
86 | #define CPS_VALUE_OUT_OF_RANGE 44 | ||
87 | #define ID_ALREADY_IN_USE 45 | ||
88 | #define SIGNALS_ALREADY_SET 46 | ||
89 | #define NOT_RECEIVING_PROCESS 47 | ||
90 | #define RTA_NUMBER_WRONG 48 | ||
91 | #define NO_SUCH_PRODUCT 49 | ||
92 | #define HOST_SYSPORT_BAD 50 | ||
93 | #define ID_NOT_TENTATIVE 51 | ||
94 | #define XPRINT_CPS_OUT_OF_RANGE 52 | ||
95 | #define NOT_ENOUGH_CORE_FOR_PCI_COPY 53 | ||
96 | |||
97 | |||
98 | #endif /* __rio_errors_h__ */ | ||
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h deleted file mode 100644 index 078d44f85e45..000000000000 --- a/drivers/char/rio/func.h +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : func.h | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 11:34:10 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)func.h 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __func_h_def | ||
34 | #define __func_h_def | ||
35 | |||
36 | #include <linux/kdev_t.h> | ||
37 | |||
38 | /* rioboot.c */ | ||
39 | int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); | ||
40 | int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); | ||
41 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); | ||
42 | void msec_timeout(struct Host *); | ||
43 | int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *); | ||
44 | int RIOBootOk(struct rio_info *, struct Host *, unsigned long); | ||
45 | int RIORtaBound(struct rio_info *, unsigned int); | ||
46 | void rio_fill_host_slot(int, int, unsigned int, struct Host *); | ||
47 | |||
48 | /* riocmd.c */ | ||
49 | int RIOFoadRta(struct Host *, struct Map *); | ||
50 | int RIOZombieRta(struct Host *, struct Map *); | ||
51 | int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *)); | ||
52 | int RIOIdentifyRta(struct rio_info *, void __user *); | ||
53 | int RIOKillNeighbour(struct rio_info *, void __user *); | ||
54 | int RIOSuspendBootRta(struct Host *, int, int); | ||
55 | int RIOFoadWakeup(struct rio_info *); | ||
56 | struct CmdBlk *RIOGetCmdBlk(void); | ||
57 | void RIOFreeCmdBlk(struct CmdBlk *); | ||
58 | int RIOQueueCmdBlk(struct Host *, unsigned int, struct CmdBlk *); | ||
59 | void RIOPollHostCommands(struct rio_info *, struct Host *); | ||
60 | int RIOWFlushMark(unsigned long, struct CmdBlk *); | ||
61 | int RIORFlushEnable(unsigned long, struct CmdBlk *); | ||
62 | int RIOUnUse(unsigned long, struct CmdBlk *); | ||
63 | |||
64 | /* rioctrl.c */ | ||
65 | int riocontrol(struct rio_info *, dev_t, int, unsigned long, int); | ||
66 | |||
67 | int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char); | ||
68 | |||
69 | /* rioinit.c */ | ||
70 | void rioinit(struct rio_info *, struct RioHostInfo *); | ||
71 | void RIOInitHosts(struct rio_info *, struct RioHostInfo *); | ||
72 | void RIOISAinit(struct rio_info *, int); | ||
73 | int RIODoAT(struct rio_info *, int, int); | ||
74 | caddr_t RIOCheckForATCard(int); | ||
75 | int RIOAssignAT(struct rio_info *, int, void __iomem *, int); | ||
76 | int RIOBoardTest(unsigned long, void __iomem *, unsigned char, int); | ||
77 | void RIOAllocDataStructs(struct rio_info *); | ||
78 | void RIOSetupDataStructs(struct rio_info *); | ||
79 | int RIODefaultName(struct rio_info *, struct Host *, unsigned int); | ||
80 | struct rioVersion *RIOVersid(void); | ||
81 | void RIOHostReset(unsigned int, struct DpRam __iomem *, unsigned int); | ||
82 | |||
83 | /* riointr.c */ | ||
84 | void RIOTxEnable(char *); | ||
85 | void RIOServiceHost(struct rio_info *, struct Host *); | ||
86 | int riotproc(struct rio_info *, struct ttystatics *, int, int); | ||
87 | |||
88 | /* rioparam.c */ | ||
89 | int RIOParam(struct Port *, int, int, int); | ||
90 | int RIODelay(struct Port *PortP, int); | ||
91 | int RIODelay_ni(struct Port *PortP, int); | ||
92 | void ms_timeout(struct Port *); | ||
93 | int can_add_transmit(struct PKT __iomem **, struct Port *); | ||
94 | void add_transmit(struct Port *); | ||
95 | void put_free_end(struct Host *, struct PKT __iomem *); | ||
96 | int can_remove_receive(struct PKT __iomem **, struct Port *); | ||
97 | void remove_receive(struct Port *); | ||
98 | |||
99 | /* rioroute.c */ | ||
100 | int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *); | ||
101 | void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int); | ||
102 | unsigned int GetUnitType(unsigned int); | ||
103 | int RIOSetChange(struct rio_info *); | ||
104 | int RIOFindFreeID(struct rio_info *, struct Host *, unsigned int *, unsigned int *); | ||
105 | |||
106 | |||
107 | /* riotty.c */ | ||
108 | |||
109 | int riotopen(struct tty_struct *tty, struct file *filp); | ||
110 | int riotclose(void *ptr); | ||
111 | int riotioctl(struct rio_info *, struct tty_struct *, int, caddr_t); | ||
112 | void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); | ||
113 | |||
114 | /* riotable.c */ | ||
115 | int RIONewTable(struct rio_info *); | ||
116 | int RIOApel(struct rio_info *); | ||
117 | int RIODeleteRta(struct rio_info *, struct Map *); | ||
118 | int RIOAssignRta(struct rio_info *, struct Map *); | ||
119 | int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); | ||
120 | int RIOChangeName(struct rio_info *, struct Map *); | ||
121 | |||
122 | #if 0 | ||
123 | /* riodrvr.c */ | ||
124 | struct rio_info *rio_install(struct RioHostInfo *); | ||
125 | int rio_uninstall(struct rio_info *); | ||
126 | int rio_open(struct rio_info *, int, struct file *); | ||
127 | int rio_close(struct rio_info *, struct file *); | ||
128 | int rio_read(struct rio_info *, struct file *, char *, int); | ||
129 | int rio_write(struct rio_info *, struct file *f, char *, int); | ||
130 | int rio_ioctl(struct rio_info *, struct file *, int, char *); | ||
131 | int rio_select(struct rio_info *, struct file *f, int, struct sel *); | ||
132 | int rio_intr(char *); | ||
133 | int rio_isr_thread(char *); | ||
134 | struct rio_info *rio_info_store(int cmd, struct rio_info *p); | ||
135 | #endif | ||
136 | |||
137 | extern void rio_copy_to_card(void *from, void __iomem *to, int len); | ||
138 | extern int rio_minor(struct tty_struct *tty); | ||
139 | extern int rio_ismodem(struct tty_struct *tty); | ||
140 | |||
141 | extern void rio_start_card_running(struct Host *HostP); | ||
142 | |||
143 | #endif /* __func_h_def */ | ||
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h deleted file mode 100644 index 78f24540c224..000000000000 --- a/drivers/char/rio/host.h +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : host.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:10 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)host.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_host_h__ | ||
34 | #define __rio_host_h__ | ||
35 | |||
36 | /* | ||
37 | ** the host structure - one per host card in the system. | ||
38 | */ | ||
39 | |||
40 | #define MAX_EXTRA_UNITS 64 | ||
41 | |||
42 | /* | ||
43 | ** Host data structure. This is used for the software equiv. of | ||
44 | ** the host. | ||
45 | */ | ||
46 | struct Host { | ||
47 | struct pci_dev *pdev; | ||
48 | unsigned char Type; /* RIO_EISA, RIO_MCA, ... */ | ||
49 | unsigned char Ivec; /* POLLED or ivec number */ | ||
50 | unsigned char Mode; /* Control stuff */ | ||
51 | unsigned char Slot; /* Slot */ | ||
52 | void __iomem *Caddr; /* KV address of DPRAM */ | ||
53 | struct DpRam __iomem *CardP; /* KV address of DPRAM, with overlay */ | ||
54 | unsigned long PaddrP; /* Phys. address of DPRAM */ | ||
55 | char Name[MAX_NAME_LEN]; /* The name of the host */ | ||
56 | unsigned int UniqueNum; /* host unique number */ | ||
57 | spinlock_t HostLock; /* Lock structure for MPX */ | ||
58 | unsigned int WorkToBeDone; /* set to true each interrupt */ | ||
59 | unsigned int InIntr; /* Being serviced? */ | ||
60 | unsigned int IntSrvDone; /* host's interrupt has been serviced */ | ||
61 | void (*Copy) (void *, void __iomem *, int); /* copy func */ | ||
62 | struct timer_list timer; | ||
63 | /* | ||
64 | ** I M P O R T A N T ! | ||
65 | ** | ||
66 | ** The rest of this data structure is cleared to zero after | ||
67 | ** a RIO_HOST_FOAD command. | ||
68 | */ | ||
69 | |||
70 | unsigned long Flags; /* Whats going down */ | ||
71 | #define RC_WAITING 0 | ||
72 | #define RC_STARTUP 1 | ||
73 | #define RC_RUNNING 2 | ||
74 | #define RC_STUFFED 3 | ||
75 | #define RC_READY 7 | ||
76 | #define RUN_STATE 7 | ||
77 | /* | ||
78 | ** Boot mode applies to the way in which hosts in this system will | ||
79 | ** boot RTAs | ||
80 | */ | ||
81 | #define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */ | ||
82 | #define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ | ||
83 | #define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ | ||
84 | |||
85 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ | ||
86 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ | ||
87 | struct PHB __iomem *PhbP; /* Pointer to the PHB array */ | ||
88 | unsigned short __iomem *PhbNumP; /* Ptr to Number of PHB's */ | ||
89 | struct LPB __iomem *LinkStrP; /* Link Structure Array */ | ||
90 | struct RUP __iomem *RupP; /* Sixteen real rups here */ | ||
91 | struct PARM_MAP __iomem *ParmMapP; /* points to the parmmap */ | ||
92 | unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ | ||
93 | unsigned int NumExtraBooted; /* how many of the above */ | ||
94 | /* | ||
95 | ** Twenty logical rups. | ||
96 | ** The first sixteen are the real Rup entries (above), the last four | ||
97 | ** are the link RUPs. | ||
98 | */ | ||
99 | struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT]; | ||
100 | int timeout_id; /* For calling 100 ms delays */ | ||
101 | int timeout_sem; /* For calling 100 ms delays */ | ||
102 | unsigned long locks; /* long req'd for set_bit --RR */ | ||
103 | char ____end_marker____; | ||
104 | }; | ||
105 | #define Control CardP->DpControl | ||
106 | #define SetInt CardP->DpSetInt | ||
107 | #define ResetTpu CardP->DpResetTpu | ||
108 | #define ResetInt CardP->DpResetInt | ||
109 | #define Signature CardP->DpSignature | ||
110 | #define Sram1 CardP->DpSram1 | ||
111 | #define Sram2 CardP->DpSram2 | ||
112 | #define Sram3 CardP->DpSram3 | ||
113 | #define Scratch CardP->DpScratch | ||
114 | #define __ParmMapR CardP->DpParmMapR | ||
115 | #define SLX CardP->DpSlx | ||
116 | #define Revision CardP->DpRevision | ||
117 | #define Unique CardP->DpUnique | ||
118 | #define Year CardP->DpYear | ||
119 | #define Week CardP->DpWeek | ||
120 | |||
121 | #define RIO_DUMBPARM 0x0860 /* what not to expect */ | ||
122 | |||
123 | #endif | ||
diff --git a/drivers/char/rio/link.h b/drivers/char/rio/link.h deleted file mode 100644 index f3bf11a04d41..000000000000 --- a/drivers/char/rio/link.h +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* L I N K | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra / Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _link_h | ||
38 | #define _link_h 1 | ||
39 | |||
40 | /************************************************* | ||
41 | * Define the Link Status stuff | ||
42 | ************************************************/ | ||
43 | /* Boot request stuff */ | ||
44 | #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ | ||
45 | #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ | ||
46 | #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets | ||
47 | and load address */ | ||
48 | #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ | ||
49 | |||
50 | |||
51 | struct LPB { | ||
52 | u16 link_number; /* Link Number */ | ||
53 | u16 in_ch; /* Link In Channel */ | ||
54 | u16 out_ch; /* Link Out Channel */ | ||
55 | u8 attached_serial[4]; /* Attached serial number */ | ||
56 | u8 attached_host_serial[4]; | ||
57 | /* Serial number of Host who | ||
58 | booted the other end */ | ||
59 | u16 descheduled; /* Currently Descheduled */ | ||
60 | u16 state; /* Current state */ | ||
61 | u16 send_poll; /* Send a Poll Packet */ | ||
62 | u16 ltt_p; /* Process Descriptor */ | ||
63 | u16 lrt_p; /* Process Descriptor */ | ||
64 | u16 lrt_status; /* Current lrt status */ | ||
65 | u16 ltt_status; /* Current ltt status */ | ||
66 | u16 timeout; /* Timeout value */ | ||
67 | u16 topology; /* Topology bits */ | ||
68 | u16 mon_ltt; | ||
69 | u16 mon_lrt; | ||
70 | u16 WaitNoBoot; /* Secs to hold off booting */ | ||
71 | u16 add_packet_list; /* Add packets to here */ | ||
72 | u16 remove_packet_list; /* Send packets from here */ | ||
73 | |||
74 | u16 lrt_fail_chan; /* Lrt's failure channel */ | ||
75 | u16 ltt_fail_chan; /* Ltt's failure channel */ | ||
76 | |||
77 | /* RUP structure for HOST to driver communications */ | ||
78 | struct RUP rup; | ||
79 | struct RUP link_rup; /* RUP for the link (POLL, | ||
80 | topology etc.) */ | ||
81 | u16 attached_link; /* Number of attached link */ | ||
82 | u16 csum_errors; /* csum errors */ | ||
83 | u16 num_disconnects; /* number of disconnects */ | ||
84 | u16 num_sync_rcvd; /* # sync's received */ | ||
85 | u16 num_sync_rqst; /* # sync requests */ | ||
86 | u16 num_tx; /* Num pkts sent */ | ||
87 | u16 num_rx; /* Num pkts received */ | ||
88 | u16 module_attached; /* Module tpyes of attached */ | ||
89 | u16 led_timeout; /* LED timeout */ | ||
90 | u16 first_port; /* First port to service */ | ||
91 | u16 last_port; /* Last port to service */ | ||
92 | }; | ||
93 | |||
94 | #endif | ||
95 | |||
96 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/linux_compat.h b/drivers/char/rio/linux_compat.h deleted file mode 100644 index 34c0d2899ef1..000000000000 --- a/drivers/char/rio/linux_compat.h +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * (C) 2000 R.E.Wolff@BitWizard.nl | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #include <linux/interrupt.h> | ||
20 | |||
21 | |||
22 | #define DEBUG_ALL | ||
23 | |||
24 | struct ttystatics { | ||
25 | struct termios tm; | ||
26 | }; | ||
27 | |||
28 | extern int rio_debug; | ||
29 | |||
30 | #define RIO_DEBUG_INIT 0x000001 | ||
31 | #define RIO_DEBUG_BOOT 0x000002 | ||
32 | #define RIO_DEBUG_CMD 0x000004 | ||
33 | #define RIO_DEBUG_CTRL 0x000008 | ||
34 | #define RIO_DEBUG_INTR 0x000010 | ||
35 | #define RIO_DEBUG_PARAM 0x000020 | ||
36 | #define RIO_DEBUG_ROUTE 0x000040 | ||
37 | #define RIO_DEBUG_TABLE 0x000080 | ||
38 | #define RIO_DEBUG_TTY 0x000100 | ||
39 | #define RIO_DEBUG_FLOW 0x000200 | ||
40 | #define RIO_DEBUG_MODEMSIGNALS 0x000400 | ||
41 | #define RIO_DEBUG_PROBE 0x000800 | ||
42 | #define RIO_DEBUG_CLEANUP 0x001000 | ||
43 | #define RIO_DEBUG_IFLOW 0x002000 | ||
44 | #define RIO_DEBUG_PFE 0x004000 | ||
45 | #define RIO_DEBUG_REC 0x008000 | ||
46 | #define RIO_DEBUG_SPINLOCK 0x010000 | ||
47 | #define RIO_DEBUG_DELAY 0x020000 | ||
48 | #define RIO_DEBUG_MOD_COUNT 0x040000 | ||
49 | |||
50 | |||
51 | /* Copied over from riowinif.h . This is ugly. The winif file declares | ||
52 | also much other stuff which is incompatible with the headers from | ||
53 | the older driver. The older driver includes "brates.h" which shadows | ||
54 | the definitions from Linux, and is incompatible... */ | ||
55 | |||
56 | /* RxBaud and TxBaud definitions... */ | ||
57 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ | ||
58 | #define RIO_B50 0x01 /* 50 baud */ | ||
59 | #define RIO_B75 0x02 /* 75 baud */ | ||
60 | #define RIO_B110 0x03 /* 110 baud */ | ||
61 | #define RIO_B134 0x04 /* 134.5 baud */ | ||
62 | #define RIO_B150 0x05 /* 150 baud */ | ||
63 | #define RIO_B200 0x06 /* 200 baud */ | ||
64 | #define RIO_B300 0x07 /* 300 baud */ | ||
65 | #define RIO_B600 0x08 /* 600 baud */ | ||
66 | #define RIO_B1200 0x09 /* 1200 baud */ | ||
67 | #define RIO_B1800 0x0A /* 1800 baud */ | ||
68 | #define RIO_B2400 0x0B /* 2400 baud */ | ||
69 | #define RIO_B4800 0x0C /* 4800 baud */ | ||
70 | #define RIO_B9600 0x0D /* 9600 baud */ | ||
71 | #define RIO_B19200 0x0E /* 19200 baud */ | ||
72 | #define RIO_B38400 0x0F /* 38400 baud */ | ||
73 | #define RIO_B56000 0x10 /* 56000 baud */ | ||
74 | #define RIO_B57600 0x11 /* 57600 baud */ | ||
75 | #define RIO_B64000 0x12 /* 64000 baud */ | ||
76 | #define RIO_B115200 0x13 /* 115200 baud */ | ||
77 | #define RIO_B2000 0x14 /* 2000 baud */ | ||
diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h deleted file mode 100644 index 8366978578c1..000000000000 --- a/drivers/char/rio/map.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : map.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:11 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)map.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_map_h__ | ||
34 | #define __rio_map_h__ | ||
35 | |||
36 | /* | ||
37 | ** mapping structure passed to and from the config.rio program to | ||
38 | ** determine the current topology of the world | ||
39 | */ | ||
40 | |||
41 | #define MAX_MAP_ENTRY 17 | ||
42 | #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) | ||
43 | #define MAX_NAME_LEN 32 | ||
44 | |||
45 | struct Map { | ||
46 | unsigned int HostUniqueNum; /* Supporting hosts unique number */ | ||
47 | unsigned int RtaUniqueNum; /* Unique number */ | ||
48 | /* | ||
49 | ** The next two IDs must be swapped on big-endian architectures | ||
50 | ** when using a v2.04 /etc/rio/config with a v3.00 driver (when | ||
51 | ** upgrading for example). | ||
52 | */ | ||
53 | unsigned short ID; /* ID used in the subnet */ | ||
54 | unsigned short ID2; /* ID of 2nd block of 8 for 16 port */ | ||
55 | unsigned long Flags; /* Booted, ID Given, Disconnected */ | ||
56 | unsigned long SysPort; /* First tty mapped to this port */ | ||
57 | struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ | ||
58 | char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | ** Flag values: | ||
63 | */ | ||
64 | #define RTA_BOOTED 0x00000001 | ||
65 | #define RTA_NEWBOOT 0x00000010 | ||
66 | #define MSG_DONE 0x00000020 | ||
67 | #define RTA_INTERCONNECT 0x00000040 | ||
68 | #define RTA16_SECOND_SLOT 0x00000080 | ||
69 | #define BEEN_HERE 0x00000100 | ||
70 | #define SLOT_TENTATIVE 0x40000000 | ||
71 | #define SLOT_IN_USE 0x80000000 | ||
72 | |||
73 | /* | ||
74 | ** HostUniqueNum is the unique number from the host card that this RTA | ||
75 | ** is to be connected to. | ||
76 | ** RtaUniqueNum is the unique number of the RTA concerned. It will be ZERO | ||
77 | ** if the slot in the table is unused. If it is the same as the HostUniqueNum | ||
78 | ** then this slot represents a host card. | ||
79 | ** Flags contains current boot/route state info | ||
80 | ** SysPort is a value in the range 0-504, being the number of the first tty | ||
81 | ** on this RTA. Each RTA supports 8 ports. The SysPort value must be modulo 8. | ||
82 | ** SysPort 0-127 correspond to /dev/ttyr001 to /dev/ttyr128, with minor | ||
83 | ** numbers 0-127. SysPort 128-255 correspond to /dev/ttyr129 to /dev/ttyr256, | ||
84 | ** again with minor numbers 0-127, and so on for SysPorts 256-383 and 384-511 | ||
85 | ** ID will be in the range 0-16 for a `known' RTA. ID will be 0xFFFF for an | ||
86 | ** unused slot/unknown ID etc. | ||
87 | ** The Topology array contains the ID of the unit connected to each of the | ||
88 | ** four links on this unit. The entry will be 0xFFFF if NOTHING is connected | ||
89 | ** to the link, or will be 0xFF00 if an UNKNOWN unit is connected to the link. | ||
90 | ** The Name field is a null-terminated string, upto 31 characters, containing | ||
91 | ** the 'cute' name that the sysadmin/users know the RTA by. It is permissible | ||
92 | ** for this string to contain any character in the range \040 to \176 inclusive. | ||
93 | ** In particular, ctrl sequences and DEL (0x7F, \177) are not allowed. The | ||
94 | ** special character '%' IS allowable, and needs no special action. | ||
95 | ** | ||
96 | */ | ||
97 | |||
98 | #endif | ||
diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h deleted file mode 100644 index 7e9b6283e8aa..000000000000 --- a/drivers/char/rio/param.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : param.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:12 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)param.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_param_h__ | ||
34 | #define __rio_param_h__ | ||
35 | |||
36 | /* | ||
37 | ** the param command block, as used in OPEN and PARAM calls. | ||
38 | */ | ||
39 | |||
40 | struct phb_param { | ||
41 | u8 Cmd; /* It is very important that these line up */ | ||
42 | u8 Cor1; /* with what is expected at the other end. */ | ||
43 | u8 Cor2; /* to confirm that you've got it right, */ | ||
44 | u8 Cor4; /* check with cirrus/cirrus.h */ | ||
45 | u8 Cor5; | ||
46 | u8 TxXon; /* Transmit X-On character */ | ||
47 | u8 TxXoff; /* Transmit X-Off character */ | ||
48 | u8 RxXon; /* Receive X-On character */ | ||
49 | u8 RxXoff; /* Receive X-Off character */ | ||
50 | u8 LNext; /* Literal-next character */ | ||
51 | u8 TxBaud; /* Transmit baudrate */ | ||
52 | u8 RxBaud; /* Receive baudrate */ | ||
53 | }; | ||
54 | |||
55 | #endif | ||
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h deleted file mode 100644 index acc8fa439df5..000000000000 --- a/drivers/char/rio/parmmap.h +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* H O S T M E M O R Y M A P | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra / Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | 6/4/1991 jonb Made changes to accommodate Mips R3230 bus | ||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _parmap_h | ||
38 | #define _parmap_h | ||
39 | |||
40 | typedef struct PARM_MAP PARM_MAP; | ||
41 | |||
42 | struct PARM_MAP { | ||
43 | u16 phb_ptr; /* Pointer to the PHB array */ | ||
44 | u16 phb_num_ptr; /* Ptr to Number of PHB's */ | ||
45 | u16 free_list; /* Free List pointer */ | ||
46 | u16 free_list_end; /* Free List End pointer */ | ||
47 | u16 q_free_list_ptr; /* Ptr to Q_BUF variable */ | ||
48 | u16 unit_id_ptr; /* Unit Id */ | ||
49 | u16 link_str_ptr; /* Link Structure Array */ | ||
50 | u16 bootloader_1; /* 1st Stage Boot Loader */ | ||
51 | u16 bootloader_2; /* 2nd Stage Boot Loader */ | ||
52 | u16 port_route_map_ptr; /* Port Route Map */ | ||
53 | u16 route_ptr; /* Unit Route Map */ | ||
54 | u16 map_present; /* Route Map present */ | ||
55 | s16 pkt_num; /* Total number of packets */ | ||
56 | s16 q_num; /* Total number of Q packets */ | ||
57 | u16 buffers_per_port; /* Number of buffers per port */ | ||
58 | u16 heap_size; /* Initial size of heap */ | ||
59 | u16 heap_left; /* Current Heap left */ | ||
60 | u16 error; /* Error code */ | ||
61 | u16 tx_max; /* Max number of tx pkts per phb */ | ||
62 | u16 rx_max; /* Max number of rx pkts per phb */ | ||
63 | u16 rx_limit; /* For high / low watermarks */ | ||
64 | s16 links; /* Links to use */ | ||
65 | s16 timer; /* Interrupts per second */ | ||
66 | u16 rups; /* Pointer to the RUPs */ | ||
67 | u16 max_phb; /* Mostly for debugging */ | ||
68 | u16 living; /* Just increments!! */ | ||
69 | u16 init_done; /* Initialisation over */ | ||
70 | u16 booting_link; | ||
71 | u16 idle_count; /* Idle time counter */ | ||
72 | u16 busy_count; /* Busy counter */ | ||
73 | u16 idle_control; /* Control Idle Process */ | ||
74 | u16 tx_intr; /* TX interrupt pending */ | ||
75 | u16 rx_intr; /* RX interrupt pending */ | ||
76 | u16 rup_intr; /* RUP interrupt pending */ | ||
77 | }; | ||
78 | |||
79 | #endif | ||
80 | |||
81 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/pci.h b/drivers/char/rio/pci.h deleted file mode 100644 index 6032f9135956..000000000000 --- a/drivers/char/rio/pci.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : pci.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:12 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)pci.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_pci_h__ | ||
34 | #define __rio_pci_h__ | ||
35 | |||
36 | /* | ||
37 | ** PCI stuff | ||
38 | */ | ||
39 | |||
40 | #define PCITpFastClock 0x80 | ||
41 | #define PCITpSlowClock 0x00 | ||
42 | #define PCITpFastLinks 0x40 | ||
43 | #define PCITpSlowLinks 0x00 | ||
44 | #define PCITpIntEnable 0x04 | ||
45 | #define PCITpIntDisable 0x00 | ||
46 | #define PCITpBusEnable 0x02 | ||
47 | #define PCITpBusDisable 0x00 | ||
48 | #define PCITpBootFromRam 0x01 | ||
49 | #define PCITpBootFromLink 0x00 | ||
50 | |||
51 | #define RIO_PCI_VENDOR 0x11CB | ||
52 | #define RIO_PCI_DEVICE 0x8000 | ||
53 | #define RIO_PCI_BASE_CLASS 0x02 | ||
54 | #define RIO_PCI_SUB_CLASS 0x80 | ||
55 | #define RIO_PCI_PROG_IFACE 0x00 | ||
56 | |||
57 | #define RIO_PCI_RID 0x0008 | ||
58 | #define RIO_PCI_BADR0 0x0010 | ||
59 | #define RIO_PCI_INTLN 0x003C | ||
60 | #define RIO_PCI_INTPIN 0x003D | ||
61 | |||
62 | #define RIO_PCI_MEM_SIZE 65536 | ||
63 | |||
64 | #define RIO_PCI_TURBO_TP 0x80 | ||
65 | #define RIO_PCI_FAST_LINKS 0x40 | ||
66 | #define RIO_PCI_INT_ENABLE 0x04 | ||
67 | #define RIO_PCI_TP_BUS_ENABLE 0x02 | ||
68 | #define RIO_PCI_BOOT_FROM_RAM 0x01 | ||
69 | |||
70 | #define RIO_PCI_DEFAULT_MODE 0x05 | ||
71 | |||
72 | #endif /* __rio_pci_h__ */ | ||
diff --git a/drivers/char/rio/phb.h b/drivers/char/rio/phb.h deleted file mode 100644 index a4c48ae4e365..000000000000 --- a/drivers/char/rio/phb.h +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* P H B H E A D E R ******* | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra, Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _phb_h | ||
38 | #define _phb_h 1 | ||
39 | |||
40 | /************************************************* | ||
41 | * Handshake asserted. Deasserted by the LTT(s) | ||
42 | ************************************************/ | ||
43 | #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */ | ||
44 | |||
45 | #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */ | ||
46 | |||
47 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET) | ||
48 | /* Reset by ltt */ | ||
49 | |||
50 | |||
51 | /************************************************* | ||
52 | * Maximum number of PHB's | ||
53 | ************************************************/ | ||
54 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ | ||
55 | |||
56 | /************************************************* | ||
57 | * Defines for the mode fields | ||
58 | ************************************************/ | ||
59 | #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */ | ||
60 | #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */ | ||
61 | #define TX_TAB3 0x0004 /* TAB3 mode */ | ||
62 | #define TX_OCRNL 0x0008 /* OCRNL mode */ | ||
63 | #define TX_ONLCR 0x0010 /* ONLCR mode */ | ||
64 | #define TX_SENDSPACES 0x0020 /* Send n spaces command needs | ||
65 | completing */ | ||
66 | #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */ | ||
67 | #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */ | ||
68 | #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | ||
69 | port */ | ||
70 | #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL) | ||
71 | #define TX_DTRFLOW 0x0200 /* DTR tx flow control */ | ||
72 | #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data | ||
73 | into the FIFO */ | ||
74 | #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */ | ||
75 | #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */ | ||
76 | |||
77 | #define RX_SPARE 0x0001 /* SPARE */ | ||
78 | #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */ | ||
79 | #define RX_ICRNL 0x0008 /* ICRNL mode */ | ||
80 | #define RX_INLCR 0x0010 /* INLCR mode */ | ||
81 | #define RX_IGNCR 0x0020 /* IGNCR mode */ | ||
82 | #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */ | ||
83 | #define RX_IXOFF 0x0080 /* IXOFF enabled */ | ||
84 | #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */ | ||
85 | #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */ | ||
86 | #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */ | ||
87 | |||
88 | #define PORT_ISOPEN 0x0001 /* Port open? */ | ||
89 | #define PORT_HUPCL 0x0002 /* Hangup on close? */ | ||
90 | #define PORT_MOPENPEND 0x0004 /* Modem open pending */ | ||
91 | #define PORT_ISPARALLEL 0x0008 /* Parallel port */ | ||
92 | #define PORT_BREAK 0x0010 /* Port on break */ | ||
93 | #define PORT_STATUSPEND 0x0020 /* Status packet pending */ | ||
94 | #define PORT_BREAKPEND 0x0040 /* Break packet pending */ | ||
95 | #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */ | ||
96 | #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | ||
97 | port */ | ||
98 | #define PORT_FULLMODEM 0x0200 /* Full modem signals */ | ||
99 | #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */ | ||
100 | #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */ | ||
101 | |||
102 | #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */ | ||
103 | |||
104 | #define PORT_WCLOSE 0x0800 /* Waiting for close */ | ||
105 | #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */ | ||
106 | #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */ | ||
107 | #define DUMPMODE 0x4000 /* Dump RTA mem */ | ||
108 | #define READ_REG 0x8000 /* Read CD1400 register */ | ||
109 | |||
110 | |||
111 | |||
112 | /************************************************************************** | ||
113 | * PHB Structure | ||
114 | * A few words. | ||
115 | * | ||
116 | * Normally Packets are added to the end of the list and removed from | ||
117 | * the start. The pointer tx_add points to a SPACE to put a Packet. | ||
118 | * The pointer tx_remove points to the next Packet to remove | ||
119 | *************************************************************************/ | ||
120 | |||
121 | struct PHB { | ||
122 | u8 source; | ||
123 | u8 handshake; | ||
124 | u8 status; | ||
125 | u16 timeout; /* Maximum of 1.9 seconds */ | ||
126 | u8 link; /* Send down this link */ | ||
127 | u8 destination; | ||
128 | u16 tx_start; | ||
129 | u16 tx_end; | ||
130 | u16 tx_add; | ||
131 | u16 tx_remove; | ||
132 | |||
133 | u16 rx_start; | ||
134 | u16 rx_end; | ||
135 | u16 rx_add; | ||
136 | u16 rx_remove; | ||
137 | |||
138 | }; | ||
139 | |||
140 | #endif | ||
141 | |||
142 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/pkt.h b/drivers/char/rio/pkt.h deleted file mode 100644 index a9458164f02f..000000000000 --- a/drivers/char/rio/pkt.h +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* P A C K E T H E A D E R F I L E | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra / Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _pkt_h | ||
38 | #define _pkt_h 1 | ||
39 | |||
40 | #define PKT_CMD_BIT ((ushort) 0x080) | ||
41 | #define PKT_CMD_DATA ((ushort) 0x080) | ||
42 | |||
43 | #define PKT_ACK ((ushort) 0x040) | ||
44 | |||
45 | #define PKT_TGL ((ushort) 0x020) | ||
46 | |||
47 | #define PKT_LEN_MASK ((ushort) 0x07f) | ||
48 | |||
49 | #define DATA_WNDW ((ushort) 0x10) | ||
50 | #define PKT_TTL_MASK ((ushort) 0x0f) | ||
51 | |||
52 | #define PKT_MAX_DATA_LEN 72 | ||
53 | |||
54 | #define PKT_LENGTH sizeof(struct PKT) | ||
55 | #define SYNC_PKT_LENGTH (PKT_LENGTH + 4) | ||
56 | |||
57 | #define CONTROL_PKT_LEN_MASK PKT_LEN_MASK | ||
58 | #define CONTROL_PKT_CMD_BIT PKT_CMD_BIT | ||
59 | #define CONTROL_PKT_ACK (PKT_ACK << 8) | ||
60 | #define CONTROL_PKT_TGL (PKT_TGL << 8) | ||
61 | #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8) | ||
62 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) | ||
63 | |||
64 | struct PKT { | ||
65 | u8 dest_unit; /* Destination Unit Id */ | ||
66 | u8 dest_port; /* Destination POrt */ | ||
67 | u8 src_unit; /* Source Unit Id */ | ||
68 | u8 src_port; /* Source POrt */ | ||
69 | u8 len; | ||
70 | u8 control; | ||
71 | u8 data[PKT_MAX_DATA_LEN]; | ||
72 | /* Actual data :-) */ | ||
73 | u16 csum; /* C-SUM */ | ||
74 | }; | ||
75 | #endif | ||
76 | |||
77 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/port.h b/drivers/char/rio/port.h deleted file mode 100644 index 49cf6d15ee54..000000000000 --- a/drivers/char/rio/port.h +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : port.h | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 11:34:12 | ||
26 | ** Retrieved : 11/6/98 11:34:21 | ||
27 | ** | ||
28 | ** ident @(#)port.h 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_port_h__ | ||
34 | #define __rio_port_h__ | ||
35 | |||
36 | /* | ||
37 | ** Port data structure | ||
38 | */ | ||
39 | struct Port { | ||
40 | struct gs_port gs; | ||
41 | int PortNum; /* RIO port no., 0-511 */ | ||
42 | struct Host *HostP; | ||
43 | void __iomem *Caddr; | ||
44 | unsigned short HostPort; /* Port number on host card */ | ||
45 | unsigned char RupNum; /* Number of RUP for port */ | ||
46 | unsigned char ID2; /* Second ID of RTA for port */ | ||
47 | unsigned long State; /* FLAGS for open & xopen */ | ||
48 | #define RIO_LOPEN 0x00001 /* Local open */ | ||
49 | #define RIO_MOPEN 0x00002 /* Modem open */ | ||
50 | #define RIO_WOPEN 0x00004 /* Waiting for open */ | ||
51 | #define RIO_CLOSING 0x00008 /* The port is being close */ | ||
52 | #define RIO_XPBUSY 0x00010 /* Transparent printer busy */ | ||
53 | #define RIO_BREAKING 0x00020 /* Break in progress */ | ||
54 | #define RIO_DIRECT 0x00040 /* Doing Direct output */ | ||
55 | #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ | ||
56 | #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ | ||
57 | #define RIO_CARR_ON 0x00200 /* Stream has carrier present */ | ||
58 | #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ | ||
59 | #define RIO_RBLK 0x00800 /* Stream is read-blocked */ | ||
60 | #define RIO_BUSY 0x01000 /* Stream is BUSY for write */ | ||
61 | #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ | ||
62 | #define RIO_TXSTOP 0x04000 /* Stream output is stopped */ | ||
63 | #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ | ||
64 | #define RIO_DYNOROD 0x10000 /* Drain failed */ | ||
65 | #define RIO_DELETED 0x20000 /* RTA has been deleted */ | ||
66 | #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ | ||
67 | #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ | ||
68 | #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ | ||
69 | #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ | ||
70 | #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */ | ||
71 | #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ | ||
72 | #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ | ||
73 | |||
74 | unsigned long Config; /* FLAGS for NOREAD.... */ | ||
75 | #define RIO_NOREAD 0x0001 /* Are not allowed to read port */ | ||
76 | #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ | ||
77 | #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ | ||
78 | #define RIO_NOMASK 0x0007 /* All not allowed things */ | ||
79 | #define RIO_IXANY 0x0008 /* Port is allowed ixany */ | ||
80 | #define RIO_MODEM 0x0010 /* Stream is a modem device */ | ||
81 | #define RIO_IXON 0x0020 /* Port is allowed ixon */ | ||
82 | #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ | ||
83 | #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ | ||
84 | #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ | ||
85 | |||
86 | /* | ||
87 | ** 15.10.1998 ARG - ESIL 0761 prt fix | ||
88 | ** As LynxOS does not appear to support Hardware Flow Control ..... | ||
89 | ** Define our own flow control flags in 'Config'. | ||
90 | */ | ||
91 | #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ | ||
92 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ | ||
93 | |||
94 | |||
95 | struct PHB __iomem *PhbP; /* pointer to PHB for port */ | ||
96 | u16 __iomem *TxAdd; /* Add packets here */ | ||
97 | u16 __iomem *TxStart; /* Start of add array */ | ||
98 | u16 __iomem *TxEnd; /* End of add array */ | ||
99 | u16 __iomem *RxRemove; /* Remove packets here */ | ||
100 | u16 __iomem *RxStart; /* Start of remove array */ | ||
101 | u16 __iomem *RxEnd; /* End of remove array */ | ||
102 | unsigned int RtaUniqueNum; /* Unique number of RTA */ | ||
103 | unsigned short PortState; /* status of port */ | ||
104 | unsigned short ModemState; /* status of modem lines */ | ||
105 | unsigned long ModemLines; /* Modem bits sent to RTA */ | ||
106 | unsigned char CookMode; /* who expands CR/LF? */ | ||
107 | unsigned char ParamSem; /* Prevent write during param */ | ||
108 | unsigned char Mapped; /* if port mapped onto host */ | ||
109 | unsigned char SecondBlock; /* if port belongs to 2nd block | ||
110 | of 16 port RTA */ | ||
111 | unsigned char InUse; /* how many pre-emptive cmds */ | ||
112 | unsigned char Lock; /* if params locked */ | ||
113 | unsigned char Store; /* if params stored across closes */ | ||
114 | unsigned char FirstOpen; /* TRUE if first time port opened */ | ||
115 | unsigned char FlushCmdBodge; /* if doing a (non)flush */ | ||
116 | unsigned char MagicFlags; /* require intr processing */ | ||
117 | #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ | ||
118 | #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ | ||
119 | #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ | ||
120 | unsigned char WflushFlag; /* 1 How many WFLUSHs active */ | ||
121 | /* | ||
122 | ** Transparent print stuff | ||
123 | */ | ||
124 | struct Xprint { | ||
125 | #ifndef MAX_XP_CTRL_LEN | ||
126 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ | ||
127 | #endif | ||
128 | unsigned int XpCps; | ||
129 | char XpOn[MAX_XP_CTRL_LEN]; | ||
130 | char XpOff[MAX_XP_CTRL_LEN]; | ||
131 | unsigned short XpLen; /* strlen(XpOn)+strlen(XpOff) */ | ||
132 | unsigned char XpActive; | ||
133 | unsigned char XpLastTickOk; /* TRUE if we can process */ | ||
134 | #define XP_OPEN 00001 | ||
135 | #define XP_RUNABLE 00002 | ||
136 | struct ttystatics *XttyP; | ||
137 | } Xprint; | ||
138 | unsigned char RxDataStart; | ||
139 | unsigned char Cor2Copy; /* copy of COR2 */ | ||
140 | char *Name; /* points to the Rta's name */ | ||
141 | char *TxRingBuffer; | ||
142 | unsigned short TxBufferIn; /* New data arrives here */ | ||
143 | unsigned short TxBufferOut; /* Intr removes data here */ | ||
144 | unsigned short OldTxBufferOut; /* Indicates if draining */ | ||
145 | int TimeoutId; /* Timeout ID */ | ||
146 | unsigned int Debug; | ||
147 | unsigned char WaitUntilBooted; /* True if open should block */ | ||
148 | unsigned int statsGather; /* True if gathering stats */ | ||
149 | unsigned long txchars; /* Chars transmitted */ | ||
150 | unsigned long rxchars; /* Chars received */ | ||
151 | unsigned long opens; /* port open count */ | ||
152 | unsigned long closes; /* port close count */ | ||
153 | unsigned long ioctls; /* ioctl count */ | ||
154 | unsigned char LastRxTgl; /* Last state of rx toggle bit */ | ||
155 | spinlock_t portSem; /* Lock using this sem */ | ||
156 | int MonitorTstate; /* Monitoring ? */ | ||
157 | int timeout_id; /* For calling 100 ms delays */ | ||
158 | int timeout_sem; /* For calling 100 ms delays */ | ||
159 | int firstOpen; /* First time open ? */ | ||
160 | char *p; /* save the global struc here .. */ | ||
161 | }; | ||
162 | |||
163 | struct ModuleInfo { | ||
164 | char *Name; | ||
165 | unsigned int Flags[4]; /* one per port on a module */ | ||
166 | }; | ||
167 | |||
168 | /* | ||
169 | ** This struct is required because trying to grab an entire Port structure | ||
170 | ** runs into problems with differing struct sizes between driver and config. | ||
171 | */ | ||
172 | struct PortParams { | ||
173 | unsigned int Port; | ||
174 | unsigned long Config; | ||
175 | unsigned long State; | ||
176 | struct ttystatics *TtyP; | ||
177 | }; | ||
178 | |||
179 | #endif | ||
diff --git a/drivers/char/rio/protsts.h b/drivers/char/rio/protsts.h deleted file mode 100644 index 8ab79401d3ee..000000000000 --- a/drivers/char/rio/protsts.h +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* P R O T O C O L S T A T U S S T R U C T U R E ******* | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra / Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _protsts_h | ||
38 | #define _protsts_h 1 | ||
39 | |||
40 | /************************************************* | ||
41 | * ACK bit. Last Packet received OK. Set by | ||
42 | * rxpkt to indicate that the Packet has been | ||
43 | * received OK and that the LTT must set the ACK | ||
44 | * bit in the next outward bound Packet | ||
45 | * and re-set by LTT's after xmit. | ||
46 | * | ||
47 | * Gets shoved into rx_status | ||
48 | ************************************************/ | ||
49 | #define PHB_RX_LAST_PKT_ACKED ((ushort) 0x080) | ||
50 | |||
51 | /******************************************************* | ||
52 | * The Rx TOGGLE bit. | ||
53 | * Stuffed into rx_status by RXPKT | ||
54 | ******************************************************/ | ||
55 | #define PHB_RX_DATA_WNDW ((ushort) 0x040) | ||
56 | |||
57 | /******************************************************* | ||
58 | * The Rx TOGGLE bit. Matches the setting in PKT.H | ||
59 | * Stuffed into rx_status | ||
60 | ******************************************************/ | ||
61 | #define PHB_RX_TGL ((ushort) 0x2000) | ||
62 | |||
63 | |||
64 | /************************************************* | ||
65 | * This bit is set by the LRT to indicate that | ||
66 | * an ACK (packet) must be returned. | ||
67 | * | ||
68 | * Gets shoved into tx_status | ||
69 | ************************************************/ | ||
70 | #define PHB_TX_SEND_PKT_ACK ((ushort) 0x08) | ||
71 | |||
72 | /************************************************* | ||
73 | * Set by LTT to indicate that an ACK is required | ||
74 | *************************************************/ | ||
75 | #define PHB_TX_ACK_RQRD ((ushort) 0x01) | ||
76 | |||
77 | |||
78 | /******************************************************* | ||
79 | * The Tx TOGGLE bit. | ||
80 | * Stuffed into tx_status by RXPKT from the PKT WndW | ||
81 | * field. Looked by the LTT when the NEXT Packet | ||
82 | * is going to be sent. | ||
83 | ******************************************************/ | ||
84 | #define PHB_TX_DATA_WNDW ((ushort) 0x04) | ||
85 | |||
86 | |||
87 | /******************************************************* | ||
88 | * The Tx TOGGLE bit. Matches the setting in PKT.H | ||
89 | * Stuffed into tx_status | ||
90 | ******************************************************/ | ||
91 | #define PHB_TX_TGL ((ushort) 0x02) | ||
92 | |||
93 | /******************************************************* | ||
94 | * Request intr bit. Set when the queue has gone quiet | ||
95 | * and the PHB has requested an interrupt. | ||
96 | ******************************************************/ | ||
97 | #define PHB_TX_INTR ((ushort) 0x100) | ||
98 | |||
99 | /******************************************************* | ||
100 | * SET if the PHB cannot send any more data down the | ||
101 | * Link | ||
102 | ******************************************************/ | ||
103 | #define PHB_TX_HANDSHAKE ((ushort) 0x010) | ||
104 | |||
105 | |||
106 | #define RUP_SEND_WNDW ((ushort) 0x08) ; | ||
107 | |||
108 | #endif | ||
109 | |||
110 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h deleted file mode 100644 index 1bf36223a4e8..000000000000 --- a/drivers/char/rio/rio.h +++ /dev/null | |||
@@ -1,208 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 1998 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rio.h | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 11:34:13 | ||
26 | ** Retrieved : 11/6/98 11:34:22 | ||
27 | ** | ||
28 | ** ident @(#)rio.h 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_rio_h__ | ||
34 | #define __rio_rio_h__ | ||
35 | |||
36 | /* | ||
37 | ** Maximum numbers of things | ||
38 | */ | ||
39 | #define RIO_SLOTS 4 /* number of configuration slots */ | ||
40 | #define RIO_HOSTS 4 /* number of hosts that can be found */ | ||
41 | #define PORTS_PER_HOST 128 /* number of ports per host */ | ||
42 | #define LINKS_PER_UNIT 4 /* number of links from a host */ | ||
43 | #define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */ | ||
44 | #define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */ | ||
45 | #define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */ | ||
46 | #define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */ | ||
47 | /* number of modules on an RTA */ | ||
48 | #define MODULES_PER_RTA (PORTS_PER_RTA/PORTS_PER_MODULE) | ||
49 | #define MAX_PRODUCT 16 /* numbr of different product codes */ | ||
50 | #define MAX_MODULE_TYPES 16 /* number of different types of module */ | ||
51 | |||
52 | #define RIO_CONTROL_DEV 128 /* minor number of host/control device */ | ||
53 | #define RIO_INVALID_MAJOR 0 /* test first host card's major no for validity */ | ||
54 | |||
55 | /* | ||
56 | ** number of RTAs that can be bound to a master | ||
57 | */ | ||
58 | #define MAX_RTA_BINDINGS (MAX_RUP * RIO_HOSTS) | ||
59 | |||
60 | /* | ||
61 | ** Unit types | ||
62 | */ | ||
63 | #define PC_RTA16 0x90000000 | ||
64 | #define PC_RTA8 0xe0000000 | ||
65 | #define TYPE_HOST 0 | ||
66 | #define TYPE_RTA8 1 | ||
67 | #define TYPE_RTA16 2 | ||
68 | |||
69 | /* | ||
70 | ** Flag values returned by functions | ||
71 | */ | ||
72 | |||
73 | #define RIO_FAIL -1 | ||
74 | |||
75 | /* | ||
76 | ** SysPort value for something that hasn't any ports | ||
77 | */ | ||
78 | #define NO_PORT 0xFFFFFFFF | ||
79 | |||
80 | /* | ||
81 | ** Unit ID Of all hosts | ||
82 | */ | ||
83 | #define HOST_ID 0 | ||
84 | |||
85 | /* | ||
86 | ** Break bytes into nybles | ||
87 | */ | ||
88 | #define LONYBLE(X) ((X) & 0xF) | ||
89 | #define HINYBLE(X) (((X)>>4) & 0xF) | ||
90 | |||
91 | /* | ||
92 | ** Flag values passed into some functions | ||
93 | */ | ||
94 | #define DONT_SLEEP 0 | ||
95 | #define OK_TO_SLEEP 1 | ||
96 | |||
97 | #define DONT_PRINT 1 | ||
98 | #define DO_PRINT 0 | ||
99 | |||
100 | #define PRINT_TO_LOG_CONS 0 | ||
101 | #define PRINT_TO_CONS 1 | ||
102 | #define PRINT_TO_LOG 2 | ||
103 | |||
104 | /* | ||
105 | ** Timeout has trouble with times of less than 3 ticks... | ||
106 | */ | ||
107 | #define MIN_TIMEOUT 3 | ||
108 | |||
109 | /* | ||
110 | ** Generally useful constants | ||
111 | */ | ||
112 | |||
113 | #define HUNDRED_MS ((HZ/10)?(HZ/10):1) | ||
114 | #define ONE_MEG 0x100000 | ||
115 | #define SIXTY_FOUR_K 0x10000 | ||
116 | |||
117 | #define RIO_AT_MEM_SIZE SIXTY_FOUR_K | ||
118 | #define RIO_EISA_MEM_SIZE SIXTY_FOUR_K | ||
119 | #define RIO_MCA_MEM_SIZE SIXTY_FOUR_K | ||
120 | |||
121 | #define COOK_WELL 0 | ||
122 | #define COOK_MEDIUM 1 | ||
123 | #define COOK_RAW 2 | ||
124 | |||
125 | /* | ||
126 | ** Pointer manipulation stuff | ||
127 | ** RIO_PTR takes hostp->Caddr and the offset into the DP RAM area | ||
128 | ** and produces a UNIX caddr_t (pointer) to the object | ||
129 | ** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and | ||
130 | ** returns the offset into the DP RAM area. | ||
131 | */ | ||
132 | #define RIO_PTR(C,O) (((unsigned char __iomem *)(C))+(0xFFFF&(O))) | ||
133 | #define RIO_OFF(C,O) ((unsigned char __iomem *)(O)-(unsigned char __iomem *)(C)) | ||
134 | |||
135 | /* | ||
136 | ** How to convert from various different device number formats: | ||
137 | ** DEV is a dev number, as passed to open, close etc - NOT a minor | ||
138 | ** number! | ||
139 | **/ | ||
140 | |||
141 | #define RIO_MODEM_MASK 0x1FF | ||
142 | #define RIO_MODEM_BIT 0x200 | ||
143 | #define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK) | ||
144 | #define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT) | ||
145 | #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ | ||
146 | + MINOR(DEV) | ||
147 | #define CSUM(pkt_ptr) (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \ | ||
148 | ((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \ | ||
149 | ((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \ | ||
150 | ((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \ | ||
151 | ((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] ) | ||
152 | |||
153 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ | ||
154 | /* prevent a really stupid race condition. */ | ||
155 | |||
156 | #define NOT_INITIALISED 0 | ||
157 | #define INITIALISED 1 | ||
158 | |||
159 | #define NOT_POLLING 0 | ||
160 | #define POLLING 1 | ||
161 | |||
162 | #define NOT_CHANGED 0 | ||
163 | #define CHANGED 1 | ||
164 | |||
165 | #define NOT_INUSE 0 | ||
166 | |||
167 | #define DISCONNECT 0 | ||
168 | #define CONNECT 1 | ||
169 | |||
170 | /* ------ Control Codes ------ */ | ||
171 | |||
172 | #define CONTROL '^' | ||
173 | #define IFOAD ( CONTROL + 1 ) | ||
174 | #define IDENTIFY ( CONTROL + 2 ) | ||
175 | #define ZOMBIE ( CONTROL + 3 ) | ||
176 | #define UFOAD ( CONTROL + 4 ) | ||
177 | #define IWAIT ( CONTROL + 5 ) | ||
178 | |||
179 | #define IFOAD_MAGIC 0xF0AD /* of course */ | ||
180 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ | ||
181 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ | ||
182 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ | ||
183 | |||
184 | /* ------ Error Codes ------ */ | ||
185 | |||
186 | #define E_NO_ERROR ((ushort) 0) | ||
187 | |||
188 | /* ------ Free Lists ------ */ | ||
189 | |||
190 | struct rio_free_list { | ||
191 | u16 next; | ||
192 | u16 prev; | ||
193 | }; | ||
194 | |||
195 | /* NULL for card side linked lists */ | ||
196 | #define TPNULL ((ushort)(0x8000)) | ||
197 | /* We can add another packet to a transmit queue if the packet pointer pointed | ||
198 | * to by the TxAdd pointer has PKT_IN_USE clear in its address. */ | ||
199 | #define PKT_IN_USE 0x1 | ||
200 | |||
201 | /* ------ Topology ------ */ | ||
202 | |||
203 | struct Top { | ||
204 | u8 Unit; | ||
205 | u8 Link; | ||
206 | }; | ||
207 | |||
208 | #endif /* __rio_h__ */ | ||
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c deleted file mode 100644 index 5e33293d24e3..000000000000 --- a/drivers/char/rio/rio_linux.c +++ /dev/null | |||
@@ -1,1204 +0,0 @@ | |||
1 | |||
2 | /* rio_linux.c -- Linux driver for the Specialix RIO series cards. | ||
3 | * | ||
4 | * | ||
5 | * (C) 1999 R.E.Wolff@BitWizard.nl | ||
6 | * | ||
7 | * Specialix pays for the development and support of this driver. | ||
8 | * Please DO contact support@specialix.co.uk if you require | ||
9 | * support. But please read the documentation (rio.txt) first. | ||
10 | * | ||
11 | * | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License as | ||
15 | * published by the Free Software Foundation; either version 2 of | ||
16 | * the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be | ||
19 | * useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
21 | * PURPOSE. See the GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public | ||
24 | * License along with this program; if not, write to the Free | ||
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | ||
26 | * USA. | ||
27 | * | ||
28 | * */ | ||
29 | |||
30 | #include <linux/module.h> | ||
31 | #include <linux/kdev_t.h> | ||
32 | #include <asm/io.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/sched.h> | ||
35 | #include <linux/ioport.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/errno.h> | ||
38 | #include <linux/tty.h> | ||
39 | #include <linux/tty_flip.h> | ||
40 | #include <linux/mm.h> | ||
41 | #include <linux/serial.h> | ||
42 | #include <linux/fcntl.h> | ||
43 | #include <linux/major.h> | ||
44 | #include <linux/delay.h> | ||
45 | #include <linux/pci.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/mutex.h> | ||
48 | #include <linux/miscdevice.h> | ||
49 | #include <linux/init.h> | ||
50 | |||
51 | #include <linux/generic_serial.h> | ||
52 | #include <asm/uaccess.h> | ||
53 | |||
54 | #include "linux_compat.h" | ||
55 | #include "pkt.h" | ||
56 | #include "daemon.h" | ||
57 | #include "rio.h" | ||
58 | #include "riospace.h" | ||
59 | #include "cmdpkt.h" | ||
60 | #include "map.h" | ||
61 | #include "rup.h" | ||
62 | #include "port.h" | ||
63 | #include "riodrvr.h" | ||
64 | #include "rioinfo.h" | ||
65 | #include "func.h" | ||
66 | #include "errors.h" | ||
67 | #include "pci.h" | ||
68 | |||
69 | #include "parmmap.h" | ||
70 | #include "unixrup.h" | ||
71 | #include "board.h" | ||
72 | #include "host.h" | ||
73 | #include "phb.h" | ||
74 | #include "link.h" | ||
75 | #include "cmdblk.h" | ||
76 | #include "route.h" | ||
77 | #include "cirrus.h" | ||
78 | #include "rioioctl.h" | ||
79 | #include "param.h" | ||
80 | #include "protsts.h" | ||
81 | #include "rioboard.h" | ||
82 | |||
83 | |||
84 | #include "rio_linux.h" | ||
85 | |||
86 | /* I don't think that this driver can handle more than 512 ports on | ||
87 | one machine. Specialix specifies max 4 boards in one machine. I don't | ||
88 | know why. If you want to try anyway you'll have to increase the number | ||
89 | of boards in rio.h. You'll have to allocate more majors if you need | ||
90 | more than 512 ports.... */ | ||
91 | |||
92 | #ifndef RIO_NORMAL_MAJOR0 | ||
93 | /* This allows overriding on the compiler commandline, or in a "major.h" | ||
94 | include or something like that */ | ||
95 | #define RIO_NORMAL_MAJOR0 154 | ||
96 | #define RIO_NORMAL_MAJOR1 156 | ||
97 | #endif | ||
98 | |||
99 | #ifndef PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 | ||
100 | #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000 | ||
101 | #endif | ||
102 | |||
103 | #ifndef RIO_WINDOW_LEN | ||
104 | #define RIO_WINDOW_LEN 0x10000 | ||
105 | #endif | ||
106 | |||
107 | |||
108 | /* Configurable options: | ||
109 | (Don't be too sure that it'll work if you toggle them) */ | ||
110 | |||
111 | /* Am I paranoid or not ? ;-) */ | ||
112 | #undef RIO_PARANOIA_CHECK | ||
113 | |||
114 | |||
115 | /* 20 -> 2000 per second. The card should rate-limit interrupts at 1000 | ||
116 | Hz, but it is user configurable. I don't recommend going above 1000 | ||
117 | Hz. The interrupt ratelimit might trigger if the interrupt is | ||
118 | shared with a very active other device. | ||
119 | undef this if you want to disable the check.... | ||
120 | */ | ||
121 | #define IRQ_RATE_LIMIT 200 | ||
122 | |||
123 | |||
124 | /* These constants are derived from SCO Source */ | ||
125 | static DEFINE_MUTEX(rio_fw_mutex); | ||
126 | static struct Conf | ||
127 | RIOConf = { | ||
128 | /* locator */ "RIO Config here", | ||
129 | /* startuptime */ HZ * 2, | ||
130 | /* how long to wait for card to run */ | ||
131 | /* slowcook */ 0, | ||
132 | /* TRUE -> always use line disc. */ | ||
133 | /* intrpolltime */ 1, | ||
134 | /* The frequency of OUR polls */ | ||
135 | /* breakinterval */ 25, | ||
136 | /* x10 mS XXX: units seem to be 1ms not 10! -- REW */ | ||
137 | /* timer */ 10, | ||
138 | /* mS */ | ||
139 | /* RtaLoadBase */ 0x7000, | ||
140 | /* HostLoadBase */ 0x7C00, | ||
141 | /* XpHz */ 5, | ||
142 | /* number of Xprint hits per second */ | ||
143 | /* XpCps */ 120, | ||
144 | /* Xprint characters per second */ | ||
145 | /* XpOn */ "\033d#", | ||
146 | /* start Xprint for a wyse 60 */ | ||
147 | /* XpOff */ "\024", | ||
148 | /* end Xprint for a wyse 60 */ | ||
149 | /* MaxXpCps */ 2000, | ||
150 | /* highest Xprint speed */ | ||
151 | /* MinXpCps */ 10, | ||
152 | /* slowest Xprint speed */ | ||
153 | /* SpinCmds */ 1, | ||
154 | /* non-zero for mega fast boots */ | ||
155 | /* First Addr */ 0x0A0000, | ||
156 | /* First address to look at */ | ||
157 | /* Last Addr */ 0xFF0000, | ||
158 | /* Last address looked at */ | ||
159 | /* BufferSize */ 1024, | ||
160 | /* Bytes per port of buffering */ | ||
161 | /* LowWater */ 256, | ||
162 | /* how much data left before wakeup */ | ||
163 | /* LineLength */ 80, | ||
164 | /* how wide is the console? */ | ||
165 | /* CmdTimeout */ HZ, | ||
166 | /* how long a close command may take */ | ||
167 | }; | ||
168 | |||
169 | |||
170 | |||
171 | |||
172 | /* Function prototypes */ | ||
173 | |||
174 | static void rio_disable_tx_interrupts(void *ptr); | ||
175 | static void rio_enable_tx_interrupts(void *ptr); | ||
176 | static void rio_disable_rx_interrupts(void *ptr); | ||
177 | static void rio_enable_rx_interrupts(void *ptr); | ||
178 | static int rio_carrier_raised(struct tty_port *port); | ||
179 | static void rio_shutdown_port(void *ptr); | ||
180 | static int rio_set_real_termios(void *ptr); | ||
181 | static void rio_hungup(void *ptr); | ||
182 | static void rio_close(void *ptr); | ||
183 | static int rio_chars_in_buffer(void *ptr); | ||
184 | static long rio_fw_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
185 | static int rio_init_drivers(void); | ||
186 | |||
187 | static void my_hd(void *addr, int len); | ||
188 | |||
189 | static struct tty_driver *rio_driver, *rio_driver2; | ||
190 | |||
191 | /* The name "p" is a bit non-descript. But that's what the rio-lynxos | ||
192 | sources use all over the place. */ | ||
193 | struct rio_info *p; | ||
194 | |||
195 | int rio_debug; | ||
196 | |||
197 | |||
198 | /* You can have the driver poll your card. | ||
199 | - Set rio_poll to 1 to poll every timer tick (10ms on Intel). | ||
200 | This is used when the card cannot use an interrupt for some reason. | ||
201 | */ | ||
202 | static int rio_poll = 1; | ||
203 | |||
204 | |||
205 | /* These are the only open spaces in my computer. Yours may have more | ||
206 | or less.... */ | ||
207 | static int rio_probe_addrs[] = { 0xc0000, 0xd0000, 0xe0000 }; | ||
208 | |||
209 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) | ||
210 | |||
211 | |||
212 | /* Set the mask to all-ones. This alas, only supports 32 interrupts. | ||
213 | Some architectures may need more. -- Changed to LONG to | ||
214 | support up to 64 bits on 64bit architectures. -- REW 20/06/99 */ | ||
215 | static long rio_irqmask = -1; | ||
216 | |||
217 | MODULE_AUTHOR("Rogier Wolff <R.E.Wolff@bitwizard.nl>, Patrick van de Lageweg <patrick@bitwizard.nl>"); | ||
218 | MODULE_DESCRIPTION("RIO driver"); | ||
219 | MODULE_LICENSE("GPL"); | ||
220 | module_param(rio_poll, int, 0); | ||
221 | module_param(rio_debug, int, 0644); | ||
222 | module_param(rio_irqmask, long, 0); | ||
223 | |||
224 | static struct real_driver rio_real_driver = { | ||
225 | rio_disable_tx_interrupts, | ||
226 | rio_enable_tx_interrupts, | ||
227 | rio_disable_rx_interrupts, | ||
228 | rio_enable_rx_interrupts, | ||
229 | rio_shutdown_port, | ||
230 | rio_set_real_termios, | ||
231 | rio_chars_in_buffer, | ||
232 | rio_close, | ||
233 | rio_hungup, | ||
234 | NULL | ||
235 | }; | ||
236 | |||
237 | /* | ||
238 | * Firmware loader driver specific routines | ||
239 | * | ||
240 | */ | ||
241 | |||
242 | static const struct file_operations rio_fw_fops = { | ||
243 | .owner = THIS_MODULE, | ||
244 | .unlocked_ioctl = rio_fw_ioctl, | ||
245 | .llseek = noop_llseek, | ||
246 | }; | ||
247 | |||
248 | static struct miscdevice rio_fw_device = { | ||
249 | RIOCTL_MISC_MINOR, "rioctl", &rio_fw_fops | ||
250 | }; | ||
251 | |||
252 | |||
253 | |||
254 | |||
255 | |||
256 | #ifdef RIO_PARANOIA_CHECK | ||
257 | |||
258 | /* This doesn't work. Who's paranoid around here? Not me! */ | ||
259 | |||
260 | static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine) | ||
261 | { | ||
262 | |||
263 | static const char *badmagic = KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; | ||
264 | static const char *badinfo = KERN_ERR "rio: Warning: null rio port for device %s in %s\n"; | ||
265 | |||
266 | if (!port) { | ||
267 | printk(badinfo, name, routine); | ||
268 | return 1; | ||
269 | } | ||
270 | if (port->magic != RIO_MAGIC) { | ||
271 | printk(badmagic, name, routine); | ||
272 | return 1; | ||
273 | } | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | #else | ||
278 | #define rio_paranoia_check(a,b,c) 0 | ||
279 | #endif | ||
280 | |||
281 | |||
282 | #ifdef DEBUG | ||
283 | static void my_hd(void *ad, int len) | ||
284 | { | ||
285 | int i, j, ch; | ||
286 | unsigned char *addr = ad; | ||
287 | |||
288 | for (i = 0; i < len; i += 16) { | ||
289 | rio_dprintk(RIO_DEBUG_PARAM, "%08lx ", (unsigned long) addr + i); | ||
290 | for (j = 0; j < 16; j++) { | ||
291 | rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); | ||
292 | } | ||
293 | for (j = 0; j < 16; j++) { | ||
294 | ch = addr[j + i]; | ||
295 | rio_dprintk(RIO_DEBUG_PARAM, "%c", (ch < 0x20) ? '.' : ((ch > 0x7f) ? '.' : ch)); | ||
296 | } | ||
297 | rio_dprintk(RIO_DEBUG_PARAM, "\n"); | ||
298 | } | ||
299 | } | ||
300 | #else | ||
301 | #define my_hd(ad,len) do{/* nothing*/ } while (0) | ||
302 | #endif | ||
303 | |||
304 | |||
305 | /* Delay a number of jiffies, allowing a signal to interrupt */ | ||
306 | int RIODelay(struct Port *PortP, int njiffies) | ||
307 | { | ||
308 | func_enter(); | ||
309 | |||
310 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); | ||
311 | msleep_interruptible(jiffies_to_msecs(njiffies)); | ||
312 | func_exit(); | ||
313 | |||
314 | if (signal_pending(current)) | ||
315 | return RIO_FAIL; | ||
316 | else | ||
317 | return !RIO_FAIL; | ||
318 | } | ||
319 | |||
320 | |||
321 | /* Delay a number of jiffies, disallowing a signal to interrupt */ | ||
322 | int RIODelay_ni(struct Port *PortP, int njiffies) | ||
323 | { | ||
324 | func_enter(); | ||
325 | |||
326 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); | ||
327 | msleep(jiffies_to_msecs(njiffies)); | ||
328 | func_exit(); | ||
329 | return !RIO_FAIL; | ||
330 | } | ||
331 | |||
332 | void rio_copy_to_card(void *from, void __iomem *to, int len) | ||
333 | { | ||
334 | rio_copy_toio(to, from, len); | ||
335 | } | ||
336 | |||
337 | int rio_minor(struct tty_struct *tty) | ||
338 | { | ||
339 | return tty->index + ((tty->driver == rio_driver) ? 0 : 256); | ||
340 | } | ||
341 | |||
342 | static int rio_set_real_termios(void *ptr) | ||
343 | { | ||
344 | return RIOParam((struct Port *) ptr, RIOC_CONFIG, 1, 1); | ||
345 | } | ||
346 | |||
347 | |||
348 | static void rio_reset_interrupt(struct Host *HostP) | ||
349 | { | ||
350 | func_enter(); | ||
351 | |||
352 | switch (HostP->Type) { | ||
353 | case RIO_AT: | ||
354 | case RIO_MCA: | ||
355 | case RIO_PCI: | ||
356 | writeb(0xFF, &HostP->ResetInt); | ||
357 | } | ||
358 | |||
359 | func_exit(); | ||
360 | } | ||
361 | |||
362 | |||
363 | static irqreturn_t rio_interrupt(int irq, void *ptr) | ||
364 | { | ||
365 | struct Host *HostP; | ||
366 | func_enter(); | ||
367 | |||
368 | HostP = ptr; /* &p->RIOHosts[(long)ptr]; */ | ||
369 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec); | ||
370 | |||
371 | /* AAargh! The order in which to do these things is essential and | ||
372 | not trivial. | ||
373 | |||
374 | - hardware twiddling goes before "recursive". Otherwise when we | ||
375 | poll the card, and a recursive interrupt happens, we won't | ||
376 | ack the card, so it might keep on interrupting us. (especially | ||
377 | level sensitive interrupt systems like PCI). | ||
378 | |||
379 | - Rate limit goes before hardware twiddling. Otherwise we won't | ||
380 | catch a card that has gone bonkers. | ||
381 | |||
382 | - The "initialized" test goes after the hardware twiddling. Otherwise | ||
383 | the card will stick us in the interrupt routine again. | ||
384 | |||
385 | - The initialized test goes before recursive. | ||
386 | */ | ||
387 | |||
388 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); | ||
389 | if (HostP->Ivec == irq) { | ||
390 | /* Tell the card we've noticed the interrupt. */ | ||
391 | rio_reset_interrupt(HostP); | ||
392 | } | ||
393 | |||
394 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) | ||
395 | return IRQ_HANDLED; | ||
396 | |||
397 | if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { | ||
398 | printk(KERN_ERR "Recursive interrupt! (host %p/irq%d)\n", ptr, HostP->Ivec); | ||
399 | return IRQ_HANDLED; | ||
400 | } | ||
401 | |||
402 | RIOServiceHost(p, HostP); | ||
403 | |||
404 | rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type); | ||
405 | |||
406 | clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); | ||
407 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); | ||
408 | func_exit(); | ||
409 | return IRQ_HANDLED; | ||
410 | } | ||
411 | |||
412 | |||
413 | static void rio_pollfunc(unsigned long data) | ||
414 | { | ||
415 | func_enter(); | ||
416 | |||
417 | rio_interrupt(0, &p->RIOHosts[data]); | ||
418 | mod_timer(&p->RIOHosts[data].timer, jiffies + rio_poll); | ||
419 | |||
420 | func_exit(); | ||
421 | } | ||
422 | |||
423 | |||
424 | /* ********************************************************************** * | ||
425 | * Here are the routines that actually * | ||
426 | * interface with the generic_serial driver * | ||
427 | * ********************************************************************** */ | ||
428 | |||
429 | /* Ehhm. I don't know how to fiddle with interrupts on the Specialix | ||
430 | cards. .... Hmm. Ok I figured it out. You don't. -- REW */ | ||
431 | |||
432 | static void rio_disable_tx_interrupts(void *ptr) | ||
433 | { | ||
434 | func_enter(); | ||
435 | |||
436 | /* port->gs.port.flags &= ~GS_TX_INTEN; */ | ||
437 | |||
438 | func_exit(); | ||
439 | } | ||
440 | |||
441 | |||
442 | static void rio_enable_tx_interrupts(void *ptr) | ||
443 | { | ||
444 | struct Port *PortP = ptr; | ||
445 | /* int hn; */ | ||
446 | |||
447 | func_enter(); | ||
448 | |||
449 | /* hn = PortP->HostP - p->RIOHosts; | ||
450 | |||
451 | rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn); | ||
452 | rio_interrupt (-1,(void *) hn, NULL); */ | ||
453 | |||
454 | RIOTxEnable((char *) PortP); | ||
455 | |||
456 | /* | ||
457 | * In general we cannot count on "tx empty" interrupts, although | ||
458 | * the interrupt routine seems to be able to tell the difference. | ||
459 | */ | ||
460 | PortP->gs.port.flags &= ~GS_TX_INTEN; | ||
461 | |||
462 | func_exit(); | ||
463 | } | ||
464 | |||
465 | |||
466 | static void rio_disable_rx_interrupts(void *ptr) | ||
467 | { | ||
468 | func_enter(); | ||
469 | func_exit(); | ||
470 | } | ||
471 | |||
472 | static void rio_enable_rx_interrupts(void *ptr) | ||
473 | { | ||
474 | /* struct rio_port *port = ptr; */ | ||
475 | func_enter(); | ||
476 | func_exit(); | ||
477 | } | ||
478 | |||
479 | |||
480 | /* Jeez. Isn't this simple? */ | ||
481 | static int rio_carrier_raised(struct tty_port *port) | ||
482 | { | ||
483 | struct Port *PortP = container_of(port, struct Port, gs.port); | ||
484 | int rv; | ||
485 | |||
486 | func_enter(); | ||
487 | rv = (PortP->ModemState & RIOC_MSVR1_CD) != 0; | ||
488 | |||
489 | rio_dprintk(RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); | ||
490 | |||
491 | func_exit(); | ||
492 | return rv; | ||
493 | } | ||
494 | |||
495 | |||
496 | /* Jeez. Isn't this simple? Actually, we can sync with the actual port | ||
497 | by just pushing stuff into the queue going to the port... */ | ||
498 | static int rio_chars_in_buffer(void *ptr) | ||
499 | { | ||
500 | func_enter(); | ||
501 | |||
502 | func_exit(); | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | |||
507 | /* Nothing special here... */ | ||
508 | static void rio_shutdown_port(void *ptr) | ||
509 | { | ||
510 | struct Port *PortP; | ||
511 | |||
512 | func_enter(); | ||
513 | |||
514 | PortP = (struct Port *) ptr; | ||
515 | PortP->gs.port.tty = NULL; | ||
516 | func_exit(); | ||
517 | } | ||
518 | |||
519 | |||
520 | /* I haven't the foggiest why the decrement use count has to happen | ||
521 | here. The whole linux serial drivers stuff needs to be redesigned. | ||
522 | My guess is that this is a hack to minimize the impact of a bug | ||
523 | elsewhere. Thinking about it some more. (try it sometime) Try | ||
524 | running minicom on a serial port that is driven by a modularized | ||
525 | driver. Have the modem hangup. Then remove the driver module. Then | ||
526 | exit minicom. I expect an "oops". -- REW */ | ||
527 | static void rio_hungup(void *ptr) | ||
528 | { | ||
529 | struct Port *PortP; | ||
530 | |||
531 | func_enter(); | ||
532 | |||
533 | PortP = (struct Port *) ptr; | ||
534 | PortP->gs.port.tty = NULL; | ||
535 | |||
536 | func_exit(); | ||
537 | } | ||
538 | |||
539 | |||
540 | /* The standard serial_close would become shorter if you'd wrap it like | ||
541 | this. | ||
542 | rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} | ||
543 | */ | ||
544 | static void rio_close(void *ptr) | ||
545 | { | ||
546 | struct Port *PortP; | ||
547 | |||
548 | func_enter(); | ||
549 | |||
550 | PortP = (struct Port *) ptr; | ||
551 | |||
552 | riotclose(ptr); | ||
553 | |||
554 | if (PortP->gs.port.count) { | ||
555 | printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count); | ||
556 | PortP->gs.port.count = 0; | ||
557 | } | ||
558 | |||
559 | PortP->gs.port.tty = NULL; | ||
560 | func_exit(); | ||
561 | } | ||
562 | |||
563 | |||
564 | |||
565 | static long rio_fw_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
566 | { | ||
567 | int rc = 0; | ||
568 | func_enter(); | ||
569 | |||
570 | /* The "dev" argument isn't used. */ | ||
571 | mutex_lock(&rio_fw_mutex); | ||
572 | rc = riocontrol(p, 0, cmd, arg, capable(CAP_SYS_ADMIN)); | ||
573 | mutex_unlock(&rio_fw_mutex); | ||
574 | |||
575 | func_exit(); | ||
576 | return rc; | ||
577 | } | ||
578 | |||
579 | extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); | ||
580 | |||
581 | static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) | ||
582 | { | ||
583 | void __user *argp = (void __user *)arg; | ||
584 | int rc; | ||
585 | struct Port *PortP; | ||
586 | int ival; | ||
587 | |||
588 | func_enter(); | ||
589 | |||
590 | PortP = (struct Port *) tty->driver_data; | ||
591 | |||
592 | rc = 0; | ||
593 | switch (cmd) { | ||
594 | case TIOCSSOFTCAR: | ||
595 | if ((rc = get_user(ival, (unsigned __user *) argp)) == 0) { | ||
596 | tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); | ||
597 | } | ||
598 | break; | ||
599 | case TIOCGSERIAL: | ||
600 | rc = -EFAULT; | ||
601 | if (access_ok(VERIFY_WRITE, argp, sizeof(struct serial_struct))) | ||
602 | rc = gs_getserial(&PortP->gs, argp); | ||
603 | break; | ||
604 | case TCSBRK: | ||
605 | if (PortP->State & RIO_DELETED) { | ||
606 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | ||
607 | rc = -EIO; | ||
608 | } else { | ||
609 | if (RIOShortCommand(p, PortP, RIOC_SBREAK, 2, 250) == | ||
610 | RIO_FAIL) { | ||
611 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | ||
612 | rc = -EIO; | ||
613 | } | ||
614 | } | ||
615 | break; | ||
616 | case TCSBRKP: | ||
617 | if (PortP->State & RIO_DELETED) { | ||
618 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | ||
619 | rc = -EIO; | ||
620 | } else { | ||
621 | int l; | ||
622 | l = arg ? arg * 100 : 250; | ||
623 | if (l > 255) | ||
624 | l = 255; | ||
625 | if (RIOShortCommand(p, PortP, RIOC_SBREAK, 2, | ||
626 | arg ? arg * 100 : 250) == RIO_FAIL) { | ||
627 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | ||
628 | rc = -EIO; | ||
629 | } | ||
630 | } | ||
631 | break; | ||
632 | case TIOCSSERIAL: | ||
633 | rc = -EFAULT; | ||
634 | if (access_ok(VERIFY_READ, argp, sizeof(struct serial_struct))) | ||
635 | rc = gs_setserial(&PortP->gs, argp); | ||
636 | break; | ||
637 | default: | ||
638 | rc = -ENOIOCTLCMD; | ||
639 | break; | ||
640 | } | ||
641 | func_exit(); | ||
642 | return rc; | ||
643 | } | ||
644 | |||
645 | |||
646 | /* The throttle/unthrottle scheme for the Specialix card is different | ||
647 | * from other drivers and deserves some explanation. | ||
648 | * The Specialix hardware takes care of XON/XOFF | ||
649 | * and CTS/RTS flow control itself. This means that all we have to | ||
650 | * do when signalled by the upper tty layer to throttle/unthrottle is | ||
651 | * to make a note of it here. When we come to read characters from the | ||
652 | * rx buffers on the card (rio_receive_chars()) we look to see if the | ||
653 | * upper layer can accept more (as noted here in rio_rx_throt[]). | ||
654 | * If it can't we simply don't remove chars from the cards buffer. | ||
655 | * When the tty layer can accept chars, we again note that here and when | ||
656 | * rio_receive_chars() is called it will remove them from the cards buffer. | ||
657 | * The card will notice that a ports buffer has drained below some low | ||
658 | * water mark and will unflow control the line itself, using whatever | ||
659 | * flow control scheme is in use for that port. -- Simon Allen | ||
660 | */ | ||
661 | |||
662 | static void rio_throttle(struct tty_struct *tty) | ||
663 | { | ||
664 | struct Port *port = (struct Port *) tty->driver_data; | ||
665 | |||
666 | func_enter(); | ||
667 | /* If the port is using any type of input flow | ||
668 | * control then throttle the port. | ||
669 | */ | ||
670 | |||
671 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { | ||
672 | port->State |= RIO_THROTTLE_RX; | ||
673 | } | ||
674 | |||
675 | func_exit(); | ||
676 | } | ||
677 | |||
678 | |||
679 | static void rio_unthrottle(struct tty_struct *tty) | ||
680 | { | ||
681 | struct Port *port = (struct Port *) tty->driver_data; | ||
682 | |||
683 | func_enter(); | ||
684 | /* Always unthrottle even if flow control is not enabled on | ||
685 | * this port in case we disabled flow control while the port | ||
686 | * was throttled | ||
687 | */ | ||
688 | |||
689 | port->State &= ~RIO_THROTTLE_RX; | ||
690 | |||
691 | func_exit(); | ||
692 | return; | ||
693 | } | ||
694 | |||
695 | |||
696 | |||
697 | |||
698 | |||
699 | /* ********************************************************************** * | ||
700 | * Here are the initialization routines. * | ||
701 | * ********************************************************************** */ | ||
702 | |||
703 | |||
704 | static struct vpd_prom *get_VPD_PROM(struct Host *hp) | ||
705 | { | ||
706 | static struct vpd_prom vpdp; | ||
707 | char *p; | ||
708 | int i; | ||
709 | |||
710 | func_enter(); | ||
711 | rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM); | ||
712 | |||
713 | p = (char *) &vpdp; | ||
714 | for (i = 0; i < sizeof(struct vpd_prom); i++) | ||
715 | *p++ = readb(hp->Caddr + RIO_VPD_ROM + i * 2); | ||
716 | /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ | ||
717 | |||
718 | /* Terminate the identifier string. | ||
719 | *** requires one extra byte in struct vpd_prom *** */ | ||
720 | *p++ = 0; | ||
721 | |||
722 | if (rio_debug & RIO_DEBUG_PROBE) | ||
723 | my_hd((char *) &vpdp, 0x20); | ||
724 | |||
725 | func_exit(); | ||
726 | |||
727 | return &vpdp; | ||
728 | } | ||
729 | |||
730 | static const struct tty_operations rio_ops = { | ||
731 | .open = riotopen, | ||
732 | .close = gs_close, | ||
733 | .write = gs_write, | ||
734 | .put_char = gs_put_char, | ||
735 | .flush_chars = gs_flush_chars, | ||
736 | .write_room = gs_write_room, | ||
737 | .chars_in_buffer = gs_chars_in_buffer, | ||
738 | .flush_buffer = gs_flush_buffer, | ||
739 | .ioctl = rio_ioctl, | ||
740 | .throttle = rio_throttle, | ||
741 | .unthrottle = rio_unthrottle, | ||
742 | .set_termios = gs_set_termios, | ||
743 | .stop = gs_stop, | ||
744 | .start = gs_start, | ||
745 | .hangup = gs_hangup, | ||
746 | }; | ||
747 | |||
748 | static int rio_init_drivers(void) | ||
749 | { | ||
750 | int error = -ENOMEM; | ||
751 | |||
752 | rio_driver = alloc_tty_driver(256); | ||
753 | if (!rio_driver) | ||
754 | goto out; | ||
755 | rio_driver2 = alloc_tty_driver(256); | ||
756 | if (!rio_driver2) | ||
757 | goto out1; | ||
758 | |||
759 | func_enter(); | ||
760 | |||
761 | rio_driver->owner = THIS_MODULE; | ||
762 | rio_driver->driver_name = "specialix_rio"; | ||
763 | rio_driver->name = "ttySR"; | ||
764 | rio_driver->major = RIO_NORMAL_MAJOR0; | ||
765 | rio_driver->type = TTY_DRIVER_TYPE_SERIAL; | ||
766 | rio_driver->subtype = SERIAL_TYPE_NORMAL; | ||
767 | rio_driver->init_termios = tty_std_termios; | ||
768 | rio_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
769 | rio_driver->flags = TTY_DRIVER_REAL_RAW; | ||
770 | tty_set_operations(rio_driver, &rio_ops); | ||
771 | |||
772 | rio_driver2->owner = THIS_MODULE; | ||
773 | rio_driver2->driver_name = "specialix_rio"; | ||
774 | rio_driver2->name = "ttySR"; | ||
775 | rio_driver2->major = RIO_NORMAL_MAJOR1; | ||
776 | rio_driver2->type = TTY_DRIVER_TYPE_SERIAL; | ||
777 | rio_driver2->subtype = SERIAL_TYPE_NORMAL; | ||
778 | rio_driver2->init_termios = tty_std_termios; | ||
779 | rio_driver2->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
780 | rio_driver2->flags = TTY_DRIVER_REAL_RAW; | ||
781 | tty_set_operations(rio_driver2, &rio_ops); | ||
782 | |||
783 | rio_dprintk(RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); | ||
784 | |||
785 | if ((error = tty_register_driver(rio_driver))) | ||
786 | goto out2; | ||
787 | if ((error = tty_register_driver(rio_driver2))) | ||
788 | goto out3; | ||
789 | func_exit(); | ||
790 | return 0; | ||
791 | out3: | ||
792 | tty_unregister_driver(rio_driver); | ||
793 | out2: | ||
794 | put_tty_driver(rio_driver2); | ||
795 | out1: | ||
796 | put_tty_driver(rio_driver); | ||
797 | out: | ||
798 | printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error); | ||
799 | return 1; | ||
800 | } | ||
801 | |||
802 | static const struct tty_port_operations rio_port_ops = { | ||
803 | .carrier_raised = rio_carrier_raised, | ||
804 | }; | ||
805 | |||
806 | static int rio_init_datastructures(void) | ||
807 | { | ||
808 | int i; | ||
809 | struct Port *port; | ||
810 | func_enter(); | ||
811 | |||
812 | /* Many drivers statically allocate the maximum number of ports | ||
813 | There is no reason not to allocate them dynamically. Is there? -- REW */ | ||
814 | /* However, the RIO driver allows users to configure their first | ||
815 | RTA as the ports numbered 504-511. We therefore need to allocate | ||
816 | the whole range. :-( -- REW */ | ||
817 | |||
818 | #define RI_SZ sizeof(struct rio_info) | ||
819 | #define HOST_SZ sizeof(struct Host) | ||
820 | #define PORT_SZ sizeof(struct Port *) | ||
821 | #define TMIO_SZ sizeof(struct termios *) | ||
822 | rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); | ||
823 | |||
824 | if (!(p = kzalloc(RI_SZ, GFP_KERNEL))) | ||
825 | goto free0; | ||
826 | if (!(p->RIOHosts = kzalloc(RIO_HOSTS * HOST_SZ, GFP_KERNEL))) | ||
827 | goto free1; | ||
828 | if (!(p->RIOPortp = kzalloc(RIO_PORTS * PORT_SZ, GFP_KERNEL))) | ||
829 | goto free2; | ||
830 | p->RIOConf = RIOConf; | ||
831 | rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp); | ||
832 | |||
833 | #if 1 | ||
834 | for (i = 0; i < RIO_PORTS; i++) { | ||
835 | port = p->RIOPortp[i] = kzalloc(sizeof(struct Port), GFP_KERNEL); | ||
836 | if (!port) { | ||
837 | goto free6; | ||
838 | } | ||
839 | rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); | ||
840 | tty_port_init(&port->gs.port); | ||
841 | port->gs.port.ops = &rio_port_ops; | ||
842 | port->PortNum = i; | ||
843 | port->gs.magic = RIO_MAGIC; | ||
844 | port->gs.close_delay = HZ / 2; | ||
845 | port->gs.closing_wait = 30 * HZ; | ||
846 | port->gs.rd = &rio_real_driver; | ||
847 | spin_lock_init(&port->portSem); | ||
848 | } | ||
849 | #else | ||
850 | /* We could postpone initializing them to when they are configured. */ | ||
851 | #endif | ||
852 | |||
853 | |||
854 | |||
855 | if (rio_debug & RIO_DEBUG_INIT) { | ||
856 | my_hd(&rio_real_driver, sizeof(rio_real_driver)); | ||
857 | } | ||
858 | |||
859 | |||
860 | func_exit(); | ||
861 | return 0; | ||
862 | |||
863 | free6:for (i--; i >= 0; i--) | ||
864 | kfree(p->RIOPortp[i]); | ||
865 | /*free5: | ||
866 | free4: | ||
867 | free3:*/ kfree(p->RIOPortp); | ||
868 | free2:kfree(p->RIOHosts); | ||
869 | free1: | ||
870 | rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp); | ||
871 | kfree(p); | ||
872 | free0: | ||
873 | return -ENOMEM; | ||
874 | } | ||
875 | |||
876 | static void __exit rio_release_drivers(void) | ||
877 | { | ||
878 | func_enter(); | ||
879 | tty_unregister_driver(rio_driver2); | ||
880 | tty_unregister_driver(rio_driver); | ||
881 | put_tty_driver(rio_driver2); | ||
882 | put_tty_driver(rio_driver); | ||
883 | func_exit(); | ||
884 | } | ||
885 | |||
886 | |||
887 | #ifdef CONFIG_PCI | ||
888 | /* This was written for SX, but applies to RIO too... | ||
889 | (including bugs....) | ||
890 | |||
891 | There is another bit besides Bit 17. Turning that bit off | ||
892 | (on boards shipped with the fix in the eeprom) results in a | ||
893 | hang on the next access to the card. | ||
894 | */ | ||
895 | |||
896 | /******************************************************** | ||
897 | * Setting bit 17 in the CNTRL register of the PLX 9050 * | ||
898 | * chip forces a retry on writes while a read is pending.* | ||
899 | * This is to prevent the card locking up on Intel Xeon * | ||
900 | * multiprocessor systems with the NX chipset. -- NV * | ||
901 | ********************************************************/ | ||
902 | |||
903 | /* Newer cards are produced with this bit set from the configuration | ||
904 | EEprom. As the bit is read/write for the CPU, we can fix it here, | ||
905 | if we detect that it isn't set correctly. -- REW */ | ||
906 | |||
907 | static void fix_rio_pci(struct pci_dev *pdev) | ||
908 | { | ||
909 | unsigned long hwbase; | ||
910 | unsigned char __iomem *rebase; | ||
911 | unsigned int t; | ||
912 | |||
913 | #define CNTRL_REG_OFFSET 0x50 | ||
914 | #define CNTRL_REG_GOODVALUE 0x18260000 | ||
915 | |||
916 | hwbase = pci_resource_start(pdev, 0); | ||
917 | rebase = ioremap(hwbase, 0x80); | ||
918 | t = readl(rebase + CNTRL_REG_OFFSET); | ||
919 | if (t != CNTRL_REG_GOODVALUE) { | ||
920 | printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); | ||
921 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | ||
922 | } | ||
923 | iounmap(rebase); | ||
924 | } | ||
925 | #endif | ||
926 | |||
927 | |||
928 | static int __init rio_init(void) | ||
929 | { | ||
930 | int found = 0; | ||
931 | int i; | ||
932 | struct Host *hp; | ||
933 | int retval; | ||
934 | struct vpd_prom *vpdp; | ||
935 | int okboard; | ||
936 | |||
937 | #ifdef CONFIG_PCI | ||
938 | struct pci_dev *pdev = NULL; | ||
939 | unsigned short tshort; | ||
940 | #endif | ||
941 | |||
942 | func_enter(); | ||
943 | rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug); | ||
944 | |||
945 | if (abs((long) (&rio_debug) - rio_debug) < 0x10000) { | ||
946 | printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); | ||
947 | rio_debug = -1; | ||
948 | } | ||
949 | |||
950 | if (misc_register(&rio_fw_device) < 0) { | ||
951 | printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); | ||
952 | return -EIO; | ||
953 | } | ||
954 | |||
955 | retval = rio_init_datastructures(); | ||
956 | if (retval < 0) { | ||
957 | misc_deregister(&rio_fw_device); | ||
958 | return retval; | ||
959 | } | ||
960 | #ifdef CONFIG_PCI | ||
961 | /* First look for the JET devices: */ | ||
962 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { | ||
963 | u32 tint; | ||
964 | |||
965 | if (pci_enable_device(pdev)) | ||
966 | continue; | ||
967 | |||
968 | /* Specialix has a whole bunch of cards with | ||
969 | 0x2000 as the device ID. They say its because | ||
970 | the standard requires it. Stupid standard. */ | ||
971 | /* It seems that reading a word doesn't work reliably on 2.0. | ||
972 | Also, reading a non-aligned dword doesn't work. So we read the | ||
973 | whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) | ||
974 | ourselves */ | ||
975 | pci_read_config_dword(pdev, 0x2c, &tint); | ||
976 | tshort = (tint >> 16) & 0xffff; | ||
977 | rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); | ||
978 | if (tshort != 0x0100) { | ||
979 | rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort); | ||
980 | continue; | ||
981 | } | ||
982 | rio_dprintk(RIO_DEBUG_PROBE, "cp1\n"); | ||
983 | |||
984 | hp = &p->RIOHosts[p->RIONumHosts]; | ||
985 | hp->PaddrP = pci_resource_start(pdev, 2); | ||
986 | hp->Ivec = pdev->irq; | ||
987 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | ||
988 | hp->Ivec = 0; | ||
989 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | ||
990 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; | ||
991 | hp->Type = RIO_PCI; | ||
992 | hp->Copy = rio_copy_to_card; | ||
993 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | ||
994 | spin_lock_init(&hp->HostLock); | ||
995 | rio_reset_interrupt(hp); | ||
996 | rio_start_card_running(hp); | ||
997 | |||
998 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); | ||
999 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { | ||
1000 | rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); | ||
1001 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); | ||
1002 | p->RIOHosts[p->RIONumHosts].UniqueNum = | ||
1003 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | | ||
1004 | ((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); | ||
1005 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | ||
1006 | |||
1007 | fix_rio_pci(pdev); | ||
1008 | |||
1009 | p->RIOHosts[p->RIONumHosts].pdev = pdev; | ||
1010 | pci_dev_get(pdev); | ||
1011 | |||
1012 | p->RIOLastPCISearch = 0; | ||
1013 | p->RIONumHosts++; | ||
1014 | found++; | ||
1015 | } else { | ||
1016 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); | ||
1017 | p->RIOHosts[p->RIONumHosts].Caddr = NULL; | ||
1018 | } | ||
1019 | } | ||
1020 | |||
1021 | /* Then look for the older PCI card.... : */ | ||
1022 | |||
1023 | /* These older PCI cards have problems (only byte-mode access is | ||
1024 | supported), which makes them a bit awkward to support. | ||
1025 | They also have problems sharing interrupts. Be careful. | ||
1026 | (The driver now refuses to share interrupts for these | ||
1027 | cards. This should be sufficient). | ||
1028 | */ | ||
1029 | |||
1030 | /* Then look for the older RIO/PCI devices: */ | ||
1031 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) { | ||
1032 | if (pci_enable_device(pdev)) | ||
1033 | continue; | ||
1034 | |||
1035 | #ifdef CONFIG_RIO_OLDPCI | ||
1036 | hp = &p->RIOHosts[p->RIONumHosts]; | ||
1037 | hp->PaddrP = pci_resource_start(pdev, 0); | ||
1038 | hp->Ivec = pdev->irq; | ||
1039 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | ||
1040 | hp->Ivec = 0; | ||
1041 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ | ||
1042 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | ||
1043 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; | ||
1044 | hp->Type = RIO_PCI; | ||
1045 | hp->Copy = rio_copy_to_card; | ||
1046 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | ||
1047 | spin_lock_init(&hp->HostLock); | ||
1048 | |||
1049 | rio_dprintk(RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); | ||
1050 | rio_dprintk(RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); | ||
1051 | |||
1052 | rio_reset_interrupt(hp); | ||
1053 | rio_start_card_running(hp); | ||
1054 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); | ||
1055 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { | ||
1056 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); | ||
1057 | p->RIOHosts[p->RIONumHosts].UniqueNum = | ||
1058 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | | ||
1059 | ((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); | ||
1060 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | ||
1061 | |||
1062 | p->RIOHosts[p->RIONumHosts].pdev = pdev; | ||
1063 | pci_dev_get(pdev); | ||
1064 | |||
1065 | p->RIOLastPCISearch = 0; | ||
1066 | p->RIONumHosts++; | ||
1067 | found++; | ||
1068 | } else { | ||
1069 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); | ||
1070 | p->RIOHosts[p->RIONumHosts].Caddr = NULL; | ||
1071 | } | ||
1072 | #else | ||
1073 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); | ||
1074 | #endif | ||
1075 | } | ||
1076 | #endif /* PCI */ | ||
1077 | |||
1078 | /* Now probe for ISA cards... */ | ||
1079 | for (i = 0; i < NR_RIO_ADDRS; i++) { | ||
1080 | hp = &p->RIOHosts[p->RIONumHosts]; | ||
1081 | hp->PaddrP = rio_probe_addrs[i]; | ||
1082 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ | ||
1083 | hp->Ivec = 0; | ||
1084 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | ||
1085 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; | ||
1086 | hp->Type = RIO_AT; | ||
1087 | hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL | ||
1088 | * -- YES! this is now a normal copy. Only the | ||
1089 | * old PCI card uses the special PCI copy. | ||
1090 | * Moreover, the ISA card will work with the | ||
1091 | * special PCI copy anyway. -- REW */ | ||
1092 | hp->Mode = 0; | ||
1093 | spin_lock_init(&hp->HostLock); | ||
1094 | |||
1095 | vpdp = get_VPD_PROM(hp); | ||
1096 | rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n"); | ||
1097 | okboard = 0; | ||
1098 | if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { | ||
1099 | /* Board is present... */ | ||
1100 | if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == 0) { | ||
1101 | /* ... and feeling fine!!!! */ | ||
1102 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | ||
1103 | if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { | ||
1104 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum); | ||
1105 | okboard++; | ||
1106 | found++; | ||
1107 | } | ||
1108 | } | ||
1109 | |||
1110 | if (!okboard) { | ||
1111 | iounmap(hp->Caddr); | ||
1112 | hp->Caddr = NULL; | ||
1113 | } | ||
1114 | } | ||
1115 | } | ||
1116 | |||
1117 | |||
1118 | for (i = 0; i < p->RIONumHosts; i++) { | ||
1119 | hp = &p->RIOHosts[i]; | ||
1120 | if (hp->Ivec) { | ||
1121 | int mode = IRQF_SHARED; | ||
1122 | if (hp->Ivec & 0x8000) { | ||
1123 | mode = 0; | ||
1124 | hp->Ivec &= 0x7fff; | ||
1125 | } | ||
1126 | rio_dprintk(RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp, hp->Ivec, hp->Mode); | ||
1127 | retval = request_irq(hp->Ivec, rio_interrupt, mode, "rio", hp); | ||
1128 | rio_dprintk(RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); | ||
1129 | if (retval) { | ||
1130 | printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); | ||
1131 | hp->Ivec = 0; | ||
1132 | } | ||
1133 | rio_dprintk(RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); | ||
1134 | if (hp->Ivec != 0) { | ||
1135 | rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); | ||
1136 | hp->Mode |= RIO_PCI_INT_ENABLE; | ||
1137 | } else | ||
1138 | hp->Mode &= ~RIO_PCI_INT_ENABLE; | ||
1139 | rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); | ||
1140 | rio_start_card_running(hp); | ||
1141 | } | ||
1142 | /* Init the timer "always" to make sure that it can safely be | ||
1143 | deleted when we unload... */ | ||
1144 | |||
1145 | setup_timer(&hp->timer, rio_pollfunc, i); | ||
1146 | if (!hp->Ivec) { | ||
1147 | rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); | ||
1148 | mod_timer(&hp->timer, jiffies + rio_poll); | ||
1149 | } | ||
1150 | } | ||
1151 | |||
1152 | if (found) { | ||
1153 | rio_dprintk(RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); | ||
1154 | rio_init_drivers(); | ||
1155 | } else { | ||
1156 | /* deregister the misc device we created earlier */ | ||
1157 | misc_deregister(&rio_fw_device); | ||
1158 | } | ||
1159 | |||
1160 | func_exit(); | ||
1161 | return found ? 0 : -EIO; | ||
1162 | } | ||
1163 | |||
1164 | |||
1165 | static void __exit rio_exit(void) | ||
1166 | { | ||
1167 | int i; | ||
1168 | struct Host *hp; | ||
1169 | |||
1170 | func_enter(); | ||
1171 | |||
1172 | for (i = 0, hp = p->RIOHosts; i < p->RIONumHosts; i++, hp++) { | ||
1173 | RIOHostReset(hp->Type, hp->CardP, hp->Slot); | ||
1174 | if (hp->Ivec) { | ||
1175 | free_irq(hp->Ivec, hp); | ||
1176 | rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); | ||
1177 | } | ||
1178 | /* It is safe/allowed to del_timer a non-active timer */ | ||
1179 | del_timer_sync(&hp->timer); | ||
1180 | if (hp->Caddr) | ||
1181 | iounmap(hp->Caddr); | ||
1182 | if (hp->Type == RIO_PCI) | ||
1183 | pci_dev_put(hp->pdev); | ||
1184 | } | ||
1185 | |||
1186 | if (misc_deregister(&rio_fw_device) < 0) { | ||
1187 | printk(KERN_INFO "rio: couldn't deregister control-device\n"); | ||
1188 | } | ||
1189 | |||
1190 | |||
1191 | rio_dprintk(RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); | ||
1192 | |||
1193 | rio_release_drivers(); | ||
1194 | |||
1195 | /* Release dynamically allocated memory */ | ||
1196 | kfree(p->RIOPortp); | ||
1197 | kfree(p->RIOHosts); | ||
1198 | kfree(p); | ||
1199 | |||
1200 | func_exit(); | ||
1201 | } | ||
1202 | |||
1203 | module_init(rio_init); | ||
1204 | module_exit(rio_exit); | ||
diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h deleted file mode 100644 index 7f26cd7c815e..000000000000 --- a/drivers/char/rio/rio_linux.h +++ /dev/null | |||
@@ -1,197 +0,0 @@ | |||
1 | |||
2 | /* | ||
3 | * rio_linux.h | ||
4 | * | ||
5 | * Copyright (C) 1998,1999,2000 R.E.Wolff@BitWizard.nl | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | * | ||
21 | * RIO serial driver. | ||
22 | * | ||
23 | * Version 1.0 -- July, 1999. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #define RIO_NBOARDS 4 | ||
28 | #define RIO_PORTSPERBOARD 128 | ||
29 | #define RIO_NPORTS (RIO_NBOARDS * RIO_PORTSPERBOARD) | ||
30 | |||
31 | #define MODEM_SUPPORT | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | #define RIO_MAGIC 0x12345678 | ||
36 | |||
37 | |||
38 | struct vpd_prom { | ||
39 | unsigned short id; | ||
40 | char hwrev; | ||
41 | char hwass; | ||
42 | int uniqid; | ||
43 | char myear; | ||
44 | char mweek; | ||
45 | char hw_feature[5]; | ||
46 | char oem_id; | ||
47 | char identifier[16]; | ||
48 | }; | ||
49 | |||
50 | |||
51 | #define RIO_DEBUG_ALL 0xffffffff | ||
52 | |||
53 | #define O_OTHER(tty) \ | ||
54 | ((O_OLCUC(tty)) ||\ | ||
55 | (O_ONLCR(tty)) ||\ | ||
56 | (O_OCRNL(tty)) ||\ | ||
57 | (O_ONOCR(tty)) ||\ | ||
58 | (O_ONLRET(tty)) ||\ | ||
59 | (O_OFILL(tty)) ||\ | ||
60 | (O_OFDEL(tty)) ||\ | ||
61 | (O_NLDLY(tty)) ||\ | ||
62 | (O_CRDLY(tty)) ||\ | ||
63 | (O_TABDLY(tty)) ||\ | ||
64 | (O_BSDLY(tty)) ||\ | ||
65 | (O_VTDLY(tty)) ||\ | ||
66 | (O_FFDLY(tty))) | ||
67 | |||
68 | /* Same for input. */ | ||
69 | #define I_OTHER(tty) \ | ||
70 | ((I_INLCR(tty)) ||\ | ||
71 | (I_IGNCR(tty)) ||\ | ||
72 | (I_ICRNL(tty)) ||\ | ||
73 | (I_IUCLC(tty)) ||\ | ||
74 | (L_ISIG(tty))) | ||
75 | |||
76 | |||
77 | #endif /* __KERNEL__ */ | ||
78 | |||
79 | |||
80 | #define RIO_BOARD_INTR_LOCK 1 | ||
81 | |||
82 | |||
83 | #ifndef RIOCTL_MISC_MINOR | ||
84 | /* Allow others to gather this into "major.h" or something like that */ | ||
85 | #define RIOCTL_MISC_MINOR 169 | ||
86 | #endif | ||
87 | |||
88 | |||
89 | /* Allow us to debug "in the field" without requiring clients to | ||
90 | recompile.... */ | ||
91 | #if 1 | ||
92 | #define rio_spin_lock_irqsave(sem, flags) do { \ | ||
93 | rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \ | ||
94 | sem, __FILE__, __LINE__);\ | ||
95 | spin_lock_irqsave(sem, flags);\ | ||
96 | } while (0) | ||
97 | |||
98 | #define rio_spin_unlock_irqrestore(sem, flags) do { \ | ||
99 | rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\ | ||
100 | sem, __FILE__, __LINE__);\ | ||
101 | spin_unlock_irqrestore(sem, flags);\ | ||
102 | } while (0) | ||
103 | |||
104 | #define rio_spin_lock(sem) do { \ | ||
105 | rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\ | ||
106 | sem, __FILE__, __LINE__);\ | ||
107 | spin_lock(sem);\ | ||
108 | } while (0) | ||
109 | |||
110 | #define rio_spin_unlock(sem) do { \ | ||
111 | rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\ | ||
112 | sem, __FILE__, __LINE__);\ | ||
113 | spin_unlock(sem);\ | ||
114 | } while (0) | ||
115 | #else | ||
116 | #define rio_spin_lock_irqsave(sem, flags) \ | ||
117 | spin_lock_irqsave(sem, flags) | ||
118 | |||
119 | #define rio_spin_unlock_irqrestore(sem, flags) \ | ||
120 | spin_unlock_irqrestore(sem, flags) | ||
121 | |||
122 | #define rio_spin_lock(sem) \ | ||
123 | spin_lock(sem) | ||
124 | |||
125 | #define rio_spin_unlock(sem) \ | ||
126 | spin_unlock(sem) | ||
127 | |||
128 | #endif | ||
129 | |||
130 | |||
131 | |||
132 | #ifdef CONFIG_RIO_OLDPCI | ||
133 | static inline void __iomem *rio_memcpy_toio(void __iomem *dummy, void __iomem *dest, void *source, int n) | ||
134 | { | ||
135 | char __iomem *dst = dest; | ||
136 | char *src = source; | ||
137 | |||
138 | while (n--) { | ||
139 | writeb(*src++, dst++); | ||
140 | (void) readb(dummy); | ||
141 | } | ||
142 | |||
143 | return dest; | ||
144 | } | ||
145 | |||
146 | static inline void __iomem *rio_copy_toio(void __iomem *dest, void *source, int n) | ||
147 | { | ||
148 | char __iomem *dst = dest; | ||
149 | char *src = source; | ||
150 | |||
151 | while (n--) | ||
152 | writeb(*src++, dst++); | ||
153 | |||
154 | return dest; | ||
155 | } | ||
156 | |||
157 | |||
158 | static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n) | ||
159 | { | ||
160 | char *dst = dest; | ||
161 | char __iomem *src = source; | ||
162 | |||
163 | while (n--) | ||
164 | *dst++ = readb(src++); | ||
165 | |||
166 | return dest; | ||
167 | } | ||
168 | |||
169 | #else | ||
170 | #define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n) | ||
171 | #define rio_copy_toio memcpy_toio | ||
172 | #define rio_memcpy_fromio memcpy_fromio | ||
173 | #endif | ||
174 | |||
175 | #define DEBUG 1 | ||
176 | |||
177 | |||
178 | /* | ||
179 | This driver can spew a whole lot of debugging output at you. If you | ||
180 | need maximum performance, you should disable the DEBUG define. To | ||
181 | aid in debugging in the field, I'm leaving the compile-time debug | ||
182 | features enabled, and disable them "runtime". That allows me to | ||
183 | instruct people with problems to enable debugging without requiring | ||
184 | them to recompile... | ||
185 | */ | ||
186 | |||
187 | #ifdef DEBUG | ||
188 | #define rio_dprintk(f, str...) do { if (rio_debug & f) printk (str);} while (0) | ||
189 | #define func_enter() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s\n", __func__) | ||
190 | #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __func__) | ||
191 | #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__func__, port->line) | ||
192 | #else | ||
193 | #define rio_dprintk(f, str...) /* nothing */ | ||
194 | #define func_enter() | ||
195 | #define func_exit() | ||
196 | #define func_enter2() | ||
197 | #endif | ||
diff --git a/drivers/char/rio/rioboard.h b/drivers/char/rio/rioboard.h deleted file mode 100644 index 252230043c82..000000000000 --- a/drivers/char/rio/rioboard.h +++ /dev/null | |||
@@ -1,275 +0,0 @@ | |||
1 | /************************************************************************/ | ||
2 | /* */ | ||
3 | /* Title : RIO Host Card Hardware Definitions */ | ||
4 | /* */ | ||
5 | /* Author : N.P.Vassallo */ | ||
6 | /* */ | ||
7 | /* Creation : 26th April 1999 */ | ||
8 | /* */ | ||
9 | /* Version : 1.0.0 */ | ||
10 | /* */ | ||
11 | /* Copyright : (c) Specialix International Ltd. 1999 * | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | * */ | ||
27 | /* Description : Prototypes, structures and definitions */ | ||
28 | /* describing the RIO board hardware */ | ||
29 | /* */ | ||
30 | /************************************************************************/ | ||
31 | |||
32 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ | ||
33 | #define _rioboard_h 1 | ||
34 | |||
35 | /***************************************************************************** | ||
36 | *********************** *********************** | ||
37 | *********************** Hardware Control Registers *********************** | ||
38 | *********************** *********************** | ||
39 | *****************************************************************************/ | ||
40 | |||
41 | /* Hardware Registers... */ | ||
42 | |||
43 | #define RIO_REG_BASE 0x7C00 /* Base of control registers */ | ||
44 | |||
45 | #define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */ | ||
46 | #define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */ | ||
47 | #define RIO_RESET RIO_REG_BASE + 0x0100 /* WRITE: Host Reset */ | ||
48 | #define RIO_INTRESET RIO_REG_BASE + 0x0180 /* WRITE: Interrupt Reset */ | ||
49 | |||
50 | #define RIO_VPD_ROM RIO_REG_BASE + 0x0000 /* READ: Vital Product Data ROM */ | ||
51 | #define RIO_INTSTAT RIO_REG_BASE + 0x0080 /* READ: Interrupt Status (Jet boards only) */ | ||
52 | #define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */ | ||
53 | |||
54 | /* RIO_VPD_ROM definitions... */ | ||
55 | #define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */ | ||
56 | #define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */ | ||
57 | #define VPD_HW_REV 0x02 /* READ: Hardware Revision */ | ||
58 | #define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */ | ||
59 | #define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */ | ||
60 | #define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */ | ||
61 | #define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */ | ||
62 | #define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */ | ||
63 | #define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */ | ||
64 | #define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */ | ||
65 | #define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */ | ||
66 | #define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */ | ||
67 | #define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */ | ||
68 | #define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */ | ||
69 | #define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */ | ||
70 | #define VPD_OEMID 0x0F /* READ: OEM Identifier */ | ||
71 | #define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */ | ||
72 | #define VPD_IDENT_LEN 0x10 | ||
73 | |||
74 | /* VPD ROM Definitions... */ | ||
75 | #define SLX_ID1 0x4D | ||
76 | #define SLX_ID2 0x98 | ||
77 | |||
78 | #define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */ | ||
79 | |||
80 | #define ID_SX_ISA 0x2 | ||
81 | #define ID_RIO_EISA 0x3 | ||
82 | #define ID_SX_PCI 0x5 | ||
83 | #define ID_SX_EISA 0x7 | ||
84 | #define ID_RIO_RTA16 0x9 | ||
85 | #define ID_RIO_ISA 0xA | ||
86 | #define ID_RIO_MCA 0xB | ||
87 | #define ID_RIO_SBUS 0xC | ||
88 | #define ID_RIO_PCI 0xD | ||
89 | #define ID_RIO_RTA8 0xE | ||
90 | |||
91 | /* Transputer bootstrap definitions... */ | ||
92 | |||
93 | #define BOOTLOADADDR (0x8000 - 6) | ||
94 | #define BOOTINDICATE (0x8000 - 2) | ||
95 | |||
96 | /* Firmware load position... */ | ||
97 | |||
98 | #define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */ | ||
99 | |||
100 | /***************************************************************************** | ||
101 | ***************************** ***************************** | ||
102 | ***************************** RIO (Rev1) ISA ***************************** | ||
103 | ***************************** ***************************** | ||
104 | *****************************************************************************/ | ||
105 | |||
106 | /* Control Register Definitions... */ | ||
107 | #define RIO_ISA_IDENT "JBJGPGGHINSMJPJR" | ||
108 | |||
109 | #define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
110 | #define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
111 | #define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */ | ||
112 | #define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | ||
113 | #define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | ||
114 | #define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | ||
115 | #define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | ||
116 | #define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | ||
117 | |||
118 | /***************************************************************************** | ||
119 | ***************************** ***************************** | ||
120 | ***************************** RIO (Rev2) ISA ***************************** | ||
121 | ***************************** ***************************** | ||
122 | *****************************************************************************/ | ||
123 | |||
124 | /* Control Register Definitions... */ | ||
125 | #define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR" | ||
126 | |||
127 | #define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
128 | #define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
129 | #define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | ||
130 | #define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */ | ||
131 | #define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */ | ||
132 | #define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */ | ||
133 | #define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | ||
134 | #define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | ||
135 | #define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | ||
136 | #define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | ||
137 | #define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | ||
138 | |||
139 | /***************************************************************************** | ||
140 | ***************************** ****************************** | ||
141 | ***************************** RIO (Jet) ISA ****************************** | ||
142 | ***************************** ****************************** | ||
143 | *****************************************************************************/ | ||
144 | |||
145 | /* Control Register Definitions... */ | ||
146 | #define RIO_ISA3_IDENT "JET HOST BY KEV#" | ||
147 | |||
148 | #define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
149 | #define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | ||
150 | #define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */ | ||
151 | #define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | ||
152 | #define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | ||
153 | #define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | ||
154 | #define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | ||
155 | #define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | ||
156 | |||
157 | /***************************************************************************** | ||
158 | ********************************* ******************************** | ||
159 | ********************************* RIO MCA ******************************** | ||
160 | ********************************* ******************************** | ||
161 | *****************************************************************************/ | ||
162 | |||
163 | /* Control Register Definitions... */ | ||
164 | #define RIO_MCA_IDENT "JBJGPGGHINSMJPJR" | ||
165 | |||
166 | #define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
167 | #define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
168 | #define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | ||
169 | |||
170 | /***************************************************************************** | ||
171 | ******************************** ******************************** | ||
172 | ******************************** RIO EISA ******************************** | ||
173 | ******************************** ******************************** | ||
174 | *****************************************************************************/ | ||
175 | |||
176 | /* EISA Configuration Space Definitions... */ | ||
177 | #define EISA_PRODUCT_ID1 0xC80 | ||
178 | #define EISA_PRODUCT_ID2 0xC81 | ||
179 | #define EISA_PRODUCT_NUMBER 0xC82 | ||
180 | #define EISA_REVISION_NUMBER 0xC83 | ||
181 | #define EISA_CARD_ENABLE 0xC84 | ||
182 | #define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */ | ||
183 | #define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */ | ||
184 | #define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */ | ||
185 | #define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */ | ||
186 | #define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */ | ||
187 | #define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */ | ||
188 | #define EISA_MEM_ADDR_23_16 0xC00 | ||
189 | #define EISA_MEM_ADDR_31_24 0xC01 | ||
190 | #define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */ | ||
191 | #define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */ | ||
192 | #define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */ | ||
193 | |||
194 | /* Control Register Definitions... */ | ||
195 | #define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
196 | #define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */ | ||
197 | #define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */ | ||
198 | #define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */ | ||
199 | #define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */ | ||
200 | #define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | ||
201 | #define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */ | ||
202 | #define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | ||
203 | #define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | ||
204 | #define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | ||
205 | #define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | ||
206 | #define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */ | ||
207 | #define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */ | ||
208 | #define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */ | ||
209 | #define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */ | ||
210 | #define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */ | ||
211 | |||
212 | /***************************************************************************** | ||
213 | ******************************** ******************************** | ||
214 | ******************************** RIO SBus ******************************** | ||
215 | ******************************** ******************************** | ||
216 | *****************************************************************************/ | ||
217 | |||
218 | /* Control Register Definitions... */ | ||
219 | #define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0" | ||
220 | |||
221 | #define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
222 | #define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
223 | #define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | ||
224 | #define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */ | ||
225 | #define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */ | ||
226 | #define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */ | ||
227 | #define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */ | ||
228 | #define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */ | ||
229 | #define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */ | ||
230 | #define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */ | ||
231 | #define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */ | ||
232 | #define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */ | ||
233 | #define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | ||
234 | #define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | ||
235 | |||
236 | /***************************************************************************** | ||
237 | ********************************* ******************************** | ||
238 | ********************************* RIO PCI ******************************** | ||
239 | ********************************* ******************************** | ||
240 | *****************************************************************************/ | ||
241 | |||
242 | /* Control Register Definitions... */ | ||
243 | #define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#" | ||
244 | |||
245 | #define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | ||
246 | #define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
247 | #define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | ||
248 | #define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | ||
249 | #define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | ||
250 | |||
251 | /* PCI Definitions... */ | ||
252 | #define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */ | ||
253 | #define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */ | ||
254 | #define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */ | ||
255 | #define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */ | ||
256 | #define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */ | ||
257 | |||
258 | /***************************************************************************** | ||
259 | ***************************** ****************************** | ||
260 | ***************************** RIO (Jet) PCI ****************************** | ||
261 | ***************************** ****************************** | ||
262 | *****************************************************************************/ | ||
263 | |||
264 | /* Control Register Definitions... */ | ||
265 | #define RIO_PCI2_IDENT "JET HOST BY KEV#" | ||
266 | |||
267 | #define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | ||
268 | #define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | ||
269 | |||
270 | /* PCI Definitions... */ | ||
271 | #define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */ | ||
272 | |||
273 | #endif /*_rioboard_h */ | ||
274 | |||
275 | /* End of RIOBOARD.H */ | ||
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c deleted file mode 100644 index d956dd316005..000000000000 --- a/drivers/char/rio/rioboot.c +++ /dev/null | |||
@@ -1,1113 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioboot.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:36 | ||
26 | ** Retrieved : 11/6/98 10:33:48 | ||
27 | ** | ||
28 | ** ident @(#)rioboot.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/slab.h> | ||
35 | #include <linux/termios.h> | ||
36 | #include <linux/serial.h> | ||
37 | #include <linux/vmalloc.h> | ||
38 | #include <linux/generic_serial.h> | ||
39 | #include <linux/errno.h> | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <linux/delay.h> | ||
42 | #include <asm/io.h> | ||
43 | #include <asm/system.h> | ||
44 | #include <asm/string.h> | ||
45 | #include <asm/uaccess.h> | ||
46 | |||
47 | |||
48 | #include "linux_compat.h" | ||
49 | #include "rio_linux.h" | ||
50 | #include "pkt.h" | ||
51 | #include "daemon.h" | ||
52 | #include "rio.h" | ||
53 | #include "riospace.h" | ||
54 | #include "cmdpkt.h" | ||
55 | #include "map.h" | ||
56 | #include "rup.h" | ||
57 | #include "port.h" | ||
58 | #include "riodrvr.h" | ||
59 | #include "rioinfo.h" | ||
60 | #include "func.h" | ||
61 | #include "errors.h" | ||
62 | #include "pci.h" | ||
63 | |||
64 | #include "parmmap.h" | ||
65 | #include "unixrup.h" | ||
66 | #include "board.h" | ||
67 | #include "host.h" | ||
68 | #include "phb.h" | ||
69 | #include "link.h" | ||
70 | #include "cmdblk.h" | ||
71 | #include "route.h" | ||
72 | |||
73 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd __iomem *PktCmdP); | ||
74 | |||
75 | static const unsigned char RIOAtVec2Ctrl[] = { | ||
76 | /* 0 */ INTERRUPT_DISABLE, | ||
77 | /* 1 */ INTERRUPT_DISABLE, | ||
78 | /* 2 */ INTERRUPT_DISABLE, | ||
79 | /* 3 */ INTERRUPT_DISABLE, | ||
80 | /* 4 */ INTERRUPT_DISABLE, | ||
81 | /* 5 */ INTERRUPT_DISABLE, | ||
82 | /* 6 */ INTERRUPT_DISABLE, | ||
83 | /* 7 */ INTERRUPT_DISABLE, | ||
84 | /* 8 */ INTERRUPT_DISABLE, | ||
85 | /* 9 */ IRQ_9 | INTERRUPT_ENABLE, | ||
86 | /* 10 */ INTERRUPT_DISABLE, | ||
87 | /* 11 */ IRQ_11 | INTERRUPT_ENABLE, | ||
88 | /* 12 */ IRQ_12 | INTERRUPT_ENABLE, | ||
89 | /* 13 */ INTERRUPT_DISABLE, | ||
90 | /* 14 */ INTERRUPT_DISABLE, | ||
91 | /* 15 */ IRQ_15 | INTERRUPT_ENABLE | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * RIOBootCodeRTA - Load RTA boot code | ||
96 | * @p: RIO to load | ||
97 | * @rbp: Download descriptor | ||
98 | * | ||
99 | * Called when the user process initiates booting of the card firmware. | ||
100 | * Lads the firmware | ||
101 | */ | ||
102 | |||
103 | int RIOBootCodeRTA(struct rio_info *p, struct DownLoad * rbp) | ||
104 | { | ||
105 | int offset; | ||
106 | |||
107 | func_enter(); | ||
108 | |||
109 | rio_dprintk(RIO_DEBUG_BOOT, "Data at user address %p\n", rbp->DataP); | ||
110 | |||
111 | /* | ||
112 | ** Check that we have set asside enough memory for this | ||
113 | */ | ||
114 | if (rbp->Count > SIXTY_FOUR_K) { | ||
115 | rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); | ||
116 | p->RIOError.Error = HOST_FILE_TOO_LARGE; | ||
117 | func_exit(); | ||
118 | return -ENOMEM; | ||
119 | } | ||
120 | |||
121 | if (p->RIOBooting) { | ||
122 | rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); | ||
123 | p->RIOError.Error = BOOT_IN_PROGRESS; | ||
124 | func_exit(); | ||
125 | return -EBUSY; | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | ** The data we load in must end on a (RTA_BOOT_DATA_SIZE) byte boundary, | ||
130 | ** so calculate how far we have to move the data up the buffer | ||
131 | ** to achieve this. | ||
132 | */ | ||
133 | offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % RTA_BOOT_DATA_SIZE; | ||
134 | |||
135 | /* | ||
136 | ** Be clean, and clear the 'unused' portion of the boot buffer, | ||
137 | ** because it will (eventually) be part of the Rta run time environment | ||
138 | ** and so should be zeroed. | ||
139 | */ | ||
140 | memset(p->RIOBootPackets, 0, offset); | ||
141 | |||
142 | /* | ||
143 | ** Copy the data from user space into the array | ||
144 | */ | ||
145 | |||
146 | if (copy_from_user(((u8 *)p->RIOBootPackets) + offset, rbp->DataP, rbp->Count)) { | ||
147 | rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n"); | ||
148 | p->RIOError.Error = COPYIN_FAILED; | ||
149 | func_exit(); | ||
150 | return -EFAULT; | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | ** Make sure that our copy of the size includes that offset we discussed | ||
155 | ** earlier. | ||
156 | */ | ||
157 | p->RIONumBootPkts = (rbp->Count + offset) / RTA_BOOT_DATA_SIZE; | ||
158 | p->RIOBootCount = rbp->Count; | ||
159 | |||
160 | func_exit(); | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * rio_start_card_running - host card start | ||
166 | * @HostP: The RIO to kick off | ||
167 | * | ||
168 | * Start a RIO processor unit running. Encapsulates the knowledge | ||
169 | * of the card type. | ||
170 | */ | ||
171 | |||
172 | void rio_start_card_running(struct Host *HostP) | ||
173 | { | ||
174 | switch (HostP->Type) { | ||
175 | case RIO_AT: | ||
176 | rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n"); | ||
177 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF], &HostP->Control); | ||
178 | break; | ||
179 | case RIO_PCI: | ||
180 | /* | ||
181 | ** PCI is much the same as MCA. Everything is once again memory | ||
182 | ** mapped, so we are writing to memory registers instead of io | ||
183 | ** ports. | ||
184 | */ | ||
185 | rio_dprintk(RIO_DEBUG_BOOT, "Start PCI card running\n"); | ||
186 | writeb(PCITpBootFromRam | PCITpBusEnable | HostP->Mode, &HostP->Control); | ||
187 | break; | ||
188 | default: | ||
189 | rio_dprintk(RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); | ||
190 | break; | ||
191 | } | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | ** Load in the host boot code - load it directly onto all halted hosts | ||
197 | ** of the correct type. | ||
198 | ** | ||
199 | ** Put your rubber pants on before messing with this code - even the magic | ||
200 | ** numbers have trouble understanding what they are doing here. | ||
201 | */ | ||
202 | |||
203 | int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | ||
204 | { | ||
205 | struct Host *HostP; | ||
206 | u8 __iomem *Cad; | ||
207 | PARM_MAP __iomem *ParmMapP; | ||
208 | int RupN; | ||
209 | int PortN; | ||
210 | unsigned int host; | ||
211 | u8 __iomem *StartP; | ||
212 | u8 __iomem *DestP; | ||
213 | int wait_count; | ||
214 | u16 OldParmMap; | ||
215 | u16 offset; /* It is very important that this is a u16 */ | ||
216 | u8 *DownCode = NULL; | ||
217 | unsigned long flags; | ||
218 | |||
219 | HostP = NULL; /* Assure the compiler we've initialized it */ | ||
220 | |||
221 | |||
222 | /* Walk the hosts */ | ||
223 | for (host = 0; host < p->RIONumHosts; host++) { | ||
224 | rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host); | ||
225 | HostP = &p->RIOHosts[host]; | ||
226 | |||
227 | rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec); | ||
228 | |||
229 | /* Don't boot hosts already running */ | ||
230 | if ((HostP->Flags & RUN_STATE) != RC_WAITING) { | ||
231 | rio_dprintk(RIO_DEBUG_BOOT, "%s %d already running\n", "Host", host); | ||
232 | continue; | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | ** Grab a pointer to the card (ioremapped) | ||
237 | */ | ||
238 | Cad = HostP->Caddr; | ||
239 | |||
240 | /* | ||
241 | ** We are going to (try) and load in rbp->Count bytes. | ||
242 | ** The last byte will reside at p->RIOConf.HostLoadBase-1; | ||
243 | ** Therefore, we need to start copying at address | ||
244 | ** (caddr+p->RIOConf.HostLoadBase-rbp->Count) | ||
245 | */ | ||
246 | StartP = &Cad[p->RIOConf.HostLoadBase - rbp->Count]; | ||
247 | |||
248 | rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for host is %p\n", Cad); | ||
249 | rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for download is %p\n", StartP); | ||
250 | rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); | ||
251 | rio_dprintk(RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); | ||
252 | |||
253 | /* Make sure it fits */ | ||
254 | if (p->RIOConf.HostLoadBase < rbp->Count) { | ||
255 | rio_dprintk(RIO_DEBUG_BOOT, "Bin too large\n"); | ||
256 | p->RIOError.Error = HOST_FILE_TOO_LARGE; | ||
257 | func_exit(); | ||
258 | return -EFBIG; | ||
259 | } | ||
260 | /* | ||
261 | ** Ensure that the host really is stopped. | ||
262 | ** Disable it's external bus & twang its reset line. | ||
263 | */ | ||
264 | RIOHostReset(HostP->Type, HostP->CardP, HostP->Slot); | ||
265 | |||
266 | /* | ||
267 | ** Copy the data directly from user space to the SRAM. | ||
268 | ** This ain't going to be none too clever if the download | ||
269 | ** code is bigger than this segment. | ||
270 | */ | ||
271 | rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n"); | ||
272 | |||
273 | /* Buffer to local memory as we want to use I/O space and | ||
274 | some cards only do 8 or 16 bit I/O */ | ||
275 | |||
276 | DownCode = vmalloc(rbp->Count); | ||
277 | if (!DownCode) { | ||
278 | p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; | ||
279 | func_exit(); | ||
280 | return -ENOMEM; | ||
281 | } | ||
282 | if (copy_from_user(DownCode, rbp->DataP, rbp->Count)) { | ||
283 | kfree(DownCode); | ||
284 | p->RIOError.Error = COPYIN_FAILED; | ||
285 | func_exit(); | ||
286 | return -EFAULT; | ||
287 | } | ||
288 | HostP->Copy(DownCode, StartP, rbp->Count); | ||
289 | vfree(DownCode); | ||
290 | |||
291 | rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n"); | ||
292 | |||
293 | /* | ||
294 | ** S T O P ! | ||
295 | ** | ||
296 | ** Upto this point the code has been fairly rational, and possibly | ||
297 | ** even straight forward. What follows is a pile of crud that will | ||
298 | ** magically turn into six bytes of transputer assembler. Normally | ||
299 | ** you would expect an array or something, but, being me, I have | ||
300 | ** chosen [been told] to use a technique whereby the startup code | ||
301 | ** will be correct if we change the loadbase for the code. Which | ||
302 | ** brings us onto another issue - the loadbase is the *end* of the | ||
303 | ** code, not the start. | ||
304 | ** | ||
305 | ** If I were you I wouldn't start from here. | ||
306 | */ | ||
307 | |||
308 | /* | ||
309 | ** We now need to insert a short boot section into | ||
310 | ** the memory at the end of Sram2. This is normally (de)composed | ||
311 | ** of the last eight bytes of the download code. The | ||
312 | ** download has been assembled/compiled to expect to be | ||
313 | ** loaded from 0x7FFF downwards. We have loaded it | ||
314 | ** at some other address. The startup code goes into the small | ||
315 | ** ram window at Sram2, in the last 8 bytes, which are really | ||
316 | ** at addresses 0x7FF8-0x7FFF. | ||
317 | ** | ||
318 | ** If the loadbase is, say, 0x7C00, then we need to branch to | ||
319 | ** address 0x7BFE to run the host.bin startup code. We assemble | ||
320 | ** this jump manually. | ||
321 | ** | ||
322 | ** The two byte sequence 60 08 is loaded into memory at address | ||
323 | ** 0x7FFE,F. This is a local branch to location 0x7FF8 (60 is nfix 0, | ||
324 | ** which adds '0' to the .O register, complements .O, and then shifts | ||
325 | ** it left by 4 bit positions, 08 is a jump .O+8 instruction. This will | ||
326 | ** add 8 to .O (which was 0xFFF0), and will branch RELATIVE to the new | ||
327 | ** location. Now, the branch starts from the value of .PC (or .IP or | ||
328 | ** whatever the bloody register is called on this chip), and the .PC | ||
329 | ** will be pointing to the location AFTER the branch, in this case | ||
330 | ** .PC == 0x8000, so the branch will be to 0x8000+0xFFF8 = 0x7FF8. | ||
331 | ** | ||
332 | ** A long branch is coded at 0x7FF8. This consists of loading a four | ||
333 | ** byte offset into .O using nfix (as above) and pfix operators. The | ||
334 | ** pfix operates in exactly the same way as the nfix operator, but | ||
335 | ** without the complement operation. The offset, of course, must be | ||
336 | ** relative to the address of the byte AFTER the branch instruction, | ||
337 | ** which will be (urm) 0x7FFC, so, our final destination of the branch | ||
338 | ** (loadbase-2), has to be reached from here. Imagine that the loadbase | ||
339 | ** is 0x7C00 (which it is), then we will need to branch to 0x7BFE (which | ||
340 | ** is the first byte of the initial two byte short local branch of the | ||
341 | ** download code). | ||
342 | ** | ||
343 | ** To code a jump from 0x7FFC (which is where the branch will start | ||
344 | ** from) to 0x7BFE, we will need to branch 0xFC02 bytes (0x7FFC+0xFC02)= | ||
345 | ** 0x7BFE. | ||
346 | ** This will be coded as four bytes: | ||
347 | ** 60 2C 20 02 | ||
348 | ** being nfix .O+0 | ||
349 | ** pfix .O+C | ||
350 | ** pfix .O+0 | ||
351 | ** jump .O+2 | ||
352 | ** | ||
353 | ** The nfix operator is used, so that the startup code will be | ||
354 | ** compatible with the whole Tp family. (lies, damn lies, it'll never | ||
355 | ** work in a month of Sundays). | ||
356 | ** | ||
357 | ** The nfix nyble is the 1s complement of the nyble value you | ||
358 | ** want to load - in this case we wanted 'F' so we nfix loaded '0'. | ||
359 | */ | ||
360 | |||
361 | |||
362 | /* | ||
363 | ** Dest points to the top 8 bytes of Sram2. The Tp jumps | ||
364 | ** to 0x7FFE at reset time, and starts executing. This is | ||
365 | ** a short branch to 0x7FF8, where a long branch is coded. | ||
366 | */ | ||
367 | |||
368 | DestP = &Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ | ||
369 | |||
370 | #define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ | ||
371 | #define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ | ||
372 | #define JUMP(N) (0x00 | (N)) /* .PC = .PC + .O */ | ||
373 | |||
374 | /* | ||
375 | ** 0x7FFC is the address of the location following the last byte of | ||
376 | ** the four byte jump instruction. | ||
377 | ** READ THE ABOVE COMMENTS | ||
378 | ** | ||
379 | ** offset is (TO-FROM) % MEMSIZE, but with compound buggering about. | ||
380 | ** Memsize is 64K for this range of Tp, so offset is a short (unsigned, | ||
381 | ** cos I don't understand 2's complement). | ||
382 | */ | ||
383 | offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC; | ||
384 | |||
385 | writeb(NFIX(((unsigned short) (~offset) >> (unsigned short) 12) & 0xF), DestP); | ||
386 | writeb(PFIX((offset >> 8) & 0xF), DestP + 1); | ||
387 | writeb(PFIX((offset >> 4) & 0xF), DestP + 2); | ||
388 | writeb(JUMP(offset & 0xF), DestP + 3); | ||
389 | |||
390 | writeb(NFIX(0), DestP + 6); | ||
391 | writeb(JUMP(8), DestP + 7); | ||
392 | |||
393 | rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); | ||
394 | rio_dprintk(RIO_DEBUG_BOOT, "startup offset is 0x%x\n", offset); | ||
395 | |||
396 | /* | ||
397 | ** Flag what is going on | ||
398 | */ | ||
399 | HostP->Flags &= ~RUN_STATE; | ||
400 | HostP->Flags |= RC_STARTUP; | ||
401 | |||
402 | /* | ||
403 | ** Grab a copy of the current ParmMap pointer, so we | ||
404 | ** can tell when it has changed. | ||
405 | */ | ||
406 | OldParmMap = readw(&HostP->__ParmMapR); | ||
407 | |||
408 | rio_dprintk(RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n", OldParmMap); | ||
409 | |||
410 | /* | ||
411 | ** And start it running (I hope). | ||
412 | ** As there is nothing dodgy or obscure about the | ||
413 | ** above code, this is guaranteed to work every time. | ||
414 | */ | ||
415 | rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec); | ||
416 | |||
417 | rio_start_card_running(HostP); | ||
418 | |||
419 | rio_dprintk(RIO_DEBUG_BOOT, "Set control port\n"); | ||
420 | |||
421 | /* | ||
422 | ** Now, wait for upto five seconds for the Tp to setup the parmmap | ||
423 | ** pointer: | ||
424 | */ | ||
425 | for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (readw(&HostP->__ParmMapR) == OldParmMap); wait_count++) { | ||
426 | rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, readw(&HostP->__ParmMapR)); | ||
427 | mdelay(100); | ||
428 | |||
429 | } | ||
430 | |||
431 | /* | ||
432 | ** If the parmmap pointer is unchanged, then the host code | ||
433 | ** has crashed & burned in a really spectacular way | ||
434 | */ | ||
435 | if (readw(&HostP->__ParmMapR) == OldParmMap) { | ||
436 | rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", readw(&HostP->__ParmMapR)); | ||
437 | rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); | ||
438 | HostP->Flags &= ~RUN_STATE; | ||
439 | HostP->Flags |= RC_STUFFED; | ||
440 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); | ||
441 | continue; | ||
442 | } | ||
443 | |||
444 | rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", readw(&HostP->__ParmMapR)); | ||
445 | |||
446 | /* | ||
447 | ** Well, the board thought it was OK, and setup its parmmap | ||
448 | ** pointer. For the time being, we will pretend that this | ||
449 | ** board is running, and check out what the error flag says. | ||
450 | */ | ||
451 | |||
452 | /* | ||
453 | ** Grab a 32 bit pointer to the parmmap structure | ||
454 | */ | ||
455 | ParmMapP = (PARM_MAP __iomem *) RIO_PTR(Cad, readw(&HostP->__ParmMapR)); | ||
456 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); | ||
457 | ParmMapP = (PARM_MAP __iomem *)(Cad + readw(&HostP->__ParmMapR)); | ||
458 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); | ||
459 | |||
460 | /* | ||
461 | ** The links entry should be 0xFFFF; we set it up | ||
462 | ** with a mask to say how many PHBs to use, and | ||
463 | ** which links to use. | ||
464 | */ | ||
465 | if (readw(&ParmMapP->links) != 0xFFFF) { | ||
466 | rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); | ||
467 | rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", readw(&ParmMapP->links)); | ||
468 | HostP->Flags &= ~RUN_STATE; | ||
469 | HostP->Flags |= RC_STUFFED; | ||
470 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); | ||
471 | continue; | ||
472 | } | ||
473 | |||
474 | writew(RIO_LINK_ENABLE, &ParmMapP->links); | ||
475 | |||
476 | /* | ||
477 | ** now wait for the card to set all the parmmap->XXX stuff | ||
478 | ** this is a wait of upto two seconds.... | ||
479 | */ | ||
480 | rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime); | ||
481 | HostP->timeout_id = 0; | ||
482 | for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !readw(&ParmMapP->init_done); wait_count++) { | ||
483 | rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n"); | ||
484 | mdelay(100); | ||
485 | } | ||
486 | rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n"); | ||
487 | |||
488 | if (readw(&ParmMapP->error) != E_NO_ERROR || !readw(&ParmMapP->init_done)) { | ||
489 | rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); | ||
490 | rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); | ||
491 | HostP->Flags &= ~RUN_STATE; | ||
492 | HostP->Flags |= RC_STUFFED; | ||
493 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); | ||
494 | continue; | ||
495 | } | ||
496 | |||
497 | rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n"); | ||
498 | |||
499 | /* | ||
500 | ** It runs! It runs! | ||
501 | */ | ||
502 | rio_dprintk(RIO_DEBUG_BOOT, "Host ID %x Running\n", HostP->UniqueNum); | ||
503 | |||
504 | /* | ||
505 | ** set the time period between interrupts. | ||
506 | */ | ||
507 | writew(p->RIOConf.Timer, &ParmMapP->timer); | ||
508 | |||
509 | /* | ||
510 | ** Translate all the 16 bit pointers in the __ParmMapR into | ||
511 | ** 32 bit pointers for the driver in ioremap space. | ||
512 | */ | ||
513 | HostP->ParmMapP = ParmMapP; | ||
514 | HostP->PhbP = (struct PHB __iomem *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); | ||
515 | HostP->RupP = (struct RUP __iomem *) RIO_PTR(Cad, readw(&ParmMapP->rups)); | ||
516 | HostP->PhbNumP = (unsigned short __iomem *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); | ||
517 | HostP->LinkStrP = (struct LPB __iomem *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); | ||
518 | |||
519 | /* | ||
520 | ** point the UnixRups at the real Rups | ||
521 | */ | ||
522 | for (RupN = 0; RupN < MAX_RUP; RupN++) { | ||
523 | HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; | ||
524 | HostP->UnixRups[RupN].Id = RupN + 1; | ||
525 | HostP->UnixRups[RupN].BaseSysPort = NO_PORT; | ||
526 | spin_lock_init(&HostP->UnixRups[RupN].RupLock); | ||
527 | } | ||
528 | |||
529 | for (RupN = 0; RupN < LINKS_PER_UNIT; RupN++) { | ||
530 | HostP->UnixRups[RupN + MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; | ||
531 | HostP->UnixRups[RupN + MAX_RUP].Id = 0; | ||
532 | HostP->UnixRups[RupN + MAX_RUP].BaseSysPort = NO_PORT; | ||
533 | spin_lock_init(&HostP->UnixRups[RupN + MAX_RUP].RupLock); | ||
534 | } | ||
535 | |||
536 | /* | ||
537 | ** point the PortP->Phbs at the real Phbs | ||
538 | */ | ||
539 | for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) { | ||
540 | if (p->RIOPortp[PortN]->HostP == HostP) { | ||
541 | struct Port *PortP = p->RIOPortp[PortN]; | ||
542 | struct PHB __iomem *PhbP; | ||
543 | /* int oldspl; */ | ||
544 | |||
545 | if (!PortP->Mapped) | ||
546 | continue; | ||
547 | |||
548 | PhbP = &HostP->PhbP[PortP->HostPort]; | ||
549 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
550 | |||
551 | PortP->PhbP = PhbP; | ||
552 | |||
553 | PortP->TxAdd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_add)); | ||
554 | PortP->TxStart = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_start)); | ||
555 | PortP->TxEnd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_end)); | ||
556 | PortP->RxRemove = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_remove)); | ||
557 | PortP->RxStart = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_start)); | ||
558 | PortP->RxEnd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_end)); | ||
559 | |||
560 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
561 | /* | ||
562 | ** point the UnixRup at the base SysPort | ||
563 | */ | ||
564 | if (!(PortN % PORTS_PER_RTA)) | ||
565 | HostP->UnixRups[PortP->RupNum].BaseSysPort = PortN; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | rio_dprintk(RIO_DEBUG_BOOT, "Set the card running... \n"); | ||
570 | /* | ||
571 | ** last thing - show the world that everything is in place | ||
572 | */ | ||
573 | HostP->Flags &= ~RUN_STATE; | ||
574 | HostP->Flags |= RC_RUNNING; | ||
575 | } | ||
576 | /* | ||
577 | ** MPX always uses a poller. This is actually patched into the system | ||
578 | ** configuration and called directly from each clock tick. | ||
579 | ** | ||
580 | */ | ||
581 | p->RIOPolling = 1; | ||
582 | |||
583 | p->RIOSystemUp++; | ||
584 | |||
585 | rio_dprintk(RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec); | ||
586 | func_exit(); | ||
587 | return 0; | ||
588 | } | ||
589 | |||
590 | |||
591 | |||
592 | /** | ||
593 | * RIOBootRup - Boot an RTA | ||
594 | * @p: rio we are working with | ||
595 | * @Rup: Rup number | ||
596 | * @HostP: host object | ||
597 | * @PacketP: packet to use | ||
598 | * | ||
599 | * If we have successfully processed this boot, then | ||
600 | * return 1. If we havent, then return 0. | ||
601 | */ | ||
602 | |||
603 | int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT __iomem *PacketP) | ||
604 | { | ||
605 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *) PacketP->data; | ||
606 | struct PktCmd_M *PktReplyP; | ||
607 | struct CmdBlk *CmdBlkP; | ||
608 | unsigned int sequence; | ||
609 | |||
610 | /* | ||
611 | ** If we haven't been told what to boot, we can't boot it. | ||
612 | */ | ||
613 | if (p->RIONumBootPkts == 0) { | ||
614 | rio_dprintk(RIO_DEBUG_BOOT, "No RTA code to download yet\n"); | ||
615 | return 0; | ||
616 | } | ||
617 | |||
618 | /* | ||
619 | ** Special case of boot completed - if we get one of these then we | ||
620 | ** don't need a command block. For all other cases we do, so handle | ||
621 | ** this first and then get a command block, then handle every other | ||
622 | ** case, relinquishing the command block if disaster strikes! | ||
623 | */ | ||
624 | if ((readb(&PacketP->len) & PKT_CMD_BIT) && (readb(&PktCmdP->Command) == BOOT_COMPLETED)) | ||
625 | return RIOBootComplete(p, HostP, Rup, PktCmdP); | ||
626 | |||
627 | /* | ||
628 | ** Try to allocate a command block. This is in kernel space | ||
629 | */ | ||
630 | if (!(CmdBlkP = RIOGetCmdBlk())) { | ||
631 | rio_dprintk(RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); | ||
632 | return 0; | ||
633 | } | ||
634 | |||
635 | /* | ||
636 | ** Fill in the default info on the command block | ||
637 | */ | ||
638 | CmdBlkP->Packet.dest_unit = Rup < (unsigned short) MAX_RUP ? Rup : 0; | ||
639 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
640 | CmdBlkP->Packet.src_unit = 0; | ||
641 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
642 | |||
643 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
644 | PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data; | ||
645 | |||
646 | /* | ||
647 | ** process COMMANDS on the boot rup! | ||
648 | */ | ||
649 | if (readb(&PacketP->len) & PKT_CMD_BIT) { | ||
650 | /* | ||
651 | ** We only expect one type of command - a BOOT_REQUEST! | ||
652 | */ | ||
653 | if (readb(&PktCmdP->Command) != BOOT_REQUEST) { | ||
654 | rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %Zd\n", readb(&PktCmdP->Command), Rup, HostP - p->RIOHosts); | ||
655 | RIOFreeCmdBlk(CmdBlkP); | ||
656 | return 1; | ||
657 | } | ||
658 | |||
659 | /* | ||
660 | ** Build a Boot Sequence command block | ||
661 | ** | ||
662 | ** We no longer need to use "Boot Mode", we'll always allow | ||
663 | ** boot requests - the boot will not complete if the device | ||
664 | ** appears in the bindings table. | ||
665 | ** | ||
666 | ** We'll just (always) set the command field in packet reply | ||
667 | ** to allow an attempted boot sequence : | ||
668 | */ | ||
669 | PktReplyP->Command = BOOT_SEQUENCE; | ||
670 | |||
671 | PktReplyP->BootSequence.NumPackets = p->RIONumBootPkts; | ||
672 | PktReplyP->BootSequence.LoadBase = p->RIOConf.RtaLoadBase; | ||
673 | PktReplyP->BootSequence.CodeSize = p->RIOBootCount; | ||
674 | |||
675 | CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT; | ||
676 | |||
677 | memcpy((void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], "BOOT", 4); | ||
678 | |||
679 | rio_dprintk(RIO_DEBUG_BOOT, "Boot RTA on Host %Zd Rup %d - %d (0x%x) packets to 0x%x\n", HostP - p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts, p->RIOConf.RtaLoadBase); | ||
680 | |||
681 | /* | ||
682 | ** If this host is in slave mode, send the RTA an invalid boot | ||
683 | ** sequence command block to force it to kill the boot. We wait | ||
684 | ** for half a second before sending this packet to prevent the RTA | ||
685 | ** attempting to boot too often. The master host should then grab | ||
686 | ** the RTA and make it its own. | ||
687 | */ | ||
688 | p->RIOBooting++; | ||
689 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
690 | return 1; | ||
691 | } | ||
692 | |||
693 | /* | ||
694 | ** It is a request for boot data. | ||
695 | */ | ||
696 | sequence = readw(&PktCmdP->Sequence); | ||
697 | |||
698 | rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %Zd Rup%d\n", sequence, HostP - p->RIOHosts, Rup); | ||
699 | |||
700 | if (sequence >= p->RIONumBootPkts) { | ||
701 | rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts); | ||
702 | } | ||
703 | |||
704 | PktReplyP->Sequence = sequence; | ||
705 | memcpy(PktReplyP->BootData, p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], RTA_BOOT_DATA_SIZE); | ||
706 | CmdBlkP->Packet.len = PKT_MAX_DATA_LEN; | ||
707 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
708 | return 1; | ||
709 | } | ||
710 | |||
711 | /** | ||
712 | * RIOBootComplete - RTA boot is done | ||
713 | * @p: RIO we are working with | ||
714 | * @HostP: Host structure | ||
715 | * @Rup: RUP being used | ||
716 | * @PktCmdP: Packet command that was used | ||
717 | * | ||
718 | * This function is called when an RTA been booted. | ||
719 | * If booted by a host, HostP->HostUniqueNum is the booting host. | ||
720 | * If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. | ||
721 | * RtaUniq is the booted RTA. | ||
722 | */ | ||
723 | |||
724 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd __iomem *PktCmdP) | ||
725 | { | ||
726 | struct Map *MapP = NULL; | ||
727 | struct Map *MapP2 = NULL; | ||
728 | int Flag; | ||
729 | int found; | ||
730 | int host, rta; | ||
731 | int EmptySlot = -1; | ||
732 | int entry, entry2; | ||
733 | char *MyType, *MyName; | ||
734 | unsigned int MyLink; | ||
735 | unsigned short RtaType; | ||
736 | u32 RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24); | ||
737 | |||
738 | p->RIOBooting = 0; | ||
739 | |||
740 | rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); | ||
741 | |||
742 | /* | ||
743 | ** Determine type of unit (16/8 port RTA). | ||
744 | */ | ||
745 | |||
746 | RtaType = GetUnitType(RtaUniq); | ||
747 | if (Rup >= (unsigned short) MAX_RUP) | ||
748 | rio_dprintk(RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", HostP->Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); | ||
749 | else | ||
750 | rio_dprintk(RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", HostP->Mapping[Rup].Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); | ||
751 | |||
752 | rio_dprintk(RIO_DEBUG_BOOT, "UniqNum is 0x%x\n", RtaUniq); | ||
753 | |||
754 | if (RtaUniq == 0x00000000 || RtaUniq == 0xffffffff) { | ||
755 | rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); | ||
756 | return 1; | ||
757 | } | ||
758 | |||
759 | /* | ||
760 | ** If this RTA has just booted an RTA which doesn't belong to this | ||
761 | ** system, or the system is in slave mode, do not attempt to create | ||
762 | ** a new table entry for it. | ||
763 | */ | ||
764 | |||
765 | if (!RIOBootOk(p, HostP, RtaUniq)) { | ||
766 | MyLink = readb(&PktCmdP->LinkNum); | ||
767 | if (Rup < (unsigned short) MAX_RUP) { | ||
768 | /* | ||
769 | ** RtaUniq was clone booted (by this RTA). Instruct this RTA | ||
770 | ** to hold off further attempts to boot on this link for 30 | ||
771 | ** seconds. | ||
772 | */ | ||
773 | if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) { | ||
774 | rio_dprintk(RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", 'A' + MyLink); | ||
775 | } | ||
776 | } else | ||
777 | /* | ||
778 | ** RtaUniq was booted by this host. Set the booting link | ||
779 | ** to hold off for 30 seconds to give another unit a | ||
780 | ** chance to boot it. | ||
781 | */ | ||
782 | writew(30, &HostP->LinkStrP[MyLink].WaitNoBoot); | ||
783 | rio_dprintk(RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum); | ||
784 | return 1; | ||
785 | } | ||
786 | |||
787 | /* | ||
788 | ** Check for a SLOT_IN_USE entry for this RTA attached to the | ||
789 | ** current host card in the driver table. | ||
790 | ** | ||
791 | ** If it exists, make a note that we have booted it. Other parts of | ||
792 | ** the driver are interested in this information at a later date, | ||
793 | ** in particular when the booting RTA asks for an ID for this unit, | ||
794 | ** we must have set the BOOTED flag, and the NEWBOOT flag is used | ||
795 | ** to force an open on any ports that where previously open on this | ||
796 | ** unit. | ||
797 | */ | ||
798 | for (entry = 0; entry < MAX_RUP; entry++) { | ||
799 | unsigned int sysport; | ||
800 | |||
801 | if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) { | ||
802 | HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT; | ||
803 | if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) { | ||
804 | if (sysport < p->RIOFirstPortsBooted) | ||
805 | p->RIOFirstPortsBooted = sysport; | ||
806 | if (sysport > p->RIOLastPortsBooted) | ||
807 | p->RIOLastPortsBooted = sysport; | ||
808 | /* | ||
809 | ** For a 16 port RTA, check the second bank of 8 ports | ||
810 | */ | ||
811 | if (RtaType == TYPE_RTA16) { | ||
812 | entry2 = HostP->Mapping[entry].ID2 - 1; | ||
813 | HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT; | ||
814 | sysport = HostP->Mapping[entry2].SysPort; | ||
815 | if (sysport < p->RIOFirstPortsBooted) | ||
816 | p->RIOFirstPortsBooted = sysport; | ||
817 | if (sysport > p->RIOLastPortsBooted) | ||
818 | p->RIOLastPortsBooted = sysport; | ||
819 | } | ||
820 | } | ||
821 | if (RtaType == TYPE_RTA16) | ||
822 | rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1); | ||
823 | else | ||
824 | rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1); | ||
825 | return 1; | ||
826 | } | ||
827 | } | ||
828 | |||
829 | rio_dprintk(RIO_DEBUG_BOOT, "RTA not configured for this host\n"); | ||
830 | |||
831 | if (Rup >= (unsigned short) MAX_RUP) { | ||
832 | /* | ||
833 | ** It was a host that did the booting | ||
834 | */ | ||
835 | MyType = "Host"; | ||
836 | MyName = HostP->Name; | ||
837 | } else { | ||
838 | /* | ||
839 | ** It was an RTA that did the booting | ||
840 | */ | ||
841 | MyType = "RTA"; | ||
842 | MyName = HostP->Mapping[Rup].Name; | ||
843 | } | ||
844 | MyLink = readb(&PktCmdP->LinkNum); | ||
845 | |||
846 | /* | ||
847 | ** There is no SLOT_IN_USE entry for this RTA attached to the current | ||
848 | ** host card in the driver table. | ||
849 | ** | ||
850 | ** Check for a SLOT_TENTATIVE entry for this RTA attached to the | ||
851 | ** current host card in the driver table. | ||
852 | ** | ||
853 | ** If we find one, then we re-use that slot. | ||
854 | */ | ||
855 | for (entry = 0; entry < MAX_RUP; entry++) { | ||
856 | if ((HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) { | ||
857 | if (RtaType == TYPE_RTA16) { | ||
858 | entry2 = HostP->Mapping[entry].ID2 - 1; | ||
859 | if ((HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq)) | ||
860 | rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", entry, entry2); | ||
861 | else | ||
862 | continue; | ||
863 | } else | ||
864 | rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry); | ||
865 | if (!p->RIONoMessage) | ||
866 | printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); | ||
867 | return 1; | ||
868 | } | ||
869 | } | ||
870 | |||
871 | /* | ||
872 | ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA | ||
873 | ** attached to the current host card in the driver table. | ||
874 | ** | ||
875 | ** Check if there is a SLOT_IN_USE or SLOT_TENTATIVE entry on another | ||
876 | ** host for this RTA in the driver table. | ||
877 | ** | ||
878 | ** For a SLOT_IN_USE entry on another host, we need to delete the RTA | ||
879 | ** entry from the other host and add it to this host (using some of | ||
880 | ** the functions from table.c which do this). | ||
881 | ** For a SLOT_TENTATIVE entry on another host, we must cope with the | ||
882 | ** following scenario: | ||
883 | ** | ||
884 | ** + Plug 8 port RTA into host A. (This creates SLOT_TENTATIVE entry | ||
885 | ** in table) | ||
886 | ** + Unplug RTA and plug into host B. (We now have 2 SLOT_TENTATIVE | ||
887 | ** entries) | ||
888 | ** + Configure RTA on host B. (This slot now becomes SLOT_IN_USE) | ||
889 | ** + Unplug RTA and plug back into host A. | ||
890 | ** + Configure RTA on host A. We now have the same RTA configured | ||
891 | ** with different ports on two different hosts. | ||
892 | */ | ||
893 | rio_dprintk(RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq); | ||
894 | found = 0; | ||
895 | Flag = 0; /* Convince the compiler this variable is initialized */ | ||
896 | for (host = 0; !found && (host < p->RIONumHosts); host++) { | ||
897 | for (rta = 0; rta < MAX_RUP; rta++) { | ||
898 | if ((p->RIOHosts[host].Mapping[rta].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (p->RIOHosts[host].Mapping[rta].RtaUniqueNum == RtaUniq)) { | ||
899 | Flag = p->RIOHosts[host].Mapping[rta].Flags; | ||
900 | MapP = &p->RIOHosts[host].Mapping[rta]; | ||
901 | if (RtaType == TYPE_RTA16) { | ||
902 | MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1]; | ||
903 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", rta + 1, MapP->ID2, p->RIOHosts[host].Name); | ||
904 | } else | ||
905 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n", rta + 1, p->RIOHosts[host].Name); | ||
906 | found = 1; | ||
907 | break; | ||
908 | } | ||
909 | } | ||
910 | } | ||
911 | |||
912 | /* | ||
913 | ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA | ||
914 | ** attached to the current host card in the driver table. | ||
915 | ** | ||
916 | ** If we have not found a SLOT_IN_USE or SLOT_TENTATIVE entry on | ||
917 | ** another host for this RTA in the driver table... | ||
918 | ** | ||
919 | ** Check for a SLOT_IN_USE entry for this RTA in the config table. | ||
920 | */ | ||
921 | if (!MapP) { | ||
922 | rio_dprintk(RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n", RtaUniq); | ||
923 | for (rta = 0; rta < TOTAL_MAP_ENTRIES; rta++) { | ||
924 | rio_dprintk(RIO_DEBUG_BOOT, "Check table entry %d (%x)", rta, p->RIOSavedTable[rta].RtaUniqueNum); | ||
925 | |||
926 | if ((p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq)) { | ||
927 | MapP = &p->RIOSavedTable[rta]; | ||
928 | Flag = p->RIOSavedTable[rta].Flags; | ||
929 | if (RtaType == TYPE_RTA16) { | ||
930 | for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES; entry2++) { | ||
931 | if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq) | ||
932 | break; | ||
933 | } | ||
934 | MapP2 = &p->RIOSavedTable[entry2]; | ||
935 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", rta, entry2); | ||
936 | } else | ||
937 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta); | ||
938 | break; | ||
939 | } | ||
940 | } | ||
941 | } | ||
942 | |||
943 | /* | ||
944 | ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA | ||
945 | ** attached to the current host card in the driver table. | ||
946 | ** | ||
947 | ** We may have found a SLOT_IN_USE entry on another host for this | ||
948 | ** RTA in the config table, or a SLOT_IN_USE or SLOT_TENTATIVE entry | ||
949 | ** on another host for this RTA in the driver table. | ||
950 | ** | ||
951 | ** Check the driver table for room to fit this newly discovered RTA. | ||
952 | ** RIOFindFreeID() first looks for free slots and if it does not | ||
953 | ** find any free slots it will then attempt to oust any | ||
954 | ** tentative entry in the table. | ||
955 | */ | ||
956 | EmptySlot = 1; | ||
957 | if (RtaType == TYPE_RTA16) { | ||
958 | if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) { | ||
959 | RIODefaultName(p, HostP, entry); | ||
960 | rio_fill_host_slot(entry, entry2, RtaUniq, HostP); | ||
961 | EmptySlot = 0; | ||
962 | } | ||
963 | } else { | ||
964 | if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) { | ||
965 | RIODefaultName(p, HostP, entry); | ||
966 | rio_fill_host_slot(entry, 0, RtaUniq, HostP); | ||
967 | EmptySlot = 0; | ||
968 | } | ||
969 | } | ||
970 | |||
971 | /* | ||
972 | ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA | ||
973 | ** attached to the current host card in the driver table. | ||
974 | ** | ||
975 | ** If we found a SLOT_IN_USE entry on another host for this | ||
976 | ** RTA in the config or driver table, and there are enough free | ||
977 | ** slots in the driver table, then we need to move it over and | ||
978 | ** delete it from the other host. | ||
979 | ** If we found a SLOT_TENTATIVE entry on another host for this | ||
980 | ** RTA in the driver table, just delete the other host entry. | ||
981 | */ | ||
982 | if (EmptySlot == 0) { | ||
983 | if (MapP) { | ||
984 | if (Flag & SLOT_IN_USE) { | ||
985 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n"); | ||
986 | HostP->Mapping[entry].SysPort = MapP->SysPort; | ||
987 | memcpy(HostP->Mapping[entry].Name, MapP->Name, MAX_NAME_LEN); | ||
988 | HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT; | ||
989 | RIOReMapPorts(p, HostP, &HostP->Mapping[entry]); | ||
990 | if (HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted) | ||
991 | p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; | ||
992 | if (HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted) | ||
993 | p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort; | ||
994 | rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) MapP->SysPort, MapP->Name); | ||
995 | } else { | ||
996 | rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n"); | ||
997 | HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; | ||
998 | } | ||
999 | if (RtaType == TYPE_RTA16) { | ||
1000 | if (Flag & SLOT_IN_USE) { | ||
1001 | HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; | ||
1002 | HostP->Mapping[entry2].SysPort = MapP2->SysPort; | ||
1003 | /* | ||
1004 | ** Map second block of ttys for 16 port RTA | ||
1005 | */ | ||
1006 | RIOReMapPorts(p, HostP, &HostP->Mapping[entry2]); | ||
1007 | if (HostP->Mapping[entry2].SysPort < p->RIOFirstPortsBooted) | ||
1008 | p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort; | ||
1009 | if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted) | ||
1010 | p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort; | ||
1011 | rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name); | ||
1012 | } else | ||
1013 | HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; | ||
1014 | memset(MapP2, 0, sizeof(struct Map)); | ||
1015 | } | ||
1016 | memset(MapP, 0, sizeof(struct Map)); | ||
1017 | if (!p->RIONoMessage) | ||
1018 | printk("An orphaned RTA has been adopted by %s '%s' (%c).\n", MyType, MyName, MyLink + 'A'); | ||
1019 | } else if (!p->RIONoMessage) | ||
1020 | printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); | ||
1021 | RIOSetChange(p); | ||
1022 | return 1; | ||
1023 | } | ||
1024 | |||
1025 | /* | ||
1026 | ** There is no room in the driver table to make an entry for the | ||
1027 | ** booted RTA. Keep a note of its Uniq Num in the overflow table, | ||
1028 | ** so we can ignore it's ID requests. | ||
1029 | */ | ||
1030 | if (!p->RIONoMessage) | ||
1031 | printk("The RTA connected to %s '%s' (%c) cannot be configured. You cannot configure more than 128 ports to one host card.\n", MyType, MyName, MyLink + 'A'); | ||
1032 | for (entry = 0; entry < HostP->NumExtraBooted; entry++) { | ||
1033 | if (HostP->ExtraUnits[entry] == RtaUniq) { | ||
1034 | /* | ||
1035 | ** already got it! | ||
1036 | */ | ||
1037 | return 1; | ||
1038 | } | ||
1039 | } | ||
1040 | /* | ||
1041 | ** If there is room, add the unit to the list of extras | ||
1042 | */ | ||
1043 | if (HostP->NumExtraBooted < MAX_EXTRA_UNITS) | ||
1044 | HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq; | ||
1045 | return 1; | ||
1046 | } | ||
1047 | |||
1048 | |||
1049 | /* | ||
1050 | ** If the RTA or its host appears in the RIOBindTab[] structure then | ||
1051 | ** we mustn't boot the RTA and should return 0. | ||
1052 | ** This operation is slightly different from the other drivers for RIO | ||
1053 | ** in that this is designed to work with the new utilities | ||
1054 | ** not config.rio and is FAR SIMPLER. | ||
1055 | ** We no longer support the RIOBootMode variable. It is all done from the | ||
1056 | ** "boot/noboot" field in the rio.cf file. | ||
1057 | */ | ||
1058 | int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq) | ||
1059 | { | ||
1060 | int Entry; | ||
1061 | unsigned int HostUniq = HostP->UniqueNum; | ||
1062 | |||
1063 | /* | ||
1064 | ** Search bindings table for RTA or its parent. | ||
1065 | ** If it exists, return 0, else 1. | ||
1066 | */ | ||
1067 | for (Entry = 0; (Entry < MAX_RTA_BINDINGS) && (p->RIOBindTab[Entry] != 0); Entry++) { | ||
1068 | if ((p->RIOBindTab[Entry] == HostUniq) || (p->RIOBindTab[Entry] == RtaUniq)) | ||
1069 | return 0; | ||
1070 | } | ||
1071 | return 1; | ||
1072 | } | ||
1073 | |||
1074 | /* | ||
1075 | ** Make an empty slot tentative. If this is a 16 port RTA, make both | ||
1076 | ** slots tentative, and the second one RTA_SECOND_SLOT as well. | ||
1077 | */ | ||
1078 | |||
1079 | void rio_fill_host_slot(int entry, int entry2, unsigned int rta_uniq, struct Host *host) | ||
1080 | { | ||
1081 | int link; | ||
1082 | |||
1083 | rio_dprintk(RIO_DEBUG_BOOT, "rio_fill_host_slot(%d, %d, 0x%x...)\n", entry, entry2, rta_uniq); | ||
1084 | |||
1085 | host->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); | ||
1086 | host->Mapping[entry].SysPort = NO_PORT; | ||
1087 | host->Mapping[entry].RtaUniqueNum = rta_uniq; | ||
1088 | host->Mapping[entry].HostUniqueNum = host->UniqueNum; | ||
1089 | host->Mapping[entry].ID = entry + 1; | ||
1090 | host->Mapping[entry].ID2 = 0; | ||
1091 | if (entry2) { | ||
1092 | host->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT); | ||
1093 | host->Mapping[entry2].SysPort = NO_PORT; | ||
1094 | host->Mapping[entry2].RtaUniqueNum = rta_uniq; | ||
1095 | host->Mapping[entry2].HostUniqueNum = host->UniqueNum; | ||
1096 | host->Mapping[entry2].Name[0] = '\0'; | ||
1097 | host->Mapping[entry2].ID = entry2 + 1; | ||
1098 | host->Mapping[entry2].ID2 = entry + 1; | ||
1099 | host->Mapping[entry].ID2 = entry2 + 1; | ||
1100 | } | ||
1101 | /* | ||
1102 | ** Must set these up, so that utilities show | ||
1103 | ** topology of 16 port RTAs correctly | ||
1104 | */ | ||
1105 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
1106 | host->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; | ||
1107 | host->Mapping[entry].Topology[link].Link = NO_LINK; | ||
1108 | if (entry2) { | ||
1109 | host->Mapping[entry2].Topology[link].Unit = ROUTE_DISCONNECT; | ||
1110 | host->Mapping[entry2].Topology[link].Link = NO_LINK; | ||
1111 | } | ||
1112 | } | ||
1113 | } | ||
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c deleted file mode 100644 index f121357e5af0..000000000000 --- a/drivers/char/rio/riocmd.c +++ /dev/null | |||
@@ -1,939 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** ported from the existing SCO driver source | ||
6 | ** | ||
7 | * | ||
8 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | ** | ||
24 | ** Module : riocmd.c | ||
25 | ** SID : 1.2 | ||
26 | ** Last Modified : 11/6/98 10:33:41 | ||
27 | ** Retrieved : 11/6/98 10:33:49 | ||
28 | ** | ||
29 | ** ident @(#)riocmd.c 1.2 | ||
30 | ** | ||
31 | ** ----------------------------------------------------------------------------- | ||
32 | */ | ||
33 | |||
34 | #include <linux/module.h> | ||
35 | #include <linux/sched.h> | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/errno.h> | ||
38 | #include <linux/tty.h> | ||
39 | #include <asm/io.h> | ||
40 | #include <asm/system.h> | ||
41 | #include <asm/string.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | #include <linux/termios.h> | ||
45 | #include <linux/serial.h> | ||
46 | |||
47 | #include <linux/generic_serial.h> | ||
48 | |||
49 | #include "linux_compat.h" | ||
50 | #include "rio_linux.h" | ||
51 | #include "pkt.h" | ||
52 | #include "daemon.h" | ||
53 | #include "rio.h" | ||
54 | #include "riospace.h" | ||
55 | #include "cmdpkt.h" | ||
56 | #include "map.h" | ||
57 | #include "rup.h" | ||
58 | #include "port.h" | ||
59 | #include "riodrvr.h" | ||
60 | #include "rioinfo.h" | ||
61 | #include "func.h" | ||
62 | #include "errors.h" | ||
63 | #include "pci.h" | ||
64 | |||
65 | #include "parmmap.h" | ||
66 | #include "unixrup.h" | ||
67 | #include "board.h" | ||
68 | #include "host.h" | ||
69 | #include "phb.h" | ||
70 | #include "link.h" | ||
71 | #include "cmdblk.h" | ||
72 | #include "route.h" | ||
73 | #include "cirrus.h" | ||
74 | |||
75 | |||
76 | static struct IdentifyRta IdRta; | ||
77 | static struct KillNeighbour KillUnit; | ||
78 | |||
79 | int RIOFoadRta(struct Host *HostP, struct Map *MapP) | ||
80 | { | ||
81 | struct CmdBlk *CmdBlkP; | ||
82 | |||
83 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n"); | ||
84 | |||
85 | CmdBlkP = RIOGetCmdBlk(); | ||
86 | |||
87 | if (!CmdBlkP) { | ||
88 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); | ||
89 | return -ENXIO; | ||
90 | } | ||
91 | |||
92 | CmdBlkP->Packet.dest_unit = MapP->ID; | ||
93 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
94 | CmdBlkP->Packet.src_unit = 0; | ||
95 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
96 | CmdBlkP->Packet.len = 0x84; | ||
97 | CmdBlkP->Packet.data[0] = IFOAD; | ||
98 | CmdBlkP->Packet.data[1] = 0; | ||
99 | CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; | ||
100 | CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; | ||
101 | |||
102 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { | ||
103 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); | ||
104 | return -EIO; | ||
105 | } | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | int RIOZombieRta(struct Host *HostP, struct Map *MapP) | ||
110 | { | ||
111 | struct CmdBlk *CmdBlkP; | ||
112 | |||
113 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n"); | ||
114 | |||
115 | CmdBlkP = RIOGetCmdBlk(); | ||
116 | |||
117 | if (!CmdBlkP) { | ||
118 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); | ||
119 | return -ENXIO; | ||
120 | } | ||
121 | |||
122 | CmdBlkP->Packet.dest_unit = MapP->ID; | ||
123 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
124 | CmdBlkP->Packet.src_unit = 0; | ||
125 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
126 | CmdBlkP->Packet.len = 0x84; | ||
127 | CmdBlkP->Packet.data[0] = ZOMBIE; | ||
128 | CmdBlkP->Packet.data[1] = 0; | ||
129 | CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; | ||
130 | CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; | ||
131 | |||
132 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { | ||
133 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); | ||
134 | return -EIO; | ||
135 | } | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) | ||
140 | { | ||
141 | unsigned int Host; | ||
142 | |||
143 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func); | ||
144 | |||
145 | if (!RtaUnique) | ||
146 | return (0); | ||
147 | |||
148 | for (Host = 0; Host < p->RIONumHosts; Host++) { | ||
149 | unsigned int Rta; | ||
150 | struct Host *HostP = &p->RIOHosts[Host]; | ||
151 | |||
152 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { | ||
153 | struct Map *MapP = &HostP->Mapping[Rta]; | ||
154 | |||
155 | if (MapP->RtaUniqueNum == RtaUnique) { | ||
156 | uint Link; | ||
157 | |||
158 | /* | ||
159 | ** now, lets just check we have a route to it... | ||
160 | ** IF the routing stuff is working, then one of the | ||
161 | ** topology entries for this unit will have a legit | ||
162 | ** route *somewhere*. We care not where - if its got | ||
163 | ** any connections, we can get to it. | ||
164 | */ | ||
165 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { | ||
166 | if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { | ||
167 | /* | ||
168 | ** Its worth trying the operation... | ||
169 | */ | ||
170 | return (*func) (HostP, MapP); | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | return -ENXIO; | ||
177 | } | ||
178 | |||
179 | |||
180 | int RIOIdentifyRta(struct rio_info *p, void __user * arg) | ||
181 | { | ||
182 | unsigned int Host; | ||
183 | |||
184 | if (copy_from_user(&IdRta, arg, sizeof(IdRta))) { | ||
185 | rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); | ||
186 | p->RIOError.Error = COPYIN_FAILED; | ||
187 | return -EFAULT; | ||
188 | } | ||
189 | |||
190 | for (Host = 0; Host < p->RIONumHosts; Host++) { | ||
191 | unsigned int Rta; | ||
192 | struct Host *HostP = &p->RIOHosts[Host]; | ||
193 | |||
194 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { | ||
195 | struct Map *MapP = &HostP->Mapping[Rta]; | ||
196 | |||
197 | if (MapP->RtaUniqueNum == IdRta.RtaUnique) { | ||
198 | uint Link; | ||
199 | /* | ||
200 | ** now, lets just check we have a route to it... | ||
201 | ** IF the routing stuff is working, then one of the | ||
202 | ** topology entries for this unit will have a legit | ||
203 | ** route *somewhere*. We care not where - if its got | ||
204 | ** any connections, we can get to it. | ||
205 | */ | ||
206 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { | ||
207 | if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { | ||
208 | /* | ||
209 | ** Its worth trying the operation... | ||
210 | */ | ||
211 | struct CmdBlk *CmdBlkP; | ||
212 | |||
213 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n"); | ||
214 | |||
215 | CmdBlkP = RIOGetCmdBlk(); | ||
216 | |||
217 | if (!CmdBlkP) { | ||
218 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); | ||
219 | return -ENXIO; | ||
220 | } | ||
221 | |||
222 | CmdBlkP->Packet.dest_unit = MapP->ID; | ||
223 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
224 | CmdBlkP->Packet.src_unit = 0; | ||
225 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
226 | CmdBlkP->Packet.len = 0x84; | ||
227 | CmdBlkP->Packet.data[0] = IDENTIFY; | ||
228 | CmdBlkP->Packet.data[1] = 0; | ||
229 | CmdBlkP->Packet.data[2] = IdRta.ID; | ||
230 | |||
231 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { | ||
232 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); | ||
233 | return -EIO; | ||
234 | } | ||
235 | return 0; | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | return -ENOENT; | ||
242 | } | ||
243 | |||
244 | |||
245 | int RIOKillNeighbour(struct rio_info *p, void __user * arg) | ||
246 | { | ||
247 | uint Host; | ||
248 | uint ID; | ||
249 | struct Host *HostP; | ||
250 | struct CmdBlk *CmdBlkP; | ||
251 | |||
252 | rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); | ||
253 | |||
254 | if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) { | ||
255 | rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); | ||
256 | p->RIOError.Error = COPYIN_FAILED; | ||
257 | return -EFAULT; | ||
258 | } | ||
259 | |||
260 | if (KillUnit.Link > 3) | ||
261 | return -ENXIO; | ||
262 | |||
263 | CmdBlkP = RIOGetCmdBlk(); | ||
264 | |||
265 | if (!CmdBlkP) { | ||
266 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); | ||
267 | return -ENXIO; | ||
268 | } | ||
269 | |||
270 | CmdBlkP->Packet.dest_unit = 0; | ||
271 | CmdBlkP->Packet.src_unit = 0; | ||
272 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
273 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
274 | CmdBlkP->Packet.len = 0x84; | ||
275 | CmdBlkP->Packet.data[0] = UFOAD; | ||
276 | CmdBlkP->Packet.data[1] = KillUnit.Link; | ||
277 | CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; | ||
278 | CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; | ||
279 | |||
280 | for (Host = 0; Host < p->RIONumHosts; Host++) { | ||
281 | ID = 0; | ||
282 | HostP = &p->RIOHosts[Host]; | ||
283 | |||
284 | if (HostP->UniqueNum == KillUnit.UniqueNum) { | ||
285 | if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) { | ||
286 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | ||
287 | return -EIO; | ||
288 | } | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | for (ID = 0; ID < RTAS_PER_HOST; ID++) { | ||
293 | if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) { | ||
294 | CmdBlkP->Packet.dest_unit = ID + 1; | ||
295 | if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) { | ||
296 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | ||
297 | return -EIO; | ||
298 | } | ||
299 | return 0; | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | RIOFreeCmdBlk(CmdBlkP); | ||
304 | return -ENXIO; | ||
305 | } | ||
306 | |||
307 | int RIOSuspendBootRta(struct Host *HostP, int ID, int Link) | ||
308 | { | ||
309 | struct CmdBlk *CmdBlkP; | ||
310 | |||
311 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); | ||
312 | |||
313 | CmdBlkP = RIOGetCmdBlk(); | ||
314 | |||
315 | if (!CmdBlkP) { | ||
316 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); | ||
317 | return -ENXIO; | ||
318 | } | ||
319 | |||
320 | CmdBlkP->Packet.dest_unit = ID; | ||
321 | CmdBlkP->Packet.dest_port = BOOT_RUP; | ||
322 | CmdBlkP->Packet.src_unit = 0; | ||
323 | CmdBlkP->Packet.src_port = BOOT_RUP; | ||
324 | CmdBlkP->Packet.len = 0x84; | ||
325 | CmdBlkP->Packet.data[0] = IWAIT; | ||
326 | CmdBlkP->Packet.data[1] = Link; | ||
327 | CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; | ||
328 | CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; | ||
329 | |||
330 | if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) { | ||
331 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); | ||
332 | return -EIO; | ||
333 | } | ||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | int RIOFoadWakeup(struct rio_info *p) | ||
338 | { | ||
339 | int port; | ||
340 | struct Port *PortP; | ||
341 | unsigned long flags; | ||
342 | |||
343 | for (port = 0; port < RIO_PORTS; port++) { | ||
344 | PortP = p->RIOPortp[port]; | ||
345 | |||
346 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
347 | PortP->Config = 0; | ||
348 | PortP->State = 0; | ||
349 | PortP->InUse = NOT_INUSE; | ||
350 | PortP->PortState = 0; | ||
351 | PortP->FlushCmdBodge = 0; | ||
352 | PortP->ModemLines = 0; | ||
353 | PortP->ModemState = 0; | ||
354 | PortP->CookMode = 0; | ||
355 | PortP->ParamSem = 0; | ||
356 | PortP->Mapped = 0; | ||
357 | PortP->WflushFlag = 0; | ||
358 | PortP->MagicFlags = 0; | ||
359 | PortP->RxDataStart = 0; | ||
360 | PortP->TxBufferIn = 0; | ||
361 | PortP->TxBufferOut = 0; | ||
362 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
363 | } | ||
364 | return (0); | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | ** Incoming command on the COMMAND_RUP to be processed. | ||
369 | */ | ||
370 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT __iomem *PacketP) | ||
371 | { | ||
372 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *)PacketP->data; | ||
373 | struct Port *PortP; | ||
374 | struct UnixRup *UnixRupP; | ||
375 | unsigned short SysPort; | ||
376 | unsigned short ReportedModemStatus; | ||
377 | unsigned short rup; | ||
378 | unsigned short subCommand; | ||
379 | unsigned long flags; | ||
380 | |||
381 | func_enter(); | ||
382 | |||
383 | /* | ||
384 | ** 16 port RTA note: | ||
385 | ** Command rup packets coming from the RTA will have pkt->data[1] (which | ||
386 | ** translates to PktCmdP->PhbNum) set to the host port number for the | ||
387 | ** particular unit. To access the correct BaseSysPort for a 16 port RTA, | ||
388 | ** we can use PhbNum to get the rup number for the appropriate 8 port | ||
389 | ** block (for the first block, this should be equal to 'Rup'). | ||
390 | */ | ||
391 | rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA; | ||
392 | UnixRupP = &HostP->UnixRups[rup]; | ||
393 | SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA); | ||
394 | rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); | ||
395 | |||
396 | if (UnixRupP->BaseSysPort == NO_PORT) { | ||
397 | rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); | ||
398 | rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); | ||
399 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); | ||
400 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); | ||
401 | |||
402 | if (Rup < (unsigned short) MAX_RUP) { | ||
403 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); | ||
404 | } else | ||
405 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); | ||
406 | |||
407 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", readb(&PacketP->dest_unit), readb(&PacketP->dest_port)); | ||
408 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", readb(&PacketP->src_unit), readb(&PacketP->src_port)); | ||
409 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", readb(&PacketP->len), readb(&PacketP->len)); | ||
410 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", readb(&PacketP->control), readb(&PacketP->control)); | ||
411 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", readw(&PacketP->csum), readw(&PacketP->csum)); | ||
412 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", readb(&PktCmdP->PhbNum), readb(&PktCmdP->Command)); | ||
413 | return 1; | ||
414 | } | ||
415 | PortP = p->RIOPortp[SysPort]; | ||
416 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
417 | switch (readb(&PktCmdP->Command)) { | ||
418 | case RIOC_BREAK_RECEIVED: | ||
419 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); | ||
420 | /* If the current line disc. is not multi-threading and | ||
421 | the current processor is not the default, reset rup_intr | ||
422 | and return 0 to ensure that the command packet is | ||
423 | not freed. */ | ||
424 | /* Call tmgr HANGUP HERE */ | ||
425 | /* Fix this later when every thing works !!!! RAMRAJ */ | ||
426 | gs_got_break(&PortP->gs); | ||
427 | break; | ||
428 | |||
429 | case RIOC_COMPLETE: | ||
430 | rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts); | ||
431 | subCommand = 1; | ||
432 | switch (readb(&PktCmdP->SubCommand)) { | ||
433 | case RIOC_MEMDUMP: | ||
434 | rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr)); | ||
435 | break; | ||
436 | case RIOC_READ_REGISTER: | ||
437 | rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr)); | ||
438 | p->CdRegister = (readb(&PktCmdP->ModemStatus) & RIOC_MSVR1_HOST); | ||
439 | break; | ||
440 | default: | ||
441 | subCommand = 0; | ||
442 | break; | ||
443 | } | ||
444 | if (subCommand) | ||
445 | break; | ||
446 | rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState); | ||
447 | if (PortP->PortState != readb(&PktCmdP->PortStatus)) { | ||
448 | rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); | ||
449 | PortP->PortState = readb(&PktCmdP->PortStatus); | ||
450 | /* What should we do here ... | ||
451 | wakeup( &PortP->PortState ); | ||
452 | */ | ||
453 | } else | ||
454 | rio_dprintk(RIO_DEBUG_CMD, "No change\n"); | ||
455 | |||
456 | /* FALLTHROUGH */ | ||
457 | case RIOC_MODEM_STATUS: | ||
458 | /* | ||
459 | ** Knock out the tbusy and tstop bits, as these are not relevant | ||
460 | ** to the check for modem status change (they're just there because | ||
461 | ** it's a convenient place to put them!). | ||
462 | */ | ||
463 | ReportedModemStatus = readb(&PktCmdP->ModemStatus); | ||
464 | if ((PortP->ModemState & RIOC_MSVR1_HOST) == | ||
465 | (ReportedModemStatus & RIOC_MSVR1_HOST)) { | ||
466 | rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); | ||
467 | /* | ||
468 | ** Update ModemState just in case tbusy or tstop states have | ||
469 | ** changed. | ||
470 | */ | ||
471 | PortP->ModemState = ReportedModemStatus; | ||
472 | } else { | ||
473 | rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus); | ||
474 | PortP->ModemState = ReportedModemStatus; | ||
475 | #ifdef MODEM_SUPPORT | ||
476 | if (PortP->Mapped) { | ||
477 | /***********************************************************\ | ||
478 | ************************************************************* | ||
479 | *** *** | ||
480 | *** M O D E M S T A T E C H A N G E *** | ||
481 | *** *** | ||
482 | ************************************************************* | ||
483 | \***********************************************************/ | ||
484 | /* | ||
485 | ** If the device is a modem, then check the modem | ||
486 | ** carrier. | ||
487 | */ | ||
488 | if (PortP->gs.port.tty == NULL) | ||
489 | break; | ||
490 | if (PortP->gs.port.tty->termios == NULL) | ||
491 | break; | ||
492 | |||
493 | if (!(PortP->gs.port.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { | ||
494 | |||
495 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); | ||
496 | /* | ||
497 | ** Is there a carrier? | ||
498 | */ | ||
499 | if (PortP->ModemState & RIOC_MSVR1_CD) { | ||
500 | /* | ||
501 | ** Has carrier just appeared? | ||
502 | */ | ||
503 | if (!(PortP->State & RIO_CARR_ON)) { | ||
504 | rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n"); | ||
505 | PortP->State |= RIO_CARR_ON; | ||
506 | /* | ||
507 | ** wakeup anyone in WOPEN | ||
508 | */ | ||
509 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) | ||
510 | wake_up_interruptible(&PortP->gs.port.open_wait); | ||
511 | } | ||
512 | } else { | ||
513 | /* | ||
514 | ** Has carrier just dropped? | ||
515 | */ | ||
516 | if (PortP->State & RIO_CARR_ON) { | ||
517 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) | ||
518 | tty_hangup(PortP->gs.port.tty); | ||
519 | PortP->State &= ~RIO_CARR_ON; | ||
520 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | } | ||
525 | #endif | ||
526 | } | ||
527 | break; | ||
528 | |||
529 | default: | ||
530 | rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %Zd\n", readb(&PktCmdP->Command), HostP - p->RIOHosts); | ||
531 | break; | ||
532 | } | ||
533 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
534 | |||
535 | func_exit(); | ||
536 | |||
537 | return 1; | ||
538 | } | ||
539 | |||
540 | /* | ||
541 | ** The command mechanism: | ||
542 | ** Each rup has a chain of commands associated with it. | ||
543 | ** This chain is maintained by routines in this file. | ||
544 | ** Periodically we are called and we run a quick check of all the | ||
545 | ** active chains to determine if there is a command to be executed, | ||
546 | ** and if the rup is ready to accept it. | ||
547 | ** | ||
548 | */ | ||
549 | |||
550 | /* | ||
551 | ** Allocate an empty command block. | ||
552 | */ | ||
553 | struct CmdBlk *RIOGetCmdBlk(void) | ||
554 | { | ||
555 | struct CmdBlk *CmdBlkP; | ||
556 | |||
557 | CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC); | ||
558 | return CmdBlkP; | ||
559 | } | ||
560 | |||
561 | /* | ||
562 | ** Return a block to the head of the free list. | ||
563 | */ | ||
564 | void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) | ||
565 | { | ||
566 | kfree(CmdBlkP); | ||
567 | } | ||
568 | |||
569 | /* | ||
570 | ** attach a command block to the list of commands to be performed for | ||
571 | ** a given rup. | ||
572 | */ | ||
573 | int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | ||
574 | { | ||
575 | struct CmdBlk **Base; | ||
576 | struct UnixRup *UnixRupP; | ||
577 | unsigned long flags; | ||
578 | |||
579 | if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) { | ||
580 | rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); | ||
581 | RIOFreeCmdBlk(CmdBlkP); | ||
582 | return RIO_FAIL; | ||
583 | } | ||
584 | |||
585 | UnixRupP = &HostP->UnixRups[Rup]; | ||
586 | |||
587 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
588 | |||
589 | /* | ||
590 | ** If the RUP is currently inactive, then put the request | ||
591 | ** straight on the RUP.... | ||
592 | */ | ||
593 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) | ||
594 | : 1)) { | ||
595 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); | ||
596 | |||
597 | /* | ||
598 | ** Whammy! blat that pack! | ||
599 | */ | ||
600 | HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT)); | ||
601 | |||
602 | /* | ||
603 | ** place command packet on the pending position. | ||
604 | */ | ||
605 | UnixRupP->CmdPendingP = CmdBlkP; | ||
606 | |||
607 | /* | ||
608 | ** set the command register | ||
609 | */ | ||
610 | writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); | ||
611 | |||
612 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
613 | |||
614 | return 0; | ||
615 | } | ||
616 | rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); | ||
617 | |||
618 | if (UnixRupP->CmdsWaitingP != NULL) | ||
619 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); | ||
620 | if (UnixRupP->CmdPendingP != NULL) | ||
621 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); | ||
622 | if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) | ||
623 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); | ||
624 | |||
625 | Base = &UnixRupP->CmdsWaitingP; | ||
626 | |||
627 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base); | ||
628 | |||
629 | while (*Base) { | ||
630 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base); | ||
631 | Base = &((*Base)->NextP); | ||
632 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base); | ||
633 | } | ||
634 | |||
635 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base); | ||
636 | |||
637 | *Base = CmdBlkP; | ||
638 | |||
639 | CmdBlkP->NextP = NULL; | ||
640 | |||
641 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
642 | |||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | /* | ||
647 | ** Here we go - if there is an empty rup, fill it! | ||
648 | ** must be called at splrio() or higher. | ||
649 | */ | ||
650 | void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | ||
651 | { | ||
652 | struct CmdBlk *CmdBlkP; | ||
653 | struct UnixRup *UnixRupP; | ||
654 | struct PKT __iomem *PacketP; | ||
655 | unsigned short Rup; | ||
656 | unsigned long flags; | ||
657 | |||
658 | |||
659 | Rup = MAX_RUP + LINKS_PER_UNIT; | ||
660 | |||
661 | do { /* do this loop for each RUP */ | ||
662 | /* | ||
663 | ** locate the rup we are processing & lock it | ||
664 | */ | ||
665 | UnixRupP = &HostP->UnixRups[--Rup]; | ||
666 | |||
667 | spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
668 | |||
669 | /* | ||
670 | ** First check for incoming commands: | ||
671 | */ | ||
672 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { | ||
673 | int FreeMe; | ||
674 | |||
675 | PacketP = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); | ||
676 | |||
677 | switch (readb(&PacketP->dest_port)) { | ||
678 | case BOOT_RUP: | ||
679 | rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0])); | ||
680 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
681 | FreeMe = RIOBootRup(p, Rup, HostP, PacketP); | ||
682 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
683 | break; | ||
684 | |||
685 | case COMMAND_RUP: | ||
686 | /* | ||
687 | ** Free the RUP lock as loss of carrier causes a | ||
688 | ** ttyflush which will (eventually) call another | ||
689 | ** routine that uses the RUP lock. | ||
690 | */ | ||
691 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
692 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); | ||
693 | if (readb(&PacketP->data[5]) == RIOC_MEMDUMP) { | ||
694 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", readw(&(PacketP->data[6]))); | ||
695 | rio_memcpy_fromio(p->RIOMemDump, &(PacketP->data[8]), 32); | ||
696 | } | ||
697 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
698 | break; | ||
699 | |||
700 | case ROUTE_RUP: | ||
701 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
702 | FreeMe = RIORouteRup(p, Rup, HostP, PacketP); | ||
703 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
704 | break; | ||
705 | |||
706 | default: | ||
707 | rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port)); | ||
708 | FreeMe = 1; | ||
709 | break; | ||
710 | } | ||
711 | |||
712 | if (FreeMe) { | ||
713 | rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); | ||
714 | put_free_end(HostP, PacketP); | ||
715 | |||
716 | writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol); | ||
717 | |||
718 | if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { | ||
719 | rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); | ||
720 | writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake); | ||
721 | } | ||
722 | } | ||
723 | } | ||
724 | |||
725 | /* | ||
726 | ** IF a command was running on the port, | ||
727 | ** and it has completed, then tidy it up. | ||
728 | */ | ||
729 | if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ | ||
730 | (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | ||
731 | /* | ||
732 | ** we are idle. | ||
733 | ** there is a command in pending. | ||
734 | ** Therefore, this command has finished. | ||
735 | ** So, wakeup whoever is waiting for it (and tell them | ||
736 | ** what happened). | ||
737 | */ | ||
738 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) | ||
739 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); | ||
740 | |||
741 | rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP); | ||
742 | |||
743 | /* | ||
744 | ** Clear the Rup lock to prevent mutual exclusion. | ||
745 | */ | ||
746 | if (CmdBlkP->PostFuncP) { | ||
747 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
748 | (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP); | ||
749 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
750 | } | ||
751 | |||
752 | /* | ||
753 | ** ....clear the pending flag.... | ||
754 | */ | ||
755 | UnixRupP->CmdPendingP = NULL; | ||
756 | |||
757 | /* | ||
758 | ** ....and return the command block to the freelist. | ||
759 | */ | ||
760 | RIOFreeCmdBlk(CmdBlkP); | ||
761 | } | ||
762 | |||
763 | /* | ||
764 | ** If there is a command for this rup, and the rup | ||
765 | ** is idle, then process the command | ||
766 | */ | ||
767 | if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ | ||
768 | (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | ||
769 | /* | ||
770 | ** if the pre-function is non-zero, call it. | ||
771 | ** If it returns RIO_FAIL then don't | ||
772 | ** send this command yet! | ||
773 | */ | ||
774 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : 1)) { | ||
775 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command %p\n", CmdBlkP); | ||
776 | } else { | ||
777 | rio_dprintk(RIO_DEBUG_CMD, "Start new command %p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); | ||
778 | /* | ||
779 | ** Whammy! blat that pack! | ||
780 | */ | ||
781 | HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT)); | ||
782 | |||
783 | /* | ||
784 | ** remove the command from the rup command queue... | ||
785 | */ | ||
786 | UnixRupP->CmdsWaitingP = CmdBlkP->NextP; | ||
787 | |||
788 | /* | ||
789 | ** ...and place it on the pending position. | ||
790 | */ | ||
791 | UnixRupP->CmdPendingP = CmdBlkP; | ||
792 | |||
793 | /* | ||
794 | ** set the command register | ||
795 | */ | ||
796 | writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); | ||
797 | |||
798 | /* | ||
799 | ** the command block will be freed | ||
800 | ** when the command has been processed. | ||
801 | */ | ||
802 | } | ||
803 | } | ||
804 | spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | ||
805 | } while (Rup); | ||
806 | } | ||
807 | |||
808 | int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) | ||
809 | { | ||
810 | struct Port *PortP = (struct Port *) iPortP; | ||
811 | unsigned long flags; | ||
812 | |||
813 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
814 | PortP->WflushFlag++; | ||
815 | PortP->MagicFlags |= MAGIC_FLUSH; | ||
816 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
817 | return RIOUnUse(iPortP, CmdBlkP); | ||
818 | } | ||
819 | |||
820 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) | ||
821 | { | ||
822 | struct Port *PortP = (struct Port *) iPortP; | ||
823 | struct PKT __iomem *PacketP; | ||
824 | unsigned long flags; | ||
825 | |||
826 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
827 | |||
828 | while (can_remove_receive(&PacketP, PortP)) { | ||
829 | remove_receive(PortP); | ||
830 | put_free_end(PortP->HostP, PacketP); | ||
831 | } | ||
832 | |||
833 | if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { | ||
834 | /* | ||
835 | ** MAGIC! (Basically, handshake the RX buffer, so that | ||
836 | ** the RTAs upstream can be re-enabled.) | ||
837 | */ | ||
838 | rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); | ||
839 | writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake); | ||
840 | } | ||
841 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
842 | return RIOUnUse(iPortP, CmdBlkP); | ||
843 | } | ||
844 | |||
845 | int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) | ||
846 | { | ||
847 | struct Port *PortP = (struct Port *) iPortP; | ||
848 | unsigned long flags; | ||
849 | |||
850 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
851 | |||
852 | rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); | ||
853 | |||
854 | if (PortP->InUse) { | ||
855 | if (--PortP->InUse != NOT_INUSE) { | ||
856 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
857 | return 0; | ||
858 | } | ||
859 | } | ||
860 | /* | ||
861 | ** While PortP->InUse is set (i.e. a preemptive command has been sent to | ||
862 | ** the RTA and is awaiting completion), any transmit data is prevented from | ||
863 | ** being transferred from the write queue into the transmit packets | ||
864 | ** (add_transmit) and no furthur transmit interrupt will be sent for that | ||
865 | ** data. The next interrupt will occur up to 500ms later (RIOIntr is called | ||
866 | ** twice a second as a saftey measure). This was the case when kermit was | ||
867 | ** used to send data into a RIO port. After each packet was sent, TCFLSH | ||
868 | ** was called to flush the read queue preemptively. PortP->InUse was | ||
869 | ** incremented, thereby blocking the 6 byte acknowledgement packet | ||
870 | ** transmitted back. This acknowledgment hung around for 500ms before | ||
871 | ** being sent, thus reducing input performance substantially!. | ||
872 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data | ||
873 | ** hanging around in the transmit buffer is sent immediately. | ||
874 | */ | ||
875 | writew(1, &PortP->HostP->ParmMapP->tx_intr); | ||
876 | /* What to do here .. | ||
877 | wakeup( (caddr_t)&(PortP->InUse) ); | ||
878 | */ | ||
879 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
880 | return 0; | ||
881 | } | ||
882 | |||
883 | /* | ||
884 | ** | ||
885 | ** How to use this file: | ||
886 | ** | ||
887 | ** To send a command down a rup, you need to allocate a command block, fill | ||
888 | ** in the packet information, fill in the command number, fill in the pre- | ||
889 | ** and post- functions and arguments, and then add the command block to the | ||
890 | ** queue of command blocks for the port in question. When the port is idle, | ||
891 | ** then the pre-function will be called. If this returns RIO_FAIL then the | ||
892 | ** command will be re-queued and tried again at a later date (probably in one | ||
893 | ** clock tick). If the pre-function returns NOT RIO_FAIL, then the command | ||
894 | ** packet will be queued on the RUP, and the txcontrol field set to the | ||
895 | ** command number. When the txcontrol field has changed from being the | ||
896 | ** command number, then the post-function will be called, with the argument | ||
897 | ** specified earlier, a pointer to the command block, and the value of | ||
898 | ** txcontrol. | ||
899 | ** | ||
900 | ** To allocate a command block, call RIOGetCmdBlk(). This returns a pointer | ||
901 | ** to the command block structure allocated, or NULL if there aren't any. | ||
902 | ** The block will have been zeroed for you. | ||
903 | ** | ||
904 | ** The structure has the following fields: | ||
905 | ** | ||
906 | ** struct CmdBlk | ||
907 | ** { | ||
908 | ** struct CmdBlk *NextP; ** Pointer to next command block ** | ||
909 | ** struct PKT Packet; ** A packet, to copy to the rup ** | ||
910 | ** int (*PreFuncP)(); ** The func to call to check if OK ** | ||
911 | ** int PreArg; ** The arg for the func ** | ||
912 | ** int (*PostFuncP)(); ** The func to call when completed ** | ||
913 | ** int PostArg; ** The arg for the func ** | ||
914 | ** }; | ||
915 | ** | ||
916 | ** You need to fill in ALL fields EXCEPT NextP, which is used to link the | ||
917 | ** blocks together either on the free list or on the Rup list. | ||
918 | ** | ||
919 | ** Packet is an actual packet structure to be filled in with the packet | ||
920 | ** information associated with the command. You need to fill in everything, | ||
921 | ** as the command processor doesn't process the command packet in any way. | ||
922 | ** | ||
923 | ** The PreFuncP is called before the packet is enqueued on the host rup. | ||
924 | ** PreFuncP is called as (*PreFuncP)(PreArg, CmdBlkP);. PreFuncP must | ||
925 | ** return !RIO_FAIL to have the packet queued on the rup, and RIO_FAIL | ||
926 | ** if the packet is NOT to be queued. | ||
927 | ** | ||
928 | ** The PostFuncP is called when the command has completed. It is called | ||
929 | ** as (*PostFuncP)(PostArg, CmdBlkP, txcontrol);. PostFuncP is not expected | ||
930 | ** to return a value. PostFuncP does NOT need to free the command block, | ||
931 | ** as this happens automatically after PostFuncP returns. | ||
932 | ** | ||
933 | ** Once the command block has been filled in, it is attached to the correct | ||
934 | ** queue by calling RIOQueueCmdBlk( HostP, Rup, CmdBlkP ) where HostP is | ||
935 | ** a pointer to the struct Host, Rup is the NUMBER of the rup (NOT a pointer | ||
936 | ** to it!), and CmdBlkP is the pointer to the command block allocated using | ||
937 | ** RIOGetCmdBlk(). | ||
938 | ** | ||
939 | */ | ||
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c deleted file mode 100644 index 780506326a73..000000000000 --- a/drivers/char/rio/rioctrl.c +++ /dev/null | |||
@@ -1,1504 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioctrl.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:42 | ||
26 | ** Retrieved : 11/6/98 10:33:49 | ||
27 | ** | ||
28 | ** ident @(#)rioctrl.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/sched.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <linux/errno.h> | ||
37 | #include <asm/io.h> | ||
38 | #include <asm/system.h> | ||
39 | #include <asm/string.h> | ||
40 | #include <asm/uaccess.h> | ||
41 | |||
42 | #include <linux/termios.h> | ||
43 | #include <linux/serial.h> | ||
44 | |||
45 | #include <linux/generic_serial.h> | ||
46 | |||
47 | |||
48 | #include "linux_compat.h" | ||
49 | #include "rio_linux.h" | ||
50 | #include "pkt.h" | ||
51 | #include "daemon.h" | ||
52 | #include "rio.h" | ||
53 | #include "riospace.h" | ||
54 | #include "cmdpkt.h" | ||
55 | #include "map.h" | ||
56 | #include "rup.h" | ||
57 | #include "port.h" | ||
58 | #include "riodrvr.h" | ||
59 | #include "rioinfo.h" | ||
60 | #include "func.h" | ||
61 | #include "errors.h" | ||
62 | #include "pci.h" | ||
63 | |||
64 | #include "parmmap.h" | ||
65 | #include "unixrup.h" | ||
66 | #include "board.h" | ||
67 | #include "host.h" | ||
68 | #include "phb.h" | ||
69 | #include "link.h" | ||
70 | #include "cmdblk.h" | ||
71 | #include "route.h" | ||
72 | #include "cirrus.h" | ||
73 | #include "rioioctl.h" | ||
74 | |||
75 | |||
76 | static struct LpbReq LpbReq; | ||
77 | static struct RupReq RupReq; | ||
78 | static struct PortReq PortReq; | ||
79 | static struct HostReq HostReq; /* oh really? global? and no locking? */ | ||
80 | static struct HostDpRam HostDpRam; | ||
81 | static struct DebugCtrl DebugCtrl; | ||
82 | static struct Map MapEnt; | ||
83 | static struct PortSetup PortSetup; | ||
84 | static struct DownLoad DownLoad; | ||
85 | static struct SendPack SendPack; | ||
86 | /* static struct StreamInfo StreamInfo; */ | ||
87 | /* static char modemtable[RIO_PORTS]; */ | ||
88 | static struct SpecialRupCmd SpecialRupCmd; | ||
89 | static struct PortParams PortParams; | ||
90 | static struct portStats portStats; | ||
91 | |||
92 | static struct SubCmdStruct { | ||
93 | ushort Host; | ||
94 | ushort Rup; | ||
95 | ushort Port; | ||
96 | ushort Addr; | ||
97 | } SubCmd; | ||
98 | |||
99 | struct PortTty { | ||
100 | uint port; | ||
101 | struct ttystatics Tty; | ||
102 | }; | ||
103 | |||
104 | static struct PortTty PortTty; | ||
105 | typedef struct ttystatics TERMIO; | ||
106 | |||
107 | /* | ||
108 | ** This table is used when the config.rio downloads bin code to the | ||
109 | ** driver. We index the table using the product code, 0-F, and call | ||
110 | ** the function pointed to by the entry, passing the information | ||
111 | ** about the boot. | ||
112 | ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling | ||
113 | ** process to bog off. | ||
114 | */ | ||
115 | static int | ||
116 | (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = { | ||
117 | /* 0 */ RIOBootCodeHOST, | ||
118 | /* Host Card */ | ||
119 | /* 1 */ RIOBootCodeRTA, | ||
120 | /* RTA */ | ||
121 | }; | ||
122 | |||
123 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) | ||
124 | |||
125 | static int copy_from_io(void __user *to, void __iomem *from, size_t size) | ||
126 | { | ||
127 | void *buf = kmalloc(size, GFP_KERNEL); | ||
128 | int res = -ENOMEM; | ||
129 | if (buf) { | ||
130 | rio_memcpy_fromio(buf, from, size); | ||
131 | res = copy_to_user(to, buf, size); | ||
132 | kfree(buf); | ||
133 | } | ||
134 | return res; | ||
135 | } | ||
136 | |||
137 | int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su) | ||
138 | { | ||
139 | uint Host; /* leave me unsigned! */ | ||
140 | uint port; /* and me! */ | ||
141 | struct Host *HostP; | ||
142 | ushort loop; | ||
143 | int Entry; | ||
144 | struct Port *PortP; | ||
145 | struct PKT __iomem *PacketP; | ||
146 | int retval = 0; | ||
147 | unsigned long flags; | ||
148 | void __user *argp = (void __user *)arg; | ||
149 | |||
150 | func_enter(); | ||
151 | |||
152 | /* Confuse the compiler to think that we've initialized these */ | ||
153 | Host = 0; | ||
154 | PortP = NULL; | ||
155 | |||
156 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, argp); | ||
157 | |||
158 | switch (cmd) { | ||
159 | /* | ||
160 | ** RIO_SET_TIMER | ||
161 | ** | ||
162 | ** Change the value of the host card interrupt timer. | ||
163 | ** If the host card number is -1 then all host cards are changed | ||
164 | ** otherwise just the specified host card will be changed. | ||
165 | */ | ||
166 | case RIO_SET_TIMER: | ||
167 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", arg); | ||
168 | { | ||
169 | int host, value; | ||
170 | host = (arg >> 16) & 0x0000FFFF; | ||
171 | value = arg & 0x0000ffff; | ||
172 | if (host == -1) { | ||
173 | for (host = 0; host < p->RIONumHosts; host++) { | ||
174 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | ||
175 | writew(value, &p->RIOHosts[host].ParmMapP->timer); | ||
176 | } | ||
177 | } | ||
178 | } else if (host >= p->RIONumHosts) { | ||
179 | return -EINVAL; | ||
180 | } else { | ||
181 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | ||
182 | writew(value, &p->RIOHosts[host].ParmMapP->timer); | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | return 0; | ||
187 | |||
188 | case RIO_FOAD_RTA: | ||
189 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | ||
190 | return RIOCommandRta(p, arg, RIOFoadRta); | ||
191 | |||
192 | case RIO_ZOMBIE_RTA: | ||
193 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | ||
194 | return RIOCommandRta(p, arg, RIOZombieRta); | ||
195 | |||
196 | case RIO_IDENTIFY_RTA: | ||
197 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | ||
198 | return RIOIdentifyRta(p, argp); | ||
199 | |||
200 | case RIO_KILL_NEIGHBOUR: | ||
201 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | ||
202 | return RIOKillNeighbour(p, argp); | ||
203 | |||
204 | case SPECIAL_RUP_CMD: | ||
205 | { | ||
206 | struct CmdBlk *CmdBlkP; | ||
207 | |||
208 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | ||
209 | if (copy_from_user(&SpecialRupCmd, argp, sizeof(SpecialRupCmd))) { | ||
210 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | ||
211 | p->RIOError.Error = COPYIN_FAILED; | ||
212 | return -EFAULT; | ||
213 | } | ||
214 | CmdBlkP = RIOGetCmdBlk(); | ||
215 | if (!CmdBlkP) { | ||
216 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); | ||
217 | return -ENXIO; | ||
218 | } | ||
219 | CmdBlkP->Packet = SpecialRupCmd.Packet; | ||
220 | if (SpecialRupCmd.Host >= p->RIONumHosts) | ||
221 | SpecialRupCmd.Host = 0; | ||
222 | rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum); | ||
223 | if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { | ||
224 | printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n"); | ||
225 | } | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | case RIO_DEBUG_MEM: | ||
230 | return -EPERM; | ||
231 | |||
232 | case RIO_ALL_MODEM: | ||
233 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); | ||
234 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
235 | return -EINVAL; | ||
236 | |||
237 | case RIO_GET_TABLE: | ||
238 | /* | ||
239 | ** Read the routing table from the device driver to user space | ||
240 | */ | ||
241 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); | ||
242 | |||
243 | if ((retval = RIOApel(p)) != 0) | ||
244 | return retval; | ||
245 | |||
246 | if (copy_to_user(argp, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | ||
247 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | ||
248 | p->RIOError.Error = COPYOUT_FAILED; | ||
249 | return -EFAULT; | ||
250 | } | ||
251 | |||
252 | { | ||
253 | int entry; | ||
254 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); | ||
255 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { | ||
256 | if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0)) | ||
257 | continue; | ||
258 | |||
259 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum); | ||
260 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum); | ||
261 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID); | ||
262 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2); | ||
263 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags); | ||
264 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort); | ||
265 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit); | ||
266 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link); | ||
267 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit); | ||
268 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link); | ||
269 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit); | ||
270 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link); | ||
271 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit); | ||
272 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link); | ||
273 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name); | ||
274 | } | ||
275 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); | ||
276 | } | ||
277 | p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ | ||
278 | return 0; | ||
279 | |||
280 | case RIO_PUT_TABLE: | ||
281 | /* | ||
282 | ** Write the routing table to the device driver from user space | ||
283 | */ | ||
284 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); | ||
285 | |||
286 | if (!su) { | ||
287 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); | ||
288 | p->RIOError.Error = NOT_SUPER_USER; | ||
289 | return -EPERM; | ||
290 | } | ||
291 | if (copy_from_user(&p->RIOConnectTable[0], argp, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | ||
292 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); | ||
293 | p->RIOError.Error = COPYIN_FAILED; | ||
294 | return -EFAULT; | ||
295 | } | ||
296 | /* | ||
297 | *********************************** | ||
298 | { | ||
299 | int entry; | ||
300 | rio_dprint(RIO_DEBUG_CTRL, ("*****\nMAP ENTRIES\n") ); | ||
301 | for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ ) | ||
302 | { | ||
303 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ) ); | ||
304 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ) ); | ||
305 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ) ); | ||
306 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ) ); | ||
307 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Flags = 0x%x\n", entry, p->RIOConnectTable[entry].Flags ) ); | ||
308 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.SysPort = 0x%x\n", entry, p->RIOConnectTable[entry].SysPort ) ); | ||
309 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ) ); | ||
310 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Link ) ); | ||
311 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ) ); | ||
312 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Link ) ); | ||
313 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ) ); | ||
314 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Link ) ); | ||
315 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[3].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ) ); | ||
316 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[4].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Link ) ); | ||
317 | rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ) ); | ||
318 | } | ||
319 | rio_dprint(RIO_DEBUG_CTRL, ("*****\nEND MAP ENTRIES\n") ); | ||
320 | } | ||
321 | *********************************** | ||
322 | */ | ||
323 | return RIONewTable(p); | ||
324 | |||
325 | case RIO_GET_BINDINGS: | ||
326 | /* | ||
327 | ** Send bindings table, containing unique numbers of RTAs owned | ||
328 | ** by this system to user space | ||
329 | */ | ||
330 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); | ||
331 | |||
332 | if (!su) { | ||
333 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); | ||
334 | p->RIOError.Error = NOT_SUPER_USER; | ||
335 | return -EPERM; | ||
336 | } | ||
337 | if (copy_to_user(argp, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | ||
338 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | ||
339 | p->RIOError.Error = COPYOUT_FAILED; | ||
340 | return -EFAULT; | ||
341 | } | ||
342 | return 0; | ||
343 | |||
344 | case RIO_PUT_BINDINGS: | ||
345 | /* | ||
346 | ** Receive a bindings table, containing unique numbers of RTAs owned | ||
347 | ** by this system | ||
348 | */ | ||
349 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); | ||
350 | |||
351 | if (!su) { | ||
352 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); | ||
353 | p->RIOError.Error = NOT_SUPER_USER; | ||
354 | return -EPERM; | ||
355 | } | ||
356 | if (copy_from_user(&p->RIOBindTab[0], argp, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | ||
357 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | ||
358 | p->RIOError.Error = COPYIN_FAILED; | ||
359 | return -EFAULT; | ||
360 | } | ||
361 | return 0; | ||
362 | |||
363 | case RIO_BIND_RTA: | ||
364 | { | ||
365 | int EmptySlot = -1; | ||
366 | /* | ||
367 | ** Bind this RTA to host, so that it will be booted by | ||
368 | ** host in 'boot owned RTAs' mode. | ||
369 | */ | ||
370 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); | ||
371 | |||
372 | if (!su) { | ||
373 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); | ||
374 | p->RIOError.Error = NOT_SUPER_USER; | ||
375 | return -EPERM; | ||
376 | } | ||
377 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { | ||
378 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) | ||
379 | EmptySlot = Entry; | ||
380 | else if (p->RIOBindTab[Entry] == arg) { | ||
381 | /* | ||
382 | ** Already exists - delete | ||
383 | */ | ||
384 | p->RIOBindTab[Entry] = 0L; | ||
385 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", arg); | ||
386 | return 0; | ||
387 | } | ||
388 | } | ||
389 | /* | ||
390 | ** Dosen't exist - add | ||
391 | */ | ||
392 | if (EmptySlot != -1) { | ||
393 | p->RIOBindTab[EmptySlot] = arg; | ||
394 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", arg); | ||
395 | } else { | ||
396 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", arg); | ||
397 | return -ENOMEM; | ||
398 | } | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | case RIO_RESUME: | ||
403 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); | ||
404 | port = arg; | ||
405 | if ((port < 0) || (port > 511)) { | ||
406 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); | ||
407 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
408 | return -EINVAL; | ||
409 | } | ||
410 | PortP = p->RIOPortp[port]; | ||
411 | if (!PortP->Mapped) { | ||
412 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); | ||
413 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | ||
414 | return -EINVAL; | ||
415 | } | ||
416 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | ||
417 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); | ||
418 | return -EINVAL; | ||
419 | } | ||
420 | |||
421 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
422 | if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RIOC_RESUME) == | ||
423 | RIO_FAIL) { | ||
424 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); | ||
425 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
426 | return -EBUSY; | ||
427 | } else { | ||
428 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); | ||
429 | PortP->State |= RIO_BUSY; | ||
430 | } | ||
431 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
432 | return retval; | ||
433 | |||
434 | case RIO_ASSIGN_RTA: | ||
435 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); | ||
436 | if (!su) { | ||
437 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); | ||
438 | p->RIOError.Error = NOT_SUPER_USER; | ||
439 | return -EPERM; | ||
440 | } | ||
441 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { | ||
442 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | ||
443 | p->RIOError.Error = COPYIN_FAILED; | ||
444 | return -EFAULT; | ||
445 | } | ||
446 | return RIOAssignRta(p, &MapEnt); | ||
447 | |||
448 | case RIO_CHANGE_NAME: | ||
449 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); | ||
450 | if (!su) { | ||
451 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); | ||
452 | p->RIOError.Error = NOT_SUPER_USER; | ||
453 | return -EPERM; | ||
454 | } | ||
455 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { | ||
456 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | ||
457 | p->RIOError.Error = COPYIN_FAILED; | ||
458 | return -EFAULT; | ||
459 | } | ||
460 | return RIOChangeName(p, &MapEnt); | ||
461 | |||
462 | case RIO_DELETE_RTA: | ||
463 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); | ||
464 | if (!su) { | ||
465 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); | ||
466 | p->RIOError.Error = NOT_SUPER_USER; | ||
467 | return -EPERM; | ||
468 | } | ||
469 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { | ||
470 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); | ||
471 | p->RIOError.Error = COPYIN_FAILED; | ||
472 | return -EFAULT; | ||
473 | } | ||
474 | return RIODeleteRta(p, &MapEnt); | ||
475 | |||
476 | case RIO_QUICK_CHECK: | ||
477 | if (copy_to_user(argp, &p->RIORtaDisCons, sizeof(unsigned int))) { | ||
478 | p->RIOError.Error = COPYOUT_FAILED; | ||
479 | return -EFAULT; | ||
480 | } | ||
481 | return 0; | ||
482 | |||
483 | case RIO_LAST_ERROR: | ||
484 | if (copy_to_user(argp, &p->RIOError, sizeof(struct Error))) | ||
485 | return -EFAULT; | ||
486 | return 0; | ||
487 | |||
488 | case RIO_GET_LOG: | ||
489 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); | ||
490 | return -EINVAL; | ||
491 | |||
492 | case RIO_GET_MODTYPE: | ||
493 | if (copy_from_user(&port, argp, sizeof(unsigned int))) { | ||
494 | p->RIOError.Error = COPYIN_FAILED; | ||
495 | return -EFAULT; | ||
496 | } | ||
497 | rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port); | ||
498 | if (port < 0 || port > 511) { | ||
499 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); | ||
500 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
501 | return -EINVAL; | ||
502 | } | ||
503 | PortP = (p->RIOPortp[port]); | ||
504 | if (!PortP->Mapped) { | ||
505 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); | ||
506 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | ||
507 | return -EINVAL; | ||
508 | } | ||
509 | /* | ||
510 | ** Return module type of port | ||
511 | */ | ||
512 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; | ||
513 | if (copy_to_user(argp, &port, sizeof(unsigned int))) { | ||
514 | p->RIOError.Error = COPYOUT_FAILED; | ||
515 | return -EFAULT; | ||
516 | } | ||
517 | return (0); | ||
518 | case RIO_BLOCK_OPENS: | ||
519 | rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n"); | ||
520 | for (Entry = 0; Entry < RIO_PORTS; Entry++) { | ||
521 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
522 | p->RIOPortp[Entry]->WaitUntilBooted = 1; | ||
523 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
524 | } | ||
525 | return 0; | ||
526 | |||
527 | case RIO_SETUP_PORTS: | ||
528 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); | ||
529 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { | ||
530 | p->RIOError.Error = COPYIN_FAILED; | ||
531 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); | ||
532 | return -EFAULT; | ||
533 | } | ||
534 | if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) { | ||
535 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
536 | rio_dprintk(RIO_DEBUG_CTRL, "ENXIO"); | ||
537 | return -ENXIO; | ||
538 | } | ||
539 | if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) { | ||
540 | p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; | ||
541 | rio_dprintk(RIO_DEBUG_CTRL, "EINVAL"); | ||
542 | return -EINVAL; | ||
543 | } | ||
544 | if (!p->RIOPortp) { | ||
545 | printk(KERN_ERR "rio: No p->RIOPortp array!\n"); | ||
546 | rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); | ||
547 | return -EIO; | ||
548 | } | ||
549 | rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); | ||
550 | for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { | ||
551 | rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); | ||
552 | } | ||
553 | rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); | ||
554 | rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); | ||
555 | return retval; | ||
556 | |||
557 | case RIO_GET_PORT_SETUP: | ||
558 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); | ||
559 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { | ||
560 | p->RIOError.Error = COPYIN_FAILED; | ||
561 | return -EFAULT; | ||
562 | } | ||
563 | if (PortSetup.From >= RIO_PORTS) { | ||
564 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
565 | return -ENXIO; | ||
566 | } | ||
567 | |||
568 | port = PortSetup.To = PortSetup.From; | ||
569 | PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0; | ||
570 | PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0; | ||
571 | PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0; | ||
572 | PortSetup.Store = p->RIOPortp[port]->Store; | ||
573 | PortSetup.Lock = p->RIOPortp[port]->Lock; | ||
574 | PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; | ||
575 | memcpy(PortSetup.XpOn, p->RIOPortp[port]->Xprint.XpOn, MAX_XP_CTRL_LEN); | ||
576 | memcpy(PortSetup.XpOff, p->RIOPortp[port]->Xprint.XpOff, MAX_XP_CTRL_LEN); | ||
577 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
578 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
579 | |||
580 | if (copy_to_user(argp, &PortSetup, sizeof(PortSetup))) { | ||
581 | p->RIOError.Error = COPYOUT_FAILED; | ||
582 | return -EFAULT; | ||
583 | } | ||
584 | return retval; | ||
585 | |||
586 | case RIO_GET_PORT_PARAMS: | ||
587 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); | ||
588 | if (copy_from_user(&PortParams, argp, sizeof(struct PortParams))) { | ||
589 | p->RIOError.Error = COPYIN_FAILED; | ||
590 | return -EFAULT; | ||
591 | } | ||
592 | if (PortParams.Port >= RIO_PORTS) { | ||
593 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
594 | return -ENXIO; | ||
595 | } | ||
596 | PortP = (p->RIOPortp[PortParams.Port]); | ||
597 | PortParams.Config = PortP->Config; | ||
598 | PortParams.State = PortP->State; | ||
599 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | ||
600 | |||
601 | if (copy_to_user(argp, &PortParams, sizeof(struct PortParams))) { | ||
602 | p->RIOError.Error = COPYOUT_FAILED; | ||
603 | return -EFAULT; | ||
604 | } | ||
605 | return retval; | ||
606 | |||
607 | case RIO_GET_PORT_TTY: | ||
608 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); | ||
609 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { | ||
610 | p->RIOError.Error = COPYIN_FAILED; | ||
611 | return -EFAULT; | ||
612 | } | ||
613 | if (PortTty.port >= RIO_PORTS) { | ||
614 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
615 | return -ENXIO; | ||
616 | } | ||
617 | |||
618 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | ||
619 | PortP = (p->RIOPortp[PortTty.port]); | ||
620 | if (copy_to_user(argp, &PortTty, sizeof(struct PortTty))) { | ||
621 | p->RIOError.Error = COPYOUT_FAILED; | ||
622 | return -EFAULT; | ||
623 | } | ||
624 | return retval; | ||
625 | |||
626 | case RIO_SET_PORT_TTY: | ||
627 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { | ||
628 | p->RIOError.Error = COPYIN_FAILED; | ||
629 | return -EFAULT; | ||
630 | } | ||
631 | rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); | ||
632 | if (PortTty.port >= (ushort) RIO_PORTS) { | ||
633 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
634 | return -ENXIO; | ||
635 | } | ||
636 | PortP = (p->RIOPortp[PortTty.port]); | ||
637 | RIOParam(PortP, RIOC_CONFIG, PortP->State & RIO_MODEM, | ||
638 | OK_TO_SLEEP); | ||
639 | return retval; | ||
640 | |||
641 | case RIO_SET_PORT_PARAMS: | ||
642 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); | ||
643 | if (copy_from_user(&PortParams, argp, sizeof(PortParams))) { | ||
644 | p->RIOError.Error = COPYIN_FAILED; | ||
645 | return -EFAULT; | ||
646 | } | ||
647 | if (PortParams.Port >= (ushort) RIO_PORTS) { | ||
648 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
649 | return -ENXIO; | ||
650 | } | ||
651 | PortP = (p->RIOPortp[PortParams.Port]); | ||
652 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
653 | PortP->Config = PortParams.Config; | ||
654 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
655 | return retval; | ||
656 | |||
657 | case RIO_GET_PORT_STATS: | ||
658 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); | ||
659 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { | ||
660 | p->RIOError.Error = COPYIN_FAILED; | ||
661 | return -EFAULT; | ||
662 | } | ||
663 | if (portStats.port < 0 || portStats.port >= RIO_PORTS) { | ||
664 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
665 | return -ENXIO; | ||
666 | } | ||
667 | PortP = (p->RIOPortp[portStats.port]); | ||
668 | portStats.gather = PortP->statsGather; | ||
669 | portStats.txchars = PortP->txchars; | ||
670 | portStats.rxchars = PortP->rxchars; | ||
671 | portStats.opens = PortP->opens; | ||
672 | portStats.closes = PortP->closes; | ||
673 | portStats.ioctls = PortP->ioctls; | ||
674 | if (copy_to_user(argp, &portStats, sizeof(struct portStats))) { | ||
675 | p->RIOError.Error = COPYOUT_FAILED; | ||
676 | return -EFAULT; | ||
677 | } | ||
678 | return retval; | ||
679 | |||
680 | case RIO_RESET_PORT_STATS: | ||
681 | port = arg; | ||
682 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); | ||
683 | if (port >= RIO_PORTS) { | ||
684 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
685 | return -ENXIO; | ||
686 | } | ||
687 | PortP = (p->RIOPortp[port]); | ||
688 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
689 | PortP->txchars = 0; | ||
690 | PortP->rxchars = 0; | ||
691 | PortP->opens = 0; | ||
692 | PortP->closes = 0; | ||
693 | PortP->ioctls = 0; | ||
694 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
695 | return retval; | ||
696 | |||
697 | case RIO_GATHER_PORT_STATS: | ||
698 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | ||
699 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { | ||
700 | p->RIOError.Error = COPYIN_FAILED; | ||
701 | return -EFAULT; | ||
702 | } | ||
703 | if (portStats.port < 0 || portStats.port >= RIO_PORTS) { | ||
704 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
705 | return -ENXIO; | ||
706 | } | ||
707 | PortP = (p->RIOPortp[portStats.port]); | ||
708 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
709 | PortP->statsGather = portStats.gather; | ||
710 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
711 | return retval; | ||
712 | |||
713 | case RIO_READ_CONFIG: | ||
714 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); | ||
715 | if (copy_to_user(argp, &p->RIOConf, sizeof(struct Conf))) { | ||
716 | p->RIOError.Error = COPYOUT_FAILED; | ||
717 | return -EFAULT; | ||
718 | } | ||
719 | return retval; | ||
720 | |||
721 | case RIO_SET_CONFIG: | ||
722 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); | ||
723 | if (!su) { | ||
724 | p->RIOError.Error = NOT_SUPER_USER; | ||
725 | return -EPERM; | ||
726 | } | ||
727 | if (copy_from_user(&p->RIOConf, argp, sizeof(struct Conf))) { | ||
728 | p->RIOError.Error = COPYIN_FAILED; | ||
729 | return -EFAULT; | ||
730 | } | ||
731 | /* | ||
732 | ** move a few value around | ||
733 | */ | ||
734 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
735 | if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING) | ||
736 | writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer); | ||
737 | return retval; | ||
738 | |||
739 | case RIO_START_POLLER: | ||
740 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); | ||
741 | return -EINVAL; | ||
742 | |||
743 | case RIO_STOP_POLLER: | ||
744 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); | ||
745 | if (!su) { | ||
746 | p->RIOError.Error = NOT_SUPER_USER; | ||
747 | return -EPERM; | ||
748 | } | ||
749 | p->RIOPolling = NOT_POLLING; | ||
750 | return retval; | ||
751 | |||
752 | case RIO_SETDEBUG: | ||
753 | case RIO_GETDEBUG: | ||
754 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | ||
755 | if (copy_from_user(&DebugCtrl, argp, sizeof(DebugCtrl))) { | ||
756 | p->RIOError.Error = COPYIN_FAILED; | ||
757 | return -EFAULT; | ||
758 | } | ||
759 | if (DebugCtrl.SysPort == NO_PORT) { | ||
760 | if (cmd == RIO_SETDEBUG) { | ||
761 | if (!su) { | ||
762 | p->RIOError.Error = NOT_SUPER_USER; | ||
763 | return -EPERM; | ||
764 | } | ||
765 | p->rio_debug = DebugCtrl.Debug; | ||
766 | p->RIODebugWait = DebugCtrl.Wait; | ||
767 | rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait); | ||
768 | } else { | ||
769 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); | ||
770 | DebugCtrl.Debug = p->rio_debug; | ||
771 | DebugCtrl.Wait = p->RIODebugWait; | ||
772 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { | ||
773 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | ||
774 | p->RIOError.Error = COPYOUT_FAILED; | ||
775 | return -EFAULT; | ||
776 | } | ||
777 | } | ||
778 | } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) { | ||
779 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | ||
780 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
781 | return -ENXIO; | ||
782 | } else if (cmd == RIO_SETDEBUG) { | ||
783 | if (!su) { | ||
784 | p->RIOError.Error = NOT_SUPER_USER; | ||
785 | return -EPERM; | ||
786 | } | ||
787 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
788 | p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; | ||
789 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
790 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
791 | } else { | ||
792 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
793 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | ||
794 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { | ||
795 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | ||
796 | p->RIOError.Error = COPYOUT_FAILED; | ||
797 | return -EFAULT; | ||
798 | } | ||
799 | } | ||
800 | return retval; | ||
801 | |||
802 | case RIO_VERSID: | ||
803 | /* | ||
804 | ** Enquire about the release and version. | ||
805 | ** We return MAX_VERSION_LEN bytes, being a | ||
806 | ** textual null terminated string. | ||
807 | */ | ||
808 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); | ||
809 | if (copy_to_user(argp, RIOVersid(), sizeof(struct rioVersion))) { | ||
810 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | ||
811 | p->RIOError.Error = COPYOUT_FAILED; | ||
812 | return -EFAULT; | ||
813 | } | ||
814 | return retval; | ||
815 | |||
816 | case RIO_NUM_HOSTS: | ||
817 | /* | ||
818 | ** Enquire as to the number of hosts located | ||
819 | ** at init time. | ||
820 | */ | ||
821 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); | ||
822 | if (copy_to_user(argp, &p->RIONumHosts, sizeof(p->RIONumHosts))) { | ||
823 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); | ||
824 | p->RIOError.Error = COPYOUT_FAILED; | ||
825 | return -EFAULT; | ||
826 | } | ||
827 | return retval; | ||
828 | |||
829 | case RIO_HOST_FOAD: | ||
830 | /* | ||
831 | ** Kill host. This may not be in the final version... | ||
832 | */ | ||
833 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", arg); | ||
834 | if (!su) { | ||
835 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); | ||
836 | p->RIOError.Error = NOT_SUPER_USER; | ||
837 | return -EPERM; | ||
838 | } | ||
839 | p->RIOHalted = 1; | ||
840 | p->RIOSystemUp = 0; | ||
841 | |||
842 | for (Host = 0; Host < p->RIONumHosts; Host++) { | ||
843 | (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); | ||
844 | memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags)); | ||
845 | p->RIOHosts[Host].Flags = RC_WAITING; | ||
846 | } | ||
847 | RIOFoadWakeup(p); | ||
848 | p->RIONumBootPkts = 0; | ||
849 | p->RIOBooting = 0; | ||
850 | printk("HEEEEELP!\n"); | ||
851 | |||
852 | for (loop = 0; loop < RIO_PORTS; loop++) { | ||
853 | spin_lock_init(&p->RIOPortp[loop]->portSem); | ||
854 | p->RIOPortp[loop]->InUse = NOT_INUSE; | ||
855 | } | ||
856 | |||
857 | p->RIOSystemUp = 0; | ||
858 | return retval; | ||
859 | |||
860 | case RIO_DOWNLOAD: | ||
861 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); | ||
862 | if (!su) { | ||
863 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); | ||
864 | p->RIOError.Error = NOT_SUPER_USER; | ||
865 | return -EPERM; | ||
866 | } | ||
867 | if (copy_from_user(&DownLoad, argp, sizeof(DownLoad))) { | ||
868 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); | ||
869 | p->RIOError.Error = COPYIN_FAILED; | ||
870 | return -EFAULT; | ||
871 | } | ||
872 | rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode); | ||
873 | |||
874 | /* | ||
875 | ** It is important that the product code is an unsigned object! | ||
876 | */ | ||
877 | if (DownLoad.ProductCode >= MAX_PRODUCT) { | ||
878 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode); | ||
879 | p->RIOError.Error = NO_SUCH_PRODUCT; | ||
880 | return -ENXIO; | ||
881 | } | ||
882 | /* | ||
883 | ** do something! | ||
884 | */ | ||
885 | retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad); | ||
886 | /* <-- Panic */ | ||
887 | p->RIOHalted = 0; | ||
888 | /* | ||
889 | ** and go back, content with a job well completed. | ||
890 | */ | ||
891 | return retval; | ||
892 | |||
893 | case RIO_PARMS: | ||
894 | { | ||
895 | unsigned int host; | ||
896 | |||
897 | if (copy_from_user(&host, argp, sizeof(host))) { | ||
898 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
899 | p->RIOError.Error = COPYIN_FAILED; | ||
900 | return -EFAULT; | ||
901 | } | ||
902 | /* | ||
903 | ** Fetch the parmmap | ||
904 | */ | ||
905 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); | ||
906 | if (copy_from_io(argp, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { | ||
907 | p->RIOError.Error = COPYOUT_FAILED; | ||
908 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); | ||
909 | return -EFAULT; | ||
910 | } | ||
911 | } | ||
912 | return retval; | ||
913 | |||
914 | case RIO_HOST_REQ: | ||
915 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); | ||
916 | if (copy_from_user(&HostReq, argp, sizeof(HostReq))) { | ||
917 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
918 | p->RIOError.Error = COPYIN_FAILED; | ||
919 | return -EFAULT; | ||
920 | } | ||
921 | if (HostReq.HostNum >= p->RIONumHosts) { | ||
922 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
923 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum); | ||
924 | return -ENXIO; | ||
925 | } | ||
926 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); | ||
927 | |||
928 | if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) { | ||
929 | p->RIOError.Error = COPYOUT_FAILED; | ||
930 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); | ||
931 | return -EFAULT; | ||
932 | } | ||
933 | return retval; | ||
934 | |||
935 | case RIO_HOST_DPRAM: | ||
936 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); | ||
937 | if (copy_from_user(&HostDpRam, argp, sizeof(HostDpRam))) { | ||
938 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); | ||
939 | p->RIOError.Error = COPYIN_FAILED; | ||
940 | return -EFAULT; | ||
941 | } | ||
942 | if (HostDpRam.HostNum >= p->RIONumHosts) { | ||
943 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
944 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum); | ||
945 | return -ENXIO; | ||
946 | } | ||
947 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); | ||
948 | |||
949 | if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { | ||
950 | int off; | ||
951 | /* It's hardware like this that really gets on my tits. */ | ||
952 | static unsigned char copy[sizeof(struct DpRam)]; | ||
953 | for (off = 0; off < sizeof(struct DpRam); off++) | ||
954 | copy[off] = readb(p->RIOHosts[HostDpRam.HostNum].Caddr + off); | ||
955 | if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { | ||
956 | p->RIOError.Error = COPYOUT_FAILED; | ||
957 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
958 | return -EFAULT; | ||
959 | } | ||
960 | } else if (copy_from_io(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) { | ||
961 | p->RIOError.Error = COPYOUT_FAILED; | ||
962 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
963 | return -EFAULT; | ||
964 | } | ||
965 | return retval; | ||
966 | |||
967 | case RIO_SET_BUSY: | ||
968 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); | ||
969 | if (arg > 511) { | ||
970 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", arg); | ||
971 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
972 | return -EINVAL; | ||
973 | } | ||
974 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
975 | p->RIOPortp[arg]->State |= RIO_BUSY; | ||
976 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
977 | return retval; | ||
978 | |||
979 | case RIO_HOST_PORT: | ||
980 | /* | ||
981 | ** The daemon want port information | ||
982 | ** (probably for debug reasons) | ||
983 | */ | ||
984 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); | ||
985 | if (copy_from_user(&PortReq, argp, sizeof(PortReq))) { | ||
986 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); | ||
987 | p->RIOError.Error = COPYIN_FAILED; | ||
988 | return -EFAULT; | ||
989 | } | ||
990 | |||
991 | if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ | ||
992 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort); | ||
993 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
994 | return -ENXIO; | ||
995 | } | ||
996 | rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); | ||
997 | if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) { | ||
998 | p->RIOError.Error = COPYOUT_FAILED; | ||
999 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); | ||
1000 | return -EFAULT; | ||
1001 | } | ||
1002 | return retval; | ||
1003 | |||
1004 | case RIO_HOST_RUP: | ||
1005 | /* | ||
1006 | ** The daemon want rup information | ||
1007 | ** (probably for debug reasons) | ||
1008 | */ | ||
1009 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); | ||
1010 | if (copy_from_user(&RupReq, argp, sizeof(RupReq))) { | ||
1011 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | ||
1012 | p->RIOError.Error = COPYIN_FAILED; | ||
1013 | return -EFAULT; | ||
1014 | } | ||
1015 | if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ | ||
1016 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum); | ||
1017 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1018 | return -ENXIO; | ||
1019 | } | ||
1020 | if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */ | ||
1021 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum); | ||
1022 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1023 | return -EINVAL; | ||
1024 | } | ||
1025 | HostP = &p->RIOHosts[RupReq.HostNum]; | ||
1026 | |||
1027 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
1028 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum); | ||
1029 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1030 | return -EIO; | ||
1031 | } | ||
1032 | rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); | ||
1033 | |||
1034 | if (copy_from_io(RupReq.RupP, HostP->UnixRups[RupReq.RupNum].RupP, sizeof(struct RUP))) { | ||
1035 | p->RIOError.Error = COPYOUT_FAILED; | ||
1036 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); | ||
1037 | return -EFAULT; | ||
1038 | } | ||
1039 | return retval; | ||
1040 | |||
1041 | case RIO_HOST_LPB: | ||
1042 | /* | ||
1043 | ** The daemon want lpb information | ||
1044 | ** (probably for debug reasons) | ||
1045 | */ | ||
1046 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); | ||
1047 | if (copy_from_user(&LpbReq, argp, sizeof(LpbReq))) { | ||
1048 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); | ||
1049 | p->RIOError.Error = COPYIN_FAILED; | ||
1050 | return -EFAULT; | ||
1051 | } | ||
1052 | if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ | ||
1053 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host); | ||
1054 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1055 | return -ENXIO; | ||
1056 | } | ||
1057 | if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */ | ||
1058 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link); | ||
1059 | p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; | ||
1060 | return -EINVAL; | ||
1061 | } | ||
1062 | HostP = &p->RIOHosts[LpbReq.Host]; | ||
1063 | |||
1064 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
1065 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host); | ||
1066 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1067 | return -EIO; | ||
1068 | } | ||
1069 | rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); | ||
1070 | |||
1071 | if (copy_from_io(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) { | ||
1072 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); | ||
1073 | p->RIOError.Error = COPYOUT_FAILED; | ||
1074 | return -EFAULT; | ||
1075 | } | ||
1076 | return retval; | ||
1077 | |||
1078 | /* | ||
1079 | ** Here 3 IOCTL's that allow us to change the way in which | ||
1080 | ** rio logs errors. send them just to syslog or send them | ||
1081 | ** to both syslog and console or send them to just the console. | ||
1082 | ** | ||
1083 | ** See RioStrBuf() in util.c for the other half. | ||
1084 | */ | ||
1085 | case RIO_SYSLOG_ONLY: | ||
1086 | p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */ | ||
1087 | return 0; | ||
1088 | |||
1089 | case RIO_SYSLOG_CONS: | ||
1090 | p->RIOPrintLogState = PRINT_TO_LOG_CONS; /* syslog and console */ | ||
1091 | return 0; | ||
1092 | |||
1093 | case RIO_CONS_ONLY: | ||
1094 | p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */ | ||
1095 | return 0; | ||
1096 | |||
1097 | case RIO_SIGNALS_ON: | ||
1098 | if (p->RIOSignalProcess) { | ||
1099 | p->RIOError.Error = SIGNALS_ALREADY_SET; | ||
1100 | return -EBUSY; | ||
1101 | } | ||
1102 | /* FIXME: PID tracking */ | ||
1103 | p->RIOSignalProcess = current->pid; | ||
1104 | p->RIOPrintDisabled = DONT_PRINT; | ||
1105 | return retval; | ||
1106 | |||
1107 | case RIO_SIGNALS_OFF: | ||
1108 | if (p->RIOSignalProcess != current->pid) { | ||
1109 | p->RIOError.Error = NOT_RECEIVING_PROCESS; | ||
1110 | return -EPERM; | ||
1111 | } | ||
1112 | rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n"); | ||
1113 | p->RIOSignalProcess = 0; | ||
1114 | return retval; | ||
1115 | |||
1116 | case RIO_SET_BYTE_MODE: | ||
1117 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1118 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1119 | p->RIOHosts[Host].Mode &= ~WORD_OPERATION; | ||
1120 | return retval; | ||
1121 | |||
1122 | case RIO_SET_WORD_MODE: | ||
1123 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1124 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1125 | p->RIOHosts[Host].Mode |= WORD_OPERATION; | ||
1126 | return retval; | ||
1127 | |||
1128 | case RIO_SET_FAST_BUS: | ||
1129 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1130 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1131 | p->RIOHosts[Host].Mode |= FAST_AT_BUS; | ||
1132 | return retval; | ||
1133 | |||
1134 | case RIO_SET_SLOW_BUS: | ||
1135 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1136 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1137 | p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; | ||
1138 | return retval; | ||
1139 | |||
1140 | case RIO_MAP_B50_TO_50: | ||
1141 | case RIO_MAP_B50_TO_57600: | ||
1142 | case RIO_MAP_B110_TO_110: | ||
1143 | case RIO_MAP_B110_TO_115200: | ||
1144 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); | ||
1145 | port = arg; | ||
1146 | if (port < 0 || port > 511) { | ||
1147 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | ||
1148 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1149 | return -EINVAL; | ||
1150 | } | ||
1151 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1152 | switch (cmd) { | ||
1153 | case RIO_MAP_B50_TO_50: | ||
1154 | p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; | ||
1155 | break; | ||
1156 | case RIO_MAP_B50_TO_57600: | ||
1157 | p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; | ||
1158 | break; | ||
1159 | case RIO_MAP_B110_TO_110: | ||
1160 | p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; | ||
1161 | break; | ||
1162 | case RIO_MAP_B110_TO_115200: | ||
1163 | p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; | ||
1164 | break; | ||
1165 | } | ||
1166 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1167 | return retval; | ||
1168 | |||
1169 | case RIO_STREAM_INFO: | ||
1170 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); | ||
1171 | return -EINVAL; | ||
1172 | |||
1173 | case RIO_SEND_PACKET: | ||
1174 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | ||
1175 | if (copy_from_user(&SendPack, argp, sizeof(SendPack))) { | ||
1176 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | ||
1177 | p->RIOError.Error = COPYIN_FAILED; | ||
1178 | return -EFAULT; | ||
1179 | } | ||
1180 | if (SendPack.PortNum >= 128) { | ||
1181 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1182 | return -ENXIO; | ||
1183 | } | ||
1184 | |||
1185 | PortP = p->RIOPortp[SendPack.PortNum]; | ||
1186 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1187 | |||
1188 | if (!can_add_transmit(&PacketP, PortP)) { | ||
1189 | p->RIOError.Error = UNIT_IS_IN_USE; | ||
1190 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1191 | return -ENOSPC; | ||
1192 | } | ||
1193 | |||
1194 | for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++) | ||
1195 | writeb(SendPack.Data[loop], &PacketP->data[loop]); | ||
1196 | |||
1197 | writeb(SendPack.Len, &PacketP->len); | ||
1198 | |||
1199 | add_transmit(PortP); | ||
1200 | /* | ||
1201 | ** Count characters transmitted for port statistics reporting | ||
1202 | */ | ||
1203 | if (PortP->statsGather) | ||
1204 | PortP->txchars += (SendPack.Len & 127); | ||
1205 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1206 | return retval; | ||
1207 | |||
1208 | case RIO_NO_MESG: | ||
1209 | if (su) | ||
1210 | p->RIONoMessage = 1; | ||
1211 | return su ? 0 : -EPERM; | ||
1212 | |||
1213 | case RIO_MESG: | ||
1214 | if (su) | ||
1215 | p->RIONoMessage = 0; | ||
1216 | return su ? 0 : -EPERM; | ||
1217 | |||
1218 | case RIO_WHAT_MESG: | ||
1219 | if (copy_to_user(argp, &p->RIONoMessage, sizeof(p->RIONoMessage))) { | ||
1220 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | ||
1221 | p->RIOError.Error = COPYOUT_FAILED; | ||
1222 | return -EFAULT; | ||
1223 | } | ||
1224 | return 0; | ||
1225 | |||
1226 | case RIO_MEM_DUMP: | ||
1227 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { | ||
1228 | p->RIOError.Error = COPYIN_FAILED; | ||
1229 | return -EFAULT; | ||
1230 | } | ||
1231 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr); | ||
1232 | |||
1233 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1234 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1235 | return -EINVAL; | ||
1236 | } | ||
1237 | |||
1238 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1239 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1240 | return -EINVAL; | ||
1241 | } | ||
1242 | |||
1243 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort; | ||
1244 | |||
1245 | PortP = p->RIOPortp[port]; | ||
1246 | |||
1247 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1248 | |||
1249 | if (RIOPreemptiveCmd(p, PortP, RIOC_MEMDUMP) == RIO_FAIL) { | ||
1250 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); | ||
1251 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1252 | return -EBUSY; | ||
1253 | } else | ||
1254 | PortP->State |= RIO_BUSY; | ||
1255 | |||
1256 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1257 | if (copy_to_user(argp, p->RIOMemDump, MEMDUMP_SIZE)) { | ||
1258 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | ||
1259 | p->RIOError.Error = COPYOUT_FAILED; | ||
1260 | return -EFAULT; | ||
1261 | } | ||
1262 | return 0; | ||
1263 | |||
1264 | case RIO_TICK: | ||
1265 | if (arg >= p->RIONumHosts) | ||
1266 | return -EINVAL; | ||
1267 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", arg); | ||
1268 | writeb(0xFF, &p->RIOHosts[arg].SetInt); | ||
1269 | return 0; | ||
1270 | |||
1271 | case RIO_TOCK: | ||
1272 | if (arg >= p->RIONumHosts) | ||
1273 | return -EINVAL; | ||
1274 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", arg); | ||
1275 | writeb(0xFF, &p->RIOHosts[arg].ResetInt); | ||
1276 | return 0; | ||
1277 | |||
1278 | case RIO_READ_CHECK: | ||
1279 | /* Check reads for pkts with data[0] the same */ | ||
1280 | p->RIOReadCheck = !p->RIOReadCheck; | ||
1281 | if (copy_to_user(argp, &p->RIOReadCheck, sizeof(unsigned int))) { | ||
1282 | p->RIOError.Error = COPYOUT_FAILED; | ||
1283 | return -EFAULT; | ||
1284 | } | ||
1285 | return 0; | ||
1286 | |||
1287 | case RIO_READ_REGISTER: | ||
1288 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { | ||
1289 | p->RIOError.Error = COPYIN_FAILED; | ||
1290 | return -EFAULT; | ||
1291 | } | ||
1292 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); | ||
1293 | |||
1294 | if (SubCmd.Port > 511) { | ||
1295 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port); | ||
1296 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1297 | return -EINVAL; | ||
1298 | } | ||
1299 | |||
1300 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1301 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1302 | return -EINVAL; | ||
1303 | } | ||
1304 | |||
1305 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1306 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1307 | return -EINVAL; | ||
1308 | } | ||
1309 | |||
1310 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port; | ||
1311 | PortP = p->RIOPortp[port]; | ||
1312 | |||
1313 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1314 | |||
1315 | if (RIOPreemptiveCmd(p, PortP, RIOC_READ_REGISTER) == | ||
1316 | RIO_FAIL) { | ||
1317 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); | ||
1318 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1319 | return -EBUSY; | ||
1320 | } else | ||
1321 | PortP->State |= RIO_BUSY; | ||
1322 | |||
1323 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1324 | if (copy_to_user(argp, &p->CdRegister, sizeof(unsigned int))) { | ||
1325 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | ||
1326 | p->RIOError.Error = COPYOUT_FAILED; | ||
1327 | return -EFAULT; | ||
1328 | } | ||
1329 | return 0; | ||
1330 | /* | ||
1331 | ** rio_make_dev: given port number (0-511) ORed with port type | ||
1332 | ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t | ||
1333 | ** value to pass to mknod to create the correct device node. | ||
1334 | */ | ||
1335 | case RIO_MAKE_DEV: | ||
1336 | { | ||
1337 | unsigned int port = arg & RIO_MODEM_MASK; | ||
1338 | unsigned int ret; | ||
1339 | |||
1340 | switch (arg & RIO_DEV_MASK) { | ||
1341 | case RIO_DEV_DIRECT: | ||
1342 | ret = drv_makedev(MAJOR(dev), port); | ||
1343 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); | ||
1344 | return ret; | ||
1345 | case RIO_DEV_MODEM: | ||
1346 | ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); | ||
1347 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret); | ||
1348 | return ret; | ||
1349 | case RIO_DEV_XPRINT: | ||
1350 | ret = drv_makedev(MAJOR(dev), port); | ||
1351 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret); | ||
1352 | return ret; | ||
1353 | } | ||
1354 | rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n"); | ||
1355 | return -EINVAL; | ||
1356 | } | ||
1357 | /* | ||
1358 | ** rio_minor: given a dev_t from a stat() call, return | ||
1359 | ** the port number (0-511) ORed with the port type | ||
1360 | ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT ) | ||
1361 | */ | ||
1362 | case RIO_MINOR: | ||
1363 | { | ||
1364 | dev_t dv; | ||
1365 | int mino; | ||
1366 | unsigned long ret; | ||
1367 | |||
1368 | dv = (dev_t) (arg); | ||
1369 | mino = RIO_UNMODEM(dv); | ||
1370 | |||
1371 | if (RIO_ISMODEM(dv)) { | ||
1372 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); | ||
1373 | ret = mino | RIO_DEV_MODEM; | ||
1374 | } else { | ||
1375 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); | ||
1376 | ret = mino | RIO_DEV_DIRECT; | ||
1377 | } | ||
1378 | return ret; | ||
1379 | } | ||
1380 | } | ||
1381 | rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd); | ||
1382 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
1383 | |||
1384 | func_exit(); | ||
1385 | return -EINVAL; | ||
1386 | } | ||
1387 | |||
1388 | /* | ||
1389 | ** Pre-emptive commands go on RUPs and are only one byte long. | ||
1390 | */ | ||
1391 | int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | ||
1392 | { | ||
1393 | struct CmdBlk *CmdBlkP; | ||
1394 | struct PktCmd_M *PktCmdP; | ||
1395 | int Ret; | ||
1396 | ushort rup; | ||
1397 | int port; | ||
1398 | |||
1399 | if (PortP->State & RIO_DELETED) { | ||
1400 | rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); | ||
1401 | return RIO_FAIL; | ||
1402 | } | ||
1403 | |||
1404 | if ((PortP->InUse == (typeof(PortP->InUse))-1) || | ||
1405 | !(CmdBlkP = RIOGetCmdBlk())) { | ||
1406 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block " | ||
1407 | "for command %d on port %d\n", Cmd, PortP->PortNum); | ||
1408 | return RIO_FAIL; | ||
1409 | } | ||
1410 | |||
1411 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", | ||
1412 | CmdBlkP, PortP->InUse); | ||
1413 | |||
1414 | PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; | ||
1415 | |||
1416 | CmdBlkP->Packet.src_unit = 0; | ||
1417 | if (PortP->SecondBlock) | ||
1418 | rup = PortP->ID2; | ||
1419 | else | ||
1420 | rup = PortP->RupNum; | ||
1421 | CmdBlkP->Packet.dest_unit = rup; | ||
1422 | CmdBlkP->Packet.src_port = COMMAND_RUP; | ||
1423 | CmdBlkP->Packet.dest_port = COMMAND_RUP; | ||
1424 | CmdBlkP->Packet.len = PKT_CMD_BIT | 2; | ||
1425 | CmdBlkP->PostFuncP = RIOUnUse; | ||
1426 | CmdBlkP->PostArg = (unsigned long) PortP; | ||
1427 | PktCmdP->Command = Cmd; | ||
1428 | port = PortP->HostPort % (ushort) PORTS_PER_RTA; | ||
1429 | /* | ||
1430 | ** Index ports 8-15 for 2nd block of 16 port RTA. | ||
1431 | */ | ||
1432 | if (PortP->SecondBlock) | ||
1433 | port += (ushort) PORTS_PER_RTA; | ||
1434 | PktCmdP->PhbNum = port; | ||
1435 | |||
1436 | switch (Cmd) { | ||
1437 | case RIOC_MEMDUMP: | ||
1438 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p " | ||
1439 | "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); | ||
1440 | PktCmdP->SubCommand = RIOC_MEMDUMP; | ||
1441 | PktCmdP->SubAddr = SubCmd.Addr; | ||
1442 | break; | ||
1443 | case RIOC_FCLOSE: | ||
1444 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", | ||
1445 | CmdBlkP); | ||
1446 | break; | ||
1447 | case RIOC_READ_REGISTER: | ||
1448 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) " | ||
1449 | "command blk %p\n", (int) SubCmd.Addr, CmdBlkP); | ||
1450 | PktCmdP->SubCommand = RIOC_READ_REGISTER; | ||
1451 | PktCmdP->SubAddr = SubCmd.Addr; | ||
1452 | break; | ||
1453 | case RIOC_RESUME: | ||
1454 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", | ||
1455 | CmdBlkP); | ||
1456 | break; | ||
1457 | case RIOC_RFLUSH: | ||
1458 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", | ||
1459 | CmdBlkP); | ||
1460 | CmdBlkP->PostFuncP = RIORFlushEnable; | ||
1461 | break; | ||
1462 | case RIOC_SUSPEND: | ||
1463 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", | ||
1464 | CmdBlkP); | ||
1465 | break; | ||
1466 | |||
1467 | case RIOC_MGET: | ||
1468 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", | ||
1469 | CmdBlkP); | ||
1470 | break; | ||
1471 | |||
1472 | case RIOC_MSET: | ||
1473 | case RIOC_MBIC: | ||
1474 | case RIOC_MBIS: | ||
1475 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; | ||
1476 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command " | ||
1477 | "blk %p\n", CmdBlkP); | ||
1478 | break; | ||
1479 | |||
1480 | case RIOC_WFLUSH: | ||
1481 | /* | ||
1482 | ** If we have queued up the maximum number of Write flushes | ||
1483 | ** allowed then we should not bother sending any more to the | ||
1484 | ** RTA. | ||
1485 | */ | ||
1486 | if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) { | ||
1487 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, " | ||
1488 | "WflushFlag about to wrap!"); | ||
1489 | RIOFreeCmdBlk(CmdBlkP); | ||
1490 | return (RIO_FAIL); | ||
1491 | } else { | ||
1492 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command " | ||
1493 | "blk %p\n", CmdBlkP); | ||
1494 | CmdBlkP->PostFuncP = RIOWFlushMark; | ||
1495 | } | ||
1496 | break; | ||
1497 | } | ||
1498 | |||
1499 | PortP->InUse++; | ||
1500 | |||
1501 | Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP); | ||
1502 | |||
1503 | return Ret; | ||
1504 | } | ||
diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h deleted file mode 100644 index 0907e711b355..000000000000 --- a/drivers/char/rio/riodrvr.h +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : riodrvr.h | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 09:22:46 | ||
26 | ** Retrieved : 11/6/98 09:22:46 | ||
27 | ** | ||
28 | ** ident @(#)riodrvr.h 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __riodrvr_h | ||
34 | #define __riodrvr_h | ||
35 | |||
36 | #include <asm/param.h> /* for HZ */ | ||
37 | |||
38 | #define MEMDUMP_SIZE 32 | ||
39 | #define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT) | ||
40 | |||
41 | |||
42 | struct rio_info { | ||
43 | int mode; /* Intr or polled, word/byte */ | ||
44 | spinlock_t RIOIntrSem; /* Interrupt thread sem */ | ||
45 | int current_chan; /* current channel */ | ||
46 | int RIOFailed; /* Not initialised ? */ | ||
47 | int RIOInstallAttempts; /* no. of rio-install() calls */ | ||
48 | int RIOLastPCISearch; /* status of last search */ | ||
49 | int RIONumHosts; /* Number of RIO Hosts */ | ||
50 | struct Host *RIOHosts; /* RIO Host values */ | ||
51 | struct Port **RIOPortp; /* RIO port values */ | ||
52 | /* | ||
53 | ** 02.03.1999 ARG - ESIL 0820 fix | ||
54 | ** We no longer use RIOBootMode | ||
55 | ** | ||
56 | int RIOBootMode; * RIO boot mode * | ||
57 | ** | ||
58 | */ | ||
59 | int RIOPrintDisabled; /* RIO printing disabled ? */ | ||
60 | int RIOPrintLogState; /* RIO printing state ? */ | ||
61 | int RIOPolling; /* Polling ? */ | ||
62 | /* | ||
63 | ** 09.12.1998 ARG - ESIL 0776 part fix | ||
64 | ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted. | ||
65 | ** The fix for this ESIL introduces another member (RIORtaDisCons) here to be | ||
66 | ** updated in RIOConCon() - to keep track of RTA connections/disconnections. | ||
67 | ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons. | ||
68 | */ | ||
69 | int RIOHalted; /* halted ? */ | ||
70 | int RIORtaDisCons; /* RTA connections/disconnections */ | ||
71 | unsigned int RIOReadCheck; /* Rio read check */ | ||
72 | unsigned int RIONoMessage; /* To display message or not */ | ||
73 | unsigned int RIONumBootPkts; /* how many packets for an RTA */ | ||
74 | unsigned int RIOBootCount; /* size of RTA code */ | ||
75 | unsigned int RIOBooting; /* count of outstanding boots */ | ||
76 | unsigned int RIOSystemUp; /* Booted ?? */ | ||
77 | unsigned int RIOCounting; /* for counting interrupts */ | ||
78 | unsigned int RIOIntCount; /* # of intr since last check */ | ||
79 | unsigned int RIOTxCount; /* number of xmit intrs */ | ||
80 | unsigned int RIORxCount; /* number of rx intrs */ | ||
81 | unsigned int RIORupCount; /* number of rup intrs */ | ||
82 | int RIXTimer; | ||
83 | int RIOBufferSize; /* Buffersize */ | ||
84 | int RIOBufferMask; /* Buffersize */ | ||
85 | |||
86 | int RIOFirstMajor; /* First host card's major no */ | ||
87 | |||
88 | unsigned int RIOLastPortsMapped; /* highest port number known */ | ||
89 | unsigned int RIOFirstPortsMapped; /* lowest port number known */ | ||
90 | |||
91 | unsigned int RIOLastPortsBooted; /* highest port number running */ | ||
92 | unsigned int RIOFirstPortsBooted; /* lowest port number running */ | ||
93 | |||
94 | unsigned int RIOLastPortsOpened; /* highest port number running */ | ||
95 | unsigned int RIOFirstPortsOpened; /* lowest port number running */ | ||
96 | |||
97 | /* Flag to say that the topology information has been changed. */ | ||
98 | unsigned int RIOQuickCheck; | ||
99 | unsigned int CdRegister; /* ??? */ | ||
100 | int RIOSignalProcess; /* Signalling process */ | ||
101 | int rio_debug; /* To debug ... */ | ||
102 | int RIODebugWait; /* For what ??? */ | ||
103 | int tpri; /* Thread prio */ | ||
104 | int tid; /* Thread id */ | ||
105 | unsigned int _RIO_Polled; /* Counter for polling */ | ||
106 | unsigned int _RIO_Interrupted; /* Counter for interrupt */ | ||
107 | int intr_tid; /* iointset return value */ | ||
108 | int TxEnSem; /* TxEnable Semaphore */ | ||
109 | |||
110 | |||
111 | struct Error RIOError; /* to Identify what went wrong */ | ||
112 | struct Conf RIOConf; /* Configuration ??? */ | ||
113 | struct ttystatics channel[RIO_PORTS]; /* channel information */ | ||
114 | char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)] | ||
115 | [RTA_BOOT_DATA_SIZE]; | ||
116 | struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; | ||
117 | struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; | ||
118 | |||
119 | /* RTA to host binding table for master/slave operation */ | ||
120 | unsigned long RIOBindTab[MAX_RTA_BINDINGS]; | ||
121 | /* RTA memory dump variable */ | ||
122 | unsigned char RIOMemDump[MEMDUMP_SIZE]; | ||
123 | struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; | ||
124 | |||
125 | }; | ||
126 | |||
127 | |||
128 | #ifdef linux | ||
129 | #define debug(x) printk x | ||
130 | #else | ||
131 | #define debug(x) kkprintf x | ||
132 | #endif | ||
133 | |||
134 | |||
135 | |||
136 | #define RIO_RESET_INT 0x7d80 | ||
137 | |||
138 | #endif /* __riodrvr.h */ | ||
diff --git a/drivers/char/rio/rioinfo.h b/drivers/char/rio/rioinfo.h deleted file mode 100644 index 42ff1e79d96f..000000000000 --- a/drivers/char/rio/rioinfo.h +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioinfo.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 14:07:49 | ||
26 | ** Retrieved : 11/6/98 14:07:50 | ||
27 | ** | ||
28 | ** ident @(#)rioinfo.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rioinfo_h | ||
34 | #define __rioinfo_h | ||
35 | |||
36 | /* | ||
37 | ** Host card data structure | ||
38 | */ | ||
39 | struct RioHostInfo { | ||
40 | long location; /* RIO Card Base I/O address */ | ||
41 | long vector; /* RIO Card IRQ vector */ | ||
42 | int bus; /* ISA/EISA/MCA/PCI */ | ||
43 | int mode; /* pointer to host mode - INTERRUPT / POLLED */ | ||
44 | struct old_sgttyb | ||
45 | *Sg; /* pointer to default term characteristics */ | ||
46 | }; | ||
47 | |||
48 | |||
49 | /* Mode in rio device info */ | ||
50 | #define INTERRUPTED_MODE 0x01 /* Interrupt is generated */ | ||
51 | #define POLLED_MODE 0x02 /* No interrupt */ | ||
52 | #define AUTO_MODE 0x03 /* Auto mode */ | ||
53 | |||
54 | #define WORD_ACCESS_MODE 0x10 /* Word Access Mode */ | ||
55 | #define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */ | ||
56 | |||
57 | |||
58 | /* Bus type that RIO supports */ | ||
59 | #define ISA_BUS 0x01 /* The card is ISA */ | ||
60 | #define EISA_BUS 0x02 /* The card is EISA */ | ||
61 | #define MCA_BUS 0x04 /* The card is MCA */ | ||
62 | #define PCI_BUS 0x08 /* The card is PCI */ | ||
63 | |||
64 | /* | ||
65 | ** 11.11.1998 ARG - ESIL ???? part fix | ||
66 | ** Moved definition for 'CHAN' here from rioinfo.c (it is now | ||
67 | ** called 'DEF_TERM_CHARACTERISTICS'). | ||
68 | */ | ||
69 | |||
70 | #define DEF_TERM_CHARACTERISTICS \ | ||
71 | { \ | ||
72 | B19200, B19200, /* input and output speed */ \ | ||
73 | 'H' - '@', /* erase char */ \ | ||
74 | -1, /* 2nd erase char */ \ | ||
75 | 'U' - '@', /* kill char */ \ | ||
76 | ECHO | CRMOD, /* mode */ \ | ||
77 | 'C' - '@', /* interrupt character */ \ | ||
78 | '\\' - '@', /* quit char */ \ | ||
79 | 'Q' - '@', /* start char */ \ | ||
80 | 'S' - '@', /* stop char */ \ | ||
81 | 'D' - '@', /* EOF */ \ | ||
82 | -1, /* brk */ \ | ||
83 | (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ \ | ||
84 | 'Z' - '@', /* process stop */ \ | ||
85 | 'Y' - '@', /* delayed stop */ \ | ||
86 | 'R' - '@', /* reprint line */ \ | ||
87 | 'O' - '@', /* flush output */ \ | ||
88 | 'W' - '@', /* word erase */ \ | ||
89 | 'V' - '@' /* literal next char */ \ | ||
90 | } | ||
91 | |||
92 | #endif /* __rioinfo_h */ | ||
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c deleted file mode 100644 index 24a282bb89d4..000000000000 --- a/drivers/char/rio/rioinit.c +++ /dev/null | |||
@@ -1,421 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioinit.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:43 | ||
26 | ** Retrieved : 11/6/98 10:33:49 | ||
27 | ** | ||
28 | ** ident @(#)rioinit.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/delay.h> | ||
36 | #include <asm/io.h> | ||
37 | #include <asm/system.h> | ||
38 | #include <asm/string.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | |||
41 | #include <linux/termios.h> | ||
42 | #include <linux/serial.h> | ||
43 | |||
44 | #include <linux/generic_serial.h> | ||
45 | |||
46 | |||
47 | #include "linux_compat.h" | ||
48 | #include "pkt.h" | ||
49 | #include "daemon.h" | ||
50 | #include "rio.h" | ||
51 | #include "riospace.h" | ||
52 | #include "cmdpkt.h" | ||
53 | #include "map.h" | ||
54 | #include "rup.h" | ||
55 | #include "port.h" | ||
56 | #include "riodrvr.h" | ||
57 | #include "rioinfo.h" | ||
58 | #include "func.h" | ||
59 | #include "errors.h" | ||
60 | #include "pci.h" | ||
61 | |||
62 | #include "parmmap.h" | ||
63 | #include "unixrup.h" | ||
64 | #include "board.h" | ||
65 | #include "host.h" | ||
66 | #include "phb.h" | ||
67 | #include "link.h" | ||
68 | #include "cmdblk.h" | ||
69 | #include "route.h" | ||
70 | #include "cirrus.h" | ||
71 | #include "rioioctl.h" | ||
72 | #include "rio_linux.h" | ||
73 | |||
74 | int RIOPCIinit(struct rio_info *p, int Mode); | ||
75 | |||
76 | static int RIOScrub(int, u8 __iomem *, int); | ||
77 | |||
78 | |||
79 | /** | ||
80 | ** RIOAssignAT : | ||
81 | ** | ||
82 | ** Fill out the fields in the p->RIOHosts structure now we know we know | ||
83 | ** we have a board present. | ||
84 | ** | ||
85 | ** bits < 0 indicates 8 bit operation requested, | ||
86 | ** bits > 0 indicates 16 bit operation. | ||
87 | */ | ||
88 | |||
89 | int RIOAssignAT(struct rio_info *p, int Base, void __iomem *virtAddr, int mode) | ||
90 | { | ||
91 | int bits; | ||
92 | struct DpRam __iomem *cardp = (struct DpRam __iomem *)virtAddr; | ||
93 | |||
94 | if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE)) | ||
95 | bits = BYTE_OPERATION; | ||
96 | else | ||
97 | bits = WORD_OPERATION; | ||
98 | |||
99 | /* | ||
100 | ** Board has passed its scrub test. Fill in all the | ||
101 | ** transient stuff. | ||
102 | */ | ||
103 | p->RIOHosts[p->RIONumHosts].Caddr = virtAddr; | ||
104 | p->RIOHosts[p->RIONumHosts].CardP = virtAddr; | ||
105 | |||
106 | /* | ||
107 | ** Revision 01 AT host cards don't support WORD operations, | ||
108 | */ | ||
109 | if (readb(&cardp->DpRevision) == 01) | ||
110 | bits = BYTE_OPERATION; | ||
111 | |||
112 | p->RIOHosts[p->RIONumHosts].Type = RIO_AT; | ||
113 | p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card; | ||
114 | /* set this later */ | ||
115 | p->RIOHosts[p->RIONumHosts].Slot = -1; | ||
116 | p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; | ||
117 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE , | ||
118 | &p->RIOHosts[p->RIONumHosts].Control); | ||
119 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); | ||
120 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE, | ||
121 | &p->RIOHosts[p->RIONumHosts].Control); | ||
122 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); | ||
123 | p->RIOHosts[p->RIONumHosts].UniqueNum = | ||
124 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| | ||
125 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| | ||
126 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| | ||
127 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); | ||
128 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); | ||
129 | |||
130 | p->RIONumHosts++; | ||
131 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); | ||
132 | return(1); | ||
133 | } | ||
134 | |||
135 | static u8 val[] = { | ||
136 | #ifdef VERY_LONG_TEST | ||
137 | 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, | ||
138 | 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, | ||
139 | #endif | ||
140 | 0xff, 0x00, 0x00 }; | ||
141 | |||
142 | #define TEST_END sizeof(val) | ||
143 | |||
144 | /* | ||
145 | ** RAM test a board. | ||
146 | ** Nothing too complicated, just enough to check it out. | ||
147 | */ | ||
148 | int RIOBoardTest(unsigned long paddr, void __iomem *caddr, unsigned char type, int slot) | ||
149 | { | ||
150 | struct DpRam __iomem *DpRam = caddr; | ||
151 | void __iomem *ram[4]; | ||
152 | int size[4]; | ||
153 | int op, bank; | ||
154 | int nbanks; | ||
155 | |||
156 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=%p, slot=%d\n", | ||
157 | type, DpRam, slot); | ||
158 | |||
159 | RIOHostReset(type, DpRam, slot); | ||
160 | |||
161 | /* | ||
162 | ** Scrub the memory. This comes in several banks: | ||
163 | ** DPsram1 - 7000h bytes | ||
164 | ** DPsram2 - 200h bytes | ||
165 | ** DPsram3 - 7000h bytes | ||
166 | ** scratch - 1000h bytes | ||
167 | */ | ||
168 | |||
169 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Setup ram/size arrays\n"); | ||
170 | |||
171 | size[0] = DP_SRAM1_SIZE; | ||
172 | size[1] = DP_SRAM2_SIZE; | ||
173 | size[2] = DP_SRAM3_SIZE; | ||
174 | size[3] = DP_SCRATCH_SIZE; | ||
175 | |||
176 | ram[0] = DpRam->DpSram1; | ||
177 | ram[1] = DpRam->DpSram2; | ||
178 | ram[2] = DpRam->DpSram3; | ||
179 | nbanks = (type == RIO_PCI) ? 3 : 4; | ||
180 | if (nbanks == 4) | ||
181 | ram[3] = DpRam->DpScratch; | ||
182 | |||
183 | |||
184 | if (nbanks == 3) { | ||
185 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: %p(0x%x), %p(0x%x), %p(0x%x)\n", | ||
186 | ram[0], size[0], ram[1], size[1], ram[2], size[2]); | ||
187 | } else { | ||
188 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: %p(0x%x), %p(0x%x), %p(0x%x), %p(0x%x)\n", | ||
189 | ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]); | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | ** This scrub operation will test for crosstalk between | ||
194 | ** banks. TEST_END is a magic number, and relates to the offset | ||
195 | ** within the 'val' array used by Scrub. | ||
196 | */ | ||
197 | for (op=0; op<TEST_END; op++) { | ||
198 | for (bank=0; bank<nbanks; bank++) { | ||
199 | if (RIOScrub(op, ram[bank], size[bank]) == RIO_FAIL) { | ||
200 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", | ||
201 | bank, op); | ||
202 | return RIO_FAIL; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | rio_dprintk (RIO_DEBUG_INIT, "Test completed\n"); | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | |||
212 | /* | ||
213 | ** Scrub an area of RAM. | ||
214 | ** Define PRETEST and POSTTEST for a more thorough checking of the | ||
215 | ** state of the memory. | ||
216 | ** Call with op set to an index into the above 'val' array to determine | ||
217 | ** which value will be written into memory. | ||
218 | ** Call with op set to zero means that the RAM will not be read and checked | ||
219 | ** before it is written. | ||
220 | ** Call with op not zero and the RAM will be read and compared with val[op-1] | ||
221 | ** to check that the data from the previous phase was retained. | ||
222 | */ | ||
223 | |||
224 | static int RIOScrub(int op, u8 __iomem *ram, int size) | ||
225 | { | ||
226 | int off; | ||
227 | unsigned char oldbyte; | ||
228 | unsigned char newbyte; | ||
229 | unsigned char invbyte; | ||
230 | unsigned short oldword; | ||
231 | unsigned short newword; | ||
232 | unsigned short invword; | ||
233 | unsigned short swapword; | ||
234 | |||
235 | if (op) { | ||
236 | oldbyte = val[op-1]; | ||
237 | oldword = oldbyte | (oldbyte<<8); | ||
238 | } else | ||
239 | oldbyte = oldword = 0; /* Tell the compiler we've initilalized them. */ | ||
240 | newbyte = val[op]; | ||
241 | newword = newbyte | (newbyte<<8); | ||
242 | invbyte = ~newbyte; | ||
243 | invword = invbyte | (invbyte<<8); | ||
244 | |||
245 | /* | ||
246 | ** Check that the RAM contains the value that should have been left there | ||
247 | ** by the previous test (not applicable for pass zero) | ||
248 | */ | ||
249 | if (op) { | ||
250 | for (off=0; off<size; off++) { | ||
251 | if (readb(ram + off) != oldbyte) { | ||
252 | 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)); | ||
253 | return RIO_FAIL; | ||
254 | } | ||
255 | } | ||
256 | for (off=0; off<size; off+=2) { | ||
257 | if (readw(ram + off) != oldword) { | ||
258 | 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)); | ||
259 | 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)); | ||
260 | return RIO_FAIL; | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | /* | ||
266 | ** Now write the INVERSE of the test data into every location, using | ||
267 | ** BYTE write operations, first checking before each byte is written | ||
268 | ** that the location contains the old value still, and checking after | ||
269 | ** the write that the location contains the data specified - this is | ||
270 | ** the BYTE read/write test. | ||
271 | */ | ||
272 | for (off=0; off<size; off++) { | ||
273 | if (op && (readb(ram + off) != oldbyte)) { | ||
274 | 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)); | ||
275 | return RIO_FAIL; | ||
276 | } | ||
277 | writeb(invbyte, ram + off); | ||
278 | if (readb(ram + off) != invbyte) { | ||
279 | 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)); | ||
280 | return RIO_FAIL; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | /* | ||
285 | ** now, use WORD operations to write the test value into every location, | ||
286 | ** check as before that the location contains the previous test value | ||
287 | ** before overwriting, and that it contains the data value written | ||
288 | ** afterwards. | ||
289 | ** This is the WORD operation test. | ||
290 | */ | ||
291 | for (off=0; off<size; off+=2) { | ||
292 | if (readw(ram + off) != invword) { | ||
293 | 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)); | ||
294 | 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)); | ||
295 | return RIO_FAIL; | ||
296 | } | ||
297 | |||
298 | writew(newword, ram + off); | ||
299 | if ( readw(ram + off) != newword ) { | ||
300 | 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)); | ||
301 | 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)); | ||
302 | return RIO_FAIL; | ||
303 | } | ||
304 | } | ||
305 | |||
306 | /* | ||
307 | ** now run through the block of memory again, first in byte mode | ||
308 | ** then in word mode, and check that all the locations contain the | ||
309 | ** required test data. | ||
310 | */ | ||
311 | for (off=0; off<size; off++) { | ||
312 | if (readb(ram + off) != newbyte) { | ||
313 | 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)); | ||
314 | return RIO_FAIL; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | for (off=0; off<size; off+=2) { | ||
319 | if (readw(ram + off) != newword ) { | ||
320 | 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)); | ||
321 | 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)); | ||
322 | return RIO_FAIL; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | ** time to check out byte swapping errors | ||
328 | */ | ||
329 | swapword = invbyte | (newbyte << 8); | ||
330 | |||
331 | for (off=0; off<size; off+=2) { | ||
332 | writeb(invbyte, &ram[off]); | ||
333 | writeb(newbyte, &ram[off+1]); | ||
334 | } | ||
335 | |||
336 | for ( off=0; off<size; off+=2 ) { | ||
337 | if (readw(ram + off) != swapword) { | ||
338 | 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)); | ||
339 | 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)); | ||
340 | return RIO_FAIL; | ||
341 | } | ||
342 | writew(~swapword, ram + off); | ||
343 | } | ||
344 | |||
345 | for (off=0; off<size; off+=2) { | ||
346 | if (readb(ram + off) != newbyte) { | ||
347 | 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)); | ||
348 | return RIO_FAIL; | ||
349 | } | ||
350 | if (readb(ram + off + 1) != invbyte) { | ||
351 | 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)); | ||
352 | return RIO_FAIL; | ||
353 | } | ||
354 | writew(newword, ram + off); | ||
355 | } | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | |||
360 | int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId) | ||
361 | { | ||
362 | memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17); | ||
363 | HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); | ||
364 | if ((UnitId+1) > 9) { | ||
365 | HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); | ||
366 | HostP->Mapping[UnitId].Name[15]='0'+((UnitId+1)%10); | ||
367 | } | ||
368 | else { | ||
369 | HostP->Mapping[UnitId].Name[14]='1'+UnitId; | ||
370 | HostP->Mapping[UnitId].Name[15]=0; | ||
371 | } | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | #define RIO_RELEASE "Linux" | ||
376 | #define RELEASE_ID "1.0" | ||
377 | |||
378 | static struct rioVersion stVersion; | ||
379 | |||
380 | struct rioVersion *RIOVersid(void) | ||
381 | { | ||
382 | strlcpy(stVersion.version, "RIO driver for linux V1.0", | ||
383 | sizeof(stVersion.version)); | ||
384 | strlcpy(stVersion.buildDate, __DATE__, | ||
385 | sizeof(stVersion.buildDate)); | ||
386 | |||
387 | return &stVersion; | ||
388 | } | ||
389 | |||
390 | void RIOHostReset(unsigned int Type, struct DpRam __iomem *DpRamP, unsigned int Slot) | ||
391 | { | ||
392 | /* | ||
393 | ** Reset the Tpu | ||
394 | */ | ||
395 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); | ||
396 | switch ( Type ) { | ||
397 | case RIO_AT: | ||
398 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); | ||
399 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | | ||
400 | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); | ||
401 | writeb(0xFF, &DpRamP->DpResetTpu); | ||
402 | udelay(3); | ||
403 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); | ||
404 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | | ||
405 | BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); | ||
406 | writeb(0xFF, &DpRamP->DpResetTpu); | ||
407 | udelay(3); | ||
408 | break; | ||
409 | case RIO_PCI: | ||
410 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); | ||
411 | writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl); | ||
412 | writeb(0xFF, &DpRamP->DpResetInt); | ||
413 | writeb(0xFF, &DpRamP->DpResetTpu); | ||
414 | udelay(100); | ||
415 | break; | ||
416 | default: | ||
417 | rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); | ||
418 | break; | ||
419 | } | ||
420 | return; | ||
421 | } | ||
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c deleted file mode 100644 index 2e71aecae206..000000000000 --- a/drivers/char/rio/riointr.c +++ /dev/null | |||
@@ -1,645 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : riointr.c | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 10:33:44 | ||
26 | ** Retrieved : 11/6/98 10:33:49 | ||
27 | ** | ||
28 | ** ident @(#)riointr.c 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/tty.h> | ||
36 | #include <linux/tty_flip.h> | ||
37 | #include <asm/io.h> | ||
38 | #include <asm/system.h> | ||
39 | #include <asm/string.h> | ||
40 | #include <asm/uaccess.h> | ||
41 | |||
42 | #include <linux/termios.h> | ||
43 | #include <linux/serial.h> | ||
44 | |||
45 | #include <linux/generic_serial.h> | ||
46 | |||
47 | #include <linux/delay.h> | ||
48 | |||
49 | #include "linux_compat.h" | ||
50 | #include "rio_linux.h" | ||
51 | #include "pkt.h" | ||
52 | #include "daemon.h" | ||
53 | #include "rio.h" | ||
54 | #include "riospace.h" | ||
55 | #include "cmdpkt.h" | ||
56 | #include "map.h" | ||
57 | #include "rup.h" | ||
58 | #include "port.h" | ||
59 | #include "riodrvr.h" | ||
60 | #include "rioinfo.h" | ||
61 | #include "func.h" | ||
62 | #include "errors.h" | ||
63 | #include "pci.h" | ||
64 | |||
65 | #include "parmmap.h" | ||
66 | #include "unixrup.h" | ||
67 | #include "board.h" | ||
68 | #include "host.h" | ||
69 | #include "phb.h" | ||
70 | #include "link.h" | ||
71 | #include "cmdblk.h" | ||
72 | #include "route.h" | ||
73 | #include "cirrus.h" | ||
74 | #include "rioioctl.h" | ||
75 | |||
76 | |||
77 | static void RIOReceive(struct rio_info *, struct Port *); | ||
78 | |||
79 | |||
80 | static char *firstchars(char *p, int nch) | ||
81 | { | ||
82 | static char buf[2][128]; | ||
83 | static int t = 0; | ||
84 | t = !t; | ||
85 | memcpy(buf[t], p, nch); | ||
86 | buf[t][nch] = 0; | ||
87 | return buf[t]; | ||
88 | } | ||
89 | |||
90 | |||
91 | #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) | ||
92 | /* Enable and start the transmission of packets */ | ||
93 | void RIOTxEnable(char *en) | ||
94 | { | ||
95 | struct Port *PortP; | ||
96 | struct rio_info *p; | ||
97 | struct tty_struct *tty; | ||
98 | int c; | ||
99 | struct PKT __iomem *PacketP; | ||
100 | unsigned long flags; | ||
101 | |||
102 | PortP = (struct Port *) en; | ||
103 | p = (struct rio_info *) PortP->p; | ||
104 | tty = PortP->gs.port.tty; | ||
105 | |||
106 | |||
107 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); | ||
108 | |||
109 | if (!PortP->gs.xmit_cnt) | ||
110 | return; | ||
111 | |||
112 | |||
113 | /* This routine is an order of magnitude simpler than the specialix | ||
114 | version. One of the disadvantages is that this version will send | ||
115 | an incomplete packet (usually 64 bytes instead of 72) once for | ||
116 | every 4k worth of data. Let's just say that this won't influence | ||
117 | performance significantly..... */ | ||
118 | |||
119 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
120 | |||
121 | while (can_add_transmit(&PacketP, PortP)) { | ||
122 | c = PortP->gs.xmit_cnt; | ||
123 | if (c > PKT_MAX_DATA_LEN) | ||
124 | c = PKT_MAX_DATA_LEN; | ||
125 | |||
126 | /* Don't copy past the end of the source buffer */ | ||
127 | if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) | ||
128 | c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; | ||
129 | |||
130 | { | ||
131 | int t; | ||
132 | t = (c > 10) ? 10 : c; | ||
133 | |||
134 | 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)); | ||
135 | } | ||
136 | /* If for one reason or another, we can't copy more data, | ||
137 | we're done! */ | ||
138 | if (c == 0) | ||
139 | break; | ||
140 | |||
141 | rio_memcpy_toio(PortP->HostP->Caddr, PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); | ||
142 | /* udelay (1); */ | ||
143 | |||
144 | writeb(c, &(PacketP->len)); | ||
145 | if (!(PortP->State & RIO_DELETED)) { | ||
146 | add_transmit(PortP); | ||
147 | /* | ||
148 | ** Count chars tx'd for port statistics reporting | ||
149 | */ | ||
150 | if (PortP->statsGather) | ||
151 | PortP->txchars += c; | ||
152 | } | ||
153 | PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1); | ||
154 | PortP->gs.xmit_cnt -= c; | ||
155 | } | ||
156 | |||
157 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
158 | |||
159 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) | ||
160 | tty_wakeup(PortP->gs.port.tty); | ||
161 | |||
162 | } | ||
163 | |||
164 | |||
165 | /* | ||
166 | ** RIO Host Service routine. Does all the work traditionally associated with an | ||
167 | ** interrupt. | ||
168 | */ | ||
169 | static int RupIntr; | ||
170 | static int RxIntr; | ||
171 | static int TxIntr; | ||
172 | |||
173 | void RIOServiceHost(struct rio_info *p, struct Host *HostP) | ||
174 | { | ||
175 | rio_spin_lock(&HostP->HostLock); | ||
176 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
177 | static int t = 0; | ||
178 | rio_spin_unlock(&HostP->HostLock); | ||
179 | if ((t++ % 200) == 0) | ||
180 | rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags); | ||
181 | return; | ||
182 | } | ||
183 | rio_spin_unlock(&HostP->HostLock); | ||
184 | |||
185 | if (readw(&HostP->ParmMapP->rup_intr)) { | ||
186 | writew(0, &HostP->ParmMapP->rup_intr); | ||
187 | p->RIORupCount++; | ||
188 | RupIntr++; | ||
189 | rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %Zd\n", HostP - p->RIOHosts); | ||
190 | RIOPollHostCommands(p, HostP); | ||
191 | } | ||
192 | |||
193 | if (readw(&HostP->ParmMapP->rx_intr)) { | ||
194 | int port; | ||
195 | |||
196 | writew(0, &HostP->ParmMapP->rx_intr); | ||
197 | p->RIORxCount++; | ||
198 | RxIntr++; | ||
199 | |||
200 | rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %Zd\n", HostP - p->RIOHosts); | ||
201 | /* | ||
202 | ** Loop through every port. If the port is mapped into | ||
203 | ** the system ( i.e. has /dev/ttyXXXX associated ) then it is | ||
204 | ** worth checking. If the port isn't open, grab any packets | ||
205 | ** hanging on its receive queue and stuff them on the free | ||
206 | ** list; check for commands on the way. | ||
207 | */ | ||
208 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | ||
209 | struct Port *PortP = p->RIOPortp[port]; | ||
210 | struct tty_struct *ttyP; | ||
211 | struct PKT __iomem *PacketP; | ||
212 | |||
213 | /* | ||
214 | ** not mapped in - most of the RIOPortp[] information | ||
215 | ** has not been set up! | ||
216 | ** Optimise: ports come in bundles of eight. | ||
217 | */ | ||
218 | if (!PortP->Mapped) { | ||
219 | port += 7; | ||
220 | continue; /* with the next port */ | ||
221 | } | ||
222 | |||
223 | /* | ||
224 | ** If the host board isn't THIS host board, check the next one. | ||
225 | ** optimise: ports come in bundles of eight. | ||
226 | */ | ||
227 | if (PortP->HostP != HostP) { | ||
228 | port += 7; | ||
229 | continue; | ||
230 | } | ||
231 | |||
232 | /* | ||
233 | ** Let us see - is the port open? If not, then don't service it. | ||
234 | */ | ||
235 | if (!(PortP->PortState & PORT_ISOPEN)) { | ||
236 | continue; | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | ** find corresponding tty structure. The process of mapping | ||
241 | ** the ports puts these here. | ||
242 | */ | ||
243 | ttyP = PortP->gs.port.tty; | ||
244 | |||
245 | /* | ||
246 | ** Lock the port before we begin working on it. | ||
247 | */ | ||
248 | rio_spin_lock(&PortP->portSem); | ||
249 | |||
250 | /* | ||
251 | ** Process received data if there is any. | ||
252 | */ | ||
253 | if (can_remove_receive(&PacketP, PortP)) | ||
254 | RIOReceive(p, PortP); | ||
255 | |||
256 | /* | ||
257 | ** If there is no data left to be read from the port, and | ||
258 | ** it's handshake bit is set, then we must clear the handshake, | ||
259 | ** so that that downstream RTA is re-enabled. | ||
260 | */ | ||
261 | if (!can_remove_receive(&PacketP, PortP) && (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { | ||
262 | /* | ||
263 | ** MAGIC! ( Basically, handshake the RX buffer, so that | ||
264 | ** the RTAs upstream can be re-enabled. ) | ||
265 | */ | ||
266 | rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n"); | ||
267 | writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake); | ||
268 | } | ||
269 | rio_spin_unlock(&PortP->portSem); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | if (readw(&HostP->ParmMapP->tx_intr)) { | ||
274 | int port; | ||
275 | |||
276 | writew(0, &HostP->ParmMapP->tx_intr); | ||
277 | |||
278 | p->RIOTxCount++; | ||
279 | TxIntr++; | ||
280 | rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %Zd\n", HostP - p->RIOHosts); | ||
281 | |||
282 | /* | ||
283 | ** Loop through every port. | ||
284 | ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX | ||
285 | ** associated ) then it is worth checking. | ||
286 | */ | ||
287 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | ||
288 | struct Port *PortP = p->RIOPortp[port]; | ||
289 | struct tty_struct *ttyP; | ||
290 | struct PKT __iomem *PacketP; | ||
291 | |||
292 | /* | ||
293 | ** not mapped in - most of the RIOPortp[] information | ||
294 | ** has not been set up! | ||
295 | */ | ||
296 | if (!PortP->Mapped) { | ||
297 | port += 7; | ||
298 | continue; /* with the next port */ | ||
299 | } | ||
300 | |||
301 | /* | ||
302 | ** If the host board isn't running, then its data structures | ||
303 | ** are no use to us - continue quietly. | ||
304 | */ | ||
305 | if (PortP->HostP != HostP) { | ||
306 | port += 7; | ||
307 | continue; /* with the next port */ | ||
308 | } | ||
309 | |||
310 | /* | ||
311 | ** Let us see - is the port open? If not, then don't service it. | ||
312 | */ | ||
313 | if (!(PortP->PortState & PORT_ISOPEN)) { | ||
314 | continue; | ||
315 | } | ||
316 | |||
317 | rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); | ||
318 | /* | ||
319 | ** Lock the port before we begin working on it. | ||
320 | */ | ||
321 | rio_spin_lock(&PortP->portSem); | ||
322 | |||
323 | /* | ||
324 | ** If we can't add anything to the transmit queue, then | ||
325 | ** we need do none of this processing. | ||
326 | */ | ||
327 | if (!can_add_transmit(&PacketP, PortP)) { | ||
328 | rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); | ||
329 | rio_spin_unlock(&PortP->portSem); | ||
330 | continue; | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | ** find corresponding tty structure. The process of mapping | ||
335 | ** the ports puts these here. | ||
336 | */ | ||
337 | ttyP = PortP->gs.port.tty; | ||
338 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | ||
339 | if (!ttyP) { | ||
340 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); | ||
341 | rio_spin_unlock(&PortP->portSem); | ||
342 | continue; | ||
343 | } | ||
344 | /* | ||
345 | ** If there is more room available we start up the transmit | ||
346 | ** data process again. This can be direct I/O, if the cookmode | ||
347 | ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the | ||
348 | ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch | ||
349 | ** characters via the line discipline. We must always call | ||
350 | ** the line discipline, | ||
351 | ** so that user input characters can be echoed correctly. | ||
352 | ** | ||
353 | ** ++++ Update +++++ | ||
354 | ** With the advent of double buffering, we now see if | ||
355 | ** TxBufferOut-In is non-zero. If so, then we copy a packet | ||
356 | ** to the output place, and set it going. If this empties | ||
357 | ** the buffer, then we must issue a wakeup( ) on OUT. | ||
358 | ** If it frees space in the buffer then we must issue | ||
359 | ** a wakeup( ) on IN. | ||
360 | ** | ||
361 | ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we | ||
362 | ** have to send a WFLUSH command down the PHB, to mark the | ||
363 | ** end point of a WFLUSH. We also need to clear out any | ||
364 | ** data from the double buffer! ( note that WflushFlag is a | ||
365 | ** *count* of the number of WFLUSH commands outstanding! ) | ||
366 | ** | ||
367 | ** ++++ And there's more! | ||
368 | ** If an RTA is powered off, then on again, and rebooted, | ||
369 | ** whilst it has ports open, then we need to re-open the ports. | ||
370 | ** ( reasonable enough ). We can't do this when we spot the | ||
371 | ** re-boot, in interrupt time, because the queue is probably | ||
372 | ** full. So, when we come in here, we need to test if any | ||
373 | ** ports are in this condition, and re-open the port before | ||
374 | ** we try to send any more data to it. Now, the re-booted | ||
375 | ** RTA will be discarding packets from the PHB until it | ||
376 | ** receives this open packet, but don't worry tooo much | ||
377 | ** about that. The one thing that is interesting is the | ||
378 | ** combination of this effect and the WFLUSH effect! | ||
379 | */ | ||
380 | /* For now don't handle RTA reboots. -- REW. | ||
381 | Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ | ||
382 | if (PortP->MagicFlags) { | ||
383 | if (PortP->MagicFlags & MAGIC_REBOOT) { | ||
384 | /* | ||
385 | ** well, the RTA has been rebooted, and there is room | ||
386 | ** on its queue to add the open packet that is required. | ||
387 | ** | ||
388 | ** The messy part of this line is trying to decide if | ||
389 | ** we need to call the Param function as a tty or as | ||
390 | ** a modem. | ||
391 | ** DONT USE CLOCAL AS A TEST FOR THIS! | ||
392 | ** | ||
393 | ** If we can't param the port, then move on to the | ||
394 | ** next port. | ||
395 | */ | ||
396 | PortP->InUse = NOT_INUSE; | ||
397 | |||
398 | rio_spin_unlock(&PortP->portSem); | ||
399 | if (RIOParam(PortP, RIOC_OPEN, ((PortP->Cor2Copy & (RIOC_COR2_RTSFLOW | RIOC_COR2_CTSFLOW)) == (RIOC_COR2_RTSFLOW | RIOC_COR2_CTSFLOW)) ? 1 : 0, DONT_SLEEP) == RIO_FAIL) | ||
400 | continue; /* with next port */ | ||
401 | rio_spin_lock(&PortP->portSem); | ||
402 | PortP->MagicFlags &= ~MAGIC_REBOOT; | ||
403 | } | ||
404 | |||
405 | /* | ||
406 | ** As mentioned above, this is a tacky hack to cope | ||
407 | ** with WFLUSH | ||
408 | */ | ||
409 | if (PortP->WflushFlag) { | ||
410 | rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); | ||
411 | |||
412 | if (PortP->InUse) | ||
413 | rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); | ||
414 | } | ||
415 | |||
416 | while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) { | ||
417 | int p; | ||
418 | struct PktCmd __iomem *PktCmdP; | ||
419 | |||
420 | rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); | ||
421 | /* | ||
422 | ** make it look just like a WFLUSH command | ||
423 | */ | ||
424 | PktCmdP = (struct PktCmd __iomem *) &PacketP->data[0]; | ||
425 | |||
426 | writeb(RIOC_WFLUSH, &PktCmdP->Command); | ||
427 | |||
428 | p = PortP->HostPort % (u16) PORTS_PER_RTA; | ||
429 | |||
430 | /* | ||
431 | ** If second block of ports for 16 port RTA, add 8 | ||
432 | ** to index 8-15. | ||
433 | */ | ||
434 | if (PortP->SecondBlock) | ||
435 | p += PORTS_PER_RTA; | ||
436 | |||
437 | writeb(p, &PktCmdP->PhbNum); | ||
438 | |||
439 | /* | ||
440 | ** to make debuggery easier | ||
441 | */ | ||
442 | writeb('W', &PacketP->data[2]); | ||
443 | writeb('F', &PacketP->data[3]); | ||
444 | writeb('L', &PacketP->data[4]); | ||
445 | writeb('U', &PacketP->data[5]); | ||
446 | writeb('S', &PacketP->data[6]); | ||
447 | writeb('H', &PacketP->data[7]); | ||
448 | writeb(' ', &PacketP->data[8]); | ||
449 | writeb('0' + PortP->WflushFlag, &PacketP->data[9]); | ||
450 | writeb(' ', &PacketP->data[10]); | ||
451 | writeb(' ', &PacketP->data[11]); | ||
452 | writeb('\0', &PacketP->data[12]); | ||
453 | |||
454 | /* | ||
455 | ** its two bytes long! | ||
456 | */ | ||
457 | writeb(PKT_CMD_BIT | 2, &PacketP->len); | ||
458 | |||
459 | /* | ||
460 | ** queue it! | ||
461 | */ | ||
462 | if (!(PortP->State & RIO_DELETED)) { | ||
463 | add_transmit(PortP); | ||
464 | /* | ||
465 | ** Count chars tx'd for port statistics reporting | ||
466 | */ | ||
467 | if (PortP->statsGather) | ||
468 | PortP->txchars += 2; | ||
469 | } | ||
470 | |||
471 | if (--(PortP->WflushFlag) == 0) { | ||
472 | PortP->MagicFlags &= ~MAGIC_FLUSH; | ||
473 | } | ||
474 | |||
475 | rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag); | ||
476 | } | ||
477 | if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) { | ||
478 | if (PortP->MagicFlags & MAGIC_FLUSH) { | ||
479 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | ||
480 | } else { | ||
481 | if (!can_add_transmit(&PacketP, PortP)) { | ||
482 | rio_spin_unlock(&PortP->portSem); | ||
483 | continue; | ||
484 | } | ||
485 | rio_spin_unlock(&PortP->portSem); | ||
486 | RIOTxEnable((char *) PortP); | ||
487 | rio_spin_lock(&PortP->portSem); | ||
488 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | ||
489 | } | ||
490 | } | ||
491 | } | ||
492 | |||
493 | |||
494 | /* | ||
495 | ** If we can't add anything to the transmit queue, then | ||
496 | ** we need do none of the remaining processing. | ||
497 | */ | ||
498 | if (!can_add_transmit(&PacketP, PortP)) { | ||
499 | rio_spin_unlock(&PortP->portSem); | ||
500 | continue; | ||
501 | } | ||
502 | |||
503 | rio_spin_unlock(&PortP->portSem); | ||
504 | RIOTxEnable((char *) PortP); | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | |||
509 | /* | ||
510 | ** Routine for handling received data for tty drivers | ||
511 | */ | ||
512 | static void RIOReceive(struct rio_info *p, struct Port *PortP) | ||
513 | { | ||
514 | struct tty_struct *TtyP; | ||
515 | unsigned short transCount; | ||
516 | struct PKT __iomem *PacketP; | ||
517 | register unsigned int DataCnt; | ||
518 | unsigned char __iomem *ptr; | ||
519 | unsigned char *buf; | ||
520 | int copied = 0; | ||
521 | |||
522 | static int intCount, RxIntCnt; | ||
523 | |||
524 | /* | ||
525 | ** The receive data process is to remove packets from the | ||
526 | ** PHB until there aren't any more or the current cblock | ||
527 | ** is full. When this occurs, there will be some left over | ||
528 | ** data in the packet, that we must do something with. | ||
529 | ** As we haven't unhooked the packet from the read list | ||
530 | ** yet, we can just leave the packet there, having first | ||
531 | ** made a note of how far we got. This means that we need | ||
532 | ** a pointer per port saying where we start taking the | ||
533 | ** data from - this will normally be zero, but when we | ||
534 | ** run out of space it will be set to the offset of the | ||
535 | ** next byte to copy from the packet data area. The packet | ||
536 | ** length field is decremented by the number of bytes that | ||
537 | ** we successfully removed from the packet. When this reaches | ||
538 | ** zero, we reset the offset pointer to be zero, and free | ||
539 | ** the packet from the front of the queue. | ||
540 | */ | ||
541 | |||
542 | intCount++; | ||
543 | |||
544 | TtyP = PortP->gs.port.tty; | ||
545 | if (!TtyP) { | ||
546 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); | ||
547 | return; | ||
548 | } | ||
549 | |||
550 | if (PortP->State & RIO_THROTTLE_RX) { | ||
551 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); | ||
552 | return; | ||
553 | } | ||
554 | |||
555 | if (PortP->State & RIO_DELETED) { | ||
556 | while (can_remove_receive(&PacketP, PortP)) { | ||
557 | remove_receive(PortP); | ||
558 | put_free_end(PortP->HostP, PacketP); | ||
559 | } | ||
560 | } else { | ||
561 | /* | ||
562 | ** loop, just so long as: | ||
563 | ** i ) there's some data ( i.e. can_remove_receive ) | ||
564 | ** ii ) we haven't been blocked | ||
565 | ** iii ) there's somewhere to put the data | ||
566 | ** iv ) we haven't outstayed our welcome | ||
567 | */ | ||
568 | transCount = 1; | ||
569 | while (can_remove_receive(&PacketP, PortP) | ||
570 | && transCount) { | ||
571 | RxIntCnt++; | ||
572 | |||
573 | /* | ||
574 | ** check that it is not a command! | ||
575 | */ | ||
576 | if (readb(&PacketP->len) & PKT_CMD_BIT) { | ||
577 | rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); | ||
578 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ | ||
579 | rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit)); | ||
580 | rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port)); | ||
581 | rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", readb(&PacketP->src_unit)); | ||
582 | rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", readb(&PacketP->src_port)); | ||
583 | rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", readb(&PacketP->len)); | ||
584 | rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", readb(&PacketP->control)); | ||
585 | rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", readw(&PacketP->csum)); | ||
586 | rio_dprintk(RIO_DEBUG_INTR, " data bytes: "); | ||
587 | for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++) | ||
588 | rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt])); | ||
589 | remove_receive(PortP); | ||
590 | put_free_end(PortP->HostP, PacketP); | ||
591 | continue; /* with next packet */ | ||
592 | } | ||
593 | |||
594 | /* | ||
595 | ** How many characters can we move 'upstream' ? | ||
596 | ** | ||
597 | ** Determine the minimum of the amount of data | ||
598 | ** available and the amount of space in which to | ||
599 | ** put it. | ||
600 | ** | ||
601 | ** 1. Get the packet length by masking 'len' | ||
602 | ** for only the length bits. | ||
603 | ** 2. Available space is [buffer size] - [space used] | ||
604 | ** | ||
605 | ** Transfer count is the minimum of packet length | ||
606 | ** and available space. | ||
607 | */ | ||
608 | |||
609 | transCount = tty_buffer_request_room(TtyP, readb(&PacketP->len) & PKT_LEN_MASK); | ||
610 | rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); | ||
611 | /* | ||
612 | ** To use the following 'kkprintfs' for debugging - change the '#undef' | ||
613 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the | ||
614 | ** driver). | ||
615 | */ | ||
616 | ptr = (unsigned char __iomem *) PacketP->data + PortP->RxDataStart; | ||
617 | |||
618 | tty_prepare_flip_string(TtyP, &buf, transCount); | ||
619 | rio_memcpy_fromio(buf, ptr, transCount); | ||
620 | PortP->RxDataStart += transCount; | ||
621 | writeb(readb(&PacketP->len)-transCount, &PacketP->len); | ||
622 | copied += transCount; | ||
623 | |||
624 | |||
625 | |||
626 | if (readb(&PacketP->len) == 0) { | ||
627 | /* | ||
628 | ** If we have emptied the packet, then we can | ||
629 | ** free it, and reset the start pointer for | ||
630 | ** the next packet. | ||
631 | */ | ||
632 | remove_receive(PortP); | ||
633 | put_free_end(PortP->HostP, PacketP); | ||
634 | PortP->RxDataStart = 0; | ||
635 | } | ||
636 | } | ||
637 | } | ||
638 | if (copied) { | ||
639 | rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); | ||
640 | tty_flip_buffer_push(TtyP); | ||
641 | } | ||
642 | |||
643 | return; | ||
644 | } | ||
645 | |||
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h deleted file mode 100644 index e8af5b30519e..000000000000 --- a/drivers/char/rio/rioioctl.h +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioioctl.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:13 | ||
26 | ** Retrieved : 11/6/98 11:34:22 | ||
27 | ** | ||
28 | ** ident @(#)rioioctl.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rioioctl_h__ | ||
34 | #define __rioioctl_h__ | ||
35 | |||
36 | /* | ||
37 | ** RIO device driver - user ioctls and associated structures. | ||
38 | */ | ||
39 | |||
40 | struct portStats { | ||
41 | int port; | ||
42 | int gather; | ||
43 | unsigned long txchars; | ||
44 | unsigned long rxchars; | ||
45 | unsigned long opens; | ||
46 | unsigned long closes; | ||
47 | unsigned long ioctls; | ||
48 | }; | ||
49 | |||
50 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) | ||
51 | |||
52 | #define RIO_QUICK_CHECK (RIOC | 105) | ||
53 | #define RIO_GATHER_PORT_STATS (RIOC | 193) | ||
54 | #define RIO_RESET_PORT_STATS (RIOC | 194) | ||
55 | #define RIO_GET_PORT_STATS (RIOC | 195) | ||
56 | |||
57 | #endif /* __rioioctl_h__ */ | ||
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c deleted file mode 100644 index 6415f3f32a72..000000000000 --- a/drivers/char/rio/rioparam.c +++ /dev/null | |||
@@ -1,663 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioparam.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:45 | ||
26 | ** Retrieved : 11/6/98 10:33:50 | ||
27 | ** | ||
28 | ** ident @(#)rioparam.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/tty.h> | ||
36 | #include <asm/io.h> | ||
37 | #include <asm/system.h> | ||
38 | #include <asm/string.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | |||
41 | #include <linux/termios.h> | ||
42 | #include <linux/serial.h> | ||
43 | |||
44 | #include <linux/generic_serial.h> | ||
45 | |||
46 | |||
47 | #include "linux_compat.h" | ||
48 | #include "rio_linux.h" | ||
49 | #include "pkt.h" | ||
50 | #include "daemon.h" | ||
51 | #include "rio.h" | ||
52 | #include "riospace.h" | ||
53 | #include "cmdpkt.h" | ||
54 | #include "map.h" | ||
55 | #include "rup.h" | ||
56 | #include "port.h" | ||
57 | #include "riodrvr.h" | ||
58 | #include "rioinfo.h" | ||
59 | #include "func.h" | ||
60 | #include "errors.h" | ||
61 | #include "pci.h" | ||
62 | |||
63 | #include "parmmap.h" | ||
64 | #include "unixrup.h" | ||
65 | #include "board.h" | ||
66 | #include "host.h" | ||
67 | #include "phb.h" | ||
68 | #include "link.h" | ||
69 | #include "cmdblk.h" | ||
70 | #include "route.h" | ||
71 | #include "cirrus.h" | ||
72 | #include "rioioctl.h" | ||
73 | #include "param.h" | ||
74 | |||
75 | |||
76 | |||
77 | /* | ||
78 | ** The Scam, based on email from jeremyr@bugs.specialix.co.uk.... | ||
79 | ** | ||
80 | ** To send a command on a particular port, you put a packet with the | ||
81 | ** command bit set onto the port. The command bit is in the len field, | ||
82 | ** and gets ORed in with the actual byte count. | ||
83 | ** | ||
84 | ** When you send a packet with the command bit set the first | ||
85 | ** data byte (data[0]) is interpreted as the command to execute. | ||
86 | ** It also governs what data structure overlay should accompany the packet. | ||
87 | ** Commands are defined in cirrus/cirrus.h | ||
88 | ** | ||
89 | ** If you want the command to pre-emt data already on the queue for the | ||
90 | ** port, set the pre-emptive bit in conjunction with the command bit. | ||
91 | ** It is not defined what will happen if you set the preemptive bit | ||
92 | ** on a packet that is NOT a command. | ||
93 | ** | ||
94 | ** Pre-emptive commands should be queued at the head of the queue using | ||
95 | ** add_start(), whereas normal commands and data are enqueued using | ||
96 | ** add_end(). | ||
97 | ** | ||
98 | ** Most commands do not use the remaining bytes in the data array. The | ||
99 | ** exceptions are OPEN MOPEN and CONFIG. (NB. As with the SI CONFIG and | ||
100 | ** OPEN are currently analogous). With these three commands the following | ||
101 | ** 11 data bytes are all used to pass config information such as baud rate etc. | ||
102 | ** The fields are also defined in cirrus.h. Some contain straightforward | ||
103 | ** information such as the transmit XON character. Two contain the transmit and | ||
104 | ** receive baud rates respectively. For most baud rates there is a direct | ||
105 | ** mapping between the rates defined in <sys/termio.h> and the byte in the | ||
106 | ** packet. There are additional (non UNIX-standard) rates defined in | ||
107 | ** /u/dos/rio/cirrus/h/brates.h. | ||
108 | ** | ||
109 | ** The rest of the data fields contain approximations to the Cirrus registers | ||
110 | ** that are used to program number of bits etc. Each registers bit fields is | ||
111 | ** defined in cirrus.h. | ||
112 | ** | ||
113 | ** NB. Only use those bits that are defined as being driver specific | ||
114 | ** or common to the RTA and the driver. | ||
115 | ** | ||
116 | ** All commands going from RTA->Host will be dealt with by the Host code - you | ||
117 | ** will never see them. As with the SI there will be three fields to look out | ||
118 | ** for in each phb (not yet defined - needs defining a.s.a.p). | ||
119 | ** | ||
120 | ** modem_status - current state of handshake pins. | ||
121 | ** | ||
122 | ** port_status - current port status - equivalent to hi_stat for SI, indicates | ||
123 | ** if port is IDLE_OPEN, IDLE_CLOSED etc. | ||
124 | ** | ||
125 | ** break_status - bit X set if break has been received. | ||
126 | ** | ||
127 | ** Happy hacking. | ||
128 | ** | ||
129 | */ | ||
130 | |||
131 | /* | ||
132 | ** RIOParam is used to open or configure a port. You pass it a PortP, | ||
133 | ** which will have a tty struct attached to it. You also pass a command, | ||
134 | ** either OPEN or CONFIG. The port's setup is taken from the t_ fields | ||
135 | ** of the tty struct inside the PortP, and the port is either opened | ||
136 | ** or re-configured. You must also tell RIOParam if the device is a modem | ||
137 | ** device or not (i.e. top bit of minor number set or clear - take special | ||
138 | ** care when deciding on this!). | ||
139 | ** RIOParam neither flushes nor waits for drain, and is NOT preemptive. | ||
140 | ** | ||
141 | ** RIOParam assumes it will be called at splrio(), and also assumes | ||
142 | ** that CookMode is set correctly in the port structure. | ||
143 | ** | ||
144 | ** NB. for MPX | ||
145 | ** tty lock must NOT have been previously acquired. | ||
146 | */ | ||
147 | int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) | ||
148 | { | ||
149 | struct tty_struct *TtyP; | ||
150 | int retval; | ||
151 | struct phb_param __iomem *phb_param_ptr; | ||
152 | struct PKT __iomem *PacketP; | ||
153 | int res; | ||
154 | u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; | ||
155 | u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; | ||
156 | u8 LNext = 0, TxBaud = 0, RxBaud = 0; | ||
157 | int retries = 0xff; | ||
158 | unsigned long flags; | ||
159 | |||
160 | func_enter(); | ||
161 | |||
162 | TtyP = PortP->gs.port.tty; | ||
163 | |||
164 | 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); | ||
165 | |||
166 | if (!TtyP) { | ||
167 | rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); | ||
168 | |||
169 | func_exit(); | ||
170 | |||
171 | return RIO_FAIL; | ||
172 | } | ||
173 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
174 | |||
175 | if (cmd == RIOC_OPEN) { | ||
176 | /* | ||
177 | ** If the port is set to store or lock the parameters, and it is | ||
178 | ** paramed with OPEN, we want to restore the saved port termio, but | ||
179 | ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. | ||
180 | */ | ||
181 | } | ||
182 | |||
183 | /* | ||
184 | ** wait for space | ||
185 | */ | ||
186 | while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) { | ||
187 | if (retries-- <= 0) { | ||
188 | break; | ||
189 | } | ||
190 | if (PortP->InUse != NOT_INUSE) { | ||
191 | rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); | ||
192 | } | ||
193 | |||
194 | if (!res) { | ||
195 | rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); | ||
196 | } | ||
197 | |||
198 | if (SleepFlag != OK_TO_SLEEP) { | ||
199 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
200 | func_exit(); | ||
201 | |||
202 | return RIO_FAIL; | ||
203 | } | ||
204 | |||
205 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); | ||
206 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
207 | retval = RIODelay(PortP, HUNDRED_MS); | ||
208 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
209 | if (retval == RIO_FAIL) { | ||
210 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); | ||
211 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
212 | func_exit(); | ||
213 | return -EINTR; | ||
214 | } | ||
215 | if (PortP->State & RIO_DELETED) { | ||
216 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
217 | func_exit(); | ||
218 | return 0; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | if (!res) { | ||
223 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
224 | func_exit(); | ||
225 | |||
226 | return RIO_FAIL; | ||
227 | } | ||
228 | |||
229 | rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); | ||
230 | rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP); | ||
231 | |||
232 | phb_param_ptr = (struct phb_param __iomem *) PacketP->data; | ||
233 | |||
234 | |||
235 | switch (TtyP->termios->c_cflag & CSIZE) { | ||
236 | case CS5: | ||
237 | { | ||
238 | rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n"); | ||
239 | Cor1 |= RIOC_COR1_5BITS; | ||
240 | break; | ||
241 | } | ||
242 | case CS6: | ||
243 | { | ||
244 | rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n"); | ||
245 | Cor1 |= RIOC_COR1_6BITS; | ||
246 | break; | ||
247 | } | ||
248 | case CS7: | ||
249 | { | ||
250 | rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n"); | ||
251 | Cor1 |= RIOC_COR1_7BITS; | ||
252 | break; | ||
253 | } | ||
254 | case CS8: | ||
255 | { | ||
256 | rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n"); | ||
257 | Cor1 |= RIOC_COR1_8BITS; | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | if (TtyP->termios->c_cflag & CSTOPB) { | ||
263 | rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n"); | ||
264 | Cor1 |= RIOC_COR1_2STOP; | ||
265 | } else { | ||
266 | rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n"); | ||
267 | Cor1 |= RIOC_COR1_1STOP; | ||
268 | } | ||
269 | |||
270 | if (TtyP->termios->c_cflag & PARENB) { | ||
271 | rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n"); | ||
272 | Cor1 |= RIOC_COR1_NORMAL; | ||
273 | } else { | ||
274 | rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n"); | ||
275 | Cor1 |= RIOC_COR1_NOP; | ||
276 | } | ||
277 | if (TtyP->termios->c_cflag & PARODD) { | ||
278 | rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n"); | ||
279 | Cor1 |= RIOC_COR1_ODD; | ||
280 | } else { | ||
281 | rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n"); | ||
282 | Cor1 |= RIOC_COR1_EVEN; | ||
283 | } | ||
284 | |||
285 | /* | ||
286 | ** COR 2 | ||
287 | */ | ||
288 | if (TtyP->termios->c_iflag & IXON) { | ||
289 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n"); | ||
290 | Cor2 |= RIOC_COR2_IXON; | ||
291 | } else { | ||
292 | if (PortP->Config & RIO_IXON) { | ||
293 | rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); | ||
294 | Cor2 |= RIOC_COR2_IXON; | ||
295 | } else | ||
296 | rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n"); | ||
297 | } | ||
298 | |||
299 | if (TtyP->termios->c_iflag & IXANY) { | ||
300 | if (PortP->Config & RIO_IXANY) { | ||
301 | rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n"); | ||
302 | Cor2 |= RIOC_COR2_IXANY; | ||
303 | } else | ||
304 | rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); | ||
305 | } | ||
306 | |||
307 | if (TtyP->termios->c_iflag & IXOFF) { | ||
308 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); | ||
309 | Cor2 |= RIOC_COR2_IXOFF; | ||
310 | } | ||
311 | |||
312 | if (TtyP->termios->c_cflag & HUPCL) { | ||
313 | rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n"); | ||
314 | Cor2 |= RIOC_COR2_HUPCL; | ||
315 | } | ||
316 | |||
317 | if (C_CRTSCTS(TtyP)) { | ||
318 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); | ||
319 | Cor2 |= RIOC_COR2_CTSFLOW; | ||
320 | Cor2 |= RIOC_COR2_RTSFLOW; | ||
321 | } else { | ||
322 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); | ||
323 | Cor2 &= ~RIOC_COR2_CTSFLOW; | ||
324 | Cor2 &= ~RIOC_COR2_RTSFLOW; | ||
325 | } | ||
326 | |||
327 | |||
328 | if (TtyP->termios->c_cflag & CLOCAL) { | ||
329 | rio_dprintk(RIO_DEBUG_PARAM, "Local line\n"); | ||
330 | } else { | ||
331 | rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n"); | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | ** COR 4 (there is no COR 3) | ||
336 | */ | ||
337 | if (TtyP->termios->c_iflag & IGNBRK) { | ||
338 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n"); | ||
339 | Cor4 |= RIOC_COR4_IGNBRK; | ||
340 | } | ||
341 | if (!(TtyP->termios->c_iflag & BRKINT)) { | ||
342 | rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n"); | ||
343 | Cor4 |= RIOC_COR4_NBRKINT; | ||
344 | } else { | ||
345 | rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on break condition\n"); | ||
346 | } | ||
347 | |||
348 | if (TtyP->termios->c_iflag & INLCR) { | ||
349 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); | ||
350 | Cor4 |= RIOC_COR4_INLCR; | ||
351 | } | ||
352 | |||
353 | if (TtyP->termios->c_iflag & IGNCR) { | ||
354 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); | ||
355 | Cor4 |= RIOC_COR4_IGNCR; | ||
356 | } | ||
357 | |||
358 | if (TtyP->termios->c_iflag & ICRNL) { | ||
359 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); | ||
360 | Cor4 |= RIOC_COR4_ICRNL; | ||
361 | } | ||
362 | if (TtyP->termios->c_iflag & IGNPAR) { | ||
363 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); | ||
364 | Cor4 |= RIOC_COR4_IGNPAR; | ||
365 | } | ||
366 | if (TtyP->termios->c_iflag & PARMRK) { | ||
367 | rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n"); | ||
368 | Cor4 |= RIOC_COR4_PARMRK; | ||
369 | } | ||
370 | |||
371 | /* | ||
372 | ** Set the RAISEMOD flag to ensure that the modem lines are raised | ||
373 | ** on reception of a config packet. | ||
374 | ** The download code handles the zero baud condition. | ||
375 | */ | ||
376 | Cor4 |= RIOC_COR4_RAISEMOD; | ||
377 | |||
378 | /* | ||
379 | ** COR 5 | ||
380 | */ | ||
381 | |||
382 | Cor5 = RIOC_COR5_CMOE; | ||
383 | |||
384 | /* | ||
385 | ** Set to monitor tbusy/tstop (or not). | ||
386 | */ | ||
387 | |||
388 | if (PortP->MonitorTstate) | ||
389 | Cor5 |= RIOC_COR5_TSTATE_ON; | ||
390 | else | ||
391 | Cor5 |= RIOC_COR5_TSTATE_OFF; | ||
392 | |||
393 | /* | ||
394 | ** Could set LNE here if you wanted LNext processing. SVR4 will use it. | ||
395 | */ | ||
396 | if (TtyP->termios->c_iflag & ISTRIP) { | ||
397 | rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n"); | ||
398 | if (!(PortP->State & RIO_TRIAD_MODE)) { | ||
399 | Cor5 |= RIOC_COR5_ISTRIP; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | if (TtyP->termios->c_oflag & ONLCR) { | ||
404 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); | ||
405 | if (PortP->CookMode == COOK_MEDIUM) | ||
406 | Cor5 |= RIOC_COR5_ONLCR; | ||
407 | } | ||
408 | if (TtyP->termios->c_oflag & OCRNL) { | ||
409 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); | ||
410 | if (PortP->CookMode == COOK_MEDIUM) | ||
411 | Cor5 |= RIOC_COR5_OCRNL; | ||
412 | } | ||
413 | if ((TtyP->termios->c_oflag & TABDLY) == TAB3) { | ||
414 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n"); | ||
415 | if (PortP->CookMode == COOK_MEDIUM) | ||
416 | Cor5 |= RIOC_COR5_TAB3; | ||
417 | } | ||
418 | |||
419 | /* | ||
420 | ** Flow control bytes. | ||
421 | */ | ||
422 | TxXon = TtyP->termios->c_cc[VSTART]; | ||
423 | TxXoff = TtyP->termios->c_cc[VSTOP]; | ||
424 | RxXon = TtyP->termios->c_cc[VSTART]; | ||
425 | RxXoff = TtyP->termios->c_cc[VSTOP]; | ||
426 | /* | ||
427 | ** LNEXT byte | ||
428 | */ | ||
429 | LNext = 0; | ||
430 | |||
431 | /* | ||
432 | ** Baud rate bytes | ||
433 | */ | ||
434 | rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD); | ||
435 | |||
436 | switch (TtyP->termios->c_cflag & CBAUD) { | ||
437 | #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break | ||
438 | e(50); | ||
439 | e(75); | ||
440 | e(110); | ||
441 | e(134); | ||
442 | e(150); | ||
443 | e(200); | ||
444 | e(300); | ||
445 | e(600); | ||
446 | e(1200); | ||
447 | e(1800); | ||
448 | e(2400); | ||
449 | e(4800); | ||
450 | e(9600); | ||
451 | e(19200); | ||
452 | e(38400); | ||
453 | e(57600); | ||
454 | e(115200); /* e(230400);e(460800); e(921600); */ | ||
455 | } | ||
456 | |||
457 | rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); | ||
458 | |||
459 | |||
460 | /* | ||
461 | ** Leftovers | ||
462 | */ | ||
463 | if (TtyP->termios->c_cflag & CREAD) | ||
464 | rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n"); | ||
465 | #ifdef RCV1EN | ||
466 | if (TtyP->termios->c_cflag & RCV1EN) | ||
467 | rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n"); | ||
468 | #endif | ||
469 | #ifdef XMT1EN | ||
470 | if (TtyP->termios->c_cflag & XMT1EN) | ||
471 | rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); | ||
472 | #endif | ||
473 | if (TtyP->termios->c_lflag & ISIG) | ||
474 | rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); | ||
475 | if (TtyP->termios->c_lflag & ICANON) | ||
476 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); | ||
477 | if (TtyP->termios->c_lflag & XCASE) | ||
478 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); | ||
479 | if (TtyP->termios->c_lflag & ECHO) | ||
480 | rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n"); | ||
481 | if (TtyP->termios->c_lflag & ECHOE) | ||
482 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n"); | ||
483 | if (TtyP->termios->c_lflag & ECHOK) | ||
484 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n"); | ||
485 | if (TtyP->termios->c_lflag & ECHONL) | ||
486 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n"); | ||
487 | if (TtyP->termios->c_lflag & NOFLSH) | ||
488 | rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); | ||
489 | #ifdef TOSTOP | ||
490 | if (TtyP->termios->c_lflag & TOSTOP) | ||
491 | rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); | ||
492 | #endif | ||
493 | #ifdef XCLUDE | ||
494 | if (TtyP->termios->c_lflag & XCLUDE) | ||
495 | rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n"); | ||
496 | #endif | ||
497 | if (TtyP->termios->c_iflag & IUCLC) | ||
498 | rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); | ||
499 | if (TtyP->termios->c_oflag & OPOST) | ||
500 | rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n"); | ||
501 | if (TtyP->termios->c_oflag & OLCUC) | ||
502 | rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); | ||
503 | if (TtyP->termios->c_oflag & ONOCR) | ||
504 | rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); | ||
505 | if (TtyP->termios->c_oflag & ONLRET) | ||
506 | rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); | ||
507 | if (TtyP->termios->c_oflag & OFILL) | ||
508 | rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n"); | ||
509 | if (TtyP->termios->c_oflag & OFDEL) | ||
510 | rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n"); | ||
511 | if (TtyP->termios->c_oflag & NLDLY) | ||
512 | rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n"); | ||
513 | if (TtyP->termios->c_oflag & CRDLY) | ||
514 | rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); | ||
515 | if (TtyP->termios->c_oflag & TABDLY) | ||
516 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); | ||
517 | /* | ||
518 | ** These things are kind of useful in a later life! | ||
519 | */ | ||
520 | PortP->Cor2Copy = Cor2; | ||
521 | |||
522 | if (PortP->State & RIO_DELETED) { | ||
523 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
524 | func_exit(); | ||
525 | |||
526 | return RIO_FAIL; | ||
527 | } | ||
528 | |||
529 | /* | ||
530 | ** Actually write the info into the packet to be sent | ||
531 | */ | ||
532 | writeb(cmd, &phb_param_ptr->Cmd); | ||
533 | writeb(Cor1, &phb_param_ptr->Cor1); | ||
534 | writeb(Cor2, &phb_param_ptr->Cor2); | ||
535 | writeb(Cor4, &phb_param_ptr->Cor4); | ||
536 | writeb(Cor5, &phb_param_ptr->Cor5); | ||
537 | writeb(TxXon, &phb_param_ptr->TxXon); | ||
538 | writeb(RxXon, &phb_param_ptr->RxXon); | ||
539 | writeb(TxXoff, &phb_param_ptr->TxXoff); | ||
540 | writeb(RxXoff, &phb_param_ptr->RxXoff); | ||
541 | writeb(LNext, &phb_param_ptr->LNext); | ||
542 | writeb(TxBaud, &phb_param_ptr->TxBaud); | ||
543 | writeb(RxBaud, &phb_param_ptr->RxBaud); | ||
544 | |||
545 | /* | ||
546 | ** Set the length/command field | ||
547 | */ | ||
548 | writeb(12 | PKT_CMD_BIT, &PacketP->len); | ||
549 | |||
550 | /* | ||
551 | ** The packet is formed - now, whack it off | ||
552 | ** to its final destination: | ||
553 | */ | ||
554 | add_transmit(PortP); | ||
555 | /* | ||
556 | ** Count characters transmitted for port statistics reporting | ||
557 | */ | ||
558 | if (PortP->statsGather) | ||
559 | PortP->txchars += 12; | ||
560 | |||
561 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
562 | |||
563 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n"); | ||
564 | /* | ||
565 | ** job done. | ||
566 | */ | ||
567 | func_exit(); | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | |||
573 | /* | ||
574 | ** We can add another packet to a transmit queue if the packet pointer pointed | ||
575 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. | ||
576 | */ | ||
577 | int can_add_transmit(struct PKT __iomem **PktP, struct Port *PortP) | ||
578 | { | ||
579 | struct PKT __iomem *tp; | ||
580 | |||
581 | *PktP = tp = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd)); | ||
582 | |||
583 | return !((unsigned long) tp & PKT_IN_USE); | ||
584 | } | ||
585 | |||
586 | /* | ||
587 | ** To add a packet to the queue, you set the PKT_IN_USE bit in the address, | ||
588 | ** and then move the TxAdd pointer along one position to point to the next | ||
589 | ** packet pointer. You must wrap the pointer from the end back to the start. | ||
590 | */ | ||
591 | void add_transmit(struct Port *PortP) | ||
592 | { | ||
593 | if (readw(PortP->TxAdd) & PKT_IN_USE) { | ||
594 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); | ||
595 | } | ||
596 | writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd); | ||
597 | PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1; | ||
598 | writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add); | ||
599 | } | ||
600 | |||
601 | /**************************************** | ||
602 | * Put a packet onto the end of the | ||
603 | * free list | ||
604 | ****************************************/ | ||
605 | void put_free_end(struct Host *HostP, struct PKT __iomem *PktP) | ||
606 | { | ||
607 | struct rio_free_list __iomem *tmp_pointer; | ||
608 | unsigned short old_end, new_end; | ||
609 | unsigned long flags; | ||
610 | |||
611 | rio_spin_lock_irqsave(&HostP->HostLock, flags); | ||
612 | |||
613 | /************************************************* | ||
614 | * Put a packet back onto the back of the free list | ||
615 | * | ||
616 | ************************************************/ | ||
617 | |||
618 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP); | ||
619 | |||
620 | if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) { | ||
621 | new_end = RIO_OFF(HostP->Caddr, PktP); | ||
622 | tmp_pointer = (struct rio_free_list __iomem *) RIO_PTR(HostP->Caddr, old_end); | ||
623 | writew(new_end, &tmp_pointer->next); | ||
624 | writew(old_end, &((struct rio_free_list __iomem *) PktP)->prev); | ||
625 | writew(TPNULL, &((struct rio_free_list __iomem *) PktP)->next); | ||
626 | writew(new_end, &HostP->ParmMapP->free_list_end); | ||
627 | } else { /* First packet on the free list this should never happen! */ | ||
628 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); | ||
629 | writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end); | ||
630 | tmp_pointer = (struct rio_free_list __iomem *) PktP; | ||
631 | writew(TPNULL, &tmp_pointer->prev); | ||
632 | writew(TPNULL, &tmp_pointer->next); | ||
633 | } | ||
634 | rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); | ||
635 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | ||
636 | } | ||
637 | |||
638 | /* | ||
639 | ** can_remove_receive(PktP,P) returns non-zero if PKT_IN_USE is set | ||
640 | ** for the next packet on the queue. It will also set PktP to point to the | ||
641 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, | ||
642 | ** then can_remove_receive() returns 0. | ||
643 | */ | ||
644 | int can_remove_receive(struct PKT __iomem **PktP, struct Port *PortP) | ||
645 | { | ||
646 | if (readw(PortP->RxRemove) & PKT_IN_USE) { | ||
647 | *PktP = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE); | ||
648 | return 1; | ||
649 | } | ||
650 | return 0; | ||
651 | } | ||
652 | |||
653 | /* | ||
654 | ** To remove a packet from the receive queue you clear its PKT_IN_USE bit, | ||
655 | ** and then bump the pointers. Once the pointers get to the end, they must | ||
656 | ** be wrapped back to the start. | ||
657 | */ | ||
658 | void remove_receive(struct Port *PortP) | ||
659 | { | ||
660 | writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove); | ||
661 | PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; | ||
662 | writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove); | ||
663 | } | ||
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c deleted file mode 100644 index f9b936ac3394..000000000000 --- a/drivers/char/rio/rioroute.c +++ /dev/null | |||
@@ -1,1039 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : rioroute.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:46 | ||
26 | ** Retrieved : 11/6/98 10:33:50 | ||
27 | ** | ||
28 | ** ident @(#)rioroute.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <asm/io.h> | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/string.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | |||
40 | #include <linux/termios.h> | ||
41 | #include <linux/serial.h> | ||
42 | |||
43 | #include <linux/generic_serial.h> | ||
44 | |||
45 | |||
46 | #include "linux_compat.h" | ||
47 | #include "rio_linux.h" | ||
48 | #include "pkt.h" | ||
49 | #include "daemon.h" | ||
50 | #include "rio.h" | ||
51 | #include "riospace.h" | ||
52 | #include "cmdpkt.h" | ||
53 | #include "map.h" | ||
54 | #include "rup.h" | ||
55 | #include "port.h" | ||
56 | #include "riodrvr.h" | ||
57 | #include "rioinfo.h" | ||
58 | #include "func.h" | ||
59 | #include "errors.h" | ||
60 | #include "pci.h" | ||
61 | |||
62 | #include "parmmap.h" | ||
63 | #include "unixrup.h" | ||
64 | #include "board.h" | ||
65 | #include "host.h" | ||
66 | #include "phb.h" | ||
67 | #include "link.h" | ||
68 | #include "cmdblk.h" | ||
69 | #include "route.h" | ||
70 | #include "cirrus.h" | ||
71 | #include "rioioctl.h" | ||
72 | #include "param.h" | ||
73 | |||
74 | static int RIOCheckIsolated(struct rio_info *, struct Host *, unsigned int); | ||
75 | static int RIOIsolate(struct rio_info *, struct Host *, unsigned int); | ||
76 | static int RIOCheck(struct Host *, unsigned int); | ||
77 | static void RIOConCon(struct rio_info *, struct Host *, unsigned int, unsigned int, unsigned int, unsigned int, int); | ||
78 | |||
79 | |||
80 | /* | ||
81 | ** Incoming on the ROUTE_RUP | ||
82 | ** I wrote this while I was tired. Forgive me. | ||
83 | */ | ||
84 | int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT __iomem * PacketP) | ||
85 | { | ||
86 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *) PacketP->data; | ||
87 | struct PktCmd_M *PktReplyP; | ||
88 | struct CmdBlk *CmdBlkP; | ||
89 | struct Port *PortP; | ||
90 | struct Map *MapP; | ||
91 | struct Top *TopP; | ||
92 | int ThisLink, ThisLinkMin, ThisLinkMax; | ||
93 | int port; | ||
94 | int Mod, Mod1, Mod2; | ||
95 | unsigned short RtaType; | ||
96 | unsigned int RtaUniq; | ||
97 | unsigned int ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ | ||
98 | unsigned int OldUnit, NewUnit, OldLink, NewLink; | ||
99 | char *MyType, *MyName; | ||
100 | int Lies; | ||
101 | unsigned long flags; | ||
102 | |||
103 | /* | ||
104 | ** Is this unit telling us it's current link topology? | ||
105 | */ | ||
106 | if (readb(&PktCmdP->Command) == ROUTE_TOPOLOGY) { | ||
107 | MapP = HostP->Mapping; | ||
108 | |||
109 | /* | ||
110 | ** The packet can be sent either by the host or by an RTA. | ||
111 | ** If it comes from the host, then we need to fill in the | ||
112 | ** Topology array in the host structure. If it came in | ||
113 | ** from an RTA then we need to fill in the Mapping structure's | ||
114 | ** Topology array for the unit. | ||
115 | */ | ||
116 | if (Rup >= (unsigned short) MAX_RUP) { | ||
117 | ThisUnit = HOST_ID; | ||
118 | TopP = HostP->Topology; | ||
119 | MyType = "Host"; | ||
120 | MyName = HostP->Name; | ||
121 | ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; | ||
122 | } else { | ||
123 | ThisUnit = Rup + 1; | ||
124 | TopP = HostP->Mapping[Rup].Topology; | ||
125 | MyType = "RTA"; | ||
126 | MyName = HostP->Mapping[Rup].Name; | ||
127 | ThisLinkMin = 0; | ||
128 | ThisLinkMax = LINKS_PER_UNIT - 1; | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | ** Lies will not be tolerated. | ||
133 | ** If any pair of links claim to be connected to the same | ||
134 | ** place, then ignore this packet completely. | ||
135 | */ | ||
136 | Lies = 0; | ||
137 | for (ThisLink = ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) { | ||
138 | /* | ||
139 | ** it won't lie about network interconnect, total disconnects | ||
140 | ** and no-IDs. (or at least, it doesn't *matter* if it does) | ||
141 | */ | ||
142 | if (readb(&PktCmdP->RouteTopology[ThisLink].Unit) > (unsigned short) MAX_RUP) | ||
143 | continue; | ||
144 | |||
145 | for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) { | ||
146 | if ((readb(&PktCmdP->RouteTopology[ThisLink].Unit) == readb(&PktCmdP->RouteTopology[NewLink].Unit)) && (readb(&PktCmdP->RouteTopology[ThisLink].Link) == readb(&PktCmdP->RouteTopology[NewLink].Link))) { | ||
147 | Lies++; | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | |||
152 | if (Lies) { | ||
153 | rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies); | ||
154 | rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", | ||
155 | readb(&PktCmdP->RouteTopology[0].Unit), | ||
156 | 'A' + readb(&PktCmdP->RouteTopology[0].Link), | ||
157 | readb(&PktCmdP->RouteTopology[1].Unit), | ||
158 | 'A' + readb(&PktCmdP->RouteTopology[1].Link), readb(&PktCmdP->RouteTopology[2].Unit), 'A' + readb(&PktCmdP->RouteTopology[2].Link), readb(&PktCmdP->RouteTopology[3].Unit), 'A' + readb(&PktCmdP->RouteTopology[3].Link)); | ||
159 | return 1; | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | ** now, process each link. | ||
164 | */ | ||
165 | for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) { | ||
166 | /* | ||
167 | ** this is what it was connected to | ||
168 | */ | ||
169 | OldUnit = TopP[ThisLink].Unit; | ||
170 | OldLink = TopP[ThisLink].Link; | ||
171 | |||
172 | /* | ||
173 | ** this is what it is now connected to | ||
174 | */ | ||
175 | NewUnit = readb(&PktCmdP->RouteTopology[ThisLink].Unit); | ||
176 | NewLink = readb(&PktCmdP->RouteTopology[ThisLink].Link); | ||
177 | |||
178 | if (OldUnit != NewUnit || OldLink != NewLink) { | ||
179 | /* | ||
180 | ** something has changed! | ||
181 | */ | ||
182 | |||
183 | if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT) { | ||
184 | rio_dprintk(RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", MyType, MyName, NewUnit, NewLink); | ||
185 | } else { | ||
186 | /* | ||
187 | ** put the new values in | ||
188 | */ | ||
189 | TopP[ThisLink].Unit = NewUnit; | ||
190 | TopP[ThisLink].Link = NewLink; | ||
191 | |||
192 | RIOSetChange(p); | ||
193 | |||
194 | if (OldUnit <= MAX_RUP) { | ||
195 | /* | ||
196 | ** If something has become bust, then re-enable them messages | ||
197 | */ | ||
198 | if (!p->RIONoMessage) | ||
199 | RIOConCon(p, HostP, ThisUnit, ThisLink, OldUnit, OldLink, DISCONNECT); | ||
200 | } | ||
201 | |||
202 | if ((NewUnit <= MAX_RUP) && !p->RIONoMessage) | ||
203 | RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT); | ||
204 | |||
205 | if (NewUnit == ROUTE_NO_ID) | ||
206 | rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink); | ||
207 | |||
208 | if (NewUnit == ROUTE_INTERCONNECT) { | ||
209 | if (!p->RIONoMessage) | ||
210 | printk(KERN_DEBUG "rio: %s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | ** perform an update for 'the other end', so that these messages | ||
215 | ** only appears once. Only disconnect the other end if it is pointing | ||
216 | ** at us! | ||
217 | */ | ||
218 | if (OldUnit == HOST_ID) { | ||
219 | if (HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink) { | ||
220 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink + 'A'); | ||
221 | HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
222 | HostP->Topology[OldLink].Link = NO_LINK; | ||
223 | } else { | ||
224 | rio_dprintk(RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A'); | ||
225 | } | ||
226 | } else if (OldUnit <= MAX_RUP) { | ||
227 | if (HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit - 1].Topology[OldLink].Link == ThisLink) { | ||
228 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A'); | ||
229 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
230 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Link = NO_LINK; | ||
231 | } else { | ||
232 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A'); | ||
233 | } | ||
234 | } | ||
235 | if (NewUnit == HOST_ID) { | ||
236 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", NewLink + 'A', MyName, ThisLink + 'A'); | ||
237 | HostP->Topology[NewLink].Unit = ThisUnit; | ||
238 | HostP->Topology[NewLink].Link = ThisLink; | ||
239 | } else if (NewUnit <= MAX_RUP) { | ||
240 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Name, NewLink + 'A', MyName, ThisLink + 'A'); | ||
241 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Unit = ThisUnit; | ||
242 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink; | ||
243 | } | ||
244 | } | ||
245 | RIOSetChange(p); | ||
246 | RIOCheckIsolated(p, HostP, OldUnit); | ||
247 | } | ||
248 | } | ||
249 | return 1; | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | ** The only other command we recognise is a route_request command | ||
254 | */ | ||
255 | if (readb(&PktCmdP->Command) != ROUTE_REQUEST) { | ||
256 | rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %p ROUTE_RUP\n", readb(&PktCmdP->Command), Rup, HostP); | ||
257 | return 1; | ||
258 | } | ||
259 | |||
260 | RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24); | ||
261 | |||
262 | /* | ||
263 | ** Determine if 8 or 16 port RTA | ||
264 | */ | ||
265 | RtaType = GetUnitType(RtaUniq); | ||
266 | |||
267 | rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); | ||
268 | |||
269 | Mod = readb(&PktCmdP->ModuleTypes); | ||
270 | Mod1 = LONYBLE(Mod); | ||
271 | if (RtaType == TYPE_RTA16) { | ||
272 | /* | ||
273 | ** Only one ident is set for a 16 port RTA. To make compatible | ||
274 | ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. | ||
275 | */ | ||
276 | Mod2 = Mod1; | ||
277 | rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name); | ||
278 | } else { | ||
279 | Mod2 = HINYBLE(Mod); | ||
280 | rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | ** try to unhook a command block from the command free list. | ||
285 | */ | ||
286 | if (!(CmdBlkP = RIOGetCmdBlk())) { | ||
287 | rio_dprintk(RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); | ||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | /* | ||
292 | ** Fill in the default info on the command block | ||
293 | */ | ||
294 | CmdBlkP->Packet.dest_unit = Rup; | ||
295 | CmdBlkP->Packet.dest_port = ROUTE_RUP; | ||
296 | CmdBlkP->Packet.src_unit = HOST_ID; | ||
297 | CmdBlkP->Packet.src_port = ROUTE_RUP; | ||
298 | CmdBlkP->Packet.len = PKT_CMD_BIT | 1; | ||
299 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
300 | PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data; | ||
301 | |||
302 | if (!RIOBootOk(p, HostP, RtaUniq)) { | ||
303 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq); | ||
304 | PktReplyP->Command = ROUTE_FOAD; | ||
305 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); | ||
306 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
307 | return 1; | ||
308 | } | ||
309 | |||
310 | /* | ||
311 | ** Check to see if the RTA is configured for this host | ||
312 | */ | ||
313 | for (ThisUnit = 0; ThisUnit < MAX_RUP; ThisUnit++) { | ||
314 | rio_dprintk(RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", | ||
315 | ThisUnit, HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? "Slot-In-Use" : "Not In Use", HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? "Slot-Tentative" : "Not Tentative", HostP->Mapping[ThisUnit].RtaUniqueNum); | ||
316 | |||
317 | /* | ||
318 | ** We have an entry for it. | ||
319 | */ | ||
320 | if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) { | ||
321 | if (RtaType == TYPE_RTA16) { | ||
322 | ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; | ||
323 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2); | ||
324 | } else | ||
325 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", RtaUniq, ThisUnit); | ||
326 | /* | ||
327 | ** If we have no knowledge of booting it, then the host has | ||
328 | ** been re-booted, and so we must kill the RTA, so that it | ||
329 | ** will be booted again (potentially with new bins) | ||
330 | ** and it will then re-ask for an ID, which we will service. | ||
331 | */ | ||
332 | if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) { | ||
333 | if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) { | ||
334 | if (!p->RIONoMessage) | ||
335 | printk(KERN_DEBUG "rio: RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); | ||
336 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; | ||
337 | } | ||
338 | PktReplyP->Command = ROUTE_FOAD; | ||
339 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); | ||
340 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
341 | return 1; | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | ** Send the ID (entry) to this RTA. The ID number is implicit as | ||
346 | ** the offset into the table. It is worth noting at this stage | ||
347 | ** that offset zero in the table contains the entries for the | ||
348 | ** RTA with ID 1!!!! | ||
349 | */ | ||
350 | PktReplyP->Command = ROUTE_ALLOCATE; | ||
351 | PktReplyP->IDNum = ThisUnit + 1; | ||
352 | if (RtaType == TYPE_RTA16) { | ||
353 | if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) | ||
354 | /* | ||
355 | ** Adjust the phb and tx pkt dest_units for 2nd block of 8 | ||
356 | ** only if the RTA has ports associated (SLOT_IN_USE) | ||
357 | */ | ||
358 | RIOFixPhbs(p, HostP, ThisUnit2); | ||
359 | PktReplyP->IDNum2 = ThisUnit2 + 1; | ||
360 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); | ||
361 | } else { | ||
362 | PktReplyP->IDNum2 = ROUTE_NO_ID; | ||
363 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum); | ||
364 | } | ||
365 | memcpy(PktReplyP->CommandText, "RT_ALLOCAT", 10); | ||
366 | |||
367 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
368 | |||
369 | /* | ||
370 | ** If this is a freshly booted RTA, then we need to re-open | ||
371 | ** the ports, if any where open, so that data may once more | ||
372 | ** flow around the system! | ||
373 | */ | ||
374 | if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) { | ||
375 | /* | ||
376 | ** look at the ports associated with this beast and | ||
377 | ** see if any where open. If they was, then re-open | ||
378 | ** them, using the info from the tty flags. | ||
379 | */ | ||
380 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
381 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]; | ||
382 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
383 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
384 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
385 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
386 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
387 | } | ||
388 | } | ||
389 | if (RtaType == TYPE_RTA16) { | ||
390 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
391 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]; | ||
392 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
393 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
394 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
395 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
396 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
397 | } | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | |||
402 | /* | ||
403 | ** keep a copy of the module types! | ||
404 | */ | ||
405 | HostP->UnixRups[ThisUnit].ModTypes = Mod; | ||
406 | if (RtaType == TYPE_RTA16) | ||
407 | HostP->UnixRups[ThisUnit2].ModTypes = Mod; | ||
408 | |||
409 | /* | ||
410 | ** If either of the modules on this unit is read-only or write-only | ||
411 | ** or none-xprint, then we need to transfer that info over to the | ||
412 | ** relevant ports. | ||
413 | */ | ||
414 | if (HostP->Mapping[ThisUnit].SysPort != NO_PORT) { | ||
415 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
416 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
417 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
418 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
419 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
420 | } | ||
421 | if (RtaType == TYPE_RTA16) { | ||
422 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
423 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
424 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
425 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
426 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
431 | /* | ||
432 | ** Job done, get on with the interrupts! | ||
433 | */ | ||
434 | return 1; | ||
435 | } | ||
436 | } | ||
437 | /* | ||
438 | ** There is no table entry for this RTA at all. | ||
439 | ** | ||
440 | ** Lets check to see if we actually booted this unit - if not, | ||
441 | ** then we reset it and it will go round the loop of being booted | ||
442 | ** we can then worry about trying to fit it into the table. | ||
443 | */ | ||
444 | for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++) | ||
445 | if (HostP->ExtraUnits[ThisUnit] == RtaUniq) | ||
446 | break; | ||
447 | if (ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS) { | ||
448 | /* | ||
449 | ** if the unit wasn't in the table, and the table wasn't full, then | ||
450 | ** we reset the unit, because we didn't boot it. | ||
451 | ** However, if the table is full, it could be that we did boot | ||
452 | ** this unit, and so we won't reboot it, because it isn't really | ||
453 | ** all that disasterous to keep the old bins in most cases. This | ||
454 | ** is a rather tacky feature, but we are on the edge of reallity | ||
455 | ** here, because the implication is that someone has connected | ||
456 | ** 16+MAX_EXTRA_UNITS onto one host. | ||
457 | */ | ||
458 | static int UnknownMesgDone = 0; | ||
459 | |||
460 | if (!UnknownMesgDone) { | ||
461 | if (!p->RIONoMessage) | ||
462 | printk(KERN_DEBUG "rio: One or more unknown RTAs are being updated.\n"); | ||
463 | UnknownMesgDone = 1; | ||
464 | } | ||
465 | |||
466 | PktReplyP->Command = ROUTE_FOAD; | ||
467 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); | ||
468 | } else { | ||
469 | /* | ||
470 | ** we did boot it (as an extra), and there may now be a table | ||
471 | ** slot free (because of a delete), so we will try to make | ||
472 | ** a tentative entry for it, so that the configurator can see it | ||
473 | ** and fill in the details for us. | ||
474 | */ | ||
475 | if (RtaType == TYPE_RTA16) { | ||
476 | if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) { | ||
477 | RIODefaultName(p, HostP, ThisUnit); | ||
478 | rio_fill_host_slot(ThisUnit, ThisUnit2, RtaUniq, HostP); | ||
479 | } | ||
480 | } else { | ||
481 | if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) { | ||
482 | RIODefaultName(p, HostP, ThisUnit); | ||
483 | rio_fill_host_slot(ThisUnit, 0, RtaUniq, HostP); | ||
484 | } | ||
485 | } | ||
486 | PktReplyP->Command = ROUTE_USED; | ||
487 | memcpy(PktReplyP->CommandText, "RT_USED", 7); | ||
488 | } | ||
489 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
490 | return 1; | ||
491 | } | ||
492 | |||
493 | |||
494 | void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit) | ||
495 | { | ||
496 | unsigned short link, port; | ||
497 | struct Port *PortP; | ||
498 | unsigned long flags; | ||
499 | int PortN = HostP->Mapping[unit].SysPort; | ||
500 | |||
501 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); | ||
502 | |||
503 | if (PortN != -1) { | ||
504 | unsigned short dest_unit = HostP->Mapping[unit].ID2; | ||
505 | |||
506 | /* | ||
507 | ** Get the link number used for the 1st 8 phbs on this unit. | ||
508 | */ | ||
509 | PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; | ||
510 | |||
511 | link = readw(&PortP->PhbP->link); | ||
512 | |||
513 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { | ||
514 | unsigned short dest_port = port + 8; | ||
515 | u16 __iomem *TxPktP; | ||
516 | struct PKT __iomem *Pkt; | ||
517 | |||
518 | PortP = p->RIOPortp[PortN]; | ||
519 | |||
520 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
521 | /* | ||
522 | ** If RTA is not powered on, the tx packets will be | ||
523 | ** unset, so go no further. | ||
524 | */ | ||
525 | if (!PortP->TxStart) { | ||
526 | rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); | ||
527 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
528 | break; | ||
529 | } | ||
530 | |||
531 | /* | ||
532 | ** For the second slot of a 16 port RTA, the driver needs to | ||
533 | ** sort out the phb to port mappings. The dest_unit for this | ||
534 | ** group of 8 phbs is set to the dest_unit of the accompanying | ||
535 | ** 8 port block. The dest_port of the second unit is set to | ||
536 | ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port | ||
537 | ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6 | ||
538 | ** (being the second map ID) will be sent to dest_unit 5, port | ||
539 | ** 14. When this RTA is deleted, dest_unit for ID 6 will be | ||
540 | ** restored, and the dest_port will be reduced by 8. | ||
541 | ** Transmit packets also have a destination field which needs | ||
542 | ** adjusting in the same manner. | ||
543 | ** Note that the unit/port bytes in 'dest' are swapped. | ||
544 | ** We also need to adjust the phb and rup link numbers for the | ||
545 | ** second block of 8 ttys. | ||
546 | */ | ||
547 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { | ||
548 | /* | ||
549 | ** *TxPktP is the pointer to the transmit packet on the host | ||
550 | ** card. This needs to be translated into a 32 bit pointer | ||
551 | ** so it can be accessed from the driver. | ||
552 | */ | ||
553 | Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(TxPktP)); | ||
554 | |||
555 | /* | ||
556 | ** If the packet is used, reset it. | ||
557 | */ | ||
558 | Pkt = (struct PKT __iomem *) ((unsigned long) Pkt & ~PKT_IN_USE); | ||
559 | writeb(dest_unit, &Pkt->dest_unit); | ||
560 | writeb(dest_port, &Pkt->dest_port); | ||
561 | } | ||
562 | rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", readw(&PortP->PhbP->destination) & 0xff, (readw(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); | ||
563 | writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); | ||
564 | writew(link, &PortP->PhbP->link); | ||
565 | |||
566 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
567 | } | ||
568 | /* | ||
569 | ** Now make sure the range of ports to be serviced includes | ||
570 | ** the 2nd 8 on this 16 port RTA. | ||
571 | */ | ||
572 | if (link > 3) | ||
573 | return; | ||
574 | if (((unit * 8) + 7) > readw(&HostP->LinkStrP[link].last_port)) { | ||
575 | rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); | ||
576 | writew((unit * 8) + 7, &HostP->LinkStrP[link].last_port); | ||
577 | } | ||
578 | } | ||
579 | } | ||
580 | |||
581 | /* | ||
582 | ** Check to see if the new disconnection has isolated this unit. | ||
583 | ** If it has, then invalidate all its link information, and tell | ||
584 | ** the world about it. This is done to ensure that the configurator | ||
585 | ** only gets up-to-date information about what is going on. | ||
586 | */ | ||
587 | static int RIOCheckIsolated(struct rio_info *p, struct Host *HostP, unsigned int UnitId) | ||
588 | { | ||
589 | unsigned long flags; | ||
590 | rio_spin_lock_irqsave(&HostP->HostLock, flags); | ||
591 | |||
592 | if (RIOCheck(HostP, UnitId)) { | ||
593 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); | ||
594 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | ||
595 | return (0); | ||
596 | } | ||
597 | |||
598 | RIOIsolate(p, HostP, UnitId); | ||
599 | RIOSetChange(p); | ||
600 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | ||
601 | return 1; | ||
602 | } | ||
603 | |||
604 | /* | ||
605 | ** Invalidate all the link interconnectivity of this unit, and of | ||
606 | ** all the units attached to it. This will mean that the entire | ||
607 | ** subnet will re-introduce itself. | ||
608 | */ | ||
609 | static int RIOIsolate(struct rio_info *p, struct Host *HostP, unsigned int UnitId) | ||
610 | { | ||
611 | unsigned int link, unit; | ||
612 | |||
613 | UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ | ||
614 | |||
615 | if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ | ||
616 | return (0); | ||
617 | |||
618 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) | ||
619 | return (0); | ||
620 | |||
621 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | ||
622 | |||
623 | if (p->RIOPrintDisabled == DO_PRINT) | ||
624 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); | ||
625 | |||
626 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
627 | unit = HostP->Mapping[UnitId].Topology[link].Unit; | ||
628 | HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; | ||
629 | HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; | ||
630 | RIOIsolate(p, HostP, unit); | ||
631 | } | ||
632 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | ||
633 | return 1; | ||
634 | } | ||
635 | |||
636 | static int RIOCheck(struct Host *HostP, unsigned int UnitId) | ||
637 | { | ||
638 | unsigned char link; | ||
639 | |||
640 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ | ||
641 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); | ||
642 | |||
643 | if (UnitId == HOST_ID) { | ||
644 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ | ||
645 | return 1; | ||
646 | } | ||
647 | |||
648 | UnitId--; | ||
649 | |||
650 | if (UnitId >= MAX_RUP) { | ||
651 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ | ||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
656 | if (HostP->Mapping[UnitId].Topology[link].Unit == HOST_ID) { | ||
657 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", | ||
658 | UnitId, 'A'+link)); */ | ||
659 | return 1; | ||
660 | } | ||
661 | } | ||
662 | |||
663 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) { | ||
664 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ | ||
665 | return 0; | ||
666 | } | ||
667 | |||
668 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | ||
669 | |||
670 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
671 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ | ||
672 | if (RIOCheck(HostP, HostP->Mapping[UnitId].Topology[link].Unit)) { | ||
673 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ | ||
674 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | ||
675 | return 1; | ||
676 | } | ||
677 | } | ||
678 | |||
679 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | ||
680 | |||
681 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */ | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | /* | ||
687 | ** Returns the type of unit (host, 16/8 port RTA) | ||
688 | */ | ||
689 | |||
690 | unsigned int GetUnitType(unsigned int Uniq) | ||
691 | { | ||
692 | switch ((Uniq >> 28) & 0xf) { | ||
693 | case RIO_AT: | ||
694 | case RIO_MCA: | ||
695 | case RIO_EISA: | ||
696 | case RIO_PCI: | ||
697 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Host\n"); | ||
698 | return (TYPE_HOST); | ||
699 | case RIO_RTA_16: | ||
700 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); | ||
701 | return (TYPE_RTA16); | ||
702 | case RIO_RTA: | ||
703 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); | ||
704 | return (TYPE_RTA8); | ||
705 | default: | ||
706 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); | ||
707 | return (99); | ||
708 | } | ||
709 | } | ||
710 | |||
711 | int RIOSetChange(struct rio_info *p) | ||
712 | { | ||
713 | if (p->RIOQuickCheck != NOT_CHANGED) | ||
714 | return (0); | ||
715 | p->RIOQuickCheck = CHANGED; | ||
716 | if (p->RIOSignalProcess) { | ||
717 | rio_dprintk(RIO_DEBUG_ROUTE, "Send SIG-HUP"); | ||
718 | /* | ||
719 | psignal( RIOSignalProcess, SIGHUP ); | ||
720 | */ | ||
721 | } | ||
722 | return (0); | ||
723 | } | ||
724 | |||
725 | static void RIOConCon(struct rio_info *p, | ||
726 | struct Host *HostP, | ||
727 | unsigned int FromId, | ||
728 | unsigned int FromLink, | ||
729 | unsigned int ToId, | ||
730 | unsigned int ToLink, | ||
731 | int Change) | ||
732 | { | ||
733 | char *FromName; | ||
734 | char *FromType; | ||
735 | char *ToName; | ||
736 | char *ToType; | ||
737 | unsigned int tp; | ||
738 | |||
739 | /* | ||
740 | ** 15.10.1998 ARG - ESIL 0759 | ||
741 | ** (Part) fix for port being trashed when opened whilst RTA "disconnected" | ||
742 | ** | ||
743 | ** What's this doing in here anyway ? | ||
744 | ** It was causing the port to be 'unmapped' if opened whilst RTA "disconnected" | ||
745 | ** | ||
746 | ** 09.12.1998 ARG - ESIL 0776 - part fix | ||
747 | ** Okay, We've found out what this was all about now ! | ||
748 | ** Someone had botched this to use RIOHalted to indicated the number of RTAs | ||
749 | ** 'disconnected'. The value in RIOHalted was then being used in the | ||
750 | ** 'RIO_QUICK_CHECK' ioctl. A none zero value indicating that a least one RTA | ||
751 | ** is 'disconnected'. The change was put in to satisfy a customer's needs. | ||
752 | ** Having taken this bit of code out 'RIO_QUICK_CHECK' now no longer works for | ||
753 | ** the customer. | ||
754 | ** | ||
755 | if (Change == CONNECT) { | ||
756 | if (p->RIOHalted) p->RIOHalted --; | ||
757 | } | ||
758 | else { | ||
759 | p->RIOHalted ++; | ||
760 | } | ||
761 | ** | ||
762 | ** So - we need to implement it slightly differently - a new member of the | ||
763 | ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA | ||
764 | ** connections and disconnections. | ||
765 | */ | ||
766 | if (Change == CONNECT) { | ||
767 | if (p->RIORtaDisCons) | ||
768 | p->RIORtaDisCons--; | ||
769 | } else { | ||
770 | p->RIORtaDisCons++; | ||
771 | } | ||
772 | |||
773 | if (p->RIOPrintDisabled == DONT_PRINT) | ||
774 | return; | ||
775 | |||
776 | if (FromId > ToId) { | ||
777 | tp = FromId; | ||
778 | FromId = ToId; | ||
779 | ToId = tp; | ||
780 | tp = FromLink; | ||
781 | FromLink = ToLink; | ||
782 | ToLink = tp; | ||
783 | } | ||
784 | |||
785 | FromName = FromId ? HostP->Mapping[FromId - 1].Name : HostP->Name; | ||
786 | FromType = FromId ? "RTA" : "HOST"; | ||
787 | ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name; | ||
788 | ToType = ToId ? "RTA" : "HOST"; | ||
789 | |||
790 | rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); | ||
791 | printk(KERN_DEBUG "rio: Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); | ||
792 | } | ||
793 | |||
794 | /* | ||
795 | ** RIORemoveFromSavedTable : | ||
796 | ** | ||
797 | ** Delete and RTA entry from the saved table given to us | ||
798 | ** by the configuration program. | ||
799 | */ | ||
800 | static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) | ||
801 | { | ||
802 | int entry; | ||
803 | |||
804 | /* | ||
805 | ** We loop for all entries even after finding an entry and | ||
806 | ** zeroing it because we may have two entries to delete if | ||
807 | ** it's a 16 port RTA. | ||
808 | */ | ||
809 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { | ||
810 | if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { | ||
811 | memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map)); | ||
812 | } | ||
813 | } | ||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | |||
818 | /* | ||
819 | ** RIOCheckDisconnected : | ||
820 | ** | ||
821 | ** Scan the unit links to and return zero if the unit is completely | ||
822 | ** disconnected. | ||
823 | */ | ||
824 | static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) | ||
825 | { | ||
826 | int link; | ||
827 | |||
828 | |||
829 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); | ||
830 | /* | ||
831 | ** If the slot is tentative and does not belong to the | ||
832 | ** second half of a 16 port RTA then scan to see if | ||
833 | ** is disconnected. | ||
834 | */ | ||
835 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
836 | if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) | ||
837 | break; | ||
838 | } | ||
839 | |||
840 | /* | ||
841 | ** If not all links are disconnected then we can forget about it. | ||
842 | */ | ||
843 | if (link < LINKS_PER_UNIT) | ||
844 | return 1; | ||
845 | |||
846 | #ifdef NEED_TO_FIX_THIS | ||
847 | /* Ok so all the links are disconnected. But we may have only just | ||
848 | ** made this slot tentative and not yet received a topology update. | ||
849 | ** Lets check how long ago we made it tentative. | ||
850 | */ | ||
851 | rio_dprintk(RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); | ||
852 | if (drv_getparm(LBOLT, (ulong_t *) & current_time)) | ||
853 | rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); | ||
854 | |||
855 | elapse_time = current_time - TentTime[unit]; | ||
856 | rio_dprintk(RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); | ||
857 | if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) { | ||
858 | rio_dprintk(RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", unit, drv_hztousec(elapse_time)); | ||
859 | return 1; | ||
860 | } | ||
861 | #endif | ||
862 | |||
863 | /* | ||
864 | ** We have found an usable slot. | ||
865 | ** If it is half of a 16 port RTA then delete the other half. | ||
866 | */ | ||
867 | if (HostP->Mapping[unit].ID2 != 0) { | ||
868 | int nOther = (HostP->Mapping[unit].ID2) - 1; | ||
869 | |||
870 | rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); | ||
871 | memset(&HostP->Mapping[nOther], 0, sizeof(struct Map)); | ||
872 | } | ||
873 | RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); | ||
874 | |||
875 | return 0; | ||
876 | } | ||
877 | |||
878 | |||
879 | /* | ||
880 | ** RIOFindFreeID : | ||
881 | ** | ||
882 | ** This function scans the given host table for either one | ||
883 | ** or two free unit ID's. | ||
884 | */ | ||
885 | |||
886 | int RIOFindFreeID(struct rio_info *p, struct Host *HostP, unsigned int * pID1, unsigned int * pID2) | ||
887 | { | ||
888 | int unit, tempID; | ||
889 | |||
890 | /* | ||
891 | ** Initialise the ID's to MAX_RUP. | ||
892 | ** We do this to make the loop for setting the ID's as simple as | ||
893 | ** possible. | ||
894 | */ | ||
895 | *pID1 = MAX_RUP; | ||
896 | if (pID2 != NULL) | ||
897 | *pID2 = MAX_RUP; | ||
898 | |||
899 | /* | ||
900 | ** Scan all entries of the host mapping table for free slots. | ||
901 | ** We scan for free slots first and then if that is not successful | ||
902 | ** we start all over again looking for tentative slots we can re-use. | ||
903 | */ | ||
904 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
905 | rio_dprintk(RIO_DEBUG_ROUTE, "Scanning unit %d\n", unit); | ||
906 | /* | ||
907 | ** If the flags are zero then the slot is empty. | ||
908 | */ | ||
909 | if (HostP->Mapping[unit].Flags == 0) { | ||
910 | rio_dprintk(RIO_DEBUG_ROUTE, " This slot is empty.\n"); | ||
911 | /* | ||
912 | ** If we haven't allocated the first ID then do it now. | ||
913 | */ | ||
914 | if (*pID1 == MAX_RUP) { | ||
915 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); | ||
916 | *pID1 = unit; | ||
917 | |||
918 | /* | ||
919 | ** If the second ID is not needed then we can return | ||
920 | ** now. | ||
921 | */ | ||
922 | if (pID2 == NULL) | ||
923 | return 0; | ||
924 | } else { | ||
925 | /* | ||
926 | ** Allocate the second slot and return. | ||
927 | */ | ||
928 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); | ||
929 | *pID2 = unit; | ||
930 | return 0; | ||
931 | } | ||
932 | } | ||
933 | } | ||
934 | |||
935 | /* | ||
936 | ** If we manage to come out of the free slot loop then we | ||
937 | ** need to start all over again looking for tentative slots | ||
938 | ** that we can re-use. | ||
939 | */ | ||
940 | rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); | ||
941 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
942 | if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && !(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT)) { | ||
943 | rio_dprintk(RIO_DEBUG_ROUTE, " Slot %d looks promising.\n", unit); | ||
944 | |||
945 | if (unit == *pID1) { | ||
946 | rio_dprintk(RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); | ||
947 | continue; | ||
948 | } | ||
949 | |||
950 | /* | ||
951 | ** Slot is Tentative or Empty, but not a tentative second | ||
952 | ** slot of a 16 porter. | ||
953 | ** Attempt to free up this slot (and its parnter if | ||
954 | ** it is a 16 port slot. The second slot will become | ||
955 | ** empty after a call to RIOFreeDisconnected so thats why | ||
956 | ** we look for empty slots above as well). | ||
957 | */ | ||
958 | if (HostP->Mapping[unit].Flags != 0) | ||
959 | if (RIOFreeDisconnected(p, HostP, unit) != 0) | ||
960 | continue; | ||
961 | /* | ||
962 | ** If we haven't allocated the first ID then do it now. | ||
963 | */ | ||
964 | if (*pID1 == MAX_RUP) { | ||
965 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); | ||
966 | *pID1 = unit; | ||
967 | |||
968 | /* | ||
969 | ** Clear out this slot now that we intend to use it. | ||
970 | */ | ||
971 | memset(&HostP->Mapping[unit], 0, sizeof(struct Map)); | ||
972 | |||
973 | /* | ||
974 | ** If the second ID is not needed then we can return | ||
975 | ** now. | ||
976 | */ | ||
977 | if (pID2 == NULL) | ||
978 | return 0; | ||
979 | } else { | ||
980 | /* | ||
981 | ** Allocate the second slot and return. | ||
982 | */ | ||
983 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", unit); | ||
984 | *pID2 = unit; | ||
985 | |||
986 | /* | ||
987 | ** Clear out this slot now that we intend to use it. | ||
988 | */ | ||
989 | memset(&HostP->Mapping[unit], 0, sizeof(struct Map)); | ||
990 | |||
991 | /* At this point under the right(wrong?) conditions | ||
992 | ** we may have a first unit ID being higher than the | ||
993 | ** second unit ID. This is a bad idea if we are about | ||
994 | ** to fill the slots with a 16 port RTA. | ||
995 | ** Better check and swap them over. | ||
996 | */ | ||
997 | |||
998 | if (*pID1 > *pID2) { | ||
999 | rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); | ||
1000 | tempID = *pID1; | ||
1001 | *pID1 = *pID2; | ||
1002 | *pID2 = tempID; | ||
1003 | } | ||
1004 | return 0; | ||
1005 | } | ||
1006 | } | ||
1007 | } | ||
1008 | |||
1009 | /* | ||
1010 | ** If we manage to get to the end of the second loop then we | ||
1011 | ** can give up and return a failure. | ||
1012 | */ | ||
1013 | return 1; | ||
1014 | } | ||
1015 | |||
1016 | |||
1017 | /* | ||
1018 | ** The link switch scenario. | ||
1019 | ** | ||
1020 | ** Rta Wun (A) is connected to Tuw (A). | ||
1021 | ** The tables are all up to date, and the system is OK. | ||
1022 | ** | ||
1023 | ** If Wun (A) is now moved to Wun (B) before Wun (A) can | ||
1024 | ** become disconnected, then the follow happens: | ||
1025 | ** | ||
1026 | ** Tuw (A) spots the change of unit:link at the other end | ||
1027 | ** of its link and Tuw sends a topology packet reflecting | ||
1028 | ** the change: Tuw (A) now disconnected from Wun (A), and | ||
1029 | ** this is closely followed by a packet indicating that | ||
1030 | ** Tuw (A) is now connected to Wun (B). | ||
1031 | ** | ||
1032 | ** Wun (B) will spot that it has now become connected, and | ||
1033 | ** Wun will send a topology packet, which indicates that | ||
1034 | ** both Wun (A) and Wun (B) is connected to Tuw (A). | ||
1035 | ** | ||
1036 | ** Eventually Wun (A) realises that it is now disconnected | ||
1037 | ** and Wun will send out a topology packet indicating that | ||
1038 | ** Wun (A) is now disconnected. | ||
1039 | */ | ||
diff --git a/drivers/char/rio/riospace.h b/drivers/char/rio/riospace.h deleted file mode 100644 index ffb31d4332b9..000000000000 --- a/drivers/char/rio/riospace.h +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : riospace.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:13 | ||
26 | ** Retrieved : 11/6/98 11:34:22 | ||
27 | ** | ||
28 | ** ident @(#)riospace.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_riospace_h__ | ||
34 | #define __rio_riospace_h__ | ||
35 | |||
36 | #define RIO_LOCATOR_LEN 16 | ||
37 | #define MAX_RIO_BOARDS 4 | ||
38 | |||
39 | /* | ||
40 | ** DONT change this file. At all. Unless you can rebuild the entire | ||
41 | ** device driver, which you probably can't, then the rest of the | ||
42 | ** driver won't see any changes you make here. So don't make any. | ||
43 | ** In particular, it won't be able to see changes to RIO_SLOTS | ||
44 | */ | ||
45 | |||
46 | struct Conf { | ||
47 | char Locator[24]; | ||
48 | unsigned int StartupTime; | ||
49 | unsigned int SlowCook; | ||
50 | unsigned int IntrPollTime; | ||
51 | unsigned int BreakInterval; | ||
52 | unsigned int Timer; | ||
53 | unsigned int RtaLoadBase; | ||
54 | unsigned int HostLoadBase; | ||
55 | unsigned int XpHz; | ||
56 | unsigned int XpCps; | ||
57 | char *XpOn; | ||
58 | char *XpOff; | ||
59 | unsigned int MaxXpCps; | ||
60 | unsigned int MinXpCps; | ||
61 | unsigned int SpinCmds; | ||
62 | unsigned int FirstAddr; | ||
63 | unsigned int LastAddr; | ||
64 | unsigned int BufferSize; | ||
65 | unsigned int LowWater; | ||
66 | unsigned int LineLength; | ||
67 | unsigned int CmdTime; | ||
68 | }; | ||
69 | |||
70 | /* | ||
71 | ** Board types - these MUST correspond to product codes! | ||
72 | */ | ||
73 | #define RIO_EMPTY 0x0 | ||
74 | #define RIO_EISA 0x3 | ||
75 | #define RIO_RTA_16 0x9 | ||
76 | #define RIO_AT 0xA | ||
77 | #define RIO_MCA 0xB | ||
78 | #define RIO_PCI 0xD | ||
79 | #define RIO_RTA 0xE | ||
80 | |||
81 | /* | ||
82 | ** Board data structure. This is used for configuration info | ||
83 | */ | ||
84 | struct Brd { | ||
85 | unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ | ||
86 | unsigned char Ivec; /* POLLED or ivec number */ | ||
87 | unsigned char Mode; /* Control stuff, see below */ | ||
88 | }; | ||
89 | |||
90 | struct Board { | ||
91 | char Locator[RIO_LOCATOR_LEN]; | ||
92 | int NumSlots; | ||
93 | struct Brd Boards[MAX_RIO_BOARDS]; | ||
94 | }; | ||
95 | |||
96 | #define BOOT_FROM_LINK 0x00 | ||
97 | #define BOOT_FROM_RAM 0x01 | ||
98 | #define EXTERNAL_BUS_OFF 0x00 | ||
99 | #define EXTERNAL_BUS_ON 0x02 | ||
100 | #define INTERRUPT_DISABLE 0x00 | ||
101 | #define INTERRUPT_ENABLE 0x04 | ||
102 | #define BYTE_OPERATION 0x00 | ||
103 | #define WORD_OPERATION 0x08 | ||
104 | #define POLLED INTERRUPT_DISABLE | ||
105 | #define IRQ_15 (0x00 | INTERRUPT_ENABLE) | ||
106 | #define IRQ_12 (0x10 | INTERRUPT_ENABLE) | ||
107 | #define IRQ_11 (0x20 | INTERRUPT_ENABLE) | ||
108 | #define IRQ_9 (0x30 | INTERRUPT_ENABLE) | ||
109 | #define SLOW_LINKS 0x00 | ||
110 | #define FAST_LINKS 0x40 | ||
111 | #define SLOW_AT_BUS 0x00 | ||
112 | #define FAST_AT_BUS 0x80 | ||
113 | #define SLOW_PCI_TP 0x00 | ||
114 | #define FAST_PCI_TP 0x80 | ||
115 | /* | ||
116 | ** Debug levels | ||
117 | */ | ||
118 | #define DBG_NONE 0x00000000 | ||
119 | |||
120 | #define DBG_INIT 0x00000001 | ||
121 | #define DBG_OPEN 0x00000002 | ||
122 | #define DBG_CLOSE 0x00000004 | ||
123 | #define DBG_IOCTL 0x00000008 | ||
124 | |||
125 | #define DBG_READ 0x00000010 | ||
126 | #define DBG_WRITE 0x00000020 | ||
127 | #define DBG_INTR 0x00000040 | ||
128 | #define DBG_PROC 0x00000080 | ||
129 | |||
130 | #define DBG_PARAM 0x00000100 | ||
131 | #define DBG_CMD 0x00000200 | ||
132 | #define DBG_XPRINT 0x00000400 | ||
133 | #define DBG_POLL 0x00000800 | ||
134 | |||
135 | #define DBG_DAEMON 0x00001000 | ||
136 | #define DBG_FAIL 0x00002000 | ||
137 | #define DBG_MODEM 0x00004000 | ||
138 | #define DBG_LIST 0x00008000 | ||
139 | |||
140 | #define DBG_ROUTE 0x00010000 | ||
141 | #define DBG_UTIL 0x00020000 | ||
142 | #define DBG_BOOT 0x00040000 | ||
143 | #define DBG_BUFFER 0x00080000 | ||
144 | |||
145 | #define DBG_MON 0x00100000 | ||
146 | #define DBG_SPECIAL 0x00200000 | ||
147 | #define DBG_VPIX 0x00400000 | ||
148 | #define DBG_FLUSH 0x00800000 | ||
149 | |||
150 | #define DBG_QENABLE 0x01000000 | ||
151 | |||
152 | #define DBG_ALWAYS 0x80000000 | ||
153 | |||
154 | #endif /* __rio_riospace_h__ */ | ||
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c deleted file mode 100644 index 3d15802dc0f3..000000000000 --- a/drivers/char/rio/riotable.c +++ /dev/null | |||
@@ -1,941 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : riotable.c | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 10:33:47 | ||
26 | ** Retrieved : 11/6/98 10:33:50 | ||
27 | ** | ||
28 | ** ident @(#)riotable.c 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #include <linux/module.h> | ||
34 | #include <linux/slab.h> | ||
35 | #include <linux/errno.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/string.h> | ||
38 | |||
39 | #include <asm/io.h> | ||
40 | #include <asm/system.h> | ||
41 | #include <asm/string.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | #include <linux/termios.h> | ||
45 | #include <linux/serial.h> | ||
46 | |||
47 | #include <linux/generic_serial.h> | ||
48 | |||
49 | |||
50 | #include "linux_compat.h" | ||
51 | #include "rio_linux.h" | ||
52 | #include "pkt.h" | ||
53 | #include "daemon.h" | ||
54 | #include "rio.h" | ||
55 | #include "riospace.h" | ||
56 | #include "cmdpkt.h" | ||
57 | #include "map.h" | ||
58 | #include "rup.h" | ||
59 | #include "port.h" | ||
60 | #include "riodrvr.h" | ||
61 | #include "rioinfo.h" | ||
62 | #include "func.h" | ||
63 | #include "errors.h" | ||
64 | #include "pci.h" | ||
65 | |||
66 | #include "parmmap.h" | ||
67 | #include "unixrup.h" | ||
68 | #include "board.h" | ||
69 | #include "host.h" | ||
70 | #include "phb.h" | ||
71 | #include "link.h" | ||
72 | #include "cmdblk.h" | ||
73 | #include "route.h" | ||
74 | #include "cirrus.h" | ||
75 | #include "rioioctl.h" | ||
76 | #include "param.h" | ||
77 | #include "protsts.h" | ||
78 | |||
79 | /* | ||
80 | ** A configuration table has been loaded. It is now up to us | ||
81 | ** to sort it out and use the information contained therein. | ||
82 | */ | ||
83 | int RIONewTable(struct rio_info *p) | ||
84 | { | ||
85 | int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; | ||
86 | struct Map *MapP; | ||
87 | struct Map *HostMapP; | ||
88 | struct Host *HostP; | ||
89 | |||
90 | char *cptr; | ||
91 | |||
92 | /* | ||
93 | ** We have been sent a new table to install. We need to break | ||
94 | ** it down into little bits and spread it around a bit to see | ||
95 | ** what we have got. | ||
96 | */ | ||
97 | /* | ||
98 | ** Things to check: | ||
99 | ** (things marked 'xx' aren't checked any more!) | ||
100 | ** (1) That there are no booted Hosts/RTAs out there. | ||
101 | ** (2) That the names are properly formed | ||
102 | ** (3) That blank entries really are. | ||
103 | ** xx (4) That hosts mentioned in the table actually exist. xx | ||
104 | ** (5) That the IDs are unique (per host). | ||
105 | ** (6) That host IDs are zero | ||
106 | ** (7) That port numbers are valid | ||
107 | ** (8) That port numbers aren't duplicated | ||
108 | ** (9) That names aren't duplicated | ||
109 | ** xx (10) That hosts that actually exist are mentioned in the table. xx | ||
110 | */ | ||
111 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); | ||
112 | if (p->RIOSystemUp) { /* (1) */ | ||
113 | p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; | ||
114 | return -EBUSY; | ||
115 | } | ||
116 | |||
117 | p->RIOError.Error = NOTHING_WRONG_AT_ALL; | ||
118 | p->RIOError.Entry = -1; | ||
119 | p->RIOError.Other = -1; | ||
120 | |||
121 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { | ||
122 | MapP = &p->RIOConnectTable[Entry]; | ||
123 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { | ||
124 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); | ||
125 | cptr = MapP->Name; /* (2) */ | ||
126 | cptr[MAX_NAME_LEN - 1] = '\0'; | ||
127 | if (cptr[0] == '\0') { | ||
128 | memcpy(MapP->Name, MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", 8); | ||
129 | MapP->Name[5] = '0' + Entry / 10; | ||
130 | MapP->Name[6] = '0' + Entry % 10; | ||
131 | } | ||
132 | while (*cptr) { | ||
133 | if (*cptr < ' ' || *cptr > '~') { | ||
134 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | ||
135 | p->RIOError.Entry = Entry; | ||
136 | return -ENXIO; | ||
137 | } | ||
138 | cptr++; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | ** If the entry saved was a tentative entry then just forget | ||
144 | ** about it. | ||
145 | */ | ||
146 | if (MapP->Flags & SLOT_TENTATIVE) { | ||
147 | MapP->HostUniqueNum = 0; | ||
148 | MapP->RtaUniqueNum = 0; | ||
149 | continue; | ||
150 | } | ||
151 | |||
152 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); | ||
153 | if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */ | ||
154 | if (MapP->ID || MapP->SysPort || MapP->Flags) { | ||
155 | rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name); | ||
156 | p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; | ||
157 | p->RIOError.Entry = Entry; | ||
158 | return -ENXIO; | ||
159 | } | ||
160 | rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); | ||
161 | continue; | ||
162 | } | ||
163 | |||
164 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); | ||
165 | for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */ | ||
166 | if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) { | ||
167 | HostP = &p->RIOHosts[Host]; | ||
168 | /* | ||
169 | ** having done the lookup, we don't really want to do | ||
170 | ** it again, so hang the host number in a safe place | ||
171 | */ | ||
172 | MapP->Topology[0].Unit = Host; | ||
173 | break; | ||
174 | } | ||
175 | } | ||
176 | |||
177 | if (Host >= p->RIONumHosts) { | ||
178 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum); | ||
179 | MapP->HostUniqueNum = 0; | ||
180 | /* MapP->RtaUniqueNum = 0; */ | ||
181 | /* MapP->ID = 0; */ | ||
182 | /* MapP->Flags = 0; */ | ||
183 | /* MapP->SysPort = 0; */ | ||
184 | /* MapP->Name[0] = 0; */ | ||
185 | continue; | ||
186 | } | ||
187 | |||
188 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); | ||
189 | if (MapP->RtaUniqueNum) { /* (5) */ | ||
190 | if (!MapP->ID) { | ||
191 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name); | ||
192 | p->RIOError.Error = ZERO_RTA_ID; | ||
193 | p->RIOError.Entry = Entry; | ||
194 | return -ENXIO; | ||
195 | } | ||
196 | if (MapP->ID > MAX_RUP) { | ||
197 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID); | ||
198 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | ||
199 | p->RIOError.Entry = Entry; | ||
200 | return -ENXIO; | ||
201 | } | ||
202 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { | ||
203 | if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) { | ||
204 | rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name); | ||
205 | p->RIOError.Error = DUPLICATED_RTA_ID; | ||
206 | p->RIOError.Entry = Entry; | ||
207 | p->RIOError.Other = SubEnt; | ||
208 | return -ENXIO; | ||
209 | } | ||
210 | /* | ||
211 | ** If the RtaUniqueNum is the same, it may be looking at both | ||
212 | ** entries for a 16 port RTA, so check the ids | ||
213 | */ | ||
214 | if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum) | ||
215 | && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { | ||
216 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name); | ||
217 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name); | ||
218 | p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; | ||
219 | p->RIOError.Entry = Entry; | ||
220 | p->RIOError.Other = SubEnt; | ||
221 | return -ENXIO; | ||
222 | } | ||
223 | } | ||
224 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); | ||
225 | /* (7a) */ | ||
226 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { | ||
227 | 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); | ||
228 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | ||
229 | p->RIOError.Entry = Entry; | ||
230 | return -ENXIO; | ||
231 | } | ||
232 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); | ||
233 | /* (7b) */ | ||
234 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { | ||
235 | rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name); | ||
236 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | ||
237 | p->RIOError.Entry = Entry; | ||
238 | return -ENXIO; | ||
239 | } | ||
240 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { | ||
241 | if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT) | ||
242 | continue; | ||
243 | if (p->RIOConnectTable[SubEnt].RtaUniqueNum) { | ||
244 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); | ||
245 | /* (8) */ | ||
246 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) { | ||
247 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort); | ||
248 | p->RIOError.Error = TTY_NUMBER_IN_USE; | ||
249 | p->RIOError.Entry = Entry; | ||
250 | p->RIOError.Other = SubEnt; | ||
251 | return -ENXIO; | ||
252 | } | ||
253 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); | ||
254 | if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ | ||
255 | rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); | ||
256 | p->RIOError.Error = NAME_USED_TWICE; | ||
257 | p->RIOError.Entry = Entry; | ||
258 | p->RIOError.Other = SubEnt; | ||
259 | return -ENXIO; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | } else { /* (6) */ | ||
264 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); | ||
265 | if (MapP->ID) { | ||
266 | rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name); | ||
267 | p->RIOError.Error = HOST_ID_NOT_ZERO; | ||
268 | p->RIOError.Entry = Entry; | ||
269 | return -ENXIO; | ||
270 | } | ||
271 | if (MapP->SysPort != NO_PORT) { | ||
272 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name); | ||
273 | p->RIOError.Error = HOST_SYSPORT_BAD; | ||
274 | p->RIOError.Entry = Entry; | ||
275 | return -ENXIO; | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | |||
280 | /* | ||
281 | ** wow! if we get here then it's a goody! | ||
282 | */ | ||
283 | |||
284 | /* | ||
285 | ** Zero the (old) entries for each host... | ||
286 | */ | ||
287 | for (Host = 0; Host < RIO_HOSTS; Host++) { | ||
288 | for (Entry = 0; Entry < MAX_RUP; Entry++) { | ||
289 | memset(&p->RIOHosts[Host].Mapping[Entry], 0, sizeof(struct Map)); | ||
290 | } | ||
291 | memset(&p->RIOHosts[Host].Name[0], 0, sizeof(p->RIOHosts[Host].Name)); | ||
292 | } | ||
293 | |||
294 | /* | ||
295 | ** Copy in the new table entries | ||
296 | */ | ||
297 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { | ||
298 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); | ||
299 | MapP = &p->RIOConnectTable[Entry]; | ||
300 | |||
301 | /* | ||
302 | ** Now, if it is an empty slot ignore it! | ||
303 | */ | ||
304 | if (MapP->HostUniqueNum == 0) | ||
305 | continue; | ||
306 | |||
307 | /* | ||
308 | ** we saved the host number earlier, so grab it back | ||
309 | */ | ||
310 | HostP = &p->RIOHosts[MapP->Topology[0].Unit]; | ||
311 | |||
312 | /* | ||
313 | ** If it is a host, then we only need to fill in the name field. | ||
314 | */ | ||
315 | if (MapP->ID == 0) { | ||
316 | rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); | ||
317 | memcpy(HostP->Name, MapP->Name, MAX_NAME_LEN); | ||
318 | continue; | ||
319 | } | ||
320 | |||
321 | /* | ||
322 | ** Its an RTA entry, so fill in the host mapping entries for it | ||
323 | ** and the port mapping entries. Notice that entry zero is for | ||
324 | ** ID one. | ||
325 | */ | ||
326 | HostMapP = &HostP->Mapping[MapP->ID - 1]; | ||
327 | |||
328 | if (MapP->Flags & SLOT_IN_USE) { | ||
329 | rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); | ||
330 | /* | ||
331 | ** structure assign, then sort out the bits we shouldn't have done | ||
332 | */ | ||
333 | *HostMapP = *MapP; | ||
334 | |||
335 | HostMapP->Flags = SLOT_IN_USE; | ||
336 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
337 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
338 | |||
339 | RIOReMapPorts(p, HostP, HostMapP); | ||
340 | } else { | ||
341 | rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { | ||
346 | p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; | ||
347 | } | ||
348 | |||
349 | for (Host = 0; Host < p->RIONumHosts; Host++) { | ||
350 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { | ||
351 | p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; | ||
352 | p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; | ||
353 | } | ||
354 | for (Entry = 0; Entry < MAX_RUP; Entry++) { | ||
355 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { | ||
356 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT; | ||
357 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK; | ||
358 | } | ||
359 | } | ||
360 | if (!p->RIOHosts[Host].Name[0]) { | ||
361 | memcpy(p->RIOHosts[Host].Name, "HOST 1", 7); | ||
362 | p->RIOHosts[Host].Name[5] += Host; | ||
363 | } | ||
364 | /* | ||
365 | ** Check that default name assigned is unique. | ||
366 | */ | ||
367 | Host1 = Host; | ||
368 | NameIsUnique = 0; | ||
369 | while (!NameIsUnique) { | ||
370 | NameIsUnique = 1; | ||
371 | for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) { | ||
372 | if (Host2 == Host) | ||
373 | continue; | ||
374 | if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) | ||
375 | == 0) { | ||
376 | NameIsUnique = 0; | ||
377 | Host1++; | ||
378 | if (Host1 >= p->RIONumHosts) | ||
379 | Host1 = 0; | ||
380 | p->RIOHosts[Host].Name[5] = '1' + Host1; | ||
381 | } | ||
382 | } | ||
383 | } | ||
384 | /* | ||
385 | ** Rename host if name already used. | ||
386 | */ | ||
387 | if (Host1 != Host) { | ||
388 | rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); | ||
389 | memcpy(p->RIOHosts[Host].Name, "HOST 1", 7); | ||
390 | p->RIOHosts[Host].Name[5] += Host1; | ||
391 | } | ||
392 | rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); | ||
393 | } | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | /* | ||
398 | ** User process needs the config table - build it from first | ||
399 | ** principles. | ||
400 | ** | ||
401 | * FIXME: SMP locking | ||
402 | */ | ||
403 | int RIOApel(struct rio_info *p) | ||
404 | { | ||
405 | int Host; | ||
406 | int link; | ||
407 | int Rup; | ||
408 | int Next = 0; | ||
409 | struct Map *MapP; | ||
410 | struct Host *HostP; | ||
411 | unsigned long flags; | ||
412 | |||
413 | rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); | ||
414 | |||
415 | memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES); | ||
416 | |||
417 | for (Host = 0; Host < RIO_HOSTS; Host++) { | ||
418 | rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host); | ||
419 | HostP = &p->RIOHosts[Host]; | ||
420 | rio_spin_lock_irqsave(&HostP->HostLock, flags); | ||
421 | |||
422 | MapP = &p->RIOConnectTable[Next++]; | ||
423 | MapP->HostUniqueNum = HostP->UniqueNum; | ||
424 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
425 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | ||
426 | continue; | ||
427 | } | ||
428 | MapP->RtaUniqueNum = 0; | ||
429 | MapP->ID = 0; | ||
430 | MapP->Flags = SLOT_IN_USE; | ||
431 | MapP->SysPort = NO_PORT; | ||
432 | for (link = 0; link < LINKS_PER_UNIT; link++) | ||
433 | MapP->Topology[link] = HostP->Topology[link]; | ||
434 | memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN); | ||
435 | for (Rup = 0; Rup < MAX_RUP; Rup++) { | ||
436 | if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) { | ||
437 | p->RIOConnectTable[Next] = HostP->Mapping[Rup]; | ||
438 | if (HostP->Mapping[Rup].Flags & SLOT_IN_USE) | ||
439 | p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; | ||
440 | if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) | ||
441 | p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; | ||
442 | if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT) | ||
443 | p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; | ||
444 | Next++; | ||
445 | } | ||
446 | } | ||
447 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | ||
448 | } | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | /* | ||
453 | ** config.rio has taken a dislike to one of the gross maps entries. | ||
454 | ** if the entry is suitably inactive, then we can gob on it and remove | ||
455 | ** it from the table. | ||
456 | */ | ||
457 | int RIODeleteRta(struct rio_info *p, struct Map *MapP) | ||
458 | { | ||
459 | int host, entry, port, link; | ||
460 | int SysPort; | ||
461 | struct Host *HostP; | ||
462 | struct Map *HostMapP; | ||
463 | struct Port *PortP; | ||
464 | int work_done = 0; | ||
465 | unsigned long lock_flags, sem_flags; | ||
466 | |||
467 | rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum); | ||
468 | |||
469 | for (host = 0; host < p->RIONumHosts; host++) { | ||
470 | HostP = &p->RIOHosts[host]; | ||
471 | |||
472 | rio_spin_lock_irqsave(&HostP->HostLock, lock_flags); | ||
473 | |||
474 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
475 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); | ||
476 | continue; | ||
477 | } | ||
478 | |||
479 | for (entry = 0; entry < MAX_RUP; entry++) { | ||
480 | if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) { | ||
481 | HostMapP = &HostP->Mapping[entry]; | ||
482 | rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name); | ||
483 | |||
484 | /* | ||
485 | ** Check all four links of the unit are disconnected | ||
486 | */ | ||
487 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
488 | if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) { | ||
489 | rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); | ||
490 | p->RIOError.Error = UNIT_IS_IN_USE; | ||
491 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); | ||
492 | return -EBUSY; | ||
493 | } | ||
494 | } | ||
495 | /* | ||
496 | ** Slot has been allocated, BUT not booted/routed/ | ||
497 | ** connected/selected or anything else-ed | ||
498 | */ | ||
499 | SysPort = HostMapP->SysPort; | ||
500 | |||
501 | if (SysPort != NO_PORT) { | ||
502 | for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) { | ||
503 | PortP = p->RIOPortp[port]; | ||
504 | rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n"); | ||
505 | |||
506 | rio_spin_lock_irqsave(&PortP->portSem, sem_flags); | ||
507 | |||
508 | PortP->Mapped = 0; | ||
509 | |||
510 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
511 | |||
512 | rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n"); | ||
513 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | ||
514 | /* What should I do | ||
515 | wakeup( &PortP->TxBufferIn ); | ||
516 | wakeup( &PortP->TxBufferOut); | ||
517 | */ | ||
518 | PortP->InUse = NOT_INUSE; | ||
519 | /* What should I do | ||
520 | wakeup( &PortP->InUse ); | ||
521 | signal(PortP->TtyP->t_pgrp,SIGKILL); | ||
522 | ttyflush(PortP->TtyP,(FREAD|FWRITE)); | ||
523 | */ | ||
524 | PortP->State |= RIO_CLOSING | RIO_DELETED; | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | ** For the second slot of a 16 port RTA, the | ||
529 | ** driver needs to reset the changes made to | ||
530 | ** the phb to port mappings in RIORouteRup. | ||
531 | */ | ||
532 | if (PortP->SecondBlock) { | ||
533 | u16 dest_unit = HostMapP->ID; | ||
534 | u16 dest_port = port - SysPort; | ||
535 | u16 __iomem *TxPktP; | ||
536 | struct PKT __iomem *Pkt; | ||
537 | |||
538 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { | ||
539 | /* | ||
540 | ** *TxPktP is the pointer to the | ||
541 | ** transmit packet on the host card. | ||
542 | ** This needs to be translated into | ||
543 | ** a 32 bit pointer so it can be | ||
544 | ** accessed from the driver. | ||
545 | */ | ||
546 | Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&*TxPktP)); | ||
547 | 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); | ||
548 | writew(dest_unit, &Pkt->dest_unit); | ||
549 | writew(dest_port, &Pkt->dest_port); | ||
550 | } | ||
551 | 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); | ||
552 | writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); | ||
553 | } | ||
554 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); | ||
555 | } | ||
556 | } | ||
557 | rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n"); | ||
558 | memset(HostMapP, 0, sizeof(struct Map)); | ||
559 | work_done++; | ||
560 | } | ||
561 | } | ||
562 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); | ||
563 | } | ||
564 | |||
565 | /* XXXXX lock me up */ | ||
566 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { | ||
567 | if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { | ||
568 | memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map)); | ||
569 | work_done++; | ||
570 | } | ||
571 | if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { | ||
572 | memset(&p->RIOConnectTable[entry], 0, sizeof(struct Map)); | ||
573 | work_done++; | ||
574 | } | ||
575 | } | ||
576 | if (work_done) | ||
577 | return 0; | ||
578 | |||
579 | rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); | ||
580 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
581 | return -ENXIO; | ||
582 | } | ||
583 | |||
584 | int RIOAssignRta(struct rio_info *p, struct Map *MapP) | ||
585 | { | ||
586 | int host; | ||
587 | struct Map *HostMapP; | ||
588 | char *sptr; | ||
589 | int link; | ||
590 | |||
591 | |||
592 | 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); | ||
593 | |||
594 | if ((MapP->ID != (u16) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { | ||
595 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | ||
596 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | ||
597 | return -EINVAL; | ||
598 | } | ||
599 | if (MapP->RtaUniqueNum == 0) { | ||
600 | rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); | ||
601 | p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; | ||
602 | return -EINVAL; | ||
603 | } | ||
604 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { | ||
605 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA); | ||
606 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | ||
607 | return -EINVAL; | ||
608 | } | ||
609 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { | ||
610 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort); | ||
611 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | ||
612 | return -EINVAL; | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | ** Copy the name across to the map entry. | ||
617 | */ | ||
618 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; | ||
619 | sptr = MapP->Name; | ||
620 | while (*sptr) { | ||
621 | if (*sptr < ' ' || *sptr > '~') { | ||
622 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | ||
623 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | ||
624 | return -EINVAL; | ||
625 | } | ||
626 | sptr++; | ||
627 | } | ||
628 | |||
629 | for (host = 0; host < p->RIONumHosts; host++) { | ||
630 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { | ||
631 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { | ||
632 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
633 | return -ENXIO; | ||
634 | } | ||
635 | |||
636 | /* | ||
637 | ** Now we have a host we need to allocate an ID | ||
638 | ** if the entry does not already have one. | ||
639 | */ | ||
640 | if (MapP->ID == (u16) - 1) { | ||
641 | int nNewID; | ||
642 | |||
643 | rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name); | ||
644 | /* | ||
645 | ** The idea here is to allow RTA's to be assigned | ||
646 | ** before they actually appear on the network. | ||
647 | ** This allows the addition of RTA's without having | ||
648 | ** to plug them in. | ||
649 | ** What we do is: | ||
650 | ** - Find a free ID and allocate it to the RTA. | ||
651 | ** - If this map entry is the second half of a | ||
652 | ** 16 port entry then find the other half and | ||
653 | ** make sure the 2 cross reference each other. | ||
654 | */ | ||
655 | if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) { | ||
656 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
657 | return -EBUSY; | ||
658 | } | ||
659 | MapP->ID = (u16) nNewID + 1; | ||
660 | rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); | ||
661 | HostMapP = &p->RIOHosts[host].Mapping[nNewID]; | ||
662 | HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; | ||
663 | HostMapP->HostUniqueNum = MapP->HostUniqueNum; | ||
664 | HostMapP->ID = MapP->ID; | ||
665 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
666 | HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; | ||
667 | HostMapP->Topology[link].Link = NO_LINK; | ||
668 | } | ||
669 | if (MapP->Flags & RTA16_SECOND_SLOT) { | ||
670 | int unit; | ||
671 | |||
672 | for (unit = 0; unit < MAX_RUP; unit++) | ||
673 | if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum) | ||
674 | break; | ||
675 | if (unit == MAX_RUP) { | ||
676 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
677 | return -EBUSY; | ||
678 | } | ||
679 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
680 | HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; | ||
681 | p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; | ||
682 | rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID); | ||
683 | } | ||
684 | } | ||
685 | |||
686 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; | ||
687 | |||
688 | if (HostMapP->Flags & SLOT_IN_USE) { | ||
689 | rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); | ||
690 | p->RIOError.Error = ID_ALREADY_IN_USE; | ||
691 | return -EBUSY; | ||
692 | } | ||
693 | |||
694 | /* | ||
695 | ** Assign the sys ports and the name, and mark the slot as | ||
696 | ** being in use. | ||
697 | */ | ||
698 | HostMapP->SysPort = MapP->SysPort; | ||
699 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) | ||
700 | memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN); | ||
701 | HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; | ||
702 | #ifdef NEED_TO_FIX | ||
703 | RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]); | ||
704 | #endif | ||
705 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
706 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
707 | |||
708 | RIOReMapPorts(p, &p->RIOHosts[host], HostMapP); | ||
709 | /* | ||
710 | ** Adjust 2nd block of 8 phbs | ||
711 | */ | ||
712 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
713 | RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); | ||
714 | |||
715 | if (HostMapP->SysPort != NO_PORT) { | ||
716 | if (HostMapP->SysPort < p->RIOFirstPortsBooted) | ||
717 | p->RIOFirstPortsBooted = HostMapP->SysPort; | ||
718 | if (HostMapP->SysPort > p->RIOLastPortsBooted) | ||
719 | p->RIOLastPortsBooted = HostMapP->SysPort; | ||
720 | } | ||
721 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
722 | rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); | ||
723 | else | ||
724 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); | ||
725 | return 0; | ||
726 | } | ||
727 | } | ||
728 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | ||
729 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | ||
730 | return -ENXIO; | ||
731 | } | ||
732 | |||
733 | |||
734 | int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP) | ||
735 | { | ||
736 | struct Port *PortP; | ||
737 | unsigned int SubEnt; | ||
738 | unsigned int HostPort; | ||
739 | unsigned int SysPort; | ||
740 | u16 RtaType; | ||
741 | unsigned long flags; | ||
742 | |||
743 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); | ||
744 | |||
745 | /* | ||
746 | ** We need to tell the UnixRups which sysport the rup corresponds to | ||
747 | */ | ||
748 | HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort; | ||
749 | |||
750 | if (HostMapP->SysPort == NO_PORT) | ||
751 | return (0); | ||
752 | |||
753 | RtaType = GetUnitType(HostMapP->RtaUniqueNum); | ||
754 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1); | ||
755 | |||
756 | /* | ||
757 | ** now map each of its eight ports | ||
758 | */ | ||
759 | for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) { | ||
760 | rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort); | ||
761 | SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */ | ||
762 | /* portnumber on host */ | ||
763 | |||
764 | HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt; | ||
765 | |||
766 | rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); | ||
767 | PortP = p->RIOPortp[SysPort]; | ||
768 | rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); | ||
769 | |||
770 | /* | ||
771 | ** Point at all the real neat data structures | ||
772 | */ | ||
773 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
774 | PortP->HostP = HostP; | ||
775 | PortP->Caddr = HostP->Caddr; | ||
776 | |||
777 | /* | ||
778 | ** The PhbP cannot be filled in yet | ||
779 | ** unless the host has been booted | ||
780 | */ | ||
781 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { | ||
782 | struct PHB __iomem *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; | ||
783 | PortP->TxAdd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add)); | ||
784 | PortP->TxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start)); | ||
785 | PortP->TxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end)); | ||
786 | PortP->RxRemove = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove)); | ||
787 | PortP->RxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start)); | ||
788 | PortP->RxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end)); | ||
789 | } else | ||
790 | PortP->PhbP = NULL; | ||
791 | |||
792 | /* | ||
793 | ** port related flags | ||
794 | */ | ||
795 | PortP->HostPort = HostPort; | ||
796 | /* | ||
797 | ** For each part of a 16 port RTA, RupNum is ID - 1. | ||
798 | */ | ||
799 | PortP->RupNum = HostMapP->ID - 1; | ||
800 | if (HostMapP->Flags & RTA16_SECOND_SLOT) { | ||
801 | PortP->ID2 = HostMapP->ID2 - 1; | ||
802 | PortP->SecondBlock = 1; | ||
803 | } else { | ||
804 | PortP->ID2 = 0; | ||
805 | PortP->SecondBlock = 0; | ||
806 | } | ||
807 | PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; | ||
808 | |||
809 | /* | ||
810 | ** If the port was already mapped then thats all we need to do. | ||
811 | */ | ||
812 | if (PortP->Mapped) { | ||
813 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
814 | continue; | ||
815 | } else | ||
816 | HostMapP->Flags &= ~RTA_NEWBOOT; | ||
817 | |||
818 | PortP->State = 0; | ||
819 | PortP->Config = 0; | ||
820 | /* | ||
821 | ** Check out the module type - if it is special (read only etc.) | ||
822 | ** then we need to set flags in the PortP->Config. | ||
823 | ** Note: For 16 port RTA, all ports are of the same type. | ||
824 | */ | ||
825 | if (RtaType == TYPE_RTA16) { | ||
826 | PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE]; | ||
827 | } else { | ||
828 | if (SubEnt < PORTS_PER_MODULE) | ||
829 | PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
830 | else | ||
831 | PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | ** more port related flags | ||
836 | */ | ||
837 | PortP->PortState = 0; | ||
838 | PortP->ModemLines = 0; | ||
839 | PortP->ModemState = 0; | ||
840 | PortP->CookMode = COOK_WELL; | ||
841 | PortP->ParamSem = 0; | ||
842 | PortP->FlushCmdBodge = 0; | ||
843 | PortP->WflushFlag = 0; | ||
844 | PortP->MagicFlags = 0; | ||
845 | PortP->Lock = 0; | ||
846 | PortP->Store = 0; | ||
847 | PortP->FirstOpen = 1; | ||
848 | |||
849 | /* | ||
850 | ** Buffers 'n things | ||
851 | */ | ||
852 | PortP->RxDataStart = 0; | ||
853 | PortP->Cor2Copy = 0; | ||
854 | PortP->Name = &HostMapP->Name[0]; | ||
855 | PortP->statsGather = 0; | ||
856 | PortP->txchars = 0; | ||
857 | PortP->rxchars = 0; | ||
858 | PortP->opens = 0; | ||
859 | PortP->closes = 0; | ||
860 | PortP->ioctls = 0; | ||
861 | if (PortP->TxRingBuffer) | ||
862 | memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); | ||
863 | else if (p->RIOBufferSize) { | ||
864 | PortP->TxRingBuffer = kzalloc(p->RIOBufferSize, GFP_KERNEL); | ||
865 | } | ||
866 | PortP->TxBufferOut = 0; | ||
867 | PortP->TxBufferIn = 0; | ||
868 | PortP->Debug = 0; | ||
869 | /* | ||
870 | ** LastRxTgl stores the state of the rx toggle bit for this | ||
871 | ** port, to be compared with the state of the next pkt received. | ||
872 | ** If the same, we have received the same rx pkt from the RTA | ||
873 | ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. | ||
874 | */ | ||
875 | PortP->LastRxTgl = ~(u8) PHB_RX_TGL; | ||
876 | |||
877 | /* | ||
878 | ** and mark the port as usable | ||
879 | */ | ||
880 | PortP->Mapped = 1; | ||
881 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
882 | } | ||
883 | if (HostMapP->SysPort < p->RIOFirstPortsMapped) | ||
884 | p->RIOFirstPortsMapped = HostMapP->SysPort; | ||
885 | if (HostMapP->SysPort > p->RIOLastPortsMapped) | ||
886 | p->RIOLastPortsMapped = HostMapP->SysPort; | ||
887 | |||
888 | return 0; | ||
889 | } | ||
890 | |||
891 | int RIOChangeName(struct rio_info *p, struct Map *MapP) | ||
892 | { | ||
893 | int host; | ||
894 | struct Map *HostMapP; | ||
895 | char *sptr; | ||
896 | |||
897 | 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); | ||
898 | |||
899 | if (MapP->ID > MAX_RUP) { | ||
900 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | ||
901 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | ||
902 | return -EINVAL; | ||
903 | } | ||
904 | |||
905 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; | ||
906 | sptr = MapP->Name; | ||
907 | |||
908 | while (*sptr) { | ||
909 | if (*sptr < ' ' || *sptr > '~') { | ||
910 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | ||
911 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | ||
912 | return -EINVAL; | ||
913 | } | ||
914 | sptr++; | ||
915 | } | ||
916 | |||
917 | for (host = 0; host < p->RIONumHosts; host++) { | ||
918 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { | ||
919 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { | ||
920 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
921 | return -ENXIO; | ||
922 | } | ||
923 | if (MapP->ID == 0) { | ||
924 | memcpy(p->RIOHosts[host].Name, MapP->Name, MAX_NAME_LEN); | ||
925 | return 0; | ||
926 | } | ||
927 | |||
928 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; | ||
929 | |||
930 | if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) { | ||
931 | p->RIOError.Error = RTA_NUMBER_WRONG; | ||
932 | return -ENXIO; | ||
933 | } | ||
934 | memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN); | ||
935 | return 0; | ||
936 | } | ||
937 | } | ||
938 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | ||
939 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | ||
940 | return -ENXIO; | ||
941 | } | ||
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c deleted file mode 100644 index 8a90393faf3c..000000000000 --- a/drivers/char/rio/riotty.c +++ /dev/null | |||
@@ -1,654 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : riotty.c | ||
24 | ** SID : 1.3 | ||
25 | ** Last Modified : 11/6/98 10:33:47 | ||
26 | ** Retrieved : 11/6/98 10:33:50 | ||
27 | ** | ||
28 | ** ident @(#)riotty.c 1.3 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #define __EXPLICIT_DEF_H__ | ||
34 | |||
35 | #include <linux/module.h> | ||
36 | #include <linux/sched.h> | ||
37 | #include <linux/errno.h> | ||
38 | #include <linux/tty.h> | ||
39 | #include <linux/string.h> | ||
40 | #include <asm/io.h> | ||
41 | #include <asm/system.h> | ||
42 | #include <asm/string.h> | ||
43 | #include <asm/uaccess.h> | ||
44 | |||
45 | #include <linux/termios.h> | ||
46 | |||
47 | #include <linux/serial.h> | ||
48 | |||
49 | #include <linux/generic_serial.h> | ||
50 | |||
51 | |||
52 | #include "linux_compat.h" | ||
53 | #include "rio_linux.h" | ||
54 | #include "pkt.h" | ||
55 | #include "daemon.h" | ||
56 | #include "rio.h" | ||
57 | #include "riospace.h" | ||
58 | #include "cmdpkt.h" | ||
59 | #include "map.h" | ||
60 | #include "rup.h" | ||
61 | #include "port.h" | ||
62 | #include "riodrvr.h" | ||
63 | #include "rioinfo.h" | ||
64 | #include "func.h" | ||
65 | #include "errors.h" | ||
66 | #include "pci.h" | ||
67 | |||
68 | #include "parmmap.h" | ||
69 | #include "unixrup.h" | ||
70 | #include "board.h" | ||
71 | #include "host.h" | ||
72 | #include "phb.h" | ||
73 | #include "link.h" | ||
74 | #include "cmdblk.h" | ||
75 | #include "route.h" | ||
76 | #include "cirrus.h" | ||
77 | #include "rioioctl.h" | ||
78 | #include "param.h" | ||
79 | |||
80 | static void RIOClearUp(struct Port *PortP); | ||
81 | |||
82 | /* Below belongs in func.h */ | ||
83 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); | ||
84 | |||
85 | |||
86 | extern struct rio_info *p; | ||
87 | |||
88 | |||
89 | int riotopen(struct tty_struct *tty, struct file *filp) | ||
90 | { | ||
91 | unsigned int SysPort; | ||
92 | int repeat_this = 250; | ||
93 | struct Port *PortP; /* pointer to the port structure */ | ||
94 | unsigned long flags; | ||
95 | int retval = 0; | ||
96 | |||
97 | func_enter(); | ||
98 | |||
99 | /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close | ||
100 | is going to oops. | ||
101 | */ | ||
102 | tty->driver_data = NULL; | ||
103 | |||
104 | SysPort = rio_minor(tty); | ||
105 | |||
106 | if (p->RIOFailed) { | ||
107 | rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); | ||
108 | func_exit(); | ||
109 | return -ENXIO; | ||
110 | } | ||
111 | |||
112 | rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (mapped:%d)\n", SysPort, p->RIOPortp[SysPort]->Mapped); | ||
113 | |||
114 | /* | ||
115 | ** Validate that we have received a legitimate request. | ||
116 | ** Currently, just check that we are opening a port on | ||
117 | ** a host card that actually exists, and that the port | ||
118 | ** has been mapped onto a host. | ||
119 | */ | ||
120 | if (SysPort >= RIO_PORTS) { /* out of range ? */ | ||
121 | rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort); | ||
122 | func_exit(); | ||
123 | return -ENXIO; | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | ** Grab pointer to the port stucture | ||
128 | */ | ||
129 | PortP = p->RIOPortp[SysPort]; /* Get control struc */ | ||
130 | rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP); | ||
131 | if (!PortP->Mapped) { /* we aren't mapped yet! */ | ||
132 | /* | ||
133 | ** The system doesn't know which RTA this port | ||
134 | ** corresponds to. | ||
135 | */ | ||
136 | rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n"); | ||
137 | func_exit(); | ||
138 | return -ENXIO; | ||
139 | } | ||
140 | |||
141 | tty->driver_data = PortP; | ||
142 | |||
143 | PortP->gs.port.tty = tty; | ||
144 | PortP->gs.port.count++; | ||
145 | |||
146 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); | ||
147 | |||
148 | retval = gs_init_port(&PortP->gs); | ||
149 | if (retval) { | ||
150 | PortP->gs.port.count--; | ||
151 | return -ENXIO; | ||
152 | } | ||
153 | /* | ||
154 | ** If the host hasn't been booted yet, then | ||
155 | ** fail | ||
156 | */ | ||
157 | if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
158 | rio_dprintk(RIO_DEBUG_TTY, "Host not running\n"); | ||
159 | func_exit(); | ||
160 | return -ENXIO; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | ** If the RTA has not booted yet and the user has choosen to block | ||
165 | ** until the RTA is present then we must spin here waiting for | ||
166 | ** the RTA to boot. | ||
167 | */ | ||
168 | /* I find the above code a bit hairy. I find the below code | ||
169 | easier to read and shorter. Now, if it works too that would | ||
170 | be great... -- REW | ||
171 | */ | ||
172 | rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); | ||
173 | while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { | ||
174 | if (!PortP->WaitUntilBooted) { | ||
175 | rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); | ||
176 | func_exit(); | ||
177 | return -ENXIO; | ||
178 | } | ||
179 | |||
180 | /* Under Linux you'd normally use a wait instead of this | ||
181 | busy-waiting. I'll stick with the old implementation for | ||
182 | now. --REW | ||
183 | */ | ||
184 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
185 | rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); | ||
186 | func_exit(); | ||
187 | return -EINTR; | ||
188 | } | ||
189 | if (repeat_this-- <= 0) { | ||
190 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); | ||
191 | func_exit(); | ||
192 | return -EIO; | ||
193 | } | ||
194 | } | ||
195 | rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); | ||
196 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
197 | if (p->RIOHalted) { | ||
198 | goto bombout; | ||
199 | } | ||
200 | |||
201 | /* | ||
202 | ** If the port is in the final throws of being closed, | ||
203 | ** we should wait here (politely), waiting | ||
204 | ** for it to finish, so that it doesn't close us! | ||
205 | */ | ||
206 | while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) { | ||
207 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); | ||
208 | if (repeat_this-- <= 0) { | ||
209 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | ||
210 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
211 | retval = -EINTR; | ||
212 | goto bombout; | ||
213 | } | ||
214 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
215 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
216 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
217 | retval = -EINTR; | ||
218 | goto bombout; | ||
219 | } | ||
220 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
221 | } | ||
222 | |||
223 | if (!PortP->Mapped) { | ||
224 | rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n"); | ||
225 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
226 | retval = -ENXIO; | ||
227 | func_exit(); | ||
228 | return retval; | ||
229 | } | ||
230 | |||
231 | if (p->RIOHalted) { | ||
232 | goto bombout; | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | ** 15.10.1998 ARG - ESIL 0761 part fix | ||
237 | ** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure, | ||
238 | ** we need to make sure that the flags are clear when the port is opened. | ||
239 | */ | ||
240 | /* Uh? Suppose I turn these on and then another process opens | ||
241 | the port again? The flags get cleared! Not good. -- REW */ | ||
242 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | ||
243 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); | ||
244 | } | ||
245 | |||
246 | if (!(PortP->firstOpen)) { /* First time ? */ | ||
247 | rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n"); | ||
248 | |||
249 | |||
250 | PortP->firstOpen++; | ||
251 | PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ | ||
252 | PortP->InUse = NOT_INUSE; | ||
253 | |||
254 | /* Tentative fix for bug PR27. Didn't work. */ | ||
255 | /* PortP->gs.xmit_cnt = 0; */ | ||
256 | |||
257 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
258 | |||
259 | /* Someone explain to me why this delay/config is | ||
260 | here. If I read the docs correctly the "open" | ||
261 | command piggybacks the parameters immediately. | ||
262 | -- REW */ | ||
263 | RIOParam(PortP, RIOC_OPEN, 1, OK_TO_SLEEP); /* Open the port */ | ||
264 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
265 | |||
266 | /* | ||
267 | ** wait for the port to be not closed. | ||
268 | */ | ||
269 | while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) { | ||
270 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState); | ||
271 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
272 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
273 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); | ||
274 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
275 | func_exit(); | ||
276 | return -EINTR; | ||
277 | } | ||
278 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
279 | } | ||
280 | |||
281 | if (p->RIOHalted) { | ||
282 | retval = -EIO; | ||
283 | bombout: | ||
284 | /* RIOClearUp( PortP ); */ | ||
285 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
286 | return retval; | ||
287 | } | ||
288 | rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); | ||
289 | } | ||
290 | rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); | ||
291 | /* | ||
292 | ** ACTION | ||
293 | ** insert test for carrier here. -- ??? | ||
294 | ** I already see that test here. What's the deal? -- REW | ||
295 | */ | ||
296 | if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) || | ||
297 | (PortP->ModemState & RIOC_MSVR1_CD)) { | ||
298 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); | ||
299 | /* | ||
300 | tp->tm.c_state |= CARR_ON; | ||
301 | wakeup((caddr_t) &tp->tm.c_canq); | ||
302 | */ | ||
303 | PortP->State |= RIO_CARR_ON; | ||
304 | wake_up_interruptible(&PortP->gs.port.open_wait); | ||
305 | } else { /* no carrier - wait for DCD */ | ||
306 | /* | ||
307 | while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) && | ||
308 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) | ||
309 | */ | ||
310 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { | ||
311 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); | ||
312 | /* | ||
313 | PortP->gs.port.tty->termios->c_state |= WOPEN; | ||
314 | */ | ||
315 | PortP->State |= RIO_WOPEN; | ||
316 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
317 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
318 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
319 | /* | ||
320 | ** ACTION: verify that this is a good thing | ||
321 | ** to do here. -- ??? | ||
322 | ** I think it's OK. -- REW | ||
323 | */ | ||
324 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort); | ||
325 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
326 | /* | ||
327 | tp->tm.c_state &= ~WOPEN; | ||
328 | */ | ||
329 | PortP->State &= ~RIO_WOPEN; | ||
330 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
331 | func_exit(); | ||
332 | return -EINTR; | ||
333 | } | ||
334 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
335 | } | ||
336 | PortP->State &= ~RIO_WOPEN; | ||
337 | } | ||
338 | if (p->RIOHalted) | ||
339 | goto bombout; | ||
340 | rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); | ||
341 | PortP->State |= RIO_MOPEN; | ||
342 | |||
343 | if (p->RIOHalted) | ||
344 | goto bombout; | ||
345 | |||
346 | rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); | ||
347 | |||
348 | /* | ||
349 | ** Count opens for port statistics reporting | ||
350 | */ | ||
351 | if (PortP->statsGather) | ||
352 | PortP->opens++; | ||
353 | |||
354 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
355 | rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n"); | ||
356 | func_exit(); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | ** RIOClose the port. | ||
362 | ** The operating system thinks that this is last close for the device. | ||
363 | ** As there are two interfaces to the port (Modem and tty), we need to | ||
364 | ** check that both are closed before we close the device. | ||
365 | */ | ||
366 | int riotclose(void *ptr) | ||
367 | { | ||
368 | struct Port *PortP = ptr; /* pointer to the port structure */ | ||
369 | int deleted = 0; | ||
370 | int try = -1; /* Disable the timeouts by setting them to -1 */ | ||
371 | int repeat_this = -1; /* Congrats to those having 15 years of | ||
372 | uptime! (You get to break the driver.) */ | ||
373 | unsigned long end_time; | ||
374 | struct tty_struct *tty; | ||
375 | unsigned long flags; | ||
376 | int rv = 0; | ||
377 | |||
378 | rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); | ||
379 | |||
380 | /* PortP = p->RIOPortp[SysPort]; */ | ||
381 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); | ||
382 | /* tp = PortP->TtyP; *//* Get tty */ | ||
383 | tty = PortP->gs.port.tty; | ||
384 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); | ||
385 | |||
386 | if (PortP->gs.closing_wait) | ||
387 | end_time = jiffies + PortP->gs.closing_wait; | ||
388 | else | ||
389 | end_time = jiffies + MAX_SCHEDULE_TIMEOUT; | ||
390 | |||
391 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
392 | |||
393 | /* | ||
394 | ** Setting this flag will make any process trying to open | ||
395 | ** this port block until we are complete closing it. | ||
396 | */ | ||
397 | PortP->State |= RIO_CLOSING; | ||
398 | |||
399 | if ((PortP->State & RIO_DELETED)) { | ||
400 | rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n"); | ||
401 | deleted = 1; | ||
402 | } | ||
403 | |||
404 | if (p->RIOHalted) { | ||
405 | RIOClearUp(PortP); | ||
406 | rv = -EIO; | ||
407 | goto close_end; | ||
408 | } | ||
409 | |||
410 | rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n"); | ||
411 | /* | ||
412 | ** clear the open bits for this device | ||
413 | */ | ||
414 | PortP->State &= ~RIO_MOPEN; | ||
415 | PortP->State &= ~RIO_CARR_ON; | ||
416 | PortP->ModemState &= ~RIOC_MSVR1_CD; | ||
417 | /* | ||
418 | ** If the device was open as both a Modem and a tty line | ||
419 | ** then we need to wimp out here, as the port has not really | ||
420 | ** been finally closed (gee, whizz!) The test here uses the | ||
421 | ** bit for the OTHER mode of operation, to see if THAT is | ||
422 | ** still active! | ||
423 | */ | ||
424 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | ||
425 | /* | ||
426 | ** The port is still open for the other task - | ||
427 | ** return, pretending that we are still active. | ||
428 | */ | ||
429 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum); | ||
430 | PortP->State &= ~RIO_CLOSING; | ||
431 | if (PortP->firstOpen) | ||
432 | PortP->firstOpen--; | ||
433 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
434 | return -EIO; | ||
435 | } | ||
436 | |||
437 | rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n"); | ||
438 | |||
439 | PortP->State &= ~RIO_DYNOROD; | ||
440 | |||
441 | /* | ||
442 | ** This is where we wait for the port | ||
443 | ** to drain down before closing. Bye-bye.... | ||
444 | ** (We never meant to do this) | ||
445 | */ | ||
446 | rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n"); | ||
447 | |||
448 | if (!deleted) | ||
449 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) { | ||
450 | if (repeat_this-- <= 0) { | ||
451 | rv = -EINTR; | ||
452 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | ||
453 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
454 | goto close_end; | ||
455 | } | ||
456 | rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); | ||
457 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
458 | if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) { | ||
459 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | ||
460 | rv = -EINTR; | ||
461 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
462 | goto close_end; | ||
463 | } | ||
464 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
465 | } | ||
466 | |||
467 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | ||
468 | repeat_this = 0xff; | ||
469 | |||
470 | PortP->InUse = 0; | ||
471 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | ||
472 | /* | ||
473 | ** The port has been re-opened for the other task - | ||
474 | ** return, pretending that we are still active. | ||
475 | */ | ||
476 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); | ||
477 | PortP->State &= ~RIO_CLOSING; | ||
478 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
479 | if (PortP->firstOpen) | ||
480 | PortP->firstOpen--; | ||
481 | return -EIO; | ||
482 | } | ||
483 | |||
484 | if (p->RIOHalted) { | ||
485 | RIOClearUp(PortP); | ||
486 | goto close_end; | ||
487 | } | ||
488 | |||
489 | /* Can't call RIOShortCommand with the port locked. */ | ||
490 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
491 | |||
492 | if (RIOShortCommand(p, PortP, RIOC_CLOSE, 1, 0) == RIO_FAIL) { | ||
493 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
494 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
495 | goto close_end; | ||
496 | } | ||
497 | |||
498 | if (!deleted) | ||
499 | while (try && (PortP->PortState & PORT_ISOPEN)) { | ||
500 | try--; | ||
501 | if (time_after(jiffies, end_time)) { | ||
502 | rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n"); | ||
503 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
504 | break; | ||
505 | } | ||
506 | rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN); | ||
507 | |||
508 | if (p->RIOHalted) { | ||
509 | RIOClearUp(PortP); | ||
510 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
511 | goto close_end; | ||
512 | } | ||
513 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
514 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | ||
515 | RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); | ||
516 | break; | ||
517 | } | ||
518 | } | ||
519 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
520 | rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try); | ||
521 | |||
522 | /* RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); */ | ||
523 | |||
524 | /* | ||
525 | ** 15.10.1998 ARG - ESIL 0761 part fix | ||
526 | ** 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. | ||
527 | */ | ||
528 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); | ||
529 | |||
530 | /* | ||
531 | ** Count opens for port statistics reporting | ||
532 | */ | ||
533 | if (PortP->statsGather) | ||
534 | PortP->closes++; | ||
535 | |||
536 | close_end: | ||
537 | /* XXX: Why would a "DELETED" flag be reset here? I'd have | ||
538 | thought that a "deleted" flag means that the port was | ||
539 | permanently gone, but here we can make it reappear by it | ||
540 | being in close during the "deletion". | ||
541 | */ | ||
542 | PortP->State &= ~(RIO_CLOSING | RIO_DELETED); | ||
543 | if (PortP->firstOpen) | ||
544 | PortP->firstOpen--; | ||
545 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
546 | rio_dprintk(RIO_DEBUG_TTY, "Return from close\n"); | ||
547 | return rv; | ||
548 | } | ||
549 | |||
550 | |||
551 | |||
552 | static void RIOClearUp(struct Port *PortP) | ||
553 | { | ||
554 | rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n"); | ||
555 | PortP->Config = 0; /* Direct semaphore */ | ||
556 | PortP->PortState = 0; | ||
557 | PortP->firstOpen = 0; | ||
558 | PortP->FlushCmdBodge = 0; | ||
559 | PortP->ModemState = PortP->CookMode = 0; | ||
560 | PortP->Mapped = 0; | ||
561 | PortP->WflushFlag = 0; | ||
562 | PortP->MagicFlags = 0; | ||
563 | PortP->RxDataStart = 0; | ||
564 | PortP->TxBufferIn = 0; | ||
565 | PortP->TxBufferOut = 0; | ||
566 | } | ||
567 | |||
568 | /* | ||
569 | ** Put a command onto a port. | ||
570 | ** The PortPointer, command, length and arg are passed. | ||
571 | ** The len is the length *inclusive* of the command byte, | ||
572 | ** and so for a command that takes no data, len==1. | ||
573 | ** The arg is a single byte, and is only used if len==2. | ||
574 | ** Other values of len aren't allowed, and will cause | ||
575 | ** a panic. | ||
576 | */ | ||
577 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) | ||
578 | { | ||
579 | struct PKT __iomem *PacketP; | ||
580 | int retries = 20; /* at 10 per second -> 2 seconds */ | ||
581 | unsigned long flags; | ||
582 | |||
583 | rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); | ||
584 | |||
585 | if (PortP->State & RIO_DELETED) { | ||
586 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | ||
587 | return RIO_FAIL; | ||
588 | } | ||
589 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
590 | |||
591 | /* | ||
592 | ** If the port is in use for pre-emptive command, then wait for it to | ||
593 | ** be free again. | ||
594 | */ | ||
595 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) { | ||
596 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries); | ||
597 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
598 | if (retries-- <= 0) { | ||
599 | return RIO_FAIL; | ||
600 | } | ||
601 | if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
602 | return RIO_FAIL; | ||
603 | } | ||
604 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
605 | } | ||
606 | if (PortP->State & RIO_DELETED) { | ||
607 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | ||
608 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
609 | return RIO_FAIL; | ||
610 | } | ||
611 | |||
612 | while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) { | ||
613 | rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); | ||
614 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
615 | if (retries-- <= 0) { | ||
616 | rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n"); | ||
617 | return RIO_FAIL; | ||
618 | } | ||
619 | if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) { | ||
620 | return RIO_FAIL; | ||
621 | } | ||
622 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
623 | } | ||
624 | |||
625 | if (p->RIOHalted) { | ||
626 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
627 | return RIO_FAIL; | ||
628 | } | ||
629 | |||
630 | /* | ||
631 | ** set the command byte and the argument byte | ||
632 | */ | ||
633 | writeb(command, &PacketP->data[0]); | ||
634 | |||
635 | if (len == 2) | ||
636 | writeb(arg, &PacketP->data[1]); | ||
637 | |||
638 | /* | ||
639 | ** set the length of the packet and set the command bit. | ||
640 | */ | ||
641 | writeb(PKT_CMD_BIT | len, &PacketP->len); | ||
642 | |||
643 | add_transmit(PortP); | ||
644 | /* | ||
645 | ** Count characters transmitted for port statistics reporting | ||
646 | */ | ||
647 | if (PortP->statsGather) | ||
648 | PortP->txchars += len; | ||
649 | |||
650 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
651 | return p->RIOHalted ? RIO_FAIL : ~RIO_FAIL; | ||
652 | } | ||
653 | |||
654 | |||
diff --git a/drivers/char/rio/route.h b/drivers/char/rio/route.h deleted file mode 100644 index 46e963771c30..000000000000 --- a/drivers/char/rio/route.h +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* R O U T E H E A D E R | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra / Jeremy Rolls | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _route_h | ||
38 | #define _route_h | ||
39 | |||
40 | #define MAX_LINKS 4 | ||
41 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ | ||
42 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for | ||
43 | 1 bit per node */ | ||
44 | #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete | ||
45 | info about cost etc. */ | ||
46 | #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE) | ||
47 | /* Number of nodes we can squeeze | ||
48 | into one packet */ | ||
49 | #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1) | ||
50 | /************************************************ | ||
51 | * Define the types of command for the ROUTE RUP. | ||
52 | ************************************************/ | ||
53 | #define ROUTE_REQUEST 0 /* Request an ID */ | ||
54 | #define ROUTE_FOAD 1 /* Kill the RTA */ | ||
55 | #define ROUTE_ALREADY 2 /* ID given already */ | ||
56 | #define ROUTE_USED 3 /* All ID's used */ | ||
57 | #define ROUTE_ALLOCATE 4 /* Here it is */ | ||
58 | #define ROUTE_REQ_TOP 5 /* I bet you didn't expect.... | ||
59 | the Topological Inquisition */ | ||
60 | #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */ | ||
61 | /******************************************************************* | ||
62 | * Define the Route Map Structure | ||
63 | * | ||
64 | * The route map gives a pointer to a Link Structure to use. | ||
65 | * This allows Disconnected Links to be checked quickly | ||
66 | ******************************************************************/ | ||
67 | typedef struct COST_ROUTE COST_ROUTE; | ||
68 | struct COST_ROUTE { | ||
69 | unsigned char cost; /* Cost down this link */ | ||
70 | unsigned char route[NODE_BYTES]; /* Nodes through this route */ | ||
71 | }; | ||
72 | |||
73 | typedef struct ROUTE_STR ROUTE_STR; | ||
74 | struct ROUTE_STR { | ||
75 | COST_ROUTE cost_route[MAX_LINKS]; | ||
76 | /* cost / route for this link */ | ||
77 | ushort favoured; /* favoured link */ | ||
78 | }; | ||
79 | |||
80 | |||
81 | #define NO_LINK (short) 5 /* Link unattached */ | ||
82 | #define ROUTE_NO_ID (short) 100 /* No Id */ | ||
83 | #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */ | ||
84 | #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */ | ||
85 | |||
86 | |||
87 | #define SYNC_RUP (ushort) 255 | ||
88 | #define COMMAND_RUP (ushort) 254 | ||
89 | #define ERROR_RUP (ushort) 253 | ||
90 | #define POLL_RUP (ushort) 252 | ||
91 | #define BOOT_RUP (ushort) 251 | ||
92 | #define ROUTE_RUP (ushort) 250 | ||
93 | #define STATUS_RUP (ushort) 249 | ||
94 | #define POWER_RUP (ushort) 248 | ||
95 | |||
96 | #define HIGHEST_RUP (ushort) 255 /* Set to Top one */ | ||
97 | #define LOWEST_RUP (ushort) 248 /* Set to bottom one */ | ||
98 | |||
99 | #endif | ||
100 | |||
101 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/rup.h b/drivers/char/rio/rup.h deleted file mode 100644 index 4ae90cb207a9..000000000000 --- a/drivers/char/rio/rup.h +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ******* ******* | ||
3 | ******* R U P S T R U C T U R E | ||
4 | ******* ******* | ||
5 | **************************************************************************** | ||
6 | |||
7 | Author : Ian Nandhra | ||
8 | Date : | ||
9 | |||
10 | * | ||
11 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | |||
27 | Version : 0.01 | ||
28 | |||
29 | |||
30 | Mods | ||
31 | ---------------------------------------------------------------------------- | ||
32 | Date By Description | ||
33 | ---------------------------------------------------------------------------- | ||
34 | |||
35 | ***************************************************************************/ | ||
36 | |||
37 | #ifndef _rup_h | ||
38 | #define _rup_h 1 | ||
39 | |||
40 | #define MAX_RUP ((short) 16) | ||
41 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ | ||
42 | |||
43 | /************************************************* | ||
44 | * Define all the packet request stuff | ||
45 | ************************************************/ | ||
46 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ | ||
47 | #define TX_PACKET_READY 1 /* Transmit packet ready */ | ||
48 | #define TX_LOCK_RUP 2 /* Transmit side locked */ | ||
49 | |||
50 | #define RX_RUP_INACTIVE 0 /* Nothing received */ | ||
51 | #define RX_PACKET_READY 1 /* Packet received */ | ||
52 | |||
53 | #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ | ||
54 | |||
55 | struct RUP { | ||
56 | u16 txpkt; /* Outgoing packet */ | ||
57 | u16 rxpkt; /* Incoming packet */ | ||
58 | u16 link; /* Which link to send down? */ | ||
59 | u8 rup_dest_unit[2]; /* Destination unit */ | ||
60 | u16 handshake; /* For handshaking */ | ||
61 | u16 timeout; /* Timeout */ | ||
62 | u16 status; /* Status */ | ||
63 | u16 txcontrol; /* Transmit control */ | ||
64 | u16 rxcontrol; /* Receive control */ | ||
65 | }; | ||
66 | |||
67 | #endif | ||
68 | |||
69 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h deleted file mode 100644 index 7abf0cba0f2c..000000000000 --- a/drivers/char/rio/unixrup.h +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* | ||
2 | ** ----------------------------------------------------------------------------- | ||
3 | ** | ||
4 | ** Perle Specialix driver for Linux | ||
5 | ** Ported from existing RIO Driver for SCO sources. | ||
6 | * | ||
7 | * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | ** | ||
23 | ** Module : unixrup.h | ||
24 | ** SID : 1.2 | ||
25 | ** Last Modified : 11/6/98 11:34:20 | ||
26 | ** Retrieved : 11/6/98 11:34:22 | ||
27 | ** | ||
28 | ** ident @(#)unixrup.h 1.2 | ||
29 | ** | ||
30 | ** ----------------------------------------------------------------------------- | ||
31 | */ | ||
32 | |||
33 | #ifndef __rio_unixrup_h__ | ||
34 | #define __rio_unixrup_h__ | ||
35 | |||
36 | /* | ||
37 | ** UnixRup data structure. This contains pointers to actual RUPs on the | ||
38 | ** host card, and all the command/boot control stuff. | ||
39 | */ | ||
40 | struct UnixRup { | ||
41 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ | ||
42 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ | ||
43 | struct RUP __iomem *RupP; /* the Rup to send it to */ | ||
44 | unsigned int Id; /* Id number */ | ||
45 | unsigned int BaseSysPort; /* SysPort of first tty on this RTA */ | ||
46 | unsigned int ModTypes; /* Modules on this RTA */ | ||
47 | spinlock_t RupLock; /* Lock structure for MPX */ | ||
48 | /* struct lockb RupLock; *//* Lock structure for MPX */ | ||
49 | }; | ||
50 | |||
51 | #endif /* __rio_unixrup_h__ */ | ||